MHC Projection Fusion - #4638
Open
muskansh-google wants to merge 4 commits into
Open
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
muskansh-google
marked this pull request as ready for review
July 28, 2026 16:25
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
muskansh-google
requested review from
A9isha,
NuojCheng,
RissyRan,
SurbhiJainUSC,
abhinavclemson,
aireenmei,
bvandermoon,
dipannita08,
gagika,
gobbleturk,
hengtaoguo,
huytransformer,
igorts-git,
jiangjy1982,
khatwanimohit,
richjames0,
shralex,
shuningjin,
suexu1025,
vipannalla and
xibinliu
as code owners
July 28, 2026 16:25
RissyRan
approved these changes
Jul 28, 2026
RissyRan
left a comment
Collaborator
There was a problem hiding this comment.
LGTM, just a minor comment.
|
|
||
| def mapping(self, x: Array, alpha_scale: Array, alpha: Array, beta: Array, scale: float, eps: float = 0.0): | ||
| """Helper function for both pre and post mappings.""" | ||
| # In MaxText, we match weight precision to activations before Matmul |
Collaborator
There was a problem hiding this comment.
Shall we keep this comment? It should also apply to beta and alpha_scale.
|
|
||
| def res_mapping(self, x: Array): | ||
| """Helper function for residual mapping.""" | ||
| # In MaxText, we match weight precision to activations before Matmul |
Collaborator
There was a problem hiding this comment.
How we keep this comment?
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 optimizes the Manifold-Constrained Hyper Connections (mHC) layer by fusing three independent projection matmuls (pre, post, and residual) into a single unified projection to reduce TPU kernel launch overhead.
Tests
Please describe how you tested this change, and include any instructions and/or
commands to reproduce.
Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.