Repository navigation
Fuse INT2 FC2 routing finalization for four-row verification - #33547
Draft
Akshay Sonawane (apsonawane) wants to merge 2 commits into
Draft
Akshay Sonawane (apsonawane) wants to merge 2 commits into
Akshay Sonawane (apsonawane) wants to merge 2 commits into
Conversation
Make the INT2 GEMV expanded-row limit configurable and add opt-in four-row/top-10 FC2 finalization fusion. Preserve INT2 intermediate rounding and add FP16/BF16 dense-reference parity coverage. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Oct 22, 2026
Open
Akshay Sonawane (apsonawane)
marked this pull request as ready for review
October 22, 2026 21:11
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The parity tests can hide decode-dispatch regressions and do not detect loss of the required intermediate rounding.
2 open issues
What changed in this PR
Adds opt-in CUDA QMoE optimizations for four-row, top-10 INT2 verification while preserving default dispatch.
Changes:
- Allows an expanded-row limit of 40 and optional fusion of FC2 computation with routing finalization.
- Instantiates FP16/BF16 fused INT2 kernels with activation-dtype rounding before expert weighting.
- Adds parity tests and documents the opt-in controls.
| File | Description |
|---|---|
onnxruntime/test/contrib_ops/moe_test.cc |
Adds four-row/top-10 parity cases for FP16 and BF16. |
onnxruntime/contrib_ops/cuda/moe/moe_quantization.cc |
Selects eligible fused FC2 finalization. |
onnxruntime/contrib_ops/cuda/llm/moe_gemm/moe_gemv.cu |
Adds configurable row admission, INT2 rounding, and fused instantiations. |
docs/contrib_ops/cuda/moe_qmoe.md |
Documents opt-in behavior and parity coverage. |
Review effort: Balanced
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| ? onnxruntime::ParseEnvironmentVariableWithDefault<int>("ORT_QMOE_INT2_DECODE_MAX_EXPANDED_ROWS", 20) | ||
| : kMaxProfiledExpandedRows; | ||
| ORT_ENFORCE(max_expanded_rows >= kMaxProfiledExpandedRows && max_expanded_rows <= 40, | ||
| "INT2 decode expanded-row limit must not exceed 40."); |
Tianlei Wu (tianleiwu)
marked this pull request as draft
October 24, 2026 23:42
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Optimize four-row/top-10 packed INT2 QMoE verification without changing default dispatch.
ORT_QMOE_INT2_DECODE_MAX_EXPANDED_ROWS, default 20; opt in to 40 expanded rows for four-row/top-10 GEMV.ORT_INT2_S4_FUSED_FINALIZE=1to fuse eligible INT2 FC2 GEMV and routing finalization, removing the intermediate output traffic and separate finalize launch.Base and integration
Incremental PR against
asonawane/main-ops-quantized-moe-fp8, not main, which lacks prerequisite operators. Companion components are the S4 grouped-attention, hyperconnection, and GenAI DFlash2 device-pipeline branches. No assets, binaries, benchmark/evaluation scripts, or Mobius changes are included.Validation
git diff --checkpasses; changed lines formatted with clang-format.Combined H200 experiment (not a MoE-only ablation)
INT2 target + FP8 DFlash2, greedy batch one; six-run historical means:
Peak sampled memory: 59.350 GiB versus 64.322 GiB old-runtime control. These measurements belong to the previously tested combined private integration, not an isolated benchmark of this rebased PR.
Accuracy caveat: paired HumanEval DFlash/same-S4 perturbed-draft control scored 154/164 with exact output parity. Five-problem LiveCodeBench smoke scored 2/5 versus historical MTP 3/5, including a capacity-limited regression. Accuracy qualification remains open.
Companion draft PRs