Skip to main content

Crate ferric_tensor

Crate ferric_tensor 

Source
Expand description

Ferric L2 — a general N-dimensional tensor runtime on the GPU fabric.

This is the substrate the whole ecosystem is meant to stand on: not fixed-shape, hand-fused kernels for one architecture, but a real tensor with arbitrary rank, strided views, and broadcasting, plus general elementwise ops, general reductions over any axes, and batched matmul. The transformer kernels in ferric-core become fused fast-paths of this.

Design: eager execution, tensors are Arc-shared f32 buffers described by (shape, strides, offset). Views (reshape/permute/transpose/broadcast_to) are zero-copy stride tricks; contiguous() materializes. One general strided kernel powers elementwise + broadcasting; a segmented kernel powers reductions; a batched kernel powers matmul. Validated against a strided CPU reference on general shapes (broadcasting, non-contiguous inputs, arbitrary reduction axes).

Next fabric layers (in progress): dtypes (f16/bf16/int), autograd tape for training, op fusion, and the heterogeneous scheduler.

Re-exports§

pub use autograd::Var;

Modules§

autograd
Reverse-mode automatic differentiation over the general tensor runtime — the layer that turns Ferric from an inference demo into a fabric that can train. A Var wraps a Tensor and records how to backpropagate through each op; backward() walks the graph in reverse and accumulates gradients (broadcasting-aware). Params live as plain Tensors and are re-wrapped each step, so an optimizer is just tensor arithmetic.
cpu
Plain-Rust reference on logical (row-major) data — the source of truth for the GPU tensor runtime. Operates on the same logical layout Tensor::to_vec returns, so comparisons are apples-to-apples.

Structs§

Tensor
A general N-D f32 tensor: an Arc-shared device buffer viewed through (shape, strides, offset).