Skip to content

Enable grouped INT8 sparse attention for four-row verification - #33546

Closed
Akshay Sonawane (apsonawane) wants to merge 1 commit into
asonawane/main-ops-sparse-attention-indexerfrom
asonawane/dflash2-s4-attention
Closed

Akshay Sonawane (apsonawane) wants to merge 1 commit into
asonawane/main-ops-sparse-attention-indexerfrom
asonawane/dflash2-s4-attention

Conversation

@apsonawane

@apsonawane Akshay Sonawane (apsonawane) commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Allow the existing grouped INT8 DynamicSparseAttention kernel to handle three- and four-row speculative verification through ORT_DSA_INT8_GROUPED_MAX_ROWS=4.

  • Preserve the default maximum of two rows and all other eligibility conditions.
  • Extend grouped-decode and vector-staging reference shapes through four rows.
  • Document the opt-in range and fresh-process test configuration.

Base and integration

Incremental PR against asonawane/main-ops-sparse-attention-indexer, not main: upstream main lacks the prerequisite operators. This is one component of the DFlash2 stack, alongside the INT2 MoE and hyperconnection tuning branches and GenAI asonawane/dflash2-device-pipeline. No model assets, binaries, benchmark/evaluation scripts, or Mobius changes are included.

Validation

  • Changed CUDA implementation and C++ reference-test translation units compile with this branch's contrib headers against the existing integration core build.
  • git diff --check passes; changed lines formatted with clang-format.
  • The original combined experimental stack passed 24 numeric reference tests. Those results are not a full clean build/numeric qualification of this rebased operator branch. Keep this PR draft pending that qualification.

Combined H200 experiment (not an individual-kernel ablation)

INT2 target + FP8 DFlash2, greedy batch one; six-run means from the previously tested private integration:

Context Decode tokens/s TTFT ms
2K 333.964 580.497
8K 342.140 2421.365
16K 339.684 5030.850
32K 336.767 10520.556

Peak sampled memory: 59.350 GiB versus 64.322 GiB old-runtime control. These are combined-stack historical measurements, not measurements of this rebased PR in isolation.

Accuracy caveat: paired HumanEval DFlash/same-S4 perturbed-draft control scored 154/164 with exact output parity. Five-problem LiveCodeBench smoke scored 2/5 versus historical MTP 3/5, including a capacity-limited regression. This stack is not yet an accuracy-qualified default.

Companion draft PRs

Add an opt-in maximum-row gate while preserving the two-row default, and extend grouped/vector-staging reference shapes through four rows.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Exact-branch CUDA numerical qualification remains pending, and automated tests do not enable the expanded grouped path.

1 open issue
What changed in this PR

Extends the existing CUDA DynamicSparseAttention grouped INT8 path to support opt-in three- and four-row speculative verification, while preserving the default two-row limit.

Changes:

  • Adds ORT_DSA_INT8_GROUPED_MAX_ROWS with a supported range of 2–4.
  • Extends grouped-decode and vector-staging reference cases through four rows.
  • Documents eligibility and fresh-process test configuration.
File Description
onnxruntime/​test/​contrib_ops/​dynamic_sparse_attention_op_test.cc Adds three- and four-row reference cases.
onnxruntime/​contrib_ops/​cuda/​bert/​dynamic_sparse_attention_impl.cu Makes the grouped INT8 row limit configurable.
docs/​contrib_ops/​cuda/​dynamic_sparse_attention.md Documents the opt-in range and testing setup.

Review effort: Balanced

"ORT_DSA_INT8_GROUPED_MAX_ROWS must be in [2, 4].");
return (parameters.sequence_length == 1 ||
(quantized_cache && parameters.sequence_length == 2)) &&
(quantized_cache && parameters.sequence_length <= max_decode_rows)) &&
@tianleiwu

Copy link
Copy Markdown
Contributor

Squashed into #33472 (asonawane/main-ops-sparse-attention-indexer). Closing this stacked PR.

Tianlei Wu (tianleiwu) added a commit that referenced this pull request Oct 23, 2026
…d_state_lengths2/3) + max_splits=32 into PR #33472

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants