Browse Source

!348 Feature: Cancel default set aicpu engine

From: @lixiwen1
Reviewed-by: @xchu42,@ji_chen
Signed-off-by: @ji_chen
tags/v1.1.0
mindspore-ci-bot Gitee 3 years ago
parent
commit
961aae87d6
1 changed files with 23 additions and 17 deletions
  1. +23
    -17
      ge/graph/passes/compile_nodes_pass.cc

+ 23
- 17
ge/graph/passes/compile_nodes_pass.cc View File

@@ -35,7 +35,7 @@ const char *const kAICPUKernelLibName = "aicpu_tf_kernel";
namespace ge {
graphStatus CompileNodesPass::Run(ComputeGraphPtr graph) {
GE_TIMESTAMP_START(CompileNodesPass);
GELOGI("[CompileNodesPass]: optimize begin.");
GELOGD("[CompileNodesPass]: optimize begin.");
if (graph == nullptr) {
return GRAPH_SUCCESS;
}
@@ -81,7 +81,7 @@ graphStatus CompileNodesPass::Run(ComputeGraphPtr graph) {
GELOGE(result, "Compile op failed.");
return result;
}
GELOGI("[CompileNodesPass]: Optimize success.");
GELOGD("[CompileNodesPass]: Optimize success.");
GE_TIMESTAMP_EVENT_END(CompileNodesPass, "OptimizeStage2::ControlAttrOptimize::CompileNodesPass");
return GRAPH_SUCCESS;
}
@@ -111,20 +111,28 @@ graphStatus CompileNodesPass::GetSupportedKernel(const NodePtr &node, const std:
}
// begin accuracy supported check
if (!CheckAccuracySupport(kernel_info, instance, op_desc)) {
// if check accuracy support failed , try to go to aicpu engine
string aicpu_kernel_lib_name = kAICPUKernelLibName;
OpsKernelInfoStorePtr aicpu_kernel_info =
instance->OpsKernelManagerObj().GetOpsKernelInfoStore(aicpu_kernel_lib_name);
if (aicpu_kernel_info == nullptr) {
GELOGE(ge::GE_GRAPH_PARAM_NULLPTR, "Get aicpu kernel info store failed.");
return ge::GE_GRAPH_PARAM_NULLPTR;
}
if (!CheckAccuracySupport(aicpu_kernel_info, instance, op_desc)) {
GELOGE(GRAPH_FAILED, "AICPU engine does not support node:%s, type:%s , get kernel lib failed.",
node->GetName().c_str(), op_desc->GetType().c_str());
return GRAPH_FAILED;
// if check accuracy support failed , try to go to other engine.
GELOGD("Check Accuracy Supported return not support, node name is %s. Try to go to other engine.",
op_desc->GetName().c_str());
string kernel_name_origin = kernel_lib_name;
OpsKernelManager &ops_kernel_manager = instance->OpsKernelManagerObj();
auto kernel_map = ops_kernel_manager.GetAllOpsKernelInfoStores();
for (auto it = kernel_map.begin(); it != kernel_map.end(); ++it) {
string tmp_kernel_name = it->first;
if (tmp_kernel_name == kernel_name_origin) {
continue;
}
OpsKernelInfoStorePtr tmp_kernel_info = it->second;
if (CheckAccuracySupport(tmp_kernel_info, instance, op_desc)) {
kernel_lib_name = tmp_kernel_name;
GELOGD("Find kernel lib %s support node:%s, type:%s , get kernel lib success.", tmp_kernel_name.c_str(),
node->GetName().c_str(), op_desc->GetType().c_str());
return GRAPH_SUCCESS;
}
}
kernel_lib_name = kAICPUKernelLibName;
GELOGE(GRAPH_FAILED, "Cannot find kernel lib support node:%s, type:%s , get kernel lib failed.",
node->GetName().c_str(), op_desc->GetType().c_str());
return GRAPH_FAILED;
}
return GRAPH_SUCCESS;
}
@@ -138,8 +146,6 @@ bool CompileNodesPass::CheckAccuracySupport(const OpsKernelInfoStorePtr &kernel_
}
string reason;
if (!(kernel_info->CheckAccuracySupported(*ge_desc, reason, true))) {
GELOGW("Check Accuracy Supported return not support, node name is %s, reason: %s. Try to go to AICPU engine.",
op_desc->GetName().c_str(), reason.c_str());
return false;
}
return true;


Loading…
Cancel
Save