Repository navigation
Conversation
This was referenced Oct 27, 2026
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.
Remove BF16 backward gate/up concatenation for merged-LoRA. An optional separate up-weight tensor supplies its TMA descriptor in the existing gate/up passes, preserving K accumulation order. Packed weights remain the default API.
Stacked on #24. Trainer companion: https://github.com/fw-ai/fireworks/pull/68491.
Primitive benchmark
B300, EP=1, 32,768 tokens, H=3584/I=3072, 128 experts/top-8, shared LoRA rank 32, BF16 SiTU beta=4/linear-beta=25. Timing: packed/separate/separate/packed blocks, each with 20 warmups and 41 measured iterations (82 samples per layout). Memory/RSS: separate fresh processes. CUDA host registrations: separate CUPTI callback runs. Excludes merge/router/latent/shared expert and inter-rank communication.
Backward improves 11.3%, combined 7.3%. Forward is unchanged in code but measured 2.1% slower; that observation is retained. The allocation reduction is exactly 5.25 GiB, the removed
[128,6144,3584]BF16 copy. This does not establish an end-to-end trainer speedup. Host counters cover CUDA allocation/registration APIs, not arbitrary OS/RDMA pins; both runs reported zero accounting errors.Validation
deep_gemm-2.8.2+bc31d85-cp312-cp312-linux_x86_64.whlimports with both capability flags under Torch 2.11/CUDA 13.0. Production dependency-image packaging/qualification remains pending.Trace and full-model evidence
Paired primitive traces and memory snapshots are captured. Correlation from CPU
aten::catto GPU launches identifies 16 backward copy kernels across two iterations (12.328 ms total) before, and zero after. Total GPU kernel count falls from 512 to 496. The rendered comparison isanalysis/unpacked-trace-comparison.pngin the local task bundle; it is included in the uploaded GCS bundle linked below.Parent NCU: 86.52% forward tensor-pipeline utilization; backward long-scoreboard stalls 51.02% of average issue cycles, with gate/up activation loads among leading sites. This optimization removes the independently observed packing copy; it does not claim to remove kernel-internal stalls.
The real-checkpoint 20-step CP=2/EP=2, 1K-token rerun completed. Peak GPU allocation fell from the initial integration's 46.517 GiB to 44.213 GiB. DeepEP V2 baseline: 43.644 GiB, so the overall memory gate still fails. The new snapshot identifies a remaining 2.625 GiB forward interleave allocation at the recorded peak. The initial 64K run exposed shared-factor reductions reading unwritten capacity rows. The integration PR fixes this by clearing owned saved-x/grad-y tails before those reductions. All 46 cases pass at EP=1 and on both EP=2 ranks, including four poisoned-tail regressions that fail before the fix. The corrected real 64K comparison below completes all 20 updates. Primitive numbers above precede the correctness fix.
No new kernel launch, host scalar read, GPU fence, collective, environment variable, or checkpoint-format change. Existing dgrad accumulation order/barriers are preserved. Trainer overhead is a capability lookup plus contiguous views of existing tensors. Full-parameter backward retains its packed gradient storage. The long-context factor-gradient failure is fixed in the integration PR; the remaining gates below still apply.
Draft, not ready to merge: full-model CP/document-boundary and AC/offload matrix, full-model performance/memory gate, production dependency packaging, final 256K CP=8/EP=4 20-step comparison remain outstanding.
Compile:
python tests/compile_mega_moe_compat.py --output-dir /tmp/megamoe-compat.Numerical reproduction uses the trainer companion's
train-firetitan-py/tests/kimi_k31/test_megamoe_situ_gpu.pyat EP=1/2 with this build onPYTHONPATH.Validated 64K full-model comparison
Existing
k31_shrinkYAML and real checkpoint; CP=2/EP=2, rank/alpha 32, full AC, fixed seeded synthetic next-token data. Both runs complete 20 optimizer updates. The MegaMoE run uses trainer453c872aa9798e5ce7458fa223aadcff69d70725and nativebc31d854043e1c6c8d169509ae79bf66ee640c28, including the shared-factor capacity-tail fix and separate backward weights.Timings are rank-0 medians over steps 7–20; memory is maximum across ranks. Separate runs used free B300 GPU pairs on a shared host. Combined time is essentially unchanged; this is not the requested 1.5–2× speedup. GPU peak improves at 64K, while host RSS increases. CUDA host counters report zero accounting errors and exclude OS/RDMA pins. The earlier failed 64K run is retained as failure evidence and excluded from this table. Loss/latency/memory plot:
analysis/cp2-65536-capacity-fixed-comparison.pngin the local bundle. Final 256K CP=8/EP=4 remains pending.Uploaded evidence
The completed local test, benchmark, NCU, trace and memory-snapshot bundle is uploaded to
gs://fireworks-fine-tuning-profiles/kimi-k31/yued/20261027-megamoe-merged-lora/(browse artifacts).bundle/analysis/artifact-manifest.jsonmaps local evidence paths to GCS objects; transfer checksums and remote object sizes were verified. The required final 256K CP=8/EP=4 run still needs eight free GPUs and is not included.