-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Add API to access config entries from KernelInfo #26589
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Member
|
/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 4 pipeline(s). |
adrianlizarraga
approved these changes
Nov 24, 2025
Rohanjames1997
pushed a commit
to Rohanjames1997/onnxruntime
that referenced
this pull request
Dec 4, 2025
## Description This PR adds a new API function `KernelInfo_GetConfigEntries` that allows custom operators to access all configuration entries from the `OrtKernelInfo` object during kernel construction. ## Motivation and Context Custom operators may need to access session configuration options to adjust their behavior. Previously, there was no way to retrieve all config entries from `KernelInfo`. This PR provides a convenient method to get all configuration key-value pairs that were set on the `OrtSessionOptions`. ## Changes ### API Additions - **C API**: Added `KernelInfo_GetConfigEntries` function to `OrtApi` (Version 1.24) - Takes an `OrtKernelInfo*` as input - Returns all config entries as `OrtKeyValuePairs*` - Properly documented with usage examples - **C++ API**: Added `GetConfigEntries()` method to `KernelInfoImpl` template class - Returns `KeyValuePairs` object - Follows existing C++ wrapper patterns ### Implementation - Implemented in `onnxruntime/core/session/custom_ops.cc` - Iterates through `config_options_map` from `OpKernelInfo` - Creates and populates `OrtKeyValuePairs` with all configuration entries ### Testing - Updated `shape_inference_test.cc` with test case - Verifies config entries can be retrieved in custom kernel constructor - Tests both existing and non-existing config keys ## Files Changed - `include/onnxruntime/core/session/onnxruntime_c_api.h` - API declaration - `include/onnxruntime/core/session/onnxruntime_cxx_api.h` - C++ wrapper declaration - `include/onnxruntime/core/session/onnxruntime_cxx_inline.h` - C++ wrapper implementation - `onnxruntime/core/session/custom_ops.cc` - Core implementation - `onnxruntime/core/session/onnxruntime_c_api.cc` - API registration - `onnxruntime/core/session/ort_apis.h` - API header declaration - `onnxruntime/test/framework/shape_inference_test.cc` - Test coverage ## API Version This change is part of ORT API Version 1.24. ## Breaking Changes None. This is a backward-compatible addition to the API.
Sumit2318
pushed a commit
that referenced
this pull request
Jan 6, 2026
## Description This PR adds a new API function `KernelInfo_GetConfigEntries` that allows custom operators to access all configuration entries from the `OrtKernelInfo` object during kernel construction. ## Motivation and Context Custom operators may need to access session configuration options to adjust their behavior. Previously, there was no way to retrieve all config entries from `KernelInfo`. This PR provides a convenient method to get all configuration key-value pairs that were set on the `OrtSessionOptions`. ## Changes ### API Additions - **C API**: Added `KernelInfo_GetConfigEntries` function to `OrtApi` (Version 1.24) - Takes an `OrtKernelInfo*` as input - Returns all config entries as `OrtKeyValuePairs*` - Properly documented with usage examples - **C++ API**: Added `GetConfigEntries()` method to `KernelInfoImpl` template class - Returns `KeyValuePairs` object - Follows existing C++ wrapper patterns ### Implementation - Implemented in `onnxruntime/core/session/custom_ops.cc` - Iterates through `config_options_map` from `OpKernelInfo` - Creates and populates `OrtKeyValuePairs` with all configuration entries ### Testing - Updated `shape_inference_test.cc` with test case - Verifies config entries can be retrieved in custom kernel constructor - Tests both existing and non-existing config keys ## Files Changed - `include/onnxruntime/core/session/onnxruntime_c_api.h` - API declaration - `include/onnxruntime/core/session/onnxruntime_cxx_api.h` - C++ wrapper declaration - `include/onnxruntime/core/session/onnxruntime_cxx_inline.h` - C++ wrapper implementation - `onnxruntime/core/session/custom_ops.cc` - Core implementation - `onnxruntime/core/session/onnxruntime_c_api.cc` - API registration - `onnxruntime/core/session/ort_apis.h` - API header declaration - `onnxruntime/test/framework/shape_inference_test.cc` - Test coverage ## API Version This change is part of ORT API Version 1.24. ## Breaking Changes None. This is a backward-compatible addition to the API.
This was referenced Feb 9, 2026
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds a new API function
KernelInfo_GetConfigEntriesthat allows custom operators to access all configuration entries from theOrtKernelInfoobject during kernel construction.Motivation and Context
Custom operators may need to access session configuration options to adjust their behavior. Previously, there was no way to retrieve all config entries from
KernelInfo. This PR provides a convenient method to get all configuration key-value pairs that were set on theOrtSessionOptions.Changes
API Additions
C API: Added
KernelInfo_GetConfigEntriesfunction toOrtApi(Version 1.24)OrtKernelInfo*as inputOrtKeyValuePairs*C++ API: Added
GetConfigEntries()method toKernelInfoImpltemplate classKeyValuePairsobjectImplementation
onnxruntime/core/session/custom_ops.ccconfig_options_mapfromOpKernelInfoOrtKeyValuePairswith all configuration entriesTesting
shape_inference_test.ccwith test caseFiles Changed
include/onnxruntime/core/session/onnxruntime_c_api.h- API declarationinclude/onnxruntime/core/session/onnxruntime_cxx_api.h- C++ wrapper declarationinclude/onnxruntime/core/session/onnxruntime_cxx_inline.h- C++ wrapper implementationonnxruntime/core/session/custom_ops.cc- Core implementationonnxruntime/core/session/onnxruntime_c_api.cc- API registrationonnxruntime/core/session/ort_apis.h- API header declarationonnxruntime/test/framework/shape_inference_test.cc- Test coverageAPI Version
This change is part of ORT API Version 1.24.
Breaking Changes
None. This is a backward-compatible addition to the API.