Skip to content

[Refactor] dsv4: Keep only the two-level V4.1 indexer in the prefill graph - #45783

Merged
hnyls2002 merged 3 commits into
mainfrom
lsyin/dsv41-two-level-prefill-graph-only
Oct 22, 2026
Merged

hnyls2002 merged 3 commits into
mainfrom
lsyin/dsv41-two-level-prefill-graph-only

Conversation

@hnyls2002

@hnyls2002 hnyls2002 commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator
  • The prefill CUDA graph captures the DeepSeek-V4.1 ratio-1/2 indexer only with two-level candidates (SparseTableBackend), the path released checkpoints take on SM100: low_ratio_prefill_graph now means exactly that and absorbs _prefill_graph_two_level. Any other config runs the ratio-1/2 sources as one eager break, as SM90 already does.
  • Remove what served the other path: the captured full top-k (FullTopKIndexer.topk_prefill_captured, topk_transform_paged_torch) with its candidate-window assert, and the c1/c2 paged indexer metadata every replay built for it (full-width page tables, row chunks, DeepGEMM schedules). The captured consumer read only the index page size from that metadata, now CapturedPrefillInputs.index_page_size; refresh_for_breakable_cuda_graph_replay_ drops two_level, and PagedIndexerMetadata drops row_chunk.
  • Remove SGLANG_DSV41_TORCH_PREFILL_INDEXER, a development switch that forced the torch prefill indexer on SM100; SM90 keeps the torch indexer. HIP states low_ratio_prefill_graph = False instead of borrowing the CUDA property, which reads the CUDA backend's candidate indexer.

No behavior change for released checkpoints: DeepSeek-V4.1-Flash and DeepSeek-V4.1-Flash-1017 set candidate_topk_blocks: 2048, so SM100 already runs the two-level path and SM90 the eager break; a replay just no longer builds metadata that nothing reads. Supersedes #45073.


CI States

Latest PR Test (Base): 🚫 Run #39834530155
Latest PR Test (Extra): ❌ Run #39834530688
Latest PR Test (AMD ROCm 10): ⏳ Run #39834530160

… the captured full top-k and the torch prefill indexer switch
@hnyls2002

Copy link
Copy Markdown
Collaborator Author

/rerun-test test_deepseek_v41_flash_gb300_tp2ep2.py test_deepseek_v41_flash_gb300_dp2ep2.py test_deepseek_v41_flash_gb300_encoder_bcg.py test_deepseek_v41_flash_gb300_trtllm_bounded_bcg.py test_deepseek_v4.py test_dsv41_prefill_sparse_indexer.py test_dsv41_late_layer_tail_readers.py test_encoder_swa_replay.py test_dsv41_candidate_blocks.py test_dsv4_nonpaged_indexer.py test_dsv41_candidate_graph_variants.py test_prefill_cuda_graph_runner.py

@hnyls2002

Copy link
Copy Markdown
Collaborator Author

/tag-and-rerun-ci

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

🚀 2-gpu-gb300 (4 tests): ✅ View workflow run

cd test/ && python3 registered/e2e/models/test_deepseek_v41_flash_gb300_tp2ep2.py
cd test/ && python3 registered/e2e/models/test_deepseek_v41_flash_gb300_dp2ep2.py
cd test/ && python3 registered/e2e/models/test_deepseek_v41_flash_gb300_encoder_bcg.py
cd test/ && python3 registered/e2e/models/test_deepseek_v41_flash_gb300_trtllm_bounded_bcg.py

🚀 4-gpu-b200 (2 tests): ✅ View workflow run

cd test/ && python3 registered/attention/unittests/dsv4/test_deepseek_v4.py
cd test/ && python3 registered/kernels/ops/attention/test_dsv41_prefill_sparse_indexer.py

🚀 1-gpu-h100 (1 test): ✅ View workflow run

cd test/ && python3 registered/attention/unittests/dsv4/test_deepseek_v4.py

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

cd test/ && python3 registered/unit/layers/test_dsv41_late_layer_tail_readers.py
cd test/ && python3 registered/unit/model_executor/test_encoder_swa_replay.py
cd test/ && python3 registered/unit/layers/test_dsv41_candidate_blocks.py
cd test/ && python3 registered/unit/layers/test_dsv4_nonpaged_indexer.py
cd test/ && python3 registered/unit/layers/test_dsv41_candidate_graph_variants.py
cd test/ && python3 registered/unit/model_executor/test_prefill_cuda_graph_runner.py

@github-actions github-actions Bot added the run-ci CI: run the baseline test suite on this PR label Oct 22, 2026
…captured consumer its index page size; drop row_chunk and topk_transform_paged_torch
@hnyls2002 hnyls2002 changed the title [Refactor] dsv4: Capture the V4.1 prefill indexer only with two-level candidates [Refactor] dsv4: Keep only the two-level V4.1 indexer in the prefill graph Oct 22, 2026
@hnyls2002
hnyls2002 merged commit 0d6b283 into main Oct 22, 2026
127 of 157 checks passed
@hnyls2002
hnyls2002 deleted the lsyin/dsv41-two-level-prefill-graph-only branch October 22, 2026 19:26
At1a8 added a commit to At1a8/sglang that referenced this pull request Oct 23, 2026
Resolve the conflict with sgl-project#45783 in deepseek_v4_backend_hip_radix.py: main
removed the SGLANG_DSV41_TORCH_PREFILL_INDEXER check from the extend branch of
_low_ratio_index_topk and the PR removed the prefill CP assert next to it, so
drop both.
zcnrex added a commit to zcnrex/sglang that referenced this pull request Oct 23, 2026
Resolve conflicts with bf16 V4.1 index logits (sgl-project#44051, sgl-project#45880), grouped
verify rows (sgl-project#45251), the two-level-only prefill graph (sgl-project#45783) and KV-shard
index-K writes (sgl-project#44280): the adapter takes a logits_dtype and maps
[batch, next_n] paged queries and schedules to grouped varlen rows on SM100.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deepseek jit-kernel run-ci CI: run the baseline test suite on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant