Browse Source

common formats log optimize

tags/v1.3.0
liyihan2@huawei.com 3 years ago
parent
commit
ff31cd4d15
6 changed files with 281 additions and 160 deletions
  1. +2
    -1
      ge/common/formats/format_transfers/datatype_transfer.cc
  2. +22
    -11
      ge/common/formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc
  3. +6
    -5
      ge/common/formats/format_transfers/format_transfer_dhwcn_fracz3D.cc
  4. +98
    -54
      ge/common/formats/format_transfers/format_transfer_fractal_nz.cc
  5. +41
    -28
      ge/common/formats/format_transfers/format_transfer_fractal_z.cc
  6. +112
    -61
      ge/common/formats/format_transfers/format_transfer_fractal_zz.cc

+ 2
- 1
ge/common/formats/format_transfers/datatype_transfer.cc View File

@@ -155,7 +155,8 @@ Status DataTypeTransfer::TransDataType(const CastArgs &args, TransResult &result
std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[total_size], std::default_delete<uint8_t[]>()); std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[total_size], std::default_delete<uint8_t[]>());
if (dst == nullptr) { if (dst == nullptr) {
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION,
"[Allocate][DSTMemory]Failed, memory for dst buf %zu, data size %zu", total_size, args.src_data_size);
"[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", REPORT_CALL_ERROR("E19999", "Failed to allocate memory for dst buf %zu, data size %zu",
total_size, args.src_data_size); total_size, args.src_data_size);
return ACL_ERROR_GE_MEMORY_ALLOCATION; return ACL_ERROR_GE_MEMORY_ALLOCATION;


+ 22
- 11
ge/common/formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc View File

@@ -49,12 +49,14 @@ Status CheckArgsForC1hwncoc0ToHwcn(const TransArgs &args) {
return ACL_ERROR_GE_DATATYPE_INVALID; return ACL_ERROR_GE_DATATYPE_INVALID;
} }
if (!CheckShapeValid(src_shape, kC1hwncoc0DimsNum)) { if (!CheckShapeValid(src_shape, kC1hwncoc0DimsNum)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][SrcShape]Failed, src shape %s", ShapeToString(src_shape).c_str());
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][SrcShape]Failed, src shape %s",
ShapeToString(src_shape).c_str());
REPORT_CALL_ERROR("E19999", "Failed to check src shape %s", ShapeToString(src_shape).c_str()); REPORT_CALL_ERROR("E19999", "Failed to check src shape %s", ShapeToString(src_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID; return ACL_ERROR_GE_SHAPE_INVALID;
} }
if (!CheckShapeValid(dst_shape, kHwcnDimsNum)) { if (!CheckShapeValid(dst_shape, kHwcnDimsNum)) {
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()); REPORT_CALL_ERROR("E19999", "Failed to check dst shape %s", ShapeToString(dst_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID; return ACL_ERROR_GE_SHAPE_INVALID;
} }
@@ -76,11 +78,13 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, int size
std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[total_size], std::default_delete<uint8_t[]>()); std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[total_size], std::default_delete<uint8_t[]>());
if (dst == nullptr) { if (dst == nullptr) {
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, 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",
"[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(), total_size, ShapeToString(args.dst_shape).c_str(),
TypeUtils::FormatToSerialString(args.src_format).c_str(), TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_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",
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(), total_size, ShapeToString(args.dst_shape).c_str(),
TypeUtils::FormatToSerialString(args.src_format).c_str(), TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str()); TypeUtils::FormatToSerialString(args.dst_format).c_str());
@@ -123,10 +127,13 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, int size
static_cast<size_t>(size)); static_cast<size_t>(size));
if (ret != EOK) { if (ret != EOK) {
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED,
"[Operate][Memory]Failed to copy data from C1HWNCoC0[%ld, %ld, %ld, %ld, %ld, %ld] offset %ld to "
"[Operate][Memory]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", "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);
REPORT_CALL_ERROR("E19999", "Failed to copy data from C1HWNCoC0[%ld, %ld, %ld, %ld, %ld, %ld] offset %ld to "
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", "HWCN[%ld, %ld, %ld, %ld] offset %ld, err-code %d",
c1_idx, h_idx, w_idx, n_idx, co_idx, c0_idx, src_offset, 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); h_idx, w_idx, c_idx, n_idx, dst_offset, ret);
@@ -155,10 +162,12 @@ Status FormatTransferC1hwncoc0Hwcn::TransFormat(const TransArgs &args, TransResu
result.length = static_cast<size_t>(total_size); result.length = static_cast<size_t>(total_size);
return SUCCESS; return SUCCESS;
} }
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Get][Shape]Failed, total size %ld from dst shape %s, src shape %s.",
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Get][Shape]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()); total_size, ShapeToString(args.dst_shape).c_str(), ShapeToString(args.src_shape).c_str());
REPORT_CALL_ERROR("E19999", "Get shape faield, total size %ld from dst shape %s, src shape %s.", REPORT_CALL_ERROR("E19999", "Get shape faield, total size %ld from dst shape %s, src shape %s.",
total_size, ShapeToString(args.dst_shape).c_str(), ShapeToString(args.src_shape).c_str());
total_size, ShapeToString(args.dst_shape).c_str(),
ShapeToString(args.src_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID; return ACL_ERROR_GE_SHAPE_INVALID;
} }
GELOGD("Begin to trans format from C1HWNCoC0 to HWCN, src shape %s, data type %s, dst shape %s, memory size %ld.", GELOGD("Begin to trans format from C1HWNCoC0 to HWCN, src shape %s, data type %s, dst shape %s, memory size %ld.",
@@ -168,11 +177,13 @@ Status FormatTransferC1hwncoc0Hwcn::TransFormat(const TransArgs &args, TransResu
if (ret != SUCCESS) { if (ret != SUCCESS) {
GELOGE(ret, "[Get][Data]Failed when after trans, src shape %s, data type %s, dst shape %s, " GELOGE(ret, "[Get][Data]Failed when after trans, src shape %s, data type %s, dst shape %s, "
"memory size %ld, error_code %u", "memory size %ld, error_code %u",
ShapeToString(args.src_shape).c_str(), TypeUtils::DataTypeToSerialString(args.src_data_type).c_str(),
ShapeToString(args.src_shape).c_str(),
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str(),
ShapeToString(args.dst_shape).c_str(), total_size, ret); 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, " 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", "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.src_shape).c_str(),
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str(),
ShapeToString(args.dst_shape).c_str(), total_size, ret); ShapeToString(args.dst_shape).c_str(), total_size, ret);
return ret; return ret;
} }


+ 6
- 5
ge/common/formats/format_transfers/format_transfer_dhwcn_fracz3D.cc View File

@@ -94,11 +94,12 @@ Status TransFormatDhwckToFz3D(const TransArgs &args, TransResult &result) {


std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[dst_size], std::default_delete<uint8_t[]>()); std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[dst_size], std::default_delete<uint8_t[]>());
if (dst == nullptr) { 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",
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(), dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_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",
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(), dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str()); TypeUtils::FormatToSerialString(args.dst_format).c_str());
return ACL_ERROR_GE_MEMORY_ALLOCATION; return ACL_ERROR_GE_MEMORY_ALLOCATION;
@@ -126,8 +127,8 @@ Status TransFormatDhwckToFz3D(const TransArgs &args, TransResult &result) {
args.data + src_idx * data_size, static_cast<size_t>(data_size)); args.data + src_idx * data_size, static_cast<size_t>(data_size));
} }
if (ret != EOK) { 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);
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, " REPORT_CALL_ERROR("E19999", "Failed to operate dst memory at offset %ld, "
"error-code %d, pad mode %d", dst_offset, ret, pad_zero); "error-code %d, pad mode %d", dst_offset, ret, pad_zero);
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED; return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;


+ 98
- 54
ge/common/formats/format_transfers/format_transfer_fractal_nz.cc View File

@@ -89,7 +89,8 @@ Status TransShapeToFracNz(const ShapeVector &src_shape, DataType data_type, Shap
if (!IsShapeValid(dst_shape)) { if (!IsShapeValid(dst_shape)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][DSTShape]Failed, dst shape %s", GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][DSTShape]Failed, dst shape %s",
ShapeToString(dst_shape).c_str()); 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 ACL_ERROR_GE_SHAPE_INVALID;
} }
return SUCCESS; return SUCCESS;
@@ -110,7 +111,8 @@ Status TransShapeToFracNz(const ShapeVector &src_shape, DataType data_type, Shap
if (!IsShapeValid(dst_shape)) { if (!IsShapeValid(dst_shape)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][DSTShape]Failed, dst shape %s", GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][DSTShape]Failed, dst shape %s",
ShapeToString(dst_shape).c_str()); 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 ACL_ERROR_GE_SHAPE_INVALID;
} }
return SUCCESS; return SUCCESS;
@@ -123,8 +125,10 @@ Status CheckShapeRelation(const TransArgs &args, ShapeVector &hw_shape) {
if (ret != SUCCESS) { if (ret != SUCCESS) {
GELOGE(ret, "[Transfer][ShapeToFracNz]Failed, shape from %s to %s, shape %s to %s, " 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(), "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);
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; return ret;
} }
if (!IsTransShapeSrcCorrect(args, expect_src_shape)) { if (!IsTransShapeSrcCorrect(args, expect_src_shape)) {
@@ -143,10 +147,12 @@ Status TransFormatFromNdToFracNz(const TransArgs &args, TransResult &result, con


std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[dst_size](), std::default_delete<uint8_t[]>()); std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[dst_size](), std::default_delete<uint8_t[]>());
if (dst == nullptr) { 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); 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",
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(), TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str(), dst_size); TypeUtils::FormatToSerialString(args.dst_format).c_str(), dst_size);
return ACL_ERROR_GE_MEMORY_ALLOCATION; return ACL_ERROR_GE_MEMORY_ALLOCATION;
@@ -182,8 +188,8 @@ Status TransFormatFromNdToFracNz(const TransArgs &args, TransResult &result, con
auto ret = memcpy_s(dst.get() + dst_offset, static_cast<size_t>(protected_size), args.data + src_offset, auto ret = memcpy_s(dst.get() + dst_offset, static_cast<size_t>(protected_size), args.data + src_offset,
static_cast<size_t>(size * w0)); static_cast<size_t>(size * w0));
if (ret != EOK) { 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", REPORT_CALL_ERROR("E19999", "Failed to operate dst memory at offset %ld, error-code %d",
dst_offset, ret); dst_offset, ret);
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED; return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
@@ -199,8 +205,8 @@ Status TransFormatFromNdToFracNz(const TransArgs &args, TransResult &result, con
auto ret = memcpy_s(dst.get() + dst_offset, static_cast<size_t>(protected_size), args.data + src_offset, auto ret = memcpy_s(dst.get() + dst_offset, static_cast<size_t>(protected_size), args.data + src_offset,
static_cast<size_t>(size)); static_cast<size_t>(size));
if (ret != EOK) { 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", REPORT_CALL_ERROR("E19999", "Failed to operate dst memory at offset %ld, error-code %d",
dst_offset, ret); dst_offset, ret);
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED; return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
@@ -223,11 +229,12 @@ Status TransFormatFromFracNzToNd(const TransArgs &args, TransResult &result, con


std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[dst_size], std::default_delete<uint8_t[]>()); std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[dst_size], std::default_delete<uint8_t[]>());
if (dst == nullptr) { 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.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str(), dst_size); 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",
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(), TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str(), dst_size); TypeUtils::FormatToSerialString(args.dst_format).c_str(), dst_size);
return ACL_ERROR_GE_MEMORY_ALLOCATION; return ACL_ERROR_GE_MEMORY_ALLOCATION;
@@ -263,9 +270,11 @@ Status TransFormatFromFracNzToNd(const TransArgs &args, TransResult &result, con
ret = memcpy_s(dst.get() + dst_offset, static_cast<size_t>(protected_size), args.data + src_offset, ret = memcpy_s(dst.get() + dst_offset, static_cast<size_t>(protected_size), args.data + src_offset,
static_cast<size_t>(size * w0)); static_cast<size_t>(size * w0));
if (ret != EOK) { if (ret != EOK) {
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, error-code %d",
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, "
"error-code %d",
dst_offset, ret); dst_offset, ret);
REPORT_CALL_ERROR("E19999", "Failed to operate dst memory 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; return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
} }
} }
@@ -279,9 +288,11 @@ Status TransFormatFromFracNzToNd(const TransArgs &args, TransResult &result, con
ret = memcpy_s(dst.get() + dst_offset, static_cast<size_t>(protected_size), args.data + src_offset, ret = memcpy_s(dst.get() + dst_offset, static_cast<size_t>(protected_size), args.data + src_offset,
static_cast<size_t>(size)); static_cast<size_t>(size));
if (ret != EOK) { if (ret != EOK) {
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, error-code %d",
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, "
"error-code %d",
dst_offset, ret); dst_offset, ret);
REPORT_CALL_ERROR("E19999", "Failed to operate dst memory 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; return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
} }
} }
@@ -297,25 +308,37 @@ Status FormatTransferFractalNz::TransFormat(const TransArgs &args, TransResult &
if (!IsDataTypeSupport(args.src_data_type)) { if (!IsDataTypeSupport(args.src_data_type)) {
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, GELOGE(ACL_ERROR_GE_DATATYPE_INVALID,
"[Check][Datatype]Failed, trans format from %s to %s, src shape %s, dst shape %s, " "[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());
"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, " 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());
"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; return ACL_ERROR_GE_DATATYPE_INVALID;
} }
if (!CheckShape(args.src_format, args.src_shape) || !IsShapeValid(args.dst_shape)) { if (!CheckShape(args.src_format, args.src_shape) || !IsShapeValid(args.dst_shape)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, GELOGE(ACL_ERROR_GE_SHAPE_INVALID,
"[Check][Shape]Failed, trans format from %s to %s, src shape %s, dst shape %s, data type %s is not supported",
"[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.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(),
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());
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(),
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; return ACL_ERROR_GE_SHAPE_INVALID;
} }
GELOGD("Begin to trans format from %s to %s, src shape %s, dst shape %s, data type %s", GELOGD("Begin to trans format from %s to %s, src shape %s, dst shape %s, data type %s",
@@ -338,23 +361,34 @@ Status FormatTransferFractalNz::TransShape(Format src_format, const ShapeVector
Format dst_format, ShapeVector &dst_shape) { Format dst_format, ShapeVector &dst_shape) {
if (!IsDataTypeSupport(data_type)) { if (!IsDataTypeSupport(data_type)) {
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, GELOGE(ACL_ERROR_GE_DATATYPE_INVALID,
"[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());
"[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, " REPORT_INNER_ERROR("E19999", "Check datatype failed, trans format from %s to %s, src shape %s, "
"data type %s is not supported", "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());
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; return ACL_ERROR_GE_DATATYPE_INVALID;
} }
if (!CheckShape(src_format, src_shape)) { if (!CheckShape(src_format, src_shape)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, GELOGE(ACL_ERROR_GE_SHAPE_INVALID,
"[Check][Shape]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 shape 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());
"[Check][Shape]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 shape 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_SHAPE_INVALID; return ACL_ERROR_GE_SHAPE_INVALID;
} }
ShapeVector hw_shape; ShapeVector hw_shape;
@@ -364,29 +398,39 @@ Status FormatTransferFractalNz::TransShape(Format src_format, const ShapeVector
Status FormatTransferFractalNzND::TransFormat(const TransArgs &args, TransResult &result) { Status FormatTransferFractalNzND::TransFormat(const TransArgs &args, TransResult &result) {
if (!IsDataTypeSupport(args.src_data_type)) { if (!IsDataTypeSupport(args.src_data_type)) {
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, 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",
"[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.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());
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, " 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", "dst shape %s, data type %s is not supported",
TypeUtils::FormatToSerialString(args.src_format).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());
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; return ACL_ERROR_GE_DATATYPE_INVALID;
} }


if (!IsShapeValid(args.src_shape) || !CheckShape(args.dst_format, args.dst_shape)) { if (!IsShapeValid(args.src_shape) || !CheckShape(args.dst_format, args.dst_shape)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, GELOGE(ACL_ERROR_GE_SHAPE_INVALID,
"[Check][Shape]Failed, trans format from %s to %s, src shape %s, dst shape %s, data type %s is not supported",
"[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.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.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(), 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());
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; return ACL_ERROR_GE_SHAPE_INVALID;
} }
GELOGD("Begin to trans format from %s to %s, src shape %s, dst shape %s, data type %s", GELOGD("Begin to trans format from %s to %s, src shape %s, dst shape %s, data type %s",


+ 41
- 28
ge/common/formats/format_transfers/format_transfer_fractal_z.cc View File

@@ -73,7 +73,8 @@ Status TransShapeToFz(int64_t n, int64_t c, int64_t h, int64_t w, DataType data_
dst_shape.push_back(kNiSize); dst_shape.push_back(kNiSize);
dst_shape.push_back(c0); dst_shape.push_back(c0);
if (!IsShapeValid(dst_shape)) { if (!IsShapeValid(dst_shape)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Failed, dst shape %s", ShapeToString(dst_shape).c_str());
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", 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 ACL_ERROR_GE_SHAPE_INVALID;
} }
@@ -102,7 +103,8 @@ Status TransShapeToFzWithGroups(int64_t n, int64_t c, int64_t h, int64_t w, Data
dst_shape.push_back(16); dst_shape.push_back(16);
dst_shape.push_back(cube_k); dst_shape.push_back(cube_k);
if (!IsShapeValid(dst_shape)) { if (!IsShapeValid(dst_shape)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Failed, dst shape %s", ShapeToString(dst_shape).c_str());
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", 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 ACL_ERROR_GE_SHAPE_INVALID;
} }
@@ -190,11 +192,12 @@ Status TransFormatFromNchwToFz(const TransArgs &args, TransResult &result) {
std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[dst_size], std::default_delete<uint8_t[]>()); std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[dst_size], std::default_delete<uint8_t[]>());
GE_CHK_BOOL_TRUE_EXEC_WITH_LOG( GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(
dst == nullptr, 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",
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(), dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_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",
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(), dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str()); TypeUtils::FormatToSerialString(args.dst_format).c_str());
return ACL_ERROR_GE_MEMORY_ALLOCATION;); return ACL_ERROR_GE_MEMORY_ALLOCATION;);
@@ -240,9 +243,11 @@ Status TransFormatFromNchwToFz(const TransArgs &args, TransResult &result) {
} }
} }
if (ret != EOK) { if (ret != EOK) {
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED,"[Operate][DSTMemory]Failed at offset %ld, error-code %d pad mode %d",
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED,"[Operate][DSTMemory]Failed at offset %ld, "
"error-code %d pad mode %d",
offset, ret, need_pad_zero); offset, ret, need_pad_zero);
REPORT_CALL_ERROR("E19999","Failed to operate dst memory at offset %ld, error-code %d pad mode %d",
REPORT_CALL_ERROR("E19999","Failed to operate dst memory at offset %ld, "
"error-code %d pad mode %d",
offset, ret, need_pad_zero); offset, ret, need_pad_zero);
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED; return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
} }
@@ -264,10 +269,11 @@ Status TransFormatHwcnToFzWithGroups(const TransArgs &args, TransResult &result,
int64_t cin_ori = c_dim; int64_t cin_ori = c_dim;
int64_t cout_ori = n_dim / groups; int64_t cout_ori = n_dim / groups;
if (cin_ori == 0 || cout_ori == 0) { 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", cin_ori, cout_ori, groups);
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," 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);
"and current cin_ori, cout_ori, groups are %ld %ld %ld",
cin_ori, cout_ori, groups);
return GRAPH_FAILED; return GRAPH_FAILED;
} }
const int64_t cube_k = GetCubeSizeByDataType(args.src_data_type); const int64_t cube_k = GetCubeSizeByDataType(args.src_data_type);
@@ -288,11 +294,12 @@ Status TransFormatHwcnToFzWithGroups(const TransArgs &args, TransResult &result,
errno_t ret = EOK; errno_t ret = EOK;
std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[size_output_data], std::default_delete<uint8_t[]>()); std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[size_output_data], std::default_delete<uint8_t[]>());
if (dst == nullptr) { 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",
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(), size_output_data, TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_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",
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(), size_output_data, TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str()); TypeUtils::FormatToSerialString(args.dst_format).c_str());
return ACL_ERROR_GE_MEMORY_ALLOCATION; return ACL_ERROR_GE_MEMORY_ALLOCATION;
@@ -363,11 +370,12 @@ Status TransFormatHwcnToFz(const TransArgs &args, TransResult &result) {
std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[dst_size], std::default_delete<uint8_t[]>()); std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[dst_size], std::default_delete<uint8_t[]>());
GE_CHK_BOOL_TRUE_EXEC_WITH_LOG( GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(
dst == nullptr, 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",
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(), dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_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",
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(), dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str()); TypeUtils::FormatToSerialString(args.dst_format).c_str());
return ACL_ERROR_GE_MEMORY_ALLOCATION;); return ACL_ERROR_GE_MEMORY_ALLOCATION;);
@@ -389,7 +397,8 @@ Status TransFormatHwcnToFz(const TransArgs &args, TransResult &result) {
static_cast<size_t>(data_size)); static_cast<size_t>(data_size));
} else { } else {
if (protected_size < data_size) { if (protected_size < data_size) {
GELOGE(ACL_ERROR_GE_PARAM_INVALID,"[Operate][DSTMemory]Failed, protected_size is %ld and size is %ld",
GELOGE(ACL_ERROR_GE_PARAM_INVALID,"[Operate][DSTMemory]Failed, protected_size "
"is %ld and size is %ld",
protected_size, data_size); protected_size, data_size);
return ACL_ERROR_GE_PARAM_INVALID; return ACL_ERROR_GE_PARAM_INVALID;
} }
@@ -401,11 +410,12 @@ Status TransFormatHwcnToFz(const TransArgs &args, TransResult &result) {
} }
} }
if (ret != EOK) { 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",
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); dst_offset, ret, pad_zero);
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
} }
} }
} }
@@ -444,11 +454,12 @@ Status TransFormatNhwcToFz(const TransArgs &args, TransResult &result) {
std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[dst_size], std::default_delete<uint8_t[]>()); std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[dst_size], std::default_delete<uint8_t[]>());
GE_CHK_BOOL_TRUE_EXEC_WITH_LOG( GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(
dst == nullptr, 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",
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(), dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_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",
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(), dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str()); TypeUtils::FormatToSerialString(args.dst_format).c_str());
return ACL_ERROR_GE_MEMORY_ALLOCATION;); return ACL_ERROR_GE_MEMORY_ALLOCATION;);
@@ -470,9 +481,10 @@ Status TransFormatNhwcToFz(const TransArgs &args, TransResult &result) {
static_cast<size_t>(data_size)); static_cast<size_t>(data_size));
} else { } else {
if (protected_size < data_size) { if (protected_size < data_size) {
GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Operate][DSTMemory]Failed, protected_size is %ld and size is %ld",
GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Operate][DSTMemory]Failed, protected_size "
"is %ld and size is %ld",
protected_size, data_size); protected_size, data_size);
return ACL_ERROR_GE_PARAM_INVALID;
return ACL_ERROR_GE_PARAM_INVALID;
} }
int64_t src_idx = n1n0i * hwc + hi * wc + wi * c + (c1i * c0 + c0i); int64_t src_idx = n1n0i * hwc + hi * wc + wi * c + (c1i * c0 + c0i);
char *dst_data = reinterpret_cast<char *>(dst.get() + dst_offset); char *dst_data = reinterpret_cast<char *>(dst.get() + dst_offset);
@@ -484,9 +496,10 @@ Status TransFormatNhwcToFz(const TransArgs &args, TransResult &result) {
if (ret != EOK) { if (ret != EOK) {
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, " GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, "
"error-code %d, pad mode %d", dst_offset, ret, pad_zero); "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",
REPORT_CALL_ERROR("E19999", "Failed to operate dst memory at offset %ld, "
"error-code %d, pad mode %d",
dst_offset, ret, pad_zero); dst_offset, ret, pad_zero);
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
} }
} }
} }


+ 112
- 61
ge/common/formats/format_transfers/format_transfer_fractal_zz.cc View File

@@ -86,8 +86,10 @@ Status TransShapeToFracZz(const ShapeVector &src_shape, DataType data_type, Shap
hw_shape.push_back(DIM_DEFAULT_VALUE); hw_shape.push_back(DIM_DEFAULT_VALUE);
hw_shape.push_back(src_shape[kNdDimIndexN]); hw_shape.push_back(src_shape[kNdDimIndexN]);
if (!IsShapeValid(dst_shape)) { 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());
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; return ACL_ERROR_GE_SHAPE_INVALID;
} }
return SUCCESS; return SUCCESS;
@@ -106,8 +108,10 @@ Status TransShapeToFracZz(const ShapeVector &src_shape, DataType data_type, Shap
hw_shape.push_back(src_shape[size - kNdDimCountBackwardsWH]); hw_shape.push_back(src_shape[size - kNdDimCountBackwardsWH]);
hw_shape.push_back(src_shape[size - kNdDimCountBackwardsW]); hw_shape.push_back(src_shape[size - kNdDimCountBackwardsW]);
if (!IsShapeValid(dst_shape)) { 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());
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; return ACL_ERROR_GE_SHAPE_INVALID;
} }
return SUCCESS; return SUCCESS;
@@ -120,12 +124,16 @@ Status CheckShapeRelation(const TransArgs &args, ShapeVector &hw_shape) {
if (ret != SUCCESS) { if (ret != SUCCESS) {
GELOGE(ret, "[Trans][ShapeToFracZz] Failed from %s to %s, shape %s to %s, data type %s", GELOGE(ret, "[Trans][ShapeToFracZz] Failed from %s to %s, shape %s to %s, data type %s",
TypeUtils::FormatToSerialString(args.dst_format).c_str(), 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());
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());
REPORT_CALL_ERROR("E19999", "Failed to trans shape from %s to %s, shape %s to %s, data type %s", REPORT_CALL_ERROR("E19999", "Failed to trans shape from %s to %s, shape %s to %s, data type %s",
TypeUtils::FormatToSerialString(args.dst_format).c_str(), 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());
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());
return ret; return ret;
} }
if (!IsTransShapeSrcCorrect(args, expect_src_shape)) { if (!IsTransShapeSrcCorrect(args, expect_src_shape)) {
@@ -144,11 +152,12 @@ Status TransFormatFromNdToFracZz(const TransArgs &args, TransResult &result, con


std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[dst_size](), std::default_delete<uint8_t[]>()); std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[dst_size](), std::default_delete<uint8_t[]>());
if (dst == nullptr) { 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",
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(), dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_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",
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(), dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str()); TypeUtils::FormatToSerialString(args.dst_format).c_str());
return ACL_ERROR_GE_MEMORY_ALLOCATION; return ACL_ERROR_GE_MEMORY_ALLOCATION;
@@ -187,9 +196,11 @@ Status TransFormatFromNdToFracZz(const TransArgs &args, TransResult &result, con
auto ret = memcpy_s(dst.get() + dst_offset, static_cast<size_t>(protected_size), args.data + src_offset, auto ret = memcpy_s(dst.get() + dst_offset, static_cast<size_t>(protected_size), args.data + src_offset,
static_cast<size_t>(size * w0)); static_cast<size_t>(size * w0));
if (ret != EOK) { if (ret != EOK) {
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, error-code %d",
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, "
"error-code %d",
dst_offset, ret); dst_offset, ret);
REPORT_CALL_ERROR("E19999", "Failed to operate dst memory 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; return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
} }
} }
@@ -205,9 +216,11 @@ Status TransFormatFromNdToFracZz(const TransArgs &args, TransResult &result, con
auto ret = memcpy_s(dst.get() + dst_offset, static_cast<size_t>(protected_size), args.data + src_offset, auto ret = memcpy_s(dst.get() + dst_offset, static_cast<size_t>(protected_size), args.data + src_offset,
static_cast<size_t>(size)); static_cast<size_t>(size));
if (ret != EOK) { if (ret != EOK) {
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, error-code %d",
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, "
"error-code %d",
dst_offset, ret); dst_offset, ret);
REPORT_CALL_ERROR("E19999", "Failed to operate dst memory 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; return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
} }
} }
@@ -229,11 +242,12 @@ Status TransFormatFromFracZzToNd(const TransArgs &args, TransResult &result, con


std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[dst_size](), std::default_delete<uint8_t[]>()); std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[dst_size](), std::default_delete<uint8_t[]>());
if (dst == nullptr) { 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",
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(), dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_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",
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(), dst_size, TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str()); TypeUtils::FormatToSerialString(args.dst_format).c_str());
return ACL_ERROR_GE_MEMORY_ALLOCATION; return ACL_ERROR_GE_MEMORY_ALLOCATION;
@@ -273,9 +287,11 @@ Status TransFormatFromFracZzToNd(const TransArgs &args, TransResult &result, con
auto ret = memcpy_s(dst.get() + dst_offset, static_cast<size_t>(protected_size), args.data + src_offset, auto ret = memcpy_s(dst.get() + dst_offset, static_cast<size_t>(protected_size), args.data + src_offset,
static_cast<size_t>(size * w0)); static_cast<size_t>(size * w0));
if (ret != EOK) { if (ret != EOK) {
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, error-code %d",
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, "
"error-code %d",
dst_offset, ret); dst_offset, ret);
REPORT_CALL_ERROR("E19999", "Failed to operate dst memory 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; return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
} }
} }
@@ -291,9 +307,11 @@ Status TransFormatFromFracZzToNd(const TransArgs &args, TransResult &result, con
auto ret = memcpy_s(dst.get() + dst_offset, static_cast<size_t>(protected_size), args.data + src_offset, auto ret = memcpy_s(dst.get() + dst_offset, static_cast<size_t>(protected_size), args.data + src_offset,
static_cast<size_t>(size)); static_cast<size_t>(size));
if (ret != EOK) { if (ret != EOK) {
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, error-code %d",
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed at offset %ld, "
"error-code %d",
dst_offset, ret); dst_offset, ret);
REPORT_CALL_ERROR("E19999", "Failed to operate dst memory 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; return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
} }
} }
@@ -309,26 +327,38 @@ Status TransFormatFromFracZzToNd(const TransArgs &args, TransResult &result, con
Status FormatTransferFractalZz::TransFormat(const TransArgs &args, TransResult &result) { Status FormatTransferFractalZz::TransFormat(const TransArgs &args, TransResult &result) {
if (!IsDataTypeSupport(args.src_data_type)) { if (!IsDataTypeSupport(args.src_data_type)) {
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, GELOGE(ACL_ERROR_GE_DATATYPE_INVALID,
"[Check][Datatype]Failed, not support trans format from %s to %s, src shape %s, dst shape %s, data type %s",
"[Check][Datatype]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.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, 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());
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, 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_DATATYPE_INVALID; return ACL_ERROR_GE_DATATYPE_INVALID;
} }
if (!CheckShape(args.src_format, args.src_shape) || !IsShapeValid(args.dst_shape)) { if (!CheckShape(args.src_format, args.src_shape) || !IsShapeValid(args.dst_shape)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, 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",
"[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.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());
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; return ACL_ERROR_GE_SHAPE_INVALID;
} }
GELOGD("Begin to trans format from %s to %s, src shape %s, dst shape %s, data type %s", GELOGD("Begin to trans format from %s to %s, src shape %s, dst shape %s, data type %s",
@@ -351,24 +381,34 @@ Status FormatTransferFractalZz::TransShape(Format src_format, const ShapeVector
Format dst_format, ShapeVector &dst_shape) { Format dst_format, ShapeVector &dst_shape) {
if (!IsDataTypeSupport(data_type)) { if (!IsDataTypeSupport(data_type)) {
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, GELOGE(ACL_ERROR_GE_DATATYPE_INVALID,
"[Check][Datatype]Failed, not support trans format from %s to %s, src shape %s, data type %s",
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, not support trans format from %s to %s, src shape %s, data type %s",
"[Check][Datatype]Failed, not support trans format from %s to %s, "
"src shape %s, data type %s",
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, not support trans format from %s to %s, "
"src shape %s, data type %s",
TypeUtils::FormatToSerialString(src_format).c_str(), TypeUtils::FormatToSerialString(src_format).c_str(),
TypeUtils::FormatToSerialString(dst_format).c_str(), TypeUtils::FormatToSerialString(dst_format).c_str(),
ShapeToString(src_shape).c_str(), TypeUtils::DataTypeToSerialString(data_type).c_str());
ShapeToString(src_shape).c_str(),
TypeUtils::DataTypeToSerialString(data_type).c_str());
return ACL_ERROR_GE_DATATYPE_INVALID; return ACL_ERROR_GE_DATATYPE_INVALID;
} }
if (!CheckShape(src_format, src_shape)) { if (!CheckShape(src_format, src_shape)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, GELOGE(ACL_ERROR_GE_SHAPE_INVALID,
"[Check][Shape]Failed, not support trans format from %s to %s, src shape %s, data type %s",
TypeUtils::FormatToSerialString(src_format).c_str(), TypeUtils::FormatToSerialString(dst_format).c_str(),
ShapeToString(src_shape).c_str(), TypeUtils::DataTypeToSerialString(data_type).c_str());
REPORT_CALL_ERROR("E19999", "Check shape failed, not support trans format from %s to %s, src shape %s, data type %s",
"[Check][Shape]Failed, not support trans format from %s to %s, "
"src shape %s, data type %s",
TypeUtils::FormatToSerialString(src_format).c_str(),
TypeUtils::FormatToSerialString(dst_format).c_str(),
ShapeToString(src_shape).c_str(),
TypeUtils::DataTypeToSerialString(data_type).c_str());
REPORT_CALL_ERROR("E19999", "Check shape failed, not support trans format from %s to %s, "
"src shape %s, data type %s",
TypeUtils::FormatToSerialString(src_format).c_str(), TypeUtils::FormatToSerialString(src_format).c_str(),
TypeUtils::FormatToSerialString(dst_format).c_str(), TypeUtils::FormatToSerialString(dst_format).c_str(),
ShapeToString(src_shape).c_str(), TypeUtils::DataTypeToSerialString(data_type).c_str());
ShapeToString(src_shape).c_str(),
TypeUtils::DataTypeToSerialString(data_type).c_str());
return ACL_ERROR_GE_SHAPE_INVALID; return ACL_ERROR_GE_SHAPE_INVALID;
} }
ShapeVector hw_shape; ShapeVector hw_shape;
@@ -378,27 +418,38 @@ Status FormatTransferFractalZz::TransShape(Format src_format, const ShapeVector
Status FormatTransferFractalZzND::TransFormat(const TransArgs &args, TransResult &result) { Status FormatTransferFractalZzND::TransFormat(const TransArgs &args, TransResult &result) {
if (!IsDataTypeSupport(args.src_data_type)) { if (!IsDataTypeSupport(args.src_data_type)) {
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, GELOGE(ACL_ERROR_GE_DATATYPE_INVALID,
"[Check][Datatype]Failed, not support trans format from %s to %s, src shape %s, dst shape %s, data type %s",
"[Check][Datatype]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.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, 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());
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, 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_DATATYPE_INVALID; return ACL_ERROR_GE_DATATYPE_INVALID;
} }


if (!IsShapeValid(args.src_shape) || !CheckShape(args.dst_format, args.dst_shape)) { 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.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());
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; return ACL_ERROR_GE_SHAPE_INVALID;
} }
GELOGD("Begin to trans format from %s to %s, src shape %s, dst shape %s, data type %s", GELOGD("Begin to trans format from %s to %s, src shape %s, dst shape %s, data type %s",


Loading…
Cancel
Save