Skip to content

[EP ABI] Add Graph_GetModelPath API function - #25424

Merged
Adrian Lizarraga (adrianlizarraga) merged 7 commits into
mainfrom
adrianl/EpABI_GetModelPath
Jul 23, 2025
Merged

Adrian Lizarraga (adrianlizarraga) merged 7 commits into
mainfrom
adrianl/EpABI_GetModelPath

Conversation

@adrianlizarraga

Copy link
Copy Markdown
Contributor

Description

Adds Graph_GetModelPath API function.

Motivation and Context

An EP that loads an EPContext model (i.e., compiled model) needs to know the base path of the model to determine the path the EPContext node binary (if stored in a file).

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 Graph_GetModelPath API function to the ORT Graph API that allows execution providers to retrieve the file path of the ONNX model. This is particularly useful for execution providers that need to load EPContext models (compiled models) and determine the path to EPContext node binaries.

Key changes:

  • Added Graph_GetModelPath function to the C API that returns the model's file path
  • Implemented the function across all graph type implementations with appropriate fallbacks
  • Added comprehensive test coverage for the new functionality

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
include/onnxruntime/core/session/onnxruntime_c_api.h Adds public API declaration with documentation
onnxruntime/core/session/ort_apis.h Adds internal API declaration
onnxruntime/core/session/onnxruntime_c_api.cc Implements the API function and adds to API table
onnxruntime/core/graph/abi_graph_types.h Adds pure virtual method to base OrtGraph class
onnxruntime/core/graph/ep_api_types.h Adds method declaration to EpGraph class
onnxruntime/core/graph/ep_api_types.cc Implements method using GraphViewer's ModelPath
onnxruntime/core/graph/model_editor_api_types.h Implements method returning empty string fallback
onnxruntime/test/ep_graph/test_ep_graph.cc Adds test verification of the new API function

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.

🕐

@jywu-mysoft

Copy link
Copy Markdown
Contributor

Dmitri Smirnov (@yuslepukhin) can you review again?

@adrianlizarraga

Copy link
Copy Markdown
Contributor Author

closing and reopening to make CI rerun

@adrianlizarraga

Copy link
Copy Markdown
Contributor Author

hi Dmitri Smirnov (@yuslepukhin), can you please review again?

@snnn

Copy link
Copy Markdown
Contributor

Hi there! We haven't cut the release branch for this version yet, so I'm removing the release:1.23.0 label for now to keep things tidy. Thanks so much for your contribution! We'll make sure this gets included when the release is prepared. 🤖

Sanket Kale (sanketkaleoss) pushed a commit to sanketkaleoss/onnxruntime that referenced this pull request Aug 11, 2025
### Description
Adds `Graph_GetModelPath` API function.



### Motivation and Context
An EP that loads an EPContext model (i.e., compiled model) needs to know
the base path of the model to determine the path the EPContext node
binary (if stored in a file).
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.

6 participants