From 476ded9c2bf201270388325bfe303e13640beeb6 Mon Sep 17 00:00:00 2001 From: lianghao Date: Tue, 3 Nov 2020 16:33:37 +0800 Subject: [PATCH] zero copy bug fix --- ge/graph/build/model_builder.cc | 12 ++++-------- .../new_model_manager/task_info/kernel_task_info.cc | 8 ++++---- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/ge/graph/build/model_builder.cc b/ge/graph/build/model_builder.cc index a78bbdcc..593be7bb 100755 --- a/ge/graph/build/model_builder.cc +++ b/ge/graph/build/model_builder.cc @@ -706,14 +706,10 @@ Status ModelBuilder::BuildModelForGetTask(ge::Model &model) { GELOGE(RT_FAILED, "rtGetRtCapability failed."); return RT_FAILED; } else { - if (value == RT_CAPABILITY_SUPPORT) { - GE_TIMESTAMP_START(AddMemcpyAddrAsyncNode); - MemcpyAddrAsyncPass memcpy_addr; - GE_CHK_STATUS_RET(memcpy_addr.Run(compute_graph_), "Add memcpy_addr_async node failed."); - GE_TIMESTAMP_END(AddMemcpyAddrAsyncNode, "MemcpyAddrAsyncPass::Run."); - } else { - GELOGW("rtGetRtCapability not support memcpy_addr_async."); - } + GE_TIMESTAMP_START(AddMemcpyAddrAsyncNode); + MemcpyAddrAsyncPass memcpy_addr; + GE_CHK_STATUS_RET(memcpy_addr.Run(compute_graph_), "Add memcpy_addr_async node failed."); + GE_TIMESTAMP_END(AddMemcpyAddrAsyncNode, "MemcpyAddrAsyncPass::Run."); } GE_TIMESTAMP_START(AssignMemory); diff --git a/ge/graph/load/new_model_manager/task_info/kernel_task_info.cc b/ge/graph/load/new_model_manager/task_info/kernel_task_info.cc index 9154edf9..b6b218cf 100755 --- a/ge/graph/load/new_model_manager/task_info/kernel_task_info.cc +++ b/ge/graph/load/new_model_manager/task_info/kernel_task_info.cc @@ -559,10 +559,7 @@ Status KernelTaskInfo::InitTVMTask(uint16_t offset, const domi::KernelDef &kerne GE_CHECK_NOTNULL(davinci_model_); // get tvm op desc OpDescPtr op_desc = davinci_model_->GetOpByIndex(ctx_.opIndex); - if (op_desc == nullptr) { - GELOGE(INTERNAL_ERROR, "InitTVMTaskInfo error, index:%u out of range!", ctx_.opIndex); - return INTERNAL_ERROR; - } + GE_CHECK_NOTNULL(op_desc); if (davinci_model_->IsKnownNode()) { return SUCCESS; } @@ -650,6 +647,9 @@ Status KernelTaskInfo::InitTVMTask(uint16_t offset, const domi::KernelDef &kerne vector virtual_io_addrs; // use virtual address for zero copy key. virtual_io_addrs.insert(virtual_io_addrs.end(), input_data_addrs.begin(), input_data_addrs.end()); virtual_io_addrs.insert(virtual_io_addrs.end(), output_data_addrs.begin(), output_data_addrs.end()); + if (op_desc->GetType() == ATOMICADDRCLEAN) { + virtual_io_addrs.insert(virtual_io_addrs.end(), workspace_data_addrs.begin(), workspace_data_addrs.end()); + } davinci_model_->SetZeroCopyAddr(op_desc, virtual_io_addrs, args_info.data(), args_, args_size_, offset); GELOGD("Do InitTVMTask end");