Compute matrix-vector multiplication where both matrix A and vector x are stored in NVFP4 format. The equation below defines conceptual dequantization semantics for correctness:
yi=ℓ=0∑K−1Adequant,iℓxdequant,ℓ.
This is equivalent to y=Adequantxdequant with:
- Adequant∈RM×K
- xdequant∈RK
- y∈RM
Input
- qa: packed NVFP4 E2M1 payload bytes for matrix A of logical shape M×K
- scalea: NVFP4 per-block FP8 scale bytes for A, logical shape M×K/16
- sf_g_a: global NVFP4 encode factor for A
- qx: packed NVFP4 E2M1 payload bytes for vector x, represented as logical shape 1×K
- scalex: NVFP4 per-block FP8 scale bytes for x, logical shape 1×K/16
- sf_g_x: global NVFP4 encode factor for x
- M, K: dimensions (K divisible by 16)
Output
- y: FP16 vector of shape M
Notes
- The reference implementation dequantizes NVFP4 inputs with FlashInfer decode semantics, then computes GEMV as
matmul in FP32 before casting to FP16 output.
- scale_a and scale_x are already in NVFP4 swizzled scale layout expected by the decode path, do not apply an additional swizzle.
Test Case Sizes
- 1024 x 1024
- 2048 x 2048
- 4096 x 4096
- 8192 x 4096
- 4096 x 8192