perf(GMM-v2): fuse transpose_rhs into GMM-v2 kernel for DLHS path - #4741
Open
Insideyyy wants to merge 2 commits into
Open
perf(GMM-v2): fuse transpose_rhs into GMM-v2 kernel for DLHS path#4741Insideyyy wants to merge 2 commits into
Insideyyy wants to merge 2 commits into
Conversation
Insideyyy
requested review from
A9isha,
NuojCheng,
RissyRan,
SurbhiJainUSC,
abhinavclemson,
aireenmei,
bvandermoon,
darisoy,
dipannita08,
gagika,
gobbleturk,
hengtaoguo,
huytransformer,
igorts-git,
jiangjy1982,
khatwanimohit,
michelle-yooh,
richjames0,
shralex,
shuningjin,
vipannalla and
xibinliu
as code owners
August 5, 2026 09:22
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Add native transpose_rhs handling to the GMM v2 block specs and tiled matmul path so kernels can consume expert weights in their existing layout. Teach the fused gate/up activation path to split and concatenate weights along the output dimension for either RHS layout while preserving scale and bias semantics. Keep the original RHS tensor through backward dispatch for supported element types, retain a materialized swapaxes fallback for sub-byte weights, preserve TGMM configuration compatibility, and add regression coverage for both dispatch paths.
Insideyyy
force-pushed
the
gmm_v2_fuse_dlhs_transpose
branch
from
August 5, 2026 13:14
7df3794 to
9079e30
Compare
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 adds native transposed-RHS support to GMM v2, allowing the DLHS path to consume expert weights in their existing layout without materializing a full-tensor
swapaxes.It also enables
transpose_rhswith fused gate/up activations by making weight slicing and concatenation aware of the RHS layout, while preserving the existing scale and bias semantics.For sub-byte weights, the DLHS path continues to use the materialized non-transposed fallback because the packed representation only supports the standard
[group, k, n]layout.Tests
Added parameterized regression tests in
tests/unit/pallas_mosaic_tpu_v2_kernel_test.pycovering:swapaxesbaseline for BF16 and FP8.silugeluswigluoaiThe TPU validation was run on TPU v7x. All tested native-transpose and fallback paths matched their corresponding materialized-layout references exactly.
The targeted tests can be reproduced with:
Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.