Skip to main content

Module ffi

Module ffi 

Source
Expand description

XLA FFI: calling Rust functions from compiled programs.

A program calls a handler with stablehlo.custom_call @name(...) {api_version = 4 : i32}. The handler is registered with a plugin under that name through the plugin’s FFI extension (Plugin::register_ffi_handler), and runs on the host with the device buffers of the arguments and results.

This is how ruxla runs operations that StableHLO has no operation for, such as most of linear algebra. Handlers are written with handle, which takes care of XLA’s metadata query and of the execution stages.

Structs§

FfiAttrs
The attributes of an FFI call, by name.
FfiBuffer
An argument or result buffer of an FFI call.

Enums§

FfiAttr
An attribute of an FFI call (mhlo.backend_config of the custom call).
FfiDataType
The element type of an FFI buffer, for the types handlers commonly use.
Memory
Where the buffers of an FFI call live.

Traits§

FfiElement
The element types of FfiBuffer views.

Functions§

handle⚠
Runs the body of an FFI handler.
handle_with⚠
handle with the call’s attributes, for buffers in memory.

Type Aliases§

Body
The body of a handler: the attributes, the arguments, and the results.
Handler
A typed XLA FFI handler (XLA_FFI_Handler).