From 897fcfe7e5f2c92a5c64c8ae312a9e7c1faa45b7 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Tue, 1 Jun 2021 17:04:37 +0800 Subject: [PATCH] check kernel_type. --- ge/hybrid/node_executor/host_cpu/host_cpu_node_executor.cc | 4 ++-- ge/hybrid/node_executor/host_cpu/host_cpu_node_executor.h | 2 +- inc/framework/common/taskdown_common.h | 1 + .../node_executor/host_cpu/host_cpu_node_task_unittest.cc | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ge/hybrid/node_executor/host_cpu/host_cpu_node_executor.cc b/ge/hybrid/node_executor/host_cpu/host_cpu_node_executor.cc index f106a409..26e47107 100755 --- a/ge/hybrid/node_executor/host_cpu/host_cpu_node_executor.cc +++ b/ge/hybrid/node_executor/host_cpu/host_cpu_node_executor.cc @@ -92,7 +92,7 @@ Status HostAicpuNodeTask::Execute(TaskContext &context) { } else { REPORT_CALL_ERROR("E19999", "Run cpu kernel failed node:%s, cpu kernel is not initialized.", node_name_.c_str()); GELOGE(INTERNAL_ERROR, - "[Run][Kernel]Run cpu kernel failed node:%s, cpu kernel is not initialized.",node_name_.c_str()); + "[Run][Kernel]Run cpu kernel failed node:%s, cpu kernel is not initialized.", node_name_.c_str()); return INTERNAL_ERROR; } @@ -127,7 +127,7 @@ Status HostCpuNodeExecutor::ValidateTaskDef(const domi::TaskDef &task_def) { return INTERNAL_ERROR; } auto kernel_type = static_cast(task_def.kernel().context().kernel_type()); - if (kernel_type != ccKernelType::AI_CPU) { + if (kernel_type != ccKernelType::HOST_CPU) { REPORT_INNER_ERROR("E19999", "Invalid kernel type(%d) in host cpu excutor.", static_cast(kernel_type)); GELOGE(INTERNAL_ERROR, diff --git a/ge/hybrid/node_executor/host_cpu/host_cpu_node_executor.h b/ge/hybrid/node_executor/host_cpu/host_cpu_node_executor.h index 87ec1b0c..759bf220 100644 --- a/ge/hybrid/node_executor/host_cpu/host_cpu_node_executor.h +++ b/ge/hybrid/node_executor/host_cpu/host_cpu_node_executor.h @@ -27,7 +27,7 @@ namespace hybrid { class HostAicpuNodeTask : public AicpuNodeTask { public: HostAicpuNodeTask(const NodeItem *node_item, const domi::TaskDef &task_def) - : AicpuNodeTask(node_item, task_def) {} + : AicpuNodeTask(node_item, task_def) {} ~HostAicpuNodeTask() override = default; Status ExecuteAsync(TaskContext &context, std::function done_callback) override; diff --git a/inc/framework/common/taskdown_common.h b/inc/framework/common/taskdown_common.h index 090e7e26..28f6f2b0 100644 --- a/inc/framework/common/taskdown_common.h +++ b/inc/framework/common/taskdown_common.h @@ -46,6 +46,7 @@ typedef enum tagccKernelType { AI_CPU = 6, /* aicpu */ CUST_AI_CPU = 7, /* custom aicpu*/ INVALID = 8, /* unknown kernel type */ + HOST_CPU = 9 /* host cpu */ } ccKernelType; typedef struct tagOpContext { diff --git a/tests/ut/ge/hybrid/node_executor/host_cpu/host_cpu_node_task_unittest.cc b/tests/ut/ge/hybrid/node_executor/host_cpu/host_cpu_node_task_unittest.cc index f44c7aee..74fd7519 100644 --- a/tests/ut/ge/hybrid/node_executor/host_cpu/host_cpu_node_task_unittest.cc +++ b/tests/ut/ge/hybrid/node_executor/host_cpu/host_cpu_node_task_unittest.cc @@ -82,7 +82,7 @@ TEST_F(UtestHostCpuNodeTask, test_load) { host_task_def.set_type(RT_MODEL_TASK_KERNEL); ASSERT_EQ(node_executor.LoadTask(hybrid_model, node, task), INTERNAL_ERROR); domi::KernelContext *context = host_task_def.mutable_kernel()->mutable_context(); - context->set_kernel_type(6); // ccKernelType::AI_CPU + context->set_kernel_type(9); // ccKernelType::HOST_CPU ASSERT_EQ(node_executor.LoadTask(hybrid_model, node, task), INTERNAL_ERROR); HostCpuEngine::GetInstance().constant_folding_handle_ = (void *)0x01; ASSERT_EQ(node_executor.LoadTask(hybrid_model, node, task), INTERNAL_ERROR);