Add EP- and device-specific graph surgery support to capture-onnx-graph CLI - #2670
Draft
Xiaoyu Z (xiaoyu-work) wants to merge 10 commits into
Draft
Xiaoyu Z (xiaoyu-work) wants to merge 10 commits into
Xiaoyu Z (xiaoyu-work) wants to merge 10 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The QNN mapping passes an unsupported Mobius runtime EP instead of retaining the existing standard-export fallback.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR updates Mobius ONNX capture to preserve source precision and optionally apply execution-provider-specific graph surgeries.
Changes:
- Standardizes Mobius export and removes precision overrides.
- Adds CLI execution-provider/device surgery profiles.
- Adds dtype-aware GQA surgery filtering and tests.
File summaries
| File | Description |
|---|---|
olive/cli/capture_onnx.py |
Adds EP profiles and CLI validation. |
olive/passes/onnx/mobius_model_builder.py |
Uses standard ONNX export and runtime packaging. |
olive/passes/onnx/graph_surgery/attention.py |
Filters GQA rewrites by dtype. |
olive/olive_config.json |
Allows all source precisions. |
test/cli/test_cli.py |
Tests CLI profiles and validation. |
test/passes/onnx/test_mobius_model_builder.py |
Tests standard Mobius export behavior. |
test/passes/onnx/test_graph_surgeries_attention.py |
Tests dtype filtering. |
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+85
to
88
| ExecutionProvider.NvTensorRTRTXExecutionProvider: "trt-rtx", | ||
| ExecutionProvider.OpenVINOExecutionProvider: "openvino", | ||
| ExecutionProvider.QNNExecutionProvider: "qnn", | ||
| ExecutionProvider.WebGpuExecutionProvider: "webgpu", |
Xiaoyu Z (xiaoyu-work)
marked this pull request as draft
September 21, 2026 20:24
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.
Describe your changes
This PR changes
olive capture-onnx-graph --use_mobius_builderto use a two-stage graph flow:When
--execution_providerand--deviceare supplied, Olive applies the selected EP surgery profile. For a multi-component model,buildsselects only the exporteddecoder, leaving vision, embedding, and other components unchanged.When
--onnx_standardis supplied, Olive runsInlineModelLocalFunctionsacross every exported component. All model-local functions are inlined, function definitions are removed, and Olive rejects any remaining non-standard-domain operator that has no standard fallback body.--onnx_standardmay be combined with EP/device so structural requirements such as OpenVINO Gemma4 rank-4per_layer_inputsand runtime configuration are retained.Olive now owns every graph rewrite removed from Mobius. In addition to the migrated fusion/lowering surgeons,
ConvertGroupQueryAttentionKVCacheToFp8carries the former Mobius FP8 GQA KV-cache transformation, including calibrated per-layer scale inputs.The accelerator EP/device is forwarded to Mobius only as a structural build contract; it never enables Mobius graph rewrites. This depends on onnxruntime/mobius#743.
cpugpunpucudaAttentionToGroupQueryAttention(FP16/BF16)→
PackQKVForGroupQueryAttention→
FuseSkipRMSNormalization→
FuseSkipLayerNormalizationopenvinoqnnAttentionToGroupQueryAttention→
PackQKVForGroupQueryAttention→
FuseSkipRMSNormalization→
AttentionMaskToSequenceLengthsAttentionToGroupQueryAttention→
PackQKVForGroupQueryAttention→
FuseSkipRMSNormalization→
AttentionMaskToSequenceLengths→
SimplifiedLayerNormToL2Normtrt-rtxAttentionToGroupQueryAttention(FP16/BF16)→
PackQKVForGroupQueryAttentionvitisaiInvaliddenotes an unsupported provider/device combination.Nonedenotes a valid combination with no automatic EP surgeries; users may still request strict expansion with--onnx_standard.The EP profiles intentionally cover ordinary decoder graphs. Model-specific paths remain explicit rather than silently applying an incompatible generic rewrite.
Checklist before requesting a review
Release note:
capture-onnx-graphnow keeps Mobius export canonical and lets Olive explicitly apply EP graph surgeries or expand all function-backed custom operators with--onnx_standard.(Optional) Issue link
N/A