Skip to content

[DeepSeek-V4] Enable non-paged indexer by default for large prefill chunks - #30140

Merged
Fridge003 merged 1 commit into
sgl-project:mainfrom
YAMY1234:yamy1234/dsv4-nonpaged-default-on
Jul 7, 2026
Merged

[DeepSeek-V4] Enable non-paged indexer by default for large prefill chunks#30140
Fridge003 merged 1 commit into
sgl-project:mainfrom
YAMY1234:yamy1234/dsv4-nonpaged-default-on

Conversation

@YAMY1234

@YAMY1234 YAMY1234 commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

Motivation

The non-paged DeepSeek-V4 indexer improves large local prefill queries, while its fixed gather cost can regress small queries. Enable it by default only in the measured safe region.

Modifications

  • Enable the non-paged indexer by default.
  • Keep local queries below 8,192 rows on the paged path and preserve the explicit opt-out and existing fail-closed guards.
  • Add default, boundary, fallback, and fast-path unit coverage.

Accuracy Tests

This follow-up only changes the default path selection; it does not change kernel math. The non-paged path was accuracy-tested as part of #29619.

Evaluation Result
GSM8K 96.59% (1,274 / 1,319); 0 errors, 0 truncated
AIME25 clean rerun (16 repeats) pass@1 99.58% (478 / 480); pass@16 100%; majority@16 100%; 0 errors, 0 truncated

Paged/non-paged logits and top-k parity remained bit-exact on H100 and GB300 (rtol=0, atol=0). Current-head B200 unit tests passed: 5 passed, 12 subtests passed.

Speed Tests and Profiling

End-to-end serving

Real-serving tests used OSL=1 and an effective local prefill chunk of 8,192 tokens/rank. Global concurrency was 64 for 8K–64K and 16 for 128K. Each row is a four-arm OFF → default → default → OFF comparison with a 600-second measurement window per arm. Pair gain compares adjacent default/control runs; ABBA gain is their position-balanced geometric mean. The server windows were fully saturated with no cache reuse or fatal errors.

Nominal ISL Concurrency A1 OFF TPS/rank B1 default TPS/rank Pair 1 B2 default TPS/rank A2 OFF TPS/rank Pair 2 ABBA gain
8K 64 14,853.364 14,864.640 +0.076% 14,866.710 14,741.240 +0.851% +0.463%
16K 64 14,500.505 14,572.557 +0.497% 14,570.733 14,549.204 +0.148% +0.322%
32K 64 14,288.744 14,365.048 +0.534% 14,379.434 14,201.313 +1.254% +0.894%
64K 64 13,656.240 13,898.912 +1.777% 13,903.302 13,728.748 +1.271% +1.524%
128K 16 12,477.434 12,976.438 +3.999% 13,025.532 12,526.157 +3.987% +3.993%

Both serial pairs were positive at every ISL. The effect is small at 8K–16K and increases at longer contexts as the gather cost is amortized over more prefix work.

Benchmark

The table below is a kernel-level benchmark used to choose the default-path boundary. It compares paged MQA with gather + non-paged MQA on B200. Local Q is the number of query tokens handled by one rank in the current prefill forward, not the request ISL. C4 prefix rows is the compressed K length already present before that query block; one C4 row represents four raw tokens. Run 1 and Run 2 repeat the same comparison in different execution orders. Gain is (paged - gather_and_nonpaged) / paged, so a positive value means non-paged is faster.

Local Q C4 prefix rows Run 1 gain Run 2 gain Default path
1,024 0 -235.358% -243.614% Paged
1,024 2,048 -104.526% -113.013% Paged
1,024 8,192 -38.539% -43.769% Paged
1,024 32,768 +5.742% +2.691% Paged
1,024 65,536 +8.801% +8.930% Paged
1,024 125,000 +9.836% +12.322% Paged
2,048 0 -152.328% -163.805% Paged
2,048 2,048 -56.194% -61.544% Paged
2,048 8,192 +2.338% +1.016% Paged
2,048 32,768 +19.811% +19.533% Paged
2,048 65,536 +22.350% +22.966% Paged
2,048 125,000 +26.031% +29.633% Paged
4,096 0 -54.036% -56.494% Paged
4,096 2,048 -13.225% -22.011% Paged
4,096 8,192 +17.633% +15.409% Paged
4,096 32,768 +23.480% +23.361% Paged
4,096 65,536 +28.609% +29.648% Paged
4,096 125,000 +33.240% +33.782% Paged
6,144 0 -10.209% +0.617% Paged
6,144 2,048 +5.285% +4.427% Paged
6,144 8,192 +19.414% +18.322% Paged
6,144 32,768 +27.707% +26.005% Paged
6,144 65,536 +33.260% +33.393% Paged
6,144 125,000 +35.173% +34.880% Paged
7,168 0 +24.653% +13.163% Paged
7,168 2,048 +7.977% +6.099% Paged
7,168 8,192 +19.890% +18.672% Paged
7,168 32,768 +25.049% +27.483% Paged
7,168 65,536 +32.952% +32.908% Paged
7,168 125,000 +34.796% +34.590% Paged
8,192 0 +35.139% +33.015% Non-paged
8,192 2,048 +17.475% +16.672% Non-paged
8,192 8,192 +22.810% +21.668% Non-paged
8,192 32,768 +30.323% +30.513% Non-paged
8,192 65,536 +33.333% +33.151% Non-paged
8,192 125,000 +35.477% +35.197% Non-paged
10,240 0 +45.810% +44.737% Non-paged
10,240 2,048 +18.119% +17.105% Non-paged
10,240 8,192 +24.110% +23.570% Non-paged
10,240 32,768 +30.377% +33.116% Non-paged
10,240 65,536 +34.282% +34.812% Non-paged
10,240 125,000 +35.350% +35.074% Non-paged
12,288 0 +52.223% +51.412% Non-paged
12,288 2,048 +21.732% +22.914% Non-paged
12,288 8,192 +23.864% +22.288% Non-paged
12,288 32,768 +33.491% +33.961% Non-paged
12,288 65,536 +34.463% +34.974% Non-paged
12,288 125,000 +34.867% +35.248% Non-paged
16,384 0 +58.611% +57.645% Non-paged
16,384 2,048 +28.359% +27.780% Non-paged
16,384 8,192 +26.891% +26.087% Non-paged
16,384 32,768 +34.115% +34.278% Non-paged
16,384 65,536 +35.369% +35.317% Non-paged
16,384 125,000 +35.044% +34.754% Non-paged
32,768 0 +57.037% +56.715% Non-paged
32,768 32,768 +35.172% +34.703% Non-paged
32,768 125,000 +35.168% +35.040% Non-paged

Non-paged generally becomes more favorable as Local Q and the C4 prefix grow because the gather is amortized over more Q-by-K work. The trend is not strictly monotonic at every shape, but the safe boundary is clear: every tested Q >= 8192 case improved in both runs, while smaller Q can regress, especially with short prefixes.

The same boundary holds across architectures: at Q=6144, H100 and GB300 regressed by 8.78% and 49.33%; at Q=8192, they improved by 8.82% and 6.26%. Therefore, this change conservatively selects non-paged at Local Q >= 8192 and keeps paged below it. A real-serving GB300 profile at Q=8192 also reduced the replaced p50 GPU span from 1.524 ms to 1.068 ms, including gather.

Checklist

Review and Merge Process

  1. Ping Merge Oncalls to start the process. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments or contact authorized users to do so.
    • Common commands include /tag-and-rerun-ci, /tag-run-ci-label, /rerun-failed-ci
  4. After green CI and required approvals, ask Merge Oncalls or people with Write permission to merge the PR.

CI States

Latest PR Test (Base): ❌ Run #28722513145
Latest PR Test (Extra): ✅ Run #28901105817

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@Fridge003 Fridge003 self-assigned this Jul 5, 2026
@YAMY1234
YAMY1234 marked this pull request as ready for review July 6, 2026 18:06
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@Fridge003

Copy link
Copy Markdown
Collaborator

/rerun-test test/registered/models_e2e/test_deepseek_v4_flash_fp4_h200.py test/registered/models_e2e/test_deepseek_v4_flash_fp8_h200.py test/registered/models_e2e/test_deepseek_v4_flash_fp4_b200.py test/registered/models_e2e/test_deepseek_v4_flash_fp4_megamoe_b200.py test/registered/cp/test_deepseek_v4_flash_fp4_b200_cp.py test/registered/disaggregation/test_disaggregation_dsv4.py

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Results for /rerun-test test/registered/models_e2e/test_deepseek_v4_flash_fp4_h200.py test/registered/models_e2e/test_deepseek_v4_flash_fp8_h200.py test/registered/models_e2e/test_deepseek_v4_flash_fp4_b200.py test/registered/models_e2e/test_deepseek_v4_flash_fp4_megamoe_b200.py test/registered/cp/test_deepseek_v4_flash_fp4_b200_cp.py test/registered/disaggregation/test_disaggregation_dsv4.py:

🚀 8-gpu-h200 (3 tests): ✅ View workflow run

cd test/ && python3 registered/models_e2e/test_deepseek_v4_flash_fp4_h200.py
cd test/ && python3 registered/models_e2e/test_deepseek_v4_flash_fp8_h200.py
cd test/ && python3 registered/disaggregation/test_disaggregation_dsv4.py

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

cd test/ && python3 registered/models_e2e/test_deepseek_v4_flash_fp4_b200.py
cd test/ && python3 registered/models_e2e/test_deepseek_v4_flash_fp4_megamoe_b200.py
cd test/ && python3 registered/cp/test_deepseek_v4_flash_fp4_b200_cp.py

@Fridge003 Fridge003 added release-highlight Candidate PR for release note highlight and removed release-highlight Candidate PR for release note highlight labels Jul 7, 2026
@Fridge003
Fridge003 merged commit 48ad6a8 into sgl-project:main Jul 7, 2026
120 of 134 checks passed
Fridge003 pushed a commit that referenced this pull request Jul 7, 2026
…er by default for large prefill chunks (#30140) (#30436)

Co-authored-by: YAMY <74099316+YAMY1234@users.noreply.github.com>
mattteochen pushed a commit to mattteochen/sglang that referenced this pull request Jul 8, 2026
Chronostasys pushed a commit to MindLab-Research/sglang that referenced this pull request Aug 24, 2026
…er by default for large prefill chunks (sgl-project#30140) (sgl-project#30436)

Co-authored-by: YAMY <74099316+YAMY1234@users.noreply.github.com>
Chronostasys pushed a commit to MindLab-Research/sglang that referenced this pull request Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants