- 
                Notifications
    You must be signed in to change notification settings 
- Fork 3.5k
[EP ABI] Add Graph_GetModelPath API function #25424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
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_GetModelPathfunction 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 | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🕐
| @yuslepukhin can you review again? | 
| closing and reopening to make CI rerun | 
| hi @yuslepukhin, can you please review again? | 
| Hi there! We haven't cut the release branch for this version yet, so I'm removing the  | 
### 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).
Description
Adds
Graph_GetModelPathAPI 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).