Repository navigation
[Perf] moe: Preserve Marlin workspace and route-count budgets - #45462
Merged
Merged
Conversation
ch-wan
requested review from
BBuf,
DarkSharpness,
Edwardf0t1,
Fridge003,
HaiShaw,
HydraQYH,
Ying1123,
celve,
ispobock,
merrymercy and
yuan-luo
as code owners
October 20, 2026 23:35
This was referenced Oct 21, 2026
ch-wan
requested review from
jybsuper,
lifuhuang and
yushengsu-thu
as code owners
October 21, 2026 23:05
This was referenced Oct 21, 2026
ch-wan
requested review from
AgainstEntropy,
ByronHsu,
CatherineSue,
Duyi-Wang,
YAMY1234,
bingxche,
hebiao064,
iforgetmyname,
ishandhanani,
kevin-mii,
liusy58,
niehen6174,
slin1237,
sogalin,
whybeyoung,
wisclmy0611,
yeahdongcn,
yingluosanqian and
zijiexia
as code owners
October 22, 2026 23:32
This was referenced Oct 22, 2026
4 of 5 tasks
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.
This PR is part of a stack (oldest at bottom):
Motivation
An expert ID of
-1represents valid padding, including without expert parallelism. Reusing Marlin projection storage can expose stale values for those routes; clearing the entire allocation adds work to valid routing. Muse also needs its gate/up and down projections to share the original workspace budget.Changes
M * topk * max(2I, H). Finalization predicates inactive routes before reading payloads or scores, including poisoned inactive values, and preserves the existing product-rounding boundary.zero_inactive_outputto native Marlin. Down projections complete inactive destinations within the existing kernel, including publicno_combineoutput. The default preserves caller-owned inactive rows; active GEMM math, atomics and reduction choices stay unchanged.[padded_token_count, inactive_prefix_blocks]in one count allocation. An explicit consumer flag selects the packed read and existing compressed sorted scheduling. Scalar/external producers keep the checked fallback; EP keeps its generic path. Empty inputs, dirty allocation tails and graph replay retain defined count semantics.Review the alignment/count contract first, then native output completion, Muse workspace/finalization and the registered regressions. LoRA projection changes belong to #45681.
CI cadence
The complete Marlin GEMM, inactive-route, LoRA and Muse matrix now runs in opt-in
extra-a-test-1-gpu-large. Base CI retains the routing, alignment and packed-top-k checks.Across the stack, six existing CUDA file registrations move from base CI to extra/nightly, removing 854 estimated GPU-seconds from the default gate (registration estimates, not a measured wall-time saving). All test bodies, cases, inputs, assertions and tolerances are unchanged. Full before/after discovery validates 2,535 files and 3,077 registrations, with every moved file selected in its enabled destination suite. Configured hooks pass; native tests were not rerun for this registration-only update.
Validation
At integrated
e6670af1ad, the focused native Marlin/LoRA route suite passes 14 tests on 1× B300 with the pinned providers, including changing padded routes and output completion.Two additional direct Marlin output-ownership configurations did not complete within a 600-second cold-compilation budget on B300. No result is claimed for that extended run; it is separate from the completed route replay and producer-contract checks.
At integrated
e6670af1ad, the alignment suite passes 89 tests on 1× H200 and 1× B300, covering count publication, signed IDs, complete expert-map capacity and combined options during graph replay. The GGUF native-entry suite passes 7 tests on B300 with sglang-kernel 0.4.10. H200 uses PyTorch 2.13.0+cu130 for the source-local JIT producer; this is not full native H200 GGUF admission.Configured pre-commit hooks pass. 1× NVIDIA H200 native ownership, count, packed-router and Muse tests passed on the pre-rebase implementation; these are operator checks, not full-model serving results.
On the rebased composed tree
f3a1165, 1× NVIDIA B300 passed 39 selected alignment-count cases and the scratch/count-pair CUDA graph replay probe. The selected Marlin/Muse run exceeded its 480-second cap before completion; it is not reported as passed, and no B300 Marlin/Muse latency result is claimed.Earlier H200 Muse measurements retained the projection peak budget. Its strict M512 cross-run comparison also failed on unchanged-baseline repeats; a diagnostic using identical routing metadata produced bitwise matching projections/final output. This does not establish unrestricted numerical equivalence.
CUDA validation used PyTorch 2.14.1+cu130, Triton 3.8.0 and sgl-kernel 0.4.10. Broader shapes, distributed communication and native MUSA execution remain outside this evidence.
Rebase validation (before the CI registration fix)
This five-PR stack was rebased without conflicts onto main
8b9f72417f. All five patches retain their stable patch IDs relative to the preceding published stack; the newer main commits do not touch the stack's changed files. The existing removal of the unusedmaterialized_routingparameter and its three call-site arguments in #45917 is preserved.Each rebased PR commit passed its configured pre-commit checks independently. The final stack passes
git diff --check, and all 72 changed Python files parse successfully. CPU test suites, native GPU tests and performance measurements were not rerun for this rebase. Previously reported results, including those at integratede6670af1ad, remain evidence for those earlier revisions with their stated limits.Prior CI registration fix
The GGUF weighting test now uses the existing
nightly-musa-1-gpusuite withnightly=True; at that revision, its CUDA kernel-unit registration was unchanged. The previous nonexistent MUSA suite caused global registry validation to fail before CPU, CUDA and AMD tests could run.The original collection failure was reproduced. Full registration collection and suite validation now pass on the GGUF component (2,533 files / 3,075 registrations) and the integrated stack (2,535 files / 3,077 registrations), including enabled MUSA nightly and CUDA selection. Configured pre-commit checks pass for the corrected test. This update changes one registration line and is propagated through the existing stack.
CPU CI follow-up
Run 39935811691 exposed an upstream Flux2 import test registered in the CPU suite, whose environment lacks the diffusion dependencies. The import chain also queries the active GPU. #45915 moves that check to the existing CUDA diffusion unit suite, which installs those dependencies, while retaining its XPU registration and the real subprocess check that blocks Intel Triton imports. This registration fix is propagated through the stack.
The Flux2 import check passes on 1× NVIDIA B300 with PyTorch 2.14.1+cu130, Triton 3.8.0 and Diffusers 0.37.0; its five Intel-XPU numerical cases are skipped on CUDA and were not rerun on XPU. Full integrated registry collection validates 2,535 files / 3,077 registrations, including the enabled diffusion/XPU selections and the preceding GGUF MUSA fix. Configured checks pass for the changed files. Only three test files change across this follow-up; production code is unchanged. A fresh full CI result is not claimed.
Merge preparation
Rebased this component onto main
e6451c1a95for squash merge. The preceding stack components are already merged into main; only this component is replayed here. No test suites or performance measurements were rerun for this merge. Earlier validation sections describe their named revisions.CI States
Latest PR Test (Base): ❌ Run #40011918448
Latest PR Test (Extra): ❌ Run #40011918431
Latest PR Test (AMD ROCm 10): ❌ Run #40011918491