FP8 Megablox for batch split#3770
Closed
BirdsOfAFthr wants to merge 1 commit into
Closed
Conversation
Collaborator
|
Note there is more general support in this PR #3736 |
47d4976 to
3da5049
Compare
3da5049 to
5992420
Compare
5992420 to
61a6832
Compare
shuningjin
reviewed
May 1, 2026
Collaborator
There was a problem hiding this comment.
Thanks for GMM FP8 support with careful manual quantization, while bringing back merging gating from PR#3199! Had a comment wrt sharding, and other minor changes.
49d07fb to
5ef365f
Compare
shuningjin
reviewed
May 1, 2026
shuningjin
approved these changes
May 1, 2026
4 tasks
copybara-service Bot
pushed a commit
that referenced
this pull request
Jun 11, 2026
# Description 1. Refactor `manual_axis_type` conditional specification. - It was previously introduced by [PR#3770](#3770) and [PR#3869](#3869). - It requires tokamax > 0.12.0 (unreleased yet) with [commit](openxla/tokamax@cc374e3) - It is used for gmm shard_map with check_vma=True. This is currently only activated for experimental run (deepseek_batchsplit and use_manual_quantization). Tests won't blocked by dependency. 2. Add unit test for `use_tokamax_gmm=True` for smoke train. Both bf16 and fp8. - Smoke train instead of AOT as blocked by b/489205940 - Run in g3 only to save github CI/CD time 3. Reset `group offset` to None: [PR#4082](#4082) added `group_offset` to `tokamax.ragged_dot` and `tokamax.ragged_dot_general`. However, `group_offset` is not yet supported by tokamax: - see [tokamax code](https://github.com/openxla/tokamax/blob/cdde910bf925d834c0c9e6cee5a488095f0381d4/tokamax/_src/ops/ragged_dot/api.py#L177-L178) - the added unit test meet [error](http://shortn/_oy55Dkh22N) # Tests unit test `tokamax_gmm_test` # Checklist Before submitting this PR, please make sure (put X in square brackets): - [x] I have performed a self-review of my code. For an optional AI review, add the `gemini-review` label. - [x] I have necessary comments in my code, particularly in hard-to-understand areas. - [x] I have run end-to-end tests tests and provided workload links above if applicable. - [x] I have made or will make corresponding changes to the doc if needed, including adding new documentation pages to the relevant Table of Contents (toctree directive) as explained in [our documentation](https://maxtext.readthedocs.io/en/latest/development.html#adding-new-documentation-files). PiperOrigin-RevId: 930601487
4 tasks
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.
Description
(1) This update enables FP8 Megablox quantization support for DeepSeek batch split configurations.
When quantization is active, the following changes apply:
Kernel Quantization: gmm kernels allow FP8 recipes (defined via the MaxText command line) in both forward and backward passes.
gmmforward: weight is manually quantized to bypass the expcilt sharding error; activation is quantized using qwixgmmbackward: gradients are quantized using qwix.(2) This change also enables merging gating gmm kernels.
In the previous SwiGLU/GLU implementation, the gate-projection and up-projection were processed using two sequential$W_0$ and $W_1$ effectively gives us a 2X increase in that local dimension, restoring arithmetic intensity and hardware utilization.
gmm_fncalls. By concatenating these weights and processing them together, we effectively double the contiguous hidden dimension of the kernel. This is especially critical for FP8 utilizing Expert Parallelism (EP) that shard along the contracting dimension. Because this sharding strategy inherently shrinks the local MLP hidden dimension on each device, the matrix multiplications can become small and bottlenecked by memory bandwidth. MergingTests
Verification: Validated via end-to-end (e2e) perf and convergence benchmarks.
Coverage: Unit tests will be added in a subsequent update.
Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.