@@ -47,6 +47,7 @@ const char *const kEngineNameDefault = "default"; | |||||
const char *const kVectorEngine = "VectorEngine"; | const char *const kVectorEngine = "VectorEngine"; | ||||
const char *const kAIcoreEngine = "AIcoreEngine"; | const char *const kAIcoreEngine = "AIcoreEngine"; | ||||
const char *const kFileNameSuffix = "online"; | const char *const kFileNameSuffix = "online"; | ||||
const char *const kAicpuAllshape = "_AllShape"; | |||||
const size_t kDynamicDimSize = 1; | const size_t kDynamicDimSize = 1; | ||||
const int64_t kDynamicDimValue = -2; | const int64_t kDynamicDimValue = -2; | ||||
@@ -722,10 +723,10 @@ Status GeGenerator::BuildSingleOp(OpDescPtr &op_desc, const vector<GeTensor> &in | |||||
GELOGD("The opType in op_desc_tmp is [%s]", op_desc_tmp->GetType().c_str()); | GELOGD("The opType in op_desc_tmp is [%s]", op_desc_tmp->GetType().c_str()); | ||||
bool all_shape = false; | bool all_shape = false; | ||||
(void)AttrUtils::GetBool(op_desc, "_AllShape", all_shape); | |||||
bool dynamic_flag = false; | bool dynamic_flag = false; | ||||
(void)AttrUtils::GetBool(op_desc, kAicpuAllshape, all_shape); | |||||
CheckShapeReset(op_desc, dynamic_flag); | CheckShapeReset(op_desc, dynamic_flag); | ||||
if (all_shape && dynamic_flag) { | |||||
if (dynamic_flag && all_shape) { | |||||
GELOGD("Get aicpu all_shape kernel!"); | GELOGD("Get aicpu all_shape kernel!"); | ||||
vector<GeTensor> inputs_dynamic; | vector<GeTensor> inputs_dynamic; | ||||
vector<GeTensor> outputs_dynamic; | vector<GeTensor> outputs_dynamic; | ||||
@@ -45,7 +45,7 @@ Status KernelExTaskInfo::InitTaskExtInfo(const std::string &ext_info, const OpDe | |||||
num_outputs, | num_outputs, | ||||
unknown_type)); | unknown_type)); | ||||
GE_CHK_BOOL_RET_STATUS(ext_handle != nullptr, FAILED, "Malloc aicpu_ext_handle mem failed!"); | GE_CHK_BOOL_RET_STATUS(ext_handle != nullptr, FAILED, "Malloc aicpu_ext_handle mem failed!"); | ||||
GE_CHK_STATUS_RET(ext_handle->Parse(ext_info) | |||||
GE_CHK_STATUS_RET(ext_handle->Parse(ext_info), | |||||
"Parse kernel ext info failed, kernel_ext_info_size=%zu.", ext_info.size()); | "Parse kernel ext info failed, kernel_ext_info_size=%zu.", ext_info.size()); | ||||
GE_CHK_STATUS_RET(ext_handle->UpdateExecuteMode(true), "UpdateExecuteMode failed."); | GE_CHK_STATUS_RET(ext_handle->UpdateExecuteMode(true), "UpdateExecuteMode failed."); | ||||
GELOGD("Update aicpu_task ext_info bit_map execute mode to 1."); | GELOGD("Update aicpu_task ext_info bit_map execute mode to 1."); | ||||
@@ -54,7 +54,7 @@ Status KernelExTaskInfo::InitTaskExtInfo(const std::string &ext_info, const OpDe | |||||
GE_IF_BOOL_EXEC(rt_ret != RT_ERROR_NONE, | GE_IF_BOOL_EXEC(rt_ret != RT_ERROR_NONE, | ||||
GELOGE(RT_FAILED, "rtMalloc ext_info error: 0x%X, size=%zu", rt_ret, ext_info.size()); | GELOGE(RT_FAILED, "rtMalloc ext_info error: 0x%X, size=%zu", rt_ret, ext_info.size()); | ||||
return RT_ERROR_TO_GE_STATUS(rt_ret);) | return RT_ERROR_TO_GE_STATUS(rt_ret);) | ||||
rt_ret = rtMemcpy(ext_info_addr_, ext_handle_->GetExtInfoLen(), ext_handle_->GetExtInfo(), | |||||
rt_ret = rtMemcpy(ext_info_addr_, ext_handle->GetExtInfoLen(), ext_handle->GetExtInfo(), | |||||
ext_handle->GetExtInfoLen(), RT_MEMCPY_HOST_TO_DEVICE); | ext_handle->GetExtInfoLen(), RT_MEMCPY_HOST_TO_DEVICE); | ||||
GE_IF_BOOL_EXEC(rt_ret != RT_ERROR_NONE, | GE_IF_BOOL_EXEC(rt_ret != RT_ERROR_NONE, | ||||
GELOGE(RT_FAILED, "rtMemcpy ext_info error: 0x%X, size=%zu", rt_ret, ext_info.size()); | GELOGE(RT_FAILED, "rtMemcpy ext_info error: 0x%X, size=%zu", rt_ret, ext_info.size()); | ||||
@@ -32,6 +32,8 @@ | |||||
#include "super_kernel/super_kernel.h" | #include "super_kernel/super_kernel.h" | ||||
#include "super_kernel/super_kernel_factory.h" | #include "super_kernel/super_kernel_factory.h" | ||||
#include "cce/aicpu_engine_struct.h" | #include "cce/aicpu_engine_struct.h" | ||||
#include "hybrid/node_executor/aicpu/aicpu_ext_info.h" | |||||
#include "framework/common/debug/log.h" | |||||
namespace { | namespace { | ||||
const uint8_t kL2LoadToDdr = 1; | const uint8_t kL2LoadToDdr = 1; | ||||
@@ -965,20 +967,20 @@ Status KernelTaskInfo::InitAicpuTaskExtInfo(const std::string &ext_info) { | |||||
} | } | ||||
int32_t unknown_shape_type_val = 0; | int32_t unknown_shape_type_val = 0; | ||||
(void) AttrUtils::GetInt(op_desc, ::ge::ATTR_NAME_UNKNOWN_SHAPE_TYPE, unknown_shape_type_val); | |||||
(void) AttrUtils::GetInt(op_desc_, ::ge::ATTR_NAME_UNKNOWN_SHAPE_TYPE, unknown_shape_type_val); | |||||
UnknowShapeOpType unknown_type = static_cast<UnknowShapeOpType>(unknown_shape_type_val); | UnknowShapeOpType unknown_type = static_cast<UnknowShapeOpType>(unknown_shape_type_val); | ||||
uint32_t num_inputs = op_desc->GetInputsSize(); | |||||
uint32_t num_outputs = op_desc->GetOutputsSize(); | |||||
uint32_t num_inputs = op_desc_->GetInputsSize(); | |||||
uint32_t num_outputs = op_desc_->GetOutputsSize(); | |||||
std::unique_ptr<ge::hybrid::AicpuExtInfoHandler> ext_handle( | std::unique_ptr<ge::hybrid::AicpuExtInfoHandler> ext_handle( | ||||
new(std::nothrow) ::ge::hybrid::AicpuExtInfoHandler(op_desc->GetName(), | |||||
new(std::nothrow) ::ge::hybrid::AicpuExtInfoHandler(op_desc_->GetName(), | |||||
num_inputs, | num_inputs, | ||||
num_outputs, | num_outputs, | ||||
unknown_type)); | unknown_type)); | ||||
GE_CHK_BOOL_RET_STATUS(ext_handle != nullptr, FAILED, "Malloc aicpu_ext_handle mem failed!"); | GE_CHK_BOOL_RET_STATUS(ext_handle != nullptr, FAILED, "Malloc aicpu_ext_handle mem failed!"); | ||||
GE_CHK_STATUS_RET(ext_handle->Parse(ext_info) | |||||
GE_CHK_STATUS_RET(ext_handle->Parse(ext_info), | |||||
"Parse kernel ext info failed, kernel_ext_info_size=%zu.", ext_info.size()); | "Parse kernel ext info failed, kernel_ext_info_size=%zu.", ext_info.size()); | ||||
GE_CHK_STATUS_RET(aicpu_ext_handle_->UpdateSessionInfo(davinci_model_->GetSessionId()), | |||||
"Update session info session id sfailed."); | |||||
GE_CHK_STATUS_RET(ext_handle_->UpdateSessionInfo(davinci_model_->GetSessionId()), | |||||
"Update session info session id failed."); | |||||
GELOGD("Update aicpu_task ext_info session_info session_id is %lu", davinci_model_->GetSessionId()); | GELOGD("Update aicpu_task ext_info session_info session_id is %lu", davinci_model_->GetSessionId()); | ||||
GE_CHK_STATUS_RET(ext_handle->UpdateExecuteMode(true), "UpdateExecuteMode failed."); | GE_CHK_STATUS_RET(ext_handle->UpdateExecuteMode(true), "UpdateExecuteMode failed."); | ||||
GELOGD("Update aicpu_task ext_info bit_map execute mode to 1."); | GELOGD("Update aicpu_task ext_info bit_map execute mode to 1."); | ||||
@@ -988,7 +990,7 @@ Status KernelTaskInfo::InitAicpuTaskExtInfo(const std::string &ext_info) { | |||||
GELOGE(RT_FAILED, "rtMalloc ext_info error: 0x%X, size=%zu", rt_ret, ext_info.size()); | GELOGE(RT_FAILED, "rtMalloc ext_info error: 0x%X, size=%zu", rt_ret, ext_info.size()); | ||||
return RT_ERROR_TO_GE_STATUS(rt_ret); | return RT_ERROR_TO_GE_STATUS(rt_ret); | ||||
} | } | ||||
rt_ret = rtMemcpy(aicpu_ext_info_addr_, ext_handle->GetExtInfoLen(), ext_handle_->GetExtInfo(), | |||||
rt_ret = rtMemcpy(aicpu_ext_info_addr_, ext_handle->GetExtInfoLen(), ext_handle->GetExtInfo(), | |||||
ext_handle->GetExtInfoLen(), RT_MEMCPY_HOST_TO_DEVICE); | ext_handle->GetExtInfoLen(), RT_MEMCPY_HOST_TO_DEVICE); | ||||
if (rt_ret != RT_ERROR_NONE) { | if (rt_ret != RT_ERROR_NONE) { | ||||
GELOGE(RT_FAILED, "rtMemcpy ext_info error: 0x%X, size=%zu", rt_ret, ext_info.size()); | GELOGE(RT_FAILED, "rtMemcpy ext_info error: 0x%X, size=%zu", rt_ret, ext_info.size()); | ||||
@@ -60,7 +60,6 @@ Status AicpuNodeTaskBase::InitExtInfo(const std::string &kernel_ext_info, int64_ | |||||
GELOGD("To update aicpu_task ext_info session_info session_id to %lu", session_id); | GELOGD("To update aicpu_task ext_info session_info session_id to %lu", session_id); | ||||
GE_CHK_STATUS_RET(aicpu_ext_handle_.UpdateSessionInfoSessionId(session_id), | GE_CHK_STATUS_RET(aicpu_ext_handle_.UpdateSessionInfoSessionId(session_id), | ||||
"UpdateSessionInfoSessionId failed."); | "UpdateSessionInfoSessionId failed."); | ||||
GE_CHK_STATUS_RET(aicpu_ext_handle_.UpdateExecuteMode(true), "UpdateExecuteMode failed."); | |||||
// copy task args buf | // copy task args buf | ||||
GE_CHK_STATUS_RET(AllocTensorBuffer(aicpu_ext_handle_.GetExtInfoLen(), ext_info_addr_dev_), | GE_CHK_STATUS_RET(AllocTensorBuffer(aicpu_ext_handle_.GetExtInfoLen(), ext_info_addr_dev_), | ||||
@@ -137,7 +136,7 @@ Status AicpuNodeTaskBase::UpdateExtInfo() { | |||||
return SUCCESS; | return SUCCESS; | ||||
} | } | ||||
GE_CHK_STATUS_RET(ext_handle->UpdateExecuteMode(false), "UpdateExecuteMode failed."); | |||||
GE_CHK_STATUS_RET(aicpu_ext_handle_.UpdateExecuteMode(false), "UpdateExecuteMode failed."); | |||||
for (auto i = 0; i < node_item_->num_inputs; ++i) { | for (auto i = 0; i < node_item_->num_inputs; ++i) { | ||||
auto input_desc = node_item_->MutableInputDesc(i); | auto input_desc = node_item_->MutableInputDesc(i); | ||||
GE_CHECK_NOTNULL(input_desc); | GE_CHECK_NOTNULL(input_desc); | ||||
@@ -373,7 +373,7 @@ Status AiCpuBaseTask::SetExtInfoAndType(const std::string &kernel_ext_info, uint | |||||
GE_CHK_STATUS_RET(aicpu_ext_handle_->UpdateSessionInfo(ULLONG_MAX, kernel_id, false), | GE_CHK_STATUS_RET(aicpu_ext_handle_->UpdateSessionInfo(ULLONG_MAX, kernel_id, false), | ||||
"UpdateSessionInfo failed."); | "UpdateSessionInfo failed."); | ||||
GE_CHK_STATUS_RET(ext_handle->UpdateExecuteMode(true, "UpdateExecuteMode failed."); | |||||
GE_CHK_STATUS_RET(aicpu_ext_handle_->UpdateExecuteMode(true, "UpdateExecuteMode failed."); | |||||
GE_CHK_RT_RET(rtMalloc(&ext_info_addr_dev_, aicpu_ext_handle_->GetExtInfoLen(), RT_MEMORY_HBM)); | 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(), | GE_CHK_RT_RET(rtMemcpy(ext_info_addr_dev_, aicpu_ext_handle_->GetExtInfoLen(), | ||||
@@ -406,7 +406,7 @@ Status AiCpuBaseTask::UpdateExtInfo(const std::vector<GeTensorDesc> &input_desc, | |||||
rtStream_t stream) { | rtStream_t stream) { | ||||
GELOGI("Update ext info begin, unknown_type=%d.", unknown_type_); | GELOGI("Update ext info begin, unknown_type=%d.", unknown_type_); | ||||
GE_CHECK_NOTNULL(aicpu_ext_handle_); | GE_CHECK_NOTNULL(aicpu_ext_handle_); | ||||
GE_CHK_STATUS_RET(ext_handle->UpdateExecuteMode(false), "UpdateExecuteMode failed."); | |||||
GE_CHK_STATUS_RET(aicpu_ext_handle_->UpdateExecuteMode(false), "UpdateExecuteMode failed."); | |||||
if (num_inputs_ == 0 && num_outputs_ == 0) { | if (num_inputs_ == 0 && num_outputs_ == 0) { | ||||
GELOGI("No input and output, no need update ext info."); | GELOGI("No input and output, no need update ext info."); | ||||