[FIX] Fix MoE GMM FP8 accumulator verification error and bump qwix requirement (Maxtext) - #3507
Open
sierraisland wants to merge 1 commit into
Open
[FIX] Fix MoE GMM FP8 accumulator verification error and bump qwix requirement (Maxtext)#3507sierraisland wants to merge 1 commit into
sierraisland wants to merge 1 commit into
Conversation
Signed-off-by: sierraisland <shengjieqian1225@gmail.com>
sierraisland
requested review from
QiliangCui,
gxd3,
jrplatin,
kyuyeunk,
lk-chen and
vipannalla
as code owners
September 2, 2026 06:13
DescriptionStart with a short description of what the PR does and how this is a change from The rest of the description includes relevant details and context, examples:
If the change fixes a Github issue, please include a link, e.g.,: TestsPlease describe how you tested this change, and include any instructions and/or ChecklistBefore submitting this PR, please make sure:
|
sierraisland
enabled auto-merge (squash)
September 2, 2026 10:12
| fuse_act=None, | ||
| preferred_element_type=None): | ||
| gmm_res = gmm_v2( | ||
| try: |
Collaborator
There was a problem hiding this comment.
With this change now all GMM accumulates in f32, i think this is will impact performance for our native model runs.
The real issue is that maxtext models do not properly support fp8 weights, so the fix really should exist on the maxtext side.
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
This PR fixes a fatal Pallas/Mosaic MLIR verification error (
'tpu.matmul' op Expected matmul acc to be 32-bit) encountered when running the MaxText vLLM benchmark with FP8 MoE models (e.g.Qwen/Qwen3.5-35B-A3B) and bumps the Qwix requirement to prevent dependency downgrade conflicts.Root Cause
MaxTextForCausalLM/MODEL_IMPL_TYPE=flax_nnx) on thevllm_rpaattention path,maxtext.layers.moeroutes MoE execution totpu_inference.layers.common.fused_moe_gmm.fused_moe_func. TPU MXU hardware requires FP8 matrix multiplications (f8E4M3FN×f8E4M3FN) to accumulate into 32-bit (f32). In recent JAX (0.11+) and libtpu releases, the Mosaic MLIR compiler enforces this check and fails compilation if the accumulator operand is 16-bit.'use_qwix_quantization': Trueis set in MaxText's quantization configuration, Qwix's thread-localdot_generalinterception inadvertently interceptedjnp.matmulinside the hand-written Pallasgmm_v2kernel, droppingpreferred_element_typeand defaulting the accumulator type tobfloat16.tpu-inference/requirements.txtpinnedqwix==0.1.2, which downgraded Qwix upon installation and broke MaxText compatibility (MaxText HEAD importsqwix._src.core.sparsitywhich requiresqwix>=0.1.8, causingregister_maxtext_vllm_adapterto fail to load on benchmark server startup).Changes
gmm_v2insidegmm_wrapperwithdisable_interceptionsto prevent Qwix from rewriting internal Pallas matmuls during MaxText MoE execution.acc_dtype=jnp.float32ingmm_wrapperto ensure the TPU MXU uses a 32-bit accumulator for quantized GMM kernels.qwix==0.1.2toqwix>=0.1.8inrequirements.txtto align with MaxText's sparsity requirements and avoid adapter plugin import failures.Tests
Qwen/Qwen3.5-35B-A3BMaxTextForCausalLM(MODEL_IMPL_TYPE=flax_nnx)quantization='fp8_e4m3',use_qwix_quantization=True,attention='vllm_rpa'MLIRErrororEngineCorecrashes.Checklist
Before submitting this PR, please make sure: