Repository navigation
Fold Fireworks' four DeepGEMM build patches into main (SiTU, MHC graph replay, sigmoid-bf16 gate) - #19
Conversation
Kimi K3 SiTU activation for the SM100 FP8xFP4 MegaMoE, previously applied at build time from Fireworks' third-party/deepgemm-situ.patch. Same +/- lines as the patch; three hunks were re-anchored by hand on main (side-LoRA shifted the context): the `situ` accept in get_symm_buffer_size_for_mega_moe_v3, the current-device symmetric-buffer allocation in SymmBuffer, and forwarding `situ_kwargs` from fp8_fp4_mega_moe to `_C`. SiTU stays unsupported in the side-LoRA paths added by #9 (as in production, which has no side-LoRA): their kernels only implement SwiGLU/GeGLU and fp8_fp4_mega_moe_side_lora / bf16_mega_moe_side_lora still reject it. Co-authored-by: Ishaan Shivhare <[email protected]> Co-authored-by: Matt Murphy <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ph-replay.patch) Clear the active split-barrier lines before each mega_mhc launch so CUDA graph replays, which reuse %gridid, cannot observe a previous replay's completed tags. Previously applied at build time from Fireworks' third-party/deepgemm-mhc-graph-replay.patch (fw-ai/fireworks#49884); applied unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d-bf16.patch) Add scoring_func='sigmoid_bf16' (ScoringType::SigmoidBF16), which rounds logits to BF16 before the sigmoid like low-latency routers, and the deep_gemm.bf16_mega_gate_supports_sigmoid_bf16 flag. Previously applied at build time from Fireworks' third-party/deepgemm-sigmoid-bf16.patch (fw-ai/fireworks#49884); applied unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…apability.patch) Export deep_gemm.mega_mhc_supports_graph_replay so callers can detect the graph-replay barrier reset. Previously applied at build time from Fireworks' third-party/deepgemm-mhc-capability.patch (fw-ai/fireworks#49884); applied unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Risk: medium. Not approved. This is not a mechanical low-risk change: it adds SiTU kernel numerics, MHC CUDA-graph barrier reset, and sigmoid-bf16 router scoring, so a human should check activation/scoring correctness and graph-replay safety. Bugbot passed with no findings; Security Agent was not present. Human review is needed and no reviewers were assigned.
Sent by Cursor Approval Agent: Pull Request Approver
|
@cursor is it possible for you to review and approve? |
|
I can't approve this PR, because my GitHub access is read-only and I have no approve action, so someone with write access needs to do that. I did review the full diff (10 files, +81/−19) and found nothing blocking. I'd be comfortable seeing it approved once the test gap below is addressed or accepted. What I checked and found correct
Non-blocking suggestions
I didn't run any builds or GPU tests in this environment, and I made no changes to the branch. |
|
bugbot approve |
|
/bugbot approve |
- tests/test_mega_moe.py: test_mega_moe_gated_activations(_ep2) runs fp8_fp4_mega_moe (EP1, and EP2 when two GPUs exist) for SwiGLU, GeGLU and SiTU against a dequantized PyTorch reference that follows the kernel's numerical boundaries. SiTU is checked for three (situ_beta, situ_linear_beta) settings and must differ from SwiGLU; SwiGLU/GeGLU outputs are bitwise unchanged with situ params unset, explicitly None, or set (they are ignored there, as today). - tests/test_mega_gate.py: `sigmoid_bf16` reference (BF16-rounded logit before the sigmoid) and test_mega_gate_sigmoid_bf16 on inputs with order-independent exact FP32 logits; checks the capability flag and that plain-sigmoid scores are distinguishable. - tests/test_mega_mhc.py: test_mega_mhc_graph_replay captures mega_mhc once and replays it back to back with different inputs, bitwise against eager, plus the capability flag. With the per-call barrier reset disabled in a scratch build this test fails reliably. - Keep pytest from collecting the `test_filter` helper and test_mega_moe's spawn entry point. - csrc/apis/mega_mhc.hpp: fix the stale comment on per-stream barrier allocation (comment only). Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thanks @cursor. I've closed the test gap in e5c0103 and fixed the stale comment. New tests (B300; on this branch built with no patches,
Not changed: I left the "reject 🤖 Generated with Claude Code |
There was a problem hiding this comment.
Risk: medium. Not approved. This is not a mechanical low-risk change: it adds SiTU kernel numerics, MHC CUDA-graph barrier reset, and sigmoid-bf16 router scoring, so a human should check activation/scoring correctness and graph-replay safety. Bugbot passed with no findings; Security Agent was not present. Human review is needed and no reviewers were assigned.
Sent by Cursor Approval Agent: Pull Request Approver



What
This moves Fireworks' four DeepGEMM build-time patches into the tree, so Fireworks can build
fw-ai/DeepGEMMmaindirectly with no patches. The patches come fromthird-party/in the Fireworks repo. Each is one commit, in the order Fireworks applies them, with the original authors:7f60195deepgemm-situ.patchsitu_beta/situ_linear_beta)8fed407deepgemm-mhc-graph-replay.patch2423d3edeepgemm-sigmoid-bf16.patchbb9e55edeepgemm-mhc-capability.patchSize: 10 files, +81/−19.
Conflict resolution
main's side-LoRA refactor (#9) shifted the code that threesituhunks touch:situaccept inget_symm_buffer_size_for_mega_moe_v3;SymmBuffer;situ_kwargsfromfp8_fp4_mega_moe.They are re-anchored with exactly the same added and removed lines. The SiTU kernel,
types.cuhand the host impl are byte-identical to the patched pin.The side-LoRA forward paths still reject
situ, because their kernels only implement SwiGLU/GeGLU. That matches current behavior. Side-LoRA sizing goes through v3, so it now acceptssitu.Verification (B300)
X is the build Fireworks ships today:
c2e49f5plus the four patches. Y is this branch, built with no patches.deep_gemm.*names Fireworks uses exist with identical signatures.get_symm_buffer_for_mega_moeandSymmBuffergain a trailingside_lora=False, which existing calls don't see.main's own #17 (a new template argument), not from this PR. Outputs are bitwise equal and perf is unchanged (geomean 1.000 over 470 shapes). The Hopper (sm90) precompile produces identical keys (190 entries).test_mega_moe.py(1 and 2 ranks);sigmoid_bf16reference intest_mega_gate.py;mega_mhccapture-and-replay intest_mega_mhc.py(fails 3/3 without the per-call reset). All pass on B300.test_mega_moefp8×fp4 and BF16 at 8 ranks, compat, mega_gate, mega_mhc, an fp8_fp4 GEMM subset,test_bf16, and 51 cheap side-LoRA tests.Not run:
Follow-ups
main.🤖 Generated with Claude Code