Skip to main content

Module lowering

Module lowering 

Source
Expand description

The interface for lowering primitives to StableHLO.

Each primitive lowers itself through LowerCx, which emits StableHLO operations in the MLIR generic form, such as %2 = "stablehlo.add"(%0, %1) : (tensor<3xf32>, tensor<3xf32>) -> tensor<3xf32>. The ruxla-stablehlo crate implements the context and assembles the operations into functions and modules.

Structs§

HloValue
A value in the StableHLO being emitted: an SSA name and its type.
Region
A region of an operation such as stablehlo.reduce or stablehlo.while.

Enums§

Platform
The kind of device the StableHLO is compiled for, where JAX lowers a primitive differently by platform (such as threefry2x32, with rolled loops on CPU and unrolled on GPU).
Target
Where the emitted StableHLO will be compiled.

Traits§

LowerCx
A context that emits StableHLO operations.

Functions§

dense_attr
Formats a host array as a dense elements attribute with its type, such as dense<"0x0000803F"> : tensor<f32>.
element_type
Returns the MLIR element type of a dtype, such as f32 or ui8.
i64_array
Formats a list of integers as a dense array attribute, such as array<i64: 0, 2>.
tensor_type
Returns the MLIR tensor type of an abstract value, such as tensor<2x3xf32>.

Type Aliases§

RegionBody
The body of a region, called with the region’s arguments and returning the values passed to its stablehlo.return.