From 61b239ef31cb81a4459dc0a8fd3fe64557be5aa0 Mon Sep 17 00:00:00 2001 From: "liyihan2@huawei.com" Date: Tue, 6 Apr 2021 11:32:20 +0800 Subject: [PATCH] format log optimize --- .../format_transfer_fracz_hwcn.cc | 20 +++---- .../format_transfer_fracz_nchw.cc | 24 ++++----- .../format_transfer_fracz_nhwc.cc | 22 ++++---- .../format_transfer_hwcn_c1hwncoc0.cc | 25 +++++---- .../format_transfer_nc1hwc0_nchw.cc | 24 +++++---- .../format_transfer_nc1hwc0_nhwc.cc | 27 +++++----- .../format_transfer_nchw_fz_c04.cc | 53 ++++++++++--------- .../format_transfer_nchw_nc1hwc0.cc | 24 +++++---- .../format_transfer_nhwc_nc1hwc0.cc | 27 +++++----- .../format_transfer_transpose.cc | 7 +-- 10 files changed, 133 insertions(+), 120 deletions(-) diff --git a/ge/common/formats/format_transfers/format_transfer_fracz_hwcn.cc b/ge/common/formats/format_transfers/format_transfer_fracz_hwcn.cc index 349fa80e..96d19a3f 100755 --- a/ge/common/formats/format_transfers/format_transfer_fracz_hwcn.cc +++ b/ge/common/formats/format_transfers/format_transfer_fracz_hwcn.cc @@ -41,7 +41,7 @@ Status CheckArgsForFracZToHwcn(const TransArgs &args) { return ACL_ERROR_GE_FORMAT_INVALID; } if (!CheckDataTypeSupported(args.src_data_type)) { - GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "[Trans][Shape]Failed, " + GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "[Check][DataType]Failed, " "shape from FORMAT_FRACTAL_Z to HWCN, invalid data type %s", TypeUtils::DataTypeToSerialString(args.src_data_type).c_str()); REPORT_INNER_ERROR("E19999", "Failed to trans shape from FORMAT_FRACTAL_Z to HWCN, " @@ -52,14 +52,14 @@ Status CheckArgsForFracZToHwcn(const TransArgs &args) { if (!CheckShapeValid(src_shape, kFracZDimsNum)) { GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Failed, src shape %s", ShapeToString(src_shape).c_str()); - REPORT_CALL_ERROR("E19999", "Failed to check src shape %s", + REPORT_CALL_ERROR("E19999", "Src shape %s check failed", ShapeToString(src_shape).c_str()); return ACL_ERROR_GE_SHAPE_INVALID; } if (!CheckShapeValid(dst_shape, kHwcnDimsNum)) { GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Failed, dst shape %s", ShapeToString(dst_shape).c_str()); - REPORT_CALL_ERROR("E19999", "Failed to check dst shape %s", + REPORT_CALL_ERROR("E19999", "Dst shape %s check failed", ShapeToString(dst_shape).c_str()); return ACL_ERROR_GE_SHAPE_INVALID; } @@ -76,7 +76,7 @@ Status CheckArgsForFracZToHwcn(const TransArgs &args) { FmtToStr(ShapeToString(dst_shape)); GE_ERRORLOG_AND_ERRORMSG(ACL_ERROR_GE_SHAPE_INVALID, error.c_str()); return ACL_ERROR_GE_SHAPE_INVALID; - } + } return SUCCESS; } @@ -90,11 +90,11 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, const in total_size, ShapeToString(args.dst_shape).c_str(), TypeUtils::FormatToSerialString(args.src_format).c_str(), TypeUtils::FormatToSerialString(args.dst_format).c_str()); - REPORT_INNER_ERROR("E19999", "Failed to alloc the memory for dst buf %ld, shape %s " - "when trans format from %s to %s", - total_size, ShapeToString(args.dst_shape).c_str(), - TypeUtils::FormatToSerialString(args.src_format).c_str(), - TypeUtils::FormatToSerialString(args.dst_format).c_str()); + REPORT_CALL_ERROR("E19999", "Failed to alloc the memory for dst buf %ld, shape %s " + "when trans format from %s to %s", + total_size, ShapeToString(args.dst_shape).c_str(), + TypeUtils::FormatToSerialString(args.src_format).c_str(), + TypeUtils::FormatToSerialString(args.dst_format).c_str()); return ACL_ERROR_GE_MEMORY_ALLOCATION; } @@ -163,7 +163,7 @@ Status FormatTransferFracZHwcn::TransFormat(const TransArgs &args, TransResult & result.length = static_cast(total_size); return SUCCESS; } - GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Get][Shape]Failed, " + GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Get][ShapeSize]Failed, " "total size %ld from dst shape %s, src shape %s", total_size, ShapeToString(args.dst_shape).c_str(), ShapeToString(args.src_shape).c_str()); REPORT_CALL_ERROR("E19999", "Failed to get total size %ld from " diff --git a/ge/common/formats/format_transfers/format_transfer_fracz_nchw.cc b/ge/common/formats/format_transfers/format_transfer_fracz_nchw.cc index bffeee77..2a2ac7a8 100755 --- a/ge/common/formats/format_transfers/format_transfer_fracz_nchw.cc +++ b/ge/common/formats/format_transfers/format_transfer_fracz_nchw.cc @@ -41,7 +41,7 @@ Status CheckArgsForFracZToNchw(const TransArgs &args) { return ACL_ERROR_GE_FORMAT_INVALID; } if (!CheckDataTypeSupported(args.src_data_type)) { - GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "[Trans][Shape]Failed, " + GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "[Check][DataType]Failed, " "shape from FORMAT_FRACTAL_Z to NCHW, invalid data type %s", TypeUtils::DataTypeToSerialString(args.src_data_type).c_str()); REPORT_INNER_ERROR("E19999", "Failed to trans shape from FORMAT_FRACTAL_Z to NCHW, " @@ -52,14 +52,14 @@ Status CheckArgsForFracZToNchw(const TransArgs &args) { if (!CheckShapeValid(src_shape, kFracZDimsNum)) { GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Failed, src shape %s", ShapeToString(src_shape).c_str()); - REPORT_CALL_ERROR("E19999", "Failed to check src shape %s", + REPORT_CALL_ERROR("E19999", "Src shape %s check failed", ShapeToString(src_shape).c_str()); return ACL_ERROR_GE_SHAPE_INVALID; } if (!CheckShapeValid(dst_shape, kNchwDimsNum)) { GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Failed, dst shape %s", ShapeToString(dst_shape).c_str()); - REPORT_CALL_ERROR("E19999", "Failed to check dst shape %s", + REPORT_CALL_ERROR("E19999", "Dst shape %s check failed", ShapeToString(dst_shape).c_str()); return ACL_ERROR_GE_SHAPE_INVALID; } @@ -88,16 +88,16 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, const in std::shared_ptr dst(new (std::nothrow) uint8_t[total_size], std::default_delete()); if (dst == nullptr) { GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, - "[Allocate][DSTMemory]Failed, memory for dst buf %ld, shape %s " + "[Allocate][DSTMemory]Failed, memory for dst buf %ld, shape %s " "when trans format from %s to %s", total_size, ShapeToString(args.dst_shape).c_str(), TypeUtils::FormatToSerialString(args.src_format).c_str(), TypeUtils::FormatToSerialString(args.dst_format).c_str()); - REPORT_INNER_ERROR("E19999", "Failed to alloc the memory for dst buf %ld, shape %s " - "when trans format from %s to %s", - total_size, ShapeToString(args.dst_shape).c_str(), - TypeUtils::FormatToSerialString(args.src_format).c_str(), - TypeUtils::FormatToSerialString(args.dst_format).c_str()); + REPORT_CALL_ERROR("E19999", "Failed to alloc the memory for dst buf %ld, shape %s " + "when trans format from %s to %s", + total_size, ShapeToString(args.dst_shape).c_str(), + TypeUtils::FormatToSerialString(args.src_format).c_str(), + TypeUtils::FormatToSerialString(args.dst_format).c_str()); return ACL_ERROR_GE_MEMORY_ALLOCATION; } @@ -138,7 +138,7 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, const in "[Operate][Memory]Failed to copy data from FracZ offset %ld to " "NCHW[%ld, %ld, %ld, %ld] offset %ld, err-code %d", src_offset, n_idx, c_idx, h_idx, w_idx, dst_offset, ret); - REPORT_CALL_ERROR("E19999","Failed to copy data from FracZ offset %ld to " + REPORT_CALL_ERROR("E19999","Failed to copy data from FracZ offset %ld to " "NCHW[%ld, %ld, %ld, %ld] offset %ld, err-code %d", src_offset, n_idx, c_idx, h_idx, w_idx, dst_offset, ret ); return ACL_ERROR_GE_MEMORY_OPERATE_FAILED; @@ -167,7 +167,7 @@ Status FormatTransferFracZNchw::TransFormat(const TransArgs &args, TransResult & return SUCCESS; } - GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Get][Shape]Failed, total size %ld from dst shape %s, " + GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Get][ShapeSize]Failed, total size %ld from dst shape %s, " "src shape %s", total_size, ShapeToString(args.dst_shape).c_str(), ShapeToString(args.src_shape).c_str()); REPORT_CALL_ERROR("E19999", "Failed to get total size %ld from dst shape %s, src shape %s", @@ -190,7 +190,7 @@ Status FormatTransferFracZNchw::TransFormat(const TransArgs &args, TransResult & "data type %s, dst shape %s, memory size %ld", ShapeToString(args.src_shape).c_str(), TypeUtils::DataTypeToSerialString(args.src_data_type).c_str(), - ShapeToString(args.dst_shape).c_str(), total_size); + ShapeToString(args.dst_shape).c_str(), total_size); return ret; } return SUCCESS; diff --git a/ge/common/formats/format_transfers/format_transfer_fracz_nhwc.cc b/ge/common/formats/format_transfers/format_transfer_fracz_nhwc.cc index 9c3eba35..2a17b7c3 100755 --- a/ge/common/formats/format_transfers/format_transfer_fracz_nhwc.cc +++ b/ge/common/formats/format_transfers/format_transfer_fracz_nhwc.cc @@ -41,7 +41,7 @@ Status CheckArgsForFracZToNhwc(const TransArgs &args) { return ACL_ERROR_GE_FORMAT_INVALID; } if (!CheckDataTypeSupported(args.src_data_type)) { - GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "[Trans][Shape]Failed, " + GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "[Check][DataType]Failed, " "shape from FORMAT_FRACTAL_Z to NCHW, invalid data type %s", TypeUtils::DataTypeToSerialString(args.src_data_type).c_str()); REPORT_INNER_ERROR("E19999", "Failed to trans shape from FORMAT_FRACTAL_Z to NCHW, " @@ -52,14 +52,14 @@ Status CheckArgsForFracZToNhwc(const TransArgs &args) { if (!CheckShapeValid(src_shape, kFracZDimsNum)) { GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Failed, src shape %s", ShapeToString(src_shape).c_str()); - REPORT_CALL_ERROR("E19999", "Failed to check src shape %s", + REPORT_CALL_ERROR("E19999", "Src shape %s check failed", ShapeToString(src_shape).c_str()); return ACL_ERROR_GE_SHAPE_INVALID; } if (!CheckShapeValid(dst_shape, kNhwcDimsNum)) { GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Failed, dst shape %s", ShapeToString(dst_shape).c_str()); - REPORT_CALL_ERROR("E19999", "Failed to check dst shape %s", + REPORT_CALL_ERROR("E19999", "Dst shape %s check failed", ShapeToString(dst_shape).c_str()); return ACL_ERROR_GE_SHAPE_INVALID; } @@ -74,7 +74,7 @@ Status CheckArgsForFracZToNhwc(const TransArgs &args) { GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Failed to check relationship between src and dst shape, " "src shape %s, dst shape %s", - ShapeToString(src_shape).c_str(), ShapeToString(dst_shape).c_str()); + ShapeToString(src_shape).c_str(), ShapeToString(dst_shape).c_str()); REPORT_INNER_ERROR("E19999", "Failed to check relationship between src and dst shape, " "src shape %s, dst shape %s", ShapeToString(src_shape).c_str(), ShapeToString(dst_shape).c_str()); @@ -93,11 +93,11 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, int size total_size, ShapeToString(args.dst_shape).c_str(), TypeUtils::FormatToSerialString(args.src_format).c_str(), TypeUtils::FormatToSerialString(args.dst_format).c_str()); - REPORT_INNER_ERROR("E19999", "Failed to alloc the memory for dst buf %ld, " - "shape %s when trans format from %s to %s", - total_size, ShapeToString(args.dst_shape).c_str(), - TypeUtils::FormatToSerialString(args.src_format).c_str(), - TypeUtils::FormatToSerialString(args.dst_format).c_str()); + REPORT_CALL_ERROR("E19999", "Failed to alloc the memory for dst buf %ld, " + "shape %s when trans format from %s to %s", + total_size, ShapeToString(args.dst_shape).c_str(), + TypeUtils::FormatToSerialString(args.src_format).c_str(), + TypeUtils::FormatToSerialString(args.dst_format).c_str()); return ACL_ERROR_GE_MEMORY_ALLOCATION; } @@ -135,7 +135,7 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, int size static_cast(size)); if (ret != EOK) { GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, - "[Operate][Memory]Failed to copy data from FracZ offset %ld to " + "[Operate][Memory]Failed to copy data from FracZ offset %ld to " "NCHW[%ld, %ld, %ld, %ld] offset %ld, err-code %d", src_offset, n_idx, c_idx, h_idx, w_idx, dst_offset, ret); REPORT_CALL_ERROR("E19999","Failed to copy data from FracZ offset %ld to " @@ -167,7 +167,7 @@ Status FormatTransferFracZNhwc::TransFormat(const TransArgs &args, TransResult & return SUCCESS; } - GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Get][Shape]Failed, total size %ld from dst shape %s, " + GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Get][ShapeSize]Failed, total size %ld from dst shape %s, " "src shape %s", total_size, ShapeToString(args.dst_shape).c_str(), ShapeToString(args.src_shape).c_str()); REPORT_CALL_ERROR("E19999", "Failed to get total size %ld from dst shape %s, src shape %s", diff --git a/ge/common/formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc b/ge/common/formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc index 538f94c1..ba1fd8d4 100755 --- a/ge/common/formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc +++ b/ge/common/formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc @@ -45,7 +45,7 @@ Status TransShapeHwcnToC1hwncoc0(const DataType &data_type, const std::vector &src_shape, Data ShapeToString(src_shape).c_str(), ShapeToString(perm_arg).c_str(), ShapeToString(dst_shape).c_str(), dst_offset_bytes, ShapeToString(dst_indexes).c_str()); REPORT_CALL_ERROR("E19999", "Failed to transpose, src shape %s, perm arg %s, dst shape %s, " - "failed to write to dst offset %ld, current dim offset %s", - ShapeToString(src_shape).c_str(), ShapeToString(perm_arg).c_str(), ShapeToString(dst_shape).c_str(), - dst_offset_bytes, ShapeToString(dst_indexes).c_str()); + "failed to write to dst offset %ld, current dim offset %s", + ShapeToString(src_shape).c_str(), ShapeToString(perm_arg).c_str(), + ShapeToString(dst_shape).c_str(), + dst_offset_bytes, ShapeToString(dst_indexes).c_str()); return ACL_ERROR_GE_MEMORY_OPERATE_FAILED; } AddOne(dst_shape, dst_indexes);