From d8dfda2e08e06608d27cf7fa80f2caf83a2cf34e Mon Sep 17 00:00:00 2001 From: pengwa Date: Tue, 18 Apr 2023 16:51:11 +0800 Subject: [PATCH] Minor fix for differently scoped cpu_ep usage (#15550) ### Minor fix for differently scoped cpu_ep cpu_ep is under `#ifndef DISABLE_CONTRIB_OPS`, but one of its usage is not under the same condition. ``` #ifndef DISABLE_CONTRIB_OPS const InlinedHashSet cpu_ep = {onnxruntime::kCpuExecutionProvider}; #endif ``` ### Motivation and Context Postmoterm: https://github.com/microsoft/onnxruntime/pull/15461 passed all CIs except Linux/Windows TVM CIs. I did not check the detailed error message then because they are failed for some reason for a few days at least. While checking the details, after PR 15461, the error messge changes from Before constant sharing change: TVM CI error message: ``` https://github.com/microsoft/onnxruntime/actions/runs/4700368634/jobs/8334955814 ERROR: testBooleanInputs (__main__.TestInferenceSession) ---------------------------------------------------------------------- Traceback (most recent call last): File "onnxruntime_test_python.py", line 617, in testBooleanInputs sess = onnxrt.InferenceSession(get_name("logicaland.onnx"), providers=available_providers) File "D:\a\onnxruntime\onnxruntime\build\Release\Release\onnxruntime\capi\onnxruntime_inference_collection.py", line 383, in __init__ self._create_inference_session(providers, provider_options, disabled_optimizers) File "D:\a\onnxruntime\onnxruntime\build\Release\Release\onnxruntime\capi\onnxruntime_inference_collection.py", line 435, in _create_inference_session sess.initialize_session(providers, provider_options, disabled_optimizers) onnxruntime.capi.onnxruntime_pybind11_state.RuntimeException: [ONNXRuntimeError] : 6 : RUNTIME_EXCEPTION : Exception during initialization: D:\a\onnxruntime\onnxruntime\onnxruntime\core\providers\tvm\tvm_api.cc:49 onnxruntime::tvm::TVMCompile compile != nullptr was false. Unable to retrieve 'tvm_onnx_import_and_compile'. ``` to ``` D:\a\onnxruntime\onnxruntime\onnxruntime\core\optimizer\graph_transformer_utils.cc(213,67): error C2065: 'cpu_ep': undeclared identifier [D:\a\onnxruntime\onnxruntime\build\Release\onnxruntime_optimizer.vcxproj] D:\a\onnxruntime\onnxruntime\onnxruntime\core\optimizer\graph_transformer_utils.cc(213,19): error C2672: ``` This PR fixes the build the issue, The error message of Windows/Linux TVM CIs are back to the original ones. --- onnxruntime/core/optimizer/graph_transformer_utils.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/onnxruntime/core/optimizer/graph_transformer_utils.cc b/onnxruntime/core/optimizer/graph_transformer_utils.cc index 36b16ba27a..7078596c41 100644 --- a/onnxruntime/core/optimizer/graph_transformer_utils.cc +++ b/onnxruntime/core/optimizer/graph_transformer_utils.cc @@ -210,7 +210,8 @@ InlinedVector> GenerateTransformers( for (const auto& p : session_options.initializers_to_share_map) { excluded_initializers.insert(p.first); } - transformers.emplace_back(std::make_unique(cpu_ep, excluded_initializers)); + const InlinedHashSet no_limit_empty_ep_list = {}; + transformers.emplace_back(std::make_unique(no_limit_empty_ep_list, excluded_initializers)); transformers.emplace_back(std::make_unique()); transformers.emplace_back(std::make_unique(cpu_execution_provider, !disable_quant_qdq));