Add API to access config entries from KernelInfo #26589
Open
+59
−1
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.