Compare commits

..

1 Commits

@ -195,7 +195,6 @@ set(TRAIN_SRC_LIST
"graph/passes/atomic_addr_clean_pass.cc"
"graph/passes/mark_same_addr_pass.cc"
"graph/passes/mark_graph_unknown_status_pass.cc"
"graph/passes/mark_node_unknown_shape_pass.cc"
"graph/passes/mark_agnostic_pass.cc"
"graph/partition/dynamic_shape_partition.cc"
"graph/partition/stage_partition.cc"
@ -510,7 +509,6 @@ set(INFER_SRC_LIST
"graph/passes/atomic_addr_clean_pass.cc"
"graph/passes/mark_same_addr_pass.cc"
"graph/passes/mark_graph_unknown_status_pass.cc"
"graph/passes/mark_node_unknown_shape_pass.cc"
"graph/passes/mark_agnostic_pass.cc"
"graph/common/omg_util.cc"
"graph/common/bcast.cc"

@ -72,8 +72,7 @@ Status CheckOptionsValid(const std::map<string, string> &options) {
GELOGE(PARAM_INVALID,"[Check][JobId]Failed,"
"the job_id [%s] string length: %zu > max string length: %d",
job_id_iter->second.c_str(), job_id_iter->second.length(), kMaxStrLen);
REPORT_INPUT_ERROR("E10051", std::vector<std::string>({"id","length"}),
std::vector<std::string>({job_id_iter->second, std::to_string(kMaxStrLen)}));
REPORT_INPUT_ERROR("E10051", std::vector<std::string>({"id","length"}), std::vector<std::string>({job_id_iter->second, std::to_string(kMaxStrLen)}));
return FAILED;
}
}

@ -88,7 +88,6 @@ message AippOpParams {
int32 right_padding_size = 69;
int32 top_padding_size = 70;
int32 bottom_padding_size = 71;
float padding_value = 72;
int32 mean_chn_0 = 10;
int32 mean_chn_1 = 11;

@ -111,8 +111,8 @@ Status FileSaver::SaveWithFileHeader(const std::string &file_path, const ModelFi
} while (0);
// Close file
if (mmClose(fd) != 0) { // mmClose 0: success
GELOGE(FAILED, "[Close][File]Failed, error_code:%u errmsg:%s", ret, strerror(errno));
REPORT_INNER_ERROR("E19999", "Close file failed, error_code:%u errmsg:%s", ret, strerror(errno));
GELOGE(FAILED, "[Close][File]Failed, error_code:%u.", ret);
REPORT_INNER_ERROR("E19999", "Close file failed, error_code:%u.", ret);
ret = FAILED;
}
return ret;
@ -148,11 +148,7 @@ Status FileSaver::SaveWithFileHeader(const std::string &file_path, const ModelFi
}
} while (0);
// Close file
if (mmClose(fd) != EN_OK) {
GELOGE(FAILED, "[Close][File]Failed, error_code:%u errmsg:%s", ret, strerror(errno));
REPORT_CALL_ERROR("E19999", "Close file failed, error_code:%u errmsg:%s", ret, strerror(errno));
ret = FAILED;
}
GE_CHK_BOOL_RET_STATUS(mmClose(fd) == EN_OK, FAILED, "Close file failed.");
return ret;
}
@ -350,7 +346,7 @@ Status FileSaver::SaveWithFileHeader(const std::string &file_path, const ModelFi
// Write partition data
auto &cur_partition_datas = all_partition_datas[index];
for (const auto &partition_data : cur_partition_datas) {
GELOGI("part_size[%u]", partition_data.size);
GELOGI("GC:size[%u]", partition_data.size);
GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(
WriteData(static_cast<const void *>(partition_data.data), partition_data.size, fd) != SUCCESS, ret = FAILED;
break);
@ -358,11 +354,7 @@ Status FileSaver::SaveWithFileHeader(const std::string &file_path, const ModelFi
}
} while (0);
// Close file
if (mmClose(fd) != 0) { // mmClose 0: success
GELOGE(FAILED, "[Close][File]Failed, error_code:%u errmsg:%s", ret, strerror(errno));
REPORT_CALL_ERROR("E19999", "Close file failed, error_code:%u errmsg:%s", ret, strerror(errno));
ret = FAILED;
}
GE_CHK_BOOL_RET_STATUS(mmClose(fd) == EN_OK, FAILED, "Close file failed.");
return ret;
}
@ -385,8 +377,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status FileSaver::SaveToFile(co
// Close file
if (mmClose(fd) != 0) { // mmClose 0: success
GELOGE(FAILED, "[Close][File]Failed, error_code:%u errmsg:%s", ret, strerror(errno));
REPORT_CALL_ERROR("E19999", "Close file failed, error_code:%u errmsg:%s", ret, strerror(errno));
GELOGE(FAILED, "[Close][File]Failed, error_code:%u.", ret);
REPORT_INNER_ERROR("E19999", "Close file failed, error_code:%u.", ret);
ret = FAILED;
}
return ret;

@ -96,7 +96,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpManager::SetDumpConf
dump_mode = dump_config.dump_mode;
GELOGI("Dump mode is %s", dump_mode.c_str());
dump_properties.SetDumpMode(dump_mode);
dump_properties_map_[kInferSessionId] = dump_properties;
dump_properties_map_.emplace(kInferSessionId, dump_properties);
return SUCCESS;
}

@ -20,7 +20,6 @@
#include "common/ge/datatype_util.h"
#include "framework/common/debug/ge_log.h"
#include "framework/common/util.h"
#include "framework/common/types.h"
#include "graph/anchor.h"
#include "graph/ge_tensor.h"
#include "graph/op_desc.h"
@ -56,10 +55,8 @@ void DumpOp::SetLoopAddr(void *global_step, void *loop_per_iter, void *loop_cond
loop_cond_ = reinterpret_cast<uintptr_t>(loop_cond);
}
void DumpOp::SetDynamicModelInfo(const string &dynamic_model_name, const string &dynamic_om_name,
uint32_t dynamic_model_id) {
void DumpOp::SetDynamicModelInfo(const string &dynamic_model_name, uint32_t dynamic_model_id) {
dynamic_model_name_ = dynamic_model_name;
dynamic_om_name_ = dynamic_om_name;
dynamic_model_id_ = dynamic_model_id;
}
@ -203,28 +200,6 @@ Status DumpOp::ExecutorDumpOp(aicpu::dump::OpMappingInfo &op_mapping_info) {
return SUCCESS;
}
Status DumpOp::SetDumpModelName(aicpu::dump::OpMappingInfo &op_mapping_info) {
std::set<std::string> model_list = dump_properties_.GetAllDumpModel();
bool not_find_by_omname = model_list.find(dynamic_om_name_) == model_list.end();
bool not_find_by_modelname = model_list.find(dynamic_model_name_) == model_list.end();
std::string dump_model_name = not_find_by_omname ? dynamic_model_name_ : dynamic_om_name_;
if (model_list.find(DUMP_ALL_MODEL) == model_list.end()) {
if (not_find_by_omname && not_find_by_modelname) {
std::string model_list_str;
for (auto &model : model_list) {
model_list_str += "[" + model + "].";
}
GELOGW("Model %s will not be set to dump, dump list: %s", dump_model_name.c_str(), model_list_str.c_str());
return FAILED;
}
}
if (!dump_model_name.empty() && dump_properties_.IsDumpOpen()) {
GELOGD("Dump model name is %s", dump_model_name.c_str());
op_mapping_info.set_model_name(dump_model_name);
}
return SUCCESS;
}
Status DumpOp::LaunchDumpOp() {
GELOGI("Start to launch dump op %s", op_desc_->GetName().c_str());
int32_t device_id = 0;
@ -234,7 +209,8 @@ Status DumpOp::LaunchDumpOp() {
return RT_ERROR_TO_GE_STATUS(rt_ret);
}
if (device_id < 0) {
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "Check device_id failed, device_id = %d, which should be not less than 0.",
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR,
"Check device_id failed, device_id = %d, which should be not less than 0.",
device_id);
return ACL_ERROR_GE_INTERNAL_ERROR;
}
@ -244,12 +220,11 @@ Status DumpOp::LaunchDumpOp() {
op_mapping_info.set_flag(kAicpuLoadFlag);
op_mapping_info.set_dump_step(dump_properties_.GetDumpStep());
op_mapping_info.set_model_id(dynamic_model_id_);
if (SetDumpModelName(op_mapping_info) != SUCCESS) {
return SUCCESS;
if (!dynamic_model_name_.empty() && dump_properties_.IsDumpOpen()) {
op_mapping_info.set_model_name(dynamic_model_name_);
}
SetOpMappingLoopAddr(global_step_, loop_per_iter_, loop_cond_, op_mapping_info);
GELOGI("Dump step is %s ,dump path is %s in Launch dump op", dump_properties_.GetDumpStep().c_str(),
GELOGI("Dump step is %s ,dump path is %s ,in Launch dump op", dump_properties_.GetDumpStep().c_str(),
dump_path.c_str());
uint32_t task_id = 0;
uint32_t stream_id = 0;
@ -298,4 +273,4 @@ Status DumpOp::LaunchDumpOp() {
}
return SUCCESS;
}
} // namespace ge
} // namesapce ge

@ -34,13 +34,12 @@ class DumpOp {
vector<uintptr_t> output_addrs, rtStream_t stream);
Status LaunchDumpOp();
void SetLoopAddr(void *global_step, void *loop_per_iter, void *loop_cond);
void SetDynamicModelInfo(const string &dynamic_model_name, const string &dynamic_om_name, uint32_t dynamic_model_id);
void SetDynamicModelInfo(const string &dynamic_model_name, uint32_t dynamic_model_id);
private:
Status ExecutorDumpOp(aicpu::dump::OpMappingInfo &op_mapping_info);
Status DumpOutput(aicpu::dump::Task &task);
Status DumpInput(aicpu::dump::Task &task);
Status SetDumpModelName(aicpu::dump::OpMappingInfo &op_mapping_info);
DumpProperties dump_properties_;
OpDescPtr op_desc_;
@ -55,7 +54,6 @@ class DumpOp {
uintptr_t loop_cond_;
std::string dynamic_model_name_;
std::string dynamic_om_name_;
std::uint32_t dynamic_model_id_;
};
} // namespace ge

@ -35,7 +35,7 @@ const std::string kDumpStatusOpen = "on";
const uint32_t kAicoreOverflow = (0x1 << 0);
const uint32_t kAtomicOverflow = (0x1 << 1);
const uint32_t kAllOverflow = (kAicoreOverflow | kAtomicOverflow);
} // namespace
}
namespace ge {
FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY DumpProperties::DumpProperties(const DumpProperties &other) {
CopyFrom(other);
@ -149,7 +149,6 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY std::set<std::string> DumpPrope
FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool DumpProperties::IsLayerNeedDump(
const std::string &model, const std::string &om_name, const std::string &op_name) const {
// if dump all
GELOGD("model name is %s om name is %s op is %s in layer need dump", model.c_str(), om_name.c_str(), op_name.c_str());
if (model_dump_properties_map_.find(DUMP_ALL_MODEL) != model_dump_properties_map_.end()) {
return true;
}
@ -271,4 +270,4 @@ void DumpProperties::SetDumpDebugOptions() {
GELOGI("ge.exec.enableDumpDebug is false or is not set.");
}
}
} // namespace ge
} // namespace

@ -155,10 +155,7 @@ 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[]>());
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);
"Failed to alloc the memory for dst buf %zu, data size %zu", total_size, args.src_data_size);
return ACL_ERROR_GE_MEMORY_ALLOCATION;
}

@ -49,15 +49,11 @@ Status CheckArgsForC1hwncoc0ToHwcn(const TransArgs &args) {
return ACL_ERROR_GE_DATATYPE_INVALID;
}
if (!CheckShapeValid(src_shape, kC1hwncoc0DimsNum)) {
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());
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Failed to check src shape %s", ShapeToString(src_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
if (!CheckShapeValid(dst_shape, kHwcnDimsNum)) {
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, "Failed to check dst shape %s.", ShapeToString(dst_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
auto cube_size = GetCubeSizeByDataType(args.src_data_type);
@ -78,16 +74,9 @@ 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[]>());
if (dst == nullptr) {
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(),
"Failed to trans format from %s to %s, can not alloc the memory for dst buf %ld, shape %s",
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.dst_format).c_str(), total_size, ShapeToString(args.dst_shape).c_str());
return ACL_ERROR_GE_MEMORY_ALLOCATION;
}
@ -127,16 +116,10 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, int size
static_cast<size_t>(size));
if (ret != EOK) {
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED,
"[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",
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 "
"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;
}
}
@ -162,13 +145,8 @@ Status FormatTransferC1hwncoc0Hwcn::TransFormat(const TransArgs &args, TransResu
result.length = static_cast<size_t>(total_size);
return SUCCESS;
}
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());
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());
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Get %ld total size from dst shape %s, src shape %s.", total_size,
ShapeToString(args.dst_shape).c_str(), ShapeToString(args.src_shape).c_str());
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.",
@ -176,16 +154,9 @@ 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",
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",
ShapeToString(args.src_shape).c_str(),
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str(),
ShapeToString(args.dst_shape).c_str(), total_size, ret);
GELOGE(ret, "Failed to get data after trans, src shape %s, data type %s, dst shape %s, memory size %ld",
ShapeToString(args.src_shape).c_str(), TypeUtils::DataTypeToSerialString(args.src_data_type).c_str(),
ShapeToString(args.dst_shape).c_str(), total_size);
return ret;
}
return SUCCESS;

@ -94,14 +94,10 @@ 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[]>());
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());
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());
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION,
"Failed to trans format from %s to %s, can not alloc the memory for dst buf %ld",
TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str(), dst_size);
return ACL_ERROR_GE_MEMORY_ALLOCATION;
}
@ -127,10 +123,9 @@ Status TransFormatDhwckToFz3D(const TransArgs &args, TransResult &result) {
args.data + src_idx * data_size, static_cast<size_t>(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,
"Failed to operate the dst memory at offset %ld, error-code %d, pad mode %d",
dst_offset, ret, pad_zero);
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
}
}

@ -95,14 +95,10 @@ Status TransFormatDhwncToFz3DTranspose(const TransArgs &args, TransResult &resul
std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[dst_size], std::default_delete<uint8_t[]>());
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());
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());
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION,
"Failed to trans format from %s to %s, can not alloc the memory for dst buf %ld",
TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str(), dst_size);
return ACL_ERROR_GE_MEMORY_ALLOCATION;
}
@ -128,10 +124,9 @@ Status TransFormatDhwncToFz3DTranspose(const TransArgs &args, TransResult &resul
args.data + src_idx * data_size, static_cast<size_t>(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,
"Failed to operate the dst memory at offset %ld, error-code %d, pad mode %d",
dst_offset, ret, pad_zero);
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
}
}

@ -87,10 +87,7 @@ 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());
REPORT_CALL_ERROR("E19999", "Failed to check dst shape %s",
ShapeToString(dst_shape).c_str());
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Failed to check dst shape %s", ShapeToString(dst_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
return SUCCESS;
@ -109,10 +106,7 @@ 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());
REPORT_CALL_ERROR("E19999", "Failed to check dst shape %s",
ShapeToString(dst_shape).c_str());
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Failed to check dst shape %s", ShapeToString(dst_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
return SUCCESS;
@ -123,12 +117,10 @@ 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(),
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);
GELOGE(ret, "Trans shape from %s to %s, shape %s to %s, data type %s failed",
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());
return ret;
}
if (!IsTransShapeSrcCorrect(args, expect_src_shape)) {
@ -147,14 +139,10 @@ 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[]>());
if (dst == nullptr) {
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][DSTMemory]Failed to allocate 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 allocate memory for dst buf %ld "
"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,
"Failed to trans format from %s to %s, can not alloc the memory for dst buf %ld",
TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str(), dst_size);
return ACL_ERROR_GE_MEMORY_ALLOCATION;
}
@ -188,10 +176,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,
static_cast<size_t>(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,
"Failed to operate the dst memory at offset %ld, error-code %d", dst_offset, ret);
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
}
}
@ -205,10 +191,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,
static_cast<size_t>(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,
"Failed to operate the dst memory at offset %ld, error-code %d", dst_offset, ret);
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
}
}
@ -229,12 +213,8 @@ 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[]>());
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(),
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",
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION,
"Failed to trans format from %s to %s, can not alloc the memory for dst buf %ld",
TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str(), dst_size);
return ACL_ERROR_GE_MEMORY_ALLOCATION;
@ -270,11 +250,8 @@ 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,
static_cast<size_t>(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,
"Failed to operate the dst memory at offset %ld, error-code %d", dst_offset, ret);
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
}
}
@ -288,11 +265,8 @@ 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,
static_cast<size_t>(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,
"Failed to operate the dst memory at offset %ld, error-code %d", dst_offset, ret);
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
}
}
@ -307,38 +281,18 @@ 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",
"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(),
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;
}
if (!CheckShape(args.src_format, args.src_shape) || !IsShapeValid(args.dst_shape)) {
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",
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",
"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());
return ACL_ERROR_GE_SHAPE_INVALID;
}
GELOGD("Begin to trans format from %s to %s, src shape %s, dst shape %s, data type %s",
@ -361,34 +315,16 @@ Status FormatTransferFractalNz::TransShape(Format src_format, const ShapeVector
Format dst_format, ShapeVector &dst_shape) {
if (!IsDataTypeSupport(data_type)) {
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());
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());
"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;
}
if (!CheckShape(src_format, src_shape)) {
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());
"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;
}
ShapeVector hw_shape;
@ -398,39 +334,19 @@ Status FormatTransferFractalNz::TransShape(Format src_format, const ShapeVector
Status FormatTransferFractalNzND::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",
"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(),
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;
}
if (!IsShapeValid(args.src_shape) || !CheckShape(args.dst_format, args.dst_shape)) {
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",
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",
"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());
return ACL_ERROR_GE_SHAPE_INVALID;
}
GELOGD("Begin to trans format from %s to %s, src shape %s, dst shape %s, data type %s",

@ -73,9 +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(c0);
if (!IsShapeValid(dst_shape)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Failed, dst shape %s",
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "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;
@ -103,9 +102,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(cube_k);
if (!IsShapeValid(dst_shape)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Failed, dst shape %s",
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "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;
@ -192,14 +190,10 @@ 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[]>());
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());
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());
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION,
"Failed to trans format from %s to %s, can not alloc the memory for dst buf %ld",
TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str(), dst_size);
return ACL_ERROR_GE_MEMORY_ALLOCATION;);
for (int64_t vfi = 0; vfi < vf_cnt; vfi++) {
@ -243,12 +237,9 @@ 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);
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED,
"Failed to operate the dst memory at offset %ld, error-code %d pad mode %d", offset,
ret, need_pad_zero);
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
}
}
@ -269,11 +260,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", 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);
GELOGE(GRAPH_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);
return GRAPH_FAILED;
}
const int64_t cube_k = GetCubeSizeByDataType(args.src_data_type);
@ -294,20 +282,14 @@ Status TransFormatHwcnToFzWithGroups(const TransArgs &args, TransResult &result,
errno_t ret = EOK;
std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[size_output_data], std::default_delete<uint8_t[]>());
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());
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());
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "Failed to trans format from %s to %s, can not alloc the memory for dst buf %ld",
TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str(), size_output_data);
return ACL_ERROR_GE_MEMORY_ALLOCATION;
}
ret = memset_s(dst.get(), static_cast<size_t>(size_output_data), 0, static_cast<size_t>(size_output_data));
if (ret != EOK) {
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Operate][DSTMemory]Failed, ret is %d", ret);
REPORT_CALL_ERROR("E19999", "Failed to operate dst memory, ret is %d", ret);
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "Failed to operate the dst memory, ret is %d", ret);
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
}
for (int64_t g = 0; g < groups; g++) {
@ -370,14 +352,10 @@ 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[]>());
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());
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());
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION,
"Failed to trans format from %s to %s, can not alloc the memory for dst buf %ld",
TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str(), dst_size);
return ACL_ERROR_GE_MEMORY_ALLOCATION;);
for (int64_t c1i = 0; c1i < c1; c1i++) {
@ -397,8 +375,8 @@ Status TransFormatHwcnToFz(const TransArgs &args, TransResult &result) {
static_cast<size_t>(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",
GELOGE(ACL_ERROR_GE_PARAM_INVALID,
"Failed to operate the dst memory, protected_size is %ld and size is %ld",
protected_size, data_size);
return ACL_ERROR_GE_PARAM_INVALID;
}
@ -410,10 +388,8 @@ 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",
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED,
"Failed to operate the dst memory at offset %ld, error-code %d, pad mode %d",
dst_offset, ret, pad_zero);
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
}
@ -454,14 +430,10 @@ 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[]>());
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());
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());
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION,
"Failed to trans format from %s to %s, can not alloc the memory for dst buf %ld",
TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str(), dst_size);
return ACL_ERROR_GE_MEMORY_ALLOCATION;);
for (int64_t c1i = 0; c1i < c1; c1i++) {
@ -481,8 +453,8 @@ Status TransFormatNhwcToFz(const TransArgs &args, TransResult &result) {
static_cast<size_t>(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",
GELOGE(ACL_ERROR_GE_PARAM_INVALID,
"Failed to operate the dst memory, protected_size is %ld and size is %ld",
protected_size, data_size);
return ACL_ERROR_GE_PARAM_INVALID;
}
@ -494,10 +466,8 @@ 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",
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED,
"Failed to operate the dst memory at offset %ld, error-code %d, pad mode %d",
dst_offset, ret, pad_zero);
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
}

@ -41,26 +41,16 @@ Status CheckArgsForFracZToHwcn(const TransArgs &args) {
return ACL_ERROR_GE_FORMAT_INVALID;
}
if (!CheckDataTypeSupported(args.src_data_type)) {
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "[Check][DataType]Failed, "
"shape from FORMAT_FRACTAL_Z to HWCN, invalid data type %s",
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str());
REPORT_INNER_ERROR("E19999", "Failed to trans shape from FORMAT_FRACTAL_Z to HWCN, "
"invalid data type %s",
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "Failed to trans shape from FORMAT_FRACTAL_Z to HWCN, invalid data type %s",
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str());
return ACL_ERROR_GE_DATATYPE_INVALID;
}
if (!CheckShapeValid(src_shape, kFracZDimsNum)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Value is invalid, src shape %s",
ShapeToString(src_shape).c_str());
REPORT_CALL_ERROR("E19999", "Src shape %s check invalid",
ShapeToString(src_shape).c_str());
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Failed to check src shape %s", ShapeToString(src_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
if (!CheckShapeValid(dst_shape, kHwcnDimsNum)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Value is invalid, dst shape %s",
ShapeToString(dst_shape).c_str());
REPORT_CALL_ERROR("E19999", "Dst shape %s check invalid",
ShapeToString(dst_shape).c_str());
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Failed to check dst shape %s", ShapeToString(dst_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
int64_t c0 = GetCubeSizeByDataType(args.src_data_type);
@ -85,16 +75,9 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, const in
std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[total_size], std::default_delete<uint8_t[]>());
if (dst == nullptr) {
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION,
"[Allocate][DSTMemory]Failed, memory for dst buf %ld, shape %s "
"when trans format from %s to %s",
total_size, ShapeToString(args.dst_shape).c_str(),
TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str());
REPORT_CALL_ERROR("E19999", "Failed to alloc the memory for dst buf %ld, shape %s "
"when trans format from %s to %s",
total_size, ShapeToString(args.dst_shape).c_str(),
"Failed to trans format from %s to %s, can not alloc the memory for dst buf %ld, shape %s",
TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str());
TypeUtils::FormatToSerialString(args.dst_format).c_str(), total_size, ShapeToString(args.dst_shape).c_str());
return ACL_ERROR_GE_MEMORY_ALLOCATION;
}
@ -132,11 +115,8 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, const in
static_cast<size_t>(size));
if (ret != EOK) {
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED,
"[Operate][Memory]Failed to copy data from FracZ offset %ld to "
"HWCN[%ld, %ld, %ld, %ld] offset %ld, err-code %d",
src_offset, h_idx, w_idx, c_idx, n_idx, dst_offset, ret);
REPORT_CALL_ERROR("E19999", "Failed to copy data from FracZ offset %ld to "
"HWCN[%ld, %ld, %ld, %ld], offset %ld, err-code %d",
"Failed to copy data from FracZ offset %ld to HWCN[%ld, %ld, %ld, %ld] "
"offset %ld, err-code %d",
src_offset, h_idx, w_idx, c_idx, n_idx, dst_offset, ret);
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
}
@ -163,11 +143,8 @@ Status FormatTransferFracZHwcn::TransFormat(const TransArgs &args, TransResult &
result.length = static_cast<size_t>(total_size);
return SUCCESS;
}
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Get][ShapeSize]Failed, "
"total size %ld from dst shape %s, src shape %s", total_size,
ShapeToString(args.dst_shape).c_str(), ShapeToString(args.src_shape).c_str());
REPORT_CALL_ERROR("E19999", "Failed to get total size %ld from "
"dst shape %s, src shape %s", total_size,
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Get %ld total size from dst shape %s, src shape %s", total_size,
ShapeToString(args.dst_shape).c_str(), ShapeToString(args.src_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
@ -176,16 +153,9 @@ Status FormatTransferFracZHwcn::TransFormat(const TransArgs &args, TransResult &
ShapeToString(args.dst_shape).c_str(), total_size);
ret = GetDstDataAfterTrans(args, result, size, total_size);
if (ret != SUCCESS) {
GELOGE(ret, "[Get][Data]Failed 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",
ShapeToString(args.src_shape).c_str(),
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str(),
ShapeToString(args.dst_shape).c_str(), total_size, ret);
GELOGE(ret, "Failed to get data after trans, src shape %s, data type %s, dst shape %s, memory size %ld",
ShapeToString(args.src_shape).c_str(), TypeUtils::DataTypeToSerialString(args.src_data_type).c_str(),
ShapeToString(args.dst_shape).c_str(), total_size);
return ret;
}
return SUCCESS;

@ -41,26 +41,16 @@ Status CheckArgsForFracZToNchw(const TransArgs &args) {
return ACL_ERROR_GE_FORMAT_INVALID;
}
if (!CheckDataTypeSupported(args.src_data_type)) {
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "[Check][DataType]Failed, "
"shape from FORMAT_FRACTAL_Z to NCHW, invalid data type %s",
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str());
REPORT_INNER_ERROR("E19999", "Failed to trans shape from FORMAT_FRACTAL_Z to NCHW, "
"invalid data type %s",
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "Failed to trans shape from FORMAT_FRACTAL_Z to NCHW, invalid data type %s",
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str());
return ACL_ERROR_GE_DATATYPE_INVALID;
}
if (!CheckShapeValid(src_shape, kFracZDimsNum)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Value is invalid, src shape %s",
ShapeToString(src_shape).c_str());
REPORT_CALL_ERROR("E19999", "Src shape %s check invalid",
ShapeToString(src_shape).c_str());
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Failed to check src shape %s", ShapeToString(src_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
if (!CheckShapeValid(dst_shape, kNchwDimsNum)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Value is invalid, dst shape %s",
ShapeToString(dst_shape).c_str());
REPORT_CALL_ERROR("E19999", "Dst shape %s check invalid",
ShapeToString(dst_shape).c_str());
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Failed to check dst shape %s", ShapeToString(dst_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
int64_t c0 = GetCubeSizeByDataType(args.src_data_type);
@ -72,11 +62,7 @@ Status CheckArgsForFracZToNchw(const TransArgs &args) {
if (src_shape.at(kFracZHWC1) != dst_shape.at(kNchwH) * dst_shape.at(kNchwW) * c1 ||
src_shape.at(kFracZC0) != c0 || src_shape.at(kFracZNi) != kNiSize || src_shape.at(kFracZN0) != n0) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID,
"[Check][Shape]Failed to check relationship between src and dst shape, "
"src shape %s, dst shape %s",
ShapeToString(src_shape).c_str(), ShapeToString(dst_shape).c_str());
REPORT_INNER_ERROR("E19999", "Failed to check relationship between src and dst shape, "
"src shape %s, dst shape %s",
"Failed to check relationship between src and dst shape, src shape %s, dst shape %s",
ShapeToString(src_shape).c_str(), ShapeToString(dst_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
@ -88,16 +74,9 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, const in
std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[total_size], std::default_delete<uint8_t[]>());
if (dst == nullptr) {
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION,
"[Allocate][DSTMemory]Failed, memory for dst buf %ld, shape %s "
"when trans format from %s to %s",
total_size, ShapeToString(args.dst_shape).c_str(),
TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str());
REPORT_CALL_ERROR("E19999", "Failed to alloc the memory for dst buf %ld, shape %s "
"when trans format from %s to %s",
total_size, ShapeToString(args.dst_shape).c_str(),
"Failed to trans format from %s to %s, can not alloc the memory for dst buf %ld, shape %s",
TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str());
TypeUtils::FormatToSerialString(args.dst_format).c_str(), total_size, ShapeToString(args.dst_shape).c_str());
return ACL_ERROR_GE_MEMORY_ALLOCATION;
}
@ -135,12 +114,9 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, const in
static_cast<size_t>(size));
if (ret != EOK) {
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED,
"[Operate][Memory]Failed to copy data from FracZ offset %ld to "
"NCHW[%ld, %ld, %ld, %ld] offset %ld, err-code %d",
"Failed to copy data from FracZ offset %ld to NCHW[%ld, %ld, %ld, %ld] offset %ld, "
"err-code %d",
src_offset, n_idx, c_idx, h_idx, w_idx, dst_offset, ret);
REPORT_CALL_ERROR("E19999","Failed to copy data from FracZ offset %ld to "
"NCHW[%ld, %ld, %ld, %ld] offset %ld, err-code %d",
src_offset, n_idx, c_idx, h_idx, w_idx, dst_offset, ret );
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
}
}
@ -167,11 +143,7 @@ Status FormatTransferFracZNchw::TransFormat(const TransArgs &args, TransResult &
return SUCCESS;
}
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Get][ShapeSize]Failed, total size %ld from dst shape %s, "
"src shape %s", total_size,
ShapeToString(args.dst_shape).c_str(), ShapeToString(args.src_shape).c_str());
REPORT_CALL_ERROR("E19999", "Failed to get total size %ld from dst shape %s, src shape %s",
total_size,
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Get %ld total size from dst shape %s, src shape %s", total_size,
ShapeToString(args.dst_shape).c_str(), ShapeToString(args.src_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
@ -181,15 +153,8 @@ Status FormatTransferFracZNchw::TransFormat(const TransArgs &args, TransResult &
ret = GetDstDataAfterTrans(args, result, size, total_size);
if (ret != SUCCESS) {
GELOGE(ret, "[Get][Data]Failed, after trans, src shape %s, data type %s, "
"dst shape %s, memory size %ld",
ShapeToString(args.src_shape).c_str(),
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str(),
ShapeToString(args.dst_shape).c_str(), total_size);
REPORT_CALL_ERROR("E19999", "Failed to get data after trans, src shape %s, "
"data type %s, dst shape %s, memory size %ld",
ShapeToString(args.src_shape).c_str(),
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str(),
GELOGE(ret, "Failed to get data after trans, src shape %s, data type %s, dst shape %s, memory size %ld",
ShapeToString(args.src_shape).c_str(), TypeUtils::DataTypeToSerialString(args.src_data_type).c_str(),
ShapeToString(args.dst_shape).c_str(), total_size);
return ret;
}

@ -41,26 +41,16 @@ Status CheckArgsForFracZToNhwc(const TransArgs &args) {
return ACL_ERROR_GE_FORMAT_INVALID;
}
if (!CheckDataTypeSupported(args.src_data_type)) {
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "[Check][DataType]Failed, "
"shape from FORMAT_FRACTAL_Z to NCHW, invalid data type %s",
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str());
REPORT_INNER_ERROR("E19999", "Failed to trans shape from FORMAT_FRACTAL_Z to NCHW, "
"invalid data type %s",
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "Failed to trans shape from FORMAT_FRACTAL_Z to NHWC, invalid data type %s",
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str());
return ACL_ERROR_GE_DATATYPE_INVALID;
}
if (!CheckShapeValid(src_shape, kFracZDimsNum)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Value is invalid, src shape %s",
ShapeToString(src_shape).c_str());
REPORT_CALL_ERROR("E19999", "Src shape %s check invalid",
ShapeToString(src_shape).c_str());
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Failed to check src shape %s", ShapeToString(src_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
if (!CheckShapeValid(dst_shape, kNhwcDimsNum)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Value is invalid, dst shape %s",
ShapeToString(dst_shape).c_str());
REPORT_CALL_ERROR("E19999", "Dst shape %s check invalid",
ShapeToString(dst_shape).c_str());
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Failed to check dst shape %s", ShapeToString(dst_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
int64_t c0 = GetCubeSizeByDataType(args.src_data_type);
@ -72,11 +62,7 @@ Status CheckArgsForFracZToNhwc(const TransArgs &args) {
if (src_shape.at(kFracZHWC1) != dst_shape.at(kNhwcH) * dst_shape.at(kNhwcW) * c1 ||
src_shape.at(kFracZC0) != c0 || src_shape.at(kFracZNi) != kNiSize || src_shape.at(kFracZN0) != n0) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID,
"[Check][Shape]Failed to check relationship between src and dst shape, "
"src shape %s, dst shape %s",
ShapeToString(src_shape).c_str(), ShapeToString(dst_shape).c_str());
REPORT_INNER_ERROR("E19999", "Failed to check relationship between src and dst shape, "
"src shape %s, dst shape %s",
"Failed to check relationship between src and dst shape, src shape %s, dst shape %s",
ShapeToString(src_shape).c_str(), ShapeToString(dst_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
@ -88,16 +74,9 @@ 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[]>());
if (dst == nullptr) {
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION,
"[Allocate][DSTMemory]Failed, memory for dst buf %ld, "
"shape %s when trans format from %s to %s",
total_size, ShapeToString(args.dst_shape).c_str(),
TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str());
REPORT_CALL_ERROR("E19999", "Failed to alloc the memory for dst buf %ld, "
"shape %s when trans format from %s to %s",
total_size, ShapeToString(args.dst_shape).c_str(),
"Failed to trans format from %s to %s, can not alloc the memory for dst buf %ld, shape %s",
TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str());
TypeUtils::FormatToSerialString(args.dst_format).c_str(), total_size, ShapeToString(args.dst_shape).c_str());
return ACL_ERROR_GE_MEMORY_ALLOCATION;
}
@ -135,12 +114,8 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, int size
static_cast<size_t>(size));
if (ret != EOK) {
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED,
"[Operate][Memory]Failed to copy data from FracZ offset %ld to "
"NCHW[%ld, %ld, %ld, %ld] offset %ld, err-code %d",
src_offset, n_idx, c_idx, h_idx, w_idx, dst_offset, ret);
REPORT_CALL_ERROR("E19999","Failed to copy data from FracZ offset %ld to "
"NCHW[%ld, %ld, %ld, %ld] offset %ld, err-code %d",
src_offset, n_idx, c_idx, h_idx, w_idx, dst_offset, ret);
"Failed to copy data from FracZ offset %ld to HHWC[%ld, %ld, %ld, %ld] offset %ld, err-code %d",
src_offset, n_idx, h_idx, w_idx, c_idx, dst_offset, ret);
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
}
}
@ -167,11 +142,7 @@ Status FormatTransferFracZNhwc::TransFormat(const TransArgs &args, TransResult &
return SUCCESS;
}
GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Get][ShapeSize]Failed, total size %ld from dst shape %s, "
"src shape %s", total_size,
ShapeToString(args.dst_shape).c_str(), ShapeToString(args.src_shape).c_str());
REPORT_CALL_ERROR("E19999", "Failed to get total size %ld from dst shape %s, src shape %s",
total_size,
GELOGE(ACL_ERROR_GE_PARAM_INVALID, "Get %ld total size from dst shape %s, src shape %s", total_size,
ShapeToString(args.dst_shape).c_str(), ShapeToString(args.src_shape).c_str());
return ACL_ERROR_GE_PARAM_INVALID;
}
@ -180,16 +151,9 @@ Status FormatTransferFracZNhwc::TransFormat(const TransArgs &args, TransResult &
ShapeToString(args.dst_shape).c_str(), total_size);
ret = GetDstDataAfterTrans(args, result, size, total_size);
if (ret != SUCCESS) {
GELOGE(ret, "[Get][Data]Failed, 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",
ShapeToString(args.src_shape).c_str(),
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str(),
ShapeToString(args.dst_shape).c_str(), total_size, ret);
GELOGE(ret, "Failed to get data after trans, src shape %s, data type %s, dst shape %s, memory size %ld",
ShapeToString(args.src_shape).c_str(), TypeUtils::DataTypeToSerialString(args.src_data_type).c_str(),
ShapeToString(args.dst_shape).c_str(), total_size);
return ret;
}
return SUCCESS;

@ -43,9 +43,7 @@ Status TransShapeHwcnToC1hwncoc0(const DataType &data_type, const std::vector<in
dst_shape.push_back(cube_size);
dst_shape.push_back(cube_size);
if (!CheckShapeValid(dst_shape, kC1hwncoc0DimsNum)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Value is invalid, dst shape %s",
ShapeToString(dst_shape).c_str());
REPORT_CALL_ERROR("E19999", "Dst shape %s check invalid",
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Failed to check dst shape %s",
ShapeToString(dst_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
@ -61,26 +59,16 @@ Status CheckArgsForHwcnToC1hwncoc0(const TransArgs &args) {
return ACL_ERROR_GE_FORMAT_INVALID;
}
if (!CheckDataTypeSupported(args.src_data_type)) {
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "[Trans][Shape]Failed, "
"shape from HWCN to C1HWNCoC0, invalid data type %s",
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str());
REPORT_INNER_ERROR("E19999", "Failed to trans shape from HWCN to C1HWNCoC0, "
"invalid data type %s",
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "Failed to trans shape from HWCN to C1HWNCoC0, invalid data type %s",
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str());
return ACL_ERROR_GE_DATATYPE_INVALID;
}
if (!CheckShapeValid(args.src_shape, kHwcnDimsNum)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Value is invalid, src shape %s",
ShapeToString(args.src_shape).c_str());
REPORT_CALL_ERROR("E19999", "Src shape %s check invalid",
ShapeToString(args.src_shape).c_str());
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Failed to check src shape %s", ShapeToString(args.src_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
if (!CheckShapeValid(args.dst_shape, kC1hwncoc0DimsNum)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Value is invalid, dst shape %s",
ShapeToString(args.dst_shape).c_str());
REPORT_CALL_ERROR("E19999", "Dst shape %s check invalid",
ShapeToString(args.dst_shape).c_str());
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Failed to check dst shape %s", ShapeToString(args.dst_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
std::vector<int64_t> expect_dst_shape;
@ -90,14 +78,10 @@ Status CheckArgsForHwcnToC1hwncoc0(const TransArgs &args) {
}
if (args.dst_shape != expect_dst_shape) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID,
"[Trans][Shape]Failed, src shape %s and dst shape %s are not compatible. "
"Failed to trans format, src and dst shape are not compatible. src shape %s, dst shape %s, "
"expect dst shape %s",
ShapeToString(args.src_shape).c_str(), ShapeToString(args.dst_shape).c_str(),
ShapeToString(expect_dst_shape).c_str());
REPORT_INNER_ERROR("E19999", "Failed to trans format, src shape %s and dst shape %s "
"are not compatible. expect dst shape %s",
ShapeToString(args.src_shape).c_str(), ShapeToString(args.dst_shape).c_str(),
ShapeToString(expect_dst_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
@ -107,16 +91,10 @@ Status CheckArgsForHwcnToC1hwncoc0(const TransArgs &args) {
Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, const int size, const int64_t total_size) {
std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[total_size], std::default_delete<uint8_t[]>());
if (dst == nullptr) {
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][DSTMemory]Failed, "
"memory for dst buf %ld, shape %s when trans format from %s to %s",
total_size, ShapeToString(args.dst_shape).c_str(),
TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str());
REPORT_CALL_ERROR("E19999", "Failed to alloc the memory for dst buf %ld, "
"shape %s when trans format from %s to %s",
total_size, ShapeToString(args.dst_shape).c_str(),
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION,
"Failed to trans format from %s to %s, can not alloc the memory for dst buf %ld, shape %s",
TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str());
TypeUtils::FormatToSerialString(args.dst_format).c_str(), total_size, ShapeToString(args.dst_shape).c_str());
return ACL_ERROR_GE_MEMORY_ALLOCATION;
}
@ -158,17 +136,11 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, const in
auto ret = memcpy_s(dst.get() + dst_offset, static_cast<size_t>(protected_size), args.data + src_offset,
static_cast<size_t>(size));
if (ret != EOK) {
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Copy][Data]Failed, "
"data from HWCN[%ld, %ld, %ld, %ld] offset %ld to "
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED,
"Failed to copy data from HWCN[%ld, %ld, %ld, %ld] offset %ld to "
"C1HWNCoC0[%ld, %ld, %ld, %ld, %ld, %ld] offset %ld, err-code %d",
h_idx, w_idx, c_idx, n_idx, src_offset, c1_idx, h_idx, w_idx,
n_idx, co_idx, c0_idx, dst_offset, ret);
REPORT_CALL_ERROR("E19999", "Failed to copy data from "
"HWCN[%ld, %ld, %ld, %ld] offset %ld "
"to, C1HWNCoC0[%ld, %ld, %ld, %ld, %ld, %ld] "
"offset %ld, err-code %d",
h_idx, w_idx, c_idx, n_idx, src_offset, c1_idx, h_idx, w_idx,
n_idx, co_idx, c0_idx, dst_offset, ret);
h_idx, w_idx, c_idx, n_idx, src_offset, c1_idx, h_idx, w_idx, n_idx, co_idx, c0_idx,
dst_offset, ret);
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
}
} else {
@ -176,11 +148,7 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, const in
memset_s(dst.get() + dst_offset, static_cast<size_t>(protected_size), 0, static_cast<size_t>(size));
if (ret != EOK) {
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED,
"[Operate][Memory]Failed to set to 0 to "
"C1HWNCoC0[%ld, %ld, %ld, %ld, %ld, %ld] offset %ld, err-code %d",
c1_idx, h_idx, w_idx, n_idx, co_idx, c0_idx, dst_offset, ret);
REPORT_CALL_ERROR("E19999", "Failed to set to 0 to "
"C1HWNCoC0[%ld, %ld, %ld, %ld, %ld, %ld] offset %ld, "
"Failed to set to 0 to C1HWNCoC0[%ld, %ld, %ld, %ld, %ld, %ld] offset %ld, "
"err-code %d",
c1_idx, h_idx, w_idx, n_idx, co_idx, c0_idx, dst_offset, ret);
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
@ -212,11 +180,7 @@ Status FormatTransferHwcnC1hwncoc0::TransFormat(const TransArgs &args, TransResu
return SUCCESS;
}
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Get][ShapeSize]Failed, total size %ld from dst shape %s, "
"src shape %s", total_size,
ShapeToString(args.dst_shape).c_str(), ShapeToString(args.src_shape).c_str());
REPORT_CALL_ERROR("E19999", "Failed to get total size %ld from dst shape %s, src shape %s",
total_size,
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Get %ld total size from dst shape %s, src shape %s", total_size,
ShapeToString(args.dst_shape).c_str(), ShapeToString(args.src_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
@ -226,16 +190,9 @@ Status FormatTransferHwcnC1hwncoc0::TransFormat(const TransArgs &args, TransResu
ret = GetDstDataAfterTrans(args, result, size, total_size);
if (ret != SUCCESS) {
GELOGE(ret, "[Get][Data]Failed, 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",
ShapeToString(args.src_shape).c_str(),
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str(),
ShapeToString(args.dst_shape).c_str(), total_size, ret);
GELOGE(ret, "Failed to get data after trans, src shape %s, data type %s, dst shape %s, memory size %ld",
ShapeToString(args.src_shape).c_str(), TypeUtils::DataTypeToSerialString(args.src_data_type).c_str(),
ShapeToString(args.dst_shape).c_str(), total_size);
return ret;
}
return SUCCESS;
@ -245,9 +202,7 @@ Status FormatTransferHwcnC1hwncoc0::TransShape(Format src_format, const std::vec
DataType data_type, Format dst_format, std::vector<int64_t> &dst_shape) {
if (src_format == FORMAT_HWCN && CheckDataTypeSupported(data_type)) {
if (!CheckShapeValid(src_shape, kHwcnDimsNum)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Value is invalid, src shape %s",
ShapeToString(src_shape).c_str());
REPORT_CALL_ERROR("E19999", "Src shape %s check invalid",
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Failed to check src shape %s",
ShapeToString(src_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}

@ -41,43 +41,28 @@ Status CheckArgsForNc1hwc0ToNchw(const TransArgs &args) {
return ACL_ERROR_GE_FORMAT_INVALID;
}
if (!CheckDataTypeSupported(args.src_data_type)) {
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "[Check][DataType]Failed, shape from NC1HWC0 to NCHW, "
"invalid data type %s",
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str());
REPORT_INNER_ERROR("E19999", "Failed to trans shape from NC1HWC0 to NCHW, invalid data type %s",
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "Failed to trans shape from NC1HWC0 to NCHW, invalid data type %s",
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str());
return ACL_ERROR_GE_DATATYPE_INVALID;
}
if (!CheckShapeValid(args.src_shape, kNc1hwc0DimsNum)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Value is invalid, src shape %s",
ShapeToString(args.src_shape).c_str());
REPORT_CALL_ERROR("E19999", "Src shape %s check invalid",
ShapeToString(args.src_shape).c_str());
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Failed to check src shape %s", ShapeToString(args.src_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
if (!CheckShapeValid(args.dst_shape, kNchwDimsNum)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Value is invalid, dst shape %s",
ShapeToString(args.dst_shape).c_str());
REPORT_CALL_ERROR("E19999", "Dst shape %s check invalid",
ShapeToString(args.dst_shape).c_str());
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Failed to check dst shape %s", ShapeToString(args.dst_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
int64_t c0 = GetCubeSizeByDataType(args.src_data_type);
if (c0 <= 0) {
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "[Get][Cube]Failed, the data type %s is invalid",
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str());
REPORT_CALL_ERROR("E19999", "Failed to get cube size, the data tyep %s is invalid",
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str());
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "Failed to get cube size, the data type is invalid");
return ACL_ERROR_GE_DATATYPE_INVALID;
}
if (src_shape.at(kNc1hwc0H) != dst_shape.at(kNchwH) || src_shape.at(kNc1hwc0W) != dst_shape.at(kNchwW) ||
src_shape.at(kNc1hwc0N) != dst_shape.at(kNchwN) || src_shape.at(kNc1hwc0C0) != c0 ||
src_shape.at(kNc1hwc0C1) != (Ceil(dst_shape.at(kNchwC), c0))) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Failed to check relationship between "
"src shape %s and dst shape %s",
ShapeToString(src_shape).c_str(), ShapeToString(dst_shape).c_str());
REPORT_INNER_ERROR("E19999", "Failed to check relationship between src shape %s "
"and dst shape %s",
GELOGE(ACL_ERROR_GE_SHAPE_INVALID,
"Failed to check relationship between src and dst shape, src shape %s, dst shape %s",
ShapeToString(src_shape).c_str(), ShapeToString(dst_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
@ -88,16 +73,10 @@ Status CheckArgsForNc1hwc0ToNchw(const TransArgs &args) {
Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, const int size, const int64_t total_size) {
std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[total_size], std::default_delete<uint8_t[]>());
if (dst == nullptr) {
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][DSTMemory]Failed, "
"memory for dst buf %ld, shape %s when trans format from %s to %s",
total_size, ShapeToString(args.dst_shape).c_str(),
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION,
"Failed to trans format from %s to %s, can not alloc the memory for dst buf %ld, shape %s",
TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str());
REPORT_CALL_ERROR("E19999", "Failed to alloc the memory for dst buf %ld, "
"shape %s when trans format from %s to %s",
total_size, ShapeToString(args.dst_shape).c_str(),
TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str());
TypeUtils::FormatToSerialString(args.dst_format).c_str(), total_size, ShapeToString(args.dst_shape).c_str());
return ACL_ERROR_GE_MEMORY_ALLOCATION;
}
@ -132,16 +111,10 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, const in
auto ret = memcpy_s(dst.get() + dst_offset, static_cast<size_t>(protected_size), args.data + src_offset,
static_cast<size_t>(size));
if (ret != EOK) {
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Copy][Data]Failed, data from "
"NC1HWC0[%ld, %ld, %ld, %ld, %ld] "
"src offset %ld to NCHW[%ld, %ld, %ld, %ld], dst offset %ld, err-code %d",
n_idx, c1_idx, h_idx, w_idx, c0_idx, src_offset, n_idx,
c_idx, h_idx, w_idx, dst_offset, ret);
REPORT_CALL_ERROR("E19999", "Failed to copy data from NC1HWC0[%ld, %ld, %ld, %ld, %ld] "
"src offset %ld to NCHW[%ld, %ld, %ld, %ld], dst offset %ld, "
"err-code %d",
n_idx, c1_idx, h_idx, w_idx, c0_idx, src_offset, n_idx,
c_idx, h_idx, w_idx, dst_offset, ret);
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED,
"Failed to copy data from NC1HWC0[%ld, %ld, %ld, %ld, %ld] offset %ld to NCHW[%ld, %ld, %ld, %ld]"
" offset %ld, err-code %d",
n_idx, c1_idx, h_idx, w_idx, c0_idx, src_offset, n_idx, c_idx, h_idx, w_idx, dst_offset, ret);
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
}
}
@ -168,11 +141,7 @@ Status FormatTransferNc1hwc0Nchw::TransFormat(const TransArgs &args, TransResult
return SUCCESS;
}
GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Get][ShapeSize]Failed, total size %ld from dst shape %s, "
"src shape %s", total_size,
ShapeToString(args.dst_shape).c_str(), ShapeToString(args.src_shape).c_str());
REPORT_CALL_ERROR("E19999", "Failed to get total size %ld from dst shape %s, src shape %s",
total_size,
GELOGE(ACL_ERROR_GE_PARAM_INVALID, "Get %ld total size from dst shape %s, src shape %s", total_size,
ShapeToString(args.dst_shape).c_str(), ShapeToString(args.src_shape).c_str());
return ACL_ERROR_GE_PARAM_INVALID;
}
@ -181,15 +150,8 @@ Status FormatTransferNc1hwc0Nchw::TransFormat(const TransArgs &args, TransResult
ShapeToString(args.dst_shape).c_str(), total_size);
ret = GetDstDataAfterTrans(args, result, size, total_size);
if (ret != SUCCESS) {
GELOGE(ret, "[Get][Data]Failed, after trans, src shape %s, data type %s, "
"dst shape %s, memory size %ld",
ShapeToString(args.src_shape).c_str(),
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str(),
ShapeToString(args.dst_shape).c_str(), total_size);
REPORT_CALL_ERROR("E19999", "Failed to get data after trans, src shape %s, data type %s, "
"dst shape %s, memory size %ld",
ShapeToString(args.src_shape).c_str(),
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str(),
GELOGE(ret, "Failed to get data after trans, src shape %s, data type %s, dst shape %s, memory size %ld",
ShapeToString(args.src_shape).c_str(), TypeUtils::DataTypeToSerialString(args.src_data_type).c_str(),
ShapeToString(args.dst_shape).c_str(), total_size);
return ret;
}

@ -41,43 +41,28 @@ Status CheckArgsForNc1hwc0ToNhwc(const TransArgs &args) {
return ACL_ERROR_GE_FORMAT_INVALID;
}
if (!CheckDataTypeSupported(args.src_data_type)) {
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "[Check][DataType]Failed, shape from NC1HWC0 to NHWC, "
"invalid data type %s",
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str());
REPORT_INNER_ERROR("E19999", "Failed to trans shape from NC1HWC0 to NHWC, invalid data type %s",
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "Failed to trans shape from NC1HWC0 to NHWC, invalid data type %s",
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str());
return ACL_ERROR_GE_DATATYPE_INVALID;
}
if (!CheckShapeValid(args.src_shape, kNc1hwc0DimsNum)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Value is invalid, src shape %s",
ShapeToString(args.src_shape).c_str());
REPORT_CALL_ERROR("E19999", "Src shape %s check invalid",
ShapeToString(args.src_shape).c_str());
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Failed to check src shape %s", ShapeToString(args.src_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
if (!CheckShapeValid(args.dst_shape, kNhwcDimsNum)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Value is invalid, dst shape %s",
ShapeToString(args.dst_shape).c_str());
REPORT_CALL_ERROR("E19999", "Dst shape %s check invalid",
ShapeToString(args.dst_shape).c_str());
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Failed to check dst shape %s", ShapeToString(args.dst_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
int64_t c0 = GetCubeSizeByDataType(args.src_data_type);
if (c0 <= 0) {
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "[Get][Cube]Failed, the data type %s is invalid",
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str());
REPORT_CALL_ERROR("E19999", "Failed to get cube size the data type %s is invalid",
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str());
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "Failed to get cube size, the data type is invalid");
return ACL_ERROR_GE_DATATYPE_INVALID;
}
if (src_shape.at(kNc1hwc0H) != dst_shape.at(kNhwcH) || src_shape.at(kNc1hwc0W) != dst_shape.at(kNhwcW) ||
src_shape.at(kNc1hwc0N) != dst_shape.at(kNhwcN) || src_shape.at(kNc1hwc0C0) != c0 ||
src_shape.at(kNc1hwc0C1) != (Ceil(dst_shape.at(kNhwcC), c0))) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Failed to check relationship between "
"src shape %s and dst shape %s",
ShapeToString(src_shape).c_str(), ShapeToString(dst_shape).c_str());
REPORT_INNER_ERROR("E19999", "Failed to check relationship between src shape %s "
"and dst shape %s",
GELOGE(ACL_ERROR_GE_SHAPE_INVALID,
"Failed to check relationship between src and dst shape, src shape %s, dst shape %s",
ShapeToString(src_shape).c_str(), ShapeToString(dst_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
@ -88,16 +73,10 @@ Status CheckArgsForNc1hwc0ToNhwc(const TransArgs &args) {
Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, const int size, const int64_t total_size) {
std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[total_size], std::default_delete<uint8_t[]>());
if (dst == nullptr) {
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][DSTMemory]Failed, memory for dst buf %ld, "
"shape %s when trans format from %s to %s",
total_size, ShapeToString(args.dst_shape).c_str(),
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION,
"Failed to trans format from %s to %s, can not alloc the memory for dst buf %ld, shape %s",
TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str());
REPORT_CALL_ERROR("E19999", "Failed to alloc the memory for dst buf %ld, "
"shape %s when trans format from %s to %s",
total_size, ShapeToString(args.dst_shape).c_str(),
TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str());
TypeUtils::FormatToSerialString(args.dst_format).c_str(), total_size, ShapeToString(args.dst_shape).c_str());
return ACL_ERROR_GE_MEMORY_ALLOCATION;
}
@ -133,14 +112,9 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, const in
static_cast<size_t>(size));
if (ret != EOK) {
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED,
"[Copy][Data]Failed, data from NC1HWC0[%ld, %ld, %ld, %ld, %ld] "
"offset %ld to NHWC[%ld, %ld, %ld, %ld] offset %ld, err-code %d",
n_idx, c1_idx, h_idx, w_idx, c0_idx, src_offset, n_idx, c_idx,
h_idx, w_idx, dst_offset, ret);
REPORT_CALL_ERROR("E19999", "Failed to copy data from NC1HWC0[%ld, %ld, %ld, %ld, %ld] "
"offset %ld to NHWC[%ld, %ld, %ld, %ld] offset %ld, err-code %d",
n_idx, c1_idx, h_idx, w_idx, c0_idx, src_offset, n_idx, c_idx,
h_idx, w_idx, dst_offset, ret);
"Failed to copy data from NC1HWC0[%ld, %ld, %ld, %ld, %ld] offset %ld to NHWC[%ld, %ld, %ld, %ld]"
" offset %ld, err-code %d",
n_idx, c1_idx, h_idx, w_idx, c0_idx, src_offset, n_idx, c_idx, h_idx, w_idx, dst_offset, ret);
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
}
}
@ -167,11 +141,7 @@ Status FormatTransferNc1hwc0Nhwc::TransFormat(const TransArgs &args, TransResult
return SUCCESS;
}
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Get][ShapeSize]Failed, total size %ld from dst shape %s, "
"src shape %s", total_size,
ShapeToString(args.dst_shape).c_str(), ShapeToString(args.src_shape).c_str());
REPORT_CALL_ERROR("E19999", "Failed to get total size %ld from dst shape %s, src shape %s",
total_size,
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Get %ld total size from dst shape %s, src shape %s", total_size,
ShapeToString(args.dst_shape).c_str(), ShapeToString(args.src_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
@ -181,16 +151,9 @@ Status FormatTransferNc1hwc0Nhwc::TransFormat(const TransArgs &args, TransResult
ret = GetDstDataAfterTrans(args, result, size, total_size);
if (ret != SUCCESS) {
GELOGE(ret, "[Get][Data]Failed, 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", "[Get][Data]Failed, 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);
GELOGE(ret, "Failed to get data after trans, src shape %s, data type %s, dst shape %s, memory size %ld",
ShapeToString(args.src_shape).c_str(), TypeUtils::DataTypeToSerialString(args.src_data_type).c_str(),
ShapeToString(args.dst_shape).c_str(), total_size);
return ret;
}
return SUCCESS;

@ -59,9 +59,8 @@ Status TransShape(int64_t n, int64_t c, int64_t h, int64_t w, DataType data_type
dst_shape.push_back(c0);
if (!IsShapeValid(dst_shape)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Value is invalid, dst shape %s",
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Failed to check dst shape %s",
ShapeToString(dst_shape).c_str());
REPORT_CALL_ERROR("E19999", "Dst shape %s check invalid", ShapeToString(dst_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
return SUCCESS;
@ -95,13 +94,7 @@ Status TransFormatFromNchwToFzC04(const TransArgs &args, TransResult &result) {
std::vector<int64_t> expect_shape = {n, h, w, c};
auto ret = ge::formats::Transpose(data, args.src_shape, args.src_data_type, perm_arg_1, trans_result_1);
if (ret != SUCCESS) {
GELOGE(ret, "[Trans][Formats]Failed from NCHW to HWCN, src_shape %s, src_data_type %s",
ShapeToString(args.src_shape).c_str(),
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str());
REPORT_CALL_ERROR("E19999", "Failede to trans formats from NCHW to HWCN, src_shape %s, "
"src_data_type %s",
ShapeToString(args.src_shape).c_str(),
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str());
GELOGE(ret, "Failed to Transpose from NCHW to HWCN");
return ret;
}
@ -111,9 +104,7 @@ Status TransFormatFromNchwToFzC04(const TransArgs &args, TransResult &result) {
// check size it should be same with original
size_t expect_size = n * c * h * w * size; // before has do check about mul
if (trans_result_1.length != expect_size) {
GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Check][Shape]size %zu is not match expect size %zu "
"after transpose",
trans_result_1.length, expect_size);
GELOGE(ACL_ERROR_GE_PARAM_INVALID, "size is not match after transpose!");
return ACL_ERROR_GE_PARAM_INVALID;
}
@ -127,32 +118,20 @@ Status TransFormatFromNchwToFzC04(const TransArgs &args, TransResult &result) {
// data overflow check totally
GE_IF_BOOL_EXEC(!CheckInt64MulOverflow(h_o, w_o),
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Check][Shape]Failed, "
"int64 mul overflow.A[%ld], B[%ld]", h_o, w_o);
REPORT_CALL_ERROR("E19999", "Check shape failed, int64 mul overflow.A[%ld], "
"B[%ld]", h_o, w_o);
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "int64 mul overflow.A[%ld], B[%ld]", h_o, w_o);
return ACL_ERROR_GE_INTERNAL_ERROR);
GE_IF_BOOL_EXEC(!CheckInt64MulOverflow(n_o, c_o),
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Check][Shape]Failed, "
"int64 mul overflow.A[%ld], B[%ld]", n_o, c_o);
REPORT_CALL_ERROR("E19999", "Check shape failed, int64 mul overflow.A[%ld], "
"B[%ld]", n_o, c_o);
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "int64 mul overflow.A[%ld], B[%ld]", n_o, c_o);
return ACL_ERROR_GE_INTERNAL_ERROR);
auto t1 = h_o * w_o;
auto t2 = n_o * c_o;
GE_IF_BOOL_EXEC(!CheckInt64MulOverflow(t1, t2),
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Check][Shape]Failed, "
"int64 mul overflow.A[%ld], B[%ld]", t1, t2);
REPORT_CALL_ERROR("E19999", "Check shape failed, "
"int64 mul overflow.A[%ld], B[%ld]", t1, t2);
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "int64 mul overflow.A[%ld], B[%ld]", t1, t2);
return ACL_ERROR_GE_INTERNAL_ERROR);
int64_t total_ele_cnt = n_o * c_o * h_o * w_o;
GE_IF_BOOL_EXEC(!CheckInt64MulOverflow(total_ele_cnt, size),
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Check][Shape]Failed, "
"int64 mul overflow.A[%ld], B[%d]", total_ele_cnt, size);
REPORT_CALL_ERROR("E19999", "Check shape failed, int64 mul overflow.A[%ld], "
"B[%d]", total_ele_cnt, size);
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "int64 mul overflow.A[%ld], B[%d]", total_ele_cnt, size);
return ACL_ERROR_GE_INTERNAL_ERROR);
int64_t dst_size = total_ele_cnt * size;
if (dst_size == 0) {
@ -162,21 +141,15 @@ Status TransFormatFromNchwToFzC04(const TransArgs &args, TransResult &result) {
std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[dst_size], std::default_delete<uint8_t[]>());
if (dst == nullptr) {
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "Failed to alloc the 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 alloc the 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,
"Failed to trans format from %s to %s, can not alloc the memory for dst buf %ld",
TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str(), dst_size);
return ACL_ERROR_GE_MEMORY_ALLOCATION;
}
auto retMem = memset_s(dst.get(), dst_size, 0, dst_size);
if (retMem != EOK) {
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Set][Memory]Failed, dst buf %ld, error_code %d",
dst_size, retMem);
REPORT_CALL_ERROR("E19999", "Set memory failed, dst buf %ld, error_code %d", dst_size, retMem);
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "memst failed!");
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
}
// copy data
@ -188,10 +161,7 @@ Status TransFormatFromNchwToFzC04(const TransArgs &args, TransResult &result) {
for (auto k = 0; k < n; k++) {
ret = memcpy_s(p_d + k * stride, protectSize, p_s + k * block, block);
if (ret != EOK) {
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Set][Memcpy]Failed, block %zu, stride %zu, "
"protect_size %ld error_code %d", block, stride, protectSize, ret);
REPORT_CALL_ERROR("E19999", "[Set][Memcpy]Failed, block %zu, stride %zu, "
"protect_size %ld error_code %d", block, stride, protectSize, ret);
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "memcpy_s failed!");
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
}
protectSize = protectSize - block;
@ -201,8 +171,7 @@ Status TransFormatFromNchwToFzC04(const TransArgs &args, TransResult &result) {
std::vector<int64_t> perm_arg_2 = {2, 0, 1, 3};
ret = ge::formats::Transpose(dst.get(), shape_o, args.src_data_type, perm_arg_2, result);
if (ret != SUCCESS) {
GELOGE(ret, "[Trans][Formats]Failed from NCHW to HWCN, error_code %u", ret);
REPORT_CALL_ERROR("E19999", "Failed to trans formats from NCHW to HWCN, error_code %u", ret);
GELOGE(ret, "Failed to Transpose from NCHW to HWCN");
return ret;
}
@ -223,8 +192,7 @@ Status PaddingNC(const TransArgs &args, TransArgs &args_tmp, std::shared_ptr<uin
auto w = src_shape.at(kNchwW);
if (c > kMaxDimsNumC) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Invalid dim c num[%lu]. "
"It should be in (0,4]", c);
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Invalie dim c num[%lu].It should be in (0,4]", c);
return ACL_ERROR_GE_SHAPE_INVALID;
}
@ -239,33 +207,21 @@ Status PaddingNC(const TransArgs &args, TransArgs &args_tmp, std::shared_ptr<uin
// data overflow check
GE_IF_BOOL_EXEC(!CheckInt64MulOverflow(h_o, w_o),
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Check][Shape]Failed, "
"int64 mul overflow.A[%ld], B[%ld]", h_o, w_o);
REPORT_CALL_ERROR("E19999", "Check shape failed, int64 mul overflow.A[%ld], "
"B[%ld]", h_o, w_o);
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "int64 mul overflow.A[%ld], B[%ld]", h_o, w_o);
return ACL_ERROR_GE_INTERNAL_ERROR);
GE_IF_BOOL_EXEC(!CheckInt64MulOverflow(n_o, c_o),
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Check][Shape]Failed, "
"int64 mul overflow.A[%ld], B[%ld]", n_o, c_o);
REPORT_CALL_ERROR("E19999", "Check shape failed, int64 mul overflow.A[%ld], "
"B[%ld]", n_o, c_o);
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "int64 mul overflow.A[%ld], B[%ld]", n_o, c_o);
return ACL_ERROR_GE_INTERNAL_ERROR);
auto t1 = h_o * w_o;
auto t2 = n_o * c_o;
GE_IF_BOOL_EXEC(!CheckInt64MulOverflow(t1, t2),
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Check][Shape]Failed, "
"int64 mul overflow.A[%ld], B[%ld]", t1, t2);
REPORT_CALL_ERROR("E19999", "Check shape failed, int64 mul overflow.A[%ld], "
"B[%ld]", t1, t2);
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "int64 mul overflow.A[%ld], B[%ld]", t1, t2);
return ACL_ERROR_GE_INTERNAL_ERROR);
int64_t total_ele_cnt = n_o * c_o * h_o * w_o;
int size = GetSizeByDataType(args.src_data_type);
GE_IF_BOOL_EXEC(!CheckInt64MulOverflow(total_ele_cnt, size),
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Check][Shape]Failed, "
"int64 mul overflow.A[%ld], B[%d]", total_ele_cnt, size);
REPORT_CALL_ERROR("E19999", "Check shape failed, int64 mul overflow.A[%ld], "
"B[%d]", total_ele_cnt, size);
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "int64 mul overflow.A[%ld], B[%d]", total_ele_cnt, size);
return ACL_ERROR_GE_INTERNAL_ERROR);
int64_t dst_size = total_ele_cnt * size;
@ -275,21 +231,15 @@ Status PaddingNC(const TransArgs &args, TransArgs &args_tmp, std::shared_ptr<uin
dst.reset(new (std::nothrow) uint8_t[dst_size], std::default_delete<uint8_t[]>());
if (dst == nullptr) {
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "Failed to alloc the 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 alloc the 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,
"Failed to trans format from %s to %s, can not alloc the memory for dst buf %ld",
TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str(), dst_size);
return ACL_ERROR_GE_MEMORY_ALLOCATION;
}
auto ret = memset_s(dst.get(), dst_size, 0, dst_size);
if (ret != EOK) {
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Set][Memory]Failed, dst buf %ld, error_code %d",
dst_size, ret);
REPORT_CALL_ERROR("E19999", "Set memory failed, dst buf %ld, error_code %d", dst_size, ret);
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "memst failed!");
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
}
@ -303,10 +253,7 @@ Status PaddingNC(const TransArgs &args, TransArgs &args_tmp, std::shared_ptr<uin
ret = memcpy_s(p_d + (i * c_o * h_o * w_o + j * h_o * w_o) * size, protectSize,
p_s + (i * c * h * w + j * h * w) * size, block);
if (ret != EOK) {
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "[Set][Memcpy]Failed, block %zu, "
"protect_size %ld error_code %d", block, protectSize, ret);
REPORT_CALL_ERROR("E19999", "[Set][Memcpy]Failed, block %zu, protect_size %ld"
"error_code %d", block, protectSize, ret);
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED, "memcpy_s failed!");
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
}
protectSize = protectSize - block;
@ -327,8 +274,7 @@ Status FormatTransferNchwToFZC04::TransFormat(const TransArgs &args, TransResult
std::shared_ptr<uint8_t> dst = nullptr;
auto ret = PaddingNC(args, args_tmp, dst);
if (ret != SUCCESS) {
GELOGE(ret, "[Padding][NCAxis]Failed, error_code %u", ret);
REPORT_CALL_ERROR("E19999", "Padding in NC axis failed, error_code %u", ret);
GELOGE(ret, "Padding in NC axis failed!");
return ret;
}

@ -32,16 +32,11 @@ Status TransShapeNchwToNc1hwc0(const std::vector<int64_t> &src_shape, DataType d
std::vector<int64_t> &dst_shape) {
int64_t c0 = GetCubeSizeByDataType(data_type);
if (c0 <= 0) {
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "[Get][Cube]Failed, the data type %s is invalid",
TypeUtils::DataTypeToSerialString(data_type).c_str());
REPORT_CALL_ERROR("E19999", "Failed to get cube size, the data type %s is invalid",
TypeUtils::DataTypeToSerialString(data_type).c_str());
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "Failed to get cube size, the data type is invalid");
return ACL_ERROR_GE_DATATYPE_INVALID;
}
if (!CheckShapeValid(src_shape, kNchwDimsNum)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Value is invalid, src shape %s",
ShapeToString(src_shape).c_str());
REPORT_CALL_ERROR("E19999", "Src shape %s check invalid",
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Failed to check src shape %s",
ShapeToString(src_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
@ -52,9 +47,7 @@ Status TransShapeNchwToNc1hwc0(const std::vector<int64_t> &src_shape, DataType d
dst_shape.push_back(src_shape.at(kNchwW));
dst_shape.push_back(c0);
if (!CheckShapeValid(dst_shape, kNc1hwc0DimsNum)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Value is invalid, dst shape %s",
ShapeToString(dst_shape).c_str());
REPORT_CALL_ERROR("E19999", "Dst shape %s check invalid",
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Failed to check dst shape %s",
ShapeToString(dst_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
@ -76,17 +69,10 @@ Status CheckArgsForNchwToNc1hwc0(const TransArgs &args) {
}
if (expect_5d_shape != args.dst_shape) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID,
"[Trans][Format]Failed, the src and dst shape are not compatible. "
"data type %s, src shape %s, dst shape %s, expect dst shape %s",
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str(),
ShapeToString(args.src_shape).c_str(),
"Failed to trans format, the src and dst shape are not compatible. data"
" type %s, src shape %s, dst shape %s, expect dst shape %s",
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str(), ShapeToString(args.src_shape).c_str(),
ShapeToString(args.dst_shape).c_str(), ShapeToString(expect_5d_shape).c_str());
REPORT_INNER_ERROR("E19999", "Failed to trans formats, the src and dst shape are not "
"compatible. data type %s, src shape %s, dst shape %s, expect dst shape %s",
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str(),
ShapeToString(args.src_shape).c_str(),
ShapeToString(args.dst_shape).c_str(),
ShapeToString(expect_5d_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
@ -97,16 +83,10 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, const in
std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[total_size], std::default_delete<uint8_t[]>());
if (dst == nullptr) {
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION,
"[Allcoate][Memory]Failed to alloc the memory for dst buf %ld, "
"shape %s when trans format from %s to %s",
total_size, ShapeToString(args.dst_shape).c_str(),
"Failed to trans format from %s to %s, can not alloc the memory for"
" dst buf %ld, shape %s",
TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str());
REPORT_CALL_ERROR("E19999", "Failed to alloc the memory for dst buf %ld, "
"shape %s when trans format from %s to %s",
total_size, ShapeToString(args.dst_shape).c_str(),
TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str());
TypeUtils::FormatToSerialString(args.dst_format).c_str(), total_size, ShapeToString(args.dst_shape).c_str());
return ACL_ERROR_GE_MEMORY_ALLOCATION;
}
@ -117,10 +97,7 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, const in
int64_t c0 = GetCubeSizeByDataType(args.src_data_type);
if (c0 <= 0) {
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "[Check][Shape]The c0 is invalid %ld, data_type %s",
c0, TypeUtils::DataTypeToSerialString(args.src_data_type).c_str());
REPORT_CALL_ERROR("E19999", "Check shape failed, the c0 is invalid %ld, data_type %s",
c0, TypeUtils::DataTypeToSerialString(args.src_data_type).c_str());
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "The c0 is invalid %ld", c0);
return ACL_ERROR_GE_DATATYPE_INVALID;
}
int64_t c1 = (c - 1) / c0 + 1;
@ -153,13 +130,9 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, const in
static_cast<size_t>(size));
if (ret != EOK) {
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED,
"[Operate][Memory]Failed to copy data from NCHW[%ld] offset %ld "
"to NC1HWC0[%ld, %ld, %ld, %ld, %ld] offset %ld, err-code %d",
"Failed to copy data from NCHW[%ld] offset %ld to "
"NC1HWC0[%ld, %ld, %ld, %ld, %ld] offset %ld, err-code %d",
srcIdx, src_offset, n_idx, c1_idx, h_idx, w_idx, c0_idx, dst_offset, ret);
REPORT_CALL_ERROR("E19999", "Failed to copy data from NCHW[%ld] offset %ld "
"to NC1HWC0[%ld, %ld, %ld, %ld, %ld] offset %ld, err-code %d",
srcIdx, src_offset, n_idx, c1_idx, h_idx, w_idx, c0_idx,
dst_offset, ret);
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
}
} else {
@ -167,10 +140,7 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, const in
memset_s(dst.get() + dst_offset, static_cast<size_t>(protected_size), 0, static_cast<size_t>(size));
if (ret != EOK) {
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED,
"[Operate][Memory]Failed to set to 0 to NC1HWC0[%ld, %ld, %ld, %ld, %ld] "
"offset %ld, err-code %d",
n_idx, c1_idx, h_idx, w_idx, c0_idx, dst_offset, ret);
REPORT_CALL_ERROR("E19999", "Failed to set to 0 to "
"Failed to set to 0 to "
"NC1HWC0[%ld, %ld, %ld, %ld, %ld] offset %ld, err-code %d",
n_idx, c1_idx, h_idx, w_idx, c0_idx, dst_offset, ret);
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
@ -203,11 +173,7 @@ Status FormatTransferNchwNc1hwc0::TransFormat(const TransArgs &args, TransResult
return SUCCESS;
}
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());
REPORT_CALL_ERROR("E19999", "Failed to get total size %ld from dst shape %s, src shape %s",
total_size,
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Get %ld total size from dst shape %s, src shape %s", total_size,
ShapeToString(args.dst_shape).c_str(), ShapeToString(args.src_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
@ -218,16 +184,9 @@ Status FormatTransferNchwNc1hwc0::TransFormat(const TransArgs &args, TransResult
ShapeToString(args.dst_shape).c_str(), total_size);
ret = GetDstDataAfterTrans(args, result, size, total_size);
if (ret != SUCCESS) {
GELOGE(ret, "[Get][Data]Failed, 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",
ShapeToString(args.src_shape).c_str(),
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str(),
ShapeToString(args.dst_shape).c_str(), total_size, ret);
GELOGE(ret, "Failed to get data after trans, src shape %s, data type %s, dst shape %s, memory size %ld",
ShapeToString(args.src_shape).c_str(), TypeUtils::DataTypeToSerialString(args.src_data_type).c_str(),
ShapeToString(args.dst_shape).c_str(), total_size);
return ret;
}
return SUCCESS;

@ -34,10 +34,7 @@ Status TransShapeNhwcToNc1hwc0(const std::vector<int64_t> &src_shape, DataType d
std::vector<int64_t> &dst_shape) {
int64_t c0 = GetCubeSizeByDataType(data_type);
if (c0 <= 0) {
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "[Get][Cube]Failed, the data type %s is invalid",
TypeUtils::DataTypeToSerialString(data_type).c_str());
REPORT_CALL_ERROR("E19999", "Failed to get cube size, the data type %s is invalid",
TypeUtils::DataTypeToSerialString(data_type).c_str());
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "Failed to get cube size, the data type is invalid");
return ACL_ERROR_GE_DATATYPE_INVALID;
}
dst_shape.clear();
@ -47,9 +44,7 @@ Status TransShapeNhwcToNc1hwc0(const std::vector<int64_t> &src_shape, DataType d
dst_shape.push_back(src_shape.at(kNhwcW));
dst_shape.push_back(c0);
if (!CheckShapeValid(dst_shape, kNc1hwc0DimsNum)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Value is invalid, dst shape %s",
ShapeToString(dst_shape).c_str());
REPORT_CALL_ERROR("E19999", "Dst shape %s check invalid",
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Failed to check dst shape %s",
ShapeToString(dst_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
@ -65,25 +60,16 @@ Status CheckArgsForNhwcToNc1hwc0(const TransArgs &args) {
return ACL_ERROR_GE_FORMAT_INVALID;
}
if (!CheckDataTypeSupported(args.src_data_type)) {
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "[Check][DataType]Failed from NHWC to NC1HWC0, "
"invalid data type %s",
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str());
REPORT_INNER_ERROR("E19999", "Failed to trans shape from NHWC to NC1HWC0, invalid data type %s",
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "Failed to trans shape from NHWC to NC1HWC0, invalid data type %s",
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str());
return ACL_ERROR_GE_DATATYPE_INVALID;
}
if (!CheckShapeValid(args.src_shape, kNhwcDimsNum)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Value is invalid, src shape %s",
ShapeToString(args.src_shape).c_str());
REPORT_CALL_ERROR("E19999", "Src shape %s check invalid",
ShapeToString(args.src_shape).c_str());
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Failed to check src shape %s", ShapeToString(args.src_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
if (!CheckShapeValid(args.dst_shape, kNc1hwc0DimsNum)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Value is invalid, dst shape %s",
ShapeToString(args.dst_shape).c_str());
REPORT_CALL_ERROR("E19999", "Dst shape %s check valid",
ShapeToString(args.dst_shape).c_str());
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Failed to check dst shape %s", ShapeToString(args.dst_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
std::vector<int64_t> expect_dst_shape;
@ -93,14 +79,10 @@ Status CheckArgsForNhwcToNc1hwc0(const TransArgs &args) {
}
if (args.dst_shape != expect_dst_shape) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID,
"[Trans][Format]Failed , the src shape %s and dst shape %s are not compatible. "
"Failed to trans format, the src and dst shape are not compatible. src shape %s, dst shape %s, "
"expect dst shape %s",
ShapeToString(args.src_shape).c_str(), ShapeToString(args.dst_shape).c_str(),
ShapeToString(expect_dst_shape).c_str());
REPORT_CALL_ERROR("E19999", "Failed to trans format, the src shape %s and "
"dst shape %s are not compatible. expect dst shape %s",
ShapeToString(args.src_shape).c_str(), ShapeToString(args.dst_shape).c_str(),
ShapeToString(expect_dst_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}
@ -110,16 +92,10 @@ Status CheckArgsForNhwcToNc1hwc0(const TransArgs &args) {
Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, const int size, const int64_t total_size) {
std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[total_size], std::default_delete<uint8_t[]>());
if (dst == nullptr) {
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allcoate][Memory]Failed, memory for dst buf %ld, "
"shape %s when trans format from %s to %s",
total_size, ShapeToString(args.dst_shape).c_str(),
TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str());
REPORT_CALL_ERROR("E19999", "Failed to alloc the memory for dst buf %ld, "
"shape %s when trans format from %s to %s",
total_size, ShapeToString(args.dst_shape).c_str(),
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION,
"Failed to trans format from %s to %s, can not alloc the memory for dst buf %ld, shape %s",
TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str());
TypeUtils::FormatToSerialString(args.dst_format).c_str(), total_size, ShapeToString(args.dst_shape).c_str());
return ACL_ERROR_GE_MEMORY_ALLOCATION;
}
@ -157,27 +133,17 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, const in
auto ret = memcpy_s(dst.get() + dst_offset, protected_size, args.data + src_offset, size);
if (ret != EOK) {
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED,
"[Operate][Memory]Failed to copy data from NHWC[%ld, %ld, %ld, %ld] "
"offset %ld to NC1HWC0[%ld, %ld, %ld, %ld, %ld] offset %ld err-code %d",
n_idx, h_idx, w_idx, c_idx, src_offset,
n_idx, c1_idx, h_idx, w_idx, c0_idx, dst_offset, ret);
REPORT_CALL_ERROR("E19999", "Failed to copy data from NHWC[%ld, %ld, %ld, %ld] "
"offset %ld to "
"Failed to copy data from NHWC[%ld, %ld, %ld, %ld] offset %ld to "
"NC1HWC0[%ld, %ld, %ld, %ld, %ld] offset %ld err-code %d",
n_idx, h_idx, w_idx, c_idx, src_offset,
n_idx, c1_idx, h_idx, w_idx, c0_idx, dst_offset, ret);
n_idx, h_idx, w_idx, c_idx, src_offset, n_idx, c1_idx, h_idx, w_idx, c0_idx, dst_offset, ret);
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
}
} else {
auto ret = memset_s(dst.get() + dst_offset, protected_size, 0, size);
if (ret != EOK) {
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED,
"[Operate][Memory]Failed to set 0 to "
"NC1HWC0[%ld, %ld, %ld, %ld, %ld] offset %ld base err-code %d",
n_idx, c1_idx, h_idx, w_idx, c0_idx, dst_offset, ret);
REPORT_CALL_ERROR("E19999", "Failed to set 0 to "
"NC1HWC0[%ld, %ld, %ld, %ld, %ld] offset %ld base err-code %d",
n_idx, c1_idx, h_idx, w_idx, c0_idx, dst_offset, ret);
"Failed to set 0 to NC1HWC0[%ld, %ld, %ld, %ld, %ld] offset %ld base err-code %d", n_idx, c1_idx,
h_idx, w_idx, c0_idx, dst_offset, ret);
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
}
}
@ -206,11 +172,7 @@ Status FormatTransferNhwcNc1hwc0::TransFormat(const TransArgs &args, TransResult
return SUCCESS;
}
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "[Get][ShapeSize]Failed, "
"total size %ld from dst shape %s, src shape %s", total_size,
ShapeToString(args.dst_shape).c_str(), ShapeToString(args.src_shape).c_str());
REPORT_CALL_ERROR("E19999", "[Get][Shape]Failed, total size %ld from "
"dst shape %s, src shape %s", total_size,
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "Get %ld total size from dst shape %s, src shape %s", total_size,
ShapeToString(args.dst_shape).c_str(), ShapeToString(args.src_shape).c_str());
return ACL_ERROR_GE_DATATYPE_INVALID;
}
@ -220,16 +182,9 @@ Status FormatTransferNhwcNc1hwc0::TransFormat(const TransArgs &args, TransResult
ret = GetDstDataAfterTrans(args, result, size, total_size);
if (ret != SUCCESS) {
GELOGE(ret, "[Get][Data]Failed, 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",
ShapeToString(args.src_shape).c_str(),
TypeUtils::DataTypeToSerialString(args.src_data_type).c_str(),
ShapeToString(args.dst_shape).c_str(), total_size, ret);
GELOGE(ret, "Failed to get data after trans, src shape %s, data type %s, dst shape %s, memory size %ld",
ShapeToString(args.src_shape).c_str(), TypeUtils::DataTypeToSerialString(args.src_data_type).c_str(),
ShapeToString(args.dst_shape).c_str(), total_size);
return ret;
}
return SUCCESS;
@ -239,9 +194,7 @@ Status FormatTransferNhwcNc1hwc0::TransShape(Format src_format, const std::vecto
DataType data_type, Format dst_format, std::vector<int64_t> &dst_shape) {
if (src_format == FORMAT_NHWC && CheckDataTypeSupported(data_type)) {
if (!CheckShapeValid(src_shape, kNhwcDimsNum)) {
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Check][Shape]Value is invalid, src shape %s",
ShapeToString(src_shape).c_str());
REPORT_CALL_ERROR("E19999", "Src shape %s check invalid",
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Failed to check src shape %s",
ShapeToString(src_shape).c_str());
return ACL_ERROR_GE_SHAPE_INVALID;
}

@ -51,7 +51,7 @@ bool IsShapeArgValid(const std::vector<int64_t> &src_shape, const std::vector<in
if (src_shape.empty()) {
std::string error = "Failed to transpose, empty src shape";
GE_ERRORLOG_AND_ERRORMSG(ACL_ERROR_GE_SHAPE_INVALID, error.c_str());
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "[Trans][Shape]Failed, empty src shape");
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Failed to transpose, empty src shape");
return false;
}
for (auto dim : src_shape) {
@ -82,13 +82,11 @@ bool IsShapeArgValid(const std::vector<int64_t> &src_shape, const std::vector<in
bool IsTransposeArgValid(const uint8_t *src, const std::vector<int64_t> &src_shape, DataType src_data_type,
const std::vector<int64_t> &perm_arg) {
if (src == nullptr) {
GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Trans][Param]Failed, the src is null");
GELOGE(ACL_ERROR_GE_PARAM_INVALID, "Failed to transpose, the src is null");
return false;
}
if (GetSizeByDataType(src_data_type) < 0) {
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "[Trans][Param]Failed, the data type %s is not support",
TypeUtils::DataTypeToSerialString(src_data_type).c_str());
REPORT_CALL_ERROR("E19999", "Failed to transpose, the data type %s is not support",
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "Failed to transpose, the data type %s is not support",
TypeUtils::DataTypeToSerialString(src_data_type).c_str());
return false;
}
@ -175,15 +173,10 @@ Status Transpose(const uint8_t *src, const std::vector<int64_t> &src_shape, Data
static_cast<size_t>(data_size));
if (ret != EOK) {
GELOGE(ACL_ERROR_GE_MEMORY_OPERATE_FAILED,
"[Operate][Memory]Failed to transpose, src shape %s, perm arg %s, dst shape %s, "
"Failed to transpose, src shape %s, perm arg %s, dst shape %s, "
"failed to write to dst offset %ld, current dim offset %s",
ShapeToString(src_shape).c_str(), ShapeToString(perm_arg).c_str(), ShapeToString(dst_shape).c_str(),
dst_offset_bytes, ShapeToString(dst_indexes).c_str());
REPORT_CALL_ERROR("E19999", "Failed to transpose, src shape %s, perm arg %s, dst shape %s, "
"failed to write to dst offset %ld, current dim offset %s",
ShapeToString(src_shape).c_str(), ShapeToString(perm_arg).c_str(),
ShapeToString(dst_shape).c_str(),
dst_offset_bytes, ShapeToString(dst_indexes).c_str());
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED;
}
AddOne(dst_shape, dst_indexes);

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save