Skip to content

refactor(runner): unify eager-forward DP/MLP-sync padding into one helper - #28383

Merged
ch-wan merged 1 commit into
mainfrom
cheng/refactor/forward-unify-dp
Jun 18, 2026
Merged

ch-wan merged 1 commit into
mainfrom
cheng/refactor/forward-unify-dp

Conversation

@ch-wan

@ch-wan ch-wan commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Motivation

_forward_raw had an inline eager-only preprocessing block between the cuda-graph replay early-return and the eager forward dispatch: MLP-sync / attn-tp-scatter padding, the attn-tp num_token_non_padded normalization, and the hisparse-coordinator refresh.

Modifications

  • Extract that block verbatim into _prepare_eager_forward_batch(forward_batch).
  • Same ordering and conditions; runs only on the non-graph path (the graph path pads inside the runner).

Pure helper extraction.

Accuracy Tests

N/A — behavior-preserving refactor (no change to model outputs).

Speed Tests and Profiling

N/A — no inference-speed impact.

Checklist

  • Format your code with pre-commit.
  • Behavior-preserving; covered by the existing runner-mode attention unit tests (test/registered/attention/unittests/dense).
  • Follow the SGLang code style guidance.

Builds on #28382.

🤖 Generated with Claude Code


CI States

Latest PR Test (Base): ❌ Run #27753031814
Latest PR Test (Extra): ❌ Run #27753031591

@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!

@ch-wan
ch-wan force-pushed the cheng/refactor/forward-unify-pp branch from 4484062 to ec70a37 Compare June 16, 2026 07:03
@ch-wan
ch-wan force-pushed the cheng/refactor/forward-unify-dp branch from 75a5354 to c30b541 Compare June 16, 2026 07:03
@ch-wan
ch-wan force-pushed the cheng/refactor/forward-unify-pp branch from ec70a37 to d0e17e1 Compare June 16, 2026 20:47
@ch-wan
ch-wan force-pushed the cheng/refactor/forward-unify-dp branch from c30b541 to 8e80bfe Compare June 16, 2026 20:47
@ch-wan
ch-wan force-pushed the cheng/refactor/forward-unify-pp branch from d0e17e1 to 0d96f67 Compare June 16, 2026 20:49
@ch-wan
ch-wan force-pushed the cheng/refactor/forward-unify-dp branch from 8e80bfe to 553893b Compare June 16, 2026 20:49
@ch-wan
ch-wan force-pushed the cheng/refactor/forward-unify-pp branch from 0d96f67 to 5a2ed97 Compare June 16, 2026 20:59
@ch-wan
ch-wan force-pushed the cheng/refactor/forward-unify-dp branch from 553893b to b104183 Compare June 16, 2026 20:59
@ch-wan ch-wan added the ready-to-merge The PR is ready to merge after the CI is green. label Jun 16, 2026
@ch-wan
ch-wan force-pushed the cheng/refactor/forward-unify-dp branch from b104183 to d59fbb6 Compare June 16, 2026 21:24
Base automatically changed from cheng/refactor/forward-unify-pp to main June 18, 2026 09:23
…lper

_forward_raw had an inline block between the cuda-graph replay early-return and
the eager forward dispatch: prepare_mlp_sync_batch / prepare_attn_tp_scatter_input
padding, the attn-tp num_token_non_padded normalization, and the hisparse-
coordinator refresh. Extract it verbatim into
_prepare_eager_forward_batch(forward_batch) so this eager-only preprocessing
lives in one entry the runner's load_batch can later own.

Behavior-identical: same ordering, same conditions, runs only on the non-graph
path (the graph path pads inside the runner).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ch-wan
ch-wan force-pushed the cheng/refactor/forward-unify-dp branch from d59fbb6 to db9191d Compare June 18, 2026 10:23
@ch-wan
ch-wan merged commit f83e4d5 into main Jun 18, 2026
109 of 125 checks passed
@ch-wan
ch-wan deleted the cheng/refactor/forward-unify-dp branch June 18, 2026 20:41
yuyu5333 added a commit to yuyu5333/sglang-bytedance that referenced this pull request Aug 5, 2026
_forward_raw calls self._prepare_eager_forward_batch (added by upstream
sgl-project#28383), but the method definition was never merged onto this branch, so
the eager forward path crashed with AttributeError. Restore the helper
exactly as upstream defines it (DP/MLP-sync padding, attn-tp
num_token_non_padded normalization, hisparse refresh).
Chronostasys pushed a commit to MindLab-Research/sglang that referenced this pull request Aug 24, 2026
jakki-amd pushed a commit to jakki-amd/sglang that referenced this pull request Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge The PR is ready to merge after the CI is green.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant