Repository navigation
Fix FlashInfer A2A top-k ID dtype - #29929
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the FlashInfer MoE token dispatcher to cast topk_ids to torch.int32 and adds a unit test to verify this behavior. The review feedback suggests ensuring robustness against BypassedTopKOutput by calling to_standard() if available, preventing potential AttributeErrors.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
[by Codex] Addressed the review concern in ffaa7c6a4f: FlashInfer A2A now materializes |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
[by Codex] |
|
I'm not that familiar with moe dispatch. However, I'm concerned that the conversion to int32 is unconditional. Did the dispatch ever work for other backend combinations? Wouldn't those break? |
|
[by Codex] Thanks, the conversion is not unconditional across SGLang backends. It is scoped to The FlashInfer 0.6.12 The patch normalizes IDs only at that A2A boundary and returns the received IDs as int32 for those runners. The focused standard and bypassed-top-k tests passed in the pinned nightly container (OCI job 168393), and the GLM-5 DEP2 E2E path subsequently passed. I added the ABI rationale beside the cast in b2642c7db8. |
|
convert to draft for now since I need to verify that the added GLM-5.2 test could actually catch this failure |
6f4239e to
b9fc462
Compare
|
/tag-and-rerun-ci |
|
/rerun-failed-ci |
|
@b8zhong Could you help me to review this? This fixes a topk_id dtype mismatch issue when using flashinfer alltoall. Thanks! All the NV pipelines have passed. |
b8zhong
left a comment
There was a problem hiding this comment.
/rerun-test test/registered/4-gpu-models/test_glm52_nvfp4.py
|
/rerun-test test/registered/4-gpu-models/test_glm52_nvfp4.py |
|
Results for 🚀 |
|
@b8zhong is this PR okay to merge? Or do we need more reviews? Thanks! |
| from sglang.test.run_combined_tests import run_combined_tests | ||
| from sglang.test.test_utils import CustomTestCase, ModelLaunchSettings | ||
|
|
||
| register_cuda_ci(est_time=1800, suite="nightly-4-gpu-b200", nightly=True) |
There was a problem hiding this comment.
Can we make it a subtest of test/registered/ep/test_flashinfer_a2a.py instead
A nightly test with 1800s is too heavy
There was a problem hiding this comment.
makes sense. Will update it
There was a problem hiding this comment.
[by Codex] Addressed in 51678e2. I moved the GLM-5.2 NVFP4 regression coverage into test/registered/ep/test_flashinfer_a2a.py as TestFlashinferA2ACutedslStaticFP4 and removed the standalone 1,800-second nightly accuracy/performance matrix. The consolidated case exercises Static EP, flashinfer_cutedsl, and FlashInfer A2A, then performs one generation request. Validated on AIHub B200x4 (job 1379463): TestFlashinferA2ACutedslStaticFP4.test_generate passed — 1 test in 471.443s, OK. The branch is also rebased onto latest origin/main at c00131e.
1911569 to
51678e2
Compare
|
@b8zhong @Fridge003 I have updated the test definition. Could you review again? thanks! |
|
/rerun-test test/registered/ep/test_flashinfer_a2a.py |
|
Results for 🚀 |
- test_flashinfer_dispatcher: add regression cases for both parts of #29929. One dispatches int64 expert IDs, as static EP dispatch produces, and asserts MoeAlltoAll receives int32. The other dispatches a bypassed top-k output, as runners that fuse routing produce, and asserts MoeAlltoAll receives routed int32 expert IDs and weights. Both run per-PR on CPU. Move the file's cases into a CustomTestCase class. - test_flashinfer_a2a: drop the GLM-5.2 static-dispatch class, which checked the expert-ID dtype with a full server launch. FlashInfer A2A with the CuteDSL runner stays covered by test_flashinfer_a2a_cutedsl_v2 and test_nvidia_nemotron_3_super_nvfp4.
[by Codex]
Summary
torch.int32, as required by FlashInfer'sMoeAlltoAll.dispatchAPI.DEP4+FlashInferA2A+StaticEPand the default DEP4 backend.Motivation
SGLang's static expert-parallel dispatch remaps selected experts through an
int64expert-location table. FlashInfer 0.6.12 requiresint32expert IDs, so GLM-5.2 NVFP4 with DEP4, FlashInfer A2A, and--ep-dispatch-algorithm=staticaborts during CUDA graph capture with:Normalizing the IDs at the FlashInfer dispatcher boundary keeps SGLang's internal routing representation independent of FlashInfer's ABI.
FlashInfer ABI
SGLang pins FlashInfer 0.6.12.
MoeAlltoAll.dispatchforwardstoken_selected_expertsto the underlying API. Itsmoe_a2a_dispatchdocstring specifies thattoken_selected_expertsis anint32tensor.B200 verification
Ran the exact registered test in
test/registered/4-gpu-models/test_glm52_nvfp4.pywith four B200 GPUs andnvidia/GLM-5.2-NVFP4:26b15a0825e32ff9fef4ff58b253f1c40a942981):DEP4+FlashInferA2A+StaticEPdeterministically failed during CUDA graph capture with theint64versusint32check above.478f904912): the full combined test exited 0 in 1767 seconds withOVERALL: ALL TESTS PASSED.DEP4+FlashInferA2A+StaticEP: performance PASS (804.1 output tok/s at batch size 16), GSM8K PASS (0.958versus0.920baseline).DEP4-default: performance PASS (861.9 output tok/s at batch size 16), GSM8K PASS (0.955versus0.920baseline).Additional checks:
python3 -m black --check test/registered/4-gpu-models/test_glm52_nvfp4.pypython3 -m py_compile test/registered/4-gpu-models/test_glm52_nvfp4.pygit diff --check 26b15a0825e32ff9fef4ff58b253f1c40a942981..HEADCI States
Latest PR Test (Base): ❌ Run #29388844304
Latest PR Test (Extra): ❌ Run #29388844184