Expand description
fuel-tensor — Fuel’s user-facing Tensor handle and Device
abstraction, moved here from fuel-core (board #109; CireSnave:
“Move Tensor into fuel-tensor. We can worry about a semantic split
later.”). This is a MECHANICAL move – every item below kept its own
content; only the crate boundary changed. fuel-core’s own
lib.rs re-exports these same paths so existing
fuel_tensor::lazy::Tensor / fuel::Tensor call sites keep compiling.
The moved cluster (lazy, device, the 3 GPU backend bridges,
dtype’s WithDType/IntDType/FloatDType trio, pipelined_bridge,
judge, factories, planner, decode_shape, lazy_latent_cache,
test_utils, scheduling, inference_context,
kv_block_pool_device, persistent_decode, nf4) moved together in
one PR because it is one mutually-referencing graph, not several
independent files that happen to touch Tensor – measured via a
full crate::-reference census before any file moved, not assumed
from file names. See docs/release-0.13.0-wave.md.
use fuel_tensor::lazy::{Tensor, realize_many_f32};
use fuel_tensor::Device;
let dev = Device::cpu();
let a = Tensor::from_f32((0..6).map(|x| x as f32).collect::<Vec<_>>(), (2, 3), &dev)?;
let b = Tensor::from_f32_on(a.graph(), (0..12).map(|x| x as f32).collect::<Vec<_>>(), (3, 4), &dev)?;
let c = a.matmul(&b)?;
assert_eq!(c.shape().dims(), &[2, 4]);
let out = realize_many_f32(&[&c]);
assert_eq!(out[0].len(), 8);Re-exports§
pub use device::Device;pub use device::NdArray;pub use dtype::FloatDType;pub use dtype::IntDType;pub use dtype::WithDType;
Modules§
- cuda_
backend - Thin re-export layer for CUDA backend types, plus the bridge that turns
a [
fuel_cuda_backend::CudaDevice] into acrate::Device. - decode_
shape - The identity a held decode plan is baked against.
- device
- Device abstraction for CPU, CUDA, and Metal backends.
- dtype
- Types for elements that can be stored and manipulated using tensors.
- factories
- Backend factory registry — Step 12 of the backend-agnostic refactor.
- inference_
context - Persistent inference state for the pipelined executor (Phase 7.6 step 9c, sub-phase E.3.0).
- judge
- The Judge — Phase 6b’s empirical profiler.
- kv_
block_ pool_ device - Device-backed KV block pool — the thin integration layer that binds the pure
KvBlockPoolhost-side allocator to real deviceStorage(multi-session serving, Increment 2, Part 2). - lazy
- Phase 6a bridge: a lazy-computation-graph tensor that wraps
fuel_graph::NodeHandleand presents it through an API compatible with fuel-core’s eagerTensor. - lazy_
latent_ cache LatentCache— a general N-slot decode cache backed byTensor, the structural generalization of [fuel_transformers::models::lazy_kv_cache:: LazyKvCache] that unblocks latent / pruned KV compression.- metal_
backend - Thin re-export layer for Metal backend types, plus the bridge that turns
a [
fuel_metal_backend::MetalDevice] into acrate::Device. - nf4
- bitsandbytes NF4 weight materialization helpers.
- persistent_
decode - The shared persistent-decode rebind driver (GAP-029 increment 2b).
- pipelined_
bridge - Bridge from fuel-core’s user-facing
Tensor::realize_*API to fuel-storage’sPipelinedExecutor(Phase 7.6 step 9c, sub-phases E.1 + E.2). - planner
- Load-time planning driver.
- reproducibility
- Strict reproducibility mode (ROADMAP item 13(b)).
- scheduling
- Orchestrator for the Phase 6b probe → judge → dispatch pipeline.
- test_
utils - Test helpers. The eager-
Tensorhelpers (test_device!,assert_tensor_eq,to_vec{0,1,2,3}_round) were removed in B6; what remains is host-slice and lazy infrastructure that the lazy_* port tests use.
Macros§
- bail
- Returns early from a function with a formatted error message.
Structs§
- Layout
- Describes the memory layout of a tensor: shape, strides, and start offset.
- Shape
- A shape represents the dimensions of a tensor.
- Storage
- Owns a typed contiguous buffer on one device. The boxed
DynBackendStorageis the actual byte holder;Storageis a thin wrapper that gives the eager-dispatch op methods (matmul, conv, unary, binary, …) somewhere to live.
Enums§
- D
- Dimension indexing from the right (end) of a shape.
- DType
- The different types of elements allowed in tensors.
- DType
Parse Error - Error returned when a string cannot be parsed as a
DType. - Device
Location - Identifies a physical device location (CPU or a specific GPU).
- Error
- The main error type for the fuel library.
- Host
Buffer - Host-addressable tensor storage holding a typed vector of elements.
Traits§
- Context
- Attach more context to an error.