Add the fully-fused MXFP8 grouped-MLP override - #10
Closed
wolfcomos wants to merge 1 commit into
Closed
Conversation
Stacked on the SwiGLU-override branch: a self-contained override module that runs the whole routed-expert MLP (grouped GEMM + SwiGLU + quant) through fused torchao ops, its unit-test suite, and one deepseek_v3 debugmodel flavor activating it. The ops are gated on torchao availability; without them the tests skip and the factory fails loud. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Owner
Author
|
Folded into the base branch: swiglu-mxfp8-upstream@89fcb0feb unifies the grouped override behind a single MXFP8FusedGroupedExperts with fusion_plan={swiglu, grouped_gemm_swiglu} (own params on stock GroupedExperts, plan-native w13 layout, per-plan dispatcher padding, stock w1/w3 checkpoints both ways). The swiglu plan is bitwise-verified against the pre-unification head; this PR's module and tests are carried over inside that commit. |
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.
Stacked on
swiglu-mxfp8-upstream(pytorch#4257). Adds the fully-fused sibling of the SwiGLU-fused override: the whole routed-experts MLP — FC1 grouped GEMM + SwiGLU + dual MXFP8 quantization, FC2, fused dSwiGLU backward, and wgrad — runs through four torchao grouped-GEMM custom ops (mxfp8_grouped_gemm_swiglu_fwd,mxfp8_grouped_gemm,mxfp8_grouped_gemm_dswiglu_bwd,mxfp8_grouped_gemm_wgrad).Purely additive: one commit, 3 files, +1409/−0. No line of the base branch is modified; the only touched existing file is the DSv3 config registry, which gains one appended debugmodel flavor.
What's in it
torchtitan/overrides/mxfp8_grouped_mlp.py— self-contained opt-in override.MXFP8FusedGroupedExpertsholdsw13natively in[E, 2F, D]32-block gate/up order (the kernels' layout), with DTensor-RNG-preserving param init and save/load hooks that keep checkpoints in stockw1/w3format. The factorymxfp8_grouped_expertstargets stockRoutedExperts.Config, swaps the token dispatcher topad_multiple=256(hard kernel alignment contract: per-expert row counts must be multiples of 256), and fails loud on any non-stock or already-converted config — it and the SwiGLU-fused override reject each other's configs bidirectionally.tests/unit_tests/test_mxfp8_grouped_mlp.py— 17 tests: composite numerics vs a quantized-unfused reference with negative controls, checkpoint round-trips both directions, dispatcher/factory wiring, rejection matrix, zero-token backward, compile. Skips cleanly (not ImportError) on hosts without SM100 or without the torchao ops.deepseek_v3_debugmodel_mxfp8_grouped_mlpconfig flavor.torchao dependency
The four ops live on the torchao side (wolfcomos/ao#5,
torchao/prototype/moe_training/kernels/mxfp8/cutedsl_grouped_mlp.py). Availability is probed at import; when the ops are absent the factory raises with the missing module and requirements named, and the tests skip.Validation
test_mxfp8_swiglu_override.pyunaffected (7/7 with GPU and withCUDA_VISIBLE_DEVICES="").Replaces the closed draft #4 (
cudnn-grouped-mlp), which carried the benchmark arms and evidence record.🤖 Generated with Claude Code