vllm.models.step5.nvidia.ops.sparse_decode_attention
¶
DSA decode attention read directly from paged KV by selected regions.
Replaces gather-to-scratch plus a ragged FlashInfer call: each program takes all query heads of one KV group (GQA packing) for one split of a row's selected regions, loads the regions' pages in place (dequantizing FP8), and a combine kernel merges splits and clears inactive rows.
Functions:
-
sparse_decode_attention–Attention for (token, KV group) rows over their selected regions.
-
sparse_decode_splits–Splits per row for ~256 programs (about 1.7 waves on B300).
_gate(Gate, token, head, mask, GATED, GATE_ROW, GATE_HEAD)
¶
Headwise sigmoid gate, rounded like the unfused gate kernel (1 if off).
Source code in vllm/models/step5/nvidia/ops/sparse_decode_attention.py
sparse_decode_attention(query, cache, regions, block_table, positions, active, output, *, scale, query_len=1, splits, clear_inactive=True, k_scale=None, v_scale=None, gate=None)
¶
Attention for (token, KV group) rows over their selected regions.
With gate ([tokens, G * heads]) the headwise sigmoid gate is applied
to the output, as the separate gate kernel would.
query/output: [rows, heads, 192] with rows = tokens * G;
cache: [pages, G, block, 384] (K then V); regions: [rows, R]
region ids (-1 unused); positions/active: per row. Rows of one
request are G * query_len consecutive rows sharing a table row.
Source code in vllm/models/step5/nvidia/ops/sparse_decode_attention.py
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 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | |
sparse_decode_splits(rows)
¶
Splits per row for ~256 programs (about 1.7 waves on B300).
Graphs are captured per batch size, so the split cannot follow context length; each split still covers only the row's live regions.