Skip to content

[executorch][examples] Muse Glimmer: fused gate/up projection for 8da4w CUDA exports - #26094

Open
Gasoonjia wants to merge 2 commits into
gh/Gasoonjia/174/basefrom
gh/Gasoonjia/174/head
Open

Gasoonjia wants to merge 2 commits into
gh/Gasoonjia/174/basefrom
gh/Gasoonjia/174/head

Conversation

@Gasoonjia

@Gasoonjia Gasoonjia commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

replace_8da4w_weights gains a packed_gated_linear hook. It replaces each fused [gate; up] MLP with a module that passes the MLP norm's unquantized output and gate_up_proj's buffers (codes as rewritten by pack_codes) to the hook, which returns silu(gate) * up in BF16 and so takes the place of the gate/up linear and the gating. The hook requires quantize_activations=False and a fused MLP. replace_8da4w_weights_for_cuda passes q4_zpf16_a8_gated_linear, so each layer's gate/up runs the fused W4A8 gate/up kernels with their SiLU/mul epilogue instead of a linear, a BF16 output of both halves and the eager gating, with the same rounding (gate and up rounded to BF16 before the gating). On A100 for the Muse Glimmer gate/up shape the fused kernels take 0.89-0.95x the time of the unfused linear followed by the eager gating.

Differential Revision: D136090757

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/26094

Note: Links to docs will display an error until the docs builds have been completed.

⏳ No Failures, 4 Pending

As of commit 20f4f8d with merge base 2123b48 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 4, 2026

@digantdesai digantdesai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review automatically exported from Phabricator review in Meta.

[ghstack-poisoned]
Gasoonjia added a commit that referenced this pull request Dec 4, 2026
…4w CUDA exports

Pull Request resolved: #26094

`replace_8da4w_weights` gains a `packed_gated_linear` hook. It replaces each fused [gate; up] MLP with a module that passes the MLP norm's unquantized output and `gate_up_proj`'s buffers (codes as rewritten by `pack_codes`) to the hook, which returns `silu(gate) * up` in BF16 and so takes the place of the gate/up linear and the gating. The hook requires `quantize_activations=False` and a fused MLP. `replace_8da4w_weights_for_cuda` passes `q4_zpf16_a8_gated_linear`, so each layer's gate/up runs the fused W4A8 gate/up kernels with their SiLU/mul epilogue instead of a linear, a BF16 output of both halves and the eager gating, with the same rounding (gate and up rounded to BF16 before the gating). On A100 for the Muse Glimmer gate/up shape the fused kernels take 0.89-0.95x the time of the unfused linear followed by the eager gating.
ghstack-source-id: 491036514
@exported-using-ghexport

Differential Revision: [D136090757](https://our.internmc.facebook.com/intern/diff/D136090757/)

This branch was previously deployed

1 inactive deployment
cadence — 20f4f8de Deployed Dec 5, 2026 by Gasoonjia via hifi-op-test / hifi4 #42441
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants