Skip to main content

Crate ferric_core

Crate ferric_core 

Source
Expand description

Ferric core — L0 (portable device/fabric abstraction) + L1 (kernel dispatch), on wgpu.

wgpu gives us one API over WebGPU (browser), Vulkan, Metal, DX12, and GL. This crate wraps it into a tiny Context and the first real kernel (matmul), written ONCE in WGSL and run on any fabric. The same source compiles to native (Metal/Vulkan/DX12) and to wasm32 for the browser. Numerics are validated against a plain-Rust CPU reference so “runs everywhere” also means “computes the same everywhere”.

Modules§

cpu
Plain-Rust CPU references — the source of truth every kernel is validated against.
demo
A small, deterministic Llama/SmolVLA-style demo LM — the SAME pure-Rust forward pass running on any fabric. Weights are pseudo-random but fixed, so the result is reproducible and the GPU output can be checked against the CPU reference in the same process (native OR browser WebGPU).

Structs§

Context
A compute context bound to one GPU adapter on whatever fabric is available.
Tensor
An f32 tensor living in GPU memory. Ops chain Tensor→Tensor with no host readback until to_vec, so a whole model runs on-device — this is the L2/L3 substrate (the graph executor works on these).

Functions§

matmul_cpu
Plain-Rust CPU reference (the source of truth for validation).
max_abs_diff
Max absolute difference between two equal-length vectors.

Type Aliases§

Result