已合并
OP_LOGE错误码整改:nonzero/gatherelements/index/indexputv2/indexputwithsortv2/unsortedsegmentsum算子op_host层OP_LOGE替换为EZ0008-EZ0034规范化宏 #5519
liangtongxue创建于 6月1日
OP_LOGE错误码整改:nonzero/gatherelements/index/indexputv2/indexputwithsortv2/unsortedsegmentsum算子op_host层OP_LOGE替换为EZ0008-EZ0034规范化宏 #5519
已合并
共 12 个文件变更+211-143
| @@ -14,6 +14,7 @@ | |||
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | + | ||
| 17 | 18 | ||
| 18 | 19 | ||
| 19 | 20 | ||
| @@ -48,7 +49,7 @@ ge::graphStatus GatherElementsNoContiguousTiling::GetPlatformInfo() | |||
| 48 | auto platformInfo = context_->GetPlatformInfo(); | 49 | auto platformInfo = context_->GetPlatformInfo(); |
| 49 | if (platformInfo == nullptr) { | 50 | if (platformInfo == nullptr) { |
| 50 | auto compileInfoPtr = reinterpret_cast<const GatherElementsCompileInfo *>(context_->GetCompileInfo()); | 51 | auto compileInfoPtr = reinterpret_cast<const GatherElementsCompileInfo *>(context_->GetCompileInfo()); |
| 51 | - OP_CHECK_IF(compileInfoPtr == nullptr, OP_LOGE(context_, "compile info is null"), | 52 | + OP_CHECK_IF(compileInfoPtr == nullptr, OP_LOGE_FOR_INVALID_CONFIG_WITH_REASON(opName_, "tiling", "compile_info", "null", "compile info cannot be null"), |
| 52 | return ge::GRAPH_FAILED); | 53 | return ge::GRAPH_FAILED); |
| 53 | coreNum_ = static_cast<int64_t>(compileInfoPtr->core_num); | 54 | coreNum_ = static_cast<int64_t>(compileInfoPtr->core_num); |
| 54 | ubSize_ = static_cast<int64_t>(compileInfoPtr->ub_size); | 55 | ubSize_ = static_cast<int64_t>(compileInfoPtr->ub_size); |
| @@ -62,9 +63,9 @@ ge::graphStatus GatherElementsNoContiguousTiling::GetPlatformInfo() | |||
| 62 | OP_LOGD(opName_, "Get aivNum form ascendcPlatform is: %ld", coreNum_); | 63 | OP_LOGD(opName_, "Get aivNum form ascendcPlatform is: %ld", coreNum_); |
| 63 | } | 64 | } |
| 64 | OP_CHECK_IF((coreNum_ <= 0 || ubSize_ <= 0), | 65 | OP_CHECK_IF((coreNum_ <= 0 || ubSize_ <= 0), |
| 65 | - OP_LOGE(opName_, | 66 | + OP_LOGE_FOR_INVALID_VALUE(opName_, "coreNum, ubSize", |
| 66 | - "coreNum and ubSize should not be samller than 0, but got coreNum [%ld] and ubSize [%ld], please check.", | 67 | + (std::to_string(coreNum_) + ", " + std::to_string(ubSize_)).c_str(), "> 0"), |
| 67 | - coreNum_, ubSize_), return ge::GRAPH_FAILED); | 68 | + return ge::GRAPH_FAILED); |
| 68 | return ge::GRAPH_SUCCESS; | 69 | return ge::GRAPH_SUCCESS; |
| 69 | } | 70 | } |
| 70 | 71 | ||
| @@ -113,8 +114,9 @@ ge::graphStatus GatherElementsNoContiguousTiling::GetTensorInfo(gert::Shape &sha | |||
| 113 | } | 114 | } |
| 114 | std::string info = isOut ? "output" : "input"; | 115 | std::string info = isOut ? "output" : "input"; |
| 115 | OP_CHECK_IF(shape.GetDimNum() != stride.GetDimNum(), | 116 | OP_CHECK_IF(shape.GetDimNum() != stride.GetDimNum(), |
| 116 | - OP_LOGE(opName_, "shape's dimNum [%lu] should be equal to strid's dimNum [%lu] for [%s] [%lu]", | 117 | + OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON(opName_, info.c_str(), |
| 117 | - shape.GetDimNum(), stride.GetDimNum(), info.c_str(), idx), | 118 | + (std::to_string(shape.GetDimNum()) + ", " + std::to_string(stride.GetDimNum())).c_str(), |
| 119 | + "shape's dimNum should be equal to stride's dimNum"), | ||
| 118 | return ge::GRAPH_FAILED); | 120 | return ge::GRAPH_FAILED); |
| 119 | return ge::GRAPH_SUCCESS; | 121 | return ge::GRAPH_SUCCESS; |
| 120 | } | 122 | } |
| @@ -134,20 +136,24 @@ ge::graphStatus GatherElementsNoContiguousTiling::GetInAndOutInfo() | |||
| 134 | auto xDesc = context_->GetRequiredInputDesc(IN_X_IDX); | 136 | auto xDesc = context_->GetRequiredInputDesc(IN_X_IDX); |
| 135 | OP_CHECK_NULL_WITH_CONTEXT(context_, xDesc); | 137 | OP_CHECK_NULL_WITH_CONTEXT(context_, xDesc); |
| 136 | xDtype_ = xDesc->GetDataType(); | 138 | xDtype_ = xDesc->GetDataType(); |
| 137 | - OP_CHECK_IF(ParamTypeIsInvalid(xDtype_), OP_LOGE(opName_, | 139 | + OP_CHECK_IF(ParamTypeIsInvalid(xDtype_), OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(opName_, "x", |
| 138 | - "x dtype should be float,float16,bfloat16,fp8,bool,int8,uint8,int16,uint16,int32,uint32,int64,uint64, but got [%s], please check.", | 140 | + Ops::Base::ToString(xDtype_).c_str(), |
| 139 | - Ops::Base::ToString(xDtype_).c_str()), return ge::GRAPH_FAILED); | 141 | + "dtype should be in [DT_FLOAT, DT_FLOAT16, DT_BF16, DT_BOOL, DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, DT_INT32, DT_UINT32, DT_INT64, DT_UINT64, DT_FLOAT8_E5M2, DT_FLOAT8_E8M0, DT_FLOAT8_E4M3FN]"), |
| 142 | + return ge::GRAPH_FAILED); | ||
| 140 | auto indexDesc = context_->GetRequiredInputDesc(IN_INDEX_IDX); | 143 | auto indexDesc = context_->GetRequiredInputDesc(IN_INDEX_IDX); |
| 141 | OP_CHECK_NULL_WITH_CONTEXT(context_, indexDesc); | 144 | OP_CHECK_NULL_WITH_CONTEXT(context_, indexDesc); |
| 142 | indexDtype_ = indexDesc->GetDataType(); | 145 | indexDtype_ = indexDesc->GetDataType(); |
| 143 | OP_CHECK_IF((indexDtype_ != ge::DataType::DT_INT32) && (indexDtype_ != ge::DataType::DT_INT64), | 146 | OP_CHECK_IF((indexDtype_ != ge::DataType::DT_INT32) && (indexDtype_ != ge::DataType::DT_INT64), |
| 144 | - OP_LOGE(opName_, "index dtype should be int32,int64, please check."), | 147 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(opName_, "index", |
| 148 | + Ops::Base::ToString(indexDtype_).c_str(), | ||
| 149 | + "dtype should be in [DT_INT32, DT_INT64]"), | ||
| 145 | return ge::GRAPH_FAILED); | 150 | return ge::GRAPH_FAILED); |
| 146 | auto yDesc = context_->GetOutputDesc(OUT_Y_IDX); | 151 | auto yDesc = context_->GetOutputDesc(OUT_Y_IDX); |
| 147 | OP_CHECK_NULL_WITH_CONTEXT(context_, yDesc); | 152 | OP_CHECK_NULL_WITH_CONTEXT(context_, yDesc); |
| 148 | auto yDtype = yDesc->GetDataType(); | 153 | auto yDtype = yDesc->GetDataType(); |
| 149 | - OP_CHECK_IF(yDtype != xDtype_, OP_LOGE(opName_, | 154 | + OP_CHECK_IF(yDtype != xDtype_, OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON(opName_, "x, y", |
| 150 | - "The input x and output y should have same dtype, please check."), | 155 | + (Ops::Base::ToString(xDtype_) + ", " + Ops::Base::ToString(yDtype)).c_str(), |
| 156 | + "x and y should have same dtype"), | ||
| 151 | return ge::GRAPH_FAILED); | 157 | return ge::GRAPH_FAILED); |
| 152 | GetTensorInfo(xShape_, xStride_, IN_X_IDX, false); | 158 | GetTensorInfo(xShape_, xStride_, IN_X_IDX, false); |
| 153 | GetTensorInfo(indexShape_, indexStride_, IN_INDEX_IDX, false); | 159 | GetTensorInfo(indexShape_, indexStride_, IN_INDEX_IDX, false); |
| @@ -155,11 +161,14 @@ ge::graphStatus GatherElementsNoContiguousTiling::GetInAndOutInfo() | |||
| 155 | dimSize_ = static_cast<int64_t>(indexShape_.GetDimNum()); | 161 | dimSize_ = static_cast<int64_t>(indexShape_.GetDimNum()); |
| 156 | 162 | ||
| 157 | OP_CHECK_IF(dimSize_ > MAX_DIM_LEN_EIGHT, | 163 | OP_CHECK_IF(dimSize_ > MAX_DIM_LEN_EIGHT, |
| 158 | - OP_LOGE(opName_, "dimSize should not larger than 8, got %ld.", dimSize_), | 164 | + OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON(opName_, "index", |
| 165 | + std::to_string(dimSize_).c_str(), "dimSize should not larger than 8"), | ||
| 159 | return ge::GRAPH_FAILED); | 166 | return ge::GRAPH_FAILED); |
| 160 | 167 | ||
| 161 | OP_CHECK_IF(yShape_ != indexShape_, | 168 | OP_CHECK_IF(yShape_ != indexShape_, |
| 162 | - OP_LOGE(opName_, "The input index and output y should have same shape."), | 169 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(opName_, "index, y", |
| 170 | + (Ops::Base::ToString(indexShape_) + ", " + Ops::Base::ToString(yShape_)).c_str(), | ||
| 171 | + "index and y should have same shape"), | ||
| 163 | return ge::GRAPH_FAILED); | 172 | return ge::GRAPH_FAILED); |
| 164 | 173 | ||
| 165 | // 非连续场景要用size*stride去判断 | 174 | // 非连续场景要用size*stride去判断 |
| @@ -170,11 +179,11 @@ ge::graphStatus GatherElementsNoContiguousTiling::GetInAndOutInfo() | |||
| 170 | ySize_ = indexShape_.GetShapeSize(); | 179 | ySize_ = indexShape_.GetShapeSize(); |
| 171 | xDtypeSize_ = ge::GetSizeByDataType(xDtype_); | 180 | xDtypeSize_ = ge::GetSizeByDataType(xDtype_); |
| 172 | OP_CHECK_IF((xDtypeSize_ == -1), | 181 | OP_CHECK_IF((xDtypeSize_ == -1), |
| 173 | - OP_LOGE(opName_, "get xDtypeSize fail"), | 182 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(opName_, "x", Ops::Base::ToString(xDtype_).c_str(), "failed to get dtype size, dtype may be unsupported"), |
| 174 | return ge::GRAPH_FAILED); | 183 | return ge::GRAPH_FAILED); |
| 175 | indexDtypeSize_ = ge::GetSizeByDataType(indexDtype_); | 184 | indexDtypeSize_ = ge::GetSizeByDataType(indexDtype_); |
| 176 | OP_CHECK_IF((indexDtypeSize_ == -1), | 185 | OP_CHECK_IF((indexDtypeSize_ == -1), |
| 177 | - OP_LOGE(opName_, "get indexDtypeSize fail"), | 186 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(opName_, "index", Ops::Base::ToString(indexDtype_).c_str(), "failed to get dtype size, dtype may be unsupported"), |
| 178 | return ge::GRAPH_FAILED); | 187 | return ge::GRAPH_FAILED); |
| 179 | return ge::GRAPH_SUCCESS; | 188 | return ge::GRAPH_SUCCESS; |
| 180 | } | 189 | } |
| @@ -213,8 +222,9 @@ inline ge::graphStatus GatherElementsNoContiguousTiling::GetAttrInfo() | |||
| 213 | 222 | ||
| 214 | auto axisVal = static_cast<int64_t>(*axis); | 223 | auto axisVal = static_cast<int64_t>(*axis); |
| 215 | OP_CHECK_IF(axisVal < -dimSize_ || axisVal >= dimSize_, | 224 | OP_CHECK_IF(axisVal < -dimSize_ || axisVal >= dimSize_, |
| 216 | - OP_LOGE(opName_, "axis value should between with [%ld, %ld], but got %ld.", -dimSize_, | 225 | + OP_LOGE_FOR_INVALID_VALUE_WITH_REASON(opName_, "axis", |
| 217 | - dimSize_ - 1, axisVal), | 226 | + std::to_string(axisVal).c_str(), |
| 227 | + "axis value should be in range [-dimSize, dimSize-1]"), | ||
| 218 | return ge::GRAPH_FAILED); | 228 | return ge::GRAPH_FAILED); |
| 219 | 229 | ||
| 220 | axis_ = axisVal < 0 ? axisVal + dimSize_ : axisVal; | 230 | axis_ = axisVal < 0 ? axisVal + dimSize_ : axisVal; |
| @@ -223,8 +233,9 @@ inline ge::graphStatus GatherElementsNoContiguousTiling::GetAttrInfo() | |||
| 223 | continue; | 233 | continue; |
| 224 | } | 234 | } |
| 225 | OP_CHECK_IF(xShape_.GetDim(i) < indexShape_.GetDim(i), | 235 | OP_CHECK_IF(xShape_.GetDim(i) < indexShape_.GetDim(i), |
| 226 | - OP_LOGE(opName_, | 236 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(opName_, "x, index", |
| 227 | - "x should larger than or equal to index of each dim value, except axis."), | 237 | + (std::to_string(xShape_.GetDim(i)) + ", " + std::to_string(indexShape_.GetDim(i))).c_str(), |
| 238 | + "x should larger than or equal to index of each dim value, except axis"), | ||
| 228 | return ge::GRAPH_FAILED); | 239 | return ge::GRAPH_FAILED); |
| 229 | } | 240 | } |
| 230 | return ge::GRAPH_SUCCESS; | 241 | return ge::GRAPH_SUCCESS; |
| @@ -13,6 +13,7 @@ | |||
| 13 | * \brief | 13 | * \brief |
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | + | ||
| 16 | 17 | ||
| 17 | 18 | ||
| 18 | 19 | ||
| @@ -87,13 +88,15 @@ ge::graphStatus TilingPrepareGatherElementsForAscendC(gert::TilingParseContext * | |||
| 87 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo); | 88 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo); |
| 88 | compileInfo->core_num = ascendcPlatform.GetCoreNumAiv(); | 89 | compileInfo->core_num = ascendcPlatform.GetCoreNumAiv(); |
| 89 | OP_CHECK_IF((compileInfo->core_num <= 0), | 90 | OP_CHECK_IF((compileInfo->core_num <= 0), |
| 90 | - OP_LOGE(context->GetNodeName(), "Failed to core num."), | 91 | + OP_LOGE_FOR_INVALID_VALUE(context->GetNodeName(), "core_num", |
| 92 | + std::to_string(compileInfo->core_num).c_str(), "> 0"), | ||
| 91 | return ge::GRAPH_FAILED); | 93 | return ge::GRAPH_FAILED); |
| 92 | uint64_t ubSize; | 94 | uint64_t ubSize; |
| 93 | ascendcPlatform.GetCoreMemSize(platform_ascendc::CoreMemType::UB, ubSize); | 95 | ascendcPlatform.GetCoreMemSize(platform_ascendc::CoreMemType::UB, ubSize); |
| 94 | compileInfo->ub_size = static_cast<int64_t>(ubSize); | 96 | compileInfo->ub_size = static_cast<int64_t>(ubSize); |
| 95 | OP_CHECK_IF((compileInfo->ub_size <= 0), | 97 | OP_CHECK_IF((compileInfo->ub_size <= 0), |
| 96 | - OP_LOGE(context->GetNodeName(), "Failed to get ub size."), | 98 | + OP_LOGE_FOR_INVALID_VALUE(context->GetNodeName(), "ub_size", |
| 99 | + std::to_string(compileInfo->ub_size).c_str(), "> 0"), | ||
| 97 | return ge::GRAPH_FAILED); | 100 | return ge::GRAPH_FAILED); |
| 98 | return ge::GRAPH_SUCCESS; | 101 | return ge::GRAPH_SUCCESS; |
| 99 | } | 102 | } |
| @@ -14,6 +14,7 @@ | |||
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | + | ||
| 17 | 18 | ||
| 18 | 19 | ||
| 19 | 20 | ||
| @@ -50,7 +51,7 @@ ge::graphStatus GatherElementsSimtTiling::GetPlatformInfo() | |||
| 50 | auto platformInfo = context_->GetPlatformInfo(); | 51 | auto platformInfo = context_->GetPlatformInfo(); |
| 51 | if (platformInfo == nullptr) { | 52 | if (platformInfo == nullptr) { |
| 52 | auto compileInfoPtr = static_cast<const GatherElementsCompileInfo *>(context_->GetCompileInfo()); | 53 | auto compileInfoPtr = static_cast<const GatherElementsCompileInfo *>(context_->GetCompileInfo()); |
| 53 | - OP_CHECK_IF(compileInfoPtr == nullptr, OP_LOGE(context_, "compile info is null"), | 54 | + OP_CHECK_IF(compileInfoPtr == nullptr, OP_LOGE_FOR_INVALID_CONFIG_WITH_REASON(opName_, "tiling", "compile_info", "null", "compile info cannot be null"), |
| 54 | return ge::GRAPH_FAILED); | 55 | return ge::GRAPH_FAILED); |
| 55 | coreNum_ = static_cast<int64_t>(compileInfoPtr->core_num); | 56 | coreNum_ = static_cast<int64_t>(compileInfoPtr->core_num); |
| 56 | ubSize_ = static_cast<int64_t>(compileInfoPtr->ub_size); | 57 | ubSize_ = static_cast<int64_t>(compileInfoPtr->ub_size); |
| @@ -64,15 +65,16 @@ ge::graphStatus GatherElementsSimtTiling::GetPlatformInfo() | |||
| 64 | OP_LOGD(opName_, "Get aivNum form ascendcPlatform is: %ld", coreNum_); | 65 | OP_LOGD(opName_, "Get aivNum form ascendcPlatform is: %ld", coreNum_); |
| 65 | } | 66 | } |
| 66 | OP_CHECK_IF((coreNum_ <= 0 || ubSize_ <= 0), | 67 | OP_CHECK_IF((coreNum_ <= 0 || ubSize_ <= 0), |
| 67 | - OP_LOGE(opName_, | 68 | + OP_LOGE_FOR_INVALID_VALUE(opName_, "coreNum, ubSize", |
| 68 | - "coreNum and ubSize should not be samller than 0, but got coreNum [%ld] and ubSize [%ld], please check.", | 69 | + (std::to_string(coreNum_) + ", " + std::to_string(ubSize_)).c_str(), "> 0"), |
| 69 | - coreNum_, ubSize_), return ge::GRAPH_FAILED); | 70 | + return ge::GRAPH_FAILED); |
| 70 | aicoreParams_.numBlocks = coreNum_; | 71 | aicoreParams_.numBlocks = coreNum_; |
| 71 | aicoreParams_.ubSize = static_cast<int64_t>(ubSize_ - SIMT_CACHE_SIZE); | 72 | aicoreParams_.ubSize = static_cast<int64_t>(ubSize_ - SIMT_CACHE_SIZE); |
| 72 | OP_CHECK_IF((aicoreParams_.ubSize <= 0), | 73 | OP_CHECK_IF((aicoreParams_.ubSize <= 0), |
| 73 | - OP_LOGE(opName_, | 74 | + OP_LOGE_FOR_INVALID_VALUE_WITH_REASON(opName_, "ubSize", |
| 74 | - "ubSize should be bigger than SIMT_CACHE_SIZE [%ld], but got ubSize [%ld], please check.", | 75 | + std::to_string(ubSize_).c_str(), |
| 75 | - SIMT_CACHE_SIZE, ubSize_), return ge::GRAPH_FAILED); | 76 | + "ubSize should be bigger than SIMT_CACHE_SIZE"), |
| 77 | + return ge::GRAPH_FAILED); | ||
| 76 | return ge::GRAPH_SUCCESS; | 78 | return ge::GRAPH_SUCCESS; |
| 77 | } | 79 | } |
| 78 | 80 | ||
| @@ -92,20 +94,24 @@ ge::graphStatus GatherElementsSimtTiling::GetInAndOutInfo() | |||
| 92 | auto xDesc = context_->GetRequiredInputDesc(IN_X_IDX); | 94 | auto xDesc = context_->GetRequiredInputDesc(IN_X_IDX); |
| 93 | OP_CHECK_NULL_WITH_CONTEXT(context_, xDesc); | 95 | OP_CHECK_NULL_WITH_CONTEXT(context_, xDesc); |
| 94 | xDtype_ = xDesc->GetDataType(); | 96 | xDtype_ = xDesc->GetDataType(); |
| 95 | - OP_CHECK_IF(ParamTypeIsInvalid(xDtype_), OP_LOGE(opName_, | 97 | + OP_CHECK_IF(ParamTypeIsInvalid(xDtype_), OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(opName_, "x", |
| 96 | - "x dtype should be float,float16,bfloat16,fp8,bool,int8,uint8,int16,uint16,int32,uint32,int64,uint64, but got [%s], please check.", | 98 | + Ops::Base::ToString(xDtype_).c_str(), |
| 97 | - Ops::Base::ToString(xDtype_).c_str()), return ge::GRAPH_FAILED); | 99 | + "dtype should be in [DT_FLOAT, DT_FLOAT16, DT_BF16, DT_BOOL, DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, DT_INT32, DT_UINT32, DT_INT64, DT_UINT64, DT_FLOAT8_E5M2, DT_FLOAT8_E8M0, DT_FLOAT8_E4M3FN]"), |
| 100 | + return ge::GRAPH_FAILED); | ||
| 98 | auto indexDesc = context_->GetRequiredInputDesc(IN_INDEX_IDX); | 101 | auto indexDesc = context_->GetRequiredInputDesc(IN_INDEX_IDX); |
| 99 | OP_CHECK_NULL_WITH_CONTEXT(context_, indexDesc); | 102 | OP_CHECK_NULL_WITH_CONTEXT(context_, indexDesc); |
| 100 | indexDtype_ = indexDesc->GetDataType(); | 103 | indexDtype_ = indexDesc->GetDataType(); |
| 101 | OP_CHECK_IF((indexDtype_ != ge::DataType::DT_INT32) && (indexDtype_ != ge::DataType::DT_INT64), | 104 | OP_CHECK_IF((indexDtype_ != ge::DataType::DT_INT32) && (indexDtype_ != ge::DataType::DT_INT64), |
| 102 | - OP_LOGE(opName_, "index dtype should be int32,int64, please check."), | 105 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(opName_, "index", |
| 106 | + Ops::Base::ToString(indexDtype_).c_str(), | ||
| 107 | + "dtype should be in [DT_INT32, DT_INT64]"), | ||
| 103 | return ge::GRAPH_FAILED); | 108 | return ge::GRAPH_FAILED); |
| 104 | auto yDesc = context_->GetOutputDesc(OUT_Y_IDX); | 109 | auto yDesc = context_->GetOutputDesc(OUT_Y_IDX); |
| 105 | OP_CHECK_NULL_WITH_CONTEXT(context_, yDesc); | 110 | OP_CHECK_NULL_WITH_CONTEXT(context_, yDesc); |
| 106 | auto yDtype = yDesc->GetDataType(); | 111 | auto yDtype = yDesc->GetDataType(); |
| 107 | - OP_CHECK_IF(yDtype != xDtype_, OP_LOGE(opName_, | 112 | + OP_CHECK_IF(yDtype != xDtype_, OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON(opName_, "x, y", |
| 108 | - "The input x and output y should have same dtype, please check."), | 113 | + (Ops::Base::ToString(xDtype_) + ", " + Ops::Base::ToString(yDtype)).c_str(), |
| 114 | + "x and y should have same dtype"), | ||
| 109 | return ge::GRAPH_FAILED); | 115 | return ge::GRAPH_FAILED); |
| 110 | 116 | ||
| 111 | auto xStorageShape = context_->GetInputShape(IN_X_IDX); | 117 | auto xStorageShape = context_->GetInputShape(IN_X_IDX); |
| @@ -123,11 +129,14 @@ ge::graphStatus GatherElementsSimtTiling::GetInAndOutInfo() | |||
| 123 | 129 | ||
| 124 | dimSize_ = static_cast<int64_t>(indexShape_.GetDimNum()); | 130 | dimSize_ = static_cast<int64_t>(indexShape_.GetDimNum()); |
| 125 | OP_CHECK_IF(dimSize_ > MAX_DIM_LEN_EIGHT, | 131 | OP_CHECK_IF(dimSize_ > MAX_DIM_LEN_EIGHT, |
| 126 | - OP_LOGE(opName_, "dimSize should not larger than 8, got %ld.", dimSize_), | 132 | + OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON(opName_, "index", |
| 133 | + std::to_string(dimSize_).c_str(), "dimSize should not larger than 8"), | ||
| 127 | return ge::GRAPH_FAILED); | 134 | return ge::GRAPH_FAILED); |
| 128 | 135 | ||
| 129 | OP_CHECK_IF(yShape_ != indexShape_, | 136 | OP_CHECK_IF(yShape_ != indexShape_, |
| 130 | - OP_LOGE(opName_, "The input index and output y should have same shape."), | 137 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(opName_, "index, y", |
| 138 | + (Ops::Base::ToString(indexShape_) + ", " + Ops::Base::ToString(yShape_)).c_str(), | ||
| 139 | + "index and y should have same shape"), | ||
| 131 | return ge::GRAPH_FAILED); | 140 | return ge::GRAPH_FAILED); |
| 132 | return ge::GRAPH_SUCCESS; | 141 | return ge::GRAPH_SUCCESS; |
| 133 | } | 142 | } |
| @@ -141,8 +150,9 @@ inline ge::graphStatus GatherElementsSimtTiling::GetAttrInfo() | |||
| 141 | 150 | ||
| 142 | auto axisVal = static_cast<int64_t>(*axis); | 151 | auto axisVal = static_cast<int64_t>(*axis); |
| 143 | OP_CHECK_IF(axisVal < -dimSize_ || axisVal >= dimSize_, | 152 | OP_CHECK_IF(axisVal < -dimSize_ || axisVal >= dimSize_, |
| 144 | - OP_LOGE(opName_, "axis value should between with [%ld, %ld], but got %ld.", -dimSize_, | 153 | + OP_LOGE_FOR_INVALID_VALUE_WITH_REASON(opName_, "axis", |
| 145 | - dimSize_ - 1, axisVal), | 154 | + std::to_string(axisVal).c_str(), |
| 155 | + "axis value should be in range [-dimSize, dimSize-1]"), | ||
| 146 | return ge::GRAPH_FAILED); | 156 | return ge::GRAPH_FAILED); |
| 147 | 157 | ||
| 148 | axis_ = axisVal < 0 ? axisVal + dimSize_ : axisVal; | 158 | axis_ = axisVal < 0 ? axisVal + dimSize_ : axisVal; |
| @@ -151,8 +161,9 @@ inline ge::graphStatus GatherElementsSimtTiling::GetAttrInfo() | |||
| 151 | continue; | 161 | continue; |
| 152 | } | 162 | } |
| 153 | OP_CHECK_IF(xShape_.GetDim(i) < indexShape_.GetDim(i), | 163 | OP_CHECK_IF(xShape_.GetDim(i) < indexShape_.GetDim(i), |
| 154 | - OP_LOGE(opName_, | 164 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(opName_, "x, index", |
| 155 | - "x should larger than or equal to index of each dim value, except axis."), | 165 | + (std::to_string(xShape_.GetDim(i)) + ", " + std::to_string(indexShape_.GetDim(i))).c_str(), |
| 166 | + "x should larger than or equal to index of each dim value, except axis"), | ||
| 156 | return ge::GRAPH_FAILED); | 167 | return ge::GRAPH_FAILED); |
| 157 | } | 168 | } |
| 158 | return ge::GRAPH_SUCCESS; | 169 | return ge::GRAPH_SUCCESS; |
| @@ -193,7 +204,8 @@ void GatherElementsSimtTiling::CalculateFullLoadCondition(int64_t xDtypeSize, in | |||
| 193 | idxAfterAxis_ = idxAfterAxis_ * indexShape_.GetDim(i); | 204 | idxAfterAxis_ = idxAfterAxis_ * indexShape_.GetDim(i); |
| 194 | } | 205 | } |
| 195 | OP_CHECK_IF((idxAfterAxis_ == static_cast<int64_t>(0)), | 206 | OP_CHECK_IF((idxAfterAxis_ == static_cast<int64_t>(0)), |
| 196 | - OP_LOGE(opName_, "idxAfterAxis_ is 0"), | 207 | + OP_LOGE_FOR_INVALID_VALUE_WITH_REASON(opName_, "idxAfterAxis", |
| 208 | + std::to_string(idxAfterAxis_).c_str(), "idxAfterAxis should not be 0"), | ||
| 197 | return ); | 209 | return ); |
| 198 | int64_t xPerAxisEncludeDim1 = 1; | 210 | int64_t xPerAxisEncludeDim1 = 1; |
| 199 | int64_t idxPerAxisEncludeDim1 = 1; | 211 | int64_t idxPerAxisEncludeDim1 = 1; |
| @@ -468,11 +480,11 @@ ge::graphStatus GatherElementsSimtTiling::DoOpTiling() | |||
| 468 | { | 480 | { |
| 469 | int64_t xDtypeSize = ge::GetSizeByDataType(xDtype_); | 481 | int64_t xDtypeSize = ge::GetSizeByDataType(xDtype_); |
| 470 | OP_CHECK_IF((xDtypeSize == -1), | 482 | OP_CHECK_IF((xDtypeSize == -1), |
| 471 | - OP_LOGE(opName_, "get xDtypeSize fail"), | 483 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(opName_, "x", Ops::Base::ToString(xDtype_).c_str(), "failed to get dtype size, dtype may be unsupported"), |
| 472 | return ge::GRAPH_FAILED); | 484 | return ge::GRAPH_FAILED); |
| 473 | int64_t indexDtypeSize = ge::GetSizeByDataType(indexDtype_); | 485 | int64_t indexDtypeSize = ge::GetSizeByDataType(indexDtype_); |
| 474 | OP_CHECK_IF((indexDtypeSize == -1), | 486 | OP_CHECK_IF((indexDtypeSize == -1), |
| 475 | - OP_LOGE(opName_, "get indexDtypeSize fail"), | 487 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(opName_, "index", Ops::Base::ToString(indexDtype_).c_str(), "failed to get dtype size, dtype may be unsupported"), |
| 476 | return ge::GRAPH_FAILED); | 488 | return ge::GRAPH_FAILED); |
| 477 | CalculateFullLoadCondition(xDtypeSize, indexDtypeSize); | 489 | CalculateFullLoadCondition(xDtypeSize, indexDtypeSize); |
| 478 | if (isFullLoad_ > 0) { | 490 | if (isFullLoad_ > 0) { |
| @@ -14,6 +14,7 @@ | |||
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | + | ||
| 17 | 18 | ||
| 18 | 19 | ||
| 19 | 20 | ||
| @@ -42,18 +43,18 @@ ge::graphStatus TilingPrepareIndexForAscendC(gert::TilingParseContext* context) | |||
| 42 | OP_CHECK_NULL_WITH_CONTEXT(context, platformInfo); | 43 | OP_CHECK_NULL_WITH_CONTEXT(context, platformInfo); |
| 43 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo); | 44 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo); |
| 44 | ci->core_num = ascendcPlatform.GetCoreNumAiv(); | 45 | ci->core_num = ascendcPlatform.GetCoreNumAiv(); |
| 45 | - OP_CHECK_IF((ci->core_num <= 0), OP_LOGE(context->GetNodeName(), "Failed to core num."), return ge::GRAPH_FAILED); | 46 | + OP_CHECK_IF((ci->core_num <= 0), OP_LOGE_FOR_INVALID_VALUE(context->GetNodeName(), "core_num", std::to_string(ci->core_num).c_str(), "> 0"), return ge::GRAPH_FAILED); |
| 46 | uint64_t indexUbSize; | 47 | uint64_t indexUbSize; |
| 47 | ascendcPlatform.GetCoreMemSize(platform_ascendc::CoreMemType::UB, indexUbSize); | 48 | ascendcPlatform.GetCoreMemSize(platform_ascendc::CoreMemType::UB, indexUbSize); |
| 48 | ci->ubSize = static_cast<int64_t>(indexUbSize); | 49 | ci->ubSize = static_cast<int64_t>(indexUbSize); |
| 49 | - OP_CHECK_IF((ci->ubSize <= 0), OP_LOGE(context->GetNodeName(), "Failed to get ub size."), return ge::GRAPH_FAILED); | 50 | + OP_CHECK_IF((ci->ubSize <= 0), OP_LOGE_FOR_INVALID_VALUE(context->GetNodeName(), "ubSize", std::to_string(ci->ubSize).c_str(), "> 0"), return ge::GRAPH_FAILED); |
| 50 | return ge::GRAPH_SUCCESS; | 51 | return ge::GRAPH_SUCCESS; |
| 51 | } | 52 | } |
| 52 | 53 | ||
| 53 | static ge::graphStatus TilingPrepare4Index(gert::TilingParseContext* context) | 54 | static ge::graphStatus TilingPrepare4Index(gert::TilingParseContext* context) |
| 54 | { | 55 | { |
| 55 | auto compile_info = context->GetCompiledInfo<IndexCompileInfo>(); | 56 | auto compile_info = context->GetCompiledInfo<IndexCompileInfo>(); |
| 56 | - OP_CHECK_IF(compile_info == nullptr, OP_LOGE("Index", "compile_info is nullptr!"), return ge::GRAPH_FAILED); | 57 | + OP_CHECK_IF(compile_info == nullptr, OP_LOGE_FOR_INVALID_CONFIG_WITH_REASON(context->GetNodeName(), "tiling", "compile_info", "null", "compile info cannot be null"), return ge::GRAPH_FAILED); |
| 57 | OP_LOGD(context->GetNodeName(), "AscendC TilingPrepare4Index Simt Mode success!"); | 58 | OP_LOGD(context->GetNodeName(), "AscendC TilingPrepare4Index Simt Mode success!"); |
| 58 | auto ret = TilingPrepareIndexForAscendC(context); | 59 | auto ret = TilingPrepareIndexForAscendC(context); |
| 59 | if (ret != ge::GRAPH_SUCCESS) { | 60 | if (ret != ge::GRAPH_SUCCESS) { |
| @@ -14,6 +14,7 @@ | |||
| 14 | * \brief Non-continuous tiling implementation for Index/IndexPutV2 operators | 14 | * \brief Non-continuous tiling implementation for Index/IndexPutV2 operators |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | + | ||
| 17 | 18 | ||
| 18 | 19 | ||
| 19 | 20 | ||
| @@ -143,8 +144,8 @@ ge::graphStatus IndexNonContinuousTiling::GetTensorInfo(gert::Shape &shape, gert | |||
| 143 | } | 144 | } |
| 144 | std::string info = isOut ? "output" : "input"; | 145 | std::string info = isOut ? "output" : "input"; |
| 145 | OP_CHECK_IF(shape.GetDimNum() != stride.GetDimNum(), | 146 | OP_CHECK_IF(shape.GetDimNum() != stride.GetDimNum(), |
| 146 | - OP_LOGE(context_->GetNodeName(), "shape's dimNum [%lu] should be equal to strid's dimNum [%lu] for [%s] [%lu]", | 147 | + OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON(context_->GetNodeName(), info.c_str(), std::to_string(shape.GetDimNum()).c_str(), |
| 147 | - shape.GetDimNum(), stride.GetDimNum(), info.c_str(), idx), | 148 | + ("should be equal to stride's dimNum " + std::to_string(stride.GetDimNum())).c_str()), |
| 148 | return ge::GRAPH_FAILED); | 149 | return ge::GRAPH_FAILED); |
| 149 | return ge::GRAPH_SUCCESS; | 150 | return ge::GRAPH_SUCCESS; |
| 150 | } | 151 | } |
| @@ -386,9 +387,10 @@ ge::graphStatus IndexNonContinuousTiling::GetShapeAttrsInfo() { | |||
| 386 | auto xDesc = context_->GetRequiredInputDesc(IN_X_IDX); | 387 | auto xDesc = context_->GetRequiredInputDesc(IN_X_IDX); |
| 387 | OP_CHECK_NULL_WITH_CONTEXT(context_, xDesc); | 388 | OP_CHECK_NULL_WITH_CONTEXT(context_, xDesc); |
| 388 | xDtype_ = xDesc->GetDataType(); | 389 | xDtype_ = xDesc->GetDataType(); |
| 389 | - OP_CHECK_IF(ParamTypeIsInvalid(xDtype_), OP_LOGE(context_->GetNodeName(), | 390 | + OP_CHECK_IF(ParamTypeIsInvalid(xDtype_), OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(context_->GetNodeName(), |
| 390 | - "x dtype should be float,float16,bfloat16,bool,int8,uint8,int32,int64, but got [%s], please check.", | 391 | + "x", Ops::Base::ToString(xDtype_).c_str(), |
| 391 | - Ops::Base::ToString(xDtype_).c_str()), return ge::GRAPH_FAILED); | 392 | + "should be in [DT_FLOAT, DT_FLOAT16, DT_BF16, DT_BOOL, DT_INT8, DT_UINT8, DT_INT32, DT_INT64]"), |
| 393 | + return ge::GRAPH_FAILED); | ||
| 392 | const std::set<ge::DataType> supportedIndexDtypes = {ge::DT_INT32, ge::DT_INT64}; | 394 | const std::set<ge::DataType> supportedIndexDtypes = {ge::DT_INT32, ge::DT_INT64}; |
| 393 | auto computeNodeInfo = context_->GetComputeNodeInfo(); | 395 | auto computeNodeInfo = context_->GetComputeNodeInfo(); |
| 394 | OP_CHECK_NULL_WITH_CONTEXT(context_, computeNodeInfo); | 396 | OP_CHECK_NULL_WITH_CONTEXT(context_, computeNodeInfo); |
| @@ -401,16 +403,17 @@ ge::graphStatus IndexNonContinuousTiling::GetShapeAttrsInfo() { | |||
| 401 | OP_CHECK_NULL_WITH_CONTEXT(context_, indexDesc); | 403 | OP_CHECK_NULL_WITH_CONTEXT(context_, indexDesc); |
| 402 | ge::DataType curIndexDtype = indexDesc->GetDataType(); | 404 | ge::DataType curIndexDtype = indexDesc->GetDataType(); |
| 403 | OP_CHECK_IF( | 405 | OP_CHECK_IF( |
| 404 | - supportedIndexDtypes.count(curIndexDtype) == 0, OP_LOGE(context_->GetNodeName(), | 406 | + supportedIndexDtypes.count(curIndexDtype) == 0, OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(context_->GetNodeName(), |
| 405 | - "index dtype should be int32/int64."), | 407 | + "index", Ops::Base::ToString(curIndexDtype).c_str(), "should be in [DT_INT32, DT_INT64]"), |
| 406 | return ge::GRAPH_FAILED; | 408 | return ge::GRAPH_FAILED; |
| 407 | ); | 409 | ); |
| 408 | } | 410 | } |
| 409 | auto yDesc = context_->GetOutputDesc(OUT_Y_IDX); | 411 | auto yDesc = context_->GetOutputDesc(OUT_Y_IDX); |
| 410 | OP_CHECK_NULL_WITH_CONTEXT(context_, yDesc); | 412 | OP_CHECK_NULL_WITH_CONTEXT(context_, yDesc); |
| 411 | auto yDtype = yDesc->GetDataType(); | 413 | auto yDtype = yDesc->GetDataType(); |
| 412 | - OP_CHECK_IF(yDtype != xDtype_, OP_LOGE(context_->GetNodeName(), | 414 | + OP_CHECK_IF(yDtype != xDtype_, OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON(context_->GetNodeName(), |
| 413 | - "The input x and output y should have same dtype, please check."), return ge::GRAPH_FAILED); | 415 | + "x, y", (Ops::Base::ToString(xDtype_) + ", " + Ops::Base::ToString(yDtype)).c_str(), |
| 416 | + "should have same dtype"), return ge::GRAPH_FAILED); | ||
| 414 | 417 | ||
| 415 | GetTensorInfo(xShape_, xStride_, IN_X_IDX, false); | 418 | GetTensorInfo(xShape_, xStride_, IN_X_IDX, false); |
| 416 | inputDimNum_ = xShape_.GetDimNum(); | 419 | inputDimNum_ = xShape_.GetDimNum(); |
| @@ -14,6 +14,7 @@ | |||
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | + | ||
| 17 | 18 | ||
| 18 | 19 | ||
| 19 | 20 | ||
| @@ -48,12 +49,13 @@ static graphStatus CanBroadcast(const string& name, const vector<vector<int64_t> | |||
| 48 | if (dim_index >= 0) { | 49 | if (dim_index >= 0) { |
| 49 | int64_t dim = shape[dim_index]; | 50 | int64_t dim = shape[dim_index]; |
| 50 | if (dim <= 0) { | 51 | if (dim <= 0) { |
| 51 | - OP_LOGE(name, "Shape dimensions must be positive integers."); | 52 | + OP_LOGE_FOR_INVALID_VALUE(name, "dim", std::to_string(dim).c_str(), "> 0"); |
| 52 | return GRAPH_FAILED; | 53 | return GRAPH_FAILED; |
| 53 | } | 54 | } |
| 54 | // 检查维度兼容性:要么相等,要么其中一个为1 | 55 | // 检查维度兼容性:要么相等,要么其中一个为1 |
| 55 | if (current_dim != 1 && dim != 1 && current_dim != dim) { | 56 | if (current_dim != 1 && dim != 1 && current_dim != dim) { |
| 56 | - OP_LOGE(name, "Shapes cannot be broadcast, incompatible dimensions."); | 57 | + OP_LOGE_FOR_INVALID_VALUE_WITH_REASON(name, "dim", std::to_string(dim).c_str(), |
| 58 | + ("cannot broadcast with current_dim " + std::to_string(current_dim) + ", incompatible dimensions").c_str()); | ||
| 57 | return GRAPH_FAILED; | 59 | return GRAPH_FAILED; |
| 58 | } | 60 | } |
| 59 | current_dim = max(current_dim, dim); | 61 | current_dim = max(current_dim, dim); |
| @@ -43,12 +43,12 @@ static ge::graphStatus TilingPrepare4IndexPutV2(gert::TilingParseContext* contex | |||
| 43 | OP_CHECK_NULL_WITH_CONTEXT(context, platformInfo); | 43 | OP_CHECK_NULL_WITH_CONTEXT(context, platformInfo); |
| 44 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo); | 44 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo); |
| 45 | ci->core_num = static_cast<int32_t>(ascendcPlatform.GetCoreNumAiv()); | 45 | ci->core_num = static_cast<int32_t>(ascendcPlatform.GetCoreNumAiv()); |
| 46 | - OP_CHECK_IF((ci->core_num <= 0), OP_LOGE(context->GetNodeName(), "Failed to core num."), return ge::GRAPH_FAILED); | 46 | + OP_CHECK_IF((ci->core_num <= 0), OP_LOGE_FOR_INVALID_VALUE(context->GetNodeName(), "core_num", std::to_string(ci->core_num).c_str(), "> 0"), return ge::GRAPH_FAILED); |
| 47 | uint64_t ubSize; | 47 | uint64_t ubSize; |
| 48 | ascendcPlatform.GetCoreMemSize(platform_ascendc::CoreMemType::UB, ubSize); | 48 | ascendcPlatform.GetCoreMemSize(platform_ascendc::CoreMemType::UB, ubSize); |
| 49 | ci->ubSize = ubSize; | 49 | ci->ubSize = ubSize; |
| 50 | OP_CHECK_IF( | 50 | OP_CHECK_IF( |
| 51 | - (ci->ubSize == 0), OP_LOGE(context->GetNodeName(), "Failed to get ub size."), return ge::GRAPH_FAILED); | 51 | + (ci->ubSize == 0), OP_LOGE_FOR_INVALID_VALUE(context->GetNodeName(), "ubSize", std::to_string(ci->ubSize).c_str(), "> 0"), return ge::GRAPH_FAILED); |
| 52 | return ge::GRAPH_SUCCESS; | 52 | return ge::GRAPH_SUCCESS; |
| 53 | } | 53 | } |
| 54 | 54 | ||
| @@ -13,6 +13,7 @@ | |||
| 13 | */ | 13 | */ |
| 14 | 14 | ||
| 15 | 15 | ||
| 16 | + | ||
| 16 | 17 | ||
| 17 | 18 | ||
| 18 | 19 | ||
| @@ -50,8 +51,8 @@ ge::graphStatus IndexPutWithSortV2Tiling::CheckShapeAllPositive(gert::Shape& sha | |||
| 50 | for (size_t i = 0; i < shape.GetDimNum(); i++) { | 51 | for (size_t i = 0; i < shape.GetDimNum(); i++) { |
| 51 | OP_CHECK_IF( | 52 | OP_CHECK_IF( |
| 52 | shape.GetDim(i) <= 0, | 53 | shape.GetDim(i) <= 0, |
| 53 | - OP_LOGE(context_->GetNodeName(), | 54 | + OP_LOGE_FOR_INVALID_SHAPESIZE_WITH_REASON(context_->GetNodeName(), "input", |
| 54 | - "Dim %lu of input should be positive, but actual %ld.", i, shape.GetDim(i)), | 55 | + std::to_string(shape.GetDim(i)).c_str(), "dimension value must be greater than 0"), |
| 55 | return ge::GRAPH_FAILED); | 56 | return ge::GRAPH_FAILED); |
| 56 | } | 57 | } |
| 57 | return ge::GRAPH_SUCCESS; | 58 | return ge::GRAPH_SUCCESS; |
| @@ -61,15 +62,15 @@ ge::graphStatus IndexPutWithSortV2Tiling::CheckShapesEqual(gert::Shape& shape0, | |||
| 61 | { | 62 | { |
| 62 | OP_CHECK_IF( | 63 | OP_CHECK_IF( |
| 63 | shape0.GetDimNum() != shape1.GetDimNum(), | 64 | shape0.GetDimNum() != shape1.GetDimNum(), |
| 64 | - OP_LOGE(context_->GetNodeName(), "DimNum of shapes are not equal: %lu vs %lu", | 65 | + OP_LOGE_FOR_INVALID_SHAPEDIMS_WITH_REASON(context_->GetNodeName(), "shape0, shape1", |
| 65 | - shape0.GetDimNum(), shape1.GetDimNum()), | 66 | + std::to_string(shape0.GetDimNum()).c_str(), "dimNum of both parameters must be equal"), |
| 66 | return ge::GRAPH_FAILED); | 67 | return ge::GRAPH_FAILED); |
| 67 | 68 | ||
| 68 | for (size_t i = 0; i < shape0.GetDimNum(); i++) { | 69 | for (size_t i = 0; i < shape0.GetDimNum(); i++) { |
| 69 | OP_CHECK_IF( | 70 | OP_CHECK_IF( |
| 70 | shape0.GetDim(i) != shape1.GetDim(i), | 71 | shape0.GetDim(i) != shape1.GetDim(i), |
| 71 | - OP_LOGE(context_->GetNodeName(), "Dim %lu of shapes are not equal: %ld vs %ld", i, | 72 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(context_->GetNodeName(), "shape0, shape1", |
| 72 | - shape0.GetDim(i), shape1.GetDim(i)), | 73 | + std::to_string(shape0.GetDim(i)).c_str(), "dimension values must be equal"), |
| 73 | return ge::GRAPH_FAILED); | 74 | return ge::GRAPH_FAILED); |
| 74 | } | 75 | } |
| 75 | return ge::GRAPH_SUCCESS; | 76 | return ge::GRAPH_SUCCESS; |
| @@ -82,7 +83,8 @@ ge::graphStatus IndexPutWithSortV2Tiling::CheckInputsShape() | |||
| 82 | OP_CHECK_NULL_WITH_CONTEXT(context_, inputShape); | 83 | OP_CHECK_NULL_WITH_CONTEXT(context_, inputShape); |
| 83 | auto storageShape0 = inputShape->GetStorageShape(); | 84 | auto storageShape0 = inputShape->GetStorageShape(); |
| 84 | if (CheckShapeAllPositive(storageShape0) != ge::GRAPH_SUCCESS) { | 85 | if (CheckShapeAllPositive(storageShape0) != ge::GRAPH_SUCCESS) { |
| 85 | - OP_LOGE(context_->GetNodeName(), "self shape contains zero."); | 86 | + OP_LOGE_FOR_INVALID_SHAPESIZE_WITH_REASON(context_->GetNodeName(), "self", "0", |
| 87 | + "all dimension values of shape must be greater than 0"); | ||
| 86 | return ge::GRAPH_FAILED; | 88 | return ge::GRAPH_FAILED; |
| 87 | } | 89 | } |
| 88 | auto inputXDesc = context_->GetInputDesc(INPUT_INDEX_0); | 90 | auto inputXDesc = context_->GetInputDesc(INPUT_INDEX_0); |
| @@ -95,7 +97,8 @@ ge::graphStatus IndexPutWithSortV2Tiling::CheckInputsShape() | |||
| 95 | OP_CHECK_NULL_WITH_CONTEXT(context_, inputShape); | 97 | OP_CHECK_NULL_WITH_CONTEXT(context_, inputShape); |
| 96 | auto storageShape1 = inputShape->GetStorageShape(); | 98 | auto storageShape1 = inputShape->GetStorageShape(); |
| 97 | if (CheckShapeAllPositive(storageShape1) != ge::GRAPH_SUCCESS) { | 99 | if (CheckShapeAllPositive(storageShape1) != ge::GRAPH_SUCCESS) { |
| 98 | - OP_LOGE(context_->GetNodeName(), "linear_index shape contains zero."); | 100 | + OP_LOGE_FOR_INVALID_SHAPESIZE_WITH_REASON(context_->GetNodeName(), "linear_index", "0", |
| 101 | + "all dimension values of shape must be greater than 0"); | ||
| 99 | return ge::GRAPH_FAILED; | 102 | return ge::GRAPH_FAILED; |
| 100 | } | 103 | } |
| 101 | indexedDimSize_ = storageShape1.GetShapeSize(); | 104 | indexedDimSize_ = storageShape1.GetShapeSize(); |
| @@ -109,13 +112,16 @@ ge::graphStatus IndexPutWithSortV2Tiling::CheckInputsShape() | |||
| 109 | OP_CHECK_NULL_WITH_CONTEXT(context_, inputShape); | 112 | OP_CHECK_NULL_WITH_CONTEXT(context_, inputShape); |
| 110 | auto storageShape2 = inputShape->GetStorageShape(); | 113 | auto storageShape2 = inputShape->GetStorageShape(); |
| 111 | if (CheckShapeAllPositive(storageShape2) != ge::GRAPH_SUCCESS) { | 114 | if (CheckShapeAllPositive(storageShape2) != ge::GRAPH_SUCCESS) { |
| 112 | - OP_LOGE(context_->GetNodeName(), "pos_idx shape contains zero."); | 115 | + OP_LOGE_FOR_INVALID_SHAPESIZE_WITH_REASON(context_->GetNodeName(), "pos_idx", "0", |
| 116 | + "all dimension values of shape must be greater than 0"); | ||
| 113 | return ge::GRAPH_FAILED; | 117 | return ge::GRAPH_FAILED; |
| 114 | } | 118 | } |
| 115 | 119 | ||
| 116 | // check shapes of input1 and input2 are equal | 120 | // check shapes of input1 and input2 are equal |
| 117 | if (CheckShapesEqual(storageShape1, storageShape2) != ge::GRAPH_SUCCESS) { | 121 | if (CheckShapesEqual(storageShape1, storageShape2) != ge::GRAPH_SUCCESS) { |
| 118 | - OP_LOGE(context_->GetNodeName(), "Shapes of linear_index and pos_idx are not equal."); | 122 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(context_->GetNodeName(), "linear_index, pos_idx", |
| 123 | + "linear_index_shape, pos_idx_shape", | ||
| 124 | + "shapes of both parameters must be equal"); | ||
| 119 | return ge::GRAPH_FAILED; | 125 | return ge::GRAPH_FAILED; |
| 120 | } | 126 | } |
| 121 | 127 | ||
| @@ -124,7 +130,8 @@ ge::graphStatus IndexPutWithSortV2Tiling::CheckInputsShape() | |||
| 124 | OP_CHECK_NULL_WITH_CONTEXT(context_, inputShape); | 130 | OP_CHECK_NULL_WITH_CONTEXT(context_, inputShape); |
| 125 | auto storageShape3 = inputShape->GetStorageShape(); | 131 | auto storageShape3 = inputShape->GetStorageShape(); |
| 126 | if (CheckShapeAllPositive(storageShape3) != ge::GRAPH_SUCCESS) { | 132 | if (CheckShapeAllPositive(storageShape3) != ge::GRAPH_SUCCESS) { |
| 127 | - OP_LOGE(context_->GetNodeName(), "values shape contains zero."); | 133 | + OP_LOGE_FOR_INVALID_SHAPESIZE_WITH_REASON(context_->GetNodeName(), "values", "0", |
| 134 | + "all dimension values of shape must be greater than 0"); | ||
| 128 | return ge::GRAPH_FAILED; | 135 | return ge::GRAPH_FAILED; |
| 129 | } | 136 | } |
| 130 | 137 | ||
| @@ -162,7 +169,8 @@ ge::graphStatus IndexPutWithSortV2Tiling::GetShapeAttrsInfo() | |||
| 162 | 169 | ||
| 163 | // check inputs shape | 170 | // check inputs shape |
| 164 | if (CheckInputsShape() != ge::GRAPH_SUCCESS) { | 171 | if (CheckInputsShape() != ge::GRAPH_SUCCESS) { |
| 165 | - OP_LOGE(context_->GetNodeName(), "Inputs shape invalid."); | 172 | + OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(context_->GetNodeName(), "inputs", "inputs_shape", |
| 173 | + "input shape is invalid"); | ||
| 166 | return ge::GRAPH_FAILED; | 174 | return ge::GRAPH_FAILED; |
| 167 | } | 175 | } |
| 168 | auto attrs = context_->GetAttrs(); | 176 | auto attrs = context_->GetAttrs(); |
| @@ -398,7 +406,9 @@ ge::graphStatus IndexPutWithSortV2Tiling::DoOpTiling() | |||
| 398 | CalcNonIndexedStride(selfStride, valueStride); | 406 | CalcNonIndexedStride(selfStride, valueStride); |
| 399 | CalcThreadNum(); | 407 | CalcThreadNum(); |
| 400 | if (indexedThreadNum_ <= 0 || nonIndexedThreadNum_ <= 0) { | 408 | if (indexedThreadNum_ <= 0 || nonIndexedThreadNum_ <= 0) { |
| 401 | - OP_LOGE(context_->GetNodeName(), "ThreadNum result less than zero."); | 409 | + OP_LOGE_FOR_INVALID_VALUE(context_->GetNodeName(), "ThreadNum", |
| 410 | + (std::to_string(indexedThreadNum_) + ", " + std::to_string(nonIndexedThreadNum_)).c_str(), | ||
| 411 | + "> 0"); | ||
| 402 | return ge::GRAPH_FAILED; | 412 | return ge::GRAPH_FAILED; |
| 403 | } | 413 | } |
| 404 | SetTilingData(); | 414 | SetTilingData(); |
| @@ -182,7 +182,9 @@ ge::graphStatus NonZeroAscendCTilingImpl::Init(const NonZeroCompileInfo* compile | |||
| 182 | vRegSize_ = compileInfo->vRegSize; | 182 | vRegSize_ = compileInfo->vRegSize; |
| 183 | OP_CHECK_IF( | 183 | OP_CHECK_IF( |
| 184 | coreNum_ <= 0 || ubSize_ <= 0 || vRegSize_ <= 0, | 184 | coreNum_ <= 0 || ubSize_ <= 0 || vRegSize_ <= 0, |
| 185 | - OP_LOGE(context_->GetNodeName(), "coreNum or ubSize or vRegSize is small than zero"), return ge::GRAPH_FAILED); | 185 | + OP_LOGE_FOR_INVALID_VALUE_WITH_REASON(context_->GetNodeName(), "coreNum, ubSize, vRegSize", |
| 186 | + (std::to_string(coreNum_) + ", " + std::to_string(ubSize_) + ", " + std::to_string(vRegSize_)).c_str(), | ||
| 187 | + "value must be greater than 0"), return ge::GRAPH_FAILED); | ||
| 186 | 188 | ||
| 187 | // get attrs: transpose | 189 | // get attrs: transpose |
| 188 | auto attrs = context_->GetAttrs(); | 190 | auto attrs = context_->GetAttrs(); |
| @@ -201,7 +203,7 @@ ge::graphStatus NonZeroAscendCTilingImpl::Init(const NonZeroCompileInfo* compile | |||
| 201 | 203 | ||
| 202 | intputDtypeSize_ = GetSizeByDataType(inputDtype_); | 204 | intputDtypeSize_ = GetSizeByDataType(inputDtype_); |
| 203 | outputDtypeSize_ = GetSizeByDataType(outputDtype_); | 205 | outputDtypeSize_ = GetSizeByDataType(outputDtype_); |
| 204 | - OP_CHECK_IF(intputDtypeSize_ <= 0, OP_LOGE(context_->GetNodeName(), "dtype size is 0"), return ge::GRAPH_FAILED); | 206 | + OP_CHECK_IF(intputDtypeSize_ <= 0, OP_LOGE_FOR_INVALID_VALUE_WITH_REASON(context_->GetNodeName(), "intputDtypeSize", std::to_string(intputDtypeSize_).c_str(), "dtype size must be greater than 0"), return ge::GRAPH_FAILED); |
| 205 | 207 | ||
| 206 | OP_LOGD(context_->GetNodeName(), "Exit NonZeroAscendCTilingImpl init."); | 208 | OP_LOGD(context_->GetNodeName(), "Exit NonZeroAscendCTilingImpl init."); |
| 207 | return ge::GRAPH_SUCCESS; | 209 | return ge::GRAPH_SUCCESS; |
| @@ -350,7 +352,7 @@ ge::graphStatus NonZeroAscendCTilingImpl::CalcQuickDivParams() | |||
| 350 | // calc quick div params rk and rm | 352 | // calc quick div params rk and rm |
| 351 | for (int64_t i = 0; i < SHAPE_DIM_MAX; i++) { | 353 | for (int64_t i = 0; i < SHAPE_DIM_MAX; i++) { |
| 352 | uint64_t c = mulInDimRList_[i]; | 354 | uint64_t c = mulInDimRList_[i]; |
| 353 | - OP_CHECK_IF(c <= 0, OP_LOGE(context_->GetNodeName(), "divisor c is small than zero"), return ge::GRAPH_FAILED); | 355 | + OP_CHECK_IF(c <= 0, OP_LOGE_FOR_INVALID_VALUE_WITH_REASON(context_->GetNodeName(), "c", std::to_string(c).c_str(), "divisor c must be greater than 0"), return ge::GRAPH_FAILED); |
| 354 | quickDivRKList_[i] = std::ceil(std::log2(c)); | 356 | quickDivRKList_[i] = std::ceil(std::log2(c)); |
| 355 | quickDivRMList_[i] = | 357 | quickDivRMList_[i] = |
| 356 | std::ceil(std::exp2(quickDivRKList_[i] + QUICK_DIV_NUM_32) / c) - std::exp2(QUICK_DIV_NUM_32); | 358 | std::ceil(std::exp2(quickDivRKList_[i] + QUICK_DIV_NUM_32) / c) - std::exp2(QUICK_DIV_NUM_32); |
| @@ -574,15 +576,15 @@ static ge::graphStatus TilingPrepare4NonZero(gert::TilingParseContext* context) | |||
| 574 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo); | 576 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo); |
| 575 | compileInfo->coreNum = ascendcPlatform.GetCoreNumAiv(); | 577 | compileInfo->coreNum = ascendcPlatform.GetCoreNumAiv(); |
| 576 | OP_CHECK_IF( | 578 | OP_CHECK_IF( |
| 577 | - (compileInfo->coreNum <= 0), OP_LOGE(context->GetNodeName(), "core num invalid."), return ge::GRAPH_FAILED); | 579 | + (compileInfo->coreNum <= 0), OP_LOGE_FOR_INVALID_VALUE(context->GetNodeName(), "coreNum", std::to_string(compileInfo->coreNum).c_str(), "> 0"), return ge::GRAPH_FAILED); |
| 578 | uint64_t ubSize = 0; | 580 | uint64_t ubSize = 0; |
| 579 | ascendcPlatform.GetCoreMemSize(platform_ascendc::CoreMemType::UB, ubSize); | 581 | ascendcPlatform.GetCoreMemSize(platform_ascendc::CoreMemType::UB, ubSize); |
| 580 | compileInfo->ubSize = static_cast<int64_t>(ubSize); | 582 | compileInfo->ubSize = static_cast<int64_t>(ubSize); |
| 581 | OP_CHECK_IF( | 583 | OP_CHECK_IF( |
| 582 | - (compileInfo->ubSize <= 0), OP_LOGE(context->GetNodeName(), "ub size invalid."), return ge::GRAPH_FAILED); | 584 | + (compileInfo->ubSize <= 0), OP_LOGE_FOR_INVALID_VALUE(context->GetNodeName(), "ubSize", std::to_string(compileInfo->ubSize).c_str(), "> 0"), return ge::GRAPH_FAILED); |
| 583 | compileInfo->vRegSize = static_cast<int64_t>(GetVRegSize(context)); | 585 | compileInfo->vRegSize = static_cast<int64_t>(GetVRegSize(context)); |
| 584 | OP_CHECK_IF( | 586 | OP_CHECK_IF( |
| 585 | - (compileInfo->vRegSize <= 0), OP_LOGE(context->GetNodeName(), "vRegSize size invalid."), | 587 | + (compileInfo->vRegSize <= 0), OP_LOGE_FOR_INVALID_VALUE(context->GetNodeName(), "vRegSize", std::to_string(compileInfo->vRegSize).c_str(), "> 0"), |
| 586 | return ge::GRAPH_FAILED); | 588 | return ge::GRAPH_FAILED); |
| 587 | return ge::GRAPH_SUCCESS; | 589 | return ge::GRAPH_SUCCESS; |
| 588 | } | 590 | } |
| @@ -15,6 +15,7 @@ | |||
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | 17 | ||
| 18 | + | ||
| 18 | 19 | ||
| 19 | 20 | ||
| 20 | namespace optiling { | 21 | namespace optiling { |
| @@ -353,10 +354,10 @@ | |||
| 353 | 354 | ||
| 354 | static ge::graphStatus CalcNeededCoreNum(const gert::TilingContext* context, const CommParas& commParas, | 355 | static ge::graphStatus CalcNeededCoreNum(const gert::TilingContext* context, const CommParas& commParas, |
| 355 | const int32_t& ids_size, const int32_t& core_num, int32_t& need_core_num) { | 356 | const int32_t& ids_size, const int32_t& core_num, int32_t& need_core_num) { |
| 356 | - OP_CHECK_IF( | 357 | +OP_CHECK_IF( |
| 357 | - core_num == 0, | 358 | + core_num == 0, |
| 358 | - OP_LOGE(context->GetNodeName(), "CalcNeededCoreNum check param failed, core_num is 0"), | 359 | + OP_LOGE_FOR_INVALID_VALUE(context->GetNodeName(), "core_num", "0", "> 0"), |
| 359 | - return ge::GRAPH_FAILED); | 360 | + return ge::GRAPH_FAILED); |
| 360 | int32_t ele_num = ids_size / core_num; | 361 | int32_t ele_num = ids_size / core_num; |
| 361 | 362 | ||
| 362 | if (commParas.num_segments > 1) { | 363 | if (commParas.num_segments > 1) { |
| @@ -385,21 +386,20 @@ | |||
| 385 | static ge::graphStatus CalcNeededCoreByNumSegments(const gert::TilingContext* context, | 386 | static ge::graphStatus CalcNeededCoreByNumSegments(const gert::TilingContext* context, |
| 386 | const CommParas4UbSizeNoAtomic comm_ub_size_params, | 387 | const CommParas4UbSizeNoAtomic comm_ub_size_params, |
| 387 | const int32_t& core_num, int32_t& need_core_num) { | 388 | const int32_t& core_num, int32_t& need_core_num) { |
| 388 | - OP_CHECK_IF(core_num == 0, | 389 | +OP_CHECK_IF(core_num == 0, |
| 389 | - OP_LOGE(context->GetNodeName(), | 390 | + OP_LOGE_FOR_INVALID_VALUE(context->GetNodeName(), "core_num", "0", "> 0"), |
| 390 | - "CalcNeededCoreByNumSegments check param failed, core_num is 0"), | 391 | + return ge::GRAPH_FAILED); |
| 391 | - return ge::GRAPH_FAILED); | ||
| 392 | int32_t ele_num = comm_ub_size_params.num_segments / core_num; | 392 | int32_t ele_num = comm_ub_size_params.num_segments / core_num; |
| 393 | 393 | ||
| 394 | if (comm_ub_size_params.num_segments == 1) { | 394 | if (comm_ub_size_params.num_segments == 1) { |
| 395 | if (comm_ub_size_params.e_size <= comm_ub_size_params.output_ub_ele_num_one_row) { | 395 | if (comm_ub_size_params.e_size <= comm_ub_size_params.output_ub_ele_num_one_row) { |
| 396 | need_core_num = 1; | 396 | need_core_num = 1; |
| 397 | } else { | 397 | } else { |
| 398 | - OP_CHECK_IF( | 398 | +OP_CHECK_IF( |
| 399 | - comm_ub_size_params.output_ub_ele_num_one_row == 0, | 399 | + comm_ub_size_params.output_ub_ele_num_one_row == 0, |
| 400 | - OP_LOGE( | 400 | + OP_LOGE_FOR_INVALID_VALUE( |
| 401 | - context->GetNodeName(), "CalcNeededCoreByNumSegments check param failed, output_ub_ele_num_one_row is 0"), | 401 | + context->GetNodeName(), "output_ub_ele_num_one_row", "0", ">0"), |
| 402 | - return ge::GRAPH_FAILED); | 402 | + return ge::GRAPH_FAILED); |
| 403 | int32_t core_one = comm_ub_size_params.e_size / comm_ub_size_params.output_ub_ele_num_one_row; | 403 | int32_t core_one = comm_ub_size_params.e_size / comm_ub_size_params.output_ub_ele_num_one_row; |
| 404 | if (core_one >= core_num) { | 404 | if (core_one >= core_num) { |
| 405 | need_core_num = core_num; | 405 | need_core_num = core_num; |
| @@ -2225,34 +2225,36 @@ | |||
| 2225 | OP_LOGI(context->GetNodeName(), "Tiling4SegmentSumComm running."); | 2225 | OP_LOGI(context->GetNodeName(), "Tiling4SegmentSumComm running."); |
| 2226 | 2226 | ||
| 2227 | auto input_data_shape = context->GetInputShape(INPUT_DATA_IDX); | 2227 | auto input_data_shape = context->GetInputShape(INPUT_DATA_IDX); |
| 2228 | - OP_CHECK_IF(input_data_shape == nullptr, | 2228 | +OP_CHECK_IF(input_data_shape == nullptr, |
| 2229 | - OP_LOGE(context->GetNodeName(), "get input_data_shape failed."), | 2229 | + OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(context->GetNodeName(), "data", "null", "input shape cannot be null"), |
| 2230 | - return ge::GRAPH_FAILED); | 2230 | + return ge::GRAPH_FAILED); |
| 2231 | const gert::Shape& input_data_shape_sizes = Ops::Base::EnsureNotScalar(input_data_shape->GetStorageShape()); | 2231 | const gert::Shape& input_data_shape_sizes = Ops::Base::EnsureNotScalar(input_data_shape->GetStorageShape()); |
| 2232 | 2232 | ||
| 2233 | auto input_segment_ids_shape = context->GetInputShape(INPUT_SEGMENT_IDS_IDX); | 2233 | auto input_segment_ids_shape = context->GetInputShape(INPUT_SEGMENT_IDS_IDX); |
| 2234 | - OP_CHECK_IF(input_segment_ids_shape == nullptr, | 2234 | +OP_CHECK_IF(input_segment_ids_shape == nullptr, |
| 2235 | - OP_LOGE(context->GetNodeName(), "get input_segment_ids_shape failed."), | 2235 | + OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(context->GetNodeName(), "segment_ids", "null", "input shape cannot be null"), |
| 2236 | - return ge::GRAPH_FAILED); | 2236 | + return ge::GRAPH_FAILED); |
| 2237 | const gert::Shape& input_segment_ids_shape_sizes = Ops::Base::EnsureNotScalar(input_segment_ids_shape->GetStorageShape()); | 2237 | const gert::Shape& input_segment_ids_shape_sizes = Ops::Base::EnsureNotScalar(input_segment_ids_shape->GetStorageShape()); |
| 2238 | 2238 | ||
| 2239 | const int32_t input_size = input_data_shape_sizes.GetShapeSize(); | 2239 | const int32_t input_size = input_data_shape_sizes.GetShapeSize(); |
| 2240 | const int32_t ids_size = input_segment_ids_shape_sizes.GetShapeSize(); | 2240 | const int32_t ids_size = input_segment_ids_shape_sizes.GetShapeSize(); |
| 2241 | OP_LOGI(context->GetNodeName(), "input_size=%d, ids_size=%d", input_size, ids_size); | 2241 | OP_LOGI(context->GetNodeName(), "input_size=%d, ids_size=%d", input_size, ids_size); |
| 2242 | - OP_CHECK_IF(input_size < ids_size, | 2242 | +OP_CHECK_IF(input_size < ids_size, |
| 2243 | - OP_LOGE(context->GetNodeName(), | 2243 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( |
| 2244 | - "dim of input must be greater than or equal with dim of ids"), | 2244 | + context->GetNodeName(), "input, segment_ids", |
| 2245 | - return ge::GRAPH_FAILED); | 2245 | + "input_size, ids_size", |
| 2246 | + "input shape size must be >= segment_ids shape size"), | ||
| 2247 | + return ge::GRAPH_FAILED); | ||
| 2246 | 2248 | ||
| 2247 | for (size_t i = 0; i < input_segment_ids_shape_sizes.GetDimNum(); i++) { | 2249 | for (size_t i = 0; i < input_segment_ids_shape_sizes.GetDimNum(); i++) { |
| 2248 | OP_LOGD(context->GetNodeName(), "input_segment_ids_shape_sizes[%zu] is %ld", i, | 2250 | OP_LOGD(context->GetNodeName(), "input_segment_ids_shape_sizes[%zu] is %ld", i, |
| 2249 | input_segment_ids_shape_sizes.GetDim(i)); | 2251 | input_segment_ids_shape_sizes.GetDim(i)); |
| 2250 | - OP_CHECK_IF(input_data_shape_sizes.GetDim(i) != input_segment_ids_shape_sizes.GetDim(i), | 2252 | +OP_CHECK_IF(input_data_shape_sizes.GetDim(i) != input_segment_ids_shape_sizes.GetDim(i), |
| 2251 | - OP_LOGE( | 2253 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( |
| 2252 | - context->GetNodeName(), | 2254 | + context->GetNodeName(), "input, segment_ids", |
| 2253 | - "front shape of input must be equal with ids shape, but input_data_shape_sizes[%ld] is %ld.", i, | 2255 | + "input_shape[i], ids_shape[i]", |
| 2254 | - input_data_shape_sizes.GetDim(i)), | 2256 | + "front shape of input must match segment_ids shape"), |
| 2255 | - return ge::GRAPH_FAILED); | 2257 | + return ge::GRAPH_FAILED); |
| 2256 | } | 2258 | } |
| 2257 | 2259 | ||
| 2258 | if (input_size == 0 || ids_size == 0) { | 2260 | if (input_size == 0 || ids_size == 0) { |
| @@ -2263,22 +2265,23 @@ | |||
| 2263 | OP_LOGD(context->GetNodeName(), " e_size is %d", e_size); | 2265 | OP_LOGD(context->GetNodeName(), " e_size is %d", e_size); |
| 2264 | 2266 | ||
| 2265 | auto input_data_dec_ptr = context->GetInputDesc(INPUT_DATA_IDX); | 2267 | auto input_data_dec_ptr = context->GetInputDesc(INPUT_DATA_IDX); |
| 2266 | - OP_CHECK_IF(input_data_dec_ptr == nullptr, | 2268 | +OP_CHECK_IF(input_data_dec_ptr == nullptr, |
| 2267 | - OP_LOGE(context->GetNodeName(), "get input_data_dec_ptr failed."), | 2269 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(context->GetNodeName(), "data", "null", "input desc cannot be null"), |
| 2268 | - return ge::GRAPH_FAILED); | 2270 | + return ge::GRAPH_FAILED); |
| 2269 | const ge::DataType input_dtype = input_data_dec_ptr->GetDataType(); | 2271 | const ge::DataType input_dtype = input_data_dec_ptr->GetDataType(); |
| 2270 | 2272 | ||
| 2271 | auto segment_ids_dec_ptr = context->GetInputDesc(INPUT_SEGMENT_IDS_IDX); | 2273 | auto segment_ids_dec_ptr = context->GetInputDesc(INPUT_SEGMENT_IDS_IDX); |
| 2272 | - OP_CHECK_IF(segment_ids_dec_ptr == nullptr, | 2274 | +OP_CHECK_IF(segment_ids_dec_ptr == nullptr, |
| 2273 | - OP_LOGE(context->GetNodeName(), "get segment_ids_dec_ptr failed."), | 2275 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(context->GetNodeName(), "segment_ids", "null", "input desc cannot be null"), |
| 2274 | - return ge::GRAPH_FAILED); | 2276 | + return ge::GRAPH_FAILED); |
| 2275 | const ge::DataType ids_dtype = segment_ids_dec_ptr->GetDataType(); | 2277 | const ge::DataType ids_dtype = segment_ids_dec_ptr->GetDataType(); |
| 2276 | 2278 | ||
| 2277 | // get input dtype | 2279 | // get input dtype |
| 2278 | EleByte input_ele_byte = FP32_BYTE; | 2280 | EleByte input_ele_byte = FP32_BYTE; |
| 2279 | - OP_CHECK_IF(!GetEleDtype(input_dtype, input_ele_byte), | 2281 | +OP_CHECK_IF(!GetEleDtype(input_dtype, input_ele_byte), |
| 2280 | - OP_LOGE(context->GetNodeName(), "get input_ele_byte failed."), | 2282 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(context->GetNodeName(), "input", |
| 2281 | - return ge::GRAPH_FAILED); | 2283 | + Ops::Base::ToString(input_dtype).c_str(), "failed to get dtype size, dtype may be unsupported"), |
| 2284 | + return ge::GRAPH_FAILED); | ||
| 2282 | 2285 | ||
| 2283 | EleByte output_ele_byte = input_ele_byte; | 2286 | EleByte output_ele_byte = input_ele_byte; |
| 2284 | int32_t output_ub_ele_num_one_row = BYTE_BLOCK / output_ele_byte; | 2287 | int32_t output_ub_ele_num_one_row = BYTE_BLOCK / output_ele_byte; |
| @@ -2286,9 +2289,10 @@ | |||
| 2286 | 2289 | ||
| 2287 | // get ids dtype | 2290 | // get ids dtype |
| 2288 | EleByte ids_ele_byte = FP32_BYTE; | 2291 | EleByte ids_ele_byte = FP32_BYTE; |
| 2289 | - OP_CHECK_IF(!GetEleDtype(ids_dtype, ids_ele_byte), | 2292 | +OP_CHECK_IF(!GetEleDtype(ids_dtype, ids_ele_byte), |
| 2290 | - OP_LOGE(context->GetNodeName(), "get ids_ele_byte failed."), | 2293 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(context->GetNodeName(), "segment_ids", |
| 2291 | - return ge::GRAPH_FAILED); | 2294 | + Ops::Base::ToString(ids_dtype).c_str(), "failed to get dtype size, dtype may be unsupported"), |
| 2295 | + return ge::GRAPH_FAILED); | ||
| 2292 | 2296 | ||
| 2293 | if (input_dtype == ge::DT_FLOAT) { | 2297 | if (input_dtype == ge::DT_FLOAT) { |
| 2294 | if (CalcTiling4Float(context, e_size, num_segments, input_size, ids_size, output_ub_ele_num_one_row, input_ele_byte, | 2298 | if (CalcTiling4Float(context, e_size, num_segments, input_size, ids_size, output_ub_ele_num_one_row, input_ele_byte, |
| @@ -2317,9 +2321,9 @@ | |||
| 2317 | OP_CHECK_IF(!Ops::Base::GetConstInt(context, INPUT_NUM_SEGMENTS_IDX, num_segments), | 2321 | OP_CHECK_IF(!Ops::Base::GetConstInt(context, INPUT_NUM_SEGMENTS_IDX, num_segments), |
| 2318 | OP_LOGE(context->GetNodeName(), "num_segments not exists."), | 2322 | OP_LOGE(context->GetNodeName(), "num_segments not exists."), |
| 2319 | return ge::GRAPH_FAILED); | 2323 | return ge::GRAPH_FAILED); |
| 2320 | - OP_CHECK_IF(num_segments <= 0, | 2324 | +OP_CHECK_IF(num_segments <= 0, |
| 2321 | - OP_LOGE(context->GetNodeName(), "num_segments is small than 0."), | 2325 | + OP_LOGE_FOR_INVALID_VALUE(context->GetNodeName(), "num_segments", std::to_string(num_segments).c_str(), "> 0"), |
| 2322 | - return ge::GRAPH_FAILED); | 2326 | + return ge::GRAPH_FAILED); |
| 2323 | OP_LOGD(context->GetNodeName(), "num_segments=%d", num_segments); | 2327 | OP_LOGD(context->GetNodeName(), "num_segments=%d", num_segments); |
| 2324 | 2328 | ||
| 2325 | return Tiling4SegmentSumComm(context, num_segments); | 2329 | return Tiling4SegmentSumComm(context, num_segments); |
| @@ -2352,14 +2356,14 @@ | |||
| 2352 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo); | 2356 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo); |
| 2353 | compile_info->core_num = ascendcPlatform.GetCoreNumAiv(); | 2357 | compile_info->core_num = ascendcPlatform.GetCoreNumAiv(); |
| 2354 | compile_info->max_thread = Ops::Base::GetSimtMaxThreadNum<gert::TilingParseContext>(context); | 2358 | compile_info->max_thread = Ops::Base::GetSimtMaxThreadNum<gert::TilingParseContext>(context); |
| 2355 | - OP_CHECK_IF((compile_info->core_num <= 0), | 2359 | +OP_CHECK_IF((compile_info->core_num <= 0), |
| 2356 | - OP_LOGE(context->GetNodeName(), | 2360 | + OP_LOGE_FOR_INVALID_VALUE( |
| 2357 | - "The core num is invaild."), | 2361 | + context->GetNodeName(), "core_num", std::to_string(compile_info->core_num).c_str(), ">0"), |
| 2358 | - return ge::GRAPH_FAILED); | 2362 | + return ge::GRAPH_FAILED); |
| 2359 | - OP_CHECK_IF((compile_info->max_thread <= 0), | 2363 | +OP_CHECK_IF((compile_info->max_thread <= 0), |
| 2360 | - OP_LOGE(context->GetNodeName(), | 2364 | + OP_LOGE_FOR_INVALID_VALUE( |
| 2361 | - "The max thread from platform is invaild."), | 2365 | + context->GetNodeName(), "max_thread", std::to_string(compile_info->max_thread).c_str(), ">0"), |
| 2362 | - return ge::GRAPH_FAILED); | 2366 | + return ge::GRAPH_FAILED); |
| 2363 | return ge::GRAPH_SUCCESS; | 2367 | return ge::GRAPH_SUCCESS; |
| 2364 | } | 2368 | } |
| 2365 | 2369 | ||
| @@ -21,6 +21,7 @@ | |||
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | 23 | ||
| 24 | + | ||
| 24 | 25 | ||
| 25 | using namespace AscendC; | 26 | using namespace AscendC; |
| 26 | using namespace ge; | 27 | using namespace ge; |
| @@ -143,11 +144,17 @@ ge::graphStatus UnsortedSegmentSumBaseTiling::CheckInputDtype() | |||
| 143 | auto indexTypeIter = indexTypeMap.find(segmentIdsDtypePtr->GetDataType()); | 144 | auto indexTypeIter = indexTypeMap.find(segmentIdsDtypePtr->GetDataType()); |
| 144 | OP_CHECK_IF( | 145 | OP_CHECK_IF( |
| 145 | dataTypeIter == dataTypeMap.end(), | 146 | dataTypeIter == dataTypeMap.end(), |
| 146 | - OP_LOGE(context_->GetNodeName(), "Not support data's type!"), | 147 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON( |
| 148 | + context_->GetNodeName(), "data", | ||
| 149 | + Ops::Base::ToString(dataDtypePtr->GetDataType()).c_str(), | ||
| 150 | + "supported dtype list is [DT_FLOAT, DT_FLOAT16, DT_BF16, DT_INT32, DT_INT64, DT_UINT32, DT_UINT64]"), | ||
| 147 | return ge::GRAPH_FAILED); | 151 | return ge::GRAPH_FAILED); |
| 148 | OP_CHECK_IF( | 152 | OP_CHECK_IF( |
| 149 | indexTypeIter == indexTypeMap.end(), | 153 | indexTypeIter == indexTypeMap.end(), |
| 150 | - OP_LOGE(context_->GetNodeName(), "Not support segment_ids's type"), | 154 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON( |
| 155 | + context_->GetNodeName(), "segment_ids", | ||
| 156 | + Ops::Base::ToString(segmentIdsDtypePtr->GetDataType()).c_str(), | ||
| 157 | + "supported dtype list is [DT_INT32, DT_INT64]"), | ||
| 151 | return ge::GRAPH_FAILED); | 158 | return ge::GRAPH_FAILED); |
| 152 | 159 | ||
| 153 | dataType_ = dataDtypePtr->GetDataType(); | 160 | dataType_ = dataDtypePtr->GetDataType(); |
| @@ -156,10 +163,10 @@ ge::graphStatus UnsortedSegmentSumBaseTiling::CheckInputDtype() | |||
| 156 | valueTypeBytes_ = ge::GetSizeByDataType(dataType_); | 163 | valueTypeBytes_ = ge::GetSizeByDataType(dataType_); |
| 157 | idTypeBytes_ = ge::GetSizeByDataType(idType_); | 164 | idTypeBytes_ = ge::GetSizeByDataType(idType_); |
| 158 | OP_CHECK_IF( | 165 | OP_CHECK_IF( |
| 159 | - valueTypeBytes_ <= 0UL, OP_LOGE(context_->GetNodeName(), "get dataType size fail."), | 166 | + valueTypeBytes_ <= 0UL, OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(context_->GetNodeName(), "data", Ops::Base::ToString(dataType_).c_str(), "failed to get dtype size, dtype may be unsupported"), |
| 160 | return ge::GRAPH_FAILED); | 167 | return ge::GRAPH_FAILED); |
| 161 | OP_CHECK_IF( | 168 | OP_CHECK_IF( |
| 162 | - idTypeBytes_ <= 0UL, OP_LOGE(context_->GetNodeName(), "get idType size fail."), | 169 | + idTypeBytes_ <= 0UL, OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(context_->GetNodeName(), "segment_ids", Ops::Base::ToString(idType_).c_str(), "failed to get dtype size, dtype may be unsupported"), |
| 163 | return ge::GRAPH_FAILED); | 170 | return ge::GRAPH_FAILED); |
| 164 | return ge::GRAPH_SUCCESS; | 171 | return ge::GRAPH_SUCCESS; |
| 165 | } | 172 | } |
| @@ -168,7 +175,11 @@ ge::graphStatus UnsortedSegmentSumBaseTiling::GetShapeAttrsInfo() | |||
| 168 | { | 175 | { |
| 169 | OP_CHECK_IF( | 176 | OP_CHECK_IF( |
| 170 | CheckInputDtype() != ge::GRAPH_SUCCESS, | 177 | CheckInputDtype() != ge::GRAPH_SUCCESS, |
| 171 | - OP_LOGE(context_->GetNodeName(), "input dtype check failed."), return ge::GRAPH_FAILED); | 178 | + OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON( |
| 179 | + context_->GetNodeName(), "data, segment_ids", | ||
| 180 | + "data_dtype, segment_ids_dtype", | ||
| 181 | + "dtype combination not supported"), | ||
| 182 | + return ge::GRAPH_FAILED); | ||
| 172 | 183 | ||
| 173 | auto dataShapePtr = context_->GetInputShape(INPUT_DATA_INDEX); | 184 | auto dataShapePtr = context_->GetInputShape(INPUT_DATA_INDEX); |
| 174 | OP_CHECK_NULL_WITH_CONTEXT(context_, dataShapePtr); | 185 | OP_CHECK_NULL_WITH_CONTEXT(context_, dataShapePtr); |
| @@ -188,13 +199,17 @@ ge::graphStatus UnsortedSegmentSumBaseTiling::GetShapeAttrsInfo() | |||
| 188 | 199 | ||
| 189 | OP_CHECK_IF( | 200 | OP_CHECK_IF( |
| 190 | numSegmentsShape.GetDimNum() != 1, | 201 | numSegmentsShape.GetDimNum() != 1, |
| 191 | - OP_LOGE(context_->GetNodeName(), "Num_segments should be one dim shape!"), | 202 | + OP_LOGE_FOR_INVALID_SHAPEDIM( |
| 203 | + context_->GetNodeName(), "num_segments", | ||
| 204 | + std::to_string(numSegmentsShape.GetDimNum()).c_str(), "1"), | ||
| 192 | return ge::GRAPH_FAILED); | 205 | return ge::GRAPH_FAILED); |
| 193 | 206 | ||
| 194 | OP_CHECK_IF( | 207 | OP_CHECK_IF( |
| 195 | !ShapeStartsWith(dataShape, segmentIdsShape), | 208 | !ShapeStartsWith(dataShape, segmentIdsShape), |
| 196 | - OP_LOGE( | 209 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( |
| 197 | - context_->GetNodeName(), "Data.shape does not start with segment_ids.shape"), | 210 | + context_->GetNodeName(), "data, segment_ids", |
| 211 | + "data_shape, segment_ids_shape", | ||
| 212 | + "data.shape must start with segment_ids.shape"), | ||
| 198 | return ge::GRAPH_FAILED); | 213 | return ge::GRAPH_FAILED); |
| 199 | 214 | ||
| 200 | std::tie(inputOuterDim_, innerDim_) = FlatInput(dataShape, segmentIdsShape); | 215 | std::tie(inputOuterDim_, innerDim_) = FlatInput(dataShape, segmentIdsShape); |
| @@ -202,7 +217,10 @@ ge::graphStatus UnsortedSegmentSumBaseTiling::GetShapeAttrsInfo() | |||
| 202 | uint64_t bound = static_cast<int64_t>(1ULL << 48); | 217 | uint64_t bound = static_cast<int64_t>(1ULL << 48); |
| 203 | OP_CHECK_IF( | 218 | OP_CHECK_IF( |
| 204 | inputOuterDim_ > bound, | 219 | inputOuterDim_ > bound, |
| 205 | - OP_LOGE(context_->GetNodeName(), "InputOuterDim out of 2^48!"), | 220 | + OP_LOGE_FOR_INVALID_SHAPESIZES_WITH_REASON( |
| 221 | + context_->GetNodeName(), "inputOuterDim", | ||
| 222 | + std::to_string(inputOuterDim_).c_str(), | ||
| 223 | + "value must be in range (0, 2^48)"), | ||
| 206 | return ge::GRAPH_FAILED); | 224 | return ge::GRAPH_FAILED); |
| 207 | 225 | ||
| 208 | dataShapeSize_ = dataShape.GetShapeSize(); | 226 | dataShapeSize_ = dataShape.GetShapeSize(); |
| @@ -52,9 +52,11 @@ static graphStatus InferShape4UnsortedSegment(gert::InferShapeContext* context) | |||
| 52 | gert::Shape *output_shape = context->GetOutputShape(0); | 52 | gert::Shape *output_shape = context->GetOutputShape(0); |
| 53 | OP_CHECK_NULL_WITH_CONTEXT(context, output_shape); | 53 | OP_CHECK_NULL_WITH_CONTEXT(context, output_shape); |
| 54 | 54 | ||
| 55 | - OP_CHECK_IF(num_segments_tensor->GetShapeSize() > 1, | 55 | +OP_CHECK_IF(num_segments_tensor->GetShapeSize() > 1, |
| 56 | - OP_LOGE(context->GetNodeName(), "The size of num_segments must be 1!"), | 56 | + OP_LOGE_FOR_INVALID_LISTSIZE( |
| 57 | - return ge::GRAPH_FAILED); | 57 | + context->GetNodeName(), "num_segments", |
| 58 | + std::to_string(num_segments_tensor->GetShapeSize()).c_str(), "1"), | ||
| 59 | + return ge::GRAPH_FAILED); | ||
| 58 | 60 | ||
| 59 | // dynamic shape is -2 | 61 | // dynamic shape is -2 |
| 60 | if (IsUnknownRank(*x_shape)) { | 62 | if (IsUnknownRank(*x_shape)) { |