From e143d7e829b7801b4634d9c74ceeec86171e1efe Mon Sep 17 00:00:00 2001 From: "liyihan2@huawei.com" Date: Thu, 1 Apr 2021 11:36:38 +0800 Subject: [PATCH] common formats log optimize --- .../format_transfers/datatype_transfer.cc | 3 +- .../format_transfer_c1hwncoc0_hwcn.cc | 15 +++-- .../format_transfer_dhwcn_fracz3D.cc | 17 ++++-- ...format_transfer_dhwnc_fracz3D_transpose.cc | 17 ++++-- .../format_transfer_fractal_nz.cc | 56 +++++++++++-------- .../format_transfer_fractal_z.cc | 53 ++++++++++++------ .../format_transfer_fractal_zz.cc | 51 ++++++++++------- 7 files changed, 135 insertions(+), 77 deletions(-) diff --git a/ge/common/formats/format_transfers/datatype_transfer.cc b/ge/common/formats/format_transfers/datatype_transfer.cc index df2434d6..48200980 100644 --- a/ge/common/formats/format_transfers/datatype_transfer.cc +++ b/ge/common/formats/format_transfers/datatype_transfer.cc @@ -156,7 +156,8 @@ Status DataTypeTransfer::TransDataType(const CastArgs &args, TransResult &result if (dst == nullptr) { GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][DSTMemory]Failed, memory for dst buf %zu, data size %zu", total_size, args.src_data_size); - REPORT_CALL_ERROR("E19999", "Failed to allocate memory for dst buf %zu, data size %zu", total_size, args.src_data_size); + REPORT_CALL_ERROR("E19999", "Failed to allocate memory for dst buf %zu, data size %zu", + total_size, args.src_data_size); return ACL_ERROR_GE_MEMORY_ALLOCATION; } diff --git a/ge/common/formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc b/ge/common/formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc index 1cd5786e..fcb488af 100644 --- a/ge/common/formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc +++ b/ge/common/formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc @@ -78,10 +78,12 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, int size GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][DSTMemory]Failed to allcoate 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()); + TypeUtils::FormatToSerialString(args.src_format).c_str(), + TypeUtils::FormatToSerialString(args.dst_format).c_str()); REPORT_CALL_ERROR("E19999", "Failed to allcoate 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()); + TypeUtils::FormatToSerialString(args.src_format).c_str(), + TypeUtils::FormatToSerialString(args.dst_format).c_str()); return ACL_ERROR_GE_MEMORY_ALLOCATION; } @@ -126,7 +128,8 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, int size c1_idx, h_idx, w_idx, n_idx, co_idx, c0_idx, src_offset, h_idx, w_idx, c_idx, n_idx, dst_offset, ret); REPORT_CALL_ERROR("E19999", "Failed to copy data from C1HWNCoC0[%ld, %ld, %ld, %ld, %ld, %ld] offset %ld to " "HWCN[%ld, %ld, %ld, %ld] offset %ld, err-code %d", - c1_idx, h_idx, w_idx, n_idx, co_idx, c0_idx, src_offset, h_idx, w_idx, c_idx, n_idx, dst_offset, ret); + c1_idx, h_idx, w_idx, n_idx, co_idx, c0_idx, src_offset, + h_idx, w_idx, c_idx, n_idx, dst_offset, ret); return ACL_ERROR_GE_MEMORY_OPERATE_FAILED; } } @@ -163,10 +166,12 @@ Status FormatTransferC1hwncoc0Hwcn::TransFormat(const TransArgs &args, TransResu ShapeToString(args.dst_shape).c_str(), total_size); ret = GetDstDataAfterTrans(args, result, size, total_size); if (ret != SUCCESS) { - GELOGE(ret, "[Get][Data]Failed when after trans, src shape %s, data type %s, dst shape %s, memory size %ld, error_code %u", + GELOGE(ret, "[Get][Data]Failed when after trans, src shape %s, data type %s, dst shape %s, " + "memory size %ld, error_code %u", ShapeToString(args.src_shape).c_str(), TypeUtils::DataTypeToSerialString(args.src_data_type).c_str(), ShapeToString(args.dst_shape).c_str(), total_size, ret); - REPORT_CALL_ERROR("E19999", "Failed to get data after trans, src shape %s, data type %s, dst shape %s, memory size %ld, error_code %u", + REPORT_CALL_ERROR("E19999", "Failed to get data after trans, src shape %s, data type %s, " + "dst shape %s, memory size %ld, error_code %u", ShapeToString(args.src_shape).c_str(), TypeUtils::DataTypeToSerialString(args.src_data_type).c_str(), ShapeToString(args.dst_shape).c_str(), total_size, ret); return ret; diff --git a/ge/common/formats/format_transfers/format_transfer_dhwcn_fracz3D.cc b/ge/common/formats/format_transfers/format_transfer_dhwcn_fracz3D.cc index 958bede0..ad1e8af7 100644 --- a/ge/common/formats/format_transfers/format_transfer_dhwcn_fracz3D.cc +++ b/ge/common/formats/format_transfers/format_transfer_dhwcn_fracz3D.cc @@ -94,10 +94,14 @@ Status TransFormatDhwckToFz3D(const TransArgs &args, TransResult &result) { std::shared_ptr dst(new (std::nothrow) uint8_t[dst_size], std::default_delete()); if (dst == nullptr) { - GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][DSTMemory]Failed to allcoate memory for dst buf %ld when trans format from %s to %s", - dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(),TypeUtils::FormatToSerialString(args.dst_format).c_str()); + GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][DSTMemory]Failed to allcoate memory for dst buf %ld " + "when trans format from %s to %s", + dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(), + TypeUtils::FormatToSerialString(args.dst_format).c_str()); REPORT_CALL_ERROR("E19999", "Failed to allcoate memory for dst buf %ld when trans format from %s to %s", - dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(),TypeUtils::FormatToSerialString(args.dst_format).c_str()); return ACL_ERROR_GE_MEMORY_ALLOCATION; + dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(), + TypeUtils::FormatToSerialString(args.dst_format).c_str()); + return ACL_ERROR_GE_MEMORY_ALLOCATION; } for (int64_t di = 0; di < d; di++) { @@ -122,9 +126,10 @@ Status TransFormatDhwckToFz3D(const TransArgs &args, TransResult &result) { args.data + src_idx * data_size, static_cast(data_size)); } if (ret != EOK) { - GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, error-code %d, pad mode %d", - dst_offset, ret, pad_zero); - REPORT_CALL_ERROR("E19999", "Failed to operate dst memory at offset %ld, error-code %d, pad mode %d", dst_offset, ret, pad_zero); + GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, " + "error-code %d, pad mode %d", dst_offset, ret, pad_zero); + REPORT_CALL_ERROR("E19999", "Failed to operate dst memory at offset %ld, " + "error-code %d, pad mode %d", dst_offset, ret, pad_zero); return ACL_ERROR_GE_MEMORY_OPERATE_FAILED; } } diff --git a/ge/common/formats/format_transfers/format_transfer_dhwnc_fracz3D_transpose.cc b/ge/common/formats/format_transfers/format_transfer_dhwnc_fracz3D_transpose.cc index 1f2df2b9..d8a49e41 100644 --- a/ge/common/formats/format_transfers/format_transfer_dhwnc_fracz3D_transpose.cc +++ b/ge/common/formats/format_transfers/format_transfer_dhwnc_fracz3D_transpose.cc @@ -95,10 +95,14 @@ Status TransFormatDhwncToFz3DTranspose(const TransArgs &args, TransResult &resul std::shared_ptr dst(new (std::nothrow) uint8_t[dst_size], std::default_delete()); if (dst == nullptr) { - GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][DSTMemory]Failed to allcoate memory for dst buf %ld when trans format from %s to %s", - dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(),TypeUtils::FormatToSerialString(args.dst_format).c_str()); + GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][DSTMemory]Failed to allcoate memory for dst buf %ld " + "when trans format from %s to %s", + dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(), + TypeUtils::FormatToSerialString(args.dst_format).c_str()); REPORT_CALL_ERROR("E19999", "Failed to allcoate memory for dst buf %ld when trans format from %s to %s", - dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(),TypeUtils::FormatToSerialString(args.dst_format).c_str()); return ACL_ERROR_GE_MEMORY_ALLOCATION; + dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(), + TypeUtils::FormatToSerialString(args.dst_format).c_str()); + return ACL_ERROR_GE_MEMORY_ALLOCATION; } for (int64_t di = 0; di < d; di++) { @@ -123,9 +127,10 @@ Status TransFormatDhwncToFz3DTranspose(const TransArgs &args, TransResult &resul args.data + src_idx * data_size, static_cast(data_size)); } if (ret != EOK) { - GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, error-code %d, pad mode %d", - dst_offset, ret, pad_zero); - REPORT_CALL_ERROR("E19999", "Failed to operate dst memory at offset %ld, error-code %d, pad mode %d", dst_offset, ret, pad_zero); + GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, " + "error-code %d, pad mode %d", dst_offset, ret, pad_zero); + REPORT_CALL_ERROR("E19999", "Failed to operate dst memory at offset %ld, " + "error-code %d, pad mode %d", dst_offset, ret, pad_zero); return ACL_ERROR_GE_MEMORY_OPERATE_FAILED; } } diff --git a/ge/common/formats/format_transfers/format_transfer_fractal_nz.cc b/ge/common/formats/format_transfers/format_transfer_fractal_nz.cc index 8cb468ba..75e400a4 100755 --- a/ge/common/formats/format_transfers/format_transfer_fractal_nz.cc +++ b/ge/common/formats/format_transfers/format_transfer_fractal_nz.cc @@ -87,7 +87,8 @@ Status TransShapeToFracNz(const ShapeVector &src_shape, DataType data_type, Shap hw_shape.push_back(DIM_DEFAULT_VALUE); hw_shape.push_back(src_shape[kNdDimIndexN]); if (!IsShapeValid(dst_shape)) { - GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][DSTShape]Failed, dst shape %s", ShapeToString(dst_shape).c_str()); + GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][DSTShape]Failed, dst shape %s", + ShapeToString(dst_shape).c_str()); REPORT_CALL_ERROR("E19999", "Failed to check dst shape %s", ShapeToString(dst_shape).c_str()); return ACL_ERROR_GE_SHAPE_INVALID; } @@ -107,7 +108,8 @@ Status TransShapeToFracNz(const ShapeVector &src_shape, DataType data_type, Shap hw_shape.push_back(src_shape[size - kNdDimCountBackwardsWH]); hw_shape.push_back(src_shape[size - kNdDimCountBackwardsW]); if (!IsShapeValid(dst_shape)) { - GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][DSTShape]Failed, dst shape %s", ShapeToString(dst_shape).c_str()); + GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][DSTShape]Failed, dst shape %s", + ShapeToString(dst_shape).c_str()); REPORT_CALL_ERROR("E19999", "Failed to check dst shape %s", ShapeToString(dst_shape).c_str()); return ACL_ERROR_GE_SHAPE_INVALID; } @@ -119,8 +121,8 @@ Status CheckShapeRelation(const TransArgs &args, ShapeVector &hw_shape) { ShapeVector expect_src_shape; auto ret = TransShapeToFracNz(args.dst_shape, args.src_data_type, expect_src_shape, hw_shape); if (ret != SUCCESS) { - GELOGE(ret, "[Transfer][ShapeToFracNz]Failed, shape from %s to %s, shape %s to %s, data type %s, error_code:%u", - TypeUtils::FormatToSerialString(args.dst_format).c_str(), + GELOGE(ret, "[Transfer][ShapeToFracNz]Failed, shape from %s to %s, shape %s to %s, " + "data type %s, error_code:%u", TypeUtils::FormatToSerialString(args.dst_format).c_str(), TypeUtils::FormatToSerialString(args.src_format).c_str(), ShapeToString(args.dst_shape).c_str(), ShapeToString(args.src_shape).c_str(), TypeUtils::DataTypeToSerialString(args.src_data_type).c_str(), ret); return ret; @@ -141,8 +143,8 @@ Status TransFormatFromNdToFracNz(const TransArgs &args, TransResult &result, con std::shared_ptr dst(new (std::nothrow) uint8_t[dst_size](), std::default_delete()); if (dst == nullptr) { - GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][DSTMemory]Failed to trans format from %s to %s, memory for dst buf %ld", - TypeUtils::FormatToSerialString(args.src_format).c_str(), + GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][DSTMemory]Failed to trans format from %s to %s, " + "memory for dst buf %ld", TypeUtils::FormatToSerialString(args.src_format).c_str(), TypeUtils::FormatToSerialString(args.dst_format).c_str(), dst_size); REPORT_CALL_ERROR("E19999", "Failed to trans format from %s to %s and allocate memory for dst buf %ld", TypeUtils::FormatToSerialString(args.src_format).c_str(), @@ -180,8 +182,10 @@ Status TransFormatFromNdToFracNz(const TransArgs &args, TransResult &result, con auto ret = memcpy_s(dst.get() + dst_offset, static_cast(protected_size), args.data + src_offset, static_cast(size * w0)); if (ret != EOK) { - GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED,"[Operate][DSTMemory]Failed at offset %ld, error-code %d", dst_offset, ret); - REPORT_CALL_ERROR("E19999", "Failed to operate dst memory at offset %ld, error-code %d", dst_offset, ret); + GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED,"[Operate][DSTMemory]Failed at offset %ld, error-code %d", + dst_offset, ret); + REPORT_CALL_ERROR("E19999", "Failed to operate dst memory at offset %ld, error-code %d", + dst_offset, ret); return ACL_ERROR_GE_MEMORY_OPERATE_FAILED; } } @@ -195,8 +199,10 @@ Status TransFormatFromNdToFracNz(const TransArgs &args, TransResult &result, con auto ret = memcpy_s(dst.get() + dst_offset, static_cast(protected_size), args.data + src_offset, static_cast(size)); if (ret != EOK) { - GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED,"[Operate][DSTMemory]Failed at offset %ld, error-code %d", dst_offset, ret); - REPORT_CALL_ERROR("E19999", "Failed to operate dst memory at offset %ld, error-code %d", dst_offset, ret); + GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED,"[Operate][DSTMemory]Failed at offset %ld, error-code %d", + dst_offset, ret); + REPORT_CALL_ERROR("E19999", "Failed to operate dst memory at offset %ld, error-code %d", + dst_offset, ret); return ACL_ERROR_GE_MEMORY_OPERATE_FAILED; } } @@ -217,7 +223,8 @@ Status TransFormatFromFracNzToNd(const TransArgs &args, TransResult &result, con std::shared_ptr dst(new (std::nothrow) uint8_t[dst_size], std::default_delete()); if (dst == nullptr) { - GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][DSTMemory]Failed to trans format from %s to %s, memory for dst buf %ld", + GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][DSTMemory]Failed to trans format from %s to %s, " + "memory for dst buf %ld", TypeUtils::FormatToSerialString(args.src_format).c_str(), TypeUtils::FormatToSerialString(args.dst_format).c_str(), dst_size); REPORT_CALL_ERROR("E19999", "Failed to trans format from %s to %s and allocate memory for dst buf %ld", @@ -256,7 +263,8 @@ Status TransFormatFromFracNzToNd(const TransArgs &args, TransResult &result, con ret = memcpy_s(dst.get() + dst_offset, static_cast(protected_size), args.data + src_offset, static_cast(size * w0)); if (ret != EOK) { - GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, error-code %d", dst_offset, ret); + GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, error-code %d", + dst_offset, ret); REPORT_CALL_ERROR("E19999", "Failed to operate dst memory at offset %ld, error-code %d", dst_offset, ret); return ACL_ERROR_GE_MEMORY_OPERATE_FAILED; } @@ -271,7 +279,8 @@ Status TransFormatFromFracNzToNd(const TransArgs &args, TransResult &result, con ret = memcpy_s(dst.get() + dst_offset, static_cast(protected_size), args.data + src_offset, static_cast(size)); if (ret != EOK) { - GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, error-code %d", dst_offset, ret); + GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, error-code %d", + dst_offset, ret); REPORT_CALL_ERROR("E19999", "Failed to operate dst memory at offset %ld, error-code %d", dst_offset, ret); return ACL_ERROR_GE_MEMORY_OPERATE_FAILED; } @@ -287,12 +296,12 @@ Status TransFormatFromFracNzToNd(const TransArgs &args, TransResult &result, con Status FormatTransferFractalNz::TransFormat(const TransArgs &args, TransResult &result) { if (!IsDataTypeSupport(args.src_data_type)) { GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, - "[Check][Datatype]Failed, trans format from %s to %s, src shape %s, dst shape %s, data type %s is not supported", - TypeUtils::FormatToSerialString(args.src_format).c_str(), + "[Check][Datatype]Failed, trans format from %s to %s, src shape %s, dst shape %s, " + "data type %s is not supported", TypeUtils::FormatToSerialString(args.src_format).c_str(), TypeUtils::FormatToSerialString(args.dst_format).c_str(), ShapeToString(args.src_shape).c_str(), ShapeToString(args.dst_shape).c_str(), TypeUtils::DataTypeToSerialString(args.src_data_type).c_str()); - REPORT_INNER_ERROR("E19999", "Check datatype failed, trans format from %s to %s, src shape %s, dst shape %s, data type %s is not supported", - TypeUtils::FormatToSerialString(args.src_format).c_str(), + REPORT_INNER_ERROR("E19999", "Check datatype failed, trans format from %s to %s, src shape %s, " + "dst shape %s, data type %s is not supported", TypeUtils::FormatToSerialString(args.src_format).c_str(), TypeUtils::FormatToSerialString(args.dst_format).c_str(), ShapeToString(args.src_shape).c_str(), ShapeToString(args.dst_shape).c_str(), TypeUtils::DataTypeToSerialString(args.src_data_type).c_str()); return ACL_ERROR_GE_DATATYPE_INVALID; @@ -303,8 +312,8 @@ Status FormatTransferFractalNz::TransFormat(const TransArgs &args, TransResult & TypeUtils::FormatToSerialString(args.src_format).c_str(), TypeUtils::FormatToSerialString(args.dst_format).c_str(), ShapeToString(args.src_shape).c_str(), ShapeToString(args.dst_shape).c_str(), TypeUtils::DataTypeToSerialString(args.src_data_type).c_str()); - REPORT_INNER_ERROR("E19999", "Check shape failed, trans format from %s to %s, src shape %s, dst shape %s, data type %s is not supported", - TypeUtils::FormatToSerialString(args.src_format).c_str(), + REPORT_INNER_ERROR("E19999", "Check shape failed, trans format from %s to %s, src shape %s, dst shape %s, " + "data type %s is not supported", TypeUtils::FormatToSerialString(args.src_format).c_str(), TypeUtils::FormatToSerialString(args.dst_format).c_str(), ShapeToString(args.src_shape).c_str(), ShapeToString(args.dst_shape).c_str(), TypeUtils::DataTypeToSerialString(args.src_data_type).c_str()); return ACL_ERROR_GE_SHAPE_INVALID; @@ -332,7 +341,8 @@ Status FormatTransferFractalNz::TransShape(Format src_format, const ShapeVector "[Check][Datatype]Failed, trans format from %s to %s, src shape %s, data type %s is not supported", TypeUtils::FormatToSerialString(src_format).c_str(), TypeUtils::FormatToSerialString(dst_format).c_str(), ShapeToString(src_shape).c_str(), TypeUtils::DataTypeToSerialString(data_type).c_str()); - REPORT_INNER_ERROR("E19999", "Check datatype failed, trans format from %s to %s, src shape %s, data type %s is not supported", + REPORT_INNER_ERROR("E19999", "Check datatype failed, trans format from %s to %s, src shape %s, " + "data type %s is not supported", TypeUtils::FormatToSerialString(src_format).c_str(),TypeUtils::FormatToSerialString(dst_format).c_str(), ShapeToString(src_shape).c_str(), TypeUtils::DataTypeToSerialString(data_type).c_str()); return ACL_ERROR_GE_DATATYPE_INVALID; @@ -358,7 +368,8 @@ Status FormatTransferFractalNzND::TransFormat(const TransArgs &args, TransResult TypeUtils::FormatToSerialString(args.src_format).c_str(), TypeUtils::FormatToSerialString(args.dst_format).c_str(), ShapeToString(args.src_shape).c_str(), ShapeToString(args.dst_shape).c_str(), TypeUtils::DataTypeToSerialString(args.src_data_type).c_str()); - REPORT_INNER_ERROR("E19999", "Check datatype failed, trans format from %s to %s, src shape %s, dst shape %s, data type %s is not supported", + REPORT_INNER_ERROR("E19999", "Check datatype failed, trans format from %s to %s, src shape %s, " + "dst shape %s, data type %s is not supported", TypeUtils::FormatToSerialString(args.src_format).c_str(), TypeUtils::FormatToSerialString(args.dst_format).c_str(), ShapeToString(args.src_shape).c_str(), ShapeToString(args.dst_shape).c_str(), TypeUtils::DataTypeToSerialString(args.src_data_type).c_str()); @@ -371,7 +382,8 @@ Status FormatTransferFractalNzND::TransFormat(const TransArgs &args, TransResult TypeUtils::FormatToSerialString(args.src_format).c_str(), TypeUtils::FormatToSerialString(args.dst_format).c_str(), ShapeToString(args.src_shape).c_str(), ShapeToString(args.dst_shape).c_str(), TypeUtils::DataTypeToSerialString(args.src_data_type).c_str()); - REPORT_INNER_ERROR("E19999", "Check shape failed, trans format from %s to %s, src shape %s, dst shape %s, data type %s is not supported", + REPORT_INNER_ERROR("E19999", "Check shape failed, trans format from %s to %s, src shape %s, dst shape %s, " + "data type %s is not supported", TypeUtils::FormatToSerialString(args.src_format).c_str(), TypeUtils::FormatToSerialString(args.dst_format).c_str(), ShapeToString(args.src_shape).c_str(), ShapeToString(args.dst_shape).c_str(), TypeUtils::DataTypeToSerialString(args.src_data_type).c_str()); diff --git a/ge/common/formats/format_transfers/format_transfer_fractal_z.cc b/ge/common/formats/format_transfers/format_transfer_fractal_z.cc index 2a29489a..b2924600 100644 --- a/ge/common/formats/format_transfers/format_transfer_fractal_z.cc +++ b/ge/common/formats/format_transfers/format_transfer_fractal_z.cc @@ -190,8 +190,10 @@ Status TransFormatFromNchwToFz(const TransArgs &args, TransResult &result) { std::shared_ptr dst(new (std::nothrow) uint8_t[dst_size], std::default_delete()); GE_CHK_BOOL_TRUE_EXEC_WITH_LOG( dst == nullptr, - GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][DSTMemory]Failed to allcoate memory for dst buf %ld when trans format from %s to %s", - dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(),TypeUtils::FormatToSerialString(args.dst_format).c_str()); + GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][DSTMemory]Failed to allcoate memory for dst buf %ld " + "when trans format from %s to %s", + dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(), + TypeUtils::FormatToSerialString(args.dst_format).c_str()); REPORT_CALL_ERROR("E19999", "Failed to allcoate memory for dst buf %ld when trans format from %s to %s", dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(), TypeUtils::FormatToSerialString(args.dst_format).c_str()); @@ -240,7 +242,8 @@ Status TransFormatFromNchwToFz(const TransArgs &args, TransResult &result) { if (ret != EOK) { GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED,"[Operate][DSTMemory]Failed at offset %ld, error-code %d pad mode %d", offset, ret, need_pad_zero); - REPORT_CALL_ERROR("E19999","Failed to operate dst memory at offset %ld, error-code %d pad mode %d", offset, ret, need_pad_zero); + REPORT_CALL_ERROR("E19999","Failed to operate dst memory at offset %ld, error-code %d pad mode %d", + offset, ret, need_pad_zero); return ACL_ERROR_GE_MEMORY_OPERATE_FAILED; } } @@ -261,7 +264,8 @@ Status TransFormatHwcnToFzWithGroups(const TransArgs &args, TransResult &result, int64_t cin_ori = c_dim; int64_t cout_ori = n_dim / groups; if (cin_ori == 0 || cout_ori == 0) { - GELOGE(GRAPH_FAILED, "[Check][Param]Failed, cin_ori, cout_ori must not be equal 0, and current cin_ori, cout_ori, groups are %ld %ld %ld", + GELOGE(GRAPH_FAILED, "[Check][Param]Failed, cin_ori, cout_ori must not be equal 0, and current cin_ori, " + "cout_ori, groups are %ld %ld %ld", cin_ori, cout_ori, groups); REPORT_CALL_ERROR("E19999", "Check graph param failed, cin_ori, cout_ori must not be equal 0," "and current cin_ori, cout_ori, groups are %ld %ld %ld", cin_ori, cout_ori, groups); @@ -285,8 +289,10 @@ Status TransFormatHwcnToFzWithGroups(const TransArgs &args, TransResult &result, errno_t ret = EOK; std::shared_ptr dst(new (std::nothrow) uint8_t[size_output_data], std::default_delete()); if (dst == nullptr) { - GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][DSTMemory]Failed to allcoate memory for dst buf %ld when trans format from %s to %s", - size_output_data, TypeUtils::FormatToSerialString(args.src_format).c_str(),TypeUtils::FormatToSerialString(args.dst_format).c_str()); + GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][DSTMemory]Failed to allcoate memory for dst buf %ld " + "when trans format from %s to %s", + size_output_data, TypeUtils::FormatToSerialString(args.src_format).c_str(), + TypeUtils::FormatToSerialString(args.dst_format).c_str()); REPORT_CALL_ERROR("E19999", "Failed to allcoate memory for dst buf %ld when trans format from %s to %s", size_output_data, TypeUtils::FormatToSerialString(args.src_format).c_str(), TypeUtils::FormatToSerialString(args.dst_format).c_str()); @@ -358,8 +364,10 @@ Status TransFormatHwcnToFz(const TransArgs &args, TransResult &result) { std::shared_ptr dst(new (std::nothrow) uint8_t[dst_size], std::default_delete()); GE_CHK_BOOL_TRUE_EXEC_WITH_LOG( dst == nullptr, - GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][DSTMemory]Failed to allcoate memory for dst buf %ld when trans format from %s to %s", - dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(),TypeUtils::FormatToSerialString(args.dst_format).c_str()); + GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][DSTMemory]Failed to allcoate memory for dst buf %ld " + "when trans format from %s to %s", + dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(), + TypeUtils::FormatToSerialString(args.dst_format).c_str()); REPORT_CALL_ERROR("E19999", "Failed to allcoate memory for dst buf %ld when trans format from %s to %s", dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(), TypeUtils::FormatToSerialString(args.dst_format).c_str()); @@ -382,7 +390,8 @@ Status TransFormatHwcnToFz(const TransArgs &args, TransResult &result) { static_cast(data_size)); } else { if (protected_size < data_size) { - GELOGE(ACL_ERROR_GE_PARAM_INVALID,"[Operate][DSTMemory]Failed, protected_size is %ld and size is %ld", protected_size, data_size); + GELOGE(ACL_ERROR_GE_PARAM_INVALID,"[Operate][DSTMemory]Failed, protected_size is %ld and size is %ld", + protected_size, data_size); return ACL_ERROR_GE_PARAM_INVALID; } int64_t src_idx = hi * wcn + wi * cn + (c1i * c0 + c0i) * n + n1n0i; @@ -393,9 +402,11 @@ Status TransFormatHwcnToFz(const TransArgs &args, TransResult &result) { } } if (ret != EOK) { - GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed, at offset %ld, error-code %d, pad mode %d", - dst_offset, ret, pad_zero); - REPORT_CALL_ERROR("E19999", "Failed to operate dst memoery at offset %ld, error-code %d, pad mode %d", dst_offset, ret, pad_zero); return ACL_ERROR_GE_MEMORY_OPERATE_FAILED; + GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed, at offset %ld, error-code %d, " + "pad mode %d", dst_offset, ret, pad_zero); + REPORT_CALL_ERROR("E19999", "Failed to operate dst memoery at offset %ld, error-code %d, pad mode %d", + dst_offset, ret, pad_zero); + return ACL_ERROR_GE_MEMORY_OPERATE_FAILED; } } } @@ -434,8 +445,10 @@ Status TransFormatNhwcToFz(const TransArgs &args, TransResult &result) { std::shared_ptr dst(new (std::nothrow) uint8_t[dst_size], std::default_delete()); GE_CHK_BOOL_TRUE_EXEC_WITH_LOG( dst == nullptr, - GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][DSTMemory]Failed to allcoate memory for dst buf %ld when trans format from %s to %s", - dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(),TypeUtils::FormatToSerialString(args.dst_format).c_str()); + GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][DSTMemory]Failed to allcoate memory for dst buf %ld " + "when trans format from %s to %s", + dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(), + TypeUtils::FormatToSerialString(args.dst_format).c_str()); REPORT_CALL_ERROR("E19999", "Failed to allcoate memory for dst buf %ld when trans format from %s to %s", dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(), TypeUtils::FormatToSerialString(args.dst_format).c_str()); @@ -458,7 +471,9 @@ Status TransFormatNhwcToFz(const TransArgs &args, TransResult &result) { static_cast(data_size)); } else { if (protected_size < data_size) { - GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Operate][DSTMemory]Failed, protected_size is %ld and size is %ld", protected_size, data_size); return ACL_ERROR_GE_PARAM_INVALID; + GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Operate][DSTMemory]Failed, protected_size is %ld and size is %ld", + protected_size, data_size); + return ACL_ERROR_GE_PARAM_INVALID; } int64_t src_idx = n1n0i * hwc + hi * wc + wi * c + (c1i * c0 + c0i); char *dst_data = reinterpret_cast(dst.get() + dst_offset); @@ -468,9 +483,11 @@ Status TransFormatNhwcToFz(const TransArgs &args, TransResult &result) { } } if (ret != EOK) { - GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, error-code %d, pad mode %d", - dst_offset, ret, pad_zero); - REPORT_CALL_ERROR("E19999", "Failed to operate dst memory at offset %ld, error-code %d, pad mode %d", dst_offset, ret, pad_zero); return ACL_ERROR_GE_MEMORY_OPERATE_FAILED; + GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, " + "error-code %d, pad mode %d", dst_offset, ret, pad_zero); + REPORT_CALL_ERROR("E19999", "Failed to operate dst memory at offset %ld, error-code %d, pad mode %d", + dst_offset, ret, pad_zero); + return ACL_ERROR_GE_MEMORY_OPERATE_FAILED; } } } diff --git a/ge/common/formats/format_transfers/format_transfer_fractal_zz.cc b/ge/common/formats/format_transfers/format_transfer_fractal_zz.cc index 830a4a7e..7930748d 100755 --- a/ge/common/formats/format_transfers/format_transfer_fractal_zz.cc +++ b/ge/common/formats/format_transfers/format_transfer_fractal_zz.cc @@ -87,7 +87,7 @@ Status TransShapeToFracZz(const ShapeVector &src_shape, DataType data_type, Shap hw_shape.push_back(src_shape[kNdDimIndexN]); if (!IsShapeValid(dst_shape)) { GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][DSTShape]Failed, dst shape %s", ShapeToString(dst_shape).c_str()); - REPORT_CALL_ERROR("E19999", "Failed to check dst shape %s", ShapeToString(dst_shape).c_str()); + REPORT_CALL_ERROR("E19999", "Failed to check dst shape %s", ShapeToString(dst_shape).c_str()); return ACL_ERROR_GE_SHAPE_INVALID; } return SUCCESS; @@ -107,7 +107,7 @@ Status TransShapeToFracZz(const ShapeVector &src_shape, DataType data_type, Shap hw_shape.push_back(src_shape[size - kNdDimCountBackwardsW]); if (!IsShapeValid(dst_shape)) { GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][DSTShape]Failed, dst shape %s", ShapeToString(dst_shape).c_str()); - REPORT_CALL_ERROR("E19999", "Failed to check dst shape %s", ShapeToString(dst_shape).c_str()); + REPORT_CALL_ERROR("E19999", "Failed to check dst shape %s", ShapeToString(dst_shape).c_str()); return ACL_ERROR_GE_SHAPE_INVALID; } return SUCCESS; @@ -144,10 +144,14 @@ Status TransFormatFromNdToFracZz(const TransArgs &args, TransResult &result, con std::shared_ptr dst(new (std::nothrow) uint8_t[dst_size](), std::default_delete()); if (dst == nullptr) { - GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][DSTMemory]Failed to allcoate memory for dst buf %ld when trans format from %s to %s", - dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(),TypeUtils::FormatToSerialString(args.dst_format).c_str()); + GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][DSTMemory]Failed to allcoate memory for dst buf %ld " + "when trans format from %s to %s", + dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(), + TypeUtils::FormatToSerialString(args.dst_format).c_str()); REPORT_CALL_ERROR("E19999", "Failed to allcoate memory for dst buf %ld when trans format from %s to %s", - dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(),TypeUtils::FormatToSerialString(args.dst_format).c_str()); return ACL_ERROR_GE_MEMORY_ALLOCATION; + dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(), + TypeUtils::FormatToSerialString(args.dst_format).c_str()); + return ACL_ERROR_GE_MEMORY_ALLOCATION; } // The src&dst_shape can be written as times*H*W & times*H1*W1*H0*W0, respectively. dst_shape_size >= kDimNum4D auto times = hw_shape.at(kNdDimIndexN); @@ -183,7 +187,8 @@ Status TransFormatFromNdToFracZz(const TransArgs &args, TransResult &result, con auto ret = memcpy_s(dst.get() + dst_offset, static_cast(protected_size), args.data + src_offset, static_cast(size * w0)); if (ret != EOK) { - GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, error-code %d", dst_offset, ret); + GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, error-code %d", + dst_offset, ret); REPORT_CALL_ERROR("E19999", "Failed to operate dst memory at offset %ld, error-code %d", dst_offset, ret); return ACL_ERROR_GE_MEMORY_OPERATE_FAILED; } @@ -200,7 +205,8 @@ Status TransFormatFromNdToFracZz(const TransArgs &args, TransResult &result, con auto ret = memcpy_s(dst.get() + dst_offset, static_cast(protected_size), args.data + src_offset, static_cast(size)); if (ret != EOK) { - GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, error-code %d", dst_offset, ret); + GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, error-code %d", + dst_offset, ret); REPORT_CALL_ERROR("E19999", "Failed to operate dst memory at offset %ld, error-code %d", dst_offset, ret); return ACL_ERROR_GE_MEMORY_OPERATE_FAILED; } @@ -223,10 +229,14 @@ Status TransFormatFromFracZzToNd(const TransArgs &args, TransResult &result, con std::shared_ptr dst(new (std::nothrow) uint8_t[dst_size](), std::default_delete()); if (dst == nullptr) { - GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][DSTMemory]Failed to allcoate memory for dst buf %ld when trans format from %s to %s", - dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(),TypeUtils::FormatToSerialString(args.dst_format).c_str()); + GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][DSTMemory]Failed to allcoate memory for dst buf %ld " + "when trans format from %s to %s", + dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(), + TypeUtils::FormatToSerialString(args.dst_format).c_str()); REPORT_CALL_ERROR("E19999", "Failed to allcoate memory for dst buf %ld when trans format from %s to %s", - dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(),TypeUtils::FormatToSerialString(args.dst_format).c_str()); return ACL_ERROR_GE_MEMORY_ALLOCATION; + dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(), + TypeUtils::FormatToSerialString(args.dst_format).c_str()); + return ACL_ERROR_GE_MEMORY_ALLOCATION; } // The src&dst_shape can be written as times*H*W & times*H1*W1*H0*W0, respectively. dst_shape_size >= kDimNum4D @@ -263,7 +273,8 @@ Status TransFormatFromFracZzToNd(const TransArgs &args, TransResult &result, con auto ret = memcpy_s(dst.get() + dst_offset, static_cast(protected_size), args.data + src_offset, static_cast(size * w0)); if (ret != EOK) { - GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, error-code %d", dst_offset, ret); + GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, error-code %d", + dst_offset, ret); REPORT_CALL_ERROR("E19999", "Failed to operate dst memory at offset %ld, error-code %d", dst_offset, ret); return ACL_ERROR_GE_MEMORY_OPERATE_FAILED; } @@ -280,7 +291,8 @@ Status TransFormatFromFracZzToNd(const TransArgs &args, TransResult &result, con auto ret = memcpy_s(dst.get() + dst_offset, static_cast(protected_size), args.data + src_offset, static_cast(size)); if (ret != EOK) { - GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, error-code %d", dst_offset, ret); + GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, error-code %d", + dst_offset, ret); REPORT_CALL_ERROR("E19999", "Failed to operate dst memory at offset %ld, error-code %d", dst_offset, ret); return ACL_ERROR_GE_MEMORY_OPERATE_FAILED; } @@ -306,8 +318,8 @@ Status FormatTransferFractalZz::TransFormat(const TransArgs &args, TransResult & if (!CheckShape(args.src_format, args.src_shape) || !IsShapeValid(args.dst_shape)) { GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Failed, not support trans format from %s to %s, src shape %s, dst shape %s, data type %s", - TypeUtils::FormatToSerialString(args.src_format).c_str(), - TypeUtils::FormatToSerialString(args.dst_format).c_str(), ShapeToString(args.src_shape).c_str(), + TypeUtils::FormatToSerialString(args.src_format).c_str(), + TypeUtils::FormatToSerialString(args.dst_format).c_str(), ShapeToString(args.src_shape).c_str(), ShapeToString(args.dst_shape).c_str(), TypeUtils::DataTypeToSerialString(args.src_data_type).c_str()); return ACL_ERROR_GE_SHAPE_INVALID; } @@ -358,14 +370,15 @@ Status FormatTransferFractalZzND::TransFormat(const TransArgs &args, TransResult } if (!IsShapeValid(args.src_shape) || !CheckShape(args.dst_format, args.dst_shape)) { - GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Failed, not support trans format from %s to %s, src shape %s, dst shape %s, data type %s", + GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Failed, not support trans format from %s to %s, " + "src shape %s, dst shape %s, data type %s", TypeUtils::FormatToSerialString(args.src_format).c_str(), TypeUtils::FormatToSerialString(args.dst_format).c_str(), ShapeToString(args.src_shape).c_str(), ShapeToString(args.dst_shape).c_str(), TypeUtils::DataTypeToSerialString(args.src_data_type).c_str()); - REPORT_CALL_ERROR("E19999", "Check shape failed, not support trans format from %s to %s, src shape %s, dst shape %s, data type %s", - TypeUtils::FormatToSerialString(args.src_format).c_str(), - TypeUtils::FormatToSerialString(args.dst_format).c_str(), ShapeToString(args.src_shape).c_str(), - ShapeToString(args.dst_shape).c_str(), TypeUtils::DataTypeToSerialString(args.src_data_type).c_str()); + REPORT_CALL_ERROR("E19999", "Check shape failed, not support trans format from %s to %s, src shape %s, " + "dst shape %s, data type %s", TypeUtils::FormatToSerialString(args.src_format).c_str(), + TypeUtils::FormatToSerialString(args.dst_format).c_str(), ShapeToString(args.src_shape).c_str(), + ShapeToString(args.dst_shape).c_str(), TypeUtils::DataTypeToSerialString(args.src_data_type).c_str()); return ACL_ERROR_GE_SHAPE_INVALID; } GELOGD("Begin to trans format from %s to %s, src shape %s, dst shape %s, data type %s",