vLLM TurboQuant KV 存储融合内核
该文档介绍 vLLM 中 TurboQuant KV 存储的两个 Triton 融合内核,分别走 FP8 键散写与 MSE 二分桶化路径,并由启动函数按参数选择;存储采用 SoA 元数据布局,可选范数校正把质心范数折入存储标量。
## `vllm.v1.attention.ops.turboquant_soa.triton_turboquant_store` [¶](<https://docs.vllm.ai/en/latest/api/vllm/v1/attention/ops/turboquant_soa/triton_turboquant_store/#vllm.v1.attention.ops.turboquant_soa.triton_turboquant_store>) 用于TurboQuant KV商店的Fused Triton内核. 两个内核: 1 . _tq_fused_storle_fp8: FP8 键散+值统一量化. 2. _tq_fused_storle_mse: 引信二进制搜索桶 + MSE 索引包装+值四进制. 发射装置 `triton_turboquant_store` 选择适当的内核。 函数 : - **`[triton_turboquant_store](<https://docs.vllm.ai/en/latest/api/vllm/v1/attention/ops/turboquant_soa/triton_turboquant_store/#vllm.v1.attention.ops.turboquant_soa.triton_turboquant_store.triton_turboquant_store>)`** – 推出TQ商店内核(FP8或MSE路径). ## `_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)` [¶](<https://docs.vllm.ai/en/latest/api/vllm/v1/attention/ops/turboquant_soa/triton_turboquant_store/#vllm.v1.attention.ops.turboquant_soa.triton_turboquant_store._store_quantized_value>) 将数值统一量化为VQB比特,包,并用尺度/零存储在每块SoA元数据区域(opt#3布局)中. ## `_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)` [¶](<https://docs.vllm.ai/en/latest/api/vllm/v1/attention/ops/turboquant_soa/triton_turboquant_store/#vllm.v1.attention.ops.turboquant_soa.triton_turboquant_store._tq_fused_store_fp8>) FP8 键铸+散射+值统一量化(SoA布局). ## `_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)` [¶](<https://docs.vllm.ai/en/latest/api/vllm/v1/attention/ops/turboquant_soa/triton_turboquant_store/#vllm.v1.attention.ops.turboquant_soa.triton_turboquant_store._tq_fused_store_mse>) Fused MSE 将 + pack + SoA-metadata store(opt# 3 版式)量化. 二进制搜索桶装 → MSE-index pack → K-Norm store (SoA) → 值统一量化 + 包装 → V 比例/零 商店(SoA),在一个内核中. ## `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)` [¶](<https://docs.vllm.ai/en/latest/api/vllm/v1/attention/ops/turboquant_soa/triton_turboquant_store/#vllm.v1.attention.ops.turboquant_soa.triton_turboquant_store.triton_turboquant_store>) 推出TQ商店内核(FP8或MSE路径). 何时 `norm_correction=True` (默认关闭;由 MSE 规范校正预设设定), 中间机器人-向量规范 ||c_t|| 折叠到存储时间(存储值= ||k_t|| / ||c_t||) 负载侧注意力内核不再计算每片总和+sqrt+divide,在gpt-oss解码(ctx=4096)上保存~26%的TQ高空. `centroids` 必须在此模式下提供。 11月 30, 2026 (英语).
查看原始来源