Skip to content

[EP ABI] support Graph_GetModelMetadata - #25768

Merged
Hector Li (HectorSVC) merged 12 commits into
microsoft:mainfrom
wcy123:br-new-abi-graph-get-metadata
Aug 21, 2025
Merged

[EP ABI] support Graph_GetModelMetadata#25768
Hector Li (HectorSVC) merged 12 commits into
microsoft:mainfrom
wcy123:br-new-abi-graph-get-metadata

Conversation

@wcy123

Copy link
Copy Markdown
Contributor

Description

Add a new API Graph_GetModelMetadata

Motivation and Context

VitisAI EP would convert ONNX IR to another IR which is suitable for AMD AI compilers.
The metadata in a OrtModel contains many important infomation produced by other tools, e.g. Olive.

This API potentially used by many other execution providers which need to access the same information.

@HectorSVC

Copy link
Copy Markdown
Contributor

/azp run Linux QNN CI Pipeline,Win_TRT_Minimal_CUDA_Test_CI,Windows ARM64 QNN CI Pipeline,Windows GPU Doc Gen CI Pipeline,Windows x64 QNN CI Pipeline

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 5 pipeline(s).

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

This PR adds a new API Graph_GetModelMetadata to enable execution providers to access model metadata from an OrtGraph. This is specifically needed by the VitisAI execution provider to access important metadata information produced by tools like Olive when converting ONNX IR to other IRs suitable for AMD AI compilers.

Key changes:

  • Adds Graph_GetModelMetadata API function declaration and implementation
  • Implements the virtual method in both EpGraph and ModelEditorGraph classes
  • Updates the C API structure to include the new function

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
onnxruntime/core/session/ort_apis.h Adds function declaration for Graph_GetModelMetadata
onnxruntime/core/session/onnxruntime_c_api.cc Implements Graph_GetModelMetadata API function and adds it to the API structure
onnxruntime/core/graph/model_editor_api_types.h Implements GetModelMetadata method for ModelEditorGraph class
onnxruntime/core/graph/ep_api_types.h Adds GetModelMetadata method declaration to EpGraph class
onnxruntime/core/graph/ep_api_types.cc Implements GetModelMetadata method for EpGraph class
onnxruntime/core/graph/abi_graph_types.h Adds pure virtual GetModelMetadata method to OrtGraph base class
include/onnxruntime/core/session/onnxruntime_c_api.h Adds Graph_GetModelMetadata to public C API with documentation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread onnxruntime/core/session/onnxruntime_c_api.cc Outdated
Comment thread onnxruntime/core/graph/model_editor_api_types.h Outdated
Comment thread onnxruntime/core/graph/ep_api_types.cc Outdated
Comment thread include/onnxruntime/core/session/onnxruntime_c_api.h Outdated
Comment thread include/onnxruntime/core/session/onnxruntime_c_api.h Outdated
Comment thread onnxruntime/core/session/onnxruntime_c_api.cc
Comment thread onnxruntime/core/graph/abi_graph_types.h
Comment thread onnxruntime/core/graph/ep_api_types.h Outdated
Comment thread onnxruntime/core/graph/model_editor_api_types.h Outdated
@wcy123
Chunye Wang@AMD (wcy123) force-pushed the br-new-abi-graph-get-metadata branch from af71f04 to 40f399b Compare August 19, 2025 03:39
@jywu-mysoft George Wu (jywu-mysoft) added the ep:VitisAI issues related to Vitis AI execution provider label Aug 19, 2025
@HectorSVC

Copy link
Copy Markdown
Contributor

/azp run Linux QNN CI Pipeline,Win_TRT_Minimal_CUDA_Test_CI,Windows ARM64 QNN CI Pipeline,Windows GPU Doc Gen CI Pipeline,Windows x64 QNN CI Pipeline

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 5 pipeline(s).

Comment thread onnxruntime/core/graph/abi_graph_types.h
Comment thread onnxruntime/core/graph/model_editor_api_types.h
Comment thread onnxruntime/test/ep_graph/test_ep_graph.cc
Comment thread onnxruntime/test/ep_graph/test_ep_graph.cc
Comment thread onnxruntime/test/ep_graph/test_ep_graph.cc Outdated
Comment thread onnxruntime/core/session/onnxruntime_c_api.cc Outdated
@HectorSVC

Copy link
Copy Markdown
Contributor

/azp run Linux QNN CI Pipeline,Win_TRT_Minimal_CUDA_Test_CI,Windows ARM64 QNN CI Pipeline,Windows GPU Doc Gen CI Pipeline,Windows x64 QNN CI Pipeline

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 5 pipeline(s).

@HectorSVC

Copy link
Copy Markdown
Contributor

/azp run Linux QNN CI Pipeline,Win_TRT_Minimal_CUDA_Test_CI,Windows ARM64 QNN CI Pipeline,Windows GPU Doc Gen CI Pipeline,Windows x64 QNN CI Pipeline

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 5 pipeline(s).

Comment thread onnxruntime/core/graph/ep_api_types.cc
Should just return error status for ORT_MINIMAL_BUILD
@HectorSVC

Copy link
Copy Markdown
Contributor

/azp run Linux QNN CI Pipeline,Win_TRT_Minimal_CUDA_Test_CI,Windows ARM64 QNN CI Pipeline,Windows GPU Doc Gen CI Pipeline,Windows x64 QNN CI Pipeline

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 5 pipeline(s).

@HectorSVC

Copy link
Copy Markdown
Contributor

/azp run Linux QNN CI Pipeline,Win_TRT_Minimal_CUDA_Test_CI,Windows ARM64 QNN CI Pipeline,Windows GPU Doc Gen CI Pipeline,Windows x64 QNN CI Pipeline

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 5 pipeline(s).

@HectorSVC

Copy link
Copy Markdown
Contributor

/azp run Linux QNN CI Pipeline,Win_TRT_Minimal_CUDA_Test_CI,Windows ARM64 QNN CI Pipeline,Windows GPU Doc Gen CI Pipeline,Windows x64 QNN CI Pipeline

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 5 pipeline(s).

@HectorSVC Hector Li (HectorSVC) 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.

:shipit:

@HectorSVC

Copy link
Copy Markdown
Contributor

/azp run Linux QNN CI Pipeline,Win_TRT_Minimal_CUDA_Test_CI,Windows ARM64 QNN CI Pipeline,Windows GPU Doc Gen CI Pipeline,Windows x64 QNN CI Pipeline

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 5 pipeline(s).

@HectorSVC Hector Li (HectorSVC) 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.

:shipit:

@HectorSVC
Hector Li (HectorSVC) merged commit 75f8480 into microsoft:main Aug 21, 2025
86 checks passed
Adrian Lizarraga (adrianlizarraga) pushed a commit that referenced this pull request Aug 21, 2025
### Description

Add a new API `Graph_GetModelMetadata`

### Motivation and Context
VitisAI EP would convert ONNX IR to another IR which is suitable for AMD
AI compilers.
The metadata in a OrtModel contains many important infomation produced
by other tools, e.g. Olive.

This API potentially used by many other execution providers which need
to access the same information.
Adrian Lizarraga (adrianlizarraga) added a commit that referenced this pull request Aug 25, 2025
### Description
Cherry-pick the following PRs into the `rel-1.23.0` branch:
- #25592
- #25622
- #25688
- #25729
- #25743
- #25769
- #25745
- #25761
- #25751
- #25716
- #25228
- #25768
- #25788
- #25747
- #25800
- #25818
- #25762
- #25749
- #25831


### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->

---------

Co-authored-by: quic-tirupath <quic_tirupath@quicinc.com>
Co-authored-by: quic-calvnguy <quic_calvnguy@quicinc.com>
Co-authored-by: qti-kromero <kromero@qti.qualcomm.com>
Co-authored-by: Jeff Kilpatrick <jkilpatrick@qti.qualcomm.com>
Co-authored-by: Scott McKay <skottmckay@gmail.com>
Co-authored-by: David Fan <30608893+jiafatom@users.noreply.github.com>
Co-authored-by: kuanyul-qti <kuanyul@qti.qualcomm.com>
Co-authored-by: Dmitri Smirnov <yuslepukhin@users.noreply.github.com>
Co-authored-by: Chi Lo <54722500+chilo-ms@users.noreply.github.com>
Co-authored-by: Edward Chen <18449977+edgchen1@users.noreply.github.com>
Co-authored-by: Chunye Wang@AMD <chunywan@amd.com>
Co-authored-by: minfhong-qti <minfhong@qti.qualcomm.com>
Co-authored-by: Vishal Agarwal <vishala@nvidia.com>
Co-authored-by: Maximilian Müller <maximilianm@nvidia.com>
Co-authored-by: Maximilian Müller <44298237+gedoensmax@users.noreply.github.com>
Co-authored-by: Changming Sun <chasun@microsoft.com>
Co-authored-by: adrastogi <aditya.rastogi@microsoft.com>
Co-authored-by: Aditya Rastogi <adityar@ntdev.microsoft.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Maximilian Müller (gedoensmax) pushed a commit to gedoensmax/onnxruntime that referenced this pull request Sep 2, 2025
### Description

Add a new API `Graph_GetModelMetadata`

### Motivation and Context
VitisAI EP would convert ONNX IR to another IR which is suitable for AMD
AI compilers.
The metadata in a OrtModel contains many important infomation produced
by other tools, e.g. Olive.

This API potentially used by many other execution providers which need
to access the same information.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ep:VitisAI issues related to Vitis AI execution provider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants