vllm.v1.attention.ops.turboquant_soa.triton_turboquant_store
¶
Fused Triton kernels for TurboQuant KV store.
Two kernels: 1. _tq_fused_store_fp8: FP8 key scatter + value uniform quantization. 2. _tq_fused_store_mse: Fused binary-search bucketize + MSE index packing + value quantization.
The launcher triton_turboquant_store selects the appropriate kernel.
Functions:
-
triton_turboquant_store–Launch TQ store kernel (FP8 or MSE path).
_store_quantized_value(Value_ptr, KV_cache_ptr, KV_cache_u16_ptr, base, data_base, vscale_u16_addr, vzero_u16_addr, d_offs, d_mask, D, V_DATA_OFFSET, VQB, VAL_DATA_BYTES, BLOCK_D, BLOCK_VAL, BLOCK_GRP)
¶
Uniform quantization of values to VQB bits, pack, and store with scale/zero in the per-block SoA metadata region (Opt#3 layout).
_tq_fused_store_fp8(Key_ptr, Value_ptr, KV_cache_ptr, KV_cache_u16_ptr, Slot_mapping_ptr, stride_cache_block, D, H, BLOCK_SIZE, BLOCK_D, KEY_DATA_BYTES, VAL_DATA_BYTES, META_REGION_OFFSET, NUM_SOA_FIELDS, SOA_V_SCALE, SOA_V_ZERO, VQB, BLOCK_VAL, BLOCK_GRP=16, FP8_E4B15=0)
¶
FP8 key cast+scatter + value uniform quantization (SoA layout).
_tq_fused_store_mse(Y_ptr, Norms_ptr, Value_ptr, Midpoints_ptr, Centroids_ptr, KV_cache_ptr, KV_cache_u16_ptr, Slot_mapping_ptr, stride_cache_block, D, H, BLOCK_SIZE, BLOCK_D, MSE_BYTES, VAL_DATA_BYTES, META_REGION_OFFSET, NUM_SOA_FIELDS, SOA_K_NORM, SOA_V_SCALE, SOA_V_ZERO, VQB, BLOCK_VAL, MSE_BITS, N_CENTROIDS, NORM_CORRECTION=0, BLOCK_GRP=16)
¶
Fused MSE quantize + pack + SoA-metadata store (Opt#3 layout).
Binary-search bucketize → MSE-index pack → K-norm store (SoA) → value uniform quantize + pack → V scale/zero store (SoA), in one kernel.
triton_turboquant_store(key, value, kv_cache, slot_mapping, PiT, midpoints, mse_bits, key_packed_size, value_quant_bits, key_fp8=False, centroids=None, norm_correction=False)
¶
Launch TQ store kernel (FP8 or MSE path).
When norm_correction=True (default off; set by MSE norm-correction
presets), the centroid-vector norm ||c_t|| is folded into the stored
per-token scalar at store time (stored value = ||k_t|| / ||c_t||). The
load-side attention kernel no longer computes per-tile sum+sqrt+divide,
saving ~26% of TQ overhead on gpt-oss decode (ctx=4096). centroids
must be provided in this mode.