Module nvfp4
Expand description
NVFP4 (E2M1) unpacking and dequantization engine (Work Package F9).
Implements zero-heap unpacking for NVIDIA NVFP4 weights (E2M1 floating point, packed 2 per byte) with FP8 block scales (per 16 elements) and global tensor scales. Designed for Ampere (Compute Capability 8.6, RTX A2000) execution without requiring native FP4 tensor cores.
Enums§
- Nvfp4
Error - Error conditions during NVFP4 unpacking.
Constants§
- E2M1_
TABLE - Standard E2M1 FP4 lookup table (16 entries: 1 sign, 2 exp, 1 mantissa).
- NVFP4_
BLOCK_ SIZE - NVFP4 block size: each scale factor governs 16 weights (8 packed bytes).
- NVFP4_
BYTES_ PER_ BLOCK
Functions§
- dequantize_
nvfp4_ block - Dequantize a single 16-element block of NVFP4 weights.
- dequantize_
nvfp4_ row - Dequantize a row of packed NVFP4 weights into caller-supplied
out_row. - fp8_
e4m3_ to_ f32 - Convert an FP8 E4M3 byte to f32.
- nvfp4_
gemv_ zero_ heap - Compute Matrix-Vector multiplication $y = A \cdot x$ where $A$ is in NVFP4 format.