Browse Source

No session in tf_singleop_task and add cpu kernels cache.

pull/410/head
unknown 4 years ago
parent
commit
d51d227272
8 changed files with 20 additions and 20 deletions
  1. +2
    -2
      ge/single_op/task/aicpu_kernel_task_builder.cc
  2. +1
    -1
      ge/single_op/task/aicpu_kernel_task_builder.h
  3. +5
    -9
      ge/single_op/task/aicpu_task_builder.cc
  4. +1
    -1
      ge/single_op/task/aicpu_task_builder.h
  5. +8
    -4
      ge/single_op/task/op_task.cc
  6. +1
    -1
      ge/single_op/task/op_task.h
  7. +1
    -1
      metadef
  8. +1
    -1
      parser

+ 2
- 2
ge/single_op/task/aicpu_kernel_task_builder.cc View File

@@ -46,7 +46,7 @@ Status AiCpuCCTaskBuilder::SetKernelArgs(AiCpuCCTask &task) {
return SUCCESS;
}

Status AiCpuCCTaskBuilder::BuildTask(AiCpuCCTask &task) {
Status AiCpuCCTaskBuilder::BuildTask(AiCpuCCTask &task, uint64_t kernel_id) {
auto ret = SetKernelArgs(task);
if (ret != SUCCESS) {
return ret;
@@ -76,7 +76,7 @@ Status AiCpuCCTaskBuilder::BuildTask(AiCpuCCTask &task) {
"task def kernel_ext_info.size=%zu, but kernel_ext_info_size=%u.",
kernel_ext_info.size(), kernel_ext_info_size);

ret = task.SetExtInfoAndType(kernel_ext_info);
ret = task.SetExtInfoAndType(kernel_ext_info, kernel_id);
if (ret != SUCCESS) {
GELOGE(ret, "Init ext info failed.");
return ret;


+ 1
- 1
ge/single_op/task/aicpu_kernel_task_builder.h View File

@@ -30,7 +30,7 @@ class AiCpuCCTaskBuilder {
explicit AiCpuCCTaskBuilder(const OpDescPtr &op_desc, const domi::KernelDef &kernel_def);
~AiCpuCCTaskBuilder() = default;

Status BuildTask(AiCpuCCTask &task);
Status BuildTask(AiCpuCCTask &task, uint64_t kernel_id);

private:
Status SetKernelArgs(AiCpuCCTask &task);


+ 5
- 9
ge/single_op/task/aicpu_task_builder.cc View File

@@ -111,7 +111,7 @@ namespace ge {
}

Status AiCpuTaskBuilder::BuildTask(ge::AiCpuTask &task, const SingleOpModelParam &param,
bool dynamic_flag, uint64_t session_id) {
bool dynamic_flag, uint64_t kernel_id) {
GE_CHK_STATUS_RET_NOLOG(InitWorkspaceAndIO(&task.io_addr_, &task.workspace_addr_, param, dynamic_flag));

STR_FWK_OP_KERNEL fwk_op_kernel = {0};
@@ -130,7 +130,7 @@ namespace ge {
GE_CHK_BOOL_RET_STATUS(kernel_ext_info.size() == kernel_ext_info_size, FAILED,
"task def kernel_ext_info.size=%zu, but kernel_ext_info_size=%u.",
kernel_ext_info.size(), kernel_ext_info_size);
GE_CHK_STATUS_RET(task.SetExtInfoAndType(kernel_ext_info), "Init ext info failed.");
GE_CHK_STATUS_RET(task.SetExtInfoAndType(kernel_ext_info, kernel_id), "Init ext info failed.");

if (task.ext_info_addr_dev_ != nullptr) {
fwk_op_kernel.fwkKernelBase.fwk_kernel.extInfoAddr = reinterpret_cast<uintptr_t>(task.ext_info_addr_dev_);
@@ -138,13 +138,9 @@ namespace ge {
}
GE_CHK_STATUS_RET(task.InitForSummaryAndCopy(), "AiCpuTask init for summary and copy task failed.");

// Create session
fwk_op_kernel.fwkKernelBase.fwk_kernel.sessionID = session_id;
GELOGI("Begin to CreateAicpuSession, session id: %lu", session_id);
GE_CHECK_NOTNULL(ModelManager::GetInstance());
GE_IF_BOOL_EXEC(ModelManager::GetInstance()->CreateAicpuSession(session_id) != SUCCESS,
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "CreateAicpuSession error. session id: %lu", session_id);
return ACL_ERROR_GE_INTERNAL_ERROR;)
fwk_op_kernel.fwkKernelBase.fwk_kernel.sessionID = ULLONG_MAX;
fwk_op_kernel.fwkKernelBase.fwk_kernel.kernelID = kernel_id;
fwk_op_kernel.fwkKernelBase.fwk_kernel.opType = aicpu::FWKAdapter::FWKOperateType::FWK_ADPT_KERNEL_RUN_NO_SESS;
ret = SetKernelArgs(&task.args_, fwk_op_kernel);
if (ret != SUCCESS) {
return ret;


+ 1
- 1
ge/single_op/task/aicpu_task_builder.h View File

@@ -29,7 +29,7 @@ namespace ge {
AiCpuTaskBuilder(const OpDescPtr &op_desc, const domi::KernelExDef &kernel_def);
~AiCpuTaskBuilder() = default;

Status BuildTask(AiCpuTask &task, const SingleOpModelParam &param, bool dynamic_flag, uint64_t session_id);
Status BuildTask(AiCpuTask &task, const SingleOpModelParam &param, bool dynamic_flag, uint64_t kernel_id);

private:
static Status SetKernelArgs(void **args, STR_FWK_OP_KERNEL &kernel);


+ 8
- 4
ge/single_op/task/op_task.cc View File

@@ -245,7 +245,7 @@ AiCpuBaseTask::~AiCpuBaseTask() {
}
}

Status AiCpuBaseTask::SetExtInfoAndType(const std::string &kernel_ext_info) {
Status AiCpuBaseTask::SetExtInfoAndType(const std::string &kernel_ext_info, uint64_t kernel_id) {
if (kernel_ext_info.empty()) {
GELOGI("Kernel_ext_info is empty, no need copy to device.");
return SUCCESS;
@@ -268,9 +268,13 @@ Status AiCpuBaseTask::SetExtInfoAndType(const std::string &kernel_ext_info) {
return ret;
}

GE_CHK_RT_RET(rtMalloc(&ext_info_addr_dev_, kernel_ext_info.size(), RT_MEMORY_HBM));
GE_CHK_RT_RET(rtMemcpy(ext_info_addr_dev_, kernel_ext_info.size(),
kernel_ext_info.data(), kernel_ext_info.size(), RT_MEMCPY_HOST_TO_DEVICE));
GE_CHK_STATUS_RET(aicpu_ext_handle_->UpdateSessionInfo(ULLONG_MAX, kernel_id, false),
"UpdateSessionInfo failed.");

GE_CHK_RT_RET(rtMalloc(&ext_info_addr_dev_, aicpu_ext_handle_->GetExtInfoLen(), RT_MEMORY_HBM));
GE_CHK_RT_RET(rtMemcpy(ext_info_addr_dev_, aicpu_ext_handle_->GetExtInfoLen(),
aicpu_ext_handle_->GetExtInfo(), aicpu_ext_handle_->GetExtInfoLen(),
RT_MEMCPY_HOST_TO_DEVICE));
return SUCCESS;
}



+ 1
- 1
ge/single_op/task/op_task.h View File

@@ -132,7 +132,7 @@ class AiCpuBaseTask : public OpTask {
const UnknowShapeOpType GetUnknownType() const { return unknown_type_; }

protected:
Status SetExtInfoAndType(const std::string &kernel_ext_info);
Status SetExtInfoAndType(const std::string &kernel_ext_info, uint64_t kernel_id);

Status UpdateExtInfo(const std::vector<GeTensorDesc> &input_desc,
std::vector<GeTensorDesc> &output_desc,


+ 1
- 1
metadef

@@ -1 +1 @@
Subproject commit a464149d95257e7514859b198444fb341dc40786
Subproject commit fb871b4e00e64154130b3e5f612c4bdc2ad12d40

+ 1
- 1
parser

@@ -1 +1 @@
Subproject commit c4f6e1e03ac58a5c24e9bd3a04634f7e7b3213c3
Subproject commit 3d49906d119b1cc01f4256d7992759ce9f3dcfcd

Loading…
Cancel
Save