Module rwkv7

Module rwkv7 

Source
Expand description

RWKV7 model core (weights/state/kernels). High-performance RWKV7 inference kernel.

This module provides a portable SIMD RWKV7 implementation using wide so rustc/LLVM can pick the best ISA per target (x86_64, aarch64, wasm32 SIMD, or scalar fallback on non-SIMD CPUs).

§Architecture

  • Matrix/vector operations are vectorized via wide (f32x8)
  • State updates are optimized for RWKV7 head dimension N=64
  • Memory layout is cache-friendly and alignment-aware
  • No external BLAS dependencies

Structs§

Config
Model configuration.
FullAdamState
Adam moments for full-parameter RWKV online training.
LayerProfiler
Collects wall-clock timings for each transformer block.
LayerTiming
Timing data for a single transformer block.
Model
RWKV7 model.
NullProfiler
No-op profiler used by default to keep the fast path branch-free.
ScratchBuffers
Pre-allocated scratch buffers to avoid allocations in hot path.
State
Full model state.
Tensor1D
Owned 1D tensor with aligned memory.
Tensor2D
Owned 2D tensor with aligned memory (row-major).
TensorView1D
View into external f32 data (for weights).
TensorView2D
View into external f32 data (for weights), row-major.
TrainScopeMask
Train-scope mask for RWKV full-parameter online updates.
Weights
Container for all loaded RWKV7 model weights.

Traits§

ProfilerSink
Sink trait used by the model to surface per-layer timings without committing to a particular profiler implementation.