Repository navigation
[FlyDSL] Megamoe restore 5001 aot fix - #5346
Merged
Merged
Conversation
Contributor
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
PR title tags & labels: |
JiaoliangYu
approved these changes
Sep 9, 2026
coderfeli
approved these changes
Sep 9, 2026
4 of 5 tasks
jhinpan
added a commit
to sgl-project/sgl-amd-mono
that referenced
this pull request
Oct 27, 2026
## Motivation Without CUDA graphs, every launch of the DeepSeek-V4.1, GLM-5.3, GLM-5.3-Flash and MiniMax-M3 runners goes through FlyDSL's JIT dispatch (`JitFunction.__call__`): it binds the signature, checks the globals and builds the full cache key at each launch. For GLM-5.3-Flash's launchers (50 integer arguments), that costs 182 µs of host time a launch, so an eager decode step is host-bound. This PR reuses AITER's compiled-dispatch helper: it keeps the first real launch's `CompiledFunction` and calls it after that. A replayed CUDA graph does not call the launchers, so decode with CUDA graphs (the default) does not change. ## Modifications - These launches use `_run_compiled` from `aiter.ops.flydsl.kernels.tensor_shim`, with the runtime addresses, scalars and stream passed positionally: - DeepSeek-V4.1: K1, K2, FFN and K2i. - GLM-5.3: the layer. - GLM-5.3-Flash: the layer and the head. - MiniMax-M3: the launch. MiniMax-M3.1 already caches its compiled FFN callable. - `compile_only` in the four runners uses AITER's `_preload_compiled`. AITER handles the no-dispatch preload and restores the environment. - The GLM runners import both helpers where they use them. AITER probes the GPU when it is imported, and `test/unit` imports these modules on CPU. - `test/kernels/test_compiled_dispatch.py` checks the dispatch that the runners rely on: - a preload never runs the kernel; - the first real call runs it once; - later calls skip JIT dispatch, also inside a graph. - AITER requirement: `_preload_compiled`, from ROCm/aiter#5346 (`354e278e5`) onwards. ROCm/aiter#6946 is not needed, because this repository never calls `_run_compiled` while `COMPILE_ONLY` is set. ## Accuracy Tests The kernels and their arguments do not change, and the outputs are bitwise equal to main's: - GLM-5.3-Flash: the eager step of layers 3-43 at TP4, 4 and 8 rows, on every rank. - DeepSeek-V4.1 K1 through `DSV41MonoRunner.k1`: at TP2; widths 1, 6, 24 and 48; fold, settled and index. The outputs match after the first and third eager call and after a graph replay, in 24/24 cases. E2E on MI355X: - `test_glm53_flash_server.py` (TP4): 5/5. GSM8K past the largest width scores 0.995. - `test_glm53_server.py` (FP8, TP8): 8/8. GSM8K scores 0.99 for decode and 0.99 with MTP, with an accept length of 3.3-3.4. - `test_minimax_m3_server.py` (TP4, with sgl-project/sglang#41998): 7/9. GSM8K scores 0.925 with EAGLE3 and 0.885 for decode. The 2 failing cases also fail on main: the test expects the spec name `minimax_m3_hip`, but the spec has been named `minimax_m3_family_hip` since #56. After the GLM import change, CPU-only `test/unit` gives the same result as on main, and GLM-5.3-Flash stays bitwise equal to main at TP4. ## Speed Tests and Profiling MI355X at TP4, with a fresh server for each arm and two rounds. The load is random 2048 tokens in and 256 out. The table gives median TPOT in ms, main -> this PR: | Model | CUDA graphs, c1 / c4 | `--disable-cuda-graph`, c1 / c4 | | --- | --- | --- | | GLM-5.3-Flash | 2.520 -> 2.523 / 3.032 -> 3.029 | 11.28 -> 2.72 / 11.75 -> 3.19 | | GLM-5.3 (FP8) | 6.812 -> 6.812 / 9.351 -> 9.342 | 20.06 -> 7.05 / 20.43 -> 9.39 | | MiniMax-M3 + EAGLE3 | 1.430 -> 1.426 / 4.118 -> 4.174 | 6.29 -> 3.31 / 9.58 -> 6.38 | - **With CUDA graphs**, TPOT does not change (within ±1.4% at every covered width). The gain applies only to steps that run without a graph. - **Host time** of a GLM-5.3-Flash launch goes from 182 µs to 14.7 µs. An eager step of layers 3-43 goes from 7.50 ms to 2.54 ms, which equals the step's graph replay time. Setup: image `rocm/sgl-dev:v0.5.22-rocm10-mi35x-20261026`, with SGLang `5ef99013ac`, AITER `285579b62` and FlyDSL 0.4.0. ## Checklist - [x] `pre-commit run --all-files` passes. - [x] Tests under `test/` cover the change. - The dispatch: `test_compiled_dispatch.py`. - DeepSeek-V4.1 FFN and K2: `test_deepseek_v41_kernels.py`. K2i: `test_deepseek_v41_k2i.py`. - GLM-5.3-Flash: `test_glm53_flash_kernels.py`. - MiniMax-M3 `compile_only`: `test_minimax_m3_compile.py`. - Only the e2e tests reach the GLM-5.3 and MiniMax-M3 launches. - No committed test reaches `DSV41MonoRunner.k1`, because `check_k1.py` calls the K1 launcher directly. K1 was checked bitwise against main, as described above. - [x] The SGLang commit or PR this was tested against is named above. - [x] Accuracy and speed results are attached. - [ ] A new model adds one line to `.github/CODEOWNERS` that names its owner. (No new model.) --------- Co-authored-by: Jin Pan <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Improve DeepSeek-V4-Pro MegaMoE A8W4 end-to-end performance while reducing communication-buffer memory usage and preserving 8-GPU correctness across dynamic MTPR configurations.
Technical Details
Fuse activation quantization with dispatch preparation.
Overlap Stage1 communication and GEMM through finite producer dispatch, producer auto-retirement, and consumer tile scheduling.
Deduplicate common dispatch payloads.
Improve Stage2 scheduling and common-row processing.
Add DeepSeek-V4-Pro AOT bundles for EPR 48/52/56 and MTPR 8192/16384/32768.
Harden synchronization, cache/preload handling, and remove obsolete experimental paths.
Test Plan
Run 8-GPU correctness and CUDA Graph replay tests for:
Validate JIT and cross-process AOT execution.
Run DeepSeek-V4-Pro full-network benchmarks at concurrency 512/4096 and request rates 0.8/1.0.
Run Python compile, Black, Ruff, and diff checks.
• ## Test Result
Environment
rocm/atom-dev@sha256:a5cfa1ab503af6e0f55e0ed83cd7e999edbea6940a38dba44aaeee9a227589761e7659fde32eeaa0d9aa868c3e90847e5e46a51c065280213fb28f1b574b08333a1a05c05df2a1952.10.0+rocm7.2.4.git3d3aa833, HIP7.2.53211Full-network throughput
Correctness and stability
MTPR=MAX: 15/15 8-GPU CUDA Graph cases passed.MTPR=tokens: 15/15 cases passed.SGLang end-to-end performance
AgentX variable-length trace replay, concurrency 64
Workload:
inferencex-agentx-mvp, Weka/Claude-Code trajectories, 900-second profiling window, random seed 42.SGLang environment
1ce08ce230011be15ad52080d12ff96ce01a5306884cc79c8291b599b067b5edd0003d35b40691125853cf35377eb4e1433a075ce7a9d6fa0beed15d31cfb4a0286fc9f0cf25498d07f937640cd1295d0.3.22.10.0+rocm7.2.4.git3d3aa833/7.2.53211Submission Checklist