Expand description
Backend trait — abstraction over CPU/GPU/CUDA execution.
Each backend implements Backend::compile(graph, &CompileOptions) and
returns an ExecutableGraph. New compile knobs go in CompileOptions
rather than as new trait methods.
Modules§
Traits§
- Backend
- Backend implementation trait.
- Executable
Graph - A compiled, ready-to-execute graph on a specific backend.
Functions§
- compile
- Compile at default options (F32, no policy).
- compile_
hir - Compile HIR through the fusion-first pipeline.
- compile_
module - Compile a
GraphModulethrough the fusion-first pipeline. - compile_
with_ precision - Compile at a specific precision (default policy = none).
- narrow_
f32_ to_ bytes - Narrow a
&[f32]buffer down to the declared output dtype, returning the corresponding little-endian byte stream. Mirrors the bytes a backend that stores the native dtype would emit. Used byrun_typedto keep the byte-level output contract identical across backends. - widen_
bytes_ to_ f32 - Widen (or, for F64, narrow) a typed byte buffer to
Vec<f32>. Used byset_param_typed/run_typedoverrides on backends whose internal arena is f32-uniform (Vulkan / wgpu / CUDA / ROCm / oneAPI / TPU) so callers can hand in F16/BF16/F64 without doing the host-side cast themselves. F64 is narrowed to f32 to match the f32-uniform arena slot (SPD-manifold ops re-widen to f64 inside their CPU host-fallback, so the eigendecomposition itself stays f64). Panics on dtypes the f32 arena can’t carry.