!1222 error log modify

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

@ -52,7 +52,9 @@ constexpr char const *kAttrSupportDynamicShape = "support_dynamicshape";
const int64_t kDynamicDimValue = -2; const int64_t kDynamicDimValue = -2;
std::map<ge::OpEngineType, std::string> engine_type_map{ std::map<ge::OpEngineType, std::string> engine_type_map{
{ge::ENGINE_SYS, kEngineNameDefault}, {ge::ENGINE_AICORE, kAIcoreEngine}, {ge::ENGINE_VECTOR, kVectorEngine}}; {ge::ENGINE_SYS, kEngineNameDefault},
{ge::ENGINE_AICORE, kAIcoreEngine},
{ge::ENGINE_VECTOR, kVectorEngine}};
bool ContainsDynamicInpus(const ge::OpDesc &op_desc) { bool ContainsDynamicInpus(const ge::OpDesc &op_desc) {
for (auto &tensor_desc : op_desc.GetAllInputsDescPtr()) { for (auto &tensor_desc : op_desc.GetAllInputsDescPtr()) {
@ -84,7 +86,7 @@ static Status CheckEngineTypeSupport(const NodePtr &node, OpEngineType engine_ty
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 kEngineNameDefault/kAIcoreEngine/kVectorEngine"});
GELOGE(FAILED, "CheckEngineType: engine type: %d not support", static_cast<int>(engine_type)); GELOGE(FAILED, "CheckEngineType: engine type: %d not support.", static_cast<int>(engine_type));
return FAILED; return FAILED;
} }
@ -188,17 +190,17 @@ 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, "Add input desc fail");
GE_CHK_BOOL_EXEC(data_op->AddOutputDesc(tensor) == GRAPH_SUCCESS, return FAILED, "Add output desc fail."); GE_CHK_BOOL_EXEC(data_op->AddOutputDesc(tensor) == GRAPH_SUCCESS, return FAILED, "Add output desc fail");
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 index fail");
} }
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[%s->%s] fail", data_op->GetName().c_str(), node->GetName().c_str());
return SUCCESS; return SUCCESS;
} }
@ -213,20 +215,20 @@ 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 input desc fail.");
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 output desc fail.");
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, "Insert Output node fail");
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[%s->%s] fail", node->GetName().c_str(), out_node->GetName().c_str());
} }
return SUCCESS; return SUCCESS;
@ -246,7 +248,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/");
@ -331,7 +333,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));
@ -710,7 +712,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 engine type failed");
return ret; return ret;
} }
} }
@ -784,9 +786,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;
} }

@ -64,7 +64,7 @@ Status AssignByLabelPass::Run(ComputeGraphPtr graph, const vector<SubgraphPtr> &
subgraph->stream_id = iter->second; subgraph->stream_id = iter->second;
} else { } else {
subgraph->stream_id = next_stream; subgraph->stream_id = next_stream;
GELOGI("Assign new stream %ld for label %s.", next_stream, stream_label.c_str()); GELOGI("Assign new stream %ld for label %s", next_stream, stream_label.c_str());
label_streams.emplace(stream_label, next_stream); label_streams.emplace(stream_label, next_stream);
++next_stream; ++next_stream;
@ -96,7 +96,7 @@ Status IndependentStreamPass::Run(ComputeGraphPtr graph, const vector<SubgraphPt
subgraph->stream_id = iter->second; subgraph->stream_id = iter->second;
} else { } else {
subgraph->stream_id = next_stream; subgraph->stream_id = next_stream;
GELOGI("Assign new independent stream %ld for engine %s (label: %s).", next_stream, engine.c_str(), GELOGI("Assign new independent stream %ld for engine %s (label: %s)", next_stream, engine.c_str(),
stream_label.c_str()); stream_label.c_str());
label_streams.emplace(stream_label, next_stream); label_streams.emplace(stream_label, next_stream);
@ -127,7 +127,7 @@ Status AssignByDependencyPass::Run(ComputeGraphPtr graph, const vector<SubgraphP
} else { } else {
int64_t stream_id = AssignNewStream(reusable_subgraph); int64_t stream_id = AssignNewStream(reusable_subgraph);
subgraph->stream_id = stream_id; subgraph->stream_id = stream_id;
GELOGI("Reusable subgraph %s has not been assigned a stream, now assign new stream %ld.", GELOGI("Reusable subgraph %s has not been assigned a stream, now assign new stream %ld",
reusable_subgraph->name.c_str(), stream_id); reusable_subgraph->name.c_str(), stream_id);
} }
@ -137,7 +137,7 @@ Status AssignByDependencyPass::Run(ComputeGraphPtr graph, const vector<SubgraphP
subgraph->reused_subgraph = reusable_subgraph; subgraph->reused_subgraph = reusable_subgraph;
reused_subgraphs_.emplace_back(subgraph, reusable_subgraph); reused_subgraphs_.emplace_back(subgraph, reusable_subgraph);
GELOGI("Subgraph %s of engine %s reuses stream of subgraph %s of engine %s.", subgraph->name.c_str(), GELOGI("Subgraph %s of engine %s reuses stream of subgraph %s of engine %s", subgraph->name.c_str(),
subgraph->engine_conf.id.c_str(), reusable_subgraph->name.c_str(), subgraph->engine_conf.id.c_str(), reusable_subgraph->name.c_str(),
reusable_subgraph->engine_conf.id.c_str()); reusable_subgraph->engine_conf.id.c_str());
} else { } else {
@ -249,7 +249,7 @@ int64_t AssignByDependencyPass::AssignNewStream(SubgraphPtr subgraph) {
engine_stream_num_[engine_name] = stream_id + 1; engine_stream_num_[engine_name] = stream_id + 1;
} }
GELOGI("Subgraph %s assigns new temp stream %ld (engine: %s).", subgraph->name.c_str(), stream_id, GELOGI("Subgraph %s assigns new temp stream %ld (engine: %s)", subgraph->name.c_str(), stream_id,
engine_name.c_str()); engine_name.c_str());
return stream_id; return stream_id;
@ -282,7 +282,7 @@ void AssignByDependencyPass::UpdateAssignedSubgraphs(Context &context) {
GELOGI("Subgraph %s of engine %s reuses default stream %ld.", subgraph->name.c_str(), GELOGI("Subgraph %s of engine %s reuses default stream %ld.", subgraph->name.c_str(),
subgraph->engine_conf.id.c_str(), context.default_stream); subgraph->engine_conf.id.c_str(), context.default_stream);
} else { } else {
GELOGI("Stream of subgraph %s has been updated to %ld.", subgraph->name.c_str(), subgraph->stream_id); GELOGI("Stream of subgraph %s has been updated to %ld", subgraph->name.c_str(), subgraph->stream_id);
} }
} }
} }
@ -293,7 +293,7 @@ void AssignByDependencyPass::UpdateReusedSubgraphs() {
auto &cur_subgraph = item.first; auto &cur_subgraph = item.first;
auto &reused_graph = item.second; auto &reused_graph = item.second;
cur_subgraph->stream_id = reused_graph->stream_id; cur_subgraph->stream_id = reused_graph->stream_id;
GELOGI("Stream of subgraph %s has been updated to %ld.", cur_subgraph->name.c_str(), cur_subgraph->stream_id); GELOGI("Stream of subgraph %s has been updated to %ld", cur_subgraph->name.c_str(), cur_subgraph->stream_id);
} }
} }
@ -330,7 +330,7 @@ Status NodeStreamUpdatePass::Run(ComputeGraphPtr graph, const vector<SubgraphPtr
engine_name.c_str()); engine_name.c_str());
return INTERNAL_ERROR; return INTERNAL_ERROR;
} else { } else {
GELOGI("Subgraph %s is assigned stream %ld (engine: %s).", subgraph->name.c_str(), subgraph->stream_id, GELOGI("Subgraph %s is assigned stream %ld (engine: %s)", subgraph->name.c_str(), subgraph->stream_id,
engine_name.c_str()); engine_name.c_str());
} }
} }
@ -353,11 +353,11 @@ Status NodeStreamUpdatePass::Run(ComputeGraphPtr graph, const vector<SubgraphPtr
GELOGD("Node %s of type %s in subgraph %s is assigned parent stream %ld (engine: %s).", node->GetName().c_str(), GELOGD("Node %s of type %s in subgraph %s is assigned parent stream %ld (engine: %s).", node->GetName().c_str(),
node->GetType().c_str(), subgraph->name.c_str(), context.default_stream, engine_name.c_str()); node->GetType().c_str(), subgraph->name.c_str(), context.default_stream, engine_name.c_str());
} else if (IsEngineSkip(*subgraph) && node->GetInNodes().empty()) { } else if (IsEngineSkip(*subgraph) && node->GetInNodes().empty()) {
GELOGD("Node %s of type %s in subgraph %s doesn't need to assign a stream (engine: %s).", GELOGD("Node %s of type %s in subgraph %s doesn't need to assign a stream (engine: %s)",
node->GetName().c_str(), node->GetType().c_str(), subgraph->name.c_str(), engine_name.c_str()); node->GetName().c_str(), node->GetType().c_str(), subgraph->name.c_str(), engine_name.c_str());
} else { } else {
node->GetOpDesc()->SetStreamId(stream_id); node->GetOpDesc()->SetStreamId(stream_id);
GELOGD("Node %s of type %s in subgraph %s is assigned stream %ld (engine: %s).", node->GetName().c_str(), GELOGD("Node %s of type %s in subgraph %s is assigned stream %ld (engine: %s)", node->GetName().c_str(),
node->GetType().c_str(), subgraph->name.c_str(), stream_id, engine_name.c_str()); node->GetType().c_str(), subgraph->name.c_str(), stream_id, engine_name.c_str());
} }
} }
@ -387,7 +387,7 @@ int64_t UpdateForSkippedEnginePass::GetSingleInoutStream(const NodePtr &node) co
if (stream_ids.size() == 1) { if (stream_ids.size() == 1) {
int64_t stream_id = *(stream_ids.begin()); int64_t stream_id = *(stream_ids.begin());
GELOGI("The stream of all input and output nodes of node %s (type: %s) is %ld.", node->GetName().c_str(), GELOGI("The stream of all input and output nodes of node %s (type: %s) is %ld", node->GetName().c_str(),
node->GetType().c_str(), stream_id); node->GetType().c_str(), stream_id);
return stream_id; return stream_id;
} }
@ -427,7 +427,7 @@ Status UpdateForSkippedEnginePass::Run(ComputeGraphPtr graph, const vector<Subgr
int64_t inout_stream = GetSingleInoutStream(node); int64_t inout_stream = GetSingleInoutStream(node);
if (inout_stream != kInvalidStream) { if (inout_stream != kInvalidStream) {
op_desc->SetStreamId(inout_stream); op_desc->SetStreamId(inout_stream);
GELOGI("Node %s of type %s reassign to stream %ld from stream %ld.", node->GetName().c_str(), GELOGI("Node %s of type %s reassign to stream %ld from stream %ld", node->GetName().c_str(),
node->GetType().c_str(), inout_stream, stream_id); node->GetType().c_str(), inout_stream, stream_id);
} }
} }
@ -455,7 +455,7 @@ Status AllReduceParallelPass::Run(ComputeGraphPtr graph, const vector<SubgraphPt
return NOT_CHANGED; return NOT_CHANGED;
} }
GELOGI("AllReduceParallelPass is enabled."); GELOGI("AllReduceParallelPass is enabled");
GE_DUMP(graph, "BeforeAllReduceParallel"); GE_DUMP(graph, "BeforeAllReduceParallel");
// All successors of HcomAllReduce. // All successors of HcomAllReduce.
@ -565,7 +565,7 @@ Status LogicalStreamAllocator::Assign(const ComputeGraphPtr &root_graph, const G
RefreshContinuousStreams(root_graph); RefreshContinuousStreams(root_graph);
stream_num = context_.next_stream; stream_num = context_.next_stream;
GELOGI("Assigned logical stream num: %ld.", stream_num); GELOGI("Assigned logical stream num: %ld", stream_num);
return SUCCESS; return SUCCESS;
} }
@ -597,10 +597,10 @@ Status LogicalStreamAllocator::DoAssign(const ComputeGraphPtr &graph, const Grap
return status; return status;
} }
GELOGD("Subgraphs of graph %s:", graph->GetName().c_str()); GELOGD("Subgraphs of graph %s.", graph->GetName().c_str());
for (const auto &subgraph : subgraphs) { for (const auto &subgraph : subgraphs) {
if (subgraph != nullptr) { if (subgraph != nullptr) {
GELOGD("subgraph: %s", subgraph->name.c_str()); GELOGD("subgraph: %s.", subgraph->name.c_str());
} }
} }
@ -664,9 +664,9 @@ Status LogicalStreamAllocator::RunPasses(const ComputeGraphPtr &graph, const vec
Status status = pass->Run(graph, subgraphs, context_); Status status = pass->Run(graph, subgraphs, context_);
if (status == SUCCESS) { if (status == SUCCESS) {
GELOGD("Stream pass %s return SUCCESS.", pass->GetName().c_str()); GELOGD("Stream pass %s return SUCCESS", pass->GetName().c_str());
} else if (status == NOT_CHANGED) { } else if (status == NOT_CHANGED) {
GELOGD("Stream pass %s return NOT_CHANGED.", pass->GetName().c_str()); GELOGD("Stream pass %s return NOT_CHANGED", pass->GetName().c_str());
} else { } else {
GELOGE(status, "Stream pass %s failed.", pass->GetName().c_str()); GELOGE(status, "Stream pass %s failed.", pass->GetName().c_str());
return status; return status;

@ -70,7 +70,10 @@ Status BinaryBlockMemAssigner::GetMemoryRanges(vector<int64_t> &range_ceils) {
return SUCCESS; return SUCCESS;
} }
if ((all_memory_size.front() <= 0) || (log(kLogBase) == 0)) { if ((all_memory_size.front() <= 0) || (log(kLogBase) == 0)) {
GELOGE(FAILED, "Memory size:%ld is invalid.", all_memory_size.front()); GELOGE(FAILED, "[Check][MemRangeStep]first mem_range_step:%ld less than 0,invalid,"
"maybe has dynamic shape in graph", all_memory_size.front());
REPORT_INNER_ERROR("E19999", "first mem_range_step:%ld less than 0,invalid,"
"maybe has dynamic shape in graph", all_memory_size.front());
return FAILED; return FAILED;
} }
// Memory size is 512 aligned, so it is not necessary to take less than 512 // Memory size is 512 aligned, so it is not necessary to take less than 512
@ -81,12 +84,18 @@ Status BinaryBlockMemAssigner::GetMemoryRanges(vector<int64_t> &range_ceils) {
GELOGD("Range number: %zu", range_number); GELOGD("Range number: %zu", range_number);
vector<vector<int64_t>> ranges(range_number); vector<vector<int64_t>> ranges(range_number);
GE_CHK_BOOL_EXEC((range_number != 0), return PARAM_INVALID, "range_number can't be 0."); GE_CHK_BOOL_EXEC((range_number != 0),
REPORT_INNER_ERROR("E19999", "inner data[range_number] is 0, judge invalid");
return PARAM_INVALID,
"[Check][RangeNumber]inner data is 0, judge invalid.");
size_t range_number_limit = all_memory_size.size() / range_number; size_t range_number_limit = all_memory_size.size() / range_number;
int64_t range_ceil = min_memory_size; int64_t range_ceil = min_memory_size;
for (size_t i = 1; i <= range_number; i++) { for (size_t i = 1; i <= range_number; i++) {
GE_IF_BOOL_EXEC(TypeUtils::CheckUint64MulOverflow(static_cast<uint64_t>(range_ceil), kRangeCeilInterval), GE_IF_BOOL_EXEC(TypeUtils::CheckUint64MulOverflow(static_cast<uint64_t>(range_ceil), kRangeCeilInterval),
GELOGE(FAILED, "Multiply result is out of range."); GELOGE(FAILED, "[Check][MemRangeCeil]Multiply result is out of range,"
"range_ceil:%ld, interval:%u", range_ceil, kRangeCeilInterval);
REPORT_INNER_ERROR("E19999", "process mem_range_ceil,multiply result out of range,"
"range_ceil:%ld, interval:%u", range_ceil, kRangeCeilInterval);
return FAILED); return FAILED);
range_ceil *= kRangeCeilInterval; // The block size of each interval is doubled every time. range_ceil *= kRangeCeilInterval; // The block size of each interval is doubled every time.
for (auto iter = all_memory_size.begin(); iter != all_memory_size.end();) { for (auto iter = all_memory_size.begin(); iter != all_memory_size.end();) {

File diff suppressed because it is too large Load Diff

@ -101,7 +101,7 @@ CachingAllocator::CachingAllocator(rtMemType_t memory_type) : memory_type_(memor
} }
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_);
@ -124,14 +124,14 @@ 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; uint8_t *ptr = nullptr;
size = GetBlockSize(size); size = GetBlockSize(size);
Block *block = FindFreeBlock(size, org_ptr, device_id); Block *block = FindFreeBlock(size, org_ptr, device_id);
@ -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;
@ -174,7 +174,7 @@ 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;
@ -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,7 +313,7 @@ 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) {

@ -20,6 +20,7 @@
#include <cstdint> #include <cstdint>
#include "framework/common/ge_inner_error_codes.h" #include "framework/common/ge_inner_error_codes.h"
#include "common/util/error_manager/error_manager.h"
#include "toolchain/slog.h" #include "toolchain/slog.h"
#ifdef __GNUC__ #ifdef __GNUC__
#include <unistd.h> #include <unistd.h>
@ -55,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__)

@ -1 +1 @@
Subproject commit 6b802ec3cf711e9942a7e2a74f04a53647aae473 Subproject commit deebd59d7ea015d7907db525596213492fe021b0

@ -1 +1 @@
Subproject commit 6a07f1a8b9b8b4630a5b60d9d8d02ec4a6314d68 Subproject commit eb4d9f3aa4cd0b567e3af6149e48ca2b15a3339e

@ -18,6 +18,8 @@
using namespace ErrorMessage; using namespace ErrorMessage;
thread_local Context ErrorManager::error_context_ = {0, "", "", ""};
ErrorManager &ErrorManager::GetInstance() { ErrorManager &ErrorManager::GetInstance() {
static ErrorManager instance; static ErrorManager instance;
return instance; return instance;
@ -40,6 +42,10 @@ using namespace ErrorMessage;
return 0; return 0;
} }
int ErrorManager::ReportInterErrMessage(std::string error_code, const std::string &error_msg) {
return 0;
}
/// ///
/// @brief output error message /// @brief output error message
/// @param [in] handle: print handle /// @param [in] handle: print handle
@ -84,7 +90,7 @@ using namespace ErrorMessage;
void ErrorManager::GenWorkStreamIdBySessionGraph(uint64_t session_id, uint64_t graph_id) {} void ErrorManager::GenWorkStreamIdBySessionGraph(uint64_t session_id, uint64_t graph_id) {}
const std::string &ErrorManager::GetLogHeader() { return "[TEST][TEST]"; } const std::string &ErrorManager::GetLogHeader() { return error_context_.log_header; }
struct Context &ErrorManager::GetErrorContext() { struct Context &ErrorManager::GetErrorContext() {
struct Context error_context; struct Context error_context;

@ -269,7 +269,7 @@ CHAR *mmDlerror()
INT32 mmDladdr(VOID *addr, mmDlInfo *info) INT32 mmDladdr(VOID *addr, mmDlInfo *info)
{ {
return 0; return -1;
} }
VOID *mmDlopen(const CHAR *fileName, INT32 mode) VOID *mmDlopen(const CHAR *fileName, INT32 mode)

Loading…
Cancel
Save