Skip to content

Fix GPT-OSS MXFP4 hidden size reshape on SM10X#27528

Merged
hnyls2002 merged 1 commit into
sgl-project:mainfrom
mmangkad:fix-gpt-oss-mxfp4-hidden-size
Jun 8, 2026
Merged

Fix GPT-OSS MXFP4 hidden size reshape on SM10X#27528
hnyls2002 merged 1 commit into
sgl-project:mainfrom
mmangkad:fix-gpt-oss-mxfp4-hidden-size

Conversation

@mmangkad

@mmangkad mmangkad commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fix a regression from #27063 where GPT-OSS used the backend-internal expert hidden size for the final MoE reshape.

On SM10X with FlashInfer MXFP4, self.experts.hidden_size is padded from 2880 to 3072, while config.hidden_size remains 2880, causing warmup to fail:

RuntimeError: shape '[4096, 3072]' is invalid for input of size 11796480

I also checked H200, where serving succeeds because it uses moe_runner_backend='triton_kernel' and does not pad the expert hidden size to 3072.

Test Plan

Before

On one GPU from a single GB300 node, GPT-OSS 20B failed during server warmup before this fix:

CUDA_VISIBLE_DEVICES=0 sglang serve \
  --model-path openai/gpt-oss-20b \
  --kv-cache-dtype fp8_e4m3 \
  --reasoning-parser gpt-oss \
  --tool-call-parser gpt-oss \
  --trust-remote-code

Failure:

RuntimeError: shape '[4096, 3072]' is invalid for input of size 11796480

After

With this fix, the same server command succeeds, and GPQA eval completes:

python -m gpt_oss.evals \
  --model openai/gpt-oss-20b \
  --eval gpqa \
  --n-threads 512 \
  --reasoning-effort low \
  --base-url http://127.0.0.1:30000/v1 \
  --sampler chat_completions

Result:

100%|...| 1584/1584 [00:29<00:00, 53.63it/s]
score: 0.5593434343434344

CI States

Latest PR Test (Base): ❌ Run #27116872906
Latest PR Test (Extra): ❌ Run #27116872875

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

@hnyls2002

Copy link
Copy Markdown
Collaborator

/rerun-test test/registered/models_e2e/test_gpt_oss_4gpu_mxfp4.py test/registered/lora/test_lora_gpt_oss_20b_logprob_diff.py

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Results for /rerun-test test/registered/models_e2e/test_gpt_oss_4gpu_mxfp4.py test/registered/lora/test_lora_gpt_oss_20b_logprob_diff.py:

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

cd test/ && python3 registered/models_e2e/test_gpt_oss_4gpu_mxfp4.py

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

cd test/ && python3 registered/models_e2e/test_gpt_oss_4gpu_mxfp4.py
cd test/ && python3 registered/lora/test_lora_gpt_oss_20b_logprob_diff.py

@hnyls2002
hnyls2002 merged commit dc24a26 into sgl-project:main Jun 8, 2026
85 of 97 checks passed
@mmangkad
mmangkad deleted the fix-gpt-oss-mxfp4-hidden-size branch June 8, 2026 20:33
Oasis-Git added a commit to Oasis-Git/sglang that referenced this pull request Jun 8, 2026
7 commits from main. Notable:
- sgl-project#27528 Fix GPT-OSS MXFP4 hidden size reshape on SM10X — upstream
  landed the same fix I had locally for the prepad bug in
  forward_normal; dropped my local commit f3c169b85 before merging so
  the upstream version comes in cleanly.
- sgl-project#25464 Deprecate Spec V1 — removed
  python/sglang/srt/speculative/{eagle_worker,multi_layer_eagle_worker,
  standalone_worker}.py. We had local edits on eagle_worker.py for
  the cuda_graph_bs -> cuda_graph_bs_decode rename; accepted the
  deletion (V2 was already the runtime path; no remaining call sites
  for V1 in srt/).
- Other content (dsv4 ROCm fix, EAGLE SWA pool, TRTLLM target verify,
  NPU CI, LMSYS blog) auto-merged without conflicts.

Stale-import surface re-checked post-merge: no leftover imports of
piecewise_context_manager, the old piecewise_cuda_graph_runner, the
old cuda_graph_runner module, or the deleted V1 spec workers. No
stale server_args.cuda_graph_bs / disable_piecewise_cuda_graph
accesses in python/sglang/srt/.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
jeynmann pushed a commit to jeynmann/sglang that referenced this pull request Jun 9, 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