Skip to content

vllm.v1.attention.ops.turboquant_soa.triton_turboquant_decode

Triton fused TurboQuant decode attention.

Decode path: Triton stage1 (split-KV tiled attention scoring + value accumulation) + stage2 (log-sum-exp reduction across splits).

Supports FP8 (E4M3) keys, 3-bit and 4-bit uniform quantized values.

Functions:

_get_layout(D, mse_bits, value_quant_bits, key_packed_size)

Get cached layout constants.

_tq_full_dequant_kv(KV_cache_ptr, KV_cache_u16_ptr, Block_table_ptr, Centroids_ptr, K_out_ptr, V_out_ptr, stride_ko_b, stride_ko_h, stride_ko_s, stride_vo_b, stride_vo_h, stride_vo_s, stride_cache_block, stride_bt_b, HEAD_DIM, BLOCK_SIZE, NUM_KV_HEADS, MSE_BYTES, VQB, VAL_DATA_BYTES, MSE_BITS, KEY_FP8, KEY_DATA_BYTES, META_REGION_OFFSET, NUM_SOA_FIELDS, SOA_K_NORM, SOA_V_SCALE, SOA_V_ZERO, BLOCK_D, NORM_CORRECTION=0, FP8_E4B15=0)

Full dequant: reconstruct K (MSE centroids * norm or FP8) and V to fp16.

Opt#3 SoA layout: data region [bs, H, KD+VD] + per-block SoA metadata.

_use_fp8_e4b15(device=0)

Return 1 if device needs fp8e4b15 (Ampere/Ada, SM < 8.9), else 0. On non-CUDA platforms (e.g. XPU), always returns 0 (use e4nv format).

triton_turboquant_decode_attention(query, kv_cache, block_table, seq_lens, Pi, centroids, scale, mse_bits, key_packed_size, value_quant_bits, key_fp8=False, norm_correction=False, PiT=None, mid_o_buf=None, output_buf=None, lse_buf=None, buf_holder=None, max_num_kv_splits=32, sinks=None)

Launch fused TQ decode attention (Triton stage1 + stage2).

Returns: output tensor [B, Hq, D] in query's dtype.