Repository navigation
feat(mega): add fused shared side-LoRA kernels - #9
Conversation
There was a problem hiding this comment.
Stale comment
Risk: high. Not approving: Cursor Bugbot finished skipped/neutral with 2 unresolved high-severity findings (undersized MXFP4 ready buffer; unsafe down-unweighted scratch reuse), and this ~16k-line fused side-LoRA CUDA change exceeds the low-risk auto-approval threshold. Human review is required for the MXFP4 buffer contract and backward scratch aliasing.
Sent by Cursor Approval Agent: Pull Request Approver
There was a problem hiding this comment.
Stale comment
Risk: high. Not approving: Cursor Bugbot completed skipped/neutral with 2 unresolved high-severity findings (undersized MXFP4 ready buffer; unsafe down-unweighted scratch reuse), and this ~16k-line fused side-LoRA CUDA change exceeds the low-risk auto-approval threshold. Human review is required; existing reviewer requests were left in place.
Sent by Cursor Approval Agent: Pull Request Approver
There was a problem hiding this comment.
Stale comment
Risk: high. Not approving: Cursor Bugbot passed with prior findings resolved and Security Agent was not running, but this large fused side-LoRA CUDA training change exceeds the low-risk auto-approval threshold. Human review is required; existing reviewer requests were left in place.
Sent by Cursor Approval Agent: Pull Request Approver
f323595 to
3e45539
Compare
There was a problem hiding this comment.
Stale comment
Risk: high. Left a non-blocking comment and did not approve: Cursor Bugbot completed as skipped with 2 unresolved findings (MXFP4 GeGLU backward; missing post-down fail-fast), and this fused side-LoRA CUDA training change exceeds the low-risk auto-approval threshold. Human review is required; existing reviewer requests were left in place.
Sent by Cursor Approval Agent: Pull Request Approver
There was a problem hiding this comment.
Stale comment
Risk: high. Left a non-blocking comment and did not approve: Cursor Bugbot completed as skipped with an unresolved medium finding (inconsistent MXFP4
fast_mathdefault), and this fused side-LoRA CUDA training change exceeds the low-risk auto-approval threshold. Human review is required; existing reviewer requests were left in place.Sent by Cursor Approval Agent: Pull Request Approver
There was a problem hiding this comment.
Stale comment
Risk: high. Left a non-blocking comment and did not approve: Cursor Bugbot passed with prior findings resolved and Security Agent was not running, but this fused side-LoRA CUDA training change exceeds the low-risk auto-approval threshold. Human review is required; existing reviewer requests were left in place.
Sent by Cursor Approval Agent: Pull Request Approver
1e1b4f7 to
ccaa442
Compare
There was a problem hiding this comment.
Risk: high. Left a non-blocking comment and did not approve: Cursor Bugbot completed as skipped with 1 unresolved high-severity finding (BF16 adapter grads use wrong planes), and this fused side-LoRA CUDA training change exceeds the low-risk auto-approval threshold. Human review is required; existing reviewer requests were left in place.
Sent by Cursor Approval Agent: Pull Request Approver
|
Acceptance audit at exact head
No additional full-model runtime sweep is required for this kernel acceptance seal. |
|
Repeatability attribution is now covered at head
This isolates the small replay drift to the shared atomic dispatch ordering rather than the side-LoRA backward contractions. |
|
Accepted backward stack is now on this PR branch at Validation: host contracts 4/4; clean SM100 wheel; exact 4xB300 BF16 EP4 oracle at 262,144 total tokens/top-k 6/rank 128 is finite with min adapter-grad cosine 0.999942746, native-boundary shared-grad cosine 0.999999075, and grad-x cosine 0.999986239. FireTitan integration additionally passed two repeated 3-step BF16 F/B+AdamW trials bitwise exactly after production shared-factor gradient synchronization. |
…pr9-deepjit-align-20260920
Code review (from-scratch, code-only)Reviewed the full diff (this PR is the superset of merged #17; the #17-specific 1. [High]
|
|
Addressed the correctness findings in 0cbfc76 (now pushed). Items 1–6: separate side23/ordinary22 trace schemas; reject unsupported omitted grad-x pools at both API layers; explicit prepared-gate/up specialization contract; initialized scheduler state; strided prefix over all experts; full side-buffer size validation. Item 7: removed only redundant Python clears, preserving producer completion and publisher clear/barrier synchronization. C++ build, six source regressions, BF16/MXFP4 EP2 numerical oracles, exact zero-scale base preservation, actual 23-site BF16 traces, AC/AdamW integration and the 1024-expert BF16 regression all passed. Full test scope and unchanged 262K/ARM/performance gates are in the new description section. Item 8 (shared-core extraction) remains a follow-up; not claimed resolved by these targeted fixes. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 003b9dd. Configure here.



Current review status — 2026-09-30
Draft. Includes merged DeepGEMM main6ac0f15.
Published DeepGEMM head
b8e547693fd9e8f230bf87f171c0961df04a0b02closes the strict-repeatability failure with stable source-rank-local slots only for side training (kHasSideLora && kSaveL1Preact), explicit warp reader/writer synchronization, parallel prefix when scratch fits, and exact stable-scan fallback. Round-robin transport and ordinary/inference atomic dispatch remain unchanged.A separate oracle bug was corrected: shared A1/A3/B2 reference leaves now accumulate in FP32, with separate BF16 cast nodes per expert use. Forward operands and all thresholds remain unchanged. The activation-rounding-only ablation failed and is retained, not published. The original unchanged strict262K oracle already passed before this reference fix, so repeatability closure does not depend on reference modification.
Final committed-source GPU suite: 6/6 exit0—strict EP4/262144 total tokens; wide-expert shared-counter fallback; actual metadata-capacity fallback; BF16; production forward=True/backward=False; and inference save-L1 false/true bitwise parity. All worker assertions passed; only printed rank0 metrics are claimed. Intermediate reference cosines use their existing thresholds, not a blanket >0.9999 claim. CPU shared-gradient/combined-graph regressions:13 passed.
Local provenance: existing immutable image
sha256:922f688e045efcfee26ee096c52af49bafb4348dbe796781467e30d9cf8ba78d, installed003b native extension plus current Python wrappers/JIT header, not a rebuilt b8e local wheel. Header SHA9f8530f32532aa0fccad50d3b5ad322177ed5bbe355fef453b0fc6d157e3d853; oracle SHAa1dcd22898a5488d3a2c0daf7e578ff87221a751f08909f5ac93e93bce03c220. Fresh-process header hashing and a new strict CUBIN compiled after launch were verified. Full logs:stable-slot-final-committed-gpu.log,stable-slot-final-cpu-combined-graph.log.Matched native-API ABBA, bee1755→b8e, EP4/T65536 per rank, H4096/I2048/E256/top-k6/rank128, forward=True/backward=False, saved-X reuse, same image, 20 samples ×2 per lane: median forward 17.255408→17.394560ms (+0.8064%), F+B 71.122879→71.246769ms (+0.1742%). All4 runs exit0 and pass finite/boundary/full-reference assertions; no OOM/foreign arrival. Evidence:
root-stable-slot-perf-abba-20260930.json. This is not E2E/full-model timing or a replacement for historical speedup measurements.Integration / release gates
Consumer status at 17:54 UTC: ordinary Fireworks#50925 published585494c is ready for review; side#44111 published618c352 remains draft, and both preserve frozen mainbaffda7d. These heads only add the CPU source-overlay CI fix over c164/f4dc. Ordinary coordinator36750640778 passed CPU1691/51 skips +72 isolated and wheel; prepared GPU workspace is synthetic merge39ceb91 (585 into main1c820801), not head-only. DeepSeek-V4 shard36752517117 passed33/40 skips/60 deselected; GLM-5.2 shard36752520153 passed53/29 skips/4 deselected; general36752513651 failed (3726 passed/74 skipped/1 failed plus distributed failures): generic CI DeepGEMM lacks the new layout API, and the zero-rank worker imports TorchTitan's tests package. Skips are not numerical coverage. Refreshed ARM builds36749151989/36749154150 passed installed import smoke (arm64 digests77322bff…/5820e8e9…). Ordinary public runtime36751701917 passed on exact77322bff:13 tests, requests12+11 tokens, public forward/F+B/optimizer step1; required-Helm cleanup41→48 completed17:56:47UTC for trainerp8st8ksmy4f3cvyp, terminal52. Not262K request/performance coverage; no side runtime. A confirmed consumer-only Torch2.14 private-detector bug has local unpushed two-import fixes ordinaryf1863e9/side4a46cae:26 focused CPU cases pass each, ordinary full CPU1699/46 skips +72 isolated. All shards completed; publication now waits for a scoped CI dependency/import remedy decision, not a test waiver. These production Python fixes are absent from the ARM artifacts; they do not alter this DeepGEMM head/native math. Pinned2.11 delegation and mocked-callback2.14 validation remain separate.
Fireworks latest-main refresh: ordinary
c164c68a2171e94c57663da63431af6ab29fb20e, sidef4dca68b97fd608b259966bcd3a5a60cc49eb505. Main's shared MXFP4 decoder is adopted while side's existing local W13 interleaved-store kernel is preserved unchanged. Focused source-overlay dequant: side CPU11pass/38CUDA-skips and GPU49pass/no-skips/noOOM/no foreign arrival; ordinary CPU7pass/31CUDA-skips. Imagesha256:871b71044633b9546ea485e6d5a58dc07b412e30d82610dbb3feec856942b039, current FireTitan/kernels package mounted. This does not rerun native acceptance or rebuild the PR images; earlier image evidence below retains its exact old source. New main also includes upstream RDMA changes, so fresh image/runtime gates remain open. Logs:side-latest-main-mxfp4-{cpu-03,gpu,supervisor}.log,ordinary-latest-main-mxfp4-cpu.log.Fireworks side #44111
f4dca68b97fd608b259966bcd3a5a60cc49eb505pins b8e in its isolated deps Dockerfile and Makefile. Both Fireworks heads include mainbaffda7d10490bc980a9978f69a8392c534d5b62.Earlier e836/4c887 exact-head CPU 36662914940 passed:95 consumer cases +8CUDA-only skips per head,45 ordinary /48 side workflow contracts,2 wheel tests each. Skips are not hardware acceptance. Corrected lifetime instrumentation, fail-closed FSDP compatibility and construction-only fake-math fixture isolation preserve real FSDP/DTensor/AC/optimizer and dependency-rejection checks.
Earlier e836/4c887 composed GPU follow-up passed: all5 fixture commands exit0—8 byte-exact BF16 checkpoint VJPs; DSV4+GLM BF16 full-AC/FSDP two-step parity with bitwise outputs;21 fused-MXFP4-merge/expanded-FP8 consumer cases; side BF16 three layers ×3 AC/FP32AdamW steps with13 trace captures per rank; side MXFP4 H1792/I768 three layers ×3 AC/AdamW steps with disabled/category-masked/all-masked routes. No OOM or foreign GPU arrivals. Sources tested: ordinary e836, side4c887 with b8e native wrapper/header; later side d6b0036 changes only the external auth harness, so model/kernel paths remain identical. Existing immutable local images with current source/helper mounts are not rebuilt current-head images. Logs:
current-ordinary-integration-gpu.log,current-side-integration-gpu.logand matching supervisors.Earlier ARM native deps b8e 36662911986 passed (wheel2.8.0+b8e5476; ARM
sha256:1830de36b3e337e98da105547145ed4b0cf48be996af25d41f05f9a30260bb99). Side trainer 36663689528 passed, including installed canonical BF16/native imports; ARMsha256:47ee1b9ab851b48086c366e7515ca06f0555689c37169f96579c99961afe8aa8, indexsha256:1d3155ff7d1fc4aba304a88c807f7ce06ee701b7fb13fe099c64242ec60ace12. Built-for-e836 ordinary trainer 36663008182 passed, including installed canonical BF16/native dependency closure smoke; ARMsha256:a1d0d29b78b08a57c72ba0731f9c8216b7e476e19133fe9c0121a4532dcce169, indexsha256:500813d8f64245c3355414037476a662c074f665787384aa20dd4f017442736a.Older d3630/main47 ordinary runtime 36661470294 reached readiness (Temporal event19 at03:19:23UTC), then failed with sanitized AuthenticationError before public operations. Exact CI Tinker0.16.1 offline wire test reproduced duplicate API-key headers from a case-sensitive merge; canonical
X-API-Keyfixes it. Regression failed before and full harness passed12 tests/1runtime skip afterward; published side d6b0036 changes only this external harness. Actual required-Helm cleanup completed event43 at03:20:19UTC, not a DELETED-only waiver. One auth-fixed serialized retry 36664741744, validation635d264fa10, created trainerbugxxuflwguaz5dnat03:33:14UTC against the then-current e836 ordinary ARM image above, but failed before readiness at03:51:16UTC with explicitJOB_STATE_FAILED(12 local harness tests passed,1runtime failed). No public operations ran. Temporal confirms readiness activity17 failed at03:51:08 withPod trainer-training-rlor-bugxxuflwguaz5dn-0 failed: unknown(PREREQUISITE_NOT_MET, non-retryable). Required-Helm cleanup23→25 completed at03:51:12UTC with PreserveDebugInfo=false; cleanup is proved. Direct pod get/log/events access is denied, but existing read-only GCP Logging recovered202 exact-pod events: 25 distinct pod UIDs and25 explicit Preempted events, from03:34:16 through03:51:11UTC. Preemptions at03:51:06 and03:51:11 bracket the Temporal failure. This establishes repeated preemptible scheduling/capacity interruption; it does not pass runtime acceptance or establish a kernel/auth failure. Evidence:ordinary-bugxx-central-events.jsonandordinary-bugxx-preemption-proof.json. Full log:ordinary-e836-auth-fixed-runtime-full.log. Side runtime remains unallocated pending capacity coordination; no blind retry or changes to region/reservation/priority. Region remains omitted/backend-selected. No public-operation acceptance yet; configured262K capacity is not a262K public request. Other matrix jobs with skipped work steps receive no hardware credit.Remaining: fresh current-head Fireworks image/build verification, completed exact-image ARM public F+B/optimizer acceptance, existing matched full-model performance/memory acceptance, and fresh human review. DeepGEMM #9 remains unmerged; side must repin the merged SHA after separately authorized human merge. No approval, merge, rollout or tolerance waiver.
Superseded acceptance summary (frozen; current status above governs)
Summary
Native BF16/MXFP4 MegaMoE side-LoRA forward/backward, including shared A1/A3/B2 factors, expert-local B1/B3/A2, bounded scratch and native adapter gradients. Latest published fix makes public side backward BLOCK_M rank-uniform before native launch; callers may explicitly retain a proven uniform forward tile.
Published head:
bee17552ffa4cd0d10a2ead4885eed824a720587. Includes DeepGEMM main6ac0f152af8fd22dce9bb3445d2eda4afeb57263. Draft; clean mergeability is not completed acceptance. No merge or fresh human approval claimed.Dependencies and review order
Review this kernel PR before Fireworks #44111, which explicitly pins this unmerged SHA. Ordinary Fireworks #50925 uses merged DeepGEMM 6ac0f15 and is independent of this side-specific numerical gate.
Acceptance at the published source
dev-megamoe-side-bee1755-c6b7f9ef-20260929-arm; OCI/GAR indexsha256:a0d391dd505bdcb249cb508d4e2bbe78d3f4be6e86f02bef3a7cf8e1f75faa9c; ARM manifestsha256:5a4133f50a97145b4fc789415700a4ee100d4c4b7bb03664000babe2d50be086Failure ledger (exact heads/images, failures, control attribution and remaining work):
/shared/morgendave/megamoe-pr-ready-20260929/failure-ledger.json. Full logs, immutable image IDs, commands, boundary captures and source hashes:/shared/morgendave/megamoe-pr-ready-20260929/validation-metadata.jsonand adjacent logs. Earlier multi-layer AC/optimizer and production-shape evidence is retained below with original heads; not relabeled as fresh acceptance.Remaining gates
accounts/training/rlorTrainerJobs/ncrt470fjzihociyis a retained DELETED row and its shape is404, but actual GPU workload teardown still lacks independent proof. No new remote allocation or DELETED-only bypass.sha256:39ff45929fece8b2704f5718198d9a35163899dcd4a3474817271322a48eb468, existing native deps unchanged; no GPU/source copies in probe.Historical evidence and progress (frozen snapshots; current status above supersedes old head/progress claims)
2026-09-30: rank-uniform backward fix; acceptance still incomplete
New bounded numerical mechanism evidence (not 262K closure)
One small EP2 MXFP4 boundary capture/replay completed at T128/rank, H1024/I512, E8, top-k2, rank128, remote routes, 20% masks, clamp10, pre-down, forward fast_math=True / backward=False. On both ranks, the two identical-input redispatches produced different physical row orders but all eight canonically aligned BF16 contraction operands were bitwise identical. Actual prelude dYe was cloned before scratch reuse and verified against source grad_y. All six native contraction replays matched original native gradients bitwise. Changing only first-capture row order to the second reproduced every observed gradient difference (max relative L2: rank0 3.8310434e-5, rank1 2.9796895e-5); fixed-order value differences and canonical-order repeats were exactly zero. This establishes a row-order cause for this fixture only, not for the original 262K failure.
No production/native kernel edit or port was made. The diagnostic is an uncommitted change to the existing oracle; exact-source patch, full log
row-order-mechanism-gpu-002.log, and 27 MiB of boundary captures/reports underrow-order-mechanism-20260930-001are retained in the evidence directory. Initial entrypoint-only failure001 occurred before Python/GPU work; corrected002 is the only actual diagnostic run. Existing immutable003b extension plus bee1755 Python wrapper provenance applies. No timing claim. A possible minimal follow-up is stable MXFP4 side-training source-slot assignment, retaining deterministic round-robin transport; no automatic rank-major port. Two extra prefix/grid-sync phases may cost latency, with prefix scratch reused from metadata, so performance must be measured. The strict262K gate, ARM runtime and current matched full-model acceptance remain open.Current ARM deps refresh succeeded: 36648021683, native aarch64
deep_gemm-2.8.0+bee1755, source assertion passed; OCI/GAR indexsha256:d63965a4ea96dfd9f65fd823d53ff2f5cd7fd547c31b4a896227d17351ee7869, ARM manifestsha256:79778882c996cb9f75fbed13e0aefbb6abb0ac4308e12a0e42a1c1b50f368666. Trainer 36648850649 is building the same pinned validation source and unique tag; no runtime allocation.Current published patch and previous focused acceptance
Current kernel head
bee17552ffa4cd0d10a2ead4885eed824a720587includes DeepGEMM main6ac0f152af8fd22dce9bb3445d2eda4afeb57263. Composed #44111 headff6ea894f8b8b5c1517c10d0c153ec06ea77ca82includes Fireworks main snapshota5f4e8ec250221b7893e0be9ebcd201d37ec79fb. Latest main-only refresh does not change scoped training/kernel sources.Fixed review finding 4138744373: both side backward wrappers now MAX-reduce rank-local BLOCK_M before native prelude/wave by default. Keyword-only
rank_uniform_block_m=Trueis an explicit caller contract for a retained, proven rank-uniform forward tile; FireTitan supplies that tile, including activation recomputation. No C++/CUDA math change. Review reply 4139508949; thread resolved, zero unresolved threads at this snapshot. Historical approval is not fresh approval of this head.Focused verification: 10 CPU kernel contracts + 6 FireTitan CPU integration contracts passed. Real two-rank NCCL tile-uniformity cases
(0,4096),(7,4096),(4096,4096)passed, as did explicit fast-path CUDA graph capture/replay. BF16 and MXFP4 EP2 native F+B oracles passed with injected backward local tiles16/128, remote routing,20% masked slots and saved-X reuse (T128/rank,H1024/I512,E8,topk2). Forward fixture remains uniform: this is not full uneven-input/empty-source native-kernel certification. Initial helper launch failed Docker hostname rendezvous; explicit localhost retry passed.Exact local provenance: immutable image
sha256:922f688e045efcfee26ee096c52af49bafb4348dbe796781467e30d9cf8ba78d, installed003b9dd C++ extension, newbee1755backward.pymounted read-only; C++/CUDA tree unchanged. Not a rebuilt bee1755 local wheel. Correctness only, no timing claim. Full logs in/shared/morgendave/megamoe-pr-ready-20260929:kernel-block-m-contracts-final.log,side-block-m-integration-cpu.log,side-block-m-nccl-capture-gpu-retry.log,side-block-m-{bf16,mxfp4}-gpu.log.Current native ARM artifact refresh: deps 36648021683, validation source
2f5f5490042fea2eb90999b28e68192045270869, unique tagdev-megamoe-side-bee1755-c6b7f9ef-20260929-arm; build in progress. Older003b artifacts below remain historical. No ARM runtime acceptance or additional allocation: prior trainer tombstone does not establish actual GPU teardown; independent workload absence/successful cleanup evidence is required.Strict262K gate remains failed at unchanged
<1e-4; current head is not recertified. CPU metric-precision audit of independent retained full adapter captures confirms both old/new self-repeat cases exceed1e-4 using FP32 and FP64 norms (maximum metric change about1.45e-11); metric accumulation precision is not the explanation. These are separate captures, not the original in-process failure tensors. BF16 stable route compaction versus MXFP4 atomic destination ordering supports a possible reduction-order mechanism, not an isolated causal proof. Existing oraclecalc_diffis not strict norm-relative L2 and cannot replace that gate. This remains an engineering/numerical blocker, not merely pending approval.Matched current full-model performance/memory, ARM runtime and fresh human review remain open. PR stays draft/unmerged; #44111 pins this unmerged dependency. No tolerance relaxation or skipped-job acceptance. This section supersedes older current-head/progress statements below; historical evidence is retained with its source provenance.
Historical composed freshness: #44111 head
a759279e40d608103eb0981939f380dd9ad31c31includes Fireworks mainb7f286837d121423bf78fcf81c63bb15b96575dd; latest two main commits are unrelated DB artifacts/perfagent. Kernel head and all numerical/runtime acceptance limits below are unchanged. #9 stays draft and unmerged.2026-09-29 23:32 UTC: final composed status — no runtime waiver
Kernel head remains
003b9ddfcef7d56d7ebce04d90a389bb84d7ee75, main6ac0f152af8fd22dce9bb3445d2eda4afeb57263, no new kernel edits. Current integration #441119b0175d28c0eb0a0328903e24d960ad156f0b920includes Fireworks mainc68ac3aad25da7fc8e054f5cb681bc2e03cee5af; refreshed CI/client contracts54passed1runtime-skip. Production model/kernel tree unchanged; new main-owned test-harness behavior is not relabeled as earlier GPU coverage.Exact native ARM deps/trainer builds below succeeded. Corrected runtime 36644573237 failed before trainer creation on prior-resource absence verification. Read-only observation 36645277143 confirms the old trainer is a retainedDELETED row and its shape is404, but actual GPU workload absence/successful cleanup-activity evidence remains unavailable. ARM runtime not accepted; no additional remote allocation. See #44111 for full provenance and infrastructure blocker; this is not a kernel failure.
Strict262K gate still fails its original threshold as detailed below. Matched full-model performance/memory and fresh human review remain open. No waiver, merge, approval or dependency repin claimed.
2026-09-29 23:20 UTC: exact ARM artifacts built; runtime still pending
Kernel head remains
003b9ddfcef7d56d7ebce04d90a389bb84d7ee75; DeepGEMM main remains6ac0f152af8fd22dce9bb3445d2eda4afeb57263. No kernel edit since the validated tree below. Current composed #44111 head is9f9dd5fcbd6e12b99f679a0f4d5ca4a8d7cbfee0, merged Fireworks maine3b1c842a0f42c60a5126ba9def7af8e57e91dfawith relevant model/kernel sources unchanged.Actual native ARM deps 36637332135 and trainer 36638653713 builds succeeded. Logs verify aarch64 DeepGEMM
2.8.0+003b9ddand source assertion. Trainerdev-megamoe-side-643983b8-20260929-arm, immutable OCI/GAR indexsha256:59c204e3d0718ccb5e8aeb1dfef72d1b26fbd46613fdd0265d3e94d7e6f41d58, ARM manifestsha256:e440863a0f47b4216e01c6632a3e72ce4d98be6c37b6a2af365e45ded4bbaf02.First side runtime reached RUNNING but its deprecated-route client waiter never submitted public operations. Cancelled run36640664360 performed its own cleanup successfully. Fixed gateway-proxy client has 6 CPU passes,1 runtime skip. Corrected bounded runtime 36644573237 uses the same immutable artifact and requires prior trainer/shape404 before another GPU allocation. No ARM runtime acceptance yet. Full provenance/status is maintained on #44111; skipped matrix wrappers are not tests.
Strict262K gate below remains failed at the unchanged threshold. Full-model performance/memory acceptance and fresh human review remain open. #9 is unmerged; #44111's pin explicitly targets this PR head. No merge, approval, tolerance relaxation, or waiver claimed.
2026-09-29: merge-main refresh and explicit remaining acceptance gates
Head
003b9ddfcef7d56d7ebce04d90a389bb84d7ee75merges DeepGEMM main6ac0f152af8fd22dce9bb3445d2eda4afeb57263(merged #17). Tree identical to previously tested0cbfc76f5306a41e2b28c031734ddb80e0c90e45; no kernel behavior edit. Source contracts rerun: 6 passed.Exact-source C++ extension rebuilt using FireTitan's isolated MegaMoE Dockerfile. Local side overlay
sha256:922f688e045efcfee26ee096c52af49bafb4348dbe796781467e30d9cf8ba78dlabels this exact003b source. Composed with refreshed FireTitan #44111643983b8cb72086914cd7deba919a88c8312cb22/ merged TorchTitan deepseek-ai#142035f2754: actual 2×B300, BF16 and MXFP4(H1792/I768),3layers×3steps, non-reentrant AC, FP32-master/state AdamW all passed exit0; BF1613traces/rank,23-site schema; frozen-base, masks and zero-route coverage passed. Full commands, base digest and scope in #44111 September29 section. Logs/shared/morgendave/megamoe-pr-ready-20260929/{kernel-source-contracts,side-overlay-build,side-bf16-ac-gpu,side-mxfp4-ac-gpu}.log.Strict 262K repeatability gate remains failed — no waiver
Historical EP4, 65,536 tokens/rank (262,144 total), H4096/I2048/E256/top-k6/rank128 full-redispatch same-version repeat results:
d6fbae484c4cc7068aec00fe77ace9b1e273eb43118a7f9a379d56409e9b7608145d5b02729bb650Absolute difference between the two self-repeat maxima: 0.00000180474397573359. This is not a direct cross-version tensor-difference metric. Outputs/grad-x/router were bitwise; fixed-saved-boundary backward gradients were exact. Both historical logs end in AssertionError at the unchanged threshold. These heads are not current
003b9dd; this is not a current-head pass. Reviewer disposition remains required, with no invented waiver or threshold relaxation.Raw logs:
/shared/home_workdirs/morgendave/megamoe-upstream-align-0920/pr9-old-side-mxfp4-262k.logandpr9-side-mxfp4-262k.log; provenance inpr9-body-upstream.md,pr9-body-parity.md, andparity-report.mdin that directory.ARM exact-head runtime, matched full-model performance/memory and current-head human review remain open. September29 tests are focused B300 composed-stack correctness, not fresh262K strict repeatability/full-model performance certification. Earlier reviews cover older heads. No merge, approval, tolerance relaxation, default rollout, or waiver claimed. #44111 explicitly pins this immutable PR head, not a merged-main dependency.
2026-09-25: address review correctness findings
Current side-kernel head:
0cbfc76f5306a41e2b28c031734ddb80e0c90e45.write_grad_x_pool=Falsein Python and host code before launch, rather than silently forcing writes into a caller's zero-sized pool. Default is explicitly True.valid_value; stride the stable prefix pass over experts beyond the dispatch-warp count; validate the complete side symmetric-buffer extent.Fresh final-source validation
0.638.490; 6 source-contract tests passed.No new full-model/262K performance, ARM runtime or immutable-image claim. Shared-core deduplication remains a follow-up; existing rollout and repeatability gates stay open.
2026-09-21: restore wide-K wgrad safely
Kernel heads: ordinary
0be759300fd5d198ef211e452ccb857217c41a1a(#17), side stack48e4df7b5c964257987d2a431b5b3540ecbfc5a7(#9). Integration pins: ordinary8d27eeb21aa48e995fb1a3f0e354190c7a70c7ff, sidea98db521e7003f018c0c5c114ce73dd43a08e157.Implementation
Matched production-shape performance
Same physical 4×B300 GPUs, EP4, 65,536 tokens/rank / 262,144 total, H=4096, I=2048, E=256, top-k=6, side rank=128. Old
d6fbae4, upgraded pre-optimization118a7f9, optimized48e4df7. Each path retains its corresponding integration math/ring policy.F+B is directly timed, not the sum of separate medians. Side rows include shared-factor EP gradient reductions. Each phase: 3 warmups, 3 rounds × 10 measured samples, CUDA events, max rank per sample, then median. These final-head values are separate from the two earlier candidate runs that reproduced the recovery.
Ordinary W13/W2 wgrad+combine dropped from approximately 39.79 → 13.48 ms BF16 and 39.28 → 12.50 ms MXFP4 in separate component diagnostics. The previous 25–31% ordinary F+B regression is resolved at this native-API fixture; this does not certify whole-model E2E.
Accuracy and regression tests
cuMemCreatepermission error; only sanitizer reruns disabled expandable segments. Production accuracy/performance retained their allocator configuration.Scope: native single-layer API/core; excludes base transforms, routing-plan construction, AC, optimizer timing, model E2E, and ARM runtime. Existing full-redispatch MXFP4 gradient-noise limits are not relaxed or declared fixed. The 224 change isolates MegaMoE wgrad only, not every generic DeepGEMM caller.
Historical section: Prior alignment validation and historical measurements (superseded heads)
2026-09-20: upstream-upgrade alignment (Draft)
Current head:
118a7f9a379d56409e9b7608145d5b02729bb650, based on main02452d4(#15/#16), including the ordinary-training alignment in #17.What changed
side_lora=Truebuffer API without adding the BF16 source plane to ordinary MXFP4 inference/training.Fresh validation
Matched old/new performance (2026-09-21): ordinary backward regression — NOT sealed
Same physical 4×B300 GPUs (4–7), EP4, 65,536 tokens/rank / 262,144 total, H=4096, I=2048, E=256, top-k=6; side rank=128. Old
d6fbae4versus new118a7f9. Each version retains its native layout/ring policy and integration math flags. Ordinary rows compute full BF16-output W13/W2 gradients; side rows compute adapter gradients.Each phase uses 3 warmups and 3×10 CUDA-event samples, max rank per sample, then median. F+B is timed directly, not added from F and B medians. Side B/F+B below include shared-factor EP gradient reductions.
Separate backward-component diagnostics localize the ordinary regression to W13/W2 wgrad+combine, not dgrad:
These diagnostic events run in separate passes, outside primary timing. Source inspection shows old pool BLOCK_M=192 selects wgrad K=64, whereas new BLOCK_M=240 selects K=16. This is a concrete candidate mechanism, not yet an isolated causal proof; do not force K=64 over incompatible expert boundaries.
Scope is single-layer native API/core, not model E2E: no base transforms, routing-plan construction, AC, optimizer, or integration-memory timing. Selected cards were free before each case; the unrelated service on GPU 0 was left untouched. BF16 side being approximately flat does not imply its backward improved. No kernel code was changed to obtain these numbers, and this update does not certify full-model/ARM runtime or close existing repeatability/memory gates.
Reverse-order confirmation (new then old) reproduced the result: ordinary BF16 F+B +31.72%, ordinary MXFP4 +24.71%, side BF16 -0.73%, side MXFP4 -3.98%. Both complete matrices finished successfully; all tested outputs passed the benchmark's finite checks.
Four-mode numerical coverage (2026-09-20)
The previous direct comparison covered side-LoRA only. Coverage now also includes ordinary MegaMoE with full W13/W2 weight gradients.
Matched old
d6fbae4versus new118a7f9: EP4, 4 B300 GPUs per run, 65,536 tokens/rank (262,144 total), H=4096, I=2048, E=256, top-k=6. Side rank=128. Two full F+B repetitions per version/form/precision; all-rank full tensors compared with input/weight SHA-256 checks and FP64 metric accumulation.Direct old/new numerical comparison (2026-09-20)
Compared old
d6fbae484c4cc7068aec00fe77ace9b1e273eb43against new118a7f9a379d56409e9b7608145d5b02729bb650, not two independent cosine-to-oracle numbers.fast_math=True; MXFP4 forwardTrue, backwardFalse. Native tile selection is retained: old BLOCK_M=192, new BLOCK_M=240.||new-old||₂ / ||old||₂. Table values are the worst rank/tensor across both comparisons, not rank averages.BF16 adapter gradients are also bitwise identical, both cross-version and within each version. MXFP4 adapter gradients are not bitwise: maximum absolute difference is 0.0078125 for shared A1/A3/B2 and 0.001953125 for expert-local B1/B3/A2. The same-version control's worst gradient relative L2 is 1.6450903e-4 old / 1.8329473e-4 new. Cross-version differences are slightly larger, but remain at the same small numerical scale; this does not relax the existing 1e-4 redispatch gate or claim universal determinism.
Scope: synthetic single-layer production-shape kernel parity, not a 43-layer checkpoint, AC/optimizer trajectory, full-model performance or memory seal. Accuracy comparisons ran on separate free 4-GPU groups where overlapped; no timing claim is derived from these runs.
Not sealed / do not reuse historical claims for this head
d6fbae4control also fails at ~1.62e-4. Both versions retain bitwise outputs, grad-x/router gradients, and all gradients when saved inputs are held fixed. This control establishes a pre-existing failure of this gate, not a claim of end-to-end bitwise backward.Review order: ordinary alignment #17, then this side-kernel update; FireTitan integration is tracked in fw-ai/fireworks#44111.
Historical section: Historical implementation, measurements and validation
Summary
Correctness coverage
The numerical harness checks BF16 and MXFP4 forward/backward against independent references and checks every adapter contraction again at the exact saved native kernel boundaries. Coverage includes:
The exact DSV4 Flash production-width sweep uses H=4096, I=2048, 256 experts, top-k 6, remote routing, and 20% masked routes. BF16 and MXFP4 cover all 15 token counts per rank:
1, 15, 16, 17, 90, 91, 176, 177, 346, 347, 688, 689, 1029, 1030, 2048These straddle every relevant BLOCK_M scheduling transition. The exact native-boundary adapter contractions remain above 0.9999 cosine. The independently dequantized PyTorch graph is retained as a separate approximate end-to-end quantization reference and is not substituted for the native-boundary gate.
At the exact 262,144-token EP4 FireTitan control shape:
All fused tensors are finite. Zero-scale BF16 and MXFP4 outputs remain bitwise identical to original MegaMoE.
Performance
B300 exact DSV4 Flash shape: EP4, 65,536 tokens/rank, 262,144 total, H=4096, I=2048, 256 experts, top-k 6. Control and candidate both use side-LoRA and include shared-factor EP reductions.
With the identical non-reentrant whole-MoE checkpoint wrapper:
Timing provenance remains the previously recorded B300 production-shape run; no old timing is relabeled as a post-rebase measurement.
Bounded MXFP4 scale storage
The symmetric arena now sizes scale-factor rows only for BLOCK_M regimes reachable at each live-token count and asserts the launch-time requirement. DSV4 EP4 one-wave provisioning uses 350,208 scale rows rather than the unreachable BLOCK_M=8 worst case. Together with the FireTitan one-wave token ring, the exact production arena falls from 10.794 GiB to 5.606 GiB without changing kernel arithmetic. Direct EP2 repeatability is bitwise exact for fused output and for all gradients when the saved forward boundary is held fixed.
Integration stack
This PR owns the standalone kernel ABI, edge-case correctness, and kernel-level performance contract. The private integration remains disabled by default and requires a trainer image containing this revision.
Historical validation (before the headroom update)
main/ fix(layout): support strided PSUM scale packing #114 passedHistorical source head:
b56ba1f57c89e1b6ac228bb9db4d409960e04484(acceptedc4d23b1+ff3ca21stack). The numerical/performance tables above are retained historical measurements, not a new headroom-on benchmark.2026-09-10: synchronize with main and cover side-LoRA headroom
Current source head:
d6fbae484c4cc7068aec00fe77ace9b1e273eb43.0913be4(including feat(mega): capture MXFP4 L1 pool across ring wraps #12 capture changes and mega_moe: configurable SM headroom on cooperative mega grids (DG_MEGA_MOE_SM_HEADROOM) #13 configurable SM headroom), preserving the accepted side-LoRA stack.DG_MEGA_MOE_SM_HEADROOMdefaults to 0 and rounds up to an even reservation; the explicitDG_BF16_MEGA_MOE_NUM_SMSforward override retains precedence. Ordinary dense adapter GEMMs are not indiscriminately capped.python tests/test_mega_moe_headroom.py -v— 4 tests passed, including 11 host-policy cases compiled from the actual C++ helper and launch-wiring checks.test_mega_moe_native_side_lora.py+test_mega_moe_headroom.py, CUDA hidden).Headroom remains a deployment-configured coexistence measure, not a guarantee against arbitrary concurrent kernels. This update does not claim a new NCCL overlap stress-test or full-model performance result.
Private trainer integration and trainer-dependent E2E sources remain outside this public repository.