Skip to main content

Crate ruxla_ir

Crate ruxla_ir 

Source
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’s pure_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.
ConvDims
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_general contracts 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).
GatherDims
StableHLO’s gather dimension numbers; the index vector is the last dimension of the indices, as in JAX.
HostArray
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.
ScatterDims
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.
DTypeKind
The kind of an element type.
EighImplementation
The algorithm of eigh (JAX’s EighImplementation).
Error
Errors found in the IR or while evaluating it.
FftType
The kind of a Fourier transform (lax.FftType).
GatherScatterMode
How gather and scatter treat out-of-bounds indices.
Params
The parameters of an equation, one variant per family of primitives.
Precision
The precision of matrix multiplication on accelerators.
RoundingMethod
How round rounds halfway cases.
SelectPrim
The comparison that select_and_scatter_add and select_and_gather_add select elements with (JAX’s select_prim).
SvdAlgorithm
The algorithm of svd (JAX’s SvdAlgorithm).
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, and c128.
EvalCx
Evaluates nested functions, for primitives that contain functions.
Primitive
A primitive: the smallest unit that carries rules for every transformation and backend.

Type Aliases§

Result
A specialized result type.
SrcLoc
Where in the user’s code an equation was created.