Skip to content

[executorch][examples] Muse Glimmer: export 8da4w checkpoints for CUDA - #26093

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

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

Conversation

@Gasoonjia

@Gasoonjia Gasoonjia commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

export_solo --torchao DIR --backend cuda --use-offgraph-kv-cache exports an 8da4w checkpoint for the CUDA batching runtime, text only. It goes through the same replace_8da4w_weights transform as MLX, which gains two optional, backend-neutral hooks for an operator with integer kernels: pack_codes rewrites each linear's codes once at replacement into the layout its packed_linear reads, and packed_embedding serves the token embedding from the canonical buffers. Without them the transform and the exported MLX graph are unchanged. The packed weights are copies held as frozen parameters, and with pack_codes the norm gains are copied too: AOTInductor clones every buffer for each compiled method, and a view would keep a memory-mapped checkpoint, with the canonical codes read to pack, resident beside the packed copies.

replace_8da4w_weights_for_cuda passes q4_zpf16_a8_linear with quantize_activations=False, so every linear, the MLP's fused gate/up projection included, gets its unquantized BF16 input and quantizes it with triton::int8_act_quant, which is bitwise the shared quantize_per_token_int8; pack_q4_zpf16_linear as pack_codes; and triton::q4_zpf16_embedding. The MLP's SiLU gating stays the model's own. export_cuda_batching applies it to an 8da4w model before swapping in the off-graph KV cache. Norm gains and runtime constants stay FP32, as on MLX. validate_torchao_export accepts CUDA, still requires the off-graph KV cache and BF16 activations, and rejects a DFlash draft or a vision encoder with an 8da4w CUDA target.

Differential Revision: D135947978

[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/26093

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

⏳ No Failures, 5 Pending

As of commit 8ef76d5 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]

This branch was previously deployed

1 inactive deployment
cadence — 8ef76d5e Deployed Dec 5, 2026 by Gasoonjia via hifi-op-test / hifi4 #42446
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