Skip to content

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

Open
digantdesai wants to merge 1 commit into
gh/digantdesai/69/basefrom
gh/digantdesai/69/head
Open

[ExecuTorch][llm] Add quantized_moe_ffn custom op with C++ kernel#21119
digantdesai wants to merge 1 commit into
gh/digantdesai/69/basefrom
gh/digantdesai/69/head

Conversation

@digantdesai

@digantdesai digantdesai commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

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.

Differential Revision: D102382000

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

✅ You can merge normally! (2 Unrelated Failures)

As of commit f700b8a with merge base 21554e5 (image):

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

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

@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.

1 participant