Skip to content

vllm.v1.attention.ops.ultraquant.triton_unified_attention

Unified Triton fallback for the UltraQuant 4-bit KV-cache format.

K and V use packed FP4 E2M1 values with UE8M0 group-of-32 scales. QK uses native scaled FP4×E4M3 MFMA on CDNA4. Production choices are fixed in code; there are no environment-variable tuning switches.

Functions:

_get_pit(dim, device, dtype)

Sylvester Hadamard projection / sqrt(dim). PiT = PiT.T (symmetric).

_ultraquant_fp4_decode_arith(codes)

Arithmetic FP4 E2M1 decode, bit-exact to format.FP4_BITS_TO_VALUE.

_ultraquant_load_k_packed(KV_cache_ptr, data_bases, k_scales_addrs, d_half_offs, half_mask, tile_mask, BLOCK_D, HEAD_DIM, GROUP_SIZE_C, N_GROUPS_C, TILE_SIZE, UNMASKED)

Load packed FP4 K codes and UE8M0 scales for scaled QK MFMA.

_ultraquant_load_v_tile(KV_cache_ptr, val_bases, v_scales_addrs, d_offs, d_mask, tile_mask, OUT_DTYPE, HEAD_DIM, BLOCK_D, GROUP_SIZE_C, N_GROUPS_C, TILE_SIZE, UNMASKED, UE8M0_BIAS_C)

Load and dequant a V tile with arithmetic FP4 decode.

ultraquant_unified_attention(query, kv_cache, block_table, seq_lens, query_start_loc, scale, PiT=None, output=None, tile_size=None, max_query_len=None, max_seq_len=None, num_kv_splits=None, force_2d=False, sinks=None, sliding_window=None)

Launch unified UltraQuant attention with scaled F8F6F4 MFMA.