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.
Kimi-K3.1's merged-LoRA expert path uses BF16 SiTU, but BF16 MegaMoE only implements SwiGLU/GeGLU. Add SiTU forward and input-gradient support to the existing MegaMoE kernels, with optional gate/up saturation and explicit FP32 rounding before BF16 stores.
This is a draft dependency for the trainer integration. It adds no environment variables and preserves the existing non-SiTU call signatures. SiTU requires post-down routing, unclamped activation, and
fast_math=False; unsupported fused shared-expert and numerical-correction paths fail explicitly. The capability is exported from the compiled extension so an old binary cannot silently accept the new path.Validation
Performance evidence and remaining gates
One B300, EP=1 primitive, 32,768 source tokens, H=3584/I=3072/E=128/top-8/rank-32, BF16 merged weights and SiTU beta=4/linear-beta=25; two warmups and five measured iterations. Excludes merge, router, latent/shared expert and cross-rank communication.
NCU full capture with line information: native forward 15.296 ms, SM throughput 87.946%, tensor pipeline utilization 86.521%, achieved occupancy 23.041%, 128 registers/thread and 227,716 bytes shared memory/block. The wrapper also packs gate/up weights; trainer snapshots identify separate 2.82 GB forward and backward temporaries. The initial full trainer integration regresses warm latency and peak memory versus DeepEP at 1K; removing those temporaries is a separate optimization, and the performance gate is not passed.
CPU/fence review: SiTU adds compile-time-specialized device arithmetic and launch-argument validation, with no new tensor allocations, device-to-host reads, or synchronization in these native kernels. The trainer wrapper's existing routing-plan exchanges and packing remain visible in its traces.
Trace pictures, NCU reports, memory snapshots and the reproducible local harness are retained under
profile/k31-megamoe-merged-lora-20261027/in the development checkout. The completed artifact bundle is uploaded and verified. Pinned-memory counters in this image are inconsistent and are not accepted as peak-memory evidence. Backward source NCU capture is complete (51.02% long-scoreboard stalls). The isolated backward-copy optimization reports a 5.25 GiB allocation reduction and 6.8% combined primitive latency reduction at 32K tokens; its full-model qualification and final 256K run remain outstanding. A driver-level pinned-memory allocation/registration/free probe passes, but workload pinned peaks still need measurement.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.