mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-06-01 23:30:35 +00:00
[OpenVINO-EP] Remove support for 2020.4 (#7580)
* [OpenVINO-EP] Remove support for 2020.4 Signed-off-by: MaajidKhan <n.maajidkhan@gmail.com> * Minor changes added Signed-off-by: MaajidKhan <n.maajidkhan@gmail.com> * Minor changes added Signed-off-by: MaajidKhan <n.maajidkhan@gmail.com> Co-authored-by: suryasidd <surya.siddharth.pemmaraju@intel.com>
This commit is contained in:
parent
bdb2ed7864
commit
cea0ea1591
7 changed files with 30 additions and 57 deletions
|
|
@ -1297,9 +1297,6 @@ if(onnxruntime_USE_OPENVINO)
|
|||
if (${VER} MATCHES "2020.3" OR $ENV{INTEL_OPENVINO_DIR} MATCHES "2020.3")
|
||||
set(OPENVINO_VERSION "2020.3")
|
||||
add_definitions(-DOPENVINO_2020_3=1)
|
||||
elseif (${VER} MATCHES "2020.4" OR $ENV{INTEL_OPENVINO_DIR} MATCHES "2020.4")
|
||||
set(OPENVINO_VERSION "2020.4")
|
||||
add_definitions(-DOPENVINO_2020_4=1)
|
||||
elseif (${VER} MATCHES "2021.1" OR $ENV{INTEL_OPENVINO_DIR} MATCHES "2021.1")
|
||||
set(OPENVINO_VERSION "2021.1")
|
||||
add_definitions(-DOPENVINO_2021_1=1)
|
||||
|
|
|
|||
|
|
@ -128,8 +128,7 @@ CreateCNNNetwork(const ONNX_NAMESPACE::ModelProto& model_proto, const GlobalCont
|
|||
ng_function->validate_nodes_and_infer_types();
|
||||
}
|
||||
|
||||
#if (defined OPENVINO_2020_4) || (defined OPENVINO_2021_1) || (defined OPENVINO_2021_2) || \
|
||||
(defined OPENVINO_2021_3) || (defined OPENVINO_2021_4)
|
||||
#if (defined OPENVINO_2021_1) || (defined OPENVINO_2021_2) || (defined OPENVINO_2021_3) || (defined OPENVINO_2021_4)
|
||||
if (!global_context.is_wholly_supported_graph) {
|
||||
std::map<std::string, std::string> result_to_output;
|
||||
for (auto& result : ng_function->get_results()) {
|
||||
|
|
@ -210,8 +209,7 @@ void SetIODefs(const ONNX_NAMESPACE::ModelProto& model_proto,
|
|||
auto outputInfo = network->getOutputsInfo();
|
||||
for (auto iter = outputInfo.begin(); iter != outputInfo.end(); ++iter) {
|
||||
auto output_name = iter->first;
|
||||
#if (defined OPENVINO_2020_4) || (defined OPENVINO_2021_1) || (defined OPENVINO_2021_2) || \
|
||||
(defined OPENVINO_2021_3) || (defined OPENVINO_2021_4)
|
||||
#if (defined OPENVINO_2021_1) || (defined OPENVINO_2021_2) || (defined OPENVINO_2021_3) || (defined OPENVINO_2021_4)
|
||||
auto it = const_outputs_map.find(output_name);
|
||||
//Output is constant and don't need to set precision
|
||||
if (it != const_outputs_map.end())
|
||||
|
|
@ -255,8 +253,7 @@ GetOutputTensor(Ort::CustomOpApi& ort, OrtKernelContext* context, size_t batch_s
|
|||
return output_tensor;
|
||||
}
|
||||
|
||||
#if (defined OPENVINO_2020_4) || (defined OPENVINO_2021_1) || (defined OPENVINO_2021_2) || \
|
||||
(defined OPENVINO_2021_3) || (defined OPENVINO_2021_4)
|
||||
#if (defined OPENVINO_2021_1) || (defined OPENVINO_2021_2) || (defined OPENVINO_2021_3) || (defined OPENVINO_2021_4)
|
||||
OrtValue*
|
||||
GetOutputTensor(Ort::CustomOpApi& ort, OrtKernelContext* context,
|
||||
std::string output_name,
|
||||
|
|
@ -304,8 +301,7 @@ int GetFirstAvailableDevice(GlobalContext& global_context) {
|
|||
return i;
|
||||
}
|
||||
|
||||
#if (defined OPENVINO_2020_4) || (defined OPENVINO_2021_1) || (defined OPENVINO_2021_2) || \
|
||||
(defined OPENVINO_2021_3) || (defined OPENVINO_2021_4)
|
||||
#if (defined OPENVINO_2021_1) || (defined OPENVINO_2021_2) || (defined OPENVINO_2021_3) || (defined OPENVINO_2021_4)
|
||||
void FillOutputsWithConstantData(Ort::CustomOpApi& ort, std::shared_ptr<ngraph::Node> node, OrtValue* out_tensor) {
|
||||
switch (node->get_element_type()) {
|
||||
case ngraph::element::Type_t::f32: {
|
||||
|
|
@ -330,8 +326,7 @@ void FillOutputsWithConstantData(Ort::CustomOpApi& ort, std::shared_ptr<ngraph::
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (defined OPENVINO_2020_4) || (defined OPENVINO_2021_1) || (defined OPENVINO_2021_2) || \
|
||||
(defined OPENVINO_2021_3) || (defined OPENVINO_2021_4)
|
||||
#if (defined OPENVINO_2021_1) || (defined OPENVINO_2021_2) || (defined OPENVINO_2021_3) || (defined OPENVINO_2021_4)
|
||||
template <typename T>
|
||||
void FillOutputHelper(Ort::CustomOpApi& ort, OrtValue* out_tensor, std::shared_ptr<ngraph::Node> node) {
|
||||
auto const_node = std::dynamic_pointer_cast<ngraph::op::Constant>(node);
|
||||
|
|
|
|||
|
|
@ -48,8 +48,7 @@ CreateCNNNetwork(const ONNX_NAMESPACE::ModelProto& model_proto, const GlobalCont
|
|||
|
||||
int GetFirstAvailableDevice(GlobalContext& global_context);
|
||||
|
||||
#if defined(OPENVINO_2020_4) || defined(OPENVINO_2021_1) || defined(OPENVINO_2021_2) || \
|
||||
defined(OPENVINO_2021_3) || defined(OPENVINO_2021_4)
|
||||
#if defined(OPENVINO_2021_1) || defined(OPENVINO_2021_2) || defined(OPENVINO_2021_3) || defined(OPENVINO_2021_4)
|
||||
void FillOutputsWithConstantData(Ort::CustomOpApi& ort, std::shared_ptr<ngraph::Node> node, OrtValue* out_tensor);
|
||||
|
||||
template <typename T>
|
||||
|
|
|
|||
|
|
@ -78,8 +78,7 @@ BasicBackend::BasicBackend(const ONNX_NAMESPACE::ModelProto& model_proto,
|
|||
if(!openvino_ep::BackendManager::GetGlobalContext().is_wholly_supported_graph) {
|
||||
ie_cnn_network_ = CreateCNNNetwork(model_proto, global_context_, subgraph_context_, const_outputs_map_);
|
||||
SetIODefs(model_proto, ie_cnn_network_, subgraph_context_.output_names, const_outputs_map_, global_context_.device_type);
|
||||
#if defined(OPENVINO_2020_4) || defined(OPENVINO_2021_1) || defined(OPENVINO_2021_2) || \
|
||||
defined(OPENVINO_2021_3) || defined(OPENVINO_2021_4)
|
||||
#if defined(OPENVINO_2021_1) || defined(OPENVINO_2021_2) || defined(OPENVINO_2021_3) || defined(OPENVINO_2021_4)
|
||||
if (const_outputs_map_.size() == subgraph_context_.output_names.size())
|
||||
subgraph_context_.is_constant = true;
|
||||
#endif
|
||||
|
|
@ -117,8 +116,7 @@ BasicBackend::BasicBackend(const ONNX_NAMESPACE::ModelProto& model_proto,
|
|||
if(!openvino_ep::backend_utils::UseCompiledNetwork()) {
|
||||
ie_cnn_network_ = CreateCNNNetwork(model_proto, global_context_, subgraph_context_, const_outputs_map_);
|
||||
SetIODefs(model_proto, ie_cnn_network_, subgraph_context_.output_names, const_outputs_map_, global_context_.device_type);
|
||||
#if defined(OPENVINO_2020_4) || defined(OPENVINO_2021_1) || defined(OPENVINO_2021_2) || \
|
||||
defined(OPENVINO_2021_3) || defined(OPENVINO_2021_4)
|
||||
#if defined(OPENVINO_2021_1) || defined(OPENVINO_2021_2) || defined(OPENVINO_2021_3) || defined(OPENVINO_2021_4)
|
||||
if (const_outputs_map_.size() == subgraph_context_.output_names.size())
|
||||
subgraph_context_.is_constant = true;
|
||||
#endif
|
||||
|
|
@ -133,16 +131,7 @@ BasicBackend::BasicBackend(const ONNX_NAMESPACE::ModelProto& model_proto,
|
|||
}
|
||||
#endif
|
||||
if (global_context_.device_type.find("MYRIAD") != std::string::npos) {
|
||||
#if defined(OPENVINO_2021_1) || defined(OPENVINO_2021_2) || \
|
||||
defined(OPENVINO_2021_3) || defined(OPENVINO_2021_4)
|
||||
if (subgraph_context_.set_vpu_config) {
|
||||
config["MYRIAD_DETECT_NETWORK_BATCH"] = CONFIG_VALUE(NO);
|
||||
}
|
||||
if (global_context_.enable_vpu_fast_compile) {
|
||||
config["MYRIAD_HW_INJECT_STAGES"] = CONFIG_VALUE(NO);
|
||||
config["MYRIAD_COPY_OPTIMIZATION"] = CONFIG_VALUE(NO);
|
||||
}
|
||||
#else
|
||||
#if defined(OPENVINO_2020_3)
|
||||
if (subgraph_context_.set_vpu_config) {
|
||||
config["VPU_DETECT_NETWORK_BATCH"] = CONFIG_VALUE(NO);
|
||||
}
|
||||
|
|
@ -150,6 +139,14 @@ BasicBackend::BasicBackend(const ONNX_NAMESPACE::ModelProto& model_proto,
|
|||
config["VPU_HW_INJECT_STAGES"] = CONFIG_VALUE(NO);
|
||||
config["VPU_COPY_OPTIMIZATION"] = CONFIG_VALUE(NO);
|
||||
}
|
||||
#else
|
||||
if (subgraph_context_.set_vpu_config) {
|
||||
config["MYRIAD_DETECT_NETWORK_BATCH"] = CONFIG_VALUE(NO);
|
||||
}
|
||||
if (global_context_.enable_vpu_fast_compile) {
|
||||
config["MYRIAD_HW_INJECT_STAGES"] = CONFIG_VALUE(NO);
|
||||
config["MYRIAD_COPY_OPTIMIZATION"] = CONFIG_VALUE(NO);
|
||||
}
|
||||
#endif
|
||||
#if defined(OPENVINO_2021_4)
|
||||
//to check preprocessing inside model
|
||||
|
|
@ -248,8 +245,7 @@ void BasicBackend::CompleteAsyncInference(Ort::CustomOpApi& ort, OrtKernelContex
|
|||
size_t batch_slice = 0;
|
||||
FillOutputBlob(graph_output_blob, output_tensor, ort, precision, batch_slice);
|
||||
}
|
||||
#if defined(OPENVINO_2020_4) || defined(OPENVINO_2021_1) || defined(OPENVINO_2021_2) || \
|
||||
defined(OPENVINO_2021_3) || defined(OPENVINO_2021_4)
|
||||
#if defined(OPENVINO_2021_1) || defined(OPENVINO_2021_2) || defined(OPENVINO_2021_3) || defined(OPENVINO_2021_4)
|
||||
if (!const_outputs_map_.empty()) {
|
||||
for (auto item : const_outputs_map_) {
|
||||
auto out_name = item.first;
|
||||
|
|
@ -269,8 +265,7 @@ void BasicBackend::Infer(Ort::CustomOpApi& ort, OrtKernelContext* context) {
|
|||
LOGS_DEFAULT(INFO) << log_tag << "In Infer";
|
||||
|
||||
if (subgraph_context_.is_constant) {
|
||||
#if defined(OPENVINO_2020_4) || defined(OPENVINO_2021_1) || defined(OPENVINO_2021_2) || \
|
||||
defined(OPENVINO_2021_3) || defined(OPENVINO_2021_4)
|
||||
#if defined(OPENVINO_2021_1) || defined(OPENVINO_2021_2) || defined(OPENVINO_2021_3) || defined(OPENVINO_2021_4)
|
||||
for (auto item : const_outputs_map_) {
|
||||
auto out_name = item.first;
|
||||
auto node = item.second;
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ VADMBackend::VADMBackend(const ONNX_NAMESPACE::ModelProto& model_proto,
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(OPENVINO_2020_4)
|
||||
#if defined(OPENVINO_2021_1) || defined(OPENVINO_2021_2) || defined(OPENVINO_2021_3) || defined(OPENVINO_2021_4)
|
||||
if (const_outputs_map_.size() == subgraph_context_.output_names.size())
|
||||
subgraph_context_.is_constant = true;
|
||||
#endif
|
||||
|
|
@ -77,11 +77,10 @@ VADMBackend::VADMBackend(const ONNX_NAMESPACE::ModelProto& model_proto,
|
|||
if (global_context_.is_wholly_supported_graph && subgraph_context_.enable_batching) {
|
||||
for (int j = 0; j < 8; j++) {
|
||||
InferenceEngine::ExecutableNetwork exe_network;
|
||||
#if defined(OPENVINO_2021_1) || defined(OPENVINO_2021_2) || \
|
||||
defined(OPENVINO_2021_3) || defined(OPENVINO_2021_4)
|
||||
config[InferenceEngine::HDDL_DEVICE_TAG] = global_context_.deviceTags[j];
|
||||
#else
|
||||
#if defined(OPENVINO_2020_3)
|
||||
config[VPU_HDDL_CONFIG_KEY(DEVICE_TAG)] = global_context_.deviceTags[j];
|
||||
#else
|
||||
config[InferenceEngine::HDDL_DEVICE_TAG] = global_context_.deviceTags[j];
|
||||
#endif
|
||||
try {
|
||||
exe_network = global_context_.ie_core.LoadNetwork(*ie_cnn_network_, hw_target, config);
|
||||
|
|
@ -111,11 +110,10 @@ VADMBackend::VADMBackend(const ONNX_NAMESPACE::ModelProto& model_proto,
|
|||
else {
|
||||
i = GetFirstAvailableDevice(global_context);
|
||||
LOGS_DEFAULT(INFO) << log_tag << "Device Tag is: " << i;
|
||||
#if defined(OPENVINO_2021_1) || defined(OPENVINO_2021_2) || \
|
||||
defined(OPENVINO_2021_3) || defined(OPENVINO_2021_4)
|
||||
config[InferenceEngine::HDDL_DEVICE_TAG] = global_context_.deviceTags[i];
|
||||
#else
|
||||
#if defined(OPENVINO_2020_3)
|
||||
config[VPU_HDDL_CONFIG_KEY(DEVICE_TAG)] = global_context_.deviceTags[i];
|
||||
#else
|
||||
config[InferenceEngine::HDDL_DEVICE_TAG] = global_context_.deviceTags[i];
|
||||
#endif
|
||||
InferenceEngine::ExecutableNetwork exe_network;
|
||||
try {
|
||||
|
|
@ -208,7 +206,7 @@ void VADMBackend::CompleteAsyncInference(Ort::CustomOpApi& ort, OrtKernelContext
|
|||
|
||||
FillOutputBlob(graph_output_blob, output_tensor, ort, precision, batch_slice_idx);
|
||||
}
|
||||
#if defined(OPENVINO_2020_4)
|
||||
#if defined(OPENVINO_2021_1) || defined(OPENVINO_2021_2) || defined(OPENVINO_2021_3) || defined(OPENVINO_2021_4)
|
||||
if (!const_outputs_map_.empty()) {
|
||||
for (auto item : const_outputs_map_) {
|
||||
auto out_name = item.first;
|
||||
|
|
@ -257,8 +255,7 @@ void VADMBackend::Infer(Ort::CustomOpApi& ort, OrtKernelContext* context) {
|
|||
size_t remainder_parallel_runs = batch_size % num_inf_reqs_;
|
||||
|
||||
if (subgraph_context_.is_constant) {
|
||||
#if defined(OPENVINO_2020_4) || defined(OPENVINO_2021_1) || defined(OPENVINO_2021_2) || \
|
||||
defined(OPENVINO_2021_3) || defined(OPENVINO_2021_4)
|
||||
#if defined(OPENVINO_2021_1) || defined(OPENVINO_2021_2) || defined(OPENVINO_2021_3) || defined(OPENVINO_2021_4)
|
||||
for (auto item : const_outputs_map_) {
|
||||
auto out_name = item.first;
|
||||
auto node = item.second;
|
||||
|
|
|
|||
|
|
@ -70,10 +70,6 @@ OpenVINOExecutionProvider::GetCapability(const GraphViewer& graph_viewer, const
|
|||
#if defined OPENVINO_2020_3
|
||||
result = openvino_ep::GetCapability_2020_3(graph_viewer,
|
||||
openvino_ep::BackendManager::GetGlobalContext().device_type);
|
||||
#elif defined (OPENVINO_2020_4)
|
||||
openvino_ep::GetCapability obj(graph_viewer,
|
||||
openvino_ep::BackendManager::GetGlobalContext().device_type, "V_2020_4");
|
||||
result = obj.Execute();
|
||||
#elif defined (OPENVINO_2021_1)
|
||||
openvino_ep::GetCapability obj(graph_viewer,
|
||||
openvino_ep::BackendManager::GetGlobalContext().device_type, "V_2021_1");
|
||||
|
|
|
|||
|
|
@ -32,8 +32,6 @@ GetCapability::GetCapability(const GraphViewer& graph_viewer_param, std::string
|
|||
data_ops_ = new DataOps(graph_viewer_, V_2021_2, device_type_);
|
||||
} else if (version_param == "V_2021_1") {
|
||||
data_ops_ = new DataOps(graph_viewer_, V_2021_1, device_type_);
|
||||
} else if (version_param == "V_2020_4") {
|
||||
data_ops_ = new DataOps(graph_viewer_, V_2020_4, device_type_);
|
||||
} else if (version_param == "V_2021_3") {
|
||||
data_ops_ = new DataOps(graph_viewer_, V_2021_3, device_type_);
|
||||
} else {
|
||||
|
|
@ -146,12 +144,8 @@ std::vector<std::unique_ptr<ComputeCapability>> GetCapability::Execute() {
|
|||
}
|
||||
|
||||
//If subgraph has less then three, graph is considered trivial
|
||||
if (data_ops_->GetVersion() != V_2020_4) {
|
||||
|
||||
if (this_cluster.size() < 3) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this_cluster.size() < 3) {
|
||||
continue;
|
||||
} else {
|
||||
//If subgraph only has Identity node, EyeLike or Dropout, OpenVINO EP doesn't support it.
|
||||
if (this_cluster.size() == 1) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue