diff --git a/onnxruntime/core/providers/nnapi/nnapi_builtin/builders/model_builder.cc b/onnxruntime/core/providers/nnapi/nnapi_builtin/builders/model_builder.cc index 522265ed85..b7615a45a7 100644 --- a/onnxruntime/core/providers/nnapi/nnapi_builtin/builders/model_builder.cc +++ b/onnxruntime/core/providers/nnapi/nnapi_builtin/builders/model_builder.cc @@ -543,7 +543,6 @@ Status ModelBuilder::Compile(std::unique_ptr& model) { bool all_ops_supported = std::all_of(supported_ops, supported_ops + num_nnapi_ops_, [](bool is_supported) { return is_supported; }); - // TODO, To allow fallback to CPU if it's not strict CPU_DISABLED mode if (!all_ops_supported) { // There are some ops not supported by the list of the target devices // Fail the Compile @@ -551,11 +550,10 @@ Status ModelBuilder::Compile(std::unique_ptr& model) { // TODO, add some logic to not fail for some cases // Such as, if there are some acceptable fall back to CPU (nnapi-reference) // and CPU is not in the target devices list - return ORT_MAKE_STATUS(ONNXRUNTIME, EP_FAIL, - "The model cannot run using the current set of target devices, ", - GetDevicesDescription(nnapi_target_devices_)); + return ORT_MAKE_STATUS(ONNXRUNTIME, EP_FAIL, + "The model cannot run using the current set of target devices, ", + GetDevicesDescription(nnapi_target_devices_)); } - // Workaround bugs in NNAPI drives on some phones // where ops are passed checking by 'ANeuralNetworksModel_getSupportedOperationsForDevices' // but failed at compilation. @@ -587,12 +585,12 @@ Status ModelBuilder::Compile(std::unique_ptr& model) { optype_support_status[stat_name].second++; } } - size_t total_ops = 0; + size_t fallback_ops = 0; std::string fallback_op_detail, normal_op_detail; for (const auto& [op, ops_status] : optype_support_status) { auto& [support_cnt, unspport_cnt] = ops_status; - total_ops += support_cnt + unspport_cnt; + fallback_ops += unspport_cnt; if (support_cnt > 0) { normal_op_detail += MakeString(support_cnt, "x ", op, ", "); } @@ -601,7 +599,7 @@ Status ModelBuilder::Compile(std::unique_ptr& model) { } } - LOGS_DEFAULT(VERBOSE) << total_ops << " Ops [" << fallback_op_detail << "] out of " << num_nnapi_ops_ + LOGS_DEFAULT(VERBOSE) << fallback_ops << " Ops [" << fallback_op_detail << "] out of " << num_nnapi_ops_ << " are falling-back to " << kNnapiCpuDeviceName << ", and [" << normal_op_detail << "] is running in accelerators."; } diff --git a/onnxruntime/core/providers/nnapi/nnapi_builtin/builders/model_builder.h b/onnxruntime/core/providers/nnapi/nnapi_builtin/builders/model_builder.h index e113e71564..8eddf389d3 100644 --- a/onnxruntime/core/providers/nnapi/nnapi_builtin/builders/model_builder.h +++ b/onnxruntime/core/providers/nnapi/nnapi_builtin/builders/model_builder.h @@ -5,7 +5,6 @@ #include #include -#include "core/common/inlined_containers.h" #include "core/common/inlined_containers_fwd.h" #include "core/graph/basic_types.h" #include "core/providers/nnapi/nnapi_builtin/model.h"