Skip to content

[Perf] moe: Preserve Marlin workspace and route-count budgets - #45462

Merged
ch-wan merged 1 commit into
mainfrom
cheng/hot-fix/moe-temporary-workspace
Oct 23, 2026
Merged

ch-wan merged 1 commit into
mainfrom
cheng/hot-fix/moe-temporary-workspace

Conversation

@ch-wan

@ch-wan ch-wan commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

This PR is part of a stack (oldest at bottom):

Motivation

An expert ID of -1 represents 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

  • Reuse one Muse projection workspace sized for 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.
  • Add opt-in zero_inactive_output to native Marlin. Down projections complete inactive destinations within the existing kernel, including public no_combine output. The default preserves caller-owned inactive rows; active GEMM math, atomics and reduction choices stay unchanged.
  • Let owned alignment producers optionally publish [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.
  • Preserve the upstream scratch callback ABI and accept scalar or one-element packed-router counts through a storage-sharing view. Ordinary Marlin and Muse opt into the count fact only with producers that actually publish it.

Review the alignment/count contract first, then native output completion, Muse workspace/finalization and the registered regressions. LoRA projection changes belong to #45681.

  • Keep paired inactive-prefix counts independent of optional expert-map capacity completion, including combined-option graph replay coverage.

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 unused materialized_routing parameter 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 integrated e6670af1ad, 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-gpu suite with nightly=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 e6451c1a95 for 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

amd apple-silicon blackwell SM100/SM120 deepseek dependencies Pull requests that update a dependency file diffusion SGLang Diffusion documentation Improvements or additions to documentation hicache Hierarchical Caching for SGLang jit-kernel lora memory-pool mooncake mthreads Multi-modal multi-modal language model npu quant LLM Quantization sgl-kernel speculative-decoding unified-radix-cache

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant