vllm.models.deepseek_v41.nvidia.specialized_decode.attention.step
¶
The attention of a specialized decode step.
AttentionStep runs one DeepseekV4FlashInferMLAAttention layer through
the layer's own modules and kernels, in a different schedule and with
low-batch kernels where they apply:
fused_wqa_wkvreads the MXFP8 layer input the fused all-reduce + mHC wrote instead of quantizing it again; up toLOW_BATCH_MAX_ROWSrows it,wq_bandwo_brun on the low-latency MXFP8 GEMM (mxfp8).- The side projections (compressor
kv_score, indexer weights) join their side streams at their first reader rather than before the query path, and the indexer inputs are built on side streams: the indexer query onceqris ready and the index key right after the compressor. - Up to
LOW_BATCH_MAX_ROWSrows, the side projections and the index key'swkrun onll_bf16kernels (aux_projections), the key store readswk's FP32 output, andwo_bpublishes its output into the mailbox of the fused all-reduce that reduces it next (boundary.publishing_gemm). - Dense indexers row-shard their decode rows (
indexer.decode_rows); the candidate source starts the candidate consumers' expansion on a side stream right after its indexer, and index sources first join the side-stream sparse-index builds, which read the top-k indices they overwrite. - The sparse MLA reuses the step's sparse-index tables and runs on persistent
KV counters (
sparse_mla).
Classes:
-
AttentionStep–One attention layer of the decode step.
Functions:
-
key_weight–wkofattn's indexer when it produces MXFP4 index keys. -
side_weights–The weights of
attn's side projections.
AttentionStep
¶
One attention layer of the decode step.
Methods:
-
run–The layer's TP-partial output for input
x(quant: the same
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/attention/step.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 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 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | |
_indexer(indexer, x, index_q, index_q_scale, index_weights, step)
¶
The layer's indexer: the top-k indices (and in the candidate source, the candidate blocks) of the step.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/attention/step.py
_input_projections(x, quant, step)
¶
_run_parallel_input_projections, with the side projections left
unjoined on aux streams 0 and 1; _prepare joins each at its first
reader.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/attention/step.py
_prepare(qr, kv, qr_scale, kv_score, indexer_weights, positions, step)
¶
_prepare_and_attn up to the indexer, with the indexer inputs on
side streams.
From the moment qr is ready, aux stream 2 runs the indexer query
(wq_b, then RoPE/quantize once the weights GEMM is done) and aux
stream 0, after its kv_score GEMM, the compressor and the index
key; the current stream runs the main query and KV insertion, then the
compressed-cache insertion once the latent is ready. Returns the query
and the indexer query, its scale and weights.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/attention/step.py
_produce_k(indexer, latent, positions, step)
¶
indexer._produce_k; up to LOW_BATCH_MAX_ROWS rows, wk on
ll_bf16 and the FP32 key store.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/attention/step.py
_wo_b_low_batch(z)
¶
wo_b up to LOW_BATCH_MAX_ROWS rows: published, or on the
low-latency MXFP8 GEMM.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/attention/step.py
run(x, quant, positions, step)
¶
The layer's TP-partial output for input x (quant: the same
input as MXFP8), published when wo_b publishes.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/attention/step.py
key_weight(attn)
¶
wk of attn's indexer when it produces MXFP4 index keys.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/attention/step.py
side_weights(attn)
¶
The weights of attn's side projections.