Skip to content

Update QMoE emission for ORT raw-weight prepack support - #460

Open
justinchuby with Copilot wants to merge 2 commits into
mainfrom
copilot/update-moe-op
Open

Update QMoE emission for ORT raw-weight prepack support#460
justinchuby with Copilot wants to merge 2 commits into
mainfrom
copilot/update-moe-op

Conversation

Copilot AI commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

ORT QMoE now supports raw int4/int8 expert weights via weights_prepacked=0. Mobius was emitting raw QMoE weight tensors without explicitly opting into that mode, leaving CUDA to interpret them as prepacked.

  • QMoE emission

    • Set quant_type="int" and weights_prepacked=0 on fused com.microsoft::QMoE nodes emitted by MoELayer.
  • Dense MoE rewrite

    • Apply the same attributes when rewriting dense fallback MoE expert storms into a single QMoE node.
  • Regression coverage

    • Assert the new QMoE ABI attributes in component and rewrite-rule tests.
op.QMoE(
    ...,
    quant_type="int",
    weights_prepacked=0,
    _domain="com.microsoft",
)

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Emit the new weights_prepacked=0 QMoE attribute for raw int expert weights now that ORT can prepack them internally. Add focused assertions for both component-built and rewrite-fused QMoE nodes.

Signed-off-by: GitHub <noreply@github.com>

Co-authored-by: justinchuby <11205048+justinchuby@users.noreply.github.com>
Copilot AI changed the title [WIP] Update MoE op after microsoft/onnxruntime#28749 lands Update QMoE emission for ORT raw-weight prepack support Aug 7, 2026
Copilot AI requested a review from justinchuby August 7, 2026 05:15
@justinchuby
justinchuby requested a lite review from Copilot August 7, 2026 05:47
@justinchuby
justinchuby marked this pull request as ready for review August 7, 2026 05:48
@justinchuby
justinchuby requested a review from a team August 7, 2026 05:48
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Performance Comparison

Comparing 9567144d411562

Model Metric Baseline Current Delta
bert (feature-extraction) model_size_bytes 359 KB 359 KB +0.0%
bert (feature-extraction) num_nodes 60 60 +0.0%
falcon model_size_bytes 364 KB 364 KB +0.0%
falcon num_nodes 68 68 +0.0%
gemma2 model_size_bytes 428 KB 428 KB +0.0%
gemma2 num_nodes 107 107 +0.0%
gpt2 model_size_bytes 388 KB 388 KB +0.0%
gpt2 num_nodes 54 54 +0.0%
llama model_size_bytes 425 KB 425 KB +0.0%
llama num_nodes 62 62 +0.0%
llama (static-cache) model_size_bytes 425 KB 425 KB +0.0%
llama (static-cache) num_nodes 58 58 +0.0%
mamba (ssm-text-generation) model_size_bytes 296 KB 296 KB +0.0%
mamba (ssm-text-generation) num_nodes 98 98 +0.0%
phi3 model_size_bytes 421 KB 421 KB +0.0%
phi3 num_nodes 60 60 +0.0%
phi3 (static-cache) model_size_bytes 421 KB 421 KB +0.0%
phi3 (static-cache) num_nodes 56 56 +0.0%
qwen2 model_size_bytes 425 KB 425 KB +0.0%
qwen2 num_nodes 62 62 +0.0%
qwen2 (static-cache) model_size_bytes 425 KB 425 KB +0.0%
qwen2 (static-cache) num_nodes 58 58 +0.0%
qwen3_5_moe (hybrid-text-generation) model_size_bytes 506 KB 506 KB +0.0%
qwen3_5_moe (hybrid-text-generation) num_nodes 275 275 +0.0%
qwen3_5_text (hybrid-text-generation) model_size_bytes 458 KB 458 KB +0.0%
qwen3_5_text (hybrid-text-generation) num_nodes 129 129 +0.0%
qwen3_5_vl (hybrid-qwen-vl) model_size_bytes 977 KB 977 KB +0.0%
qwen3_5_vl (hybrid-qwen-vl) num_nodes 431 431 +0.0%
t5 (seq2seq) model_size_bytes 836 KB 836 KB +0.0%
t5 (seq2seq) num_nodes 166 166 +0.0%
whisper (speech-to-text) model_size_bytes 1008 KB 1008 KB +0.0%
whisper (speech-to-text) num_nodes 128 128 +0.0%

No performance regressions.

Copilot AI 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.

Pull request overview

Aligns Mobius’s com.microsoft::QMoE emission with the updated ORT QMoE ABI by explicitly opting into raw (non-prepacked) int4/int8 expert weights, preventing ORT CUDA from misinterpreting emitted raw tensors as prepacked.

Changes:

  • Set quant_type="int" and weights_prepacked=0 when emitting fused QMoE from MoELayer.
  • Apply the same ABI attributes when rewriting dense-fallback MoE subgraphs into a single QMoE node.
  • Add regression assertions in both component and rewrite-rule tests to lock in the ABI attributes (Fixes #348).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/mobius/rewrite_rules/_qmoe_fusion.py Adds quant_type / weights_prepacked attributes to rewritten fused QMoE nodes.
src/mobius/rewrite_rules/_qmoe_fusion_test.py Asserts the rewritten QMoE node includes the new ABI attributes.
src/mobius/components/_moe.py Adds quant_type="int" and weights_prepacked=0 to MoELayer’s op.QMoE(...) emission.
src/mobius/components/_moe_test.py Asserts MoELayer-emitted QMoE nodes include the new ABI attributes.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

🏗️ Architecture Diff

Comparing 9567144d411562

Model Sub-model Changes Status
bert (feature-extraction) model 0
falcon model 0
gemma2 model 0
gemma4 (gemma4) decoder 0
gemma4 (gemma4) embedding 0
gemma4 (gemma4) vision_encoder 0
gemma4_text model 0
gpt2 model 0
llama model 0
llama (static-cache) model 0
mamba (ssm-text-generation) model 0
phi3 model 0
phi3 (static-cache) model 0
qwen model 0
qwen (static-cache) model 0
qwen2 model 0
qwen2 (static-cache) model 0
qwen2_moe model 0
qwen2_moe (static-cache) model 0
qwen3 model 0
qwen3 (static-cache) model 0
qwen3_5_moe (hybrid-text-generation) model 0
qwen3_5_text (hybrid-text-generation) model 0
qwen3_5_vl (hybrid-qwen-vl) decoder 0
qwen3_5_vl (hybrid-qwen-vl) embedding 0
qwen3_5_vl (hybrid-qwen-vl) vision_encoder 0
qwen3_moe model 0
qwen3_moe (static-cache) model 0
qwen3_next (hybrid-text-generation) model 0
t5 (seq2seq) decoder 0
t5 (seq2seq) encoder 0
whisper (speech-to-text) decoder 0
whisper (speech-to-text) encoder 0

No architecture changes detected.


Legend: ⚪ No change · 🔵 Minor (attrs/inits) · 🟡 Moderate (nodes added/removed) · 🔴 Major (interface changed)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update MoE op once microsoft/onnxruntime#28749 lands

4 participants