!1401 add error msg

Merge pull request !1401 from 王笑天/master
pull/1401/MERGE
计晨 4 years ago committed by Gitee
commit 6f74983fae

@ -674,7 +674,8 @@ Status ModelBuilder::SaveDataToModel(ge::Model &model, ge::GeModel &ge_model) {
GE_IF_BOOL_EXEC(cust_aicpu_kernel == nullptr, continue);
if (aicpu_name_set.count(cust_aicpu_kernel->GetName()) > 0) {
REPORT_INNER_ERROR("E19999", "aicpu_kernel name %s can't be the same, judge for op:%s(%s), when %s",
cust_aicpu_kernel->GetName().c_str(), n->GetName().c_str(), n->GetType().c_str(), __FUNCTION__);
cust_aicpu_kernel->GetName().c_str(), n->GetName().c_str(), n->GetType().c_str(),
__FUNCTION__);
GELOGE(FAILED, "aicpu_kernel name %s can't be the same", cust_aicpu_kernel->GetName().c_str());
return FAILED;
}

@ -143,7 +143,7 @@ Status WhileOpLabelMaker::Run(uint32_t &label_index) {
if (GraphUtils::AddEdge(in_anchor->GetPeerOutAnchor(), switch_node->GetInDataAnchor(kCondOutputIndex)) != SUCCESS) {
REPORT_CALL_ERROR("E19999", "Add ctrl edge from %s to %s in graph:%s fail when %s",
in_anchor->GetPeerOutAnchor()->GetOwnerNode()->GetName().c_str(),
switch_node->GetName().c_str(), cond_graph ->GetName().c_str(), __FUNCTION__);
switch_node->GetName().c_str(), cond_graph->GetName().c_str(), __FUNCTION__);
GELOGE(FAILED, "Node: %s Add pred data input failed.", switch_node->GetName().c_str());
return FAILED;
}

@ -1486,7 +1486,8 @@ Status DavinciModel::InitLabelSet(const OpDescPtr &op_desc) {
rtLabel_t rt_label = nullptr;
rtError_t rt_error = rtLabelCreateExV2(&rt_label, rt_model_handle_, stream);
if (rt_error != RT_ERROR_NONE || rt_label == nullptr) {
REPORT_CALL_ERROR("E19999", "Call rtLabelCreateExV2 failed, ret: 0x%X when DavinciModel %s", rt_error, __FUNCTION__);
REPORT_CALL_ERROR("E19999", "Call rtLabelCreateExV2 failed, ret: 0x%X when DavinciModel %s",
rt_error, __FUNCTION__);
GELOGE(INTERNAL_ERROR, "InitLabelSet: %s create label failed, error=0x%x.", op_desc->GetName().c_str(), rt_error);
return INTERNAL_ERROR;
}

@ -159,7 +159,8 @@ Status ModelManager::KernelLaunchEx(aicpu::FWKAdapter::FWKOperateType op_type, u
}
rt_ret = rtStreamSynchronize(stream);
if (rt_ret != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtStreamSynchronize failed, ret: 0x%X when ModelManager %s", rt_ret, __FUNCTION__);
REPORT_CALL_ERROR("E19999", "Call rtStreamSynchronize failed, ret: 0x%X when ModelManager %s",
rt_ret, __FUNCTION__);
GELOGE(RT_FAILED, "rtStreamSynchronize failed. ret: 0x%X", rt_ret);
GE_IF_BOOL_EXEC(aicpu_kernel_addr != nullptr, GE_CHK_RT(rtFree(aicpu_kernel_addr)));
GE_CHK_RT(rtFree(devicebase));
@ -1325,7 +1326,8 @@ Status ModelManager::LoadCustAicpuSo(const OpDescPtr &op_desc, const string &so_
rtContext_t rt_cur_ctx = nullptr;
auto rt_error = rtCtxGetCurrent(&rt_cur_ctx);
if (rt_error != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtCtxGetCurrent failed, ret = 0x%X, when ModelManager %s", rt_error, __FUNCTION__);
REPORT_CALL_ERROR("E19999", "Call rtCtxGetCurrent failed, ret = 0x%X, when ModelManager %s",
rt_error, __FUNCTION__);
GELOGE(RT_FAILED, "get current context failed, runtime result is %d", static_cast<int>(rt_error));
return RT_FAILED;
}
@ -1361,7 +1363,8 @@ Status ModelManager::LaunchKernelCustAicpuSo(const string &kernel_name) {
rtContext_t rt_cur_ctx = nullptr;
auto rt_error = rtCtxGetCurrent(&rt_cur_ctx);
if (rt_error != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtCtxGetCurrent failed, ret = 0x%X, when ModelManager %s", rt_error, __FUNCTION__);
REPORT_CALL_ERROR("E19999", "Call rtCtxGetCurrent failed, ret = 0x%X, when ModelManager %s",
rt_error, __FUNCTION__);
GELOGE(RT_FAILED, "get current context failed, runtime result is %d", static_cast<int>(rt_error));
return RT_FAILED;
}

@ -803,8 +803,8 @@ Status GraphManager::SetRtContext(rtContext_t rt_context, rtCtxMode_t mode, uint
}
rt_ret = rtCtxSetCurrent(rt_context);
if (rt_ret != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtCtxSetCurrent failed, session_id:%lu, graph_id:%u, mode:%d, when GraphManager %s",
session_id, graph_id, mode, __FUNCTION__);
REPORT_CALL_ERROR("E19999", "Call rtCtxSetCurrent failed, session_id:%lu, graph_id:%u, mode:%d, "
"when GraphManager %s", session_id, graph_id, mode, __FUNCTION__);
GELOGE(FAILED, "Call rt api failed, ret: 0x%X", rt_ret);
return FAILED;
}

@ -84,6 +84,7 @@ Status SubGraphInfo::FreeInOutBuffer() {
rtError_t rt_ret;
rt_ret = rtFreeHost(*iter);
if (rt_ret != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtFreeHost fail when SubGraphInfo %s", __FUNCTION__);
GELOGE(rt_ret, "[GraphManager] subgraph free buffer failed, modelId = %u", model_id_info_.model_id);
buffer_addr_.erase(buffer_addr_.begin(), iter);
return GE_GRAPH_FREE_FAILED;
@ -119,6 +120,7 @@ Status GraphModelListener::OnComputeDone(uint32_t model_id, uint32_t task_id, ui
uint32_t GraphModelListener::GetResultCode() const {
if (!is_finished_) {
REPORT_CALL_ERROR("E19999", "Model not run finish, fail for %s", __FUNCTION__);
GELOGE(INTERNAL_ERROR, "[GraphManager] model not run finish.");
return INTERNAL_ERROR;
}

@ -49,6 +49,8 @@ uint8_t *MemoryAllocator::MallocMemory(const string &purpose, size_t memory_size
uint8_t *memory_addr = nullptr;
if (rtMalloc(reinterpret_cast<void **>(&memory_addr), memory_size, memory_type_) != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtMalloc fail, purpose:%s, size:%zu, device_id:%u, when MemoryAllocator %s",
purpose.c_str(), memory_size, device_id, __FUNCTION__);
GELOGE(ge::INTERNAL_ERROR,
"MemoryAllocator::MallocMemory device_id = %u,"
" size= %lu",
@ -66,6 +68,7 @@ Status MemoryAllocator::FreeMemory(uint8_t *memory_addr, uint32_t device_id) con
GELOGI("MemoryAllocator::FreeMemory device_id = %u", device_id);
auto rtRet = rtFree(memory_addr);
if (rtRet != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtFree fail, device_id:%u, when MemoryAllocator %s", device_id, __FUNCTION__);
GELOGE(rtRet, "MemoryAllocator::MallocMemory device_id = %u", device_id);
return RT_ERROR_TO_GE_STATUS(rtRet);
}
@ -84,6 +87,9 @@ uint8_t *MemoryAllocator::MallocMemory(const string &purpose, const string &memo
uint8_t *memory_addr = MallocMemory(purpose, memory_size, device_id);
if (memory_addr == nullptr) {
REPORT_CALL_ERROR("E19999", "Malloc Memory fail, purpose:%s, memory_key:%s, memory_size:%zu, device_id:%u, "
"when MemoryAllocator %s", purpose.c_str(), memory_key.c_str(),
memory_size, device_id, __FUNCTION__);
GELOGE(ge::INTERNAL_ERROR,
"MemoryAllocator::MallocMemory failed,"
" memory_key[%s], size = %lu.",
@ -120,6 +126,8 @@ Status MemoryAllocator::FreeMemory(const string &memory_key, uint32_t device_id)
}
if (FreeMemory(it->second.memory_addr_, device_id) != ge::SUCCESS) {
REPORT_CALL_ERROR("E19999", "Free Memory fail, memory_key:%s, device_id:%u, when MemoryAllocator %s",
memory_key.c_str(), device_id, __FUNCTION__);
GELOGE(ge::INTERNAL_ERROR,
"MemoryAllocator::FreeMemory rtFree failed,"
" memory_key[%s]",
@ -169,6 +177,7 @@ Status MemManager::Initialize(const std::vector<rtMemType_t> &memory_type) {
memory_allocator_map_[index] = memory_allocator;
GELOGI("Create MemoryAllocator memory type[%u] success.", index);
} else {
REPORT_CALL_ERROR("E19999", "New MemoryAllocator fail, index:%u, when MemoryAllocator %s", index, __FUNCTION__);
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "Alloc MemoryAllocator failed.");
}
} else {

@ -39,6 +39,8 @@ VarResource::~VarResource() {
ge::Status VarResource::GetVarAddr(const std::string &var_name, const ge::GeTensorDesc &tensor_desc, uint8_t **dev_ptr,
rtMemType_t &memory_type) {
if (dev_ptr == nullptr) {
REPORT_INNER_ERROR("E19999", "Param dev_ptr is nullptr, var_name:%s, session_id:%lu, "
"check invalid when VarResource %s", var_name.c_str(), session_id_, __FUNCTION__);
GELOGE(FAILED, "[GetVarAddr] dev_ptr is null!");
return FAILED;
}
@ -47,6 +49,9 @@ ge::Status VarResource::GetVarAddr(const std::string &var_name, const ge::GeTens
auto iter = var_addr_mgr_map_.find(var_key);
if (iter == var_addr_mgr_map_.end()) {
REPORT_INNER_ERROR("E19999", "var_key:%s can't find in var_addr_mgr_map_, var_name:%s, session_id:%lu, "
"check invalid when VarResource %s", var_key.c_str(), var_name.c_str(),
session_id_, __FUNCTION__);
GELOGE(FAILED, "VarResource::GetVarAddr failed, var_key %s", var_key.c_str());
return FAILED;
}
@ -102,6 +107,9 @@ ge::Status VarResource::SaveVarAddr(const std::string &var_name, const ge::GeTen
return SUCCESS;
}
REPORT_INNER_ERROR("E19999", "var_key:%s conflict in var_addr_mgr_map_, var_name:%s, session_id:%lu, "
"check invalid when VarResource %s", var_key.c_str(), var_name.c_str(),
session_id_, __FUNCTION__);
GELOGE(FAILED, "VarResource::SaveVarAddr, var_key %s save addr conflict", var_key.c_str());
return FAILED;
}
@ -136,6 +144,8 @@ ge::Status VarResource::RenewCurVarDesc(const std::string &var_name, const ge::O
}
if (op_desc == nullptr) {
REPORT_INNER_ERROR("E19999", "Param op_desc is nullptr, var_name:%s, session_id:%lu, check invalid "
"when VarResource %s", var_name.c_str(), session_id_, __FUNCTION__);
GELOGE(FAILED, "[RenewCurVarDesc] renew var desc fail! input opdesc is null!");
return FAILED;
}
@ -152,6 +162,9 @@ ge::Status VarResource::RenewCurVarDesc(const std::string &var_name, const ge::O
cur_var_tensor_desc_map_[var_name] = curr_desc;
auto iter = var_addr_mgr_map_.find(key);
if (iter == var_addr_mgr_map_.end()) {
REPORT_INNER_ERROR("E19999", "var_key:%s can't find in var_addr_mgr_map_, var_name:%s, session_id:%lu, op:%s(%s), "
"check invalid when VarResource %s", key.c_str(), var_name.c_str(),
session_id_, op_desc->GetName().c_str(), op_desc->GetType().c_str(), __FUNCTION__);
GELOGE(FAILED, "[RenewCurVarDesc] can't find ele with key [%s]", key.c_str());
return FAILED;
}
@ -271,11 +284,15 @@ Status HbmMemResource::AssignVarMem(const std::string &var_name, uint64_t size,
uint64_t real_size = size;
total_size_ = VarManager::Instance(session_id)->GetVarMemMaxSize();
if (total_size_ < var_mem_size_) {
REPORT_INNER_ERROR("E19999", "VarMemMaxSize:%lu < var_mem_size_:%lu, var_size:%lu, var_name:%s, check invalid"
" when HbmMemResource %s", total_size_, var_mem_size_, size, var_name.c_str(), __FUNCTION__);
GELOGE(PARAM_INVALID, "total_size_: %lu is smaller than var_mem_size_: %lu", total_size_, var_mem_size_);
return PARAM_INVALID;
}
uint64_t free_size = total_size_ - var_mem_size_;
if (free_size < (size + kSessionMemAlignSize * kSessionMemAlignUnit)) {
REPORT_INNER_ERROR("E19999", "free_size:%lu not enough, var_align_size:%lu, var_name:%s, check invalid "
"when HbmMemResource %s", free_size, size, var_name.c_str(), __FUNCTION__);
GELOGE(PARAM_INVALID, "Out of memory : current var size[%lu] exceeds total var size[%lu]",
size + kSessionMemAlignSize * kSessionMemAlignUnit + var_mem_size_, total_size_);
return PARAM_INVALID;
@ -299,6 +316,8 @@ Status HbmMemResource::AssignVarMem(const std::string &var_name, uint64_t size,
Status RdmaMemResource::AssignVarMem(const std::string &var_name, uint64_t size, uint64_t session_id, size_t &address) {
uint8_t *buffer = MemManager::Instance().RdmaPoolInstance(RT_MEMORY_HBM).Malloc(size);
if (buffer == nullptr) {
REPORT_CALL_ERROR("E19999", "malloc rdma memory fail, var_size:%lu, var_name:%s when RdmaMemResource %s",
size, var_name.c_str(), __FUNCTION__);
GELOGE(MEMALLOC_FAILED, "Failed to malloc rdma memory for node %s, size = %lu", var_name.c_str(), size);
return MEMALLOC_FAILED;
}
@ -448,6 +467,8 @@ int64_t VarManager::GetVarMemSize(rtMemType_t memory_type) {
}
if (mem_resource == nullptr) {
REPORT_INNER_ERROR("E19999", "Find no mem_resource in map, memory_type:%d, session_id:%lu when VarManager %s",
memory_type, session_id_, __FUNCTION__);
GELOGE(ge::INTERNAL_ERROR, "MemResource is invalid.");
return 0;
}
@ -461,6 +482,8 @@ Status VarManager::UpdateVarMemSize(rtMemType_t memory_type, int64_t mem_size) {
if (iter == mem_resource_map_.end()) {
mem_resource = MemResource::BuildMemResourceFromType(memory_type);
if (mem_resource == nullptr) {
REPORT_CALL_ERROR("E19999", "memory_type:%d invalid or New MemResource fail, session_id:%lu when VarManager %s",
memory_type, session_id_, __FUNCTION__);
GELOGE(ge::INTERNAL_ERROR, "Alloc MemResource failed, memory_type = %u.", memory_type);
return ge::INTERNAL_ERROR;
} else {
@ -471,6 +494,8 @@ Status VarManager::UpdateVarMemSize(rtMemType_t memory_type, int64_t mem_size) {
}
if (mem_resource == nullptr) {
REPORT_INNER_ERROR("E19999", "MemResource is invalid, memory_type:%d, session_id:%lu when VarManager %s",
memory_type, session_id_, __FUNCTION__);
GELOGE(ge::INTERNAL_ERROR, "MemResource is invalid.");
return FAILED;
}
@ -489,6 +514,8 @@ ge::Status VarManager::AssignVarMem(const std::string &var_name, const ge::GeTen
size_t mem_offset = 0;
ge::Status result = TensorUtils::GetSize(tensor_desc, tensor_desc_size);
if (result != ge::SUCCESS) {
REPORT_CALL_ERROR("E19999", "Get size from tensor fail, var_name:%s, memory_type:%d, session_id:%lu, "
"when VarManager %s", var_name.c_str(), memory_type, session_id_, __FUNCTION__);
GELOGE(result, "get size from TensorDesc failed");
return result;
}
@ -498,6 +525,8 @@ ge::Status VarManager::AssignVarMem(const std::string &var_name, const ge::GeTen
if (it == mem_resource_map_.end()) {
mem_resource = MemResource::BuildMemResourceFromType(memory_type);
if (mem_resource == nullptr) {
REPORT_CALL_ERROR("E19999", "memory_type:%d invalid or New MemResource fail, session_id:%lu when VarManager %s",
memory_type, session_id_, __FUNCTION__);
GELOGE(ge::INTERNAL_ERROR, "Alloc MemResource failed, memory_type = %u.", memory_type);
return ge::INTERNAL_ERROR;
} else {
@ -508,6 +537,8 @@ ge::Status VarManager::AssignVarMem(const std::string &var_name, const ge::GeTen
}
if (mem_resource == nullptr) {
REPORT_INNER_ERROR("E19999", "MemResource is invalid, memory_type:%d, session_id:%lu when VarManager %s",
memory_type, session_id_, __FUNCTION__);
GELOGE(ge::INTERNAL_ERROR, "MemResource is invalid, memory_type = %u.", memory_type);
return ge::INTERNAL_ERROR;
}
@ -517,6 +548,8 @@ ge::Status VarManager::AssignVarMem(const std::string &var_name, const ge::GeTen
return ge::INTERNAL_ERROR;
}
if (var_resource_ == nullptr) {
REPORT_INNER_ERROR("E19999", "VarManager has not been init, memory_type:%d, session_id:%lu, "
"check invalid when VarManager %s", memory_type, session_id_, __FUNCTION__);
GELOGW("VarManager has not been init.");
return ge::INTERNAL_ERROR;
}
@ -635,6 +668,9 @@ ge::Status VarManager::RenewCurVarDesc(const std::string &var_name, ge::OpDescPt
GELOGD("VarManager::RenewCurVarDesc var_name = %s.", var_name.c_str());
if (var_resource_ == nullptr) {
REPORT_INNER_ERROR("E19999", "VarManager has not been init, op:%s(%s), session_id:%lu, check invalid "
"when VarManager %s", op_desc->GetName().c_str(), op_desc->GetType().c_str(),
session_id_, __FUNCTION__);
GELOGE(ge::INTERNAL_ERROR, "VarManager has not been init.");
return ge::INTERNAL_ERROR;
}
@ -786,6 +822,8 @@ Status VarManager::SetMemoryMallocSize(const map<string, string> &options) {
var_mem_logic_base_ = graph_mem_max_size_ + kGraphMemoryBuffer;
if (var_mem_logic_base_ > kMaxMemorySize) {
REPORT_INNER_ERROR("E19999", "var_login_base:%zu can not exeed limit:%zu, session_id:%lu, check invalid "
"when VarManager %s", var_mem_logic_base_, kMaxMemorySize, session_id_, __FUNCTION__);
GELOGE(ge::GE_GRAPH_OPTIONS_INVALID, "kMemoryVarLogicBase : %zu can not exceed max memory size : %zu.",
var_mem_logic_base_, kMaxMemorySize);
return ge::GE_GRAPH_OPTIONS_INVALID;
@ -793,6 +831,8 @@ Status VarManager::SetMemoryMallocSize(const map<string, string> &options) {
use_max_mem_size_ = graph_mem_max_size_ + var_mem_max_size_;
if (use_max_mem_size_ > kMaxMemorySize) {
REPORT_INNER_ERROR("E19999", "all mem_use size:%zu can not exeed limit:%zu, session_id:%lu, check invalid "
"when VarManager %s", use_max_mem_size_, kMaxMemorySize, session_id_, __FUNCTION__);
GELOGE(ge::GE_GRAPH_OPTIONS_INVALID, "kUseMaxMemorySize : %zu can not exceed max memory size : %zu.",
use_max_mem_size_, kMaxMemorySize);
return ge::GE_GRAPH_OPTIONS_INVALID;
@ -803,6 +843,8 @@ Status VarManager::SetMemoryMallocSize(const map<string, string> &options) {
Status VarManager::ParseMemoryMallocSize(string &memory_size, size_t &result) {
if (memory_size.empty()) {
REPORT_INNER_ERROR("E19999", "Param memory_size is empty, session_id:%lu, check invalid when VarManager %s",
session_id_, __FUNCTION__);
GELOGE(GE_GRAPH_OPTIONS_INVALID, "Memory malloc size input is empty.");
return GE_GRAPH_OPTIONS_INVALID;
}
@ -828,15 +870,23 @@ Status VarManager::ParseMemoryMallocSize(string &memory_size, size_t &result) {
for (char c : split) {
if (!isdigit(c)) {
REPORT_INNER_ERROR("E19999", "Param memory_size:%s contains non digit, session_id:%lu, check invalid "
"when VarManager %s", memory_size.c_str(), session_id_, __FUNCTION__);
GELOGE(GE_GRAPH_OPTIONS_INVALID, "Memory malloc size input contains non digit.");
return GE_GRAPH_OPTIONS_INVALID;
}
}
uint64_t num = std::strtoul(split.c_str(), nullptr, 0);
GE_IF_BOOL_EXEC(TypeUtils::CheckUint64MulOverflow(result, static_cast<uint32_t>(num)),
REPORT_INNER_ERROR("E19999", "Param memory_size:%s will overflow after multi all, session_id:%lu, "
"check invalid when VarManager %s", memory_size.c_str(),
session_id_, __FUNCTION__);
GELOGE(FAILED, "Input memory size is out of range.");
return FAILED);
if ((num > kMaxMemorySize) || (result * static_cast<size_t>(num) > kMaxMemorySize)) {
REPORT_INNER_ERROR("E19999", "Param memory_size:%s after multi will exceed limit:%lu, session_id:%lu, "
"check invalid when VarManager %s", memory_size.c_str(), kMaxMemorySize,
session_id_, __FUNCTION__);
GELOGE(FAILED, "Input memory size can not exceed max memory size : %zu.", kMaxMemorySize);
return FAILED;
}
@ -940,6 +990,7 @@ VarManager *VarManagerPool::GetVarManager(uint64_t session_id) {
VarManager *var_manager = new (std::nothrow) VarManager(session_id);
if (var_manager == nullptr) {
REPORT_INNER_ERROR("E19999", "New VarManager fail, session_id:%lu, when VarManager %s", session_id, __FUNCTION__);
GELOGE(INTERNAL_ERROR,
"VarManager::Instance find session by "
"session_id[%lu] failed.",

@ -34,6 +34,7 @@ uint8_t *HostMemAllocator::Malloc(size_t size) {
std::lock_guard<std::mutex> lock(mutex_);
std::shared_ptr<AlignedPtr> aligned_ptr = MakeShared<AlignedPtr>(size);
if (aligned_ptr == nullptr) {
REPORT_INNER_ERROR("E19999", "New AlignedPtr fail, when HostMemAllocator %s", __FUNCTION__);
GELOGE(INTERNAL_ERROR, "make shared_ptr for AlignedPtr failed");
return nullptr;
}
@ -44,6 +45,7 @@ uint8_t *HostMemAllocator::Malloc(size_t size) {
Status HostMemAllocator::Free(const void *memory_addr) {
if (memory_addr == nullptr) {
REPORT_INNER_ERROR("E19999", "Param memory_addr is nullptr, check invalid when HostMemAllocator %s", __FUNCTION__);
GELOGE(GE_GRAPH_FREE_FAILED, "Invalid memory pointer");
return GE_GRAPH_FREE_FAILED;
}
@ -51,6 +53,8 @@ Status HostMemAllocator::Free(const void *memory_addr) {
std::lock_guard<std::mutex> lock(mutex_);
auto it = allocated_blocks_.find(memory_addr);
if (it == allocated_blocks_.end()) {
REPORT_INNER_ERROR("E19999", "Memory_addr is not alloc before, check invalid when HostMemAllocator %s",
__FUNCTION__);
GELOGE(PARAM_INVALID, "Invalid memory pointer");
return PARAM_INVALID;
}

@ -39,6 +39,8 @@ Status SharedMemAllocator::Allocate(SharedMemInfo &mem_info) {
rtMallocHostSharedMemoryOut output_para;
rtError_t rt_ret = rtMallocHostSharedMemory(&input_para, &output_para);
if (rt_ret != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtMallocHostSharedMemory fail, ret:0x%X, when SharedMemAllocator %s",
rt_ret, __FUNCTION__);
GELOGE(RT_FAILED, "Call rt api(rtMallocHostSharedMemory) failed, devid:[%u].", device_id);
return GE_GRAPH_MEMORY_ALLOC_FAILED;
}
@ -59,6 +61,8 @@ Status SharedMemAllocator::DeAllocate(SharedMemInfo &mem_info) {
mem_info.host_aligned_ptr->MutableGet(), mem_info.device_address};
rtError_t rt_ret = rtFreeHostSharedMemory(&free_para);
if (rt_ret != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtFreeHostSharedMemory fail, ret:0x%X, when SharedMemAllocator %s",
rt_ret, __FUNCTION__);
GELOGE(RT_FAILED, "Call rt api(rtFreeHostSharedMemory) failed, ret: 0x%X.", rt_ret);
return RT_FAILED;
}
@ -74,6 +78,7 @@ Status HostMemManager::Initialize() {
std::lock_guard<std::recursive_mutex> lock(mutex_);
allocator_ = std::unique_ptr<SharedMemAllocator>(new (std::nothrow) SharedMemAllocator());
if (allocator_ == nullptr) {
REPORT_CALL_ERROR("E19999", "New SharedMemAllocator fail when SharedMemAllocator %s", __FUNCTION__);
GELOGE(GE_GRAPH_MALLOC_FAILED, "Shared memory allocator init failed!");
return GE_GRAPH_MALLOC_FAILED;
}
@ -94,6 +99,8 @@ Status HostMemManager::MallocSharedMemory(SharedMemInfo &mem_info) {
std::lock_guard<std::recursive_mutex> lock(mutex_);
auto iter = var_memory_base_map_.find(mem_info.op_name);
if (iter != var_memory_base_map_.end()) {
REPORT_INNER_ERROR("E19999", "MemInfo.op_name:%s can't find in var_memory_base_map_ when HostMemManager %s",
mem_info.op_name.c_str(), __FUNCTION__);
GELOGE(FAILED, "Host shared memory for op %s has been malloced", mem_info.op_name.c_str());
return FAILED;
}
@ -107,6 +114,8 @@ Status HostMemManager::MallocSharedMemory(SharedMemInfo &mem_info) {
Status HostMemManager::QueryVarMemInfo(const string &op_name, uint64_t &base_addr, uint64_t &data_size) {
std::lock_guard<std::recursive_mutex> lock(mutex_);
if (var_memory_base_map_.find(op_name) == var_memory_base_map_.end()) {
REPORT_INNER_ERROR("E19999", "MemInfo.op_name:%s can't find in var_memory_base_map_ when HostMemManager %s",
op_name.c_str(), __FUNCTION__);
GELOGE(INTERNAL_ERROR, "Find host base base_addr failed,node name:%s!", op_name.c_str());
return INTERNAL_ERROR;
}

@ -50,6 +50,8 @@ Status RdmaRemoteRegister(const std::vector<HostVarInfo> &var_info, rtMemType_t
path.append(file_name);
string canonical_path = RealPath(path.c_str());
if (canonical_path.empty()) {
REPORT_INNER_ERROR("E19999", "canonical_path:%s is empty, check invalid when %s",
canonical_path.c_str(), __FUNCTION__);
GELOGE(FAILED, "Failed to get realpath of %s", path.c_str());
return FAILED;
}
@ -65,12 +67,16 @@ Status RdmaRemoteRegister(const std::vector<HostVarInfo> &var_info, rtMemType_t
auto hcom_remote_mem_register =
(HcclResult(*)(const MemRegisterAddr *, uint32_t))dlsym(handle, "HcomRegRemoteAccessMem");
if (hcom_remote_mem_register == nullptr) {
REPORT_CALL_ERROR("E19999", "Symbol HcomRegRemoteAccessMem can't find in %s, check invalid when %s",
canonical_path.c_str(), __FUNCTION__);
GELOGE(FAILED, "Failed to invoke hcom_remote_mem_register function.");
return FAILED;
}
HcclResult hccl_ret = hcom_remote_mem_register(reg_addrs.get(), table_len);
if (hccl_ret != HCCL_SUCCESS) {
REPORT_CALL_ERROR("E19999", "Call hcom_remote_mem_register failed, ret:%d, when %s",
hccl_ret, __FUNCTION__);
GELOGE(HCCL_E_INTERNAL, "Rdma mem register failed, ret: 0x%X", hccl_ret);
return HCCL_E_INTERNAL;
}

@ -81,6 +81,8 @@ Status RdmaPoolAllocator::InitMemory(size_t mem_size) {
auto device_id = GetContext().DeviceId();
GELOGD("Init Rdma Memory with size [%zu] for devid:[%u]", mem_size, device_id);
if (rdma_base_addr_ != nullptr) {
REPORT_INNER_ERROR("E19999", "Param rdma_base_addr_ is nullptr, check invalid when RdmaPoolAllocator %s",
__FUNCTION__);
GELOGE(GE_MULTI_INIT, "Rdma pool has been malloced");
return GE_MULTI_INIT;
}
@ -100,6 +102,7 @@ Status RdmaPoolAllocator::InitMemory(size_t mem_size) {
// Init with a base block.
auto *base_block = new (std::nothrow) Block(device_id, mem_size, rdma_base_addr_);
if (base_block == nullptr) {
REPORT_CALL_ERROR("E19999", "New Block failed, device_id:%u, when RdmaPoolAllocator %s", device_id, __FUNCTION__);
GELOGE(GE_GRAPH_MALLOC_FAILED, "Block malloc failed");
return GE_GRAPH_MALLOC_FAILED;
}
@ -118,6 +121,8 @@ uint8_t *RdmaPoolAllocator::Malloc(size_t size, uint32_t device_id) {
block_bin_.erase(it);
block->allocated = true;
if (block->ptr == nullptr) {
REPORT_INNER_ERROR("E19999", "Rdmapool memory address is nullptr, device_id:%u, check invalid when RdmaPoolAllocator %s",
device_id, __FUNCTION__);
GELOGE(INTERNAL_ERROR, "Rdmapool memory address is nullptr.");
return nullptr;
}
@ -150,6 +155,8 @@ uint8_t *RdmaPoolAllocator::Malloc(size_t size, uint32_t device_id) {
Status RdmaPoolAllocator::Free(uint8_t *memory_addr, uint32_t device_id) {
GELOGI("Free rdma memory, device id = %u", device_id);
if (memory_addr == nullptr) {
REPORT_INNER_ERROR("E19999", "Param memory_addr is nullptr, device_id:%u, check invalid when RdmaPoolAllocator %s",
device_id, __FUNCTION__);
GELOGE(GE_GRAPH_FREE_FAILED, "Invalid memory pointer");
return GE_GRAPH_FREE_FAILED;
}
@ -157,6 +164,8 @@ Status RdmaPoolAllocator::Free(uint8_t *memory_addr, uint32_t device_id) {
std::lock_guard<std::recursive_mutex> lock(mutex_);
auto it = allocated_blocks_.find(memory_addr);
if (it == allocated_blocks_.end()) {
REPORT_INNER_ERROR("E19999", "Param memory_addr is not allocated before, device_id:%u, "
"check invalid when RdmaPoolAllocator %s", device_id, __FUNCTION__);
GELOGE(PARAM_INVALID, "Invalid memory pointer");
return PARAM_INVALID;
}
@ -199,6 +208,8 @@ void RdmaPoolAllocator::MergeBlocks(Block *dst, Block *src) {
Status RdmaPoolAllocator::GetBaseAddr(uint64_t &base_addr, uint64_t &mem_size) {
if (rdma_base_addr_ == nullptr) {
REPORT_INNER_ERROR("E19999", "Param rdma_base_addr_ is nullptr, check invalid when RdmaPoolAllocator %s",
__FUNCTION__);
GELOGE(INTERNAL_ERROR, "Rdma base addr is nullptr.");
return INTERNAL_ERROR;
}

@ -35,18 +35,24 @@ class RtContextSwitchGuard {
RtContextSwitchGuard(rtCtxMode_t mode, uint32_t device_id) : last_(nullptr), current_(nullptr) {
auto ret = rtCtxGetCurrent(&last_);
if (ret != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtCtxGetCurrent failed, device_id:%u, ret:0x%X, when %s",
device_id, ret, __FUNCTION__);
GELOGE(RT_FAILED, "Failed to get current context from rt, error-code %d", ret);
return;
}
ret = rtCtxCreate(&current_, mode, static_cast<int32_t>(device_id));
if (ret != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtCtxCreate failed, device_id:%u, ret:0x%X, when %s",
device_id, ret, __FUNCTION__);
GELOGE(RT_FAILED, "Failed to create new context for device %u, error-code %d", device_id, ret);
return;
}
ret = rtCtxSetCurrent(current_);
if (ret != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtCtxSetCurrent failed, device_id:%u, ret:0x%X, when %s",
device_id, ret, __FUNCTION__);
GELOGE(RT_FAILED, "Failed to switch context to normal, context %p, device %u", current_, device_id);
return;
}
@ -72,6 +78,8 @@ class RtContextSwitchGuard {
int64_t CalcVarSizeInBytes(const GeTensorDesc &desc) {
int64_t var_size = GetSizeByDataType(desc.GetDataType());
if (var_size <= 0) {
REPORT_INNER_ERROR("E19999", "Data type:%s in desc, it's size:%ld < 0, check invalid when %s",
TypeUtils::DataTypeToSerialString(desc.GetDataType()).c_str(), var_size, __FUNCTION__);
GELOGE(PARAM_INVALID, "Failed to calc var data size from data type %s",
TypeUtils::DataTypeToSerialString(desc.GetDataType()).c_str());
return -1;
@ -89,6 +97,8 @@ Status CopyVarToDevice(const NodePtr &var, const formats::TransResult &trans_res
auto ret = rtMemcpy(var_addr, trans_result.length, reinterpret_cast<void *>(trans_result.data.get()),
trans_result.length, RT_MEMCPY_HOST_TO_DEVICE);
if (ret != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtMemcpy failed, op:%s(%s), size:%lu, ret:0x%X, when %s", var->GetName().c_str(),
var->GetType().c_str(), trans_result.length, ret, __FUNCTION__);
GELOGE(RT_FAILED, "Failed to copy memory to device, size %zu", trans_result.length);
return RT_FAILED;
}
@ -110,6 +120,8 @@ Status CopyVarFromDevice(uint64_t session_id, const NodePtr &var, std::unique_pt
uint8_t *var_addr = VarManager::Instance(session_id)->GetVarMemoryAddr(var_logic, RT_MEMORY_HBM);
if (var_addr == nullptr) {
REPORT_CALL_ERROR("E19999", "Get variable memory addr failed, mem_type:%d, op:%s(%s), session_id:%lu, when %s",
RT_MEMORY_HBM, var->GetName().c_str(), var->GetType().c_str(), session_id, __FUNCTION__);
GELOGE(INTERNAL_ERROR,
"Failed to copy var %s from device, cant not get "
"var addr from logic addr %p",
@ -124,6 +136,8 @@ Status CopyVarFromDevice(uint64_t session_id, const NodePtr &var, std::unique_pt
std::unique_ptr<uint8_t[]> var_host(new(std::nothrow) uint8_t[var_size_bytes]);
if (var_host == nullptr) {
REPORT_CALL_ERROR("E19999", "New host memory failed, size:%ld, op:%s(%s), session_id:%lu, when %s",
var_size_bytes, var->GetName().c_str(), var->GetType().c_str(), session_id, __FUNCTION__);
GELOGE(OUT_OF_MEMORY, "Failed to malloc rt-host memory, size %ld", var_size_bytes);
return OUT_OF_MEMORY;
}
@ -131,6 +145,8 @@ Status CopyVarFromDevice(uint64_t session_id, const NodePtr &var, std::unique_pt
ret = rtMemcpy(reinterpret_cast<void *>(var_host.get()), var_size_bytes, reinterpret_cast<void *>(var_addr),
var_size_bytes, RT_MEMCPY_DEVICE_TO_HOST);
if (ret != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtMemcpy failed, size:%ld, op:%s(%s), session_id:%lu, ret:0x%X when %s",
var_size_bytes, var->GetName().c_str(), var->GetType().c_str(), session_id, ret, __FUNCTION__);
GELOGE(RT_FAILED,
"Failed to copy var memory from device, var %s, size %ld,"
" rt-error-code %u",
@ -175,6 +191,12 @@ Status TransVarOnHost(uint8_t *var_data, const VarTransRoad &trans_road, formats
TypeUtils::DataTypeToSerialString(data_type).c_str());
auto ret = formats::TransFormat({src_data, src_format, dst_format, src_shape, dst_shape, data_type}, tmp_result);
if (ret != SUCCESS) {
REPORT_CALL_ERROR("E19999", "Trans format from %s to %s, shape %s to %s failed, data type:%s, ret:%u, when %s",
TypeUtils::FormatToSerialString(src_format).c_str(),
TypeUtils::FormatToSerialString(dst_format).c_str(),
formats::ShapeToString(src_shape).c_str(),
formats::ShapeToString(dst_shape).c_str(),
TypeUtils::DataTypeToSerialString(data_type).c_str(), ret, __FUNCTION__);
GELOGE(INTERNAL_ERROR,
"Failed to trans format from %s to %s, shape %s to %s, "
"data type %s error code %u",
@ -195,6 +217,10 @@ Status TransVarOnHost(uint8_t *var_data, const VarTransRoad &trans_road, formats
auto ret = formats::TransDataType({src_data, static_cast<size_t>(src_data_size), src_data_type, dst_data_type},
tmp_result);
if (ret != SUCCESS) {
REPORT_CALL_ERROR("E19999", "Trans data type from %s to %s failed, input shape %s, data size %ld, ret:%u, "
"when %s", TypeUtils::DataTypeToSerialString(src_data_type).c_str(),
TypeUtils::DataTypeToSerialString(dst_data_type).c_str(),
formats::ShapeToString(input_shape).c_str(), src_data_size, ret, __FUNCTION__);
GELOGE(INTERNAL_ERROR, "Failed to trans data type from %s to %s, input shape %s, data size %ld, error code %u",
TypeUtils::DataTypeToSerialString(src_data_type).c_str(),
TypeUtils::DataTypeToSerialString(dst_data_type).c_str(), formats::ShapeToString(input_shape).c_str(),
@ -202,6 +228,8 @@ Status TransVarOnHost(uint8_t *var_data, const VarTransRoad &trans_road, formats
return ret;
}
} else {
REPORT_INNER_ERROR("E19999", "Trans var data failed, the trans type %s does not supported, check invalid when %s",
trans_info.node_type.c_str(), __FUNCTION__);
GELOGE(UNSUPPORTED, "Failed to trans var data, the trans type %s does not supported",
trans_info.node_type.c_str());
return UNSUPPORTED;
@ -236,6 +264,8 @@ Status ReAssignVarAddr(uint64_t session_id,
uint8_t *var_addr = VarManager::Instance(session_id)->GetVarMemoryAddr(var_logic, RT_MEMORY_HBM);
if (var_addr == nullptr) {
REPORT_CALL_ERROR("E19999", "Get variable memory addr failed, mem_type:%d, var_name:%s, session_id:%lu, when %s",
RT_MEMORY_HBM, var_name.c_str(), session_id, __FUNCTION__);
GELOGE(INTERNAL_ERROR, "Failed to convert var %s logic addr to real addr", var_name.c_str());
return INTERNAL_ERROR;
}
@ -263,6 +293,8 @@ Status TransVarData(const NodePtr &var, const VarTransRoad &trans_road, uint64_t
// Sync var data from device
std::unique_ptr<uint8_t[]> var_data;
if (trans_road.empty()) {
REPORT_INNER_ERROR("E19999", "Param trans_road is empty, session_id:%lu, check invalid when %s",
session_id, __FUNCTION__);
GELOGE(INTERNAL_ERROR, "Failed to get trans_road, trans_road is empty.");
return INTERNAL_ERROR;
}
@ -314,6 +346,10 @@ Status TransTensor(uint8_t *var_data, const NodePtr &var_src, const NodePtr &var
auto ret = formats::TransDataType(
{var_data, static_cast<size_t>(src_data_shape_size), src_data_datatype, dst_data_datatype}, result);
if (ret != SUCCESS) {
REPORT_CALL_ERROR("E19999", "Trans data type from %s to %s failed, data size %ld, ret:%u, "
"when %s", TypeUtils::DataTypeToSerialString(src_data_datatype).c_str(),
TypeUtils::DataTypeToSerialString(dst_data_datatype).c_str(),
src_data_shape_size, ret, __FUNCTION__);
GELOGE(INTERNAL_ERROR, "trans var data on host failed");
return ret;
});
@ -329,7 +365,10 @@ Status CopyTensorFromSrcVarNode(const NodePtr &var_src,
/// unlink edges between var_fp32 and "dst_node" (need fp16) of var_fp32, add edge between var_fp16 and dst_node.
/// need copy value from var_fp32 to var_fp16.
/// [opdesc of var_src and var_dst are checked before passed in, no need to check if they are nullptr]
GE_IF_BOOL_EXEC(var_src == nullptr || var_dst == nullptr, GELOGE(FAILED, "node var is nullptr"); return FAILED);
GE_IF_BOOL_EXEC(var_src == nullptr || var_dst == nullptr,
REPORT_INNER_ERROR("E19999", "Param var_src or var_dst is empty, session_id:%lu, device_id:%u, "
"check invalid when %s", session_id, device_id, __FUNCTION__);
GELOGE(FAILED, "node var is nullptr"); return FAILED);
// src_node output_desc (fp32)
GeTensorDesc output_desc = var_src->GetOpDesc()->GetOutputDesc(0);
auto src_data_type = output_desc.GetDataType();
@ -447,15 +486,21 @@ Status TransVarDataUtils::TransAllVarData(const vector<NodePtr> &variable_nodes,
}
std::future<Status> f = executor.commit(
[](const ge::NodePtr &node, uint64_t session_id, rtContext_t ctx, uint32_t graph_id) -> Status {
[](const ge::NodePtr &node, uint64_t session_id, rtContext_t ctx, uint32_t graph_id,
const struct ErrorMessage::Context &error_context) -> Status {
ErrorManager::GetInstance().SetErrorContext(error_context);
rtError_t rt_ret = rtCtxSetCurrent(ctx);
if (rt_ret != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtCtxSetCurrent failed, session_id:%lu, graph_id:%u, ret:0x%X, when %s",
session_id, graph_id, rt_ret, __FUNCTION__);
GELOGE(RT_FAILED, "Failed to set context, error_code is: 0x%X.", rt_ret);
return RT_ERROR_TO_GE_STATUS(rt_ret);
}
uint32_t allocated_graph_id = 0;
Status ret = VarManager::Instance(session_id)->GetAllocatedGraphId(node->GetName(), allocated_graph_id);
if (ret != SUCCESS) {
REPORT_CALL_ERROR("E19999", "Get allocated GraphId failed, session_id:%lu, graph_id:%u, ret:0x%X, when %s",
session_id, graph_id, ret, __FUNCTION__);
GELOGE(INTERNAL_ERROR, "var has not been allocated, node:%s, graph_id:%u.", node->GetName().c_str(),
graph_id);
return INTERNAL_ERROR;
@ -480,7 +525,7 @@ Status TransVarDataUtils::TransAllVarData(const vector<NodePtr> &variable_nodes,
}
return SUCCESS;
},
node, session_id, context, graph_id);
node, session_id, context, graph_id, ErrorManager::GetInstance().GetErrorContext());
if (!f.valid()) {
GELOGE(FAILED, "Future is invalid");
return FAILED;
@ -503,6 +548,8 @@ Status TransVarDataUtils::TransAllVarData(const vector<NodePtr> &variable_nodes,
Status TransVarDataUtils::CopyVarData(const ComputeGraphPtr &compute_graph, uint64_t session_id, uint32_t device_id) {
GELOGD("CopyVarData start: session_id:%lu.", session_id);
if (compute_graph == nullptr) {
REPORT_INNER_ERROR("E19999", "Param compute_graph is nullptr, session_id:%lu, device_id:%u, check invalid when %s",
session_id, device_id, __FUNCTION__);
GELOGE(FAILED, "compute_graph is nullptr");
return FAILED;
}

@ -37,6 +37,7 @@ GraphOptimize::GraphOptimize()
void AddNodeInputProperty(ComputeGraphPtr &compute_graph) {
if (compute_graph == nullptr) {
REPORT_INNER_ERROR("E19999", "Param compute_graph is nullptr, check invalid when %s", __FUNCTION__);
GELOGE(GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL, "[AddNodeInputProperty]: compute_graph is nullptr.");
return;
}
@ -78,6 +79,7 @@ void AddNodeInputProperty(ComputeGraphPtr &compute_graph) {
Status GraphOptimize::OptimizeSubGraph(ComputeGraphPtr &compute_graph, const std::string &engine_name) {
if (compute_graph == nullptr) {
REPORT_INNER_ERROR("E19999", "Param compute_graph is nullptr, check invalid when GraphOptimize %s", __FUNCTION__);
GELOGE(GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL, "[OptimizeSubGraph]: compute_graph is nullptr.");
return GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL;
}
@ -87,6 +89,7 @@ Status GraphOptimize::OptimizeSubGraph(ComputeGraphPtr &compute_graph, const std
std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance();
if (instance_ptr == nullptr || !instance_ptr->InitFlag()) {
REPORT_INNER_ERROR("E19999", "Gelib not init before, check invalid when GraphOptimize %s", __FUNCTION__);
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "GraphOptimzer: GE is not initialized");
return GE_CLI_GE_NOT_INITIALIZED;
}
@ -105,6 +108,9 @@ Status GraphOptimize::OptimizeSubGraph(ComputeGraphPtr &compute_graph, const std
for (auto iter = graph_optimizer.begin(); iter != graph_optimizer.end(); ++iter) {
Status ret = (*iter)->OptimizeFusedGraphAfterGraphSlice(*(compute_graph));
if (ret != SUCCESS) {
REPORT_INNER_ERROR("E19999", "Call OptimizeFusedGraphAfterGraphSlice failed, ret:%d, engine_name:%s, "
"graph_name:%s when GraphOptimize %s", ret, engine_name.c_str(),
compute_graph->GetName().c_str(), __FUNCTION__);
GELOGE(ret, "[OptimizeSubGraph][OptimizeFusedGraphAfterGraphSlice]: graph optimize failed, ret:%d", ret);
return ret;
}
@ -115,6 +121,9 @@ Status GraphOptimize::OptimizeSubGraph(ComputeGraphPtr &compute_graph, const std
for (auto iter = graph_optimizer.begin(); iter != graph_optimizer.end(); ++iter) {
ret = (*iter)->OptimizeFusedGraph(*(compute_graph));
if (ret != SUCCESS) {
REPORT_INNER_ERROR("E19999", "Call OptimizeFusedGraph failed, ret:%d, engine_name:%s, "
"graph_name:%s when GraphOptimize %s", ret, engine_name.c_str(),
compute_graph->GetName().c_str(), __FUNCTION__);
GELOGE(ret, "[OptimizeSubGraph][OptimizeFusedGraph]: graph optimize failed, ret:%d", ret);
return ret;
}
@ -132,6 +141,7 @@ Status GraphOptimize::OptimizeOriginalGraph(ComputeGraphPtr &compute_graph) {
return SUCCESS;
}
if (compute_graph == nullptr) {
REPORT_INNER_ERROR("E19999", "Param compute_graph is nullptr, check invalid when GraphOptimize %s", __FUNCTION__);
GELOGE(GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL, "[OptimizeOriginalGraph]: compute_graph is nullptr.");
return GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL;
}
@ -139,6 +149,7 @@ Status GraphOptimize::OptimizeOriginalGraph(ComputeGraphPtr &compute_graph) {
Status ret = SUCCESS;
std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance();
if (instance_ptr == nullptr || !instance_ptr->InitFlag()) {
REPORT_INNER_ERROR("E19999", "Gelib not init before, check invalid when GraphOptimize %s", __FUNCTION__);
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "OptimizeOriginalGraph failed.");
return GE_CLI_GE_NOT_INITIALIZED;
}
@ -155,6 +166,9 @@ Status GraphOptimize::OptimizeOriginalGraph(ComputeGraphPtr &compute_graph) {
}
ret = (iter->second)->OptimizeOriginalGraph(*compute_graph);
if (ret != SUCCESS) {
REPORT_INNER_ERROR("E19999", "Call OptimizeOriginalGraph failed, ret:%d, engine_name:%s, "
"graph_name:%s when GraphOptimize %s", ret, iter->first.c_str(),
compute_graph->GetName().c_str(), __FUNCTION__);
GELOGE(ret, "[OptimizeOriginalGraph]: graph optimize failed, ret:%d", ret);
return ret;
}
@ -174,6 +188,7 @@ Status GraphOptimize::OptimizeOriginalGraphJudgeInsert(ComputeGraphPtr &compute_
Status ret = SUCCESS;
std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance();
if (instance_ptr == nullptr || !instance_ptr->InitFlag()) {
REPORT_INNER_ERROR("E19999", "Gelib not init before, check invalid when GraphOptimize %s", __FUNCTION__);
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "OptimizeOriginalGraph failed.");
return GE_CLI_GE_NOT_INITIALIZED;
}
@ -191,6 +206,9 @@ Status GraphOptimize::OptimizeOriginalGraphJudgeInsert(ComputeGraphPtr &compute_
GELOGI("Begin to refine running format by engine %s", iter->first.c_str());
ret = (iter->second)->OptimizeOriginalGraphJudgeInsert(*compute_graph);
if (ret != SUCCESS) {
REPORT_INNER_ERROR("E19999", "Call OptimizeOriginalGraphJudgeInsert failed, ret:%d, engine_name:%s, "
"graph_name:%s when GraphOptimize %s", ret, iter->first.c_str(),
compute_graph->GetName().c_str(), __FUNCTION__);
GELOGE(ret, "[OptimizeOriginalGraphJudgeInsert]: graph optimize failed, ret:%d", ret);
return ret;
}
@ -201,12 +219,14 @@ Status GraphOptimize::OptimizeOriginalGraphJudgeInsert(ComputeGraphPtr &compute_
Status GraphOptimize::OptimizeOriginalGraphForQuantize(ComputeGraphPtr &compute_graph) {
if (compute_graph == nullptr) {
REPORT_INNER_ERROR("E19999", "Param compute_graph is nullptr, check invalid when GraphOptimize %s", __FUNCTION__);
GELOGE(GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL, "[OptimizeOriginalGraph]: compute_graph is nullptr.");
return GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL;
}
std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance();
if (instance_ptr == nullptr || !instance_ptr->InitFlag()) {
REPORT_INNER_ERROR("E19999", "Gelib not init before, check invalid when GraphOptimize %s", __FUNCTION__);
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "OptimizeOriginalGraph failed.");
return GE_CLI_GE_NOT_INITIALIZED;
}
@ -224,6 +244,9 @@ Status GraphOptimize::OptimizeOriginalGraphForQuantize(ComputeGraphPtr &compute_
}
ret = iter->second->OptimizeGraphPrepare(*compute_graph);
if (ret != SUCCESS) {
REPORT_INNER_ERROR("E19999", "Call OptimizeGraphPrepare failed, ret:%d, engine_name:%s, "
"graph_name:%s when GraphOptimize %s", ret, iter->first.c_str(),
compute_graph->GetName().c_str(), __FUNCTION__);
GELOGE(ret, "[OptimizeOriginalGraphForQuantize]: graph optimize failed, ret:%u", ret);
return ret;
}
@ -234,12 +257,14 @@ Status GraphOptimize::OptimizeOriginalGraphForQuantize(ComputeGraphPtr &compute_
Status GraphOptimize::OptimizeGraphBeforeBuildForRts(ComputeGraphPtr &compute_graph) {
if (compute_graph == nullptr) {
REPORT_INNER_ERROR("E19999", "Param compute_graph is nullptr, check invalid when GraphOptimize %s", __FUNCTION__);
GELOGE(GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL, "[OptimizeGraphBeforeBuildForRts]: compute_graph is nullptr.");
return GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL;
}
std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance();
if (instance_ptr == nullptr || !instance_ptr->InitFlag()) {
REPORT_INNER_ERROR("E19999", "Gelib not init before, check invalid when GraphOptimize %s", __FUNCTION__);
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "OptimizeGraphBeforeBuildForRts failed.");
return GE_CLI_GE_NOT_INITIALIZED;
}
@ -258,6 +283,9 @@ Status GraphOptimize::OptimizeGraphBeforeBuildForRts(ComputeGraphPtr &compute_gr
}
ret = iter->second->OptimizeGraphBeforeBuild(*compute_graph);
if (ret != SUCCESS) {
REPORT_INNER_ERROR("E19999", "Call OptimizeGraphBeforeBuild failed, ret:%d, engine_name:%s, "
"graph_name:%s when GraphOptimize %s", ret, iter->first.c_str(),
compute_graph->GetName().c_str(), __FUNCTION__);
GELOGE(ret, "[OptimizeGraphBeforeBuildForRts]: graph optimize failed, ret:%u", ret);
return ret;
}
@ -268,6 +296,8 @@ Status GraphOptimize::OptimizeGraphBeforeBuildForRts(ComputeGraphPtr &compute_gr
Status GraphOptimize::SetOptions(const ge::GraphManagerOptions &options) {
if (options.framework_type >= static_cast<int32_t>(domi::FrameworkType::FRAMEWORK_RESERVED)) {
REPORT_INNER_ERROR("E19999", "Param framework_type:%d in option check invalid when GraphOptimize %s",
options.framework_type, __FUNCTION__);
GELOGE(GE_GRAPH_OPTIONS_INVALID, "Optimize Type %d invalid.", options.framework_type);
return GE_GRAPH_OPTIONS_INVALID;
}
@ -342,12 +372,14 @@ Status GraphOptimize::IdentifyReference(ComputeGraphPtr &compute_graph) {
}
Status GraphOptimize::OptimizeWholeGraph(ComputeGraphPtr &compute_graph) {
if (compute_graph == nullptr) {
REPORT_INNER_ERROR("E19999", "Param compute_graph is nullptr, check invalid when GraphOptimize %s", __FUNCTION__);
GELOGE(GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL, "[OptimizeWholeGraph]: compute_graph is nullptr.");
return GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL;
}
std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance();
if (instance_ptr == nullptr || !instance_ptr->InitFlag()) {
REPORT_INNER_ERROR("E19999", "Gelib not init before, check invalid when GraphOptimize %s", __FUNCTION__);
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "OptimizeWholeGraph failed.");
return GE_CLI_GE_NOT_INITIALIZED;
}
@ -366,6 +398,9 @@ Status GraphOptimize::OptimizeWholeGraph(ComputeGraphPtr &compute_graph) {
ret = iter.second->OptimizeWholeGraph(*compute_graph);
GE_DUMP(compute_graph, "OptimizeWholeGraph" + iter.first);
if (ret != SUCCESS) {
REPORT_INNER_ERROR("E19999", "Call OptimizeWholeGraph failed, ret:%d, engine_name:%s, "
"graph_name:%s when GraphOptimize %s", ret, iter.first.c_str(),
compute_graph->GetName().c_str(), __FUNCTION__);
GELOGE(ret, "[OptimizeWholeGraph]: graph optimize failed, ret:%u", ret);
return ret;
}

@ -26,12 +26,14 @@ const size_t kInputSizeSingle = 1;
Status AddNPass::Run(NodePtr &node) {
GELOGD("AddNPass running");
if (node == nullptr) {
REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid when AddNPass %s", __FUNCTION__);
GELOGE(PARAM_INVALID, "param [node] must not be null.");
return PARAM_INVALID;
}
if (node->GetType() == ADDN) {
if (node->GetOpDesc() == nullptr) {
REPORT_INNER_ERROR("E19999", "Param op_desc of node is nullptr, check invalid when AddNPass %s", __FUNCTION__);
GELOGE(PARAM_INVALID, "Param [node] op desc is null.");
return PARAM_INVALID;
}

@ -122,6 +122,8 @@ bool AicpuConstantFoldingPass::CheckInput(const NodePtr &node, vector<ConstGeTen
Status AicpuConstantFoldingPass::GetInputAddrs(const vector<ConstGeTensorPtr> &weight_vec,
vector<AddrAndType> &input_addrs) {
if (weight_vec.empty()) {
REPORT_INNER_ERROR("E19999", "Param weight_vec is empty, check invalid when AicpuConstantFoldingPass :%s",
__FUNCTION__);
GELOGE(FAILED, "Weight is null");
return FAILED;
}
@ -132,6 +134,8 @@ Status AicpuConstantFoldingPass::GetInputAddrs(const vector<ConstGeTensorPtr> &w
rtError_t rt_ret = rtMemcpy(input_addr, weight->GetData().size(), weight->GetData().data(),
weight->GetData().size(), RT_MEMCPY_HOST_TO_DEVICE);
if (rt_ret != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtMemcpy failed, size:%zu, ret = 0x%X, when AicpuConstantFoldingPass %s",
weight->GetData().size(), rt_ret, __FUNCTION__);
GELOGE(rt_ret, "rtMemcpy error");
GE_CHK_RT(rtFree(input_addr));
return FAILED;
@ -145,6 +149,8 @@ Status AicpuConstantFoldingPass::GetInputAddrs(const vector<ConstGeTensorPtr> &w
Status AicpuConstantFoldingPass::GetOutputAddrs(const OpDescPtr &node_desc, vector<uint64_t> &output_addrs) {
if (node_desc->GetOutputsSize() == 0) {
REPORT_INNER_ERROR("E19999", "Ouput desc size of op:%s(%s) is 0, check invalid when AicpuConstantFoldingPass :%s",
node_desc->GetName().c_str(), node_desc->GetType().c_str(), __FUNCTION__);
GELOGE(FAILED, "Output size is 0 ");
return FAILED;
}
@ -171,6 +177,8 @@ Status AicpuConstantFoldingPass::GenerateDataPtrInfo(const vector<uint64_t> &out
if (result_summary.shape_data_size != 0) {
rtError_t rt_ret = rtMalloc(&shape_data_addr, result_summary.shape_data_size, RT_MEMORY_HBM);
if (rt_ret != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtMalloc failed, size:%lu, ret = 0x%X, when AicpuConstantFoldingPass %s",
result_summary.shape_data_size, rt_ret, __FUNCTION__);
GELOGE(rt_ret, "rtMalloc error");
GE_CHK_RT(rtFree(raw_data_addr));
return FAILED;
@ -200,6 +208,8 @@ Status AicpuConstantFoldingPass::GenerateDataPtrInfo(const vector<uint64_t> &out
Status AicpuConstantFoldingPass::UpdateWorkSpaceAddr(string &task_info, STR_FWK_OP_KERNEL &task) {
// Update the workspace_addr
if (task_info.empty()) {
REPORT_INNER_ERROR("E19999", "Param task_info is empty, check invalid when AicpuConstantFoldingPass :%s",
__FUNCTION__);
GELOGE(FAILED, "task_info is empty ");
return FAILED;
}
@ -208,6 +218,8 @@ Status AicpuConstantFoldingPass::UpdateWorkSpaceAddr(string &task_info, STR_FWK_
rtError_t rt_ret =
rtMemcpy(workspace_addr, task_info.size(), task_info.data(), task_info.size(), RT_MEMCPY_HOST_TO_DEVICE);
if (rt_ret != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtMemcpy failed, size:%zu, ret = 0x%X, when AicpuConstantFoldingPass %s",
task_info.size(), rt_ret, __FUNCTION__);
GELOGE(rt_ret, "rtMemcpy error");
GE_CHK_RT(rtFree(workspace_addr));
return FAILED;
@ -221,6 +233,8 @@ Status AicpuConstantFoldingPass::UpdateWorkSpaceAddr(string &task_info, STR_FWK_
Status AicpuConstantFoldingPass::UpdateInputAndOutputAddr(const vector<uint64_t> &io_addrs, STR_FWK_OP_KERNEL &task) {
auto addrs_size = sizeof(uint64_t) * (io_addrs.size());
if (addrs_size <= 0) {
REPORT_INNER_ERROR("E19999", "Param io_addrs size is 0, check invalid when AicpuConstantFoldingPass :%s",
__FUNCTION__);
GELOGE(FAILED, "addrs_size is less than 1 ");
return FAILED;
}
@ -228,6 +242,8 @@ Status AicpuConstantFoldingPass::UpdateInputAndOutputAddr(const vector<uint64_t>
GE_CHK_RT_RET(rtMalloc(&input_output_addr, addrs_size, RT_MEMORY_HBM));
rtError_t rt_ret = rtMemcpy(input_output_addr, addrs_size, io_addrs.data(), addrs_size, RT_MEMCPY_HOST_TO_DEVICE);
if (rt_ret != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtMemcpy failed, size:%zu, ret = 0x%X, when AicpuConstantFoldingPass %s",
addrs_size, rt_ret, __FUNCTION__);
GELOGE(rt_ret, "rtMemcpy error");
GE_CHK_RT(rtFree(input_output_addr));
return FAILED;
@ -284,6 +300,8 @@ Status AicpuConstantFoldingPass::UpdateMemCopyAddr(string &task_info, const vect
GE_CHK_RT_RET(rtMalloc(&input_addr_ptr, data_size, RT_MEMORY_HBM));
rtError_t rt_ret = rtMemcpy(input_addr_ptr, data_size, item.data(), data_size, RT_MEMCPY_HOST_TO_DEVICE);
if (rt_ret != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtMemcpy failed, size:%zu, ret = 0x%X, when AicpuConstantFoldingPass %s",
data_size, rt_ret, __FUNCTION__);
GELOGE(rt_ret, "rtMemcpy error");
GE_CHK_RT(rtFree(input_addr_ptr));
return FAILED;
@ -312,11 +330,15 @@ Status AicpuConstantFoldingPass::LaunchSingleOpRunTask(const NodePtr &node, cons
void *task_buf = nullptr;
auto instance_ptr = ge::GELib::GetInstance();
if (instance_ptr == nullptr || !instance_ptr->InitFlag()) {
REPORT_INNER_ERROR("E19999", "GeLib is not init before, check invalid when AicpuConstantFoldingPass %s",
__FUNCTION__);
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "GE is not initialized");
return GE_CLI_GE_NOT_INITIALIZED;
}
auto kernel_builder = OpsKernelBuilderManager::Instance().GetOpsKernelBuilder(kKernelLibName);
if (kernel_builder == nullptr) {
REPORT_INNER_ERROR("E19999", "Find ops kernel by name:%s failed, when AicpuConstantFoldingPass %s",
kKernelLibName, __FUNCTION__);
GELOGE(FAILED, "Get op kernel info store failed");
return FAILED;
}
@ -367,11 +389,15 @@ Status AicpuConstantFoldingPass::LaunchMemCopyTask(const vector<uint64_t> &data_
void *task_buf = nullptr;
auto instance_ptr = ge::GELib::GetInstance();
if (instance_ptr == nullptr || !instance_ptr->InitFlag()) {
REPORT_INNER_ERROR("E19999", "GeLib is not init before, check invalid when AicpuConstantFoldingPass %s",
__FUNCTION__);
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "GE is not initialized");
return GE_CLI_GE_NOT_INITIALIZED;
}
auto kernel_builder = OpsKernelBuilderManager::Instance().GetOpsKernelBuilder(kKernelLibName);
if (kernel_builder == nullptr) {
REPORT_INNER_ERROR("E19999", "Find ops kernel by name:%s failed, when AicpuConstantFoldingPass %s",
kKernelLibName, __FUNCTION__);
GELOGE(FAILED, "Get op kernel info store failed");
return FAILED;
}
@ -428,6 +454,8 @@ Status AicpuConstantFoldingPass::GenerateTaskForLaunch(STR_FWK_OP_KERNEL &aicpu_
rtError_t rt_ret = rtMemcpy(task_buf, sizeof(STR_FWK_OP_KERNEL), reinterpret_cast<void *>(&aicpu_task),
sizeof(STR_FWK_OP_KERNEL), RT_MEMCPY_HOST_TO_DEVICE);
if (rt_ret != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtMemcpy failed, size:%zu, ret = 0x%X, when AicpuConstantFoldingPass %s",
sizeof(STR_FWK_OP_KERNEL), rt_ret, __FUNCTION__);
GELOGE(rt_ret, "rtMemcpy error");
GE_CHK_RT(rtFree(task_buf));
return FAILED;
@ -457,41 +485,57 @@ Status AicpuConstantFoldingPass::KernelLaunch(void *task_buf) {
rtError_t rt_ret = rtModelCreate(&model, 0);
if (rt_ret != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtModelCreate failed, ret = 0x%X, when AicpuConstantFoldingPass %s",
rt_ret, __FUNCTION__);
GELOGE(rt_ret, "create model failed.");
return FAILED;
}
rt_ret = rtStreamCreate(&stream, 0);
if (rt_ret != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtStreamCreate failed, ret = 0x%X, when AicpuConstantFoldingPass %s",
rt_ret, __FUNCTION__);
GELOGE(rt_ret, "create stream failed.");
return FAILED;
}
rt_ret = rtModelBindStream(model, stream, 0);
if (rt_ret != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtModelBindStream failed, ret = 0x%X, when AicpuConstantFoldingPass %s",
rt_ret, __FUNCTION__);
GELOGE(rt_ret, "rtModelBindStream failed.");
return FAILED;
}
rt_ret = rtKernelLaunchEx(task_buf, sizeof(STR_FWK_OP_KERNEL), 0, stream);
if (rt_ret != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtModelBindStream failed, ret = 0x%X, when AicpuConstantFoldingPass %s",
rt_ret, __FUNCTION__);
GELOGE(rt_ret, "rtKernelLaunchEx failed.");
return FAILED;
}
rt_ret = rtModelLoadComplete(model);
if (rt_ret != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtModelLoadComplete failed, ret = 0x%X, when AicpuConstantFoldingPass %s",
rt_ret, __FUNCTION__);
GELOGE(rt_ret, "rtModelLoadComplete failed.");
return FAILED;
}
rt_ret = rtStreamCreate(&stream_run, 0);
if (rt_ret != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtStreamCreate failed, ret = 0x%X, when AicpuConstantFoldingPass %s",
rt_ret, __FUNCTION__);
GELOGE(rt_ret, "create run stream failed.");
return FAILED;
}
rt_ret = rtModelExecute(model, stream_run, 0);
if (rt_ret != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtModelExecute failed, ret = 0x%X, when AicpuConstantFoldingPass %s",
rt_ret, __FUNCTION__);
GELOGE(rt_ret, "rtModelExecute failed.");
return FAILED;
}
rt_ret = rtStreamSynchronize(stream_run);
if (rt_ret != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtStreamSynchronize failed, ret = 0x%X, when AicpuConstantFoldingPass %s",
rt_ret, __FUNCTION__);
GELOGE(rt_ret, "rtStreamSynchronize failed.");
return FAILED;
}
@ -501,6 +545,9 @@ Status AicpuConstantFoldingPass::KernelLaunch(void *task_buf) {
Status AicpuConstantFoldingPass::GenerateGeTensor(const OpDescPtr &node_desc, const vector<DataPtrInfo> &data_vec,
vector<GeTensorPtr> &outputs) {
if ((node_desc->GetOutputsSize() * kDouble) != data_vec.size()) {
REPORT_INNER_ERROR("E19999", "Output desc size:%zu of op:%s(%s), after multi 2, not equal to data_vec.size:%zu, "
"check invalid when AicpuConstantFoldingPass %s", node_desc->GetOutputsSize(),
node_desc->GetName().c_str(), node_desc->GetType().c_str(), data_vec.size(), __FUNCTION__);
GELOGE(FAILED, "node[%s] something wrong with output size", node_desc->GetName().c_str());
return FAILED;
}
@ -509,6 +556,7 @@ Status AicpuConstantFoldingPass::GenerateGeTensor(const OpDescPtr &node_desc, co
auto output_tensor_desc = node_desc->GetOutputDesc(static_cast<uint32_t>(i));
GeTensorPtr output_ptr = MakeShared<GeTensor>(output_tensor_desc);
if (output_ptr == nullptr) {
REPORT_CALL_ERROR("E19999", "New GeTensor failed when AicpuConstantFoldingPass %s", __FUNCTION__);
GELOGE(FAILED, "node[%s] something wrong with construct GeTensor", node_desc->GetName().c_str());
return FAILED;
}
@ -516,6 +564,8 @@ Status AicpuConstantFoldingPass::GenerateGeTensor(const OpDescPtr &node_desc, co
uint64_t raw_data_size = raw_data_info.data_size;
std::unique_ptr<uint8_t[]> data_addr(new (std::nothrow) uint8_t[raw_data_size]());
if (data_addr == nullptr) {
REPORT_CALL_ERROR("E19999", "New Buffer failed, size:%lu, when AicpuConstantFoldingPass %s",
raw_data_size, __FUNCTION__);
GELOGE(MEMALLOC_FAILED, "new data_addr failed");
return INTERNAL_ERROR;
}
@ -539,6 +589,8 @@ Status AicpuConstantFoldingPass::GenerateGeTensor(const OpDescPtr &node_desc, co
uint64_t dim_num = shape_data_size / sizeof(uint64_t);
std::unique_ptr<int64_t[]> shape_addr(new (std::nothrow) int64_t[dim_num]());
if (shape_addr == nullptr) {
REPORT_CALL_ERROR("E19999", "New Buffer failed, size:%lu, when AicpuConstantFoldingPass %s",
dim_num, __FUNCTION__);
GELOGE(MEMALLOC_FAILED, "new shape_addr failed");
return INTERNAL_ERROR;
}
@ -584,17 +636,24 @@ bool AicpuConstantFoldingPass::IsSkipFold(const ge::NodePtr &node) {
}
auto instance_ptr = ge::GELib::GetInstance();
if (instance_ptr == nullptr || !instance_ptr->InitFlag()) {
REPORT_INNER_ERROR("E19999", "GeLib is not init before, check invalid when AicpuConstantFoldingPass %s",
__FUNCTION__);
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "GE is not initialized");
return true;
}
OpsKernelInfoStorePtr kernel_info = instance_ptr->OpsKernelManagerObj().GetOpsKernelInfoStore(kKernelLibName);
if (kernel_info == nullptr) {
REPORT_INNER_ERROR("E19999", "Find ops kernel by name:%s failed, when AicpuConstantFoldingPass %s",
kKernelLibName, __FUNCTION__);
GELOGE(FAILED, "Get op kernel info store failed");
return true;
}
std::string check_result;
kernel_info->opsFlagCheck(*node, check_result);
if (check_result.empty()) {
REPORT_CALL_ERROR("E19999", "Call opsFlagCheck faled, ops kernel name:%s, op:%s(%s), "
"when AicpuConstantFoldingPass %s", kKernelLibName,
node->GetName().c_str(), node->GetType().c_str(), __FUNCTION__);
GELOGE(FAILED, "Get op check_result failed");
return true;
}

@ -30,10 +30,12 @@ namespace ge {
Status AssertPass::Run(NodePtr &node) {
GELOGD("AssertPass running");
if (node == nullptr) {
REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid when AssertPass %s", __FUNCTION__);
GELOGE(PARAM_INVALID, "param [node] must not be null.");
return PARAM_INVALID;
}
if (node->GetOpDesc() == nullptr) {
REPORT_INNER_ERROR("E19999", "Param op_desc of node is nullptr, check invalid when AssertPass %s", __FUNCTION__);
GELOGE(PARAM_INVALID, "param [node] [opDesc] must not be null.");
return PARAM_INVALID;
}
@ -93,6 +95,8 @@ Status AssertPass::RemoveUnusedNode(std::vector<NodePtr> &nodes_unused) {
}
if (IsolateAndDeleteNode(node, assert_io_map) != SUCCESS) {
REPORT_INNER_ERROR("E19999", "Isolate and delete node:%s(%s) faild when AssertPass %s",
node->GetName().c_str(), node->GetType().c_str(), __FUNCTION__);
return FAILED;
}
}

@ -57,12 +57,18 @@ Status AssignRemovePass::OptimizedAssignNode(NodePtr &assign_node) {
const auto &ref_in_anchor = assign_node->GetInDataAnchor(kAssignRefInputIndex);
const auto &value_in_anchor = assign_node->GetInDataAnchor(kAssignValueInputIndex);
if ((ref_in_anchor == nullptr) || (value_in_anchor == nullptr)) {
REPORT_INNER_ERROR("E19999", "Index %d or %d input anchor of node:%s(%s) is nullptr, check invalid "
"when AssignRemovePass %s", kAssignRefInputIndex, kAssignValueInputIndex,
assign_node->GetName().c_str(), assign_node->GetType().c_str(), __FUNCTION__);
GELOGE(FAILED, "In data anchor is null, node:%s", assign_node->GetName().c_str());
return FAILED;
}
const auto &ref_peer_anchor = ref_in_anchor->GetPeerOutAnchor();
const auto &value_peer_anchor = value_in_anchor->GetPeerOutAnchor();
if ((ref_peer_anchor == nullptr) || (value_peer_anchor == nullptr)) {
REPORT_INNER_ERROR("E19999", "Index %d or %d input anchor of node:%s(%s), peer anchor is nullptr, check invalid "
"when AssignRemovePass %s", kAssignRefInputIndex, kAssignValueInputIndex,
assign_node->GetName().c_str(), assign_node->GetType().c_str(), __FUNCTION__);
GELOGE(FAILED, "Peer data anchor is null, node:%s", assign_node->GetName().c_str());
return FAILED;
}
@ -79,6 +85,8 @@ Status AssignRemovePass::OptimizedAssignNode(NodePtr &assign_node) {
///
GELOGD("Optimization for assign_node %s start", assign_node->GetName().c_str());
if (IsolateAndDeleteNode(assign_node, {kAssignRefInputIndex}) != SUCCESS) {
REPORT_CALL_ERROR("E19999", "Isolate and delete node:%s(%s) failed when AssignRemovePass %s",
assign_node->GetName().c_str(), assign_node->GetType().c_str(), __FUNCTION__);
GELOGE(FAILED, "Isolate and delete assign_node %s failed.", assign_node->GetName().c_str());
return FAILED;
}
@ -86,16 +94,27 @@ Status AssignRemovePass::OptimizedAssignNode(NodePtr &assign_node) {
const auto &ref_input = ref_peer_anchor->GetOwnerNode()->GetOpDesc();
const auto &value_input = value_peer_anchor->GetOwnerNode()->GetOpDesc();
if ((ref_input == nullptr) || (value_input == nullptr)) {
REPORT_INNER_ERROR("E19999", "Input index %d or %d of node:%s(%s), peer op is nullptr, check invalid "
"when AssignRemovePass %s", kAssignRefInputIndex, kAssignValueInputIndex,
assign_node->GetName().c_str(), assign_node->GetType().c_str(), __FUNCTION__);
GELOGE(FAILED, "value input is null");
return FAILED;
}
// variable has and only has one input
if (ref_input->UpdateInputDesc(0, value_input->GetOutputDesc(value_peer_anchor->GetIdx())) != GRAPH_SUCCESS) {
REPORT_CALL_ERROR("E19999", "Input index %d of node:%s(%s), update it's peer op input:0 desc failed "
"when AssignRemovePass %s", kAssignRefInputIndex,
assign_node->GetName().c_str(), assign_node->GetType().c_str(), __FUNCTION__);
GELOGE(FAILED, "Update input_desc for variable %s failed.", ref_input->GetName().c_str());
return FAILED;
}
if (GraphUtils::AddEdge(value_peer_anchor, ref_peer_anchor->GetOwnerNode()->GetInDataAnchor(0)) != GRAPH_SUCCESS) {
REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(out_index:%d) and op:%s(%s)(in_index:0) failed "
"when AssignRemovePass %s", value_peer_anchor->GetOwnerNode()->GetName().c_str(),
value_peer_anchor->GetOwnerNode()->GetType().c_str(), value_peer_anchor->GetIdx(),
ref_peer_anchor->GetOwnerNode()->GetName().c_str(),
ref_peer_anchor->GetOwnerNode()->GetType().c_str(), __FUNCTION__);
GELOGE(FAILED, "Add data edge %s->%s failed", value_input->GetName().c_str(), ref_input->GetName().c_str());
return FAILED;
}
@ -104,6 +123,9 @@ Status AssignRemovePass::OptimizedAssignNode(NodePtr &assign_node) {
value_input->GetName().c_str(), ref_input->GetName().c_str());
if (!AttrUtils::SetStr(value_input->MutableOutputDesc(value_peer_anchor->GetIdx()), ASSIGN_VAR_NAME,
ref_input->GetName())) {
REPORT_CALL_ERROR("E19999", "Set Attr:%s to output:%d desc of node:%s(%s) failed when %s",
ASSIGN_VAR_NAME.c_str(), value_peer_anchor->GetIdx(),
value_input->GetName().c_str(), value_input->GetType().c_str(), __FUNCTION__);
GELOGE(FAILED, "Set attr ASSIGN_VAR_NAME failed.");
return FAILED;
}
@ -136,6 +158,9 @@ Status AssignRemovePass::TransformAttr(NodePtr &node) {
GELOGD("add attr ASSIGN_VAR_NAME on node %s, var_name=%s", in_node->GetName().c_str(), assign_var_name.c_str());
if (!AttrUtils::SetStr(in_node->GetOpDesc()->MutableOutputDesc(peer_data_anchor->GetIdx()),
ASSIGN_VAR_NAME, assign_var_name)) {
REPORT_CALL_ERROR("E19999", "Set Attr:%s to output:%d desc of node:%s(%s) failed when %s",
ASSIGN_VAR_NAME.c_str(), peer_data_anchor->GetIdx(),
in_node->GetName().c_str(), in_node->GetType().c_str(), __FUNCTION__);
GELOGE(FAILED, "Set attr ASSIGN_VAR_NAME failed.");
return FAILED;
}

@ -93,7 +93,7 @@ bool AtomicAddrCleanPass::CheckAtomicFromOpsKernel(const NodePtr &node) {
in_data_anchor->GetPeerOutAnchor()->GetOwnerNode() != nullptr) {
auto peer_in_node = in_data_anchor->GetPeerOutAnchor()->GetOwnerNode();
if (peer_in_node->GetType() == DATA) {
GELOGI("Recognized atomic op %s from %s engine and input is DATA.", node->GetName().c_str(),
GELOGI("Recognized atomic op %s from %s engine and input is DATA.", node->GetName().c_str(),
op_info.engine.c_str());
return false;
}
@ -266,6 +266,7 @@ Status AtomicAddrCleanPass::HandleDispersedAtomicNodes(ComputeGraphPtr &graph,
NodePtr AtomicAddrCleanPass::InsertAtomicAddrCleanNode(ComputeGraphPtr &graph) {
OpDescPtr op_desc = MakeShared<OpDesc>(NODE_NAME_ATOMIC_ADDR_CLEAN, ATOMICADDRCLEAN);
if (op_desc == nullptr) {
REPORT_CALL_ERROR("E19999", "New OpDesc failed when AtomicAddrCleanPass %s", __FUNCTION__);
GELOGE(INTERNAL_ERROR, "Make shared atomic addr clean op failed.");
return nullptr;
}
@ -292,10 +293,17 @@ NodePtr AtomicAddrCleanPass::InsertAtomicAddrCleanNode(ComputeGraphPtr &graph) {
Status AtomicAddrCleanPass::LinkToAtomicNode(const NodePtr &atomic_node, NodePtr &atomic_clean_node) {
GE_IF_BOOL_EXEC(atomic_node == nullptr || atomic_clean_node == nullptr,
DOMI_LOGE("param [atomic_node][atomic_clean_node] must not be null."); return PARAM_INVALID);
REPORT_INNER_ERROR("E19999", "Param atomic_node or atomic_clean_node is nullptr, "
"check invalid when AtomicAddrCleanPass %s", __FUNCTION__);
DOMI_LOGE("param [atomic_node][atomic_clean_node] must not be null.");
return PARAM_INVALID);
InControlAnchorPtr in_ctrl_anchor = atomic_node->GetInControlAnchor();
OutControlAnchorPtr out_ctrl_anchor = atomic_clean_node->GetOutControlAnchor();
if (in_ctrl_anchor == nullptr || out_ctrl_anchor == nullptr) {
REPORT_INNER_ERROR("E19999", "in_ctrl_anchor of op:%s(%s) or out_ctrl_anchor of op:%s(%s) is nullptr, "
"check invalid when AtomicAddrCleanPass %s",
atomic_node->GetName().c_str(), atomic_node->GetType().c_str(),
atomic_clean_node->GetName().c_str(), atomic_clean_node->GetType().c_str(), __FUNCTION__);
GELOGE(INTERNAL_ERROR,
"Get control anchor faild, dst node: %s.",
atomic_node->GetName().c_str());
@ -304,6 +312,11 @@ Status AtomicAddrCleanPass::LinkToAtomicNode(const NodePtr &atomic_node, NodePtr
graphStatus status = GraphUtils::AddEdge(out_ctrl_anchor, in_ctrl_anchor);
if (status != GRAPH_SUCCESS) {
REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(out_index:%d) and op:%s(%s)(in_index:%d) failed "
"when AssignRemovePass %s", out_ctrl_anchor->GetOwnerNode()->GetName().c_str(),
out_ctrl_anchor->GetOwnerNode()->GetType().c_str(), out_ctrl_anchor->GetIdx(),
in_ctrl_anchor->GetOwnerNode()->GetName().c_str(),
in_ctrl_anchor->GetOwnerNode()->GetType().c_str(), in_ctrl_anchor->GetIdx(), __FUNCTION__);
GELOGE(INTERNAL_ERROR,
"Graph add cleanAddrNode op out ctrl edge fail, dst node: %s.",
atomic_node->GetName().c_str());
@ -361,6 +374,8 @@ Status AtomicAddrCleanPass::CompileUnknownGraphOp(const vector<NodePtr> &atomic_
std::unordered_map<string, vector<ge::NodePtr>> node_vector_map;
std::shared_ptr<GELib> instance = ge::GELib::GetInstance();
if ((instance == nullptr) || !instance->InitFlag()) {
REPORT_INNER_ERROR("E19999", "GeLib is not init before, check invalid when AtomicAddrCleanPass %s",
__FUNCTION__);
GELOGE(ge::GE_CLI_GE_NOT_INITIALIZED, "CompileSingleOp failed.");
return ge::GE_CLI_GE_NOT_INITIALIZED;
}
@ -373,6 +388,8 @@ Status AtomicAddrCleanPass::CompileUnknownGraphOp(const vector<NodePtr> &atomic_
}
string kernel_lib_name = op_desc->GetOpKernelLibName();
if (kernel_lib_name.empty()) {
REPORT_INNER_ERROR("E19999", "Find ops kernel by name:%s failed, when AtomicAddrCleanPass %s",
kernel_lib_name.c_str(), __FUNCTION__);
GELOGE(ge::INTERNAL_ERROR, "Get atomic node:%s(%s) kernel lib failed.", atomic_node->GetName().c_str(),
atomic_node->GetType().c_str());
return ge::INTERNAL_ERROR;
@ -393,6 +410,8 @@ Status AtomicAddrCleanPass::CompileUnknownGraphOp(const vector<NodePtr> &atomic_
GELOGI("The atomic node size of compile op of %s is %zu", kernel_lib_name.c_str(), node_vector.size());
GE_TIMESTAMP_ADD(UnknownGraphCompileOp);
if (ret != ge::SUCCESS) {
REPORT_CALL_ERROR("E19999", "Call CompileOp failed, kernel_lib_name:%s, ret:%d, when AtomicAddrCleanPass %s",
kernel_lib_name.c_str(), ret, __FUNCTION__);
GELOGE(ret, "Compile atomic op failed, kernel lib name is %s", kernel_lib_name.c_str());
return ret;
}

@ -117,7 +117,13 @@ Status AttachStreamLabelPass::UpdateCondBranch(const NodePtr &node) {
for (const NodePtr &tmp_node : branch_nodes) {
GELOGD("Attach label %s to node: %s.", stream_label.c_str(), tmp_node->GetName().c_str());
GE_CHK_STATUS_RET(SetStreamLabel(tmp_node, stream_label), "Set stream label failed.");
auto status = SetStreamLabel(tmp_node, stream_label);
if (status != ge::SUCCESS) {
REPORT_CALL_ERROR("E19999", "Set stream_label:%s to op:%s(%s) failed when AttachStreamLabelPass %s",
stream_label.c_str(), tmp_node->GetName().c_str(), tmp_node->GetType().c_str(), __FUNCTION__);
GELOGE(status, "Set stream label failed.");
return status;
}
}
return SUCCESS;
@ -133,6 +139,8 @@ Status AttachStreamLabelPass::AttachFlag(const NodePtr &node, std::string &strea
const std::string &type = node->GetType();
if (type == STREAMSWITCH) {
if (node->GetInDataNodes().empty()) {
REPORT_INNER_ERROR("E19999", "In data nodes is empty of op:%s(%s), check invalid when AttachStreamLabelPass %s",
node->GetName().c_str(), node->GetType().c_str(), __FUNCTION__);
GELOGE(INTERNAL_ERROR, "node %s has no input_data_node.", node->GetName().c_str());
return INTERNAL_ERROR;
}
@ -140,13 +148,29 @@ Status AttachStreamLabelPass::AttachFlag(const NodePtr &node, std::string &strea
bool value = false;
OpDescPtr op_desc = node->GetOpDesc();
GE_CHECK_NOTNULL(op_desc);
GE_CHK_BOOL_EXEC(AttrUtils::GetBool(op_desc, ATTR_NAME_SWITCH_TRUE_BRANCH_FLAG, value), return FAILED,
GE_CHK_BOOL_EXEC(AttrUtils::GetBool(op_desc, ATTR_NAME_SWITCH_TRUE_BRANCH_FLAG, value),
REPORT_CALL_ERROR("E19999", "Get Attr:%s of op:%s(%s) failed when AttachStreamLabelPass %s",
ATTR_NAME_SWITCH_TRUE_BRANCH_FLAG.c_str(),
op_desc->GetName().c_str(), op_desc->GetType().c_str(), __FUNCTION__);
return FAILED,
"StreamSwitch get attr TRUE_BRANCH_STREAM failed.");
stream_label += (value ? "_t" : "_f");
GE_CHK_STATUS_RET(SetActiveLabelList(node, {stream_label}), "set active_label_list failed.");
auto status = SetActiveLabelList(node, {stream_label});
if (status != ge::SUCCESS) {
REPORT_CALL_ERROR("E19999", "Set active label list:%s to op:%s(%s) failed when AttachStreamLabelPass %s",
stream_label.c_str(), node->GetName().c_str(), node->GetType().c_str(), __FUNCTION__);
GELOGE(status, "set active_label_list failed.");
return status;
}
} else if (type == STREAMMERGE) {
stream_label = node->GetName();
GE_CHK_STATUS_RET(SetStreamLabel(node, stream_label), "Set stream label failed.");
auto status = SetStreamLabel(node, stream_label);
if (status != ge::SUCCESS) {
REPORT_CALL_ERROR("E19999", "Set stream_label:%s to op:%s(%s) failed when AttachStreamLabelPass %s",
stream_label.c_str(), node->GetName().c_str(), node->GetType().c_str(), __FUNCTION__);
GELOGE(status, "Set stream label failed.");
return status;
}
}
return SUCCESS;
@ -183,6 +207,9 @@ Status AttachStreamLabelPass::UpdateEnterNode() {
bool get_attr = AttrUtils::GetListStr(active_node->GetOpDesc(), ATTR_NAME_ACTIVE_LABEL_LIST, active_label_list) &&
(active_label_list.size() == 1) && !active_label_list[0].empty();
if (!get_attr) {
REPORT_CALL_ERROR("E19999", "Get Attr:%s of op:%s(%s) failed when AttachStreamLabelPass %s",
ATTR_NAME_ACTIVE_LABEL_LIST.c_str(),
active_node->GetName().c_str(), active_node->GetType().c_str(), __FUNCTION__);
GELOGE(INTERNAL_ERROR, "Get attr ATTR_NAME_ACTIVE_LABEL_LIST failed, node: %s.", active_node->GetName().c_str());
return INTERNAL_ERROR;
}
@ -216,7 +243,14 @@ Status AttachStreamLabelPass::SetEnterLabel(const std::vector<NodePtr> &enter_no
}
for (const auto &enter_node : enter_nodes) {
GE_CHK_STATUS_RET(SetStreamLabel(enter_node, stream_label), "Set stream label failed.");
auto status = SetStreamLabel(enter_node, stream_label);
if (status != ge::SUCCESS) {
REPORT_CALL_ERROR("E19999", "Set stream_label:%s to op:%s(%s) failed when AttachStreamLabelPass %s",
stream_label.c_str(), enter_node->GetName().c_str(), enter_node->GetType().c_str(),
__FUNCTION__);
GELOGE(status, "Set stream label failed.");
return status;
}
}
return SUCCESS;
}
@ -245,7 +279,14 @@ Status AttachStreamLabelPass::UpdateLoopBranch(const std::stack<NodePtr> &enter_
continue;
}
GELOGD("Attach label %s to node: %s.", stream_label.c_str(), out_node->GetName().c_str());
GE_CHK_STATUS_RET(SetStreamLabel(out_node, stream_label), "Set stream label failed.");
auto status = SetStreamLabel(out_node, stream_label);
if (status != ge::SUCCESS) {
REPORT_CALL_ERROR("E19999", "Set stream_label:%s to op:%s(%s) failed when AttachStreamLabelPass %s",
stream_label.c_str(), out_node->GetName().c_str(), out_node->GetType().c_str(),
__FUNCTION__);
GELOGE(status, "Set stream label failed.");
return status;
}
nodes.push(out_node);
}
}

@ -22,6 +22,7 @@
#include "graph/utils/type_utils.h"
#include "framework/common/debug/log.h"
#include "framework/common/ge_inner_error_codes.h"
#include "common/formats/utils/formats_trans_utils.h"
namespace ge {
namespace {
@ -31,6 +32,7 @@ const char *const kAttrNameType = "type";
Status BitcastPass::Run(NodePtr &node) {
GELOGD("Bitcast running");
if (node == nullptr) {
REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid when BitcastPass %s", __FUNCTION__);
GELOGE(PARAM_INVALID, "Param [node] must not be null.");
return PARAM_INVALID;
}
@ -41,6 +43,7 @@ Status BitcastPass::Run(NodePtr &node) {
OpDescPtr op_desc = node->GetOpDesc();
if (op_desc == nullptr) {
REPORT_INNER_ERROR("E19999", "Param op_desc of node is nullptr, check invalid when BitcastPass %s", __FUNCTION__);
return PARAM_INVALID;
}
ge::DataType dst_data_type;
@ -58,20 +61,31 @@ Status BitcastPass::Run(NodePtr &node) {
Status BitcastPass::CheckDstDataType(const OpDescPtr op_desc, ge::DataType &dst_data_type) {
if (!ge::AttrUtils::GetDataType(op_desc, kAttrNameType, dst_data_type)) {
REPORT_CALL_ERROR("E19999", "Get Attr:%s of op:%s(%s) failed when BitcastPass %s",
kAttrNameType, op_desc->GetName().c_str(), op_desc->GetType().c_str(), __FUNCTION__);
GELOGE(PARAM_INVALID, "Node failed to get attribute type.");
return PARAM_INVALID;
}
if (dst_data_type >= ge::DT_UNDEFINED) {
GELOGE(PARAM_INVALID, "dst_data_type[%s] is not valid.",
REPORT_INNER_ERROR("E19999", "Param dst_data_type:%d check invalid, op:%s(%s), when BitcastPass %s",
dst_data_type, op_desc->GetName().c_str(), op_desc->GetType().c_str(), __FUNCTION__);
GELOGE(PARAM_INVALID, "dst_data_type[%s] is not valid.",
TypeUtils::DataTypeToSerialString(dst_data_type).c_str());
return PARAM_INVALID;
}
if (op_desc->GetOutputDescPtr(0) == nullptr) {
REPORT_INNER_ERROR("E19999", "Index 0 ouput desc of op:%s(%s) not exist, check invalid when BitcastPass %s",
op_desc->GetName().c_str(), op_desc->GetType().c_str(), __FUNCTION__);
GELOGE(PARAM_INVALID, "Bitcast node outputDesc is null.");
return PARAM_INVALID;
}
if (op_desc->GetOutputDescPtr(0)->GetDataType() != dst_data_type) {
REPORT_INNER_ERROR("E19999", "Index 0 ouput desc of op:%s(%s), it't data type:%s not equal to dst_data_type:%s, "
"check invalid when BitcastPass %s", op_desc->GetName().c_str(), op_desc->GetType().c_str(),
TypeUtils::DataTypeToSerialString(dst_data_type).c_str(),
TypeUtils::DataTypeToSerialString(op_desc->GetOutputDescPtr(0)->GetDataType()).c_str(),
__FUNCTION__);
GELOGE(PARAM_INVALID, "dst_data_type[%s] is not equal to output_data_type[%s].",
TypeUtils::DataTypeToSerialString(dst_data_type).c_str(),
TypeUtils::DataTypeToSerialString(op_desc->GetOutputDescPtr(0)->GetDataType()).c_str());
@ -84,6 +98,8 @@ Status BitcastPass::CheckOutputShape(const OpDescPtr op_desc, const ge::DataType
const GeTensorDescPtr &input_tensor_desc = op_desc->MutableInputDesc(0);
const GeTensorDescPtr &output_tensor_desc = op_desc->MutableOutputDesc(0);
if (input_tensor_desc == nullptr) {
REPORT_INNER_ERROR("E19999", "Index 0 input desc of op:%s(%s) not exist, check invalid when BitcastPass %s",
op_desc->GetName().c_str(), op_desc->GetType().c_str(), __FUNCTION__);
GELOGE(PARAM_INVALID, "input_tensor_desc must not be null.");
return PARAM_INVALID;
}
@ -91,7 +107,10 @@ Status BitcastPass::CheckOutputShape(const OpDescPtr op_desc, const ge::DataType
// get origin data_type and shape
ge::DataType ori_data_type = input_tensor_desc->GetDataType();
if (ori_data_type >= ge::DT_UNDEFINED) {
GELOGE(PARAM_INVALID, "ori_data_type[%s] is not valid.",
REPORT_INNER_ERROR("E19999", "ori_data_type:%d of index 0 input desc in op:%s(%s), "
"check invalid when BitcastPass %s",
ori_data_type, op_desc->GetName().c_str(), op_desc->GetType().c_str(), __FUNCTION__);
GELOGE(PARAM_INVALID, "ori_data_type[%s] is not valid.",
TypeUtils::DataTypeToSerialString(ori_data_type).c_str());
return PARAM_INVALID;
}
@ -108,6 +127,11 @@ Status BitcastPass::CheckOutputShape(const OpDescPtr op_desc, const ge::DataType
}
if (dim_vec != output_tensor_desc->GetShape().GetDims()) {
REPORT_INNER_ERROR("E19999", "Shape:%s of index 0 output desc in op:%s(%s), different from expect shape:%s ,"
"check invalid when BitcastPass %s",
formats::JoinToString(output_tensor_desc->GetShape().GetDims()).c_str(),
op_desc->GetName().c_str(), op_desc->GetType().c_str(), formats::JoinToString(dim_vec).c_str(),
__FUNCTION__);
GELOGE(PARAM_INVALID, "out_put_shape is different from expectations.");
return PARAM_INVALID;
}
@ -118,6 +142,7 @@ Status BitcastPass::CheckOutputShape(const OpDescPtr op_desc, const ge::DataType
Status BitcastPass::CalcAndUpdateShape(BitcastPass::kVecInt64 &dim_vec, ge::DataType ori_data_type,
ge::DataType dst_data_type) {
if (dim_vec.size() == 0) {
REPORT_INNER_ERROR("E19999", "Param dim_vec is empty, check invalid when BitcastPass %s", __FUNCTION__);
GELOGE(PARAM_INVALID, "Pre node shape size is zero.");
return PARAM_INVALID;
}
@ -128,6 +153,10 @@ Status BitcastPass::CalcAndUpdateShape(BitcastPass::kVecInt64 &dim_vec, ge::Data
return SUCCESS;
} else if (ori_data_size > dst_data_size) {
if (ori_data_size % dst_data_size != 0) {
REPORT_INNER_ERROR("E19999", "size:%ld of ori_data_type:%s is not divisible by size:%ld of dst_data_type:%s ,"
"check invalid when BitcastPass %s",
ori_data_size, TypeUtils::DataTypeToSerialString(ori_data_type).c_str(),
dst_data_size, TypeUtils::DataTypeToSerialString(dst_data_type).c_str(), __FUNCTION__);
GELOGE(PARAM_INVALID, "ori_data_size is not divisible by dst_data_size.");
return PARAM_INVALID;
}
@ -135,11 +164,18 @@ Status BitcastPass::CalcAndUpdateShape(BitcastPass::kVecInt64 &dim_vec, ge::Data
return SUCCESS;
} else {
if (dst_data_size % ori_data_size != 0) {
REPORT_INNER_ERROR("E19999", "size:%ld of dst_data_type:%s is not divisible by size:%ld of ori_data_type:%s ,"
"check invalid when BitcastPass %s",
dst_data_size, TypeUtils::DataTypeToSerialString(dst_data_type).c_str(),
ori_data_size, TypeUtils::DataTypeToSerialString(ori_data_type).c_str(), __FUNCTION__);
GELOGE(PARAM_INVALID, "dst_data_size is not divisible by ori_data_size.");
return PARAM_INVALID;
}
if (dim_vec[dim_vec.size() - 1] != (dst_data_size / ori_data_size)) {
REPORT_INNER_ERROR("E19999", "The last dim:%ld in param dim_vec is not equal to "
"dst_data_size:%ld / ori_data_size:%ld, check invalid when BitcastPass %s",
dim_vec[dim_vec.size() - 1], dst_data_size, ori_data_size, __FUNCTION__);
GELOGE(PARAM_INVALID, "The last dim is not equal to dst_data_size / ori_data_size.");
return PARAM_INVALID;
}

@ -25,11 +25,14 @@
namespace ge {
Status CastRemovePass::Run(NodePtr &node) {
if (node == nullptr) {
REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid when CastRemovePass %s", __FUNCTION__);
GELOGE(PARAM_INVALID, "Param [node] must not be null.");
return PARAM_INVALID;
}
OpDescPtr op_desc = node->GetOpDesc();
if (op_desc == nullptr) {
REPORT_INNER_ERROR("E19999", "Param op_desc of node is nullptr, check invalid when CastRemovePass %s",
__FUNCTION__);
GELOGE(PARAM_INVALID, "OpDesc of param [node] must not be null.");
return PARAM_INVALID;
}
@ -46,6 +49,7 @@ Status CastRemovePass::Run(NodePtr &node) {
}
OpDescPtr end_op_desc = end_node->GetOpDesc();
if (end_op_desc == nullptr) {
REPORT_INNER_ERROR("E19999", "op_desc of end_node is nullptr, check invalid when CastRemovePass %s", __FUNCTION__);
GELOGE(PARAM_INVALID, "OpDesc of end node must not be null.");
return PARAM_INVALID;
}
@ -99,6 +103,8 @@ Status CastRemovePass::RemoveCast(DataType &type, std::vector<NodePtr> &nodes_to
GELOGI("CastRemovePass, remove Cast %s.", node->GetName().c_str());
cast_name = node->GetName();
if (IsolateAndDeleteNode(node, {0}) != SUCCESS) {
REPORT_CALL_ERROR("E19999", "Isolate and delete node:%s(%s) failed when CastRemovePass %s",
node->GetName().c_str(), node->GetType().c_str(), __FUNCTION__);
GELOGE(FAILED, "IsolateAndDeleteNode %s failed.", node->GetName().c_str());
return FAILED;
}
@ -114,6 +120,8 @@ Status CastRemovePass::RemoveCast(DataType &type, std::vector<NodePtr> &nodes_to
}
OpDescPtr op_desc = node->GetOpDesc();
if (op_desc == nullptr) {
REPORT_INNER_ERROR("E19999", "Find nullptr op_desc in node, check invalid when CastRemovePass %s",
__FUNCTION__);
GELOGE(FAILED, "OpDesc must not be null.");
return FAILED;
}
@ -123,6 +131,9 @@ Status CastRemovePass::RemoveCast(DataType &type, std::vector<NodePtr> &nodes_to
op_desc->SetName(new_node_name);
// add attr to changed TransData, then will be rebuild
if (!AttrUtils::SetBool(op_desc, ATTR_NEED_COMPILE, true)) {
REPORT_CALL_ERROR("E19999", "Set Attr:%s of op:%s(%s) failed when CastRemovePass %s",
ATTR_NEED_COMPILE.c_str(),
op_desc->GetName().c_str(), op_desc->GetType().c_str(), __FUNCTION__);
GELOGE(FAILED, "Set ATTR_NEED_COMPILE Attr fail.");
return FAILED;
}

@ -223,6 +223,8 @@ Status CastTranslatePass::Run(NodePtr &node) {
continue;
}
if (IsolateAndDeleteNode(out_data_node, {0}) != SUCCESS) {
REPORT_CALL_ERROR("E19999", "Isolate and delete node:%s(%s) failed when CastTranslatePass %s",
out_data_node->GetName().c_str(), out_data_node->GetType().c_str(), __FUNCTION__);
return FAILED;
}
}
@ -262,6 +264,9 @@ Status CastTranslatePass::FuseDstNTranslates(NodePtr &node) {
ComputeGraphPtr graph = out_data_node->GetOwnerComputeGraph();
GE_CHECK_NOTNULL(graph);
if (GraphUtils::RemoveNodeWithoutRelink(graph, out_data_node) != SUCCESS) {
REPORT_CALL_ERROR("E19999", "Remove node:%s(%s) without relink in graph:%s failed when CastTranslatePass %s",
out_data_node->GetName().c_str(), out_data_node->GetType().c_str(), graph->GetName().c_str(),
__FUNCTION__);
GELOGE(FAILED, "[%s] RemoveNodeWithoutRelink failed.", out_data_node->GetName().c_str());
return FAILED;
}

@ -106,6 +106,9 @@ Status CommonSubexpressionEliminationPass::Run(ComputeGraphPtr graph) {
ret = GraphUtils::ReplaceNodeAnchors(iter->second, node, {}, output_map);
if (ret != GRAPH_SUCCESS) {
REPORT_CALL_ERROR("E19999", "Replace node:%s(%s) by node:%s(%s) failed "
"when CommonSubexpressionEliminationPass %s", node->GetName().c_str(), node->GetType().c_str(),
iter->second->GetName().c_str(), iter->second->GetType().c_str(), __FUNCTION__);
GELOGE(INTERNAL_ERROR, "Failed to replace node %s by node %s error node %u",
node->GetName().c_str(), iter->second->GetName().c_str(), ret);
return INTERNAL_ERROR;
@ -115,6 +118,9 @@ Status CommonSubexpressionEliminationPass::Run(ComputeGraphPtr graph) {
ret = GraphUtils::RemoveNodeWithoutRelink(graph, node);
if (ret != GRAPH_SUCCESS) {
REPORT_CALL_ERROR("E19999", "Remove node:%s(%s) without relink in graph:%s failed "
"when CommonSubexpressionEliminationPass %s",
node->GetName().c_str(), node->GetType().c_str(), graph->GetName().c_str(), __FUNCTION__);
GELOGE(INTERNAL_ERROR, "Failed to remove node %s from graph", node->GetName().c_str());
return INTERNAL_ERROR;
}

@ -41,6 +41,7 @@ graphStatus CompileNodesPass::Run(ComputeGraphPtr graph) {
}
std::shared_ptr<GELib> instance = ge::GELib::GetInstance();
if (instance == nullptr || !instance->InitFlag()) {
REPORT_INNER_ERROR("E19999", "Gelib not init before, check invalid when CompileNodesPass %s", __FUNCTION__);
GELOGE(ge::GE_CLI_GE_NOT_INITIALIZED, "Run CompileNodesPass failed.");
return ge::GE_CLI_GE_NOT_INITIALIZED;
}
@ -99,6 +100,8 @@ graphStatus CompileNodesPass::GetSupportedKernel(const NodePtr &node, const std:
(void)instance->DNNEngineManagerObj().GetDNNEngineName(node);
kernel_lib_name = op_desc->GetOpKernelLibName();
if (kernel_lib_name.empty()) {
REPORT_INNER_ERROR("E19999", "kernel_lib_name in op:%s(%s) is empty, check invalid when CompileNodesPass %s",
op_desc->GetName().c_str(), op_desc->GetType().c_str(), __FUNCTION__);
GELOGE(GRAPH_FAILED, "Get node:%s, type:%s kernel lib failed.", node->GetName().c_str(),
op_desc->GetType().c_str());
return GRAPH_FAILED;
@ -106,11 +109,16 @@ graphStatus CompileNodesPass::GetSupportedKernel(const NodePtr &node, const std:
}
OpsKernelInfoStorePtr kernel_info = instance->OpsKernelManagerObj().GetOpsKernelInfoStore(kernel_lib_name);
if (kernel_info == nullptr) {
REPORT_INNER_ERROR("E19999", "Find ops kernel by name:%s failed for op:%s(%s), when CompileNodesPass %s",
kernel_lib_name.c_str(), op_desc->GetName().c_str(), op_desc->GetType().c_str(), __FUNCTION__);
GELOGE(ge::GE_GRAPH_PARAM_NULLPTR, "Get op %s ops kernel info store failed", node->GetName().c_str());
return ge::GE_GRAPH_PARAM_NULLPTR;
}
std::map<std::string, std::string> unsupported_reasons;
std::string unsupported_reason;
// begin accuracy supported check
if (!CheckAccuracySupport(kernel_info, instance, node)) {
if (!CheckAccuracySupport(kernel_info, instance, node, unsupported_reason)) {
// if check accuracy support failed , try to go to other engine.
GELOGD("Check Accuracy Supported return not support, node name is %s. Try to go to other engine.",
op_desc->GetName().c_str());
@ -123,13 +131,25 @@ graphStatus CompileNodesPass::GetSupportedKernel(const NodePtr &node, const std:
continue;
}
OpsKernelInfoStorePtr tmp_kernel_info = it->second;
if (CheckAccuracySupport(tmp_kernel_info, instance, node)) {
if (CheckAccuracySupport(tmp_kernel_info, instance, node, unsupported_reason)) {
kernel_lib_name = tmp_kernel_name;
GELOGD("Find kernel lib %s support node:%s, type:%s , get kernel lib success.", tmp_kernel_name.c_str(),
node->GetName().c_str(), op_desc->GetType().c_str());
return GRAPH_SUCCESS;
} else {
unsupported_reasons.emplace(tmp_kernel_name, unsupported_reason);
}
}
for (const auto &it : unsupported_reasons) {
REPORT_INPUT_ERROR("E13002", std::vector<std::string>({"optype", "opskernel", "reason"}),
std::vector<std::string>({op_desc->GetType(), it.first, it.second}));
GELOGE(GE_GRAPH_ASSIGN_ENGINE_FAILED,
"CheckAccuracySupport:Op type %s of ops kernel %s is unsupported, reason:%s",
op_desc->GetType().c_str(), it.first.c_str(), it.second.c_str());
}
REPORT_INPUT_ERROR("E13003", std::vector<std::string>({"opname", "optype"}),
std::vector<std::string>({op_desc->GetName(), op_desc->GetType()}));
GELOGE(GRAPH_FAILED, "Cannot find kernel lib support node:%s, type:%s , get kernel lib failed.",
node->GetName().c_str(), op_desc->GetType().c_str());
return GRAPH_FAILED;
@ -137,10 +157,10 @@ graphStatus CompileNodesPass::GetSupportedKernel(const NodePtr &node, const std:
return GRAPH_SUCCESS;
}
bool CompileNodesPass::CheckAccuracySupport(const OpsKernelInfoStorePtr &kernel_info,
const std::shared_ptr<GELib> instance, const NodePtr &node) {
string reason;
if (!(kernel_info->CheckAccuracySupported(node, reason, true))) {
bool CompileNodesPass::CheckAccuracySupport(
const OpsKernelInfoStorePtr &kernel_info, const std::shared_ptr<GELib> instance,
const NodePtr &node, string& unsupported_reason) {
if (!(kernel_info->CheckAccuracySupported(node, unsupported_reason, true))) {
return false;
}
return true;
@ -153,6 +173,8 @@ graphStatus CompileNodesPass::CompileNodes(const std::shared_ptr<GELib> instance
for (auto &kernel_nodes : kernel_to_compile_nodes) {
kernel_info = instance->OpsKernelManagerObj().GetOpsKernelInfoStore(kernel_nodes.first);
if (kernel_info == nullptr) {
REPORT_INNER_ERROR("E19999", "Find ops kernel by name:%s failed, when CompileNodesPass %s",
kernel_nodes.first.c_str(), __FUNCTION__);
GELOGE(ge::GE_GRAPH_PARAM_NULLPTR, "Get op %s ops kernel info store failed", kernel_nodes.first.c_str());
return ge::GE_GRAPH_PARAM_NULLPTR;
}
@ -168,6 +190,8 @@ graphStatus CompileNodesPass::CompileNodes(const std::shared_ptr<GELib> instance
}
auto ret = kernel_info->CompileOp(kernel_nodes.second);
if (ret != GRAPH_SUCCESS) {
REPORT_CALL_ERROR("E19999", "Call CompileOp failed, kernel_lib_name:%s, ret:%d, when CompileNodesPass %s",
kernel_nodes.first.c_str(), ret, __FUNCTION__);
GELOGE(ret, "Compile op failed, kernel name is %s", kernel_nodes.first.c_str());
return GRAPH_FAILED;
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save