Skip to content

[Performance] Reduce idle DP work in breakable prefill CUDA graphs - #33871

Merged
BBuf merged 6 commits into
sgl-project:mainfrom
Promisewjx:opt/deepseek-v4-bcg
Aug 27, 2026
Merged

BBuf merged 6 commits into
sgl-project:mainfrom
Promisewjx:opt/deepseek-v4-bcg

Conversation

@Promisewjx

@Promisewjx Promisewjx commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Under DP attention with breakable prefill CUDA graphs, idle DP ranks may be
rewritten into fabricated EXTEND batches so that all ranks can follow the
same execution sequence.

Previously, the fabricated rows were counted as real tokens. As a result:

  • MoE top-k and dispatch treated dummy rows as valid tokens.
  • Busy ranks performed unnecessary expert work for tokens from idle ranks.
  • Attention was executed even when a rank had no real tokens.
  • Prefill BCG forced all DP ranks to use MAX_LEN, which can introduce
    significant padding when the per-rank token distribution is skewed.

The padding overhead is particularly visible in multi-turn and agentic
workloads, where cache affinity, tool calls, and uneven turn arrival times
frequently leave some DP ranks idle.

Changes

Skip dummy-token work on idle DP ranks

For idle non-hybrid models:

  • Keep num_token_non_padded at zero after creating the fabricated
    EXTEND batch.
  • Prevent dummy rows from being dispatched to MoE experts.
  • Skip attention when the rank has no real tokens.
  • Zero skipped attention outputs before returning to avoid propagating
    uninitialized values.

Hybrid SSM models retain the previous behavior because their state update
requires the fabricated row.

Allow per-rank prefill graph buckets with MegaMoE

MegaMoE can safely use per-rank SUM_LEN buckets because its symmetric
dispatch buffers are sized from num_max_tokens_per_rank, and its NVLink
barrier depends on the number of ranks rather than each rank's local token
count.

This PR therefore allows MegaMoE DP ranks to select different prefill CUDA
graph buckets instead of forcing all ranks to use MAX_LEN.

The optimization is intentionally disabled for:

  • DeepEP and other MoE A2A backends.
  • DSA prefill context parallelism.
  • MLA prefill context parallelism.

These paths continue to use the existing MAX_LEN behavior.

Benchmark

Configuration:

  • Model: DeepSeek-V4-Flash
  • TP / DP / EP: 4 / 4 / 4
  • Prefill CUDA graph backend: breakable
  • Router: DP-aware, cache-aware
  • Maximum concurrency: 64

Single-turn workload

For both DeepEP and MegaMoE, the single-turn high-concurrency workload mainly
improves TTFT. End-to-end throughput remains approximately unchanged because
all DP ranks stay busy for most of the benchmark, leaving few idle-rank
opportunities.

MegaMoE results below are the mean of three runs:

Metric Baseline This PR Change
Mean TTFT 11.50 s 10.01 s -13.0%
Median TTFT 9.85 s 7.99 s -18.9%
Mean E2E latency 34.99 s 34.86 s approximately unchanged
Input throughput 60.84k tok/s 60.96k tok/s within run-to-run variance

Multi-turn MegaMoE workload

The multi-turn workload creates more skewed per-rank prefill batches and more
idle DP ranks.

Metric Baseline This PR Change
QPS 4.749 5.361 +12.9%

This matches the intended optimization target: the gain becomes visible when
the workload frequently contains idle or lightly loaded DP ranks.

Correctness and compatibility

  • DeepEP retains its existing MAX_LEN behavior.
  • Non-MegaMoE A2A backends retain their existing behavior.
  • DSA and MLA prefill CP retain their existing synchronization behavior.
  • Hybrid SSM models continue counting the fabricated row as a real token.

Accuracy Results: MMLU / GSM8K / AIME25

The MegaMoE and DeepEP configurations use breakable prefill CUDA Graph (BCG).

Dataset / metric Baseline + MegaMoE PR + MegaMoE PR + DeepEP
GSM8K (temperature=0, 1319 examples) 96.59% 96.97% 96.97%
MMLU (temperature=0, 14042 examples) 90.13% 90.00% 89.87%
AIME25 (30 examples × 16 repeats, temperature=1.0, thinking) 95.83% ± 0.78% SEM 97.08% ± 0.60% SEM 96.25% ± 0.91% SEM

Test Plan

  • test/registered/unit/model_executor/runner/test_prefill_cuda_graph_padding.py
    • 2 passed
  • test/registered/dp_attn/test_dp_attention_bcg_kl.py
    • 48 samples
    • Prefill and decode cache-hit KL: 0.0
    • Passed in 163.655s
  • DeepSeek-V4-Flash service startup with DeepEP
  • DeepSeek-V4-Flash service startup with MegaMoE
  • Breakable prefill CUDA graph capture and replay
  • DP-aware Router smoke test
  • Single-turn DeepEP benchmark
  • Single-turn MegaMoE benchmark, three runs
  • Multi-turn MegaMoE benchmark

CI States

Latest PR Test (Base): ⏳ Run #32973140790
Latest PR Test (Extra): ✅ Run #32973140560
Latest PR Test (AMD ROCm 7.2): ⏳ Run #32973140695

@BBuf

BBuf commented Aug 18, 2026 •

Copy link
Copy Markdown
Collaborator

Can we add some real dataset acc test results?

@ch-wan ch-wan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Summary

The two changes are coherent: idle non-hybrid fabricated EXTEND rows stop being counted as real tokens (so MoE top-k can mask them and attention can skip), and MegaMoE is allowed to keep SUM_LEN so DP ranks can pick different prefill graph buckets. Hybrid SSM, DeepEP/other A2A, and DSA/MLA prefill CP are gated the way the PR describes, and MegaMoE still enters dispatch with 0 tokens so the mixed graph/eager split on idle SUM_LEN ranks looks safe. The main residual risk is incomplete 0-token handling in the shared attention skip (LSE return contract) and TBO children recomputing num_token_non_padded from padded input_ids, which undoes the dummy mask on the MAX_LEN path.

Issue counts by severity

  • bugs: 1
  • suggestions: 2
  • nits: 1


if real_query_num_tokens == 0:
_zero_skipped_attn_outputs(output)
return

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[bug] The new 0-token skip in _unified_attention_with_output_impl always returns None. unified_attention_with_output_and_lse calls this with return_lse=True and then assert lse is not None. Idle dummy batches usually have prefix 0 so mha_return_lse is False today, but any 0-real-token call that does need LSE (chunked-prefix MHA merge, or a later change that sets mha_return_lse on this rank) will AssertionError instead of returning a zeroed LSE. The skip was added to a function with two return modes and only one was handled.

Suggestion: If return_lse, allocate a zero LSE with the same shape the fake impl uses ((query.shape[0], query.shape[1]), float32), zero output, and return that tensor. Keep the non-LSE path returning None.

if key_value_num_tokens is None:
key_value_num_tokens = real_query_num_tokens

if real_query_num_tokens == 0:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[suggestion] The PR's stated invariant is that skipped attention must zero outputs so garbage does not flow into residuals/MoE. That skip was added to _unified_attention_with_output_impl, unified_sparse_attention_with_output, and deepseek_v4_attention_with_output, but attention_with_output_extra_kwargs (Inkling score_mod / aux_tensors) still narrows to query[:0] and only copies output[:0], leaving the preallocated output uninitialized.

Suggestion: Apply the same real_num_tokens == 0 early-return + _zero_skipped_attn_outputs(output) in attention_with_output_extra_kwargs.

self.num_token_non_padded_cpu = num_tokens
# Keep idle non-hybrid fabricated rows masked by default.
# Hybrid-SSM needs the real count for its state update.
mask_dummy_tokens = (

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[suggestion] The dummy-token mask is written on the parent ForwardBatch, but TboForwardBatchPreparer.prepare runs immediately afterwards. TBO children get num_token_non_padded from len(batch.input_ids) (the fabricated MAX_LEN dummy count) and num_token_non_padded_cpu=None. Attention therefore does not skip (None == 0 is false) and MoE treats dummy rows as real again. SUM_LEN MegaMoE idle stays at 0 tokens so it is unaffected; DeepEP/pplx MAX_LEN + --enable-two-batch-overlap silently loses the dummy-token skip.

Suggestion: Pass the already-masked parent count into compute_tbo_children_num_token_non_padded (use num_token_non_padded_cpu / the device scalar, not len(input_ids)), and set each child's num_token_non_padded_cpu accordingly so the skip/mask survive the split.

global_num_tokens = forward_batch.global_num_tokens_cpu
if global_num_tokens is None:
return False
if prefill_graph_tolerates_sum_len():

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[nit] The comment above _has_inactive_dp_rank still says sparse-DP batches fall back to eager so every rank enters the same replay path. The new MegaMoE early-return makes that comment false for the path this PR is optimizing.

Suggestion: Note that MegaMoE (via prefill_graph_tolerates_sum_len) is excluded because idle ranks still execute MegaMoE with 0 tokens.

@ch-wan ch-wan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Summary

Prior review items are addressed: the 0-token unified skip now returns a zeroed padded LSE (and None on the output-only path), attention_with_output_extra_kwargs zeros the preallocated output, eager TBO children inherit the parent's dummy-token mask instead of len(input_ids) / cpu=None, and _has_inactive_dp_rank documents the MegaMoE exemption. MegaMoE SUM_LEN vs DeepEP/DSA/MLA-CP MAX_LEN gating still matches the stated intent, and the new unit tests actually pin those regressions.

The dummy-mask change to compute_tbo_children_num_token_non_padded does not tolerate a missing CPU count. Decode CUDA-graph capture (TBO enabled) builds a ForwardBatch with only the device tensor and then calls this helper, so min(split, None) TypeErrors at capture.

Issue counts by severity

  • bugs: 1
  • suggestions: 0
  • nits: 0

# Not len(input_ids): that is the padded (MAX_LEN) token count, which
# would undo the idle-rank dummy-token mask that
# prepare_mlp_sync_batch writes onto the parent.
num_token_non_padded=batch.num_token_non_padded_cpu,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[bug] Switching the TBO child split from len(batch.input_ids) to batch.num_token_non_padded_cpu is correct for the eager MAX_LEN dummy-mask path (prepare_mlp_sync_batch always writes the CPU field). It is not safe for TboCudaGraphRunnerPlugin.capture_one_batch_size, which is still invoked from decode CUDA-graph capture whenever --enable-two-batch-overlap is on. DecodeCudaGraphRunner.capture_prepare constructs the capture batch with num_token_non_padded (device) but never sets num_token_non_padded_cpu (defaults to None). _split_num_token_non_padded then does min(tbo_split_token_index, None) and raises TypeError. Prefill capture happens to set the CPU field, so this only blows up the decode-graph + TBO capture path; the new TBO tests always populate num_token_non_padded_cpu and cannot catch it.

Suggestion: Treat a missing CPU count as "all rows are real" (the capture-time meaning of len(input_ids)), e.g. num_token_non_padded = batch.num_token_non_padded_cpu if batch.num_token_non_padded_cpu is not None else len(batch.input_ids). Use the same fallback in prepare()'s CPU split. Add a regression that calls compute_tbo_children_num_token_non_padded on a decode-capture-style batch with num_token_non_padded_cpu is None and asserts it does not TypeError (and still splits on len(input_ids)).

@ch-wan ch-wan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Summary

The round-2 TypeError is actually fixed: _get_num_token_non_padded_cpu prefers the parent CPU count (so a MAX_LEN idle mask of 0 still splits to (0, 0)) and falls back to len(input_ids) only when the CPU mirror is unset, which is exactly the decode CUDA-graph capture path. Round-1 items remain in place (LSE skip returns a padded float32 tensor, extra-kwargs/sparse/DSV4 skip zero outputs, TBO children inherit the CPU pair on the eager path). MegaMoE vs DeepEP/DSA/MLA-CP gating is unchanged. The remaining gap is that the cpu=None regression coverage lives in test/manual/ rather than the registered TBO unit file, so CI will not catch a repeat of the capture TypeError.

Issue counts by severity

  • bugs: 0
  • suggestions: 1
  • nits: 0

Comment thread test/manual/test_two_batch_overlap.py Outdated
]
self.assertEqual(child_cpu_counts, (0, 0))

def test_capture_count_falls_back_to_physical_rows(self):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[suggestion] test_capture_count_falls_back_to_physical_rows and test_prepare_falls_back_to_physical_rows_for_missing_cpu_count are the only cases that pass num_token_non_padded_cpu=None (the decode-graph capture shape that TypeError'd). They sit on TestTwoBatchOverlapUnitTest in test/manual/, which is not register_cpu_ci'd. test/registered/unit/batch_overlap/test_tbo_children_dummy_token_mask.py covers cpu=0 / padded busy ranks / filter_batch propagation, but deleting it would still leave the capture fallback unguarded in CI.

Suggestion: Move (or duplicate) the cpu=None cases into test_tbo_children_dummy_token_mask.py next to the dummy-mask tests, asserting _get_num_token_non_padded_cpu / compute_tbo_children_num_token_non_padded on a batch with num_token_non_padded_cpu=None and len(input_ids)=8.

@Promisewjx
Promisewjx force-pushed the opt/deepseek-v4-bcg branch from 8d4d2e6 to 07305f2 Compare August 26, 2026 09:59
@BBuf BBuf added run-ci CI: run the baseline test suite on this PR bypass-fastfail run-ci-extra CI: also run the extra suite (requires run-ci) labels Aug 26, 2026
@Promisewjx
Promisewjx force-pushed the opt/deepseek-v4-bcg branch from c119e29 to dc909c5 Compare August 26, 2026 12:58
Address review feedback on the idle-rank optimization: the 0-token skip was
only wired through part of the attention entry points, and the TBO split
silently restored the dummy-token mask it was supposed to inherit.

- _unified_attention_with_output_impl: the 0-token early return honored only
  the non-LSE contract, so a 0-real-token call needing LSE hit
  `assert lse is not None` instead of getting a zeroed LSE.
- attention_with_output_extra_kwargs: narrowing to query[:0] left the
  preallocated output uninitialized on every non-ROCm platform, leaking
  NaN/Inf into residuals and MoE routing.
- TBO children: the split recomputed its token count from the padded
  len(input_ids) and hardcoded num_token_non_padded_cpu to None, so MoE
  treated dummy rows as real again and the attention skip never fired.
  DeepEP/pplx MAX_LEN + --enable-two-batch-overlap lost the optimization.
- Note in _has_inactive_dp_rank why MegaMoE is exempt from eager fallback.
Ensure eager TBO children inherit the parent's
num_token_non_padded_cpu count so MAX_LEN dummy tokens
remain masked.
Fall back to physical rows for CUDA graph capture batches
that do not initialize num_token_non_padded_cpu, while
preserving the masked count for eager MAX_LEN batches.
Cover eager and CUDA graph capture batches where
num_token_non_padded_cpu is unset and verify the
fallback to physical input rows.
@Promisewjx
Promisewjx force-pushed the opt/deepseek-v4-bcg branch from dc909c5 to e980b35 Compare August 26, 2026 13:15
@BBuf
BBuf merged commit 9d07b9e into sgl-project:main Aug 27, 2026
168 of 194 checks passed
YAMY1234 added a commit to akhilg-nv/sglang that referenced this pull request Sep 3, 2026
…ize the semaphore WAR

Measured on 4x GB300 (DeepSeek-V4-Flash, TP4 / TP4+DP4) on top of 39bc7db:

- trtllm + EAGLE + DP attention passes the Balanced CI recipe with the regular
  in-graph metadata prep (GSM8K 0.975, accept 1.950 vs 1.944 host-side), so the
  host-side metadata path resurrected in the FlashMLA base class
  (_prep_in_cuda_graph, host decode branch,
  init_forward_metadata_target_verify_old) is removed.
- trtllm + EAGLE with the overlap scheduler enabled passes the TP4 and DP4
  recipes with no illegal memory access; the containment that forced
  --disable-overlap-schedule is removed.
- The captured-metadata pinning and the plan-staging keepalive deque are not
  needed for trtllm correctness (all recipes pass without them; the deque was a
  no-op — it read c4_compress_metadata off the wrong object). Both are removed
  from this PR; the pinning can be proposed separately if it is a real FlashMLA
  latent issue.
- The DP4 + breakable-prefill-CUDA-graph class passes on current main
  (sgl-project#33871), so its @unittest.skip is removed.

Shared-file footprint: deepseek_v4_backend.py +156/-4 (was +399/-45),
compressor_v2.py +20/-0 (early return instead of re-indenting the fused path).
The draft-extend clamp(min=1) is now guarded by trtllm_attn.

Hardening kept from review: the hook reads resolvable fields via the resolving
view; the trtllm-gen semaphore WAR is sized from max_prefill_tokens /
max_prefill_buffer_tokens() / max_running_requests x draft tokens and asserts
the per-launch row count at both kernel call sites (unit-tested) instead of a
fixed unguarded 16384.

Tests: the backend test resolves the model through try_cached_model, no longer
launches a FlashMLA baseline server, and replaces greedy-tail similarity
(0.56 on GB300 although every answer was correct) with sanity checks plus
exact equality between two identical cached-prefix extends. The unrelated
--mem-fraction-static edit in test_disaggregation_dsv4.py is reverted.
YAMY1234 added a commit to akhilg-nv/sglang that referenced this pull request Sep 3, 2026
…ize the semaphore WAR

Measured on 4x GB300 (DeepSeek-V4-Flash, TP4 / TP4+DP4) on top of 39bc7db:

- trtllm + EAGLE + DP attention passes the Balanced CI recipe with the regular
  in-graph metadata prep (GSM8K 0.975, accept 1.950 vs 1.944 host-side), so the
  host-side metadata path resurrected in the FlashMLA base class
  (_prep_in_cuda_graph, host decode branch,
  init_forward_metadata_target_verify_old) is removed.
- trtllm + EAGLE with the overlap scheduler enabled passes the TP4 and DP4
  recipes with no illegal memory access; the containment that forced
  --disable-overlap-schedule is removed.
- The captured-metadata pinning and the plan-staging keepalive deque are not
  needed for trtllm correctness (all recipes pass without them; the deque was a
  no-op — it read c4_compress_metadata off the wrong object). Both are removed
  from this PR; the pinning can be proposed separately if it is a real FlashMLA
  latent issue.
- The DP4 + breakable-prefill-CUDA-graph class passes on current main
  (sgl-project#33871), so its @unittest.skip is removed.

Shared-file footprint: deepseek_v4_backend.py +156/-4 (was +399/-45),
compressor_v2.py +20/-0 (early return instead of re-indenting the fused path).
The draft-extend clamp(min=1) is now guarded by trtllm_attn.

Hardening kept from review: the hook reads resolvable fields via the resolving
view; the trtllm-gen semaphore WAR is sized from max_prefill_tokens /
max_prefill_buffer_tokens() / max_running_requests x draft tokens and asserts
the per-launch row count at both kernel call sites (unit-tested) instead of a
fixed unguarded 16384.

Tests: the backend test resolves the model through try_cached_model, no longer
launches a FlashMLA baseline server, and replaces greedy-tail similarity
(0.56 on GB300 although every answer was correct) with non-empty /
non-gibberish checks; at ~7k context temperature-0 output is not reproducible
on FlashMLA either, so no greedy-equality assertion there. The unrelated
--mem-fraction-static edit in test_disaggregation_dsv4.py is reverted.
@nvpohanh

nvpohanh commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

cc @elvischenv for vis

YAMY1234 added a commit to YAMY1234/sglang that referenced this pull request Sep 4, 2026
PR sgl-project#33871 let MegaMoE DP ranks pick per-rank SUM_LEN prefill graph buckets
and dropped the eager fallback for batches with an idle DP rank. Under
SUM_LEN a 0-token rank never gets the fabricated EXTEND row, so it stays in
IDLE mode and runs eager while the busy rank replays the prefill graph. The
two paths issue different NCCL collectives (tp-group all_reduce of the
SUM_LEN DP buffer vs. the captured MAX_LEN path) and deadlock; Kimi-K3
TP16/DP2/EP16 hangs on the first request routed to a single DP rank.

Keep the per-rank bucket exemption only when every DP rank has tokens. With
an idle rank fall back to MAX_LEN so the idle rank fabricates an EXTEND row
and every rank replays the same bucket, which is the pre-sgl-project#33871 path.

Fixes sgl-project#37561
YAMY1234 added a commit to YAMY1234/sglang that referenced this pull request Sep 4, 2026
The report isolated the hang to sgl-project#33871 and pointed at the MegaMoE
SUM_LEN exemption, which led directly to this fix.

Co-authored-by: shyeh25 <[email protected]>
YAMY1234 added a commit to YAMY1234/sglang that referenced this pull request Sep 4, 2026
…having no DP gather

The prefill CUDA graph body is captured with MAX_LEN geometry
(global_num_tokens_gpu is frozen at capture). When a model runs a DP
gather/scatter inside the graph, such as Kimi-K3's dense layer 0 over the
full TP group, two DP ranks replaying different buckets issue an NCCL
all_gather with different per-rank counts and deadlock even when every
rank is busy. Reproduced with DP0 on bucket 8 and DP1 on bucket 256.

Latch a DP flag when a DP gather/scatter runs during prefill graph capture
and disable the MegaMoE SUM_LEN exemption for such graphs, so those models
keep the pre-sgl-project#33871 shared MAX_LEN bucket. Models whose graph has no DP
gather (e.g. DeepSeek-V4-Flash with an a2a MoE backend) keep the per-rank
bucket optimization from sgl-project#33871.
YAMY1234 added a commit to YAMY1234/sglang that referenced this pull request Sep 4, 2026
…graph check

With no DP gather/scatter recorded in the prefill graph, an idle rank's
eager 0-token forward issues the same a2a sequence as the replaying busy
ranks (the path sgl-project#33871 validated on DSV4-Flash), so the sparse batch can
keep per-rank SUM_LEN buckets. Graphs that did capture a DP gather stay on
the shared MAX_LEN bucket, which also covers their idle-rank case.
YAMY1234 added a commit to YAMY1234/sglang that referenced this pull request Sep 4, 2026
PR sgl-project#33871 let MegaMoE DP ranks pick per-rank SUM_LEN prefill graph buckets
and dropped the eager fallback for batches with an idle DP rank. Under
SUM_LEN a 0-token rank never gets the fabricated EXTEND row, so it stays in
IDLE mode and runs eager while the busy rank replays the prefill graph. The
two paths issue different NCCL collectives (tp-group all_reduce of the
SUM_LEN DP buffer vs. the captured MAX_LEN path) and deadlock; Kimi-K3
TP16/DP2/EP16 hangs on the first request routed to a single DP rank.

Keep the per-rank bucket exemption only when every DP rank has tokens. With
an idle rank fall back to MAX_LEN so the idle rank fabricates an EXTEND row
and every rank replays the same bucket, which is the pre-sgl-project#33871 path.

Fixes sgl-project#37561
YAMY1234 added a commit to YAMY1234/sglang that referenced this pull request Sep 4, 2026
…having no DP gather

The prefill CUDA graph body is captured with MAX_LEN geometry
(global_num_tokens_gpu is frozen at capture). When a model runs a DP
gather/scatter inside the graph, such as Kimi-K3's dense layer 0 over the
full TP group, two DP ranks replaying different buckets issue an NCCL
all_gather with different per-rank counts and deadlock even when every
rank is busy. Reproduced with DP0 on bucket 8 and DP1 on bucket 256.

Latch a DP flag when a DP gather/scatter runs during prefill graph capture
and disable the MegaMoE SUM_LEN exemption for such graphs, so those models
keep the pre-sgl-project#33871 shared MAX_LEN bucket. Models whose graph has no DP
gather (e.g. DeepSeek-V4-Flash with an a2a MoE backend) keep the per-rank
bucket optimization from sgl-project#33871.
YAMY1234 added a commit to YAMY1234/sglang that referenced this pull request Sep 4, 2026
…graph check

With no DP gather/scatter recorded in the prefill graph, an idle rank's
eager 0-token forward issues the same a2a sequence as the replaying busy
ranks (the path sgl-project#33871 validated on DSV4-Flash), so the sparse batch can
keep per-rank SUM_LEN buckets. Graphs that did capture a DP gather stay on
the shared MAX_LEN bucket, which also covers their idle-rank case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bypass-fastfail deepseek 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.

4 participants