Skip to content

[Scheduler] Fix the deterministic-inference hang when a prefill chunk is shorter than its alignment - #43444

Merged
hnyls2002 merged 3 commits into
mainfrom
lsyin/deterministic-chunk-align
Oct 10, 2026
Merged

hnyls2002 merged 3 commits into
mainfrom
lsyin/deterministic-chunk-align

Conversation

@hnyls2002

@hnyls2002 hnyls2002 commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator
  • Deterministic inference truncates each prefill chunk to a multiple of an alignment (4096 by default). A per-rank chunk below it, from --chunked-prefill-size < 4096 or from DP attention splitting the chunk across ranks, truncated every chunk to zero tokens, so a prompt longer than the chunk waited in the queue forever
  • Triton: drop the alignment; align_window_kv_to_tiles pads each sliding-window KV list to an absolute multiple of 128, so a chunked prefill sums keys in the same tiles as an unchunked one (built once per forward, deterministic inference only; the attention kernel is unchanged)
  • Flashinfer and the DSA kpool alignment: a per-rank chunk shorter than the alignment fails at startup instead of hanging; decode servers are exempt
  • Deprecate SGLANG_TRITON_PREFILL_TRUNCATION_ALIGN_SIZE
  • Add test_deterministic_chunk_align.py and a chunked-vs-unchunked sliding-window case in test_triton_attention_kernels.py

No behavior change without deterministic inference. With it, triton prefill chunks are no longer aligned (chunked and unchunked outputs stay bitwise equal), and flashinfer configurations that used to hang now fail at startup.


CI States

Latest PR Test (Base): 🚫 Run #38014068588
Latest PR Test (Extra): ❌ Run #38014068370
Latest PR Test (AMD ROCm 10): ❌ Run #38014068591

… chunk is shorter than the alignment; add test
@mintlify

mintlify Bot commented Oct 9, 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 9, 2026, 11:40 PM

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

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Oct 9, 2026
@hnyls2002

Copy link
Copy Markdown
Collaborator Author

/rerun-test test_deterministic_chunk_align.py test_deterministic.py test_gemma4_swa_triton_oob_regression.py test_unified_memory_deterministic.py test_triton_attention_kernels.py

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

🚀 ubuntu-latest (1 test): ✅ View workflow run

cd test/ && python3 registered/unit/managers/test_deterministic_chunk_align.py

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

cd test/ && python3 registered/attention/test_deterministic.py
cd test/ && python3 registered/attention/test_unified_memory_deterministic.py
cd test/ && python3 registered/attention/test_triton_attention_kernels.py

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

cd test/ && python3 registered/attention/test_gemma4_swa_triton_oob_regression.py

@hnyls2002

Copy link
Copy Markdown
Collaborator Author

/tag-and-rerun-ci

@github-actions github-actions Bot added the run-ci CI: run the baseline test suite on this PR label Oct 10, 2026
@hnyls2002
hnyls2002 merged commit 465253e into main Oct 10, 2026
199 of 260 checks passed
@hnyls2002
hnyls2002 deleted the lsyin/deterministic-chunk-align branch October 10, 2026 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation 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