Browse Source

check kernel_type.

tags/v1.3.0
zhaozhixuan 3 years ago
parent
commit
897fcfe7e5
4 changed files with 5 additions and 4 deletions
  1. +2
    -2
      ge/hybrid/node_executor/host_cpu/host_cpu_node_executor.cc
  2. +1
    -1
      ge/hybrid/node_executor/host_cpu/host_cpu_node_executor.h
  3. +1
    -0
      inc/framework/common/taskdown_common.h
  4. +1
    -1
      tests/ut/ge/hybrid/node_executor/host_cpu/host_cpu_node_task_unittest.cc

+ 2
- 2
ge/hybrid/node_executor/host_cpu/host_cpu_node_executor.cc View File

@@ -92,7 +92,7 @@ Status HostAicpuNodeTask::Execute(TaskContext &context) {
} else { } else {
REPORT_CALL_ERROR("E19999", "Run cpu kernel failed node:%s, cpu kernel is not initialized.", node_name_.c_str()); REPORT_CALL_ERROR("E19999", "Run cpu kernel failed node:%s, cpu kernel is not initialized.", node_name_.c_str());
GELOGE(INTERNAL_ERROR, 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; return INTERNAL_ERROR;
} }


@@ -127,7 +127,7 @@ Status HostCpuNodeExecutor::ValidateTaskDef(const domi::TaskDef &task_def) {
return INTERNAL_ERROR; return INTERNAL_ERROR;
} }
auto kernel_type = static_cast<ccKernelType>(task_def.kernel().context().kernel_type()); auto kernel_type = static_cast<ccKernelType>(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.", REPORT_INNER_ERROR("E19999", "Invalid kernel type(%d) in host cpu excutor.",
static_cast<int>(kernel_type)); static_cast<int>(kernel_type));
GELOGE(INTERNAL_ERROR, GELOGE(INTERNAL_ERROR,


+ 1
- 1
ge/hybrid/node_executor/host_cpu/host_cpu_node_executor.h View File

@@ -27,7 +27,7 @@ namespace hybrid {
class HostAicpuNodeTask : public AicpuNodeTask { class HostAicpuNodeTask : public AicpuNodeTask {
public: public:
HostAicpuNodeTask(const NodeItem *node_item, const domi::TaskDef &task_def) HostAicpuNodeTask(const NodeItem *node_item, const domi::TaskDef &task_def)
: AicpuNodeTask(node_item, task_def) {}
: AicpuNodeTask(node_item, task_def) {}
~HostAicpuNodeTask() override = default; ~HostAicpuNodeTask() override = default;


Status ExecuteAsync(TaskContext &context, std::function<void()> done_callback) override; Status ExecuteAsync(TaskContext &context, std::function<void()> done_callback) override;


+ 1
- 0
inc/framework/common/taskdown_common.h View File

@@ -46,6 +46,7 @@ typedef enum tagccKernelType {
AI_CPU = 6, /* aicpu */ AI_CPU = 6, /* aicpu */
CUST_AI_CPU = 7, /* custom aicpu*/ CUST_AI_CPU = 7, /* custom aicpu*/
INVALID = 8, /* unknown kernel type */ INVALID = 8, /* unknown kernel type */
HOST_CPU = 9 /* host cpu */
} ccKernelType; } ccKernelType;


typedef struct tagOpContext { typedef struct tagOpContext {


+ 1
- 1
tests/ut/ge/hybrid/node_executor/host_cpu/host_cpu_node_task_unittest.cc View File

@@ -82,7 +82,7 @@ TEST_F(UtestHostCpuNodeTask, test_load) {
host_task_def.set_type(RT_MODEL_TASK_KERNEL); host_task_def.set_type(RT_MODEL_TASK_KERNEL);
ASSERT_EQ(node_executor.LoadTask(hybrid_model, node, task), INTERNAL_ERROR); ASSERT_EQ(node_executor.LoadTask(hybrid_model, node, task), INTERNAL_ERROR);
domi::KernelContext *context = host_task_def.mutable_kernel()->mutable_context(); 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); ASSERT_EQ(node_executor.LoadTask(hybrid_model, node, task), INTERNAL_ERROR);
HostCpuEngine::GetInstance().constant_folding_handle_ = (void *)0x01; HostCpuEngine::GetInstance().constant_folding_handle_ = (void *)0x01;
ASSERT_EQ(node_executor.LoadTask(hybrid_model, node, task), INTERNAL_ERROR); ASSERT_EQ(node_executor.LoadTask(hybrid_model, node, task), INTERNAL_ERROR);


Loading…
Cancel
Save