Skip to content

Pass for Nvidia ModelOpt graph surgery framework#2377

Merged
jambayk merged 6 commits intomicrosoft:mainfrom
hthadicherla:hthadicherla/graph-surgery-pass
Apr 9, 2026
Merged

Pass for Nvidia ModelOpt graph surgery framework#2377
jambayk merged 6 commits intomicrosoft:mainfrom
hthadicherla:hthadicherla/graph-surgery-pass

Conversation

@hthadicherla
Copy link
Copy Markdown
Contributor

@hthadicherla hthadicherla commented Mar 31, 2026

Describe your changes

Add NVModelOptGraphSurgery pass to integrate NVIDIA ModelOpt graph surgeries into Olive. Supports all existing surgeries in ModelOpt like GQA fusion, DQ-Transpose and all future surgeries that will be added in ModelOpt

Changes:

  • New pass: olive/passes/onnx/nvmo_graph_surgery.py
  • Pass registration in olive_config.json
  • Unit tests: test/passes/onnx/test_nvmo_graph_surgery.py
  • Documentation in pass.rst and onnx-transformations.md

Usage

Example

{
    "type": "NVModelOptGraphSurgery",
    "config": {
        "surgery_type": "replace-gqa" # Surgery-key in Modelopt,
        "surgery_params": {
             # Surgery specific parameters of that particular surgery, example below
            "hf_model_id": "meta-llama/Llama-2-7b-hf",
            "io_dtype": "float16"
        }
    }
}

Checklist before requesting a review

  • Add unit tests for this change.
  • Make sure all tests can pass.
  • Update documents if necessary.
  • Lint and apply fixes to your code by running lintrunner -a
  • Is this a user-facing change? If yes, give a description of this change to be included in the release notes.

Release note: Added NVModelOptGraphSurgery pass for running NVIDIA ModelOpt graph surgeries on ONNX models.

Signed-off-by: Hrishith Thadicherla <hthadicherla@nvidia.com>
Signed-off-by: Hrishith Thadicherla <hthadicherla@nvidia.com>
Signed-off-by: Hrishith Thadicherla <hthadicherla@nvidia.com>
@hthadicherla
Copy link
Copy Markdown
Contributor Author

@jambayk Can you review this PR? This is graph surgery pass for NVIDIA stack. The implementation of the surgeries will be in modelopt and essentially we are calling them through the olive pass.

Signed-off-by: Hrishith Thadicherla <hthadicherla@nvidia.com>
@hthadicherla hthadicherla force-pushed the hthadicherla/graph-surgery-pass branch from 6e92bd3 to 5b287d5 Compare April 7, 2026 08:46
@hthadicherla hthadicherla requested a review from jambayk April 7, 2026 08:47
jambayk
jambayk previously approved these changes Apr 7, 2026
@jambayk jambayk enabled auto-merge (squash) April 7, 2026 18:39
@jambayk jambayk dismissed their stale review April 7, 2026 21:10

Pipeline is failing because graph_surgeon dependency is using onnx.helper.bfloat.float32_to_bfloat16 which has been deprecated in onnx since version 1.18 and removed in 1.20.

@jambayk jambayk disabled auto-merge April 7, 2026 21:10
@hthadicherla
Copy link
Copy Markdown
Contributor Author

hthadicherla commented Apr 8, 2026

This is a conflict between onnx_graphsurgeon and onnx and needs to be resolved within onnx_graphsurgeon. I have raised a PR in ModelOpt for a workaround temporarily. NVIDIA/Model-Optimizer#1204.

After it is merged, this failure should resolve itself

@hthadicherla hthadicherla requested a review from jambayk April 8, 2026 13:08
@hthadicherla
Copy link
Copy Markdown
Contributor Author

The PR has been merged. Can you re review it again @jambayk ?

jambayk
jambayk previously approved these changes Apr 8, 2026
@jambayk jambayk dismissed their stale review April 8, 2026 22:33

tests need to be skipped until new release of modelopt due to incompatibility with latest onnx versions

@xiaoyu-work
Copy link
Copy Markdown
Collaborator

@hthadicherla can you update this PR? we plan to release new Olive version this Friday and this PR will be in the new release

Signed-off-by: Hrishith Thadicherla <hthadicherla@nvidia.com>
@hthadicherla hthadicherla force-pushed the hthadicherla/graph-surgery-pass branch from 2b09f13 to ba3f2a7 Compare April 9, 2026 08:24
@hthadicherla
Copy link
Copy Markdown
Contributor Author

@xiaoyu-work @jambayk I have added skip to the test. Can you reapprove it now ?

@hthadicherla hthadicherla requested a review from jambayk April 9, 2026 08:29
@jambayk jambayk enabled auto-merge (squash) April 9, 2026 16:18
@jambayk jambayk merged commit 27f477f into microsoft:main Apr 9, 2026
14 of 15 checks passed
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.

3 participants