Skip to content

Commit

Permalink
[IREE-EP] Register IREE EP in OnnxRT's python bindings. (#4)
Browse files Browse the repository at this point in the history
* [IREE-EP] Register IREE EP in OnnxRT's python bindings.

* Add TODO comments.
  • Loading branch information
vinayakdsci committed Sep 10, 2024
1 parent 95e18f5 commit 08acace
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions onnxruntime/core/providers/iree/iree_execution_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include "core/framework/execution_provider.h"

#include "core/framework/provider_options.h"
#include "core/providers/iree/iree_ep_runtime.h"

namespace onnxruntime {
Expand Down
2 changes: 1 addition & 1 deletion onnxruntime/core/session/provider_registration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ ORT_API_STATUS_IMPL(OrtApis::SessionOptionsAppendExecutionProvider,
#endif
} else if (strcmp(provider_name, "IREE") == 0) {
#if defined(USE_IREE)
options->provider_factories.push_back(IREEProviderFactoryCreator::Create(provider_options_keys));
options->provider_factories.push_back(IREEProviderFactoryCreator::Create(provider_options));
#else
status = create_not_supported_status();
#endif
Expand Down
3 changes: 3 additions & 0 deletions onnxruntime/python/onnxruntime_pybind_schema.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ void addGlobalSchemaFunctions(pybind11::module& m) {
#ifdef USE_VITISAI
onnxruntime::VitisAIProviderFactoryCreator::Create(ProviderOptions{}),
#endif
#ifdef USE_IREE
onnxruntime::IREEProviderFactoryCreator::Create(ProviderOptions{}),
#endif
#ifdef USE_ACL
onnxruntime::ACLProviderFactoryCreator::Create(0),
#endif
Expand Down
10 changes: 10 additions & 0 deletions onnxruntime/python/onnxruntime_pybind_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1138,6 +1138,16 @@ std::unique_ptr<IExecutionProvider> CreateExecutionProviderInstance(
info["ep_context_embed_mode"] = session_options.config_options.GetConfigOrDefault(kOrtSessionOptionEpContextEmbedMode, "1");
info["ep_context_file_path"] = session_options.config_options.GetConfigOrDefault(kOrtSessionOptionEpContextFilePath, "");
return onnxruntime::VitisAIProviderFactoryCreator::Create(info)->CreateProvider();
#endif
} else if (type == kIreeExecutionProvider) {
#if USE_IREE
const auto &it = provider_options_map.find(type);
ProviderOptions iree_option_map = ProviderOptions{};
if (it != provider_options_map.end()) {
iree_option_map = it->second;
}
return onnxruntime::IREEProviderFactoryCreator::Create(iree_option_map)
->CreateProvider();
#endif
} else if (type == kAclExecutionProvider) {
#ifdef USE_ACL
Expand Down
2 changes: 2 additions & 0 deletions onnxruntime/test/perftest/command_args_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,8 @@ static bool ParseSessionConfigs(const std::string& configs_string,
test_config.machine_config.provider_type_name = onnxruntime::kXnnpackExecutionProvider;
} else if (!CompareCString(optarg, ORT_TSTR("vitisai"))) {
test_config.machine_config.provider_type_name = onnxruntime::kVitisAIExecutionProvider;
} else if (!CompareCString(optarg, ORT_TSTR("iree"))) {
test_config.machine_config.provider_type_name = onnxruntime::kIreeExecutionProvider;
} else {
return false;
}
Expand Down
3 changes: 2 additions & 1 deletion onnxruntime/test/perftest/ort_test_session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,8 @@ select from 'TF8', 'TF16', 'UINT8', 'FLOAT', 'ITENSOR'. \n)");
#endif
} else if (!provider_name_.empty() &&
provider_name_ != onnxruntime::kCpuExecutionProvider &&
provider_name_ != onnxruntime::kOpenVINOExecutionProvider) {
provider_name_ != onnxruntime::kOpenVINOExecutionProvider &&
provider_name_ != onnxruntime::kIreeExecutionProvider) {
ORT_THROW("This backend is not included in perf test runner.\n");
}

Expand Down

0 comments on commit 08acace

Please sign in to comment.