feat(moe_ep): SM120 Cake MegaMoE on any NCCL 2.30.7 or newer #9808
All Vouch review confidence checks passed
Residual risk 0.30 = Change Risk (0.52) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #9808"
general
weight: 0.35
lucifer1004
<!-- .github/pull_request_template.md -->
📌 Description
The SM120 Cake MegaMoE (
moe_epbackendsm120_mxfp4_mxfp8_bf16_cake) and the nosync MegaMoE's GIN builds, which share its loader (flashinfer/moe_ep/shims/sm120/cake_mxfp4/cake_jit.py), only accept exactly NCCL 2.30.7. Projects that use NCCL 2.31+ elsewhere in the same process (DeepEP needs ≥ 2.31, for example) cannot use Cake at all. This PR replaces the exact pin with a version floor and checks for the conditions the kernel actually depends on.Why 2.32.3 failed. With 2.32.3 headers the kernel compiles, but with a 128-byte stack frame (2.30.7: none), so the spill check (
LOCAL_BYTES_LIMIT = 8) refuses it. This is not register pressure. NCCL 2.32 adds the EFA GDA GIN backend, enabled by default, andGIN_BACKENDSswitches off only the three backends 2.30.7 knows, so every GIN call keeps an EFA branch.| headers | GDAKI build, m128 / m64 | stack |
|---|---|---|
| 2.30.7 | 162 / 149 regs | 0 B |
| 2.32.3, current
GIN_BACKENDS| 148 / 136 regs | 128 B (refused) || 2.32.3, +
-DNCCL_GIN_EFA_GDA_ENABLE=0| 164 / 148 regs | 0 B |Changes
GIN_BACKENDSalso passes-DNCCL_GIN_EFA_GDA_ENABLE=0. Before 2.32 the macro does not exist, so the flag is a no-op there.MIN_NCCL_VERSION_INTEGER;EXPECTED_NCCL_VERSION_INTEGERstays as an alias). The device code inlines the Device API and reads thencclDevCommthe library fills in, so what has to hold is "headers == the library in use", whatever its version.-
nccl_installation()now finds thelibnccl.so.2that definesncclGetVersion(dladdr; torch's copy or anLD_PRELOADone). Several copies can be mapped at once, because torch maps its wheel's copy by path.- It then takes headers of exactly that version: next to the library (
<lib>/../include, the wheel layout), then underNCCL_HOMEand thenvidia-nccl-cu13wheel, skipping headers of other versions. Without matching headers, the error names thenvidia-nccl-cu13version to install.- The binding's
kExpectedNcclVersionis nowNCCL_VERSION_CODE, so it refuses a library other than its own headers.cake_sm120_megamoe_nccl_check.cuh. The loader force-includes it withnvcc -includeinto the device passes of Cake's instances and of the nosync GIN kernel. It asserts the version floor and that exactly one GIN backend is compiled in. A backend that a future NCCL adds therefore fails the build with a message namingGIN_BACKENDS, instead of a "spill" refusal at load time.- The generated sources and the manifest's device section are untouched. Only the hand-written binding's digest changes.
- The checks are device-pass only, because the nosync kernel includes the Device API in its device pass only.
- Compiled with the header, the SASS is identical to the stock generated source on both NCCL versions.
megamoe_sm120_gin_session. Without this, a shared JIT cache would reuse a module built against another NCCL. The session module has no runtime version check, so that reuse would go unnoticed.GIN_BACKENDSexpectation (3 flags, EFA included), and two "2.30.7" messages updated.Validation. 8× RTX PRO 6000 (SM120), PCIe + 4× 400G NICs, on this branch (rebased on
ceb7af38) and on the earlier base046ec14:| | NCCL 2.32.3 | NCCL 2.30.7 |
|---|---|---|
|
tests/moe_ep/test_sm120_w4a8_cake_host.py| 43 passed | 43 passed ||
tests/moe_ep/test_moe_ep_sm120_w4a8_cake_mega.py,all_gin(8 ranks) | 16 passed each | 16 passed each || same,
lsa_where_reachable(8 ranks) | 16 passed each | 16 passed each ||
tests/moe_ep/test_moe_ep_sm120_w4a8_nosync_mega.py,FLASHINFER_TEST_MEGAMOE_SM120_NIC=1| 39 passed, 2 skipped | 39 passed, 2 skipped |046ec14) on NCCL 2.30.7 gives the same nosync result: 39 passed, 2 skipped.lsa_where_reachable, graph replay, same node, 3 alternating rounds) is unchanged between 2.30.7 and 2.32.3 at 384 / 1024 / 2048 tokens per rank: within 1%. At 4096 tokens the round-to-round spread of each version (~11–20%) exceeds the difference between them.- the wheel only;
- a stale
NCCL_HOME;- an
LD_PRELOADed 2.30.7 with headers next to it;- a library without headers, with
NCCL_HOMEset to matching headers and to mismatched ones.GIN_BACKENDSon 2.32.3, the new assert fails the build.Follow-up suggestions (not in this PR)
ncclGin_BackendOne<backend>would remove the need forGIN_BACKENDS, but it currently cannot be used here:ncclGinBarrierSessionand the signal/counter helpers (ncclGin_getSignalDescriptor,ncclGin_getCounterId) only accept the fullncclGintype, in both 2.30.7 and 2.32.3.This PR was written with AI assistance (Claude Code). I reviewed the changes and the validation above.
🔍 Related Issues
None filed. Motivation: running Cake MegaMoE in a process that also uses NCCL 2.31+ (DeepSeek-V4.1-Flash serving on RTX PRO 6000).
🚀 Pull Request Checklist
Thank you for contributing to FlashInfer! Before we review your pull request, please make sure the following items are complete.
✅ Pre-commit Checks
pre-commitby runningpip install pre-commit(or used your preferred method).pre-commit install.pre-commit run --all-filesand fixed any reported issues.(Ran
pre-commit run --fileson every file this PR changes, not--all-files; all hooks pass.)🧪 Tests
unittest, etc.).Reason: <!-- e.g. cross-cutting change to shared infrastructure -->
Suggested CI test targets (optional; paths under
tests/, whitespace-separated — a startingpoint for
@flashinfer-bot run <targets>//bot run <targets>, reviewers may adjust):tests/moe_ep/test_sm120_w4a8_cake_host.py tests/moe_ep/test_moe_ep_sm120_w4a8_cake_mega.py tests/moe_ep/test_moe_ep_sm120_w4a8_nosync_mega.py🔬 Experimental Track
<!-- Only for PRs submitted under the experimental policy (CONTRIBUTING.md → "Experimental APIs and Backends").
Leave this section untouched for normal PRs. -->
flashinfer/experimental/and/or an@flashinfer_experimental_api. Tracking issue: #- [ ] The tracking issue names an owner, the reason for the experimental path, and a graduation plan with a target release.
- [ ] Core changes are limited to a thin entry point (signature, shared validation, feature-gate check, backend selection, handoff).
- [ ] Tests live in
tests/experimental/and were validated on the intended hardware; a runnable example is included.- [ ] Nothing is registered in
flashinfer/aot.py, and no experimental backend is reachable frombackend="auto"withoutFLASHINFER_ALLOW_EXPERIMENTAL_AUTO_BACKENDS=1. (Calling an@flashinfer_experimental_apior naming a backend explicitly is itself the opt-in and needs no environment variable.)- [ ] Test scope declared below. The experimental CI lane runs exactly these targets, so keep them as narrow as the change allows.
<!-- Required for experimental PRs. Replace the commented lines below with your targets.
Do not delete the fence or change its
experimental-teststag — the experimental-trackwatcher reads it verbatim to decide which targets to ask CI for. -->
``
experimental-tests
`One target per line: a directory or a file. (A pytest ::selector is not
supported -- the sharding runner cannot consume one.) Must be under
tests/experimental/ and must exist. Delete these comment lines and add yours, e.g.
# tests/experimental/test_my_backend.py
tests/experimental/my_backend/
# Declaring the whole tree (tests/experimental/) is allowed but means every
experimental PR pays for every other feature's tests, in every matrix cell.
Reviewer Notes
, instance wrappers, geometry) and the manifest's device section are byte-identical tomain. Only the hand-written binding, the loader, the new hand-written check header and the binding digest change.and thedladdrapproach inloaded_nccl_library()`.🤖 Generated with Claude Code
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
New Features
MegaMoE on SM120 now supports NCCL 2.30.7 and newer when the installed library and headers match.
NCCL GIN builds support selecting among available backends, including EFA GDA, and reject configurations with multiple backends enabled.
Bug Fixes
NCCL-specific build artifacts now account for NCCL installation identity, reducing conflicts between installations.
Version mismatch errors identify the build and runtime versions.
Documentation
* Updated NCCL requirements, backend options, and build checks.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->