Skip to content

[ExecuTorch][llm] Add quantized_moe_ffn custom op with C++ kernel - #21533

Open
pytorchbot wants to merge 1 commit into
mainfrom
gh/digantdesai/69/orig
Open

[ExecuTorch][llm] Add quantized_moe_ffn custom op with C++ kernel#21533
pytorchbot wants to merge 1 commit into
mainfrom
gh/digantdesai/69/orig

Conversation

@pytorchbot

Copy link
Copy Markdown
Collaborator

This PR was created by the merge bot to help merge the original PR into the main branch.
ghstack PR number: #21119 by @digantdesai
^ Please use this as the source of truth for the PR details, comments, and reviews
ghstack PR base: https://github.com/pytorch/executorch/tree/gh/digantdesai/69/base
ghstack PR head: https://github.com/pytorch/executorch/tree/gh/digantdesai/69/head
Merge bot PR base: https://github.com/pytorch/executorch/tree/main
Merge bot PR head: https://github.com/pytorch/executorch/tree/gh/digantdesai/69/orig
Differential Revision: D102382000
@diff-train-skip-merge

Pull Request resolved: #21119

Add a fused `quantized_moe_ffn` custom op for MoE feed-forward with INT4/INT8 weight quantization via torchao.

The C++ runtime kernel implements router GEMM, scoring, top-k, counting-sort permutation, per-expert grouped GEMMs, SwiGLU, and weighted scatter-add unpermute. On aarch64, expert GEMMs use `torchao::linear_operator` from D112958457; otherwise a portable reference path unpacks the torchao blob, dequantizes to fp32, and calls `cpublas::gemm`.

The AOT shim registers the schema, provides `CompositeExplicitAutograd` dispatch, and exposes a `_quantized_moe_ffn_active` sentinel op. Build integration covers Buck and CMake.
ghstack-source-id: 409183072
@exported-using-ghexport

Differential Revision: [D102382000](https://our.internmc.facebook.com/intern/diff/D102382000/)
@pytorch-bot

pytorch-bot Bot commented Jul 31, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

⏳ No Failures, 1 Pending

As of commit a50a02f with merge base 250020b (image):
💚 Looks good so far! There are no failures yet. 💚

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

@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 Jul 31, 2026
@github-actions

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.

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants