Skip to content

Commit

Permalink
fixups for doxygen. add c++ wrapper for setEpDynamicOptions (#22416)
Browse files Browse the repository at this point in the history
follow up to #22282

replaces #22388
  • Loading branch information
jywu-msft authored Oct 12, 2024
1 parent 18e81f8 commit 3321735
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
18 changes: 12 additions & 6 deletions include/onnxruntime/core/session/onnxruntime_c_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -3783,7 +3783,7 @@ struct OrtApi {

/** \brief Release an OrtCANNProviderOptions
*
* \param[in] the pointer of OrtCANNProviderOptions which will been deleted
* \param[in] input The pointer of OrtCANNProviderOptions which will been deleted
*
* \since Version 1.13.
*/
Expand Down Expand Up @@ -4685,6 +4685,8 @@ struct OrtApi {
* The data would still be copied to device if required by the model at inference time.
* \param[out] out A pointer to a newly created OrtLoraAdapter instance. Must be released with
* OrtApi::ReleaseLoraAdapter.
*
* \snippet{doc} snippets.dox OrtStatus Return Value
*/
ORT_API2_STATUS(CreateLoraAdapter, const ORTCHAR_T* adapter_file_path, _In_ OrtAllocator* allocator,
_Outptr_ OrtLoraAdapter** out);
Expand All @@ -4701,6 +4703,8 @@ struct OrtApi {
* The data would still be copied to device if required by the model at inference time.
* \param[out] out A pointer to a newly created OrtLoraAdapter instance. Must be released with
* OrtApi::ReleaseLoraAdapter.
*
* \snippet{doc} snippets.dox OrtStatus Return Value
*/
ORT_API2_STATUS(CreateLoraAdapterFromArray, _In_ const void* bytes, size_t num_bytes, _In_ OrtAllocator* allocator,
_Outptr_ OrtLoraAdapter** out);
Expand All @@ -4720,6 +4724,8 @@ struct OrtApi {
*
* \param[in] options OrtRunOptions instance
* \param[in] adapter OrtLoraAdapter instance
*
* \snippet{doc} snippets.dox OrtStatus Return Value
*/
ORT_API2_STATUS(RunOptionsAddActiveLoraAdapter, _Inout_ OrtRunOptions* options, _In_ const OrtLoraAdapter* adapter);

Expand All @@ -4732,12 +4738,12 @@ struct OrtApi {
* Valid options can be found in `include\onnxruntime\core\session\onnxruntime_session_options_config_keys.h`
* Look for `kOrtEpDynamicOptions`
*
* \param[in] session
* \param[in] list of keys represented by null-terminated strings
* \param[in] list of values represented by null-terminated strings
* \param[in] number of key-value pairs
* \param[in] sess OrtSession
* \param[in] keys Array of null terminated UTF8 encoded strings of EP dynamic option keys
* \param[in] values Array of null terminated UTF8 encoded string of EP dynamic option values
* \param[in] kv_len Number of elements in the keys and values arrays
*
* \since Version 1.20
* \snippet{doc} snippets.dox OrtStatus Return Value
*/
ORT_API2_STATUS(SetEpDynamicOptions, _Inout_ OrtSession* sess, _In_reads_(kv_len) const char* const* keys,
_In_reads_(kv_len) const char* const* values, _In_ size_t kv_len);
Expand Down
13 changes: 13 additions & 0 deletions include/onnxruntime/core/session/onnxruntime_cxx_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,19 @@ struct SessionImpl : ConstSessionImpl<T> {
* The OrtAllocator instances must be valid at the point of memory release.
*/
AllocatedStringPtr EndProfilingAllocated(OrtAllocator* allocator); ///< Wraps OrtApi::SessionEndProfiling

/** \brief Set DynamicOptions for EPs (Execution Providers)
*
* Wraps OrtApi::SetEpDynamicOptions
*
* Valid options can be found in `include\onnxruntime\core\session\onnxruntime_session_options_config_keys.h`
* Look for `kOrtEpDynamicOptions`
*
* \param[in] keys Array of null terminated UTF8 encoded strings of EP dynamic option keys
* \param[in] values Array of null terminated UTF8 encoded string of EP dynamic option values
* \param[in] kv_len Number of elements in the keys and values arrays
*/
void SetEpDynamicOptions(const char* const* keys, const char* const* values, size_t kv_len);
};

} // namespace detail
Expand Down
5 changes: 5 additions & 0 deletions include/onnxruntime/core/session/onnxruntime_cxx_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -1093,6 +1093,11 @@ inline AllocatedStringPtr SessionImpl<T>::EndProfilingAllocated(OrtAllocator* al
return AllocatedStringPtr(out, detail::AllocatedFree(allocator));
}

template <typename T>
inline void SessionImpl<T>::SetEpDynamicOptions(const char* const* keys, const char* const* values, size_t kv_len) {
ThrowOnError(GetApi().SetEpDynamicOptions(this->p_, keys, values, kv_len));
}

} // namespace detail

inline SessionOptions::SessionOptions() {
Expand Down

0 comments on commit 3321735

Please sign in to comment.