Expand description
The intermediate representation (IR) of ruxla: a static SSA form like JAX’s jaxpr, with typed abstract values.
§Examples
use ruxla_ir::{AVal, DType, Function, Var};
let x = Var::new(AVal::new([2], DType::F32));
let f = Function { invars: vec![x.clone()], outvars: vec![x.into()], ..Function::default() };
f.check().unwrap();
assert_eq!(f.to_string(), "{ lambda ; a:f32[2]. let\n in (a,) }");Modules§
- ad
- The interface for automatic differentiation.
- batching
- The interface for batching primitives (
vmap). - callback
- Host callbacks: Rust functions on host arrays that programs call
(
host_callback, as JAX’spure_callback), so that native code that cannot be written generically runs inside traced programs. - lowering
- The interface for lowering primitives to StableHLO.
- serialize
- A binary serialization of functions.
Structs§
- AVal
- An abstract value: the element type and shape of an array.
- Conv
Dims - The dimension numbers of a convolution, as JAX’s
ConvDimensionNumbers: each spec lists dimensions of an operand or of the result. - DotDims
- The dimensions that
dot_generalcontracts and batches over. The result has the batch dimensions, then the free dimensions of the left operand, then those of the right operand. - Eqn
- An equation: applies a primitive to operands and defines variables.
- Function
- A function of the IR (a closed jaxpr).
- Gather
Dims - StableHLO’s gather dimension numbers; the index vector is the last dimension of the indices, as in JAX.
- Host
Array - An array in host memory: a typed buffer and a shape.
- Literal
- A scalar constant used directly as an operand.
- Prim
- A handle to a primitive, compared by name.
- Scatter
Dims - StableHLO’s scatter dimension numbers; the index vector is the last dimension of the indices, as in JAX.
- Shape
- The dimension sizes of an array, in row-major order.
- Var
- A variable: a unique id and an abstract value.
Enums§
- Atom
- An operand: a variable or a literal.
- DType
- The element type of a value.
- DType
Kind - The kind of an element type.
- Eigh
Implementation - The algorithm of
eigh(JAX’sEighImplementation). - Error
- Errors found in the IR or while evaluating it.
- FftType
- The kind of a Fourier transform (
lax.FftType). - Gather
Scatter Mode - How
gatherandscattertreat out-of-bounds indices. - Params
- The parameters of an equation, one variant per family of primitives.
- Precision
- The precision of matrix multiplication on accelerators.
- Rounding
Method - How
roundrounds halfway cases. - Select
Prim - The comparison that
select_and_scatter_addandselect_and_gather_addselect elements with (JAX’sselect_prim). - SvdAlgorithm
- The algorithm of
svd(JAX’sSvdAlgorithm). - Value
- A value of any element type, widened without loss: the common form through which conversions go.
Traits§
- Element
- A Rust type that is an element type of ruxla. It is implemented for
bool, the integer types,f16,bf16,f32,f64,c64, andc128. - EvalCx
- Evaluates nested functions, for primitives that contain functions.
- Primitive
- A primitive: the smallest unit that carries rules for every transformation and backend.