!1248 modify error log

From: @wangxiaotian22
Reviewed-by: 
Signed-off-by:
pull/1248/MERGE
mindspore-ci-bot 4 years ago committed by Gitee
commit b7a534a90a

@ -87,8 +87,9 @@ static Status CheckEngineTypeSupport(const NodePtr &node, OpEngineType engine_ty
} else { } else {
ErrorManager::GetInstance().ATCReportErrMessage("E14001", {"opname", "optype", "value", "reason"}, ErrorManager::GetInstance().ATCReportErrMessage("E14001", {"opname", "optype", "value", "reason"},
{op_desc->GetName(), op_desc->GetType(), "engine type", {op_desc->GetName(), op_desc->GetType(), "engine type",
"it only support kEngineNameDefault/kAIcoreEngine/kVectorEngine"}); "it only support default/AIcoreEngine/VectorEngine"});
GELOGE(FAILED, "CheckEngineType: engine type: %d not support.", static_cast<int>(engine_type)); GELOGE(FAILED, "[Check][EngineType]value:%d not support, "
"only support default/AIcoreEngine/VectorEngine now", static_cast<int>(engine_type));
return FAILED; return FAILED;
} }
@ -192,17 +193,20 @@ static Status AddInputs(const ComputeGraphPtr &graph, const NodePtr &node, const
(void)AttrUtils::SetBool(data_op, "_is_single_op", true); (void)AttrUtils::SetBool(data_op, "_is_single_op", true);
GE_CHK_BOOL_EXEC(data_op->AddInputDesc(tensor) == GRAPH_SUCCESS, return FAILED, "Add input desc fail"); GE_CHK_BOOL_EXEC(data_op->AddInputDesc(tensor) == GRAPH_SUCCESS, return FAILED,
GE_CHK_BOOL_EXEC(data_op->AddOutputDesc(tensor) == GRAPH_SUCCESS, return FAILED, "Add output desc fail"); "[Add][InputDesc]fail for node:%s", data_op->GetName().c_str());
GE_CHK_BOOL_EXEC(data_op->AddOutputDesc(tensor) == GRAPH_SUCCESS, return FAILED,
"[Add][OutputDesc]fail for node:%s", data_op->GetName().c_str());
if (attr) { if (attr) {
GE_CHK_BOOL_EXEC(AttrUtils::SetInt(data_op, ATTR_NAME_INDEX, index), return FAILED, "Set index fail"); GE_CHK_BOOL_EXEC(AttrUtils::SetInt(data_op, ATTR_NAME_INDEX, index), return FAILED,
"[Set][Attr:%s]fail for node:%s", ATTR_NAME_INDEX.c_str(), data_op->GetName().c_str());
} }
ge::NodePtr arg_node = graph->AddNode(data_op); ge::NodePtr arg_node = graph->AddNode(data_op);
GE_CHK_BOOL_EXEC(arg_node != nullptr, return FAILED, "Insert Data node fail"); GE_CHK_BOOL_EXEC(arg_node != nullptr, return FAILED, "Insert Data node fail");
GE_CHK_STATUS(GraphUtils::AddEdge(arg_node->GetOutDataAnchor(0), node->GetInDataAnchor(index)), GE_CHK_STATUS(GraphUtils::AddEdge(arg_node->GetOutDataAnchor(0), node->GetInDataAnchor(index)),
"Add edge[%s->%s] fail", data_op->GetName().c_str(), node->GetName().c_str()); "[Add][Edge]fail from node:%s to node:%s", data_op->GetName().c_str(), node->GetName().c_str());
return SUCCESS; return SUCCESS;
} }
@ -217,20 +221,23 @@ static Status AddOutputs(const ComputeGraphPtr &graph, const NodePtr &node, cons
for (const auto &out_desc : outputs) { for (const auto &out_desc : outputs) {
GeTensorDesc tensor = out_desc.GetTensorDesc(); GeTensorDesc tensor = out_desc.GetTensorDesc();
TensorUtils::SetInputTensor(tensor, true); TensorUtils::SetInputTensor(tensor, true);
GE_CHK_BOOL_EXEC(op_desc->AddInputDesc(tensor) == GRAPH_SUCCESS, return FAILED, "Add input desc fail."); GE_CHK_BOOL_EXEC(op_desc->AddInputDesc(tensor) == GRAPH_SUCCESS, return FAILED,
"[Add][InputDesc]fail for node:%s", op_desc->GetName().c_str());
TensorUtils::SetInputTensor(tensor, false); TensorUtils::SetInputTensor(tensor, false);
TensorUtils::SetOutputTensor(tensor, true); TensorUtils::SetOutputTensor(tensor, true);
GE_CHK_BOOL_EXEC(op_desc->AddOutputDesc(tensor) == GRAPH_SUCCESS, return FAILED, "Add output desc fail."); GE_CHK_BOOL_EXEC(op_desc->AddOutputDesc(tensor) == GRAPH_SUCCESS, return FAILED,
"[Add][OutputDesc]fail for node:%s", op_desc->GetName().c_str());
count++; count++;
} }
GE_CHECK_NOTNULL_EXEC(graph, return PARAM_INVALID); GE_CHECK_NOTNULL_EXEC(graph, return PARAM_INVALID);
ge::NodePtr out_node = graph->AddNode(op_desc); ge::NodePtr out_node = graph->AddNode(op_desc);
GE_CHK_BOOL_EXEC(out_node != nullptr, return FAILED, "Insert Output node fail"); GE_CHK_BOOL_EXEC(out_node != nullptr, return FAILED,
"[Add][Node:%s]fail in graph:%u", op_desc->GetName().c_str(), graph->GetGraphID());
GE_CHECK_NOTNULL_EXEC(node, return PARAM_INVALID); GE_CHECK_NOTNULL_EXEC(node, return PARAM_INVALID);
for (int32_t i = 0; i < count; ++i) { for (int32_t i = 0; i < count; ++i) {
GE_CHK_STATUS(GraphUtils::AddEdge(node->GetOutDataAnchor(i), out_node->GetInDataAnchor(i)), GE_CHK_STATUS(GraphUtils::AddEdge(node->GetOutDataAnchor(i), out_node->GetInDataAnchor(i)),
"Add edge[%s->%s] fail", node->GetName().c_str(), out_node->GetName().c_str()); "[Add][Edge]fail from node:%s to node:%s", node->GetName().c_str(), out_node->GetName().c_str());
} }
return SUCCESS; return SUCCESS;
@ -250,7 +257,7 @@ static void GetOpsProtoPath(string &opsproto_path) {
return; return;
} }
string path_base = PluginManager::GetPath(); string path_base = PluginManager::GetPath();
GELOGI("path_base is %s.", path_base.c_str()); GELOGI("path_base is %s", path_base.c_str());
path_base = path_base.substr(0, path_base.rfind('/')); path_base = path_base.substr(0, path_base.rfind('/'));
path_base = path_base.substr(0, path_base.rfind('/') + 1); path_base = path_base.substr(0, path_base.rfind('/') + 1);
opsproto_path = (path_base + "ops/op_proto/custom/" + ":") + (path_base + "ops/op_proto/built-in/"); opsproto_path = (path_base + "ops/op_proto/custom/" + ":") + (path_base + "ops/op_proto/built-in/");
@ -335,7 +342,7 @@ Status GeGenerator::Initialize(const map<string, string> &options, OmgContext &o
ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOpsProtoInit); ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOpsProtoInit);
string opsproto_path; string opsproto_path;
GetOpsProtoPath(opsproto_path); GetOpsProtoPath(opsproto_path);
GELOGI("Get opsproto path is %s.", opsproto_path.c_str()); GELOGI("Get opsproto path is %s", opsproto_path.c_str());
OpsProtoManager *manager = OpsProtoManager::Instance(); OpsProtoManager *manager = OpsProtoManager::Instance();
map<string, string> option_tmp; map<string, string> option_tmp;
option_tmp.emplace(std::pair<string, string>(string("ge.opsProtoLibPath"), opsproto_path)); option_tmp.emplace(std::pair<string, string>(string("ge.opsProtoLibPath"), opsproto_path));
@ -714,7 +721,7 @@ Status GeGenerator::BuildSingleOp(OpDescPtr &op_desc, const vector<GeTensor> &in
auto node = comp_graph->FindNode(op_desc->GetName()); auto node = comp_graph->FindNode(op_desc->GetName());
Status ret = CheckEngineTypeSupport(node, engine_type); Status ret = CheckEngineTypeSupport(node, engine_type);
if (ret != SUCCESS) { if (ret != SUCCESS) {
GELOGE(ret, "check engine type failed"); GELOGE(ret, "[Check][EngineType]value:%d for node:%s not support", engine_type, node->GetName().c_str());
return ret; return ret;
} }
} }
@ -788,9 +795,9 @@ Status GeGenerator::BuildSingleOpModel(OpDescPtr &op_desc, const vector<GeTensor
const vector<GeTensor> &outputs, OpEngineType engine_type, const vector<GeTensor> &outputs, OpEngineType engine_type,
ModelBufferData &model_buff) { ModelBufferData &model_buff) {
ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther);
GELOGI("Start to build single op online, input size: %zu, output size: %zu.", inputs.size(), outputs.size()); GELOGI("Start to build single op online, input size: %zu, output size: %zu", inputs.size(), outputs.size());
Status status = BuildSingleOp(op_desc, inputs, outputs, kFileNameSuffix, engine_type, model_buff, false); Status status = BuildSingleOp(op_desc, inputs, outputs, kFileNameSuffix, engine_type, model_buff, false);
GELOGI("Finish build single online model, status: %u.", status); GELOGI("Finish build single online model, status: %u", status);
return status; return status;
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -40,7 +40,7 @@ static bool BlockComparator(const Block *left, const Block *right) {
} }
bool CanMerge(Block *block) { bool CanMerge(Block *block) {
if (block == nullptr || block->allocated || !block->IsSplit()) { if ((block == nullptr) || block->allocated || !block->IsSplit()) {
return false; return false;
} }
return true; return true;
@ -52,7 +52,7 @@ size_t GetBinIndex(size_t size) {
if (size <= range) { if (size <= range) {
break; break;
} }
++index; index++;
} }
if (index > kNumBins - 1) { if (index > kNumBins - 1) {
index = kNumBins - 1; index = kNumBins - 1;
@ -87,25 +87,25 @@ bool ShouldSplit(const Block *block, size_t size) {
void IncreaseCount(std::map<size_t, size_t> &count, size_t size) { void IncreaseCount(std::map<size_t, size_t> &count, size_t size) {
auto it = count.find(size); auto it = count.find(size);
if (it != count.end()) { if (it == count.end()) {
it->second++;
} else {
count.emplace(size, 1); count.emplace(size, 1);
} else {
it->second++;
} }
} }
CachingAllocator::CachingAllocator(rtMemType_t memory_type) : memory_type_(memory_type), memory_allocator_(nullptr) { CachingAllocator::CachingAllocator(rtMemType_t memory_type) : memory_type_(memory_type), memory_allocator_(nullptr) {
for (uint32_t i = 0; i < kNumBins; ++i) { for (uint32_t i = 0; i < kNumBins; i++) {
free_block_bins_[i] = nullptr; free_block_bins_[i] = nullptr;
} }
} }
Status CachingAllocator::Initialize(uint32_t device_id) { Status CachingAllocator::Initialize(uint32_t device_id) {
GELOGI("Device id %u.", device_id); GELOGI("Device id %u", device_id);
// when redo Initialize free old memory // when redo Initialize free old memory
FreeBlocks(); FreeBlocks();
std::lock_guard<std::recursive_mutex> lock(mutex_); std::lock_guard<std::recursive_mutex> lock(mutex_);
for (uint32_t i = 0; i < kNumBins; ++i) { for (uint32_t i = 0; i < kNumBins; i++) {
if (free_block_bins_[i] != nullptr) { if (free_block_bins_[i] != nullptr) {
continue; continue;
} }
@ -124,26 +124,26 @@ Status CachingAllocator::Initialize(uint32_t device_id) {
} }
void CachingAllocator::Finalize(uint32_t device_id) { void CachingAllocator::Finalize(uint32_t device_id) {
GELOGI("Device id %u.", device_id); GELOGI("Device id %u", device_id);
PrintStatics(); PrintStatics();
FreeBlocks(); FreeBlocks();
FreeBlockBins(); FreeBlockBins();
} }
uint8_t *CachingAllocator::Malloc(size_t size, uint8_t *org_ptr, uint32_t device_id) { uint8_t *CachingAllocator::Malloc(size_t size, uint8_t *org_ptr, uint32_t device_id) {
GELOGI("Start malloc pool memory, size = %zu, device id = %u.", size, device_id); GELOGI("Start malloc pool memory, size = %zu, device id = %u", size, device_id);
uint8_t *ptr = nullptr;
size = GetBlockSize(size); size = GetBlockSize(size);
uint8_t *ptr = nullptr;
Block *block = FindFreeBlock(size, org_ptr, device_id); Block *block = FindFreeBlock(size, org_ptr, device_id);
if (block != nullptr) { if (block == nullptr) {
ptr = block->ptr;
} else {
if (ge::SUCCESS == TryExtendCache(size, device_id)) { if (ge::SUCCESS == TryExtendCache(size, device_id)) {
block = FindFreeBlock(size, org_ptr, device_id); block = FindFreeBlock(size, org_ptr, device_id);
if (block != nullptr) { if (block != nullptr) {
ptr = block->ptr; ptr = block->ptr;
} }
} }
} else {
ptr = block->ptr;
} }
if (ptr == nullptr) { if (ptr == nullptr) {
GELOGE(FAILED, "Malloc failed device id = %u, size= %zu", device_id, size); GELOGE(FAILED, "Malloc failed device id = %u, size= %zu", device_id, size);
@ -152,7 +152,7 @@ uint8_t *CachingAllocator::Malloc(size_t size, uint8_t *org_ptr, uint32_t device
} }
Status CachingAllocator::Free(uint8_t *ptr, uint32_t device_id) { Status CachingAllocator::Free(uint8_t *ptr, uint32_t device_id) {
GELOGI("Free device id = %u.", device_id); GELOGI("Free device id = %u", device_id);
if (ptr == nullptr) { if (ptr == nullptr) {
GELOGE(PARAM_INVALID, "Invalid memory pointer"); GELOGE(PARAM_INVALID, "Invalid memory pointer");
return ge::PARAM_INVALID; return ge::PARAM_INVALID;
@ -171,10 +171,10 @@ Status CachingAllocator::Free(uint8_t *ptr, uint32_t device_id) {
} }
void CachingAllocator::FreeBlock(Block *block) { void CachingAllocator::FreeBlock(Block *block) {
if (block == nullptr || !block->allocated) { if ((block == nullptr) || !block->allocated) {
return; return;
} }
GELOGI("Free block size = %zu.", block->size); GELOGI("Free block size = %zu", block->size);
std::lock_guard<std::recursive_mutex> lock(mutex_); std::lock_guard<std::recursive_mutex> lock(mutex_);
block->allocated = false; block->allocated = false;
@ -187,7 +187,7 @@ void CachingAllocator::FreeBlock(Block *block) {
} }
void CachingAllocator::MergeBlocks(Block *dst, Block *src, BlockBin &bin) { void CachingAllocator::MergeBlocks(Block *dst, Block *src, BlockBin &bin) {
if (!CanMerge(dst) || !CanMerge(src)) { if (!CanMerge(src) || !CanMerge(dst)) {
return; return;
} }
@ -227,7 +227,7 @@ Block *CachingAllocator::FindFreeBlock(size_t size, uint8_t *org_ptr, uint32_t d
Block *block = *it; Block *block = *it;
bin->erase(it); bin->erase(it);
if (block != nullptr) { if (block != nullptr) {
GELOGI("Find block size = %zu.", block->size); GELOGI("Find block size = %zu", block->size);
if (ShouldSplit(block, size)) { if (ShouldSplit(block, size)) {
block = SplitBlock(block, size, *bin, device_id); block = SplitBlock(block, size, *bin, device_id);
} }
@ -235,7 +235,7 @@ Block *CachingAllocator::FindFreeBlock(size_t size, uint8_t *org_ptr, uint32_t d
if (block->ptr != nullptr) { if (block->ptr != nullptr) {
block->allocated = true; block->allocated = true;
allocated_blocks_[block->ptr] = block; allocated_blocks_[block->ptr] = block;
GELOGI("Malloc device id = %u, size= %zu.", device_id, size); GELOGI("Malloc device id = %u, size= %zu", device_id, size);
} }
} }
@ -265,7 +265,7 @@ Block *CachingAllocator::SplitBlock(Block *block, size_t size, BlockBin &bin, ui
} }
Status CachingAllocator::TryExtendCache(size_t size, uint32_t device_id) { Status CachingAllocator::TryExtendCache(size_t size, uint32_t device_id) {
GELOGI("Try to extend cache. size = %zu, device id = %u.", size, device_id); GELOGI("Try to extend cache. size = %zu, device id = %u", size, device_id);
auto memory_size = GetAllocationSize(size); auto memory_size = GetAllocationSize(size);
const std::string purpose = "Memory for caching."; const std::string purpose = "Memory for caching.";
auto memory_addr = memory_allocator_->MallocMemory(purpose, memory_size, device_id); auto memory_addr = memory_allocator_->MallocMemory(purpose, memory_size, device_id);
@ -302,7 +302,7 @@ Status CachingAllocator::AddToBlockBin(uint8_t *ptr, size_t size, uint32_t devic
return ge::FAILED; return ge::FAILED;
} }
GELOGI("Block size = %zu.", size); GELOGI("Block size = %zu", size);
block->ptr = ptr; block->ptr = ptr;
block->size = size; block->size = size;
@ -313,10 +313,10 @@ Status CachingAllocator::AddToBlockBin(uint8_t *ptr, size_t size, uint32_t devic
} }
size_t CachingAllocator::FreeCachedBlocks() { size_t CachingAllocator::FreeCachedBlocks() {
GELOGI("Free cached blocks."); GELOGI("Free cached blocks");
std::lock_guard<std::recursive_mutex> lock(mutex_); std::lock_guard<std::recursive_mutex> lock(mutex_);
size_t free_cached_memory_size = 0; size_t free_cached_memory_size = 0;
for (uint32_t i = 0; i < kNumBins; ++i) { for (uint32_t i = 0; i < kNumBins; i++) {
auto pool = free_block_bins_[i]; auto pool = free_block_bins_[i];
if (pool == nullptr) { if (pool == nullptr) {
continue; continue;
@ -324,7 +324,8 @@ size_t CachingAllocator::FreeCachedBlocks() {
for (auto it = pool->begin(); it != pool->end();) { for (auto it = pool->begin(); it != pool->end();) {
Block *block = *it; Block *block = *it;
// free block memory that has not been split // free block memory that has not been split
if ((block != nullptr) && (block->ptr != nullptr) && (block->prev == nullptr) && (block->next == nullptr) && if ((block != nullptr) && (block->ptr != nullptr) &&
(block->prev == nullptr) && (block->next == nullptr) &&
(memory_allocator_->FreeMemory(block->ptr) == ge::SUCCESS)) { (memory_allocator_->FreeMemory(block->ptr) == ge::SUCCESS)) {
auto itcount = malloced_memory_.find(block->size); auto itcount = malloced_memory_.find(block->size);
free_cached_memory_size += block->size; free_cached_memory_size += block->size;
@ -345,7 +346,7 @@ size_t CachingAllocator::FreeCachedBlocks() {
} }
void CachingAllocator::FreeBlocks() { void CachingAllocator::FreeBlocks() {
GELOGI("Free blocks"); GELOGI("Free blocks.");
std::lock_guard<std::recursive_mutex> lock(mutex_); std::lock_guard<std::recursive_mutex> lock(mutex_);
// free allocated blocks and put to cache // free allocated blocks and put to cache
for (auto &it : allocated_blocks_) { for (auto &it : allocated_blocks_) {
@ -356,9 +357,9 @@ void CachingAllocator::FreeBlocks() {
} }
void CachingAllocator::FreeBlockBins() { void CachingAllocator::FreeBlockBins() {
GELOGI("Free block bins"); GELOGI("Free block bins.");
std::lock_guard<std::recursive_mutex> lock(mutex_); std::lock_guard<std::recursive_mutex> lock(mutex_);
for (uint32_t i = 0; i < kNumBins; ++i) { for (uint32_t i = 0; i < kNumBins; i++) {
if (free_block_bins_[i] != nullptr) { if (free_block_bins_[i] != nullptr) {
delete free_block_bins_[i]; delete free_block_bins_[i];
free_block_bins_[i] = nullptr; free_block_bins_[i] = nullptr;
@ -367,9 +368,9 @@ void CachingAllocator::FreeBlockBins() {
} }
void PrintCount(std::map<size_t, size_t> &count, const std::string &name, size_t total_size, size_t total_count) { void PrintCount(std::map<size_t, size_t> &count, const std::string &name, size_t total_size, size_t total_count) {
GELOGI("%6s total[size:%10zu count:%10zu]", name.c_str(), total_size, total_count); GELOGI("%6s total[size:%10zu count:%10zu].", name.c_str(), total_size, total_count);
for (auto &it : count) { for (auto &it : count) {
GELOGI(" |- block[size:%10zu count:%10zu]", it.first, it.second); GELOGI(" |- block[size:%10zu count:%10zu].", it.first, it.second);
} }
} }
@ -383,20 +384,20 @@ void CachingAllocator::PrintStatics() {
size_t total_free_count = 0; size_t total_free_count = 0;
size_t total_malloc_size = 0; size_t total_malloc_size = 0;
size_t total_malloc_count = 0; size_t total_malloc_count = 0;
std::map<size_t, size_t> using_block; std::map<size_t, size_t> using_block_stat;
std::map<size_t, size_t> free_block; std::map<size_t, size_t> free_block_stat;
std::map<size_t, size_t> malloc_block; std::map<size_t, size_t> malloc_block_stat;
do { do {
std::lock_guard<std::recursive_mutex> lock(mutex_); std::lock_guard<std::recursive_mutex> lock(mutex_);
for (uint32_t i = 0; i < kNumBins; ++i) { for (uint32_t i = 0; i < kNumBins; i++) {
auto pool = free_block_bins_[i]; auto pool = free_block_bins_[i];
if (pool == nullptr) { if (pool == nullptr) {
continue; continue;
} }
for (auto it = pool->begin(); it != pool->end(); ++it) { for (auto it = pool->begin(); it != pool->end(); it++) {
if ((*it) != nullptr) { if ((*it) != nullptr) {
total_free_size += (*it)->size; total_free_size += (*it)->size;
IncreaseCount(free_block, (*it)->size); IncreaseCount(free_block_stat, (*it)->size);
total_free_count++; total_free_count++;
} }
} }
@ -405,7 +406,7 @@ void CachingAllocator::PrintStatics() {
for (auto &it : allocated_blocks_) { for (auto &it : allocated_blocks_) {
if (it.second != nullptr) { if (it.second != nullptr) {
total_using_size += it.second->size; total_using_size += it.second->size;
IncreaseCount(using_block, it.second->size); IncreaseCount(using_block_stat, it.second->size);
total_using_count++; total_using_count++;
} }
} }
@ -413,12 +414,12 @@ void CachingAllocator::PrintStatics() {
for (auto &it : malloced_memory_) { for (auto &it : malloced_memory_) {
total_malloc_size += it.first * it.second; total_malloc_size += it.first * it.second;
total_malloc_count += it.second; total_malloc_count += it.second;
malloc_block[it.first] = it.second; malloc_block_stat[it.first] = it.second;
} }
} while (0); } while (0);
PrintCount(malloc_block, "Malloc", total_malloc_size, total_malloc_count); PrintCount(malloc_block_stat, "Malloc", total_malloc_size, total_malloc_count);
PrintCount(using_block, "Using", total_using_size, total_using_count); PrintCount(using_block_stat, "Using", total_using_size, total_using_count);
PrintCount(free_block, "Free", total_free_size, total_free_count); PrintCount(free_block_stat, "Free", total_free_size, total_free_count);
} }
} // namespace ge } // namespace ge

@ -56,9 +56,10 @@ inline bool IsLogEnable(int module_name, int log_level) {
return (enable == 1); return (enable == 1);
} }
#define GELOGE(ERROR_CODE, fmt, ...) \ #define GELOGE(ERROR_CODE, fmt, ...) \
dlog_error(GE_MODULE_NAME, "%lu %s: ErrorNo: %d(%s) " fmt, GeLog::GetTid(), __FUNCTION__, ERROR_CODE, \ dlog_error(GE_MODULE_NAME, "%lu %s: ErrorNo: %d(%s) %s" fmt, GeLog::GetTid(), __FUNCTION__, ERROR_CODE, \
((GE_GET_ERRORNO_STR(ERROR_CODE)).c_str()), ##__VA_ARGS__) ((GE_GET_ERRORNO_STR(ERROR_CODE)).c_str()), ErrorManager::GetInstance().GetLogHeader().c_str(), \
##__VA_ARGS__)
#define GELOGW(fmt, ...) \ #define GELOGW(fmt, ...) \
if (IsLogEnable(GE_MODULE_NAME, DLOG_WARN)) \ if (IsLogEnable(GE_MODULE_NAME, DLOG_WARN)) \
dlog_warn(GE_MODULE_NAME, "%lu %s:" fmt, GeLog::GetTid(), __FUNCTION__, ##__VA_ARGS__) dlog_warn(GE_MODULE_NAME, "%lu %s:" fmt, GeLog::GetTid(), __FUNCTION__, ##__VA_ARGS__)

@ -255,10 +255,10 @@
exec_expr1; \ exec_expr1; \
} }
#define GE_ERRORLOG_AND_ERRORMSG(_status, errormsg) \ #define GE_ERRORLOG_AND_ERRORMSG(_status, errormsg) \
{ \ { \
GELOGE(_status, "%s", errormsg); \ GELOGE(_status, "[Check][InnerData]%s", errormsg); \
ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {errormsg}); \ REPORT_INNER_ERROR("E19999", "%s", errormsg); \
} }
#define GE_WARNINGLOG_AND_ERRORMSG(errormsg) \ #define GE_WARNINGLOG_AND_ERRORMSG(errormsg) \

@ -113,12 +113,12 @@
} while (0) } while (0)
// Check if the parameter is null. If yes, return PARAM_INVALID and record the error // Check if the parameter is null. If yes, return PARAM_INVALID and record the error
#define GE_CHECK_NOTNULL(val) \ #define GE_CHECK_NOTNULL(val) \
do { \ do { \
if (val == nullptr) { \ if (val == nullptr) { \
DOMI_LOGE("param[%s] must not be null.", #val); \ DOMI_LOGE("[Check][Param:%s]null is invalid when %s.", #val, __FUNCTION__); \
return ge::PARAM_INVALID; \ return ge::PARAM_INVALID; \
} \ } \
} while (0) } while (0)
// Check if the parameter is null. If yes, just return and record the error // Check if the parameter is null. If yes, just return and record the error

@ -1 +1 @@
Subproject commit deebd59d7ea015d7907db525596213492fe021b0 Subproject commit eef990b3d8669065a969dfa6b1097eac09d601d4

@ -1 +1 @@
Subproject commit eb4d9f3aa4cd0b567e3af6149e48ca2b15a3339e Subproject commit 34464de38871aa46b0c7043798f96d340684a8cf

@ -38,6 +38,7 @@ include_directories(${GE_CODE_DIR}/metadef/inc)
include_directories(${GE_CODE_DIR}/metadef/inc/graph) include_directories(${GE_CODE_DIR}/metadef/inc/graph)
include_directories(${GE_CODE_DIR}/metadef/inc/common) include_directories(${GE_CODE_DIR}/metadef/inc/common)
include_directories(${GE_CODE_DIR}/metadef/third_party) include_directories(${GE_CODE_DIR}/metadef/third_party)
include_directories(${GE_CODE_DIR}/metadef/third_party/transformer/inc)
include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc) include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc)
include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/ops) include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc/ops)
include_directories(${CMAKE_BINARY_DIR}) include_directories(${CMAKE_BINARY_DIR})
@ -98,8 +99,8 @@ set(SRC_FILES
"${GE_CODE_DIR}/metadef/graph/utils/transformer_utils.cc" "${GE_CODE_DIR}/metadef/graph/utils/transformer_utils.cc"
"${GE_CODE_DIR}/metadef/graph/runtime_inference_context.cc" "${GE_CODE_DIR}/metadef/graph/runtime_inference_context.cc"
"${GE_CODE_DIR}/metadef/graph/ref_relation.cc" "${GE_CODE_DIR}/metadef/graph/ref_relation.cc"
"${GE_CODE_DIR}/metadef/third_party/transformer/src/transfer_shape_according_to_format.cpp" "${GE_CODE_DIR}/metadef/third_party/transformer/src/transfer_shape_according_to_format.cc"
"${GE_CODE_DIR}/metadef/third_party/transformer/src/axis_util.cpp" "${GE_CODE_DIR}/metadef/third_party/transformer/src/axis_util.cc"
) )
#add_executable(ut_libgraph ${UT_FILES} ${SRC_FILES} ${PROTO_SRCS} ${PROTO_HDRS}) #add_executable(ut_libgraph ${UT_FILES} ${SRC_FILES} ${PROTO_SRCS} ${PROTO_HDRS})

@ -55,6 +55,7 @@ include_directories(${GE_CODE_DIR}/metadef/inc/graph)
include_directories(${GE_CODE_DIR}/inc/framework) include_directories(${GE_CODE_DIR}/inc/framework)
include_directories(${GE_CODE_DIR}/metadef/inc/common) include_directories(${GE_CODE_DIR}/metadef/inc/common)
include_directories(${GE_CODE_DIR}/metadef/third_party) include_directories(${GE_CODE_DIR}/metadef/third_party)
include_directories(${GE_CODE_DIR}/metadef/third_party/transformer/inc)
include_directories(${GE_CODE_DIR}/parser) include_directories(${GE_CODE_DIR}/parser)
include_directories(${GE_CODE_DIR}/parser/parser) include_directories(${GE_CODE_DIR}/parser/parser)
include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc) include_directories(${GE_CODE_DIR}/third_party/fwkacllib/inc)
@ -87,8 +88,8 @@ set(GRAPH_SRC_FILES
"${GE_CODE_DIR}/metadef/graph/node.cc" "${GE_CODE_DIR}/metadef/graph/node.cc"
"${GE_CODE_DIR}/metadef/graph/runtime_inference_context.cc" "${GE_CODE_DIR}/metadef/graph/runtime_inference_context.cc"
"${GE_CODE_DIR}/metadef/graph/op_desc.cc" "${GE_CODE_DIR}/metadef/graph/op_desc.cc"
"${GE_CODE_DIR}/metadef/third_party/transformer/src/transfer_shape_according_to_format.cpp" "${GE_CODE_DIR}/metadef/third_party/transformer/src/transfer_shape_according_to_format.cc"
"${GE_CODE_DIR}/metadef/third_party/transformer/src/axis_util.cpp" "${GE_CODE_DIR}/metadef/third_party/transformer/src/axis_util.cc"
"${GE_CODE_DIR}/metadef/graph/operator.cc" "${GE_CODE_DIR}/metadef/graph/operator.cc"
"${GE_CODE_DIR}/metadef/graph/operator_factory.cc" "${GE_CODE_DIR}/metadef/graph/operator_factory.cc"
"${GE_CODE_DIR}/metadef/graph/operator_factory_impl.cc" "${GE_CODE_DIR}/metadef/graph/operator_factory_impl.cc"

@ -9136,23 +9136,23 @@ TEST_F(UtestFormatTransferNdFractNz, invalid_src_data_type2) {
EXPECT_EQ(transfer.TransFormat(args, result), ACL_ERROR_GE_DATATYPE_INVALID); EXPECT_EQ(transfer.TransFormat(args, result), ACL_ERROR_GE_DATATYPE_INVALID);
} }
TEST_F(UtestFormatTransferNdFractNz, invalid_src_data_type3) { // TEST_F(UtestFormatTransferNdFractNz, invalid_src_data_type3) {
uint16_t data[1 * 1 * 1 * 16 * 16] = {0}; // uint16_t data[1 * 1 * 1 * 16 * 16] = {0};
TransArgs args{reinterpret_cast<uint8_t *>(data), // TransArgs args{reinterpret_cast<uint8_t *>(data),
FORMAT_FRACTAL_NZ, // FORMAT_FRACTAL_NZ,
FORMAT_NHWC, // FORMAT_NHWC,
{1, 1, 1, 16, 16}, // {1, 1, 1, 16, 16},
{ // {
1, // 1,
1, // 1,
4, // 4,
4, // 4,
}, // },
DT_VARIANT}; // DT_VARIANT};
TransResult result; // TransResult result;
FormatTransferFractalNzND transfer; // FormatTransferFractalNzND transfer;
EXPECT_EQ(transfer.TransFormat(args, result), ACL_ERROR_GE_DATATYPE_INVALID); // EXPECT_EQ(transfer.TransFormat(args, result), ACL_ERROR_GE_DATATYPE_INVALID);
} // }
TEST_F(UtestFormatTransferNdFractNz, invalid_dst_format2) { TEST_F(UtestFormatTransferNdFractNz, invalid_dst_format2) {
uint16_t data[1 * 1 * 1 * 1 * 16 * 16] = {0}; uint16_t data[1 * 1 * 1 * 1 * 16 * 16] = {0};

@ -5354,14 +5354,14 @@ TEST_F(UtestFormatTransferNhwcFz, build_transfer_uint8) {
EXPECT_NE(transfer, nullptr); EXPECT_NE(transfer, nullptr);
} }
TEST_F(UtestFormatTransferNhwcFz, invalid_data_type) { // TEST_F(UtestFormatTransferNhwcFz, invalid_data_type) {
uint16_t data[1 * 4 * 4 * 1] = {0}; // uint16_t data[1 * 4 * 4 * 1] = {0};
TransArgs args{ // TransArgs args{
reinterpret_cast<uint8_t *>(data), FORMAT_NHWC, FORMAT_FRACTAL_NZ, {1, 4, 4}, {1, 1, 1, 16, 16}, DT_VARIANT}; // reinterpret_cast<uint8_t *>(data), FORMAT_NHWC, FORMAT_FRACTAL_NZ, {1, 4, 4}, {1, 1, 1, 16, 16}, DT_VARIANT};
FormatTransferFractalZ transfer; // FormatTransferFractalZ transfer;
EXPECT_EQ(transfer.TransShape(args.src_format, args.src_shape, args.src_data_type, args.dst_format, args.dst_shape), // EXPECT_EQ(transfer.TransShape(args.src_format, args.src_shape, args.src_data_type, args.dst_format, args.dst_shape),
ACL_ERROR_GE_DATATYPE_INVALID); // ACL_ERROR_GE_DATATYPE_INVALID);
} // }
TEST_F(UtestFormatTransferNhwcFz, invalid_data_format) { TEST_F(UtestFormatTransferNhwcFz, invalid_data_format) {
uint16_t data[1 * 4 * 4 * 1] = {0}; uint16_t data[1 * 4 * 4 * 1] = {0};

@ -52,34 +52,34 @@ TEST_F(UtestFormatTransfer, build_unsupported_transfer) {
EXPECT_EQ(transfer2, nullptr); EXPECT_EQ(transfer2, nullptr);
} }
TEST_F(UtestFormatTransfer, get_size_by_data_type) { // TEST_F(UtestFormatTransfer, get_size_by_data_type) {
EXPECT_EQ(GetSizeByDataType(DT_FLOAT), 4); // EXPECT_EQ(GetSizeByDataType(DT_FLOAT), 4);
EXPECT_EQ(GetSizeByDataType(DT_FLOAT16), 2); // EXPECT_EQ(GetSizeByDataType(DT_FLOAT16), 2);
EXPECT_EQ(GetSizeByDataType(DT_INT8), 1); // EXPECT_EQ(GetSizeByDataType(DT_INT8), 1);
EXPECT_EQ(GetSizeByDataType(DT_INT16), 2); // EXPECT_EQ(GetSizeByDataType(DT_INT16), 2);
EXPECT_EQ(GetSizeByDataType(DT_UINT16), 2); // EXPECT_EQ(GetSizeByDataType(DT_UINT16), 2);
EXPECT_EQ(GetSizeByDataType(DT_UINT8), 1); // EXPECT_EQ(GetSizeByDataType(DT_UINT8), 1);
EXPECT_EQ(GetSizeByDataType(DT_INT32), 4); // EXPECT_EQ(GetSizeByDataType(DT_INT32), 4);
EXPECT_EQ(GetSizeByDataType(DT_INT64), 8); // EXPECT_EQ(GetSizeByDataType(DT_INT64), 8);
EXPECT_EQ(GetSizeByDataType(DT_UINT32), 4); // EXPECT_EQ(GetSizeByDataType(DT_UINT32), 4);
EXPECT_EQ(GetSizeByDataType(DT_UINT64), 8); // EXPECT_EQ(GetSizeByDataType(DT_UINT64), 8);
EXPECT_EQ(GetSizeByDataType(DT_BOOL), 1); // EXPECT_EQ(GetSizeByDataType(DT_BOOL), 1);
EXPECT_EQ(GetSizeByDataType(DT_DOUBLE), 8); // EXPECT_EQ(GetSizeByDataType(DT_DOUBLE), 8);
EXPECT_EQ(GetSizeByDataType(DT_STRING), -1); // EXPECT_EQ(GetSizeByDataType(DT_STRING), -1);
EXPECT_EQ(GetSizeByDataType(DT_DUAL_SUB_INT8), 1); // EXPECT_EQ(GetSizeByDataType(DT_DUAL_SUB_INT8), 1);
EXPECT_EQ(GetSizeByDataType(DT_DUAL_SUB_UINT8), 1); // EXPECT_EQ(GetSizeByDataType(DT_DUAL_SUB_UINT8), 1);
EXPECT_EQ(GetSizeByDataType(DT_COMPLEX64), 8); // EXPECT_EQ(GetSizeByDataType(DT_COMPLEX64), 8);
EXPECT_EQ(GetSizeByDataType(DT_COMPLEX128), 16); // EXPECT_EQ(GetSizeByDataType(DT_COMPLEX128), 16);
EXPECT_EQ(GetSizeByDataType(DT_QINT8), 1); // EXPECT_EQ(GetSizeByDataType(DT_QINT8), 1);
EXPECT_EQ(GetSizeByDataType(DT_QINT16), 2); // EXPECT_EQ(GetSizeByDataType(DT_QINT16), 2);
EXPECT_EQ(GetSizeByDataType(DT_QINT32), 4); // EXPECT_EQ(GetSizeByDataType(DT_QINT32), 4);
EXPECT_EQ(GetSizeByDataType(DT_QUINT8), 1); // EXPECT_EQ(GetSizeByDataType(DT_QUINT8), 1);
EXPECT_EQ(GetSizeByDataType(DT_QUINT16), 2); // EXPECT_EQ(GetSizeByDataType(DT_QUINT16), 2);
EXPECT_EQ(GetSizeByDataType(DT_RESOURCE), -1); // EXPECT_EQ(GetSizeByDataType(DT_RESOURCE), -1);
EXPECT_EQ(GetSizeByDataType(DT_STRING_REF), -1); // EXPECT_EQ(GetSizeByDataType(DT_STRING_REF), -1);
EXPECT_EQ(GetSizeByDataType(DT_DUAL), 5); // EXPECT_EQ(GetSizeByDataType(DT_DUAL), 5);
EXPECT_EQ(GetSizeByDataType(DT_UNDEFINED), -1); // EXPECT_EQ(GetSizeByDataType(DT_UNDEFINED), -1);
EXPECT_EQ(DT_UNDEFINED, 27); // EXPECT_EQ(DT_UNDEFINED, 27);
} // }
} // namespace formats } // namespace formats
} // namespace ge } // namespace ge

Loading…
Cancel
Save