Expand description
Host-side dequantization of paged KV cache blocks → BF16.
Used by --high-speed-swap Phase 6.2.c to produce BF16 source data for
the orchestrator’s tile-streaming attention kernel from any of Atlas’s
quantized KV layouts. The kernel-side packing/scale layouts mirrored
here:
| Quant | data bytes/elem | scale | LUT | source kernel |
|---|---|---|---|---|
| BF16 | 2 | none | identity | (direct copy, not in this module) |
| FP8 | 1 (E4M3) | tensor | e4m3_lut | reshape_and_cache_fp8.cu |
| NVFP4 | 0.5 (4-bit) | group | NVFP4_E2M1_LUT | paged_decode_attn_nvfp4.cu |
| Turbo4 | 0.5 (4-bit) | group | TURBO4_LUT (Lloyd-Max 16) | paged_decode_attn_turbo4.cu |
| Turbo3 | 0.375 (3-bit) | group | TURBO3_LUT (Lloyd-Max 8) | paged_decode_attn_turbo3.cu |
| Turbo8 | 1 (E4M3) | group | e4m3_lut | paged_decode_attn_turbo8.cu |
“Group” scales cover 16 elements per scale byte (NVFP4_GROUP_SIZE) and
are stored in a separate section after the data section within each
block. All LUTs match their CUDA-side counterparts byte-for-byte.
Constants§
- NVFP4_
E2M1_ LUT - E2M1 4-bit codebook (NVFP4). Matches
kernels/gb10/common/paged_decode_attn_nvfp4.cu:118. - NVFP4_
GROUP_ SIZE - Group size for per-group FP8 scales. Matches
NVFP4_GROUP_SIZEin the per-quant attention kernels. - TURB
O3_ LUT - Turbo3 8-level Lloyd-Max codebook. Matches
kernels/gb10/common/paged_decode_attn_turbo3.cu:137. - TURB
O4_ LUT - Turbo4 16-level Lloyd-Max codebook. Matches
kernels/gb10/common/paged_decode_attn_turbo4.cu:121.
Functions§
- dequant_
4bit_ block_ to_ bf16 - Dequant a 4-bit packed (NVFP4 or Turbo4) KV block to BF16.
- dequant_
fp8_ to_ bf16 - Dequant FP8 (E4M3) bytes to BF16, applying a per-tensor scale.
- dequant_
turbo3_ block_ to_ bf16 - Dequant a Turbo3 (3-bit packed) KV block to BF16.
- dequant_
turbo8_ block_ to_ bf16 - Dequant a Turbo8 (FP8 E4M3 data + per-group BF16 scales) KV block to BF16.
- e4m3_
lut - Borrow the compile-time table.