Skip to content

[Fix] dp-attention: Align prefill graph buckets and decode padding across DP ranks - #46138

Merged
ispobock merged 8 commits into
mainfrom
dp-prefill-graph-bucket
Oct 25, 2026
Merged

ispobock merged 8 commits into
mainfrom
dp-prefill-graph-bucket

Conversation

@ispobock

@ispobock ispobock commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Two DP-attention padding changes:

  • With breakable prefill CUDA graphs, every DP rank pads to the same captured token bucket. An idle rank keeps the padded shape for the collectives; a backend that opts in also skips its attention metadata there.
  • Decode picks SUM_LEN padding, one TP all-reduce of the summed rows, when the gather spans several ranks, every rank has tokens, the summed buffer fits the CustomAllReduceV2 buffer, and there is no MoE all-to-all or speculative decoding. Otherwise the existing cost-based choice applies.

Changes to existing code

  • forward_batch_info: global_num_tokens is rounded up to the smallest captured prefill bucket on every rank.
  • DpPaddingMode: decode selects SUM_LEN under the condition above, both eagerly and in get_default_mode_in_cuda_graph, which now receives the captured per-rank token counts.
  • AttentionBackend.skips_prefill_metadata_on_idle_dp_rank (default False): when a backend sets it, PrefillCudaGraphRunner skips init_forward_metadata and the read snapshot on a rank with no real tokens. No existing backend sets it, so their replay is unchanged.

The prefill change affects every model that uses DP attention with breakable prefill graphs; the decode padding change affects DP-attention decode without idle ranks.

Verification

  • test_dp_attention, test_dsa_backend_dp_padding (an idle rank still selects MAX_LEN), test_runtime_context, test_prefill_cuda_graph_padding, test_prefill_cuda_graph_runner, test_prefill_cuda_graph_runner_helpers, test_prefill_shared_read_done
  • TODO: DP-attention serving on an existing DP model, with breakable prefill graphs and with decode CUDA graphs.

Cut byte-for-byte from #45925 (MiniMax-M3.1-Flash support) at 10e655a.


CI States

Latest PR Test (Base): ✅ Run #40160842644
Latest PR Test (Extra): ✅ Run #40160842552
Latest PR Test (AMD ROCm 10): ⏳ Run #40160842664

@github-actions

This comment has been minimized.

@ispobock

Copy link
Copy Markdown
Collaborator Author

/rerun-test test/registered/unit/layers/test_dp_attention.py test/registered/unit/layers/attention/test_dsa_backend_dp_padding.py test/registered/unit/model_executor/runner/test_prefill_cuda_graph_padding.py test/registered/unit/model_executor/test_prefill_cuda_graph_runner.py test/registered/unit/model_executor/test_prefill_cuda_graph_runner_helpers.py

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

🚀 ubuntu-latest (5 tests): ❌ View workflow run

cd test/ && python3 registered/unit/layers/test_dp_attention.py
cd test/ && python3 registered/unit/layers/attention/test_dsa_backend_dp_padding.py
cd test/ && python3 registered/unit/model_executor/runner/test_prefill_cuda_graph_padding.py
cd test/ && python3 registered/unit/model_executor/test_prefill_cuda_graph_runner.py
cd test/ && python3 registered/unit/model_executor/test_prefill_cuda_graph_runner_helpers.py

ispobock and others added 2 commits October 24, 2026 01:51
Co-authored-by: Chunan Zeng <zcnrex@gmail.com>
Co-authored-by: Chunan Zeng <zcnrex@gmail.com>
Co-authored-by: Denji-kk <51020465+Denji-kk@users.noreply.github.com>
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

🚀 ubuntu-latest (5 tests): ❌ View workflow run

cd test/ && python3 registered/unit/layers/test_dp_attention.py
cd test/ && python3 registered/unit/layers/attention/test_dsa_backend_dp_padding.py
cd test/ && python3 registered/unit/model_executor/runner/test_prefill_cuda_graph_padding.py
cd test/ && python3 registered/unit/model_executor/test_prefill_cuda_graph_runner.py
cd test/ && python3 registered/unit/model_executor/test_prefill_cuda_graph_runner_helpers.py

@ispobock

Copy link
Copy Markdown
Collaborator Author

/rerun-test test/registered/unit/layers/test_dp_attention.py test/registered/unit/layers/attention/test_dsa_backend_dp_padding.py test/registered/unit/model_executor/runner/test_prefill_cuda_graph_padding.py test/registered/unit/model_executor/test_prefill_cuda_graph_runner.py test/registered/unit/model_executor/test_prefill_cuda_graph_runner_helpers.py

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

🚀 ubuntu-latest (5 tests): ❌ View workflow run

cd test/ && python3 registered/unit/layers/test_dp_attention.py
cd test/ && python3 registered/unit/layers/attention/test_dsa_backend_dp_padding.py
cd test/ && python3 registered/unit/model_executor/runner/test_prefill_cuda_graph_padding.py
cd test/ && python3 registered/unit/model_executor/test_prefill_cuda_graph_runner.py
cd test/ && python3 registered/unit/model_executor/test_prefill_cuda_graph_runner_helpers.py

@ispobock

Copy link
Copy Markdown
Collaborator Author

/rerun-test test/registered/unit/layers/test_dp_attention.py test/registered/unit/layers/attention/test_dsa_backend_dp_padding.py test/registered/unit/model_executor/runner/test_prefill_cuda_graph_padding.py test/registered/unit/model_executor/test_prefill_cuda_graph_runner.py test/registered/unit/model_executor/test_prefill_cuda_graph_runner_helpers.py

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

🚀 ubuntu-latest (5 tests): ✅ View workflow run

cd test/ && python3 registered/unit/layers/test_dp_attention.py
cd test/ && python3 registered/unit/layers/attention/test_dsa_backend_dp_padding.py
cd test/ && python3 registered/unit/model_executor/runner/test_prefill_cuda_graph_padding.py
cd test/ && python3 registered/unit/model_executor/test_prefill_cuda_graph_runner.py
cd test/ && python3 registered/unit/model_executor/test_prefill_cuda_graph_runner_helpers.py

@ispobock

Copy link
Copy Markdown
Collaborator Author

/rerun-test test/registered/unit/layers/test_dp_attention.py test/registered/unit/layers/attention/test_dsa_backend_dp_padding.py test/registered/unit/test_runtime_context.py test/registered/unit/model_executor/runner/test_prefill_cuda_graph_padding.py test/registered/unit/model_executor/test_prefill_cuda_graph_runner.py test/registered/unit/model_executor/test_prefill_cuda_graph_runner_helpers.py test/registered/unit/model_executor/runner/test_prefill_shared_read_done.py

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🚀 ubuntu-latest (7 tests): ✅ View workflow run

cd test/ && python3 registered/unit/layers/test_dp_attention.py
cd test/ && python3 registered/unit/layers/attention/test_dsa_backend_dp_padding.py
cd test/ && python3 registered/unit/test_runtime_context.py
cd test/ && python3 registered/unit/model_executor/runner/test_prefill_cuda_graph_padding.py
cd test/ && python3 registered/unit/model_executor/test_prefill_cuda_graph_runner.py
cd test/ && python3 registered/unit/model_executor/test_prefill_cuda_graph_runner_helpers.py
cd test/ && python3 registered/unit/model_executor/runner/test_prefill_shared_read_done.py

@mintlify

mintlify Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
sglang-doc 🟢 Ready View Preview Oct 25, 2026, 4:13 AM

💡 Tip: Enable Automations to automatically generate PRs for you.

# Conflicts:
#	python/sglang/srt/layers/layer_boundary/fusions/custom_all_reduce_fusion.py
#	test/registered/unit/layer_boundary/test_custom_all_reduce_fusion.py
@ispobock

Copy link
Copy Markdown
Collaborator Author

/run-full-ci

@github-actions github-actions Bot added run-ci CI: run the baseline test suite on this PR run-ci-extra CI: also run the extra suite (requires run-ci) labels Oct 25, 2026
@ispobock

Copy link
Copy Markdown
Collaborator Author

cc @yuxwei @ch-wan

@ispobock
ispobock merged commit 9b230c1 into main Oct 25, 2026
304 of 331 checks passed
@ispobock
ispobock deleted the dp-prefill-graph-bucket branch October 25, 2026 08:50
@ispobock ispobock mentioned this pull request Oct 27, 2026
13 tasks done

This branch was successfully deployed

1 active deployment
staging - docs — acf31996 Deployed Oct 25, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-ci CI: run the baseline test suite on this PR run-ci-extra CI: also run the extra suite (requires run-ci)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant