-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Add a new ORT API GetSessionOptionConfigEntries
#25277
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
Add a new ORT API GetSessionOptionConfigEntries
#25277
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
Adds a new C API GetSessionOptionConfigEntries
to expose all session configuration entries via OrtKeyValuePairs
.
- Declares the new API in
ort_apis.h
andonnxruntime_c_api.h
- Registers it in the
ort_api_1_to_23
dispatch table - Implements the API in
abi_session_options.cc
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
onnxruntime/core/session/ort_apis.h | Declares GetSessionOptionConfigEntries |
onnxruntime/core/session/onnxruntime_c_api.cc | Adds function pointer to the API dispatch table |
onnxruntime/core/session/abi_session_options.cc | Implements the new C API |
include/onnxruntime/core/session/onnxruntime_c_api.h | Documents the new API in the public header |
Comments suppressed due to low confidence (2)
include/onnxruntime/core/session/onnxruntime_c_api.h:6078
- Update the
\since
version to match the new API release (should be 1.23 instead of 1.22).
* \since Version 1.22.
include/onnxruntime/core/session/onnxruntime_c_api.h:6080
- [nitpick] Consider adding or updating unit tests to cover
GetSessionOptionConfigEntries
for various session options to ensure correct behavior.
OrtKeyValuePairs*(ORT_API_CALL* GetSessionOptionConfigEntries)(_In_ const OrtSessionOptions* options);
/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 successfully started running 5 pipeline(s). |
/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 successfully started running 5 pipeline(s). |
Do we want to make it more flexible by adding an additional key's prefix as a parameter, so that EP can get more useful session configs back, ex: "ep.vitis_ep.XXX", instead of all the session configs? |
359f5e5
to
e159be3
Compare
VitisAI EP would handle some other configuration entries, i.e. "ep.shared_ep_context", "ep.context_file_path", "ep.stop_share_ep_contexts" etc. Additionally it would be easy for an EP plugin to filter out the prefix, soreturning all session configuration could be fine. |
/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 successfully started running 5 pipeline(s). |
c8e3728
to
f9dfcd3
Compare
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Edward Chen <[email protected]>
f9dfcd3
to
0301055
Compare
/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 successfully started running 5 pipeline(s). |
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.
### Description Add a new ORT API `GetSessionOptionConfigEntries`. ### Motivation and Context microsoft#24887 allows plugin-EPs to interface with ORT using a binary stable interface. microsoft#24445 allows an EP to handle the extraction of EP options from the session option configurations. For an EP like VitisAI EP to comply with the requirements, it is necessary for a plugin-EPs to access all config entries in a session option. ```c++ OrtKeyValuePairs * kvps = nullptr; auto status = GetSessionOptionConfigEntries(session_option, &kvps); if(status) { throw status; } std::unique_ptr<OrtKeyValuePairs, void (*)(OrtKeyValuePairs*)> config_entries(kvps, ort_api.ReleaseKeyValuePairs); const char* const* keys = nullptr; const char* const* values = nullptr; size_t num_keys = 0; // Get keys and values from the config entries Ort::GetApi().GetKeyValuePairs(config_entries.get(), &keys, &values, &num_keys); for (size_t i = 0; i < num_keys; ++i) { // process keys[i] and values[i] } ```
### Description Add a new ORT API `GetSessionOptionConfigEntries`. ### Motivation and Context microsoft#24887 allows plugin-EPs to interface with ORT using a binary stable interface. microsoft#24445 allows an EP to handle the extraction of EP options from the session option configurations. For an EP like VitisAI EP to comply with the requirements, it is necessary for a plugin-EPs to access all config entries in a session option. ```c++ OrtKeyValuePairs * kvps = nullptr; auto status = GetSessionOptionConfigEntries(session_option, &kvps); if(status) { throw status; } std::unique_ptr<OrtKeyValuePairs, void (*)(OrtKeyValuePairs*)> config_entries(kvps, ort_api.ReleaseKeyValuePairs); const char* const* keys = nullptr; const char* const* values = nullptr; size_t num_keys = 0; // Get keys and values from the config entries Ort::GetApi().GetKeyValuePairs(config_entries.get(), &keys, &values, &num_keys); for (size_t i = 0; i < num_keys; ++i) { // process keys[i] and values[i] } ```
### Description Add a new ORT API `GetSessionOptionConfigEntries`. ### Motivation and Context microsoft#24887 allows plugin-EPs to interface with ORT using a binary stable interface. microsoft#24445 allows an EP to handle the extraction of EP options from the session option configurations. For an EP like VitisAI EP to comply with the requirements, it is necessary for a plugin-EPs to access all config entries in a session option. ```c++ OrtKeyValuePairs * kvps = nullptr; auto status = GetSessionOptionConfigEntries(session_option, &kvps); if(status) { throw status; } std::unique_ptr<OrtKeyValuePairs, void (*)(OrtKeyValuePairs*)> config_entries(kvps, ort_api.ReleaseKeyValuePairs); const char* const* keys = nullptr; const char* const* values = nullptr; size_t num_keys = 0; // Get keys and values from the config entries Ort::GetApi().GetKeyValuePairs(config_entries.get(), &keys, &values, &num_keys); for (size_t i = 0; i < num_keys; ++i) { // process keys[i] and values[i] } ```
Description
Add a new ORT API
GetSessionOptionConfigEntries
.Motivation and Context
#24887 allows plugin-EPs to interface with ORT using a binary stable interface. #24445 allows an EP to handle the extraction of EP options from the session option configurations. For an EP like VitisAI EP to comply with the requirements,
it is necessary for a plugin-EPs to access all config entries in a session option.