mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-30 20:18:08 +00:00
Bug fix for C API (#5520)
* remove if_def from C api * Fix CI issues. * revert change for symbols.txt
This commit is contained in:
parent
3f3b202e36
commit
860cb22260
6 changed files with 15 additions and 11 deletions
|
|
@ -1090,13 +1090,11 @@ struct OrtApi {
|
|||
ORT_API2_STATUS(CreateEnvWithCustomLoggerAndGlobalThreadPools, OrtLoggingFunction logging_function, _In_opt_ void* logger_param, OrtLoggingLevel logging_level,
|
||||
_In_ const char* logid, _In_ const struct OrtThreadingOptions* tp_options, _Outptr_ OrtEnv** out);
|
||||
|
||||
#ifdef USE_CUDA
|
||||
/**
|
||||
* Append CUDA execution provider
|
||||
*/
|
||||
ORT_API2_STATUS(OrtSessionOptionsAppendExecutionProvider_CUDA,
|
||||
_In_ OrtSessionOptions* options, _In_ OrtCUDAProviderOptions* cuda_options);
|
||||
#endif // USE_CUDA
|
||||
|
||||
/**
|
||||
* Use this API to configure the global thread pool options to be used in the call to CreateEnvWithGlobalThreadPools.
|
||||
|
|
|
|||
|
|
@ -251,9 +251,8 @@ struct SessionOptions : Base<OrtSessionOptions> {
|
|||
|
||||
SessionOptions& AddConfigEntry(const char* config_key, const char* config_value);
|
||||
SessionOptions& AddInitializer(const char* name, const OrtValue* ort_val);
|
||||
#ifdef USE_CUDA
|
||||
OrtStatus* OrtSessionOptionsAppendExecutionProvider_CUDA(OrtSessionOptions* options, OrtCUDAProviderOptions* cuda_options);
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
struct ModelMetadata : Base<OrtModelMetadata> {
|
||||
|
|
|
|||
|
|
@ -477,12 +477,10 @@ inline SessionOptions& SessionOptions::AddInitializer(const char* name, const Or
|
|||
return *this;
|
||||
}
|
||||
|
||||
#ifdef USE_CUDA
|
||||
inline OrtStatus* SessionOptions::OrtSessionOptionsAppendExecutionProvider_CUDA(OrtSessionOptions * options, OrtCUDAProviderOptions * cuda_options) {
|
||||
ThrowOnError(GetApi().OrtSessionOptionsAppendExecutionProvider_CUDA(options, cuda_options));
|
||||
return nullptr;
|
||||
ThrowOnError(GetApi().OrtSessionOptionsAppendExecutionProvider_CUDA(options, cuda_options));
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
inline Session::Session(Env& env, const ORTCHAR_T* model_path, const SessionOptions& options) {
|
||||
ThrowOnError(GetApi().CreateSession(env, model_path, options, &p_));
|
||||
|
|
|
|||
|
|
@ -68,5 +68,6 @@ ORT_API_STATUS_IMPL(OrtApis::OrtSessionOptionsAppendExecutionProvider_CUDA,
|
|||
cuda_options->cudnn_conv_algo_search, cuda_options->cuda_mem_limit,
|
||||
static_cast<onnxruntime::ArenaExtendStrategy>(cuda_options->arena_extend_strategy),
|
||||
cuda_options->do_copy_in_default_stream));
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
OrtSessionOptionsAppendExecutionProvider_CUDA
|
||||
OrtSessionOptionsAppendExecutionProvider_CUDA
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
#include <functional>
|
||||
#include <sstream>
|
||||
|
||||
#include "core/common/common.h"
|
||||
#include "core/common/logging/logging.h"
|
||||
#include "core/common/status.h"
|
||||
#include "core/common/safeint.h"
|
||||
|
|
@ -1805,6 +1806,15 @@ ORT_API_STATUS_IMPL(OrtApis::SessionGetProfilingStartTimeNs, _In_ const OrtSessi
|
|||
|
||||
// End support for non-tensor types
|
||||
|
||||
#ifndef USE_CUDA
|
||||
ORT_API_STATUS_IMPL(OrtApis::OrtSessionOptionsAppendExecutionProvider_CUDA,
|
||||
_In_ OrtSessionOptions* options, _In_ OrtCUDAProviderOptions* cuda_options){
|
||||
ORT_UNUSED_PARAMETER(options);
|
||||
ORT_UNUSED_PARAMETER(cuda_options);
|
||||
return CreateStatus(ORT_FAIL, "CUDA execution provider is not enabled.");
|
||||
}
|
||||
#endif
|
||||
|
||||
static constexpr OrtApiBase ort_api_base = {
|
||||
&OrtApis::GetApi,
|
||||
&OrtApis::GetVersionString,
|
||||
|
|
@ -2031,9 +2041,7 @@ static constexpr OrtApi ort_api_1_to_6 = {
|
|||
// Version 6 - In development, feel free to add/remove/rearrange here
|
||||
&OrtApis::AddInitializer,
|
||||
&OrtApis::CreateEnvWithCustomLoggerAndGlobalThreadPools,
|
||||
#ifdef USE_CUDA
|
||||
&OrtApis::OrtSessionOptionsAppendExecutionProvider_CUDA,
|
||||
#endif
|
||||
&OrtApis::SetGlobalDenormalAsZero,
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue