Skip to main content

Module linalg

Module linalg 

Source
Expand description

ruxla’s FFI handlers for linear algebra.

The linear algebra primitives of ruxla-prims lower to stablehlo.custom_call @ruxla_<op> when compiled by PJRT from Rust. These handlers implement them with the kernels of ruxla-kernels, the same functions that the native backend and the interpreter call, so XLA computes the same bits. register_handlers registers them with a plugin: for "Host" (CPU plugins), and for "CUDA", where the buffers are copied to the host and back around each call (see Memory::Cuda).

The operands are row-major batches of matrices (f32, f64, c64, or c128), as the lowering passes them; the attributes are the primitives’ parameters.

Functions§

handler_names
The names of the custom calls that register_handlers registers (ruxla_cholesky, …).
register_handlers
Registers ruxla’s linear algebra handlers with a plugin for platform: "Host" for CPU plugins, or "CUDA" (whose handlers copy the buffers to the host and back, and the cuSOLVER handlers that compute on the device, ruxla_cusolver_*). Registering again for the same plugin and platform does nothing.