@ -87,7 +87,8 @@ Status TransShapeToFracNz(const ShapeVector &src_shape, DataType data_type, Shap
hw_shape . push_back ( DIM_DEFAULT_VALUE ) ;
hw_shape . push_back ( src_shape [ kNdDimIndexN ] ) ;
if ( ! IsShapeValid ( dst_shape ) ) {
GELOGE ( ACL_ERROR_GE_SHAPE_INVALID , " Failed to check dst shape %s " , ShapeToString ( dst_shape ) . c_str ( ) ) ;
GELOGE ( ACL_ERROR_GE_SHAPE_INVALID , " [Check][DSTShape]Failed, dst shape %s " , ShapeToString ( dst_shape ) . c_str ( ) ) ;
REPORT_INNER_ERROR ( " E19999 " , " Failed to check dst shape %s " , ShapeToString ( dst_shape ) . c_str ( ) ) ;
return ACL_ERROR_GE_SHAPE_INVALID ;
}
return SUCCESS ;
@ -106,7 +107,8 @@ Status TransShapeToFracNz(const ShapeVector &src_shape, DataType data_type, Shap
hw_shape . push_back ( src_shape [ size - kNdDimCountBackwardsWH ] ) ;
hw_shape . push_back ( src_shape [ size - kNdDimCountBackwardsW ] ) ;
if ( ! IsShapeValid ( dst_shape ) ) {
GELOGE ( ACL_ERROR_GE_SHAPE_INVALID , " Failed to check dst shape %s " , ShapeToString ( dst_shape ) . c_str ( ) ) ;
GELOGE ( ACL_ERROR_GE_SHAPE_INVALID , " [Check][DSTShape]Failed, dst shape %s " , ShapeToString ( dst_shape ) . c_str ( ) ) ;
REPORT_INNER_ERROR ( " E19999 " , " Failed to check dst shape %s " , ShapeToString ( dst_shape ) . c_str ( ) ) ;
return ACL_ERROR_GE_SHAPE_INVALID ;
}
return SUCCESS ;
@ -117,10 +119,14 @@ 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 , " Trans shape from %s to %s, shape %s to %s, data type %s fail ed" ,
GELOGE ( ret , " [ Transfer][ShapeToFracNz]Failed, shape from %s to %s, shape %s to %s, data type %s, error_co de:%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 ( ) ) ;
ShapeToString ( args . src_shape ) . c_str ( ) , TypeUtils : : DataTypeToSerialString ( args . src_data_type ) . c_str ( ) , ret ) ;
REPORT_INNER_ERROR ( " E19999 " , " Failed to tranfer shape from %s to %s, shape %s to %s, data type %s, error_code:%u " ,
TypeUtils : : FormatToSerialString ( args . dst_format ) . c_str ( ) ,
TypeUtils : : FormatToSerialString ( args . src_format ) . c_str ( ) , ShapeToString ( args . dst_shape ) . c_str ( ) ,
ShapeToString ( args . src_shape ) . c_str ( ) , TypeUtils : : DataTypeToSerialString ( args . src_data_type ) . c_str ( ) , ret ) ;
return ret ;
}
if ( ! IsTransShapeSrcCorrect ( args , expect_src_shape ) ) {
@ -139,10 +145,12 @@ Status TransFormatFromNdToFracNz(const TransArgs &args, TransResult &result, con
std : : shared_ptr < uint8_t > dst ( new ( std : : nothrow ) uint8_t [ dst_size ] ( ) , std : : default_delete < uint8_t [ ] > ( ) ) ;
if ( dst = = nullptr ) {
GELOGE ( ACL_ERROR_GE_MEMORY_ALLOCATION ,
" Failed to trans format from %s to %s, can not alloc the memory for dst buf %ld " ,
GELOGE ( ACL_ERROR_GE_MEMORY_ALLOCATION , " [Allocate][DSTMemory]Failed to trans format from %s to %s, memory for dst buf %ld " ,
TypeUtils : : FormatToSerialString ( args . src_format ) . c_str ( ) ,
TypeUtils : : FormatToSerialString ( args . dst_format ) . c_str ( ) , dst_size ) ;
REPORT_INNER_ERROR ( " E19999 " , " Failed to trans format from %s to %s and allocate memory for dst buf %ld " ,
TypeUtils : : FormatToSerialString ( args . src_format ) . c_str ( ) ,
TypeUtils : : FormatToSerialString ( args . dst_format ) . c_str ( ) , dst_size ) ;
return ACL_ERROR_GE_MEMORY_ALLOCATION ;
}
@ -176,8 +184,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 ,
" Failed to operate th e dst memory at offset %ld, error-code %d" , dst_offset , ret ) ;
GELOGE ( ACL_ERROR_GE_MEMORY_OPERATE_FAILED , " [Operate][DSTMemory]Failed at offset %ld, error-code %d " , dst_offset , ret ) ;
REPORT_INNER_ERROR ( " E19999 " , " Failed to operat e dst memory at offset %ld, error-code %d" , dst_offset , ret ) ;
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED ;
}
}
@ -191,8 +199,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 ,
" Failed to operate th e dst memory at offset %ld, error-code %d" , dst_offset , ret ) ;
GELOGE ( ACL_ERROR_GE_MEMORY_OPERATE_FAILED , " [Operate][DSTMemory]Failed at offset %ld, error-code %d " , dst_offset , ret ) ;
REPORT_INNER_ERROR ( " E19999 " , " Failed to operat e dst memory at offset %ld, error-code %d" , dst_offset , ret ) ;
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED ;
}
}
@ -213,10 +221,12 @@ Status TransFormatFromFracNzToNd(const TransArgs &args, TransResult &result, con
std : : shared_ptr < uint8_t > dst ( new ( std : : nothrow ) uint8_t [ dst_size ] , std : : default_delete < uint8_t [ ] > ( ) ) ;
if ( dst = = nullptr ) {
GELOGE ( ACL_ERROR_GE_MEMORY_ALLOCATION ,
" Failed to trans format from %s to %s, can not alloc the memory for dst buf %ld " ,
GELOGE ( ACL_ERROR_GE_MEMORY_ALLOCATION , " [Allocate][DSTMemory]Failed to trans format from %s to %s, memory for dst buf %ld " ,
TypeUtils : : FormatToSerialString ( args . src_format ) . c_str ( ) ,
TypeUtils : : FormatToSerialString ( args . dst_format ) . c_str ( ) , dst_size ) ;
REPORT_INNER_ERROR ( " E19999 " , " Failed to trans format from %s to %s and allocate memory for dst buf %ld " ,
TypeUtils : : FormatToSerialString ( args . src_format ) . c_str ( ) ;
TypeUtils : : FormatToSerialString ( args . dst_format ) . c_str ( ) , dst_size ) ;
return ACL_ERROR_GE_MEMORY_ALLOCATION ;
}
@ -250,8 +260,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 ,
" Failed to operate th e dst memory at offset %ld, error-code %d" , dst_offset , ret ) ;
GELOGE ( ACL_ERROR_GE_MEMORY_OPERATE_FAILED , " [Operate][DSTMemory]Failed at offset %ld, error-code %d " , dst_offset , ret ) ;
REPORT_INNER_ERROR ( " E19999 " , " Failed to operat e dst memory at offset %ld, error-code %d" , dst_offset , ret ) ;
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED ;
}
}
@ -265,8 +275,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 ,
" Failed to operate th e dst memory at offset %ld, error-code %d" , dst_offset , ret ) ;
GELOGE ( ACL_ERROR_GE_MEMORY_OPERATE_FAILED , " [Operate][DSTMemory]Failed at offset %ld, error-code %d " , dst_offset , ret ) ;
REPORT_INNER_ERROR ( " E19999 " , " Failed to operat e dst memory at offset %ld, error-code %d" , dst_offset , ret ) ;
return ACL_ERROR_GE_MEMORY_OPERATE_FAILED ;
}
}
@ -281,18 +291,26 @@ 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 ,
" T rans format from %s to %s, src shape %s, dst shape %s, data type %s is not supported" ,
" [Check][Datatype]Failed, t rans 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 ( ) ) ;
return ACL_ERROR_GE_DATATYPE_INVALID ;
}
if ( ! CheckShape ( args . src_format , args . src_shape ) | | ! IsShapeValid ( args . dst_shape ) ) {
GELOGE ( ACL_ERROR_GE_SHAPE_INVALID ,
" T rans format from %s to %s, src shape %s, dst shape %s, data type %s is not supported" ,
" [Check][Shape]Failed, t rans 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 " ,
TypeUtils : : FormatToSerialString ( args . src_format ) . c_str ( ) ,
TypeUtils : : FormatToSerialString ( args . dst_format ) . c_str ( ) , ShapeToString ( args . src_shape ) . c_str ( ) ,
ShapeToString ( args . dst_shape ) . c_str ( ) , TypeUtils : : DataTypeToSerialString ( args . src_data_type ) . c_str ( ) ) ;
return ACL_ERROR_GE_SHAPE_INVALID ;
}
GELOGD ( " Begin to trans format from %s to %s, src shape %s, dst shape %s, data type %s " ,
@ -315,16 +333,26 @@ Status FormatTransferFractalNz::TransShape(Format src_format, const ShapeVector
Format dst_format , ShapeVector & dst_shape ) {
if ( ! IsDataTypeSupport ( data_type ) ) {
GELOGE ( ACL_ERROR_GE_DATATYPE_INVALID ,
" Trans format from %s to %s, src shape %s, data type %s is not supported " ,
TypeUtils : : FormatToSerialString ( src_format ) . c_str ( ) , TypeUtils : : FormatToSerialString ( dst_format ) . c_str ( ) ,
ShapeToString ( src_shape ) . c_str ( ) , TypeUtils : : DataTypeToSerialString ( data_type ) . c_str ( ) ) ;
" [Check][Datatype]Failed, trans format from %s to %s, src shape %s, 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 ( ) ) ;
return ACL_ERROR_GE_DATATYPE_INVALID ;
}
if ( ! CheckShape ( src_format , src_shape ) ) {
GELOGE ( ACL_ERROR_GE_SHAPE_INVALID ,
" Trans format from %s to %s, src shape %s, data type %s is not supported " ,
TypeUtils : : FormatToSerialString ( src_format ) . c_str ( ) , TypeUtils : : FormatToSerialString ( dst_format ) . c_str ( ) ,
ShapeToString ( src_shape ) . c_str ( ) , TypeUtils : : DataTypeToSerialString ( data_type ) . c_str ( ) ) ;
" [Check][Shape]Failed, trans format from %s to %s, src shape %s, 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 " ,
TypeUtils : : FormatToSerialString ( args . src_format ) . c_str ( ) ,
TypeUtils : : FormatToSerialString ( args . dst_format ) . c_str ( ) , ShapeToString ( args . src_shape ) . c_str ( ) ,
ShapeToString ( args . dst_shape ) . c_str ( ) , TypeUtils : : DataTypeToSerialString ( args . src_data_type ) . c_str ( ) ) ;
return ACL_ERROR_GE_SHAPE_INVALID ;
}
ShapeVector hw_shape ;
@ -334,19 +362,27 @@ 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 ,
" 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 ( ) ) ;
" [Check][Datatype]Failed, trans format from %s to %s, src shape %s, dst shape %s, data type %s is not supported " ,
TypeUtils : : FormatToSerialString ( args . src_format ) . c_str ( ) ,
TypeUtils : : FormatToSerialString ( args . dst_format ) . c_str ( ) , ShapeToString ( args . src_shape ) . c_str ( ) ,
ShapeToString ( args . dst_shape ) . c_str ( ) , TypeUtils : : DataTypeToSerialString ( args . src_data_type ) . c_str ( ) ) ;
REPORT_INNER_ERROR ( " E19999 " , " Check datatype failed, trans format from %s to %s, src shape %s, dst shape %s, data type %s is not supported " ,
TypeUtils : : FormatToSerialString ( args . src_format ) . c_str ( ) ,
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 ,
" 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 ( ) ) ;
" [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 " ,
TypeUtils : : FormatToSerialString ( args . src_format ) . c_str ( ) ,
TypeUtils : : FormatToSerialString ( args . dst_format ) . c_str ( ) , ShapeToString ( args . src_shape ) . c_str ( ) ,
ShapeToString ( args . dst_shape ) . c_str ( ) , TypeUtils : : DataTypeToSerialString ( args . src_data_type ) . c_str ( ) ) ;
return ACL_ERROR_GE_SHAPE_INVALID ;
}
GELOGD ( " Begin to trans format from %s to %s, src shape %s, dst shape %s, data type %s " ,