Skip to main content

Module nvfp4

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§

Nvfp4Error
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.