vllm.models.deepseek_v4.xpu.xpu_sparse_decode_fp8
¶
XPU sparse decode for DeepSeek V4 with FP8 KV cache.
Strategy: dequantize FP8 UE8M0 KV cache pages to BF16 on the fly, then reuse the BF16 sparse MLA attention kernel (xpu_sparse_mla_bf16). This keeps the external KV cache layout identical to CUDA/ROCm.
Functions:
-
dequant_gather_slots–Dequantize FP8 UE8M0 pages at scattered slot indices into bf16.
-
xpu_sparse_decode_fp8–XPU decode: dequant FP8 pages to BF16, then BF16 sparse MLA attention.
_dequant_gather_slots_kernel(out_ptr, cache_ptr, indices_ptr, cache_block_size, token_data_size, block_stride, fp8_dim, bf16_dim, scale_dim, quant_block, output_dim, n_quant_blocks)
¶
Dequantize scattered FP8 slots into a flat BF16 workspace.
Grid: [total_slots] — one program per slot to gather.
Cache block layout (block_size tokens): [0, block_size576): Token data, each token 448 FP8 + 128 BF16 [block_size576, block_size576 + block_size8): Scales
Source code in vllm/models/deepseek_v4/xpu/xpu_sparse_decode_fp8.py
dequant_gather_slots(out, cache, indices, cache_block_size)
¶
Dequantize FP8 UE8M0 pages at scattered slot indices into bf16.
Source code in vllm/models/deepseek_v4/xpu/xpu_sparse_decode_fp8.py
xpu_sparse_decode_fp8(q, kv_cache, swa_kv_cache, swa_only, topk_indices, topk_lens, swa_indices, swa_lens, attn_sink, softmax_scale, head_dim, nope_head_dim, rope_head_dim, out)
¶
XPU decode: dequant FP8 pages to BF16, then BF16 sparse MLA attention.
Keeps external FP8 KV cache layout identical to CUDA/ROCm. Performance is slower due to on-the-fly dequant, but correctness is guaranteed by reusing the validated BF16 attention kernel.
Source code in vllm/models/deepseek_v4/xpu/xpu_sparse_decode_fp8.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | |