Commit Graph
1 Commits
Author SHA1 Message Date
Niko1221 cf9d86fba1 Fused prompt experts: NVFP4 gate/up and down on the int8 kernels
NVFP4 expert blocks (64 values: four UE4M3 scales and 32 bytes of E2M1 codes) are decoded
into the fused int8 tile: the doubled E2M1 values go through the same 16-entry table path as
IQ4_NL, one scale per 16 values uses the per-16 form (two m16n8k16 products), and the UE4M3
scale is built from its bits (equal to ggml's decoder for all 256 bytes).

The per-expert weight_scale_2 values in the blob's tail are applied on the FP32 products:
s_gate and s_up before the SwiGLU, s_down as the down rows are written. The activation and H
scales stay FP32, so the small values never meet an FP16 range.

Taken for the NVFP4 / NVFP4 pair only, when STRATA_PF_FUSED is set to 1 (the build without
MMQ sets it) and STRATA_PREFILL_NVFP4 is unset or w4a8; a build with MMQ keeps MMQ w4a8
unless the switch is given. No NT = 256 or warp-specialized form.

Tests: prefill_decode_golden covers NVFP4 (ggml dequantizer oracle, 0 of 5,242,880 values
differ; digests added), nvfp4_decode_model_test (CPU model against the quant layer, all 256
scale bytes), prefill_fused_iq_test_nvfp4 (reference part with edge shapes and the timing
part; fused against its int8 model 2.2e-4 relative RMS on sm_89).
2026-11-13 21:06:35 +01:00