已合并
OP_LOGE接口整改 #4446
陈思创建于 4月29日
OP_LOGE接口整改 #4446
已合并
陈思创建于 4月29日
17 个文件变更+352-222
@@ -7,7 +7,7 @@
7# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.7# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8# See LICENSE in the root of the software repository for the full text of the License.8# See LICENSE in the root of the software repository for the full text of the License.
9# ----------------------------------------------------------------------------9# ----------------------------------------------------------------------------
10-set(OPBASE_TAG_ID cc7abcd40480902c0d20204a1b6a3d98edaa9253)10+set(OPBASE_TAG_ID 29cce588c8494853f1f9cc53f1ac523ec2a4fc39)
11 11 
12if(EXISTS "${PROJECT_SOURCE_DIR}/../../ops-base")12if(EXISTS "${PROJECT_SOURCE_DIR}/../../ops-base")
13 get_filename_component(OPBASE_SOURCE_PATH13 get_filename_component(OPBASE_SOURCE_PATH
@@ -108,7 +108,7 @@ ge::graphStatus ForeachNonFiniteCheckAndUnscaleRegbaseTiling::GetShapeAttrsInfo(
108 OP_CHECK_IF(108 OP_CHECK_IF(
109 totalTensorCount_ > MAX_TENSOR_COUNT || totalTensorCount_ <= 0,109 totalTensorCount_ > MAX_TENSOR_COUNT || totalTensorCount_ <= 0,
110 OP_LOGE_FOR_INVALID_TENSORNUM(nodeName_.c_str(), "scaled_grads", totalTensorCount_,110 OP_LOGE_FOR_INVALID_TENSORNUM(nodeName_.c_str(), "scaled_grads", totalTensorCount_,
111- ("(0, " + std::to_string(MAX_TENSOR_COUNT) + ")").c_str()),111+ ("within the range (0, " + std::to_string(MAX_TENSOR_COUNT) + ")").c_str()),
112 return ge::GRAPH_FAILED);112 return ge::GRAPH_FAILED);
113 113 
114 // Get shape, dtype information, and the total number of data.114 // Get shape, dtype information, and the total number of data.
@@ -132,9 +132,9 @@ ge::graphStatus ForeachNonFiniteCheckAndUnscaleRegbaseTiling::GetShapeAttrsInfo(
132 } else if (tempDtype != dataType_) {132 } else if (tempDtype != dataType_) {
133 OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(nodeName_.c_str(), "scaled_grads",133 OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(nodeName_.c_str(), "scaled_grads",
134 ge::TypeUtils::DataTypeToSerialString(tempDtype).c_str(),134 ge::TypeUtils::DataTypeToSerialString(tempDtype).c_str(),
135- ("All tensor dtypes must be consistent, expected " +135+ ("The dtypes of all tensors in the tensor list must be the same, expected " +
136 ge::TypeUtils::DataTypeToSerialString(dataType_) +136 ge::TypeUtils::DataTypeToSerialString(dataType_) +
137- ", but scaled_grads[" + std::to_string(i) + "] does not match").c_str());137+ ".Currently, the dtype of scaled_grads[" + std::to_string(i) + "] is inconsistent with that of other tensors").c_str());
138 return ge::GRAPH_FAILED;138 return ge::GRAPH_FAILED;
139 }139 }
140 auto shapePtr = context_->GetDynamicInputShape(SCALE_GRADS_INDEX, i);140 auto shapePtr = context_->GetDynamicInputShape(SCALE_GRADS_INDEX, i);
@@ -234,7 +234,7 @@ ge::graphStatus ForeachNonFiniteCheckAndUnscaleRegbaseTiling::CheckParams() cons
234 OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON(nodeName_.c_str(), "found_inf and inv_scale",234 OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON(nodeName_.c_str(), "found_inf and inv_scale",
235 (ge::TypeUtils::DataTypeToSerialString(flagDescPtr->GetDataType()) + " and " +235 (ge::TypeUtils::DataTypeToSerialString(flagDescPtr->GetDataType()) + " and " +
236 ge::TypeUtils::DataTypeToSerialString(scaleDescPtr->GetDataType())).c_str(),236 ge::TypeUtils::DataTypeToSerialString(scaleDescPtr->GetDataType())).c_str(),
237- "The datatypes of found_inf and inv_scale must be float"),237+ "The dtypes of found_inf and inv_scale must be float"),
238 return ge::GRAPH_FAILED);238 return ge::GRAPH_FAILED);
239 239 
240 return ge::GRAPH_SUCCESS;240 return ge::GRAPH_SUCCESS;
@@ -104,14 +104,15 @@ ge::graphStatus ForeachNonFiniteCheckAndUnscaleTiling::Init()
104 dataTypeSize <= 0,104 dataTypeSize <= 0,
105 OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(nodeName.c_str(), "scaled_grads",105 OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(nodeName.c_str(), "scaled_grads",
106 ge::TypeUtils::DataTypeToSerialString(dataType).c_str(),106 ge::TypeUtils::DataTypeToSerialString(dataType).c_str(),
107- "The dataTypeSize of scaled_grads must bigger than 0"),107+ "The dtype size of scaled_grads must be greater than 0"),
108 return ge::GRAPH_FAILED);108 return ge::GRAPH_FAILED);
109 elementsPerBlock = BYTE_BLOCK / dataTypeSize;109 elementsPerBlock = BYTE_BLOCK / dataTypeSize;
110 } else if (tempDtype != dataType) {110 } else if (tempDtype != dataType) {
111 OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(nodeName.c_str(), "scaled_grads",111 OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(nodeName.c_str(), "scaled_grads",
112 ge::TypeUtils::DataTypeToSerialString(tempDtype).c_str(),112 ge::TypeUtils::DataTypeToSerialString(tempDtype).c_str(),
113- ("All tensor dtype must be consistent, expected " +113+ ("The dtypes of all tensors in tensor list scaled_grads must be the same, expected " +
114- ge::TypeUtils::DataTypeToSerialString(dataType)).c_str());114+ ge::TypeUtils::DataTypeToSerialString(dataType)+
115+ ".Currently, the dtype of scaled_grads[" + std::to_string(i) + "] is inconsistent with that of other tensors").c_str());
115 return ge::GRAPH_FAILED;116 return ge::GRAPH_FAILED;
116 }117 }
117 auto shapePtr = tilingContext->GetDynamicInputShape(SCALE_GRADS_INDEX, i);118 auto shapePtr = tilingContext->GetDynamicInputShape(SCALE_GRADS_INDEX, i);
@@ -181,7 +182,7 @@ ge::graphStatus ForeachNonFiniteCheckAndUnscaleTiling::CheckParams() const
181 OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON(nodeName.c_str(), "found_inf and inv_scale",182 OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON(nodeName.c_str(), "found_inf and inv_scale",
182 (ge::TypeUtils::DataTypeToSerialString(flagDescPtr->GetDataType()) + " and " +183 (ge::TypeUtils::DataTypeToSerialString(flagDescPtr->GetDataType()) + " and " +
183 ge::TypeUtils::DataTypeToSerialString(scaleDescPtr->GetDataType())).c_str(),184 ge::TypeUtils::DataTypeToSerialString(scaleDescPtr->GetDataType())).c_str(),
184- "The datatypes of found_inf and inv_scale must be float"),185+ "The dtypes of found_inf and inv_scale must be float"),
185 return ge::GRAPH_FAILED);186 return ge::GRAPH_FAILED);
186 187 
187 return ge::GRAPH_SUCCESS;188 return ge::GRAPH_SUCCESS;
@@ -44,9 +44,10 @@ ge::graphStatus ForeachReduceRegbaseTiling::GetShapeAttrsInfo()
44 totalTensorCount_ = anchorInstanceInfo->GetInstanceNum();44 totalTensorCount_ = anchorInstanceInfo->GetInstanceNum();
45 OP_CHECK_IF(45 OP_CHECK_IF(
46 totalTensorCount_ > MAX_TENSOR_CONT_950 || totalTensorCount_ <= 0,46 totalTensorCount_ > MAX_TENSOR_CONT_950 || totalTensorCount_ <= 0,
47- OP_LOGE(47+ OP_LOGE_FOR_INVALID_TENSORNUM(
48- context_, "The number of input tensors must not be greater than %hu or less than/equal to 0, but get [%hu].", MAX_TENSOR_CONT_950,48+ context_->GetNodeName(), "x",
49- totalTensorCount_),49+ static_cast<int64_t>(totalTensorCount_),
50+ ("within the range [1, " + std::to_string(MAX_TENSOR_CONT_950) + "]").c_str()),
50 return ge::GRAPH_FAILED);51 return ge::GRAPH_FAILED);
51 totalDataCount_ = 0;52 totalDataCount_ = 0;
52 dataType_ = ge::DT_UNDEFINED;53 dataType_ = ge::DT_UNDEFINED;
@@ -59,7 +60,14 @@ ge::graphStatus ForeachReduceRegbaseTiling::GetShapeAttrsInfo()
59 if (dataType_ == ge::DT_UNDEFINED) {60 if (dataType_ == ge::DT_UNDEFINED) {
60 dataType_ = srcDtype;61 dataType_ = srcDtype;
61 } else if (srcDtype != dataType_) {62 } else if (srcDtype != dataType_) {
62- OP_LOGE(context_, "DataType of all input should be same.");63+ std::string reasonMsg = "The dtypes of all tensors in the tensor list must be the same. "
64+ "Currently, the dtype of the " +
65+ std::to_string(i) + "th tensor is inconsistent with that (" +
66+ ge::TypeUtils::DataTypeToSerialString(dataType_) + ") of other tensors";
67+ OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(
68+ context_->GetNodeName(), "x",
69+ ge::TypeUtils::DataTypeToSerialString(srcDtype).c_str(),
70+ reasonMsg.c_str());
63 return ge::GRAPH_FAILED;71 return ge::GRAPH_FAILED;
64 }72 }
65 auto tempShape = context_->GetDynamicInputShape(0, i);73 auto tempShape = context_->GetDynamicInputShape(0, i);
@@ -67,10 +75,11 @@ ge::graphStatus ForeachReduceRegbaseTiling::GetShapeAttrsInfo()
67 // check max dim75 // check max dim
68 OP_CHECK_IF(76 OP_CHECK_IF(
69 tempShape->GetStorageShape().GetDimNum() > MAX_SUPPORT_DIM_NUMS,77 tempShape->GetStorageShape().GetDimNum() > MAX_SUPPORT_DIM_NUMS,
70- OP_LOGE(78+ OP_LOGE_FOR_INVALID_SHAPEDIM(
71 context_->GetNodeName(),79 context_->GetNodeName(),
72- "The input1 tensors[%u] shape is invaild, and it cannot be larger than 8 dimensions, but its %zu dims.",80+ "x",
73- i, tempShape->GetStorageShape().GetDimNum()),81+ std::to_string(tempShape->GetStorageShape().GetDimNum()).c_str(),
Z
Zzl_hw5月7日

OP_LOGE_FOR_INVALID_SHAPEDIM 没有reason入参

likedislike
陈思
陈思
5月7日 评论:
82+ "less than or equal to 8"),
74 return ge::GRAPH_FAILED);83 return ge::GRAPH_FAILED);
75 84 
76 // Make a 32-byte alignment for each Tensor85 // Make a 32-byte alignment for each Tensor
@@ -94,20 +103,24 @@ ge::graphStatus ForeachReduceRegbaseTiling::CheckScalar()
94 scalarDtype_ = scalarDesc->GetDataType();103 scalarDtype_ = scalarDesc->GetDataType();
95 OP_CHECK_IF(104 OP_CHECK_IF(
96 scalarDtype_ != ge::DT_FLOAT && scalarDtype_ != ge::DT_INT64,105 scalarDtype_ != ge::DT_FLOAT && scalarDtype_ != ge::DT_INT64,
97- OP_LOGE(106+ OP_LOGE_FOR_INVALID_DTYPE(
98- context_, "The data type of the scalar only supports FP32 and INT64, but it is %s.",107+ context_->GetNodeName(), "scalar",
99- Ops::Base::ToString(scalarDtype_).c_str()),108+ ge::TypeUtils::DataTypeToSerialString(scalarDtype_).c_str(), "FP32 or INT64"),
100 return ge::GRAPH_FAILED);109 return ge::GRAPH_FAILED);
101 auto scalarShape = context_->GetRequiredInputShape(SECOND_INPUT_IDX);110 auto scalarShape = context_->GetRequiredInputShape(SECOND_INPUT_IDX);
102 OP_CHECK_IF(scalarShape == nullptr, OP_LOGE(context_, "The scalar shape is null."), return ge::GRAPH_FAILED);111 OP_CHECK_IF(scalarShape == nullptr, OP_LOGE(context_, "The scalar shape is null."), return ge::GRAPH_FAILED);
103 OP_CHECK_IF(112 OP_CHECK_IF(
104 scalarShape->GetStorageShape().GetDimNum() > MAX_SUPPORT_DIM_NUMS,113 scalarShape->GetStorageShape().GetDimNum() > MAX_SUPPORT_DIM_NUMS,
105- OP_LOGE(114+ OP_LOGE_FOR_INVALID_SHAPEDIM(
106- context_, "The scalar shape is invaild, and it cannot be larger than 8 dimensions, but its %zu dims.",115+ context_->GetNodeName(), "scalar",
107- scalarShape->GetStorageShape().GetDimNum()),116+ std::to_string(scalarShape->GetStorageShape().GetDimNum()).c_str(),
117+ "less than or equal to 8"),
108 return ge::GRAPH_FAILED);118 return ge::GRAPH_FAILED);
109 OP_CHECK_IF(119 OP_CHECK_IF(
110- scalarShape->GetStorageShape().GetShapeSize() != 1, OP_LOGE(context_, "The scalar shape must be 1."),120+ scalarShape->GetStorageShape().GetShapeSize() != 1,
121+ OP_LOGE_FOR_INVALID_SHAPESIZE(
122+ context_->GetNodeName(), "scalar",
123+ std::to_string(scalarShape->GetStorageShape().GetShapeSize()).c_str(), "1"),
111 return ge::GRAPH_FAILED);124 return ge::GRAPH_FAILED);
112 return ge::GRAPH_SUCCESS;125 return ge::GRAPH_SUCCESS;
113}126}
@@ -117,7 +130,11 @@ ge::graphStatus ForeachReduceRegbaseTiling::CheckShapeAllPositive(const gert::Sh
117 for (size_t i = 0; i < shape.GetDimNum(); i++) {130 for (size_t i = 0; i < shape.GetDimNum(); i++) {
118 OP_CHECK_IF(131 OP_CHECK_IF(
119 shape.GetDim(i) < 0,132 shape.GetDim(i) < 0,
120- OP_LOGE(context_, "Dim %lu of input %u expect cant be negtive, but actual %ld.", i, idx, shape.GetDim(i)),133+ OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(
134+ context_->GetNodeName(), "x", std::to_string(shape.GetDim(i)).c_str(),
135+ "All axes of tensors in the tensor list must be 0 or positive numbers. Currently, the " +
136+ std::to_string(i) + "th axis of the " + std::to_string(idx) +
137+ "th tensor in the tensor list does not meet the condition"),
121 return ge::GRAPH_FAILED);138 return ge::GRAPH_FAILED);
122 }139 }
123 return ge::GRAPH_SUCCESS;140 return ge::GRAPH_SUCCESS;
@@ -212,33 +229,39 @@ ge::graphStatus ForeachReduceRegbaseTiling::CheckOutput()
212 size_t outputCount = context_->GetComputeNodeOutputNum();229 size_t outputCount = context_->GetComputeNodeOutputNum();
213 OP_CHECK_IF(230 OP_CHECK_IF(
214 totalTensorCount_ != outputCount,231 totalTensorCount_ != outputCount,
215- OP_LOGE(232+ OP_LOGE_FOR_INVALID_TENSORNUMS_WITH_REASON(
216- context_, "The output num should be same with input, expect %hu, actual %lu.", totalTensorCount_,233+ context_->GetNodeName(), "x and y",
217- outputCount),234+ (std::to_string(totalTensorCount_) + " and " + std::to_string(outputCount)).c_str(),
235+ "The tensor nums in {x, y} must be the same"),
218 return ge::GRAPH_FAILED);236 return ge::GRAPH_FAILED);
219 for (uint32_t i = 0; i < totalTensorCount_; i++) {237 for (uint32_t i = 0; i < totalTensorCount_; i++) {
220 auto tempDesc = context_->GetOutputDesc(i);238 auto tempDesc = context_->GetOutputDesc(i);
221 OP_CHECK_IF(tempDesc == nullptr, OP_LOGE(context_, "The output %u desc is null.", i), return ge::GRAPH_FAILED);239 OP_CHECK_IF(tempDesc == nullptr, OP_LOGE(context_, "The output %u desc is null.", i), return ge::GRAPH_FAILED);
222 auto dstDtype = tempDesc->GetDataType();240 auto dstDtype = tempDesc->GetDataType();
223 OP_CHECK_IF(241 OP_CHECK_IF(
224- dstDtype != dataType_, OP_LOGE(context_, "The output %u datatype should be same with input.", i),242+ dstDtype != dataType_,
243+ OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(
244+ context_->GetNodeName(), "y",
245+ ge::TypeUtils::DataTypeToSerialString(dstDtype).c_str(),
246+ "The dtype of y must be the same as x"),
225 return ge::GRAPH_FAILED);247 return ge::GRAPH_FAILED);
226 auto dstShape = context_->GetOutputShape(i);248 auto dstShape = context_->GetOutputShape(i);
227 OP_CHECK_IF(dstShape == nullptr, OP_LOGE(context_, "The output %u shape is null.", i), return ge::GRAPH_FAILED);249 OP_CHECK_IF(dstShape == nullptr, OP_LOGE(context_, "The output %u shape is null.", i), return ge::GRAPH_FAILED);
228 // check max dim250 // check max dim
229 OP_CHECK_IF(251 OP_CHECK_IF(
230 dstShape->GetStorageShape().GetDimNum() > MAX_SUPPORT_DIM_NUMS,252 dstShape->GetStorageShape().GetDimNum() > MAX_SUPPORT_DIM_NUMS,
231- OP_LOGE(253+ OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON(
232- context_->GetNodeName(),254+ context_->GetNodeName(), "y",
233- "The output tensors[%u] shape is invaild, and it cannot be larger than 8 dimensions, but its %zu dims.",255+ std::to_string(dstShape->GetStorageShape().GetDimNum()).c_str(),
234- i, dstShape->GetStorageShape().GetDimNum()),256+ ("The shape dim of " + std::to_string(i) + "th tensor in tensorlist y must be less than or equal 8").c_str()),
Z
Zzl_hw5月7日

提交reason审核

likedislike
235 return ge::GRAPH_FAILED);257 return ge::GRAPH_FAILED);
236 258 
237 OP_CHECK_IF(259 OP_CHECK_IF(
238 dstShape->GetStorageShape().GetShapeSize() != 1,260 dstShape->GetStorageShape().GetShapeSize() != 1,
239- OP_LOGE(261+ OP_LOGE_FOR_INVALID_SHAPESIZE_WITH_REASON(
240- context_, "The output tensors[%u] shapeSize should be 1, but it is %ld.", i,262+ context_->GetNodeName(), "y",
241- dstShape->GetStorageShape().GetShapeSize()),263+ std::to_string(dstShape->GetStorageShape().GetShapeSize()).c_str(),
264+ ("The shape size of " + std::to_string(i) + "th tensor in tensorlist y must be 1").c_str()),
Z
Zzl_hw5月7日

提交reason审核

likedislike
陈思
陈思
5月7日 评论:
242 return ge::GRAPH_FAILED);265 return ge::GRAPH_FAILED);
243 }266 }
244 return ge::GRAPH_SUCCESS;267 return ge::GRAPH_SUCCESS;
@@ -260,9 +260,9 @@ private:
260 size_t xSize = anchorInstanceInfo->GetInstanceNum();260 size_t xSize = anchorInstanceInfo->GetInstanceNum();
261 OP_CHECK_IF(261 OP_CHECK_IF(
262 xSize > MAX_TENSOR_CONT,262 xSize > MAX_TENSOR_CONT,
263- OP_LOGE(263+ OP_LOGE_FOR_INVALID_TENSORNUM(
264- tilingContext->GetNodeName(), "The number of input tensors [%lu] not in [0, %d].", xSize,264+ tilingContext->GetNodeName(), "x", static_cast<int64_t>(xSize),
265- MAX_TENSOR_CONT),265+ ("within the range [0," + std::to_string(MAX_TENSOR_CONT) + "]").c_str()),
266 return ge::GRAPH_FAILED);266 return ge::GRAPH_FAILED);
267 267 
268 OP_CHECK_IF(268 OP_CHECK_IF(
@@ -289,23 +289,24 @@ private:
289 return ge::GRAPH_FAILED);289 return ge::GRAPH_FAILED);
290 290 
291 // check max dim291 // check max dim
292- OP_CHECK_IF(292+ if(x1Shape->GetStorageShape().GetDimNum() > MAX_SUPPORT_DIMS_NUMS){
TangPC
TangPCTangPC5月7日

if 关键字后缺少空格,应写为 if (;左花括号前也缺少空格,){ 应写为 ) {。文件中其他 if 语句(如第 302 行)使用了正确格式,此处是新引入的不一致。

likedislike
陈思
陈思
5月7日 评论:
293- x1Shape->GetStorageShape().GetDimNum() > MAX_SUPPORT_DIMS_NUMS,293+ OP_LOGE_FOR_INVALID_SHAPEDIM(
294- OP_LOGE(294+ tilingContext->GetNodeName(), "x",
295- tilingContext->GetNodeName(),295+ std::to_string(x1Shape->GetStorageShape().GetDimNum()).c_str(),
296- "The input %lu shape is invalid, and it cannot be larger than %zu dimensions.", startListIndex,296+ "less than or equal to 8");
297- static_cast<size_t>(MAX_SUPPORT_DIMS_NUMS)),297+ return ge::GRAPH_FAILED;
298- return ge::GRAPH_FAILED);298+ }
299 299 
300- // checke tensorlist input consistent300+ // check tensorlist input consistent
301 for (size_t listId = startListIndex + 1; listId < static_cast<size_t>(inputTensorsNum); listId++) {301 for (size_t listId = startListIndex + 1; listId < static_cast<size_t>(inputTensorsNum); listId++) {
302- OP_CHECK_IF(302+ if (x1Shape->GetStorageShape() !=
303- x1Shape->GetStorageShape() !=303+ tilingContext->GetDynamicInputShape(listId, tensorId)->GetStorageShape()) {
304- tilingContext->GetDynamicInputShape(listId, tensorId)->GetStorageShape(),304+ std::string paramName = "x " + std::to_string(listId + 1);
305- OP_LOGE(305+ std::string errMsg = Ops::Base::ToString(tilingContext->GetDynamicInputShape(listId, tensorId)->GetStorageShape());
306- tilingContext->GetNodeName(), "The input %lu shape should be same with input %lu.", listId,306+ std::string reasonMsg = "The shape of x" + std::to_string(listId + 1) + " should be the same as x" + std::to_string(startListIndex + 1);
307- startListIndex),307+ OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(tilingContext->GetNodeName(), paramName.c_str(),errMsg.c_str(),reasonMsg.c_str());
308- return ge::GRAPH_FAILED);308+ return ge::GRAPH_FAILED;
309+ }
309 }310 }
310 }311 }
311 return ge::GRAPH_SUCCESS;312 return ge::GRAPH_SUCCESS;
@@ -317,12 +318,13 @@ private:
317 ge::graphStatus CheckOutputShapeAndDtype()318 ge::graphStatus CheckOutputShapeAndDtype()
318 {319 {
319 size_t outputCount = tilingContext->GetComputeNodeOutputNum();320 size_t outputCount = tilingContext->GetComputeNodeOutputNum();
320- OP_CHECK_IF(321+ if(static_cast<size_t>(totalTensorCount) != outputCount){
321- static_cast<size_t>(totalTensorCount) != outputCount,322+ OP_LOGE_FOR_INVALID_TENSORNUMS_WITH_REASON(
322- OP_LOGE(323+ tilingContext->GetNodeName(), "x and y",
323- tilingContext->GetNodeName(), "The output num should be same with input, expect %u, actual %lu.",324+ (std::to_string(totalTensorCount) + " and " + std::to_string(outputCount)).c_str(),
324- totalTensorCount, outputCount),325+ "The tensor nums in {x, y} must be the same");
325- return ge::GRAPH_FAILED);326+ return ge::GRAPH_FAILED;
327+ }
326 for (uint32_t i = 0; i < totalTensorCount; i++) {328 for (uint32_t i = 0; i < totalTensorCount; i++) {
327 auto tempDesc = tilingContext->GetOutputDesc(i);329 auto tempDesc = tilingContext->GetOutputDesc(i);
328 OP_CHECK_IF(330 OP_CHECK_IF(
@@ -331,7 +333,10 @@ private:
331 auto dstDtype = tempDesc->GetDataType();333 auto dstDtype = tempDesc->GetDataType();
332 OP_CHECK_IF(334 OP_CHECK_IF(
333 dstDtype != dataType,335 dstDtype != dataType,
334- OP_LOGE(tilingContext->GetNodeName(), "The tensor %u of output datatype should be same with input.", i),336+ OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(
337+ tilingContext->GetNodeName(), "y",
338+ ge::TypeUtils::DataTypeToSerialString(dstDtype).c_str(),
339+ "The dtype of y must be the same as x"),
335 return ge::GRAPH_FAILED);340 return ge::GRAPH_FAILED);
336 auto dstShape = tilingContext->GetOutputShape(i);341 auto dstShape = tilingContext->GetOutputShape(i);
337 OP_CHECK_IF(342 OP_CHECK_IF(
@@ -339,7 +344,10 @@ private:
339 return ge::GRAPH_FAILED);344 return ge::GRAPH_FAILED);
340 OP_CHECK_IF(345 OP_CHECK_IF(
341 dstShape->GetStorageShape().GetShapeSize() != 1,346 dstShape->GetStorageShape().GetShapeSize() != 1,
342- OP_LOGE(tilingContext->GetNodeName(), "The number of output tensor [%u] must be 1.", i),347+ OP_LOGE_FOR_INVALID_SHAPESIZE_WITH_REASON(
348+ tilingContext->GetNodeName(), "y",
349+ std::to_string(dstShape->GetStorageShape().GetShapeSize()).c_str(),
350+ ("The shape size of " + std::to_string(i) + "th tensor in tensorlist y must be 1").c_str()),
343 return ge::GRAPH_FAILED);351 return ge::GRAPH_FAILED);
344 }352 }
345 return ge::GRAPH_SUCCESS;353 return ge::GRAPH_SUCCESS;
@@ -21,6 +21,15 @@
21 21 
22namespace optiling {22namespace optiling {
23static constexpr uint64_t WORK_SPACE_SIZE = 32;23static constexpr uint64_t WORK_SPACE_SIZE = 32;
24+ 
25+const char* ForeachRegbaseTiling::GetFirstTensorName() const
26+{
27+ auto computeNodeInfo = context_->GetComputeNodeInfo();
28+ if (computeNodeInfo != nullptr && computeNodeInfo->GetIrInputsNum() > 2) {
29+ return "x1";
30+ }
31+ return "x";
32+}
24static constexpr int64_t DOUBLE_BUFFER = 2;33static constexpr int64_t DOUBLE_BUFFER = 2;
25static constexpr uint64_t TILING_KEY_HALF = 10001;34static constexpr uint64_t TILING_KEY_HALF = 10001;
26static constexpr uint64_t TILING_KEY_FLOAT = 10002;35static constexpr uint64_t TILING_KEY_FLOAT = 10002;
@@ -55,9 +64,10 @@ ge::graphStatus ForeachRegbaseTiling::GetShapeAttrsInfo()
55 totalTensorCount_ = anchorInstanceInfo->GetInstanceNum();64 totalTensorCount_ = anchorInstanceInfo->GetInstanceNum();
56 OP_CHECK_IF(65 OP_CHECK_IF(
57 totalTensorCount_ > MAX_TENSOR_CONT_950 || totalTensorCount_ <= 0,66 totalTensorCount_ > MAX_TENSOR_CONT_950 || totalTensorCount_ <= 0,
58- OP_LOGE(67+ OP_LOGE_FOR_INVALID_TENSORNUM(
59- context_, "The number of input tensors must not be greater than %hu or smaller than 1, but get [%hu].",68+ context_->GetNodeName(), GetFirstTensorName(),
60- MAX_TENSOR_CONT_950, totalTensorCount_),69+ static_cast<int64_t>(totalTensorCount_),
70+ ("within the range [1, " + std::to_string(MAX_TENSOR_CONT_950) + "]").c_str()),
61 return ge::GRAPH_FAILED);71 return ge::GRAPH_FAILED);
62 totalDataCount_ = 0;72 totalDataCount_ = 0;
63 dataType_ = ge::DT_UNDEFINED;73 dataType_ = ge::DT_UNDEFINED;
@@ -69,7 +79,12 @@ ge::graphStatus ForeachRegbaseTiling::GetShapeAttrsInfo()
69 if (dataType_ == ge::DT_UNDEFINED) {79 if (dataType_ == ge::DT_UNDEFINED) {
70 dataType_ = srcDtype;80 dataType_ = srcDtype;
71 } else if (srcDtype != dataType_) {81 } else if (srcDtype != dataType_) {
72- OP_LOGE(context_, "DataType of all input should be same.");82+ OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(
83+ context_->GetNodeName(), GetFirstTensorName(),
84+ ge::TypeUtils::DataTypeToSerialString(srcDtype).c_str(),
85+ ("The dtypes of all tensors in the tensor list must be the same. "
86+ "Currently, the dtype of the " + std::to_string(i) + "th tensor is inconsistent with that (" +
87+ ge::TypeUtils::DataTypeToSerialString(dataType_) + ") of other tensors").c_str());
73 return ge::GRAPH_FAILED;88 return ge::GRAPH_FAILED;
74 }89 }
75 auto tempShape = context_->GetDynamicInputShape(0, i);90 auto tempShape = context_->GetDynamicInputShape(0, i);
@@ -77,10 +92,11 @@ ge::graphStatus ForeachRegbaseTiling::GetShapeAttrsInfo()
77 // check max dim92 // check max dim
78 OP_CHECK_IF(93 OP_CHECK_IF(
79 tempShape->GetStorageShape().GetDimNum() > MAX_SUPPORT_DIM_NUMS,94 tempShape->GetStorageShape().GetDimNum() > MAX_SUPPORT_DIM_NUMS,
80- OP_LOGE(95+ OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON(
81 context_->GetNodeName(),96 context_->GetNodeName(),
82- "The input1 tensors[%u] shape is invaild, and it cannot be larger than 8 dimensions, but its %zu dims.",97+ GetFirstTensorName(),
83- i, tempShape->GetStorageShape().GetDimNum()),98+ std::to_string(tempShape->GetStorageShape().GetDimNum()).c_str(),
99+ "The shape dim of the " + std::to_string(i) + "th tensor in the tensor list should be less than or equal to 8"),
Z
Zzl_hw5月7日

提交reason审核

likedislike
陈思
陈思
5月7日 评论:
84 return ge::GRAPH_FAILED);100 return ge::GRAPH_FAILED);
85 101 
86 // Make a 32-byte alignment for each Tensor102 // Make a 32-byte alignment for each Tensor
@@ -101,18 +117,26 @@ ge::graphStatus ForeachRegbaseTiling::CheckScalar(int64_t scalarIdx)
101 std::vector<ge::DataType> dtypeComb = {dataType_, scalarDtype_};117 std::vector<ge::DataType> dtypeComb = {dataType_, scalarDtype_};
102 OP_CHECK_IF(118 OP_CHECK_IF(
103 std::find(SUPPORT_DTYPE_COMB.begin(), SUPPORT_DTYPE_COMB.end(), dtypeComb) == SUPPORT_DTYPE_COMB.end(),119 std::find(SUPPORT_DTYPE_COMB.begin(), SUPPORT_DTYPE_COMB.end(), dtypeComb) == SUPPORT_DTYPE_COMB.end(),
104- OP_LOGE(context_, "Only support F32/F32, INT32/INT32, BF16/F32, F16/F16, F16/F32 datetype combination."),120+ OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(
121+ context_->GetNodeName(), "scalar",
122+ (ge::TypeUtils::DataTypeToSerialString(dataType_) + " and " +
123+ ge::TypeUtils::DataTypeToSerialString(scalarDtype_)).c_str(),
124+ "The dtypes of x and scalar must be within the range {F32/F32, INT32/INT32, BF16/F32, F16/F16, F16/F32}"),
105 return ge::GRAPH_FAILED);125 return ge::GRAPH_FAILED);
106 auto scalarShape = context_->GetRequiredInputShape(scalarIdx);126 auto scalarShape = context_->GetRequiredInputShape(scalarIdx);
107 OP_CHECK_IF(scalarShape == nullptr, OP_LOGE(context_, "The scalar shape is null."), return ge::GRAPH_FAILED);127 OP_CHECK_IF(scalarShape == nullptr, OP_LOGE(context_, "The scalar shape is null."), return ge::GRAPH_FAILED);
108 OP_CHECK_IF(128 OP_CHECK_IF(
109 scalarShape->GetStorageShape().GetDimNum() > MAX_SUPPORT_DIM_NUMS,129 scalarShape->GetStorageShape().GetDimNum() > MAX_SUPPORT_DIM_NUMS,
110- OP_LOGE(130+ OP_LOGE_FOR_INVALID_SHAPEDIM(
111- context_, "The scalar shape is invaild, and it cannot be larger than 8 dimensions, but its %zu dims.",131+ context_->GetNodeName(), "scalar",
112- scalarShape->GetStorageShape().GetDimNum()),132+ std::to_string(scalarShape->GetStorageShape().GetDimNum()).c_str(),
133+ "less than or equal to 8"),
113 return ge::GRAPH_FAILED);134 return ge::GRAPH_FAILED);
114 OP_CHECK_IF(135 OP_CHECK_IF(
115- scalarShape->GetStorageShape().GetShapeSize() != 1, OP_LOGE(context_, "The scalar shape must be 1."),136+ scalarShape->GetStorageShape().GetShapeSize() != 1,
137+ OP_LOGE_FOR_INVALID_SHAPESIZE(
138+ context_->GetNodeName(), "scalar",
139+ std::to_string(scalarShape->GetStorageShape().GetShapeSize()).c_str(), "1"),
116 return ge::GRAPH_FAILED);140 return ge::GRAPH_FAILED);
117 return ge::GRAPH_SUCCESS;141 return ge::GRAPH_SUCCESS;
118}142}
@@ -124,23 +148,24 @@ ge::graphStatus ForeachRegbaseTiling::CheckScalarList(int64_t scalarIdx)
124 scalarDtype_ = scalarDesc->GetDataType();148 scalarDtype_ = scalarDesc->GetDataType();
125 OP_CHECK_IF(149 OP_CHECK_IF(
126 scalarDtype_ != ge::DT_FLOAT,150 scalarDtype_ != ge::DT_FLOAT,
127- OP_LOGE(151+ OP_LOGE_FOR_INVALID_DTYPE(
128- context_, "The scalars dtype only support F32 but got %s.",152+ context_->GetNodeName(), "scalars",
129- ge::TypeUtils::DataTypeToSerialString(scalarDtype_).c_str()),153+ ge::TypeUtils::DataTypeToSerialString(scalarDtype_).c_str(), "FP32"),
130 return ge::GRAPH_FAILED);154 return ge::GRAPH_FAILED);
131 OP_CHECK_IF(155 OP_CHECK_IF(
132 dataType_ != ge::DT_FLOAT && dataType_ != ge::DT_FLOAT16 && dataType_ != ge::DT_BF16,156 dataType_ != ge::DT_FLOAT && dataType_ != ge::DT_FLOAT16 && dataType_ != ge::DT_BF16,
133- OP_LOGE(157+ OP_LOGE_FOR_INVALID_DTYPE(
134- context_, "The input dtype only support F32/FP16/BF16 but got %s.",158+ context_->GetNodeName(), "x",
135- ge::TypeUtils::DataTypeToSerialString(dataType_).c_str()),159+ ge::TypeUtils::DataTypeToSerialString(dataType_).c_str(), "FP32, FP16 or BF16"),
136 return ge::GRAPH_FAILED);160 return ge::GRAPH_FAILED);
137 auto scalarShape = context_->GetRequiredInputShape(scalarIdx);161 auto scalarShape = context_->GetRequiredInputShape(scalarIdx);
138 OP_CHECK_IF(scalarShape == nullptr, OP_LOGE(context_, "The scalars shape is null."), return ge::GRAPH_FAILED);162 OP_CHECK_IF(scalarShape == nullptr, OP_LOGE(context_, "The scalars shape is null."), return ge::GRAPH_FAILED);
139 OP_CHECK_IF(163 OP_CHECK_IF(
140 scalarShape->GetStorageShape().GetShapeSize() != totalTensorCount_,164 scalarShape->GetStorageShape().GetShapeSize() != totalTensorCount_,
141- OP_LOGE(165+ OP_LOGE_FOR_INVALID_SHAPESIZE(
142- context_, "The scalars count must equal to tensor count %hu, but got %ld.", totalTensorCount_,166+ context_->GetNodeName(), "scalars",
143- scalarShape->GetStorageShape().GetShapeSize()),167+ std::to_string(scalarShape->GetStorageShape().GetShapeSize()).c_str(),
168+ (std::to_string(totalTensorCount_)).c_str()),
144 return ge::GRAPH_FAILED);169 return ge::GRAPH_FAILED);
145 return ge::GRAPH_SUCCESS;170 return ge::GRAPH_SUCCESS;
146}171}
@@ -150,9 +175,9 @@ ge::graphStatus ForeachRegbaseTiling::CheckScalarListInt(int64_t scalarIdx)
150 OP_CHECK_IF(175 OP_CHECK_IF(
151 dataType_ != ge::DT_FLOAT && dataType_ != ge::DT_FLOAT16 && dataType_ != ge::DT_BF16 &&176 dataType_ != ge::DT_FLOAT && dataType_ != ge::DT_FLOAT16 && dataType_ != ge::DT_BF16 &&
152 dataType_ != ge::DT_INT32,177 dataType_ != ge::DT_INT32,
153- OP_LOGE(178+ OP_LOGE_FOR_INVALID_DTYPE(
154- context_, "The input dtype only support F32/FP16/BF16/INT32 but got %s.",179+ context_->GetNodeName(), "x",
155- ge::TypeUtils::DataTypeToSerialString(dataType_).c_str()),180+ ge::TypeUtils::DataTypeToSerialString(dataType_).c_str(), "FP32, FP16, BF16 or INT32"),
156 return ge::GRAPH_FAILED);181 return ge::GRAPH_FAILED);
157 auto scalarDesc = context_->GetRequiredInputDesc(scalarIdx);182 auto scalarDesc = context_->GetRequiredInputDesc(scalarIdx);
158 OP_CHECK_IF(scalarDesc == nullptr, OP_LOGE(context_, "The scalars desc is null."), return ge::GRAPH_FAILED);183 OP_CHECK_IF(scalarDesc == nullptr, OP_LOGE(context_, "The scalars desc is null."), return ge::GRAPH_FAILED);
@@ -161,16 +186,21 @@ ge::graphStatus ForeachRegbaseTiling::CheckScalarListInt(int64_t scalarIdx)
161 OP_CHECK_IF(186 OP_CHECK_IF(
162 std::find(SCALAR_LIST_SUPPORT_DTYPE_COMB.begin(), SCALAR_LIST_SUPPORT_DTYPE_COMB.end(), dtypeComb) ==187 std::find(SCALAR_LIST_SUPPORT_DTYPE_COMB.begin(), SCALAR_LIST_SUPPORT_DTYPE_COMB.end(), dtypeComb) ==
163 SCALAR_LIST_SUPPORT_DTYPE_COMB.end(),188 SCALAR_LIST_SUPPORT_DTYPE_COMB.end(),
164- OP_LOGE(context_, "Only support F32/F32, INT32/INT64, BF16/F32, F16/F32 datetype combination."),189+ OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON(
190+ context_->GetNodeName(), "x and scalars",
191+ (ge::TypeUtils::DataTypeToSerialString(dataType_) + " and " +
192+ ge::TypeUtils::DataTypeToSerialString(scalarDtype_)).c_str(),
193+ "The dtypes of x and scalars must be within the range {F32/F32, INT32/INT64, BF16/F32, F16/F32}"),
165 return ge::GRAPH_FAILED);194 return ge::GRAPH_FAILED);
166 195 
167 auto scalarShape = context_->GetRequiredInputShape(scalarIdx);196 auto scalarShape = context_->GetRequiredInputShape(scalarIdx);
168 OP_CHECK_IF(scalarShape == nullptr, OP_LOGE(context_, "The scalars shape is null."), return ge::GRAPH_FAILED);197 OP_CHECK_IF(scalarShape == nullptr, OP_LOGE(context_, "The scalars shape is null."), return ge::GRAPH_FAILED);
169 OP_CHECK_IF(198 OP_CHECK_IF(
170 scalarShape->GetStorageShape().GetShapeSize() != totalTensorCount_,199 scalarShape->GetStorageShape().GetShapeSize() != totalTensorCount_,
171- OP_LOGE(200+ OP_LOGE_FOR_INVALID_SHAPESIZE(
172- context_, "The scalars count must equal to tensor count %hu, but got %ld.", totalTensorCount_,201+ context_->GetNodeName(), "scalars",
173- scalarShape->GetStorageShape().GetShapeSize()),202+ std::to_string(scalarShape->GetStorageShape().GetShapeSize()).c_str(),
203+ (std::to_string(totalTensorCount_)).c_str()),
174 return ge::GRAPH_FAILED);204 return ge::GRAPH_FAILED);
175 return ge::GRAPH_SUCCESS;205 return ge::GRAPH_SUCCESS;
176}206}
@@ -277,7 +307,11 @@ ge::graphStatus ForeachRegbaseTiling::CheckShapeAllPositive(const gert::Shape& s
277 for (size_t i = 0; i < shape.GetDimNum(); i++) {307 for (size_t i = 0; i < shape.GetDimNum(); i++) {
278 OP_CHECK_IF(308 OP_CHECK_IF(
279 shape.GetDim(i) < 0,309 shape.GetDim(i) < 0,
280- OP_LOGE(context_, "Dim %lu of input %u expect cant be negtive, but actual %ld.", i, idx, shape.GetDim(i)),310+ OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(
311+ context_->GetNodeName(),
312+ GetFirstTensorName(),
313+ std::to_string(shape.GetDim(i)).c_str(),
314+ ("The " + std::to_string(i) + "th axis of the " + std::to_string(idx) + "th tensor in the tensor list must be 0 or a positive number").c_str()),
281 return ge::GRAPH_FAILED);315 return ge::GRAPH_FAILED);
282 }316 }
283 return ge::GRAPH_SUCCESS;317 return ge::GRAPH_SUCCESS;
@@ -304,16 +338,21 @@ ge::graphStatus ForeachRegbaseTiling::CheckOutput()
304 size_t outputCount = context_->GetComputeNodeOutputNum();338 size_t outputCount = context_->GetComputeNodeOutputNum();
305 OP_CHECK_IF(339 OP_CHECK_IF(
306 totalTensorCount_ != outputCount,340 totalTensorCount_ != outputCount,
307- OP_LOGE(341+ OP_LOGE_FOR_INVALID_TENSORNUMS_WITH_REASON(
308- context_, "The output num should be same with input, expect %hu, actual %lu.", totalTensorCount_,342+ context_->GetNodeName(), "x and y",
309- outputCount),343+ (std::to_string(totalTensorCount_) + " and " + std::to_string(outputCount)).c_str(),
344+ "The tensor nums in {x, y} must be the same"),
310 return ge::GRAPH_FAILED);345 return ge::GRAPH_FAILED);
311 for (uint32_t i = 0; i < totalTensorCount_; i++) {346 for (uint32_t i = 0; i < totalTensorCount_; i++) {
312 auto tempDesc = context_->GetOutputDesc(i);347 auto tempDesc = context_->GetOutputDesc(i);
313 OP_CHECK_IF(tempDesc == nullptr, OP_LOGE(context_, "The output %u desc is null.", i), return ge::GRAPH_FAILED);348 OP_CHECK_IF(tempDesc == nullptr, OP_LOGE(context_, "The output %u desc is null.", i), return ge::GRAPH_FAILED);
314 auto dstDtype = tempDesc->GetDataType();349 auto dstDtype = tempDesc->GetDataType();
315 OP_CHECK_IF(350 OP_CHECK_IF(
316- dstDtype != dataType_, OP_LOGE(context_, "The output %u datatype should be same with input.", i),351+ dstDtype != dataType_,
352+ OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(
353+ context_->GetNodeName(), "y",
354+ ge::TypeUtils::DataTypeToSerialString(dstDtype).c_str(),
355+ "The dtype of y must be the same as x"),
317 return ge::GRAPH_FAILED);356 return ge::GRAPH_FAILED);
318 auto srcShape = context_->GetDynamicInputShape(0, i);357 auto srcShape = context_->GetDynamicInputShape(0, i);
319 OP_CHECK_IF(srcShape == nullptr, OP_LOGE(context_, "The input %u shape is null.", i), return ge::GRAPH_FAILED);358 OP_CHECK_IF(srcShape == nullptr, OP_LOGE(context_, "The input %u shape is null.", i), return ge::GRAPH_FAILED);
@@ -322,21 +361,25 @@ ge::graphStatus ForeachRegbaseTiling::CheckOutput()
322 // check max dim361 // check max dim
323 OP_CHECK_IF(362 OP_CHECK_IF(
324 dstShape->GetStorageShape().GetDimNum() > MAX_SUPPORT_DIM_NUMS,363 dstShape->GetStorageShape().GetDimNum() > MAX_SUPPORT_DIM_NUMS,
325- OP_LOGE(364+ OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON(
326- context_->GetNodeName(),365+ context_->GetNodeName(), "y",
327- "The output tensors[%u] shape is invaild, and it cannot be larger than 8 dimensions, but its %zu dims.",366+ std::to_string(dstShape->GetStorageShape().GetDimNum()).c_str(),
328- i, dstShape->GetStorageShape().GetDimNum()),367+ ("The " + std::to_string(i) + "th tensor in tensor list y must be less than or equal to 8").c_str()),
329 return ge::GRAPH_FAILED);368 return ge::GRAPH_FAILED);
330 369 
331- OP_CHECK_IF(370+ if (srcShape->GetStorageShape() != dstShape->GetStorageShape() &&
332- srcShape->GetStorageShape() != dstShape->GetStorageShape() &&371+ srcShape->GetStorageShape().GetShapeSize() > dstShape->GetStorageShape().GetShapeSize()) {
333- srcShape->GetStorageShape().GetShapeSize() > dstShape->GetStorageShape().GetShapeSize(),372+ std::string reasonMsg = "The shape size of " + std::to_string(i) +
334- OP_LOGE(373+ "th tensor in tensor list y should be greater than or equal to that of the tensor "
335- context_,374+ "in the same position of the another tensor list x";
336- "The output tensors[%u] shapeSize should be same with input, but input tensors[%u] is %ld, output "375+ OP_LOGE_FOR_INVALID_SHAPESIZE_WITH_REASON(
337- "tensors[%u] is %ld.",376+ context_->GetNodeName(), "y",
338- i, i, srcShape->GetStorageShape().GetShapeSize(), i, dstShape->GetStorageShape().GetShapeSize()),377+ (std::to_string(srcShape->GetStorageShape().GetShapeSize()) + " and " +
339- return ge::GRAPH_FAILED);378+ std::to_string(dstShape->GetStorageShape().GetShapeSize()))
379+ .c_str(),
380+ reasonMsg.c_str());
381+ return ge::GRAPH_FAILED;
382+ }
340 }383 }
341 return ge::GRAPH_SUCCESS;384 return ge::GRAPH_SUCCESS;
342}385}
@@ -455,9 +498,11 @@ ge::graphStatus ForeachRegbaseTilingTernaryScalar::CheckContext()
455 498 
456 OP_CHECK_IF(499 OP_CHECK_IF(
457 totalTensorCount_ != totalTensorCountSecond || totalTensorCount_ != totalTensorCountThird,500 totalTensorCount_ != totalTensorCountSecond || totalTensorCount_ != totalTensorCountThird,
458- OP_LOGE(501+ OP_LOGE_FOR_INVALID_TENSORNUMS_WITH_REASON(
459- context_, "The all input tensors should be consistent but detected as %hu, %hu, %hu respectively.",502+ context_->GetNodeName(), "x1, x2 and x3",
460- totalTensorCount_, totalTensorCountSecond, totalTensorCountThird),503+ (std::to_string(totalTensorCount_) + ", " + std::to_string(totalTensorCountSecond) + " and " +
504+ std::to_string(totalTensorCountThird)).c_str(),
505+ "The tensor nums in {x1, x2, x3} must be the same"),
461 return ge::GRAPH_FAILED);506 return ge::GRAPH_FAILED);
462 507 
463 return ge::GRAPH_SUCCESS;508 return ge::GRAPH_SUCCESS;
@@ -477,29 +522,29 @@ ge::graphStatus ForeachRegbaseTilingTernaryScalar::CheckShape(uint32_t idx)
477 // check max dim522 // check max dim
478 OP_CHECK_IF(523 OP_CHECK_IF(
479 tempShapeSecond->GetStorageShape().GetDimNum() > MAX_SUPPORT_DIM_NUMS,524 tempShapeSecond->GetStorageShape().GetDimNum() > MAX_SUPPORT_DIM_NUMS,
480- OP_LOGE(525+ OP_LOGE_FOR_INVALID_SHAPEDIM(
481- context_,526+ context_->GetNodeName(), "x2",
482- "The input2 tensors[%u] shape is invaild, and it cannot be larger than 8 dimensions, but its %zu dims.",527+ std::to_string(tempShapeSecond->GetStorageShape().GetDimNum()).c_str(),
483- idx, tempShapeSecond->GetStorageShape().GetDimNum()),528+ ("The shape dim of " + std::to_string(idx) + "th tensor in the tensor list x2 must be less than or equal to 8").c_str()),
484 return ge::GRAPH_FAILED);529 return ge::GRAPH_FAILED);
485 // check max dim530 // check max dim
486 OP_CHECK_IF(531 OP_CHECK_IF(
487 tempShapeThird->GetStorageShape().GetDimNum() > MAX_SUPPORT_DIM_NUMS,532 tempShapeThird->GetStorageShape().GetDimNum() > MAX_SUPPORT_DIM_NUMS,
488- OP_LOGE(533+ OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON(
489- context_,534+ context_->GetNodeName(), "x3",
490- "The input3 tensors[%u] shape is invaild, and it cannot be larger than 8 dimensions, but its %zu dims.",535+ std::to_string(tempShapeThird->GetStorageShape().GetDimNum()).c_str(),
491- idx, tempShapeThird->GetStorageShape().GetDimNum()),536+ ("The shape dim of " + std::to_string(idx) + "th tensor in the tensor list x3 must be less than or equal to 8").c_str()),
492- return ge::GRAPH_FAILED);
493- OP_CHECK_IF(
494- tempShapeFirst->GetStorageShape().GetShapeSize() != tempShapeSecond->GetStorageShape().GetShapeSize() ||
495- tempShapeFirst->GetStorageShape().GetShapeSize() != tempShapeThird->GetStorageShape().GetShapeSize(),
496- OP_LOGE(
497- context_,
498- "The shapeSize of all input should be consistent, but %uth is not consistent, and detected as %ld, "
499- "%ld, %ld.",
500- idx, tempShapeFirst->GetStorageShape().GetShapeSize(), tempShapeSecond->GetStorageShape().GetShapeSize(),
501- tempShapeThird->GetStorageShape().GetShapeSize()),
502 return ge::GRAPH_FAILED);537 return ge::GRAPH_FAILED);
538+ if (tempShapeFirst->GetStorageShape().GetShapeSize() != tempShapeSecond->GetStorageShape().GetShapeSize() ||
539+ tempShapeFirst->GetStorageShape().GetShapeSize() != tempShapeThird->GetStorageShape().GetShapeSize()) {
540+ OP_LOGE_FOR_INVALID_SHAPESIZES_WITH_REASON(
541+ context_->GetNodeName(), "x1, x2 and x3",
542+ (std::to_string(tempShapeFirst->GetStorageShape().GetShapeSize()) + ", " +
543+ std::to_string(tempShapeSecond->GetStorageShape().GetShapeSize()) + " and " +
544+ std::to_string(tempShapeThird->GetStorageShape().GetShapeSize())).c_str(),
545+ "The shape sizes of x1, x2 and x3 must be the same");
546+ return ge::GRAPH_FAILED;
547+ }
503 return ge::GRAPH_SUCCESS;548 return ge::GRAPH_SUCCESS;
504}549}
505 550 
@@ -524,7 +569,12 @@ ge::graphStatus ForeachRegbaseTilingTernaryScalar::GetShapeAttrsInfo()
524 auto srcDtypeThird = tempDescThird->GetDataType();569 auto srcDtypeThird = tempDescThird->GetDataType();
525 OP_CHECK_IF(570 OP_CHECK_IF(
526 dataType_ != srcDtypeSecond || dataType_ != srcDtypeThird,571 dataType_ != srcDtypeSecond || dataType_ != srcDtypeThird,
527- OP_LOGE(context_, "DataType of all input should be same."), return ge::GRAPH_FAILED);572+ OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON(
573+ context_->GetNodeName(), "x1, x2 and x3",
574+ (ge::TypeUtils::DataTypeToSerialString(dataType_) + ", " +
575+ ge::TypeUtils::DataTypeToSerialString(srcDtypeSecond) + " and " +
576+ ge::TypeUtils::DataTypeToSerialString(srcDtypeThird)).c_str(),
577+ "The dtypes of x1, x2 and x3 must be the same"), return ge::GRAPH_FAILED);
528 578 
529 if (CheckShape(i) != ge::GRAPH_SUCCESS) {579 if (CheckShape(i) != ge::GRAPH_SUCCESS) {
530 return ge::GRAPH_FAILED;580 return ge::GRAPH_FAILED;
@@ -572,9 +622,10 @@ ge::graphStatus ForeachRegbaseTilingBinaryScalar::CheckContext()
572 622 
573 OP_CHECK_IF(623 OP_CHECK_IF(
574 totalTensorCount_ != totalTensorCountSecond,624 totalTensorCount_ != totalTensorCountSecond,
575- OP_LOGE(625+ OP_LOGE_FOR_INVALID_TENSORNUMS_WITH_REASON(
576- context_, "The all input tensors should be consistent but detected as %hu, %hu respectively.",626+ context_->GetNodeName(), "x1 and x2",
577- totalTensorCount_, totalTensorCountSecond),627+ (std::to_string(totalTensorCount_) + " and " + std::to_string(totalTensorCountSecond)).c_str(),
628+ "The tensor nums in {x1, x2} must be the same"),
578 return ge::GRAPH_FAILED);629 return ge::GRAPH_FAILED);
579 630 
580 return ge::GRAPH_SUCCESS;631 return ge::GRAPH_SUCCESS;
@@ -591,18 +642,19 @@ ge::graphStatus ForeachRegbaseTilingBinaryScalar::CheckShape(uint32_t idx)
591 // check max dim642 // check max dim
592 OP_CHECK_IF(643 OP_CHECK_IF(
593 tempShapeSecond->GetStorageShape().GetDimNum() > MAX_SUPPORT_DIM_NUMS,644 tempShapeSecond->GetStorageShape().GetDimNum() > MAX_SUPPORT_DIM_NUMS,
594- OP_LOGE(645+ OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON(
595- context_,646+ context_->GetNodeName(), "x2",
596- "The input2 tensors[%u] shape is invaild, and it cannot be larger than 8 dimensions, but its %zu dims.",647+ std::to_string(tempShapeSecond->GetStorageShape().GetDimNum()).c_str(),
597- idx, tempShapeSecond->GetStorageShape().GetDimNum()),648+ ("The shape dim of the " + std::to_string(idx) + "th tensor of x2 must be less than or equal to 8").c_str()),
598- return ge::GRAPH_FAILED);
599- OP_CHECK_IF(
600- tempShapeFirst->GetStorageShape().GetShapeSize() != tempShapeSecond->GetStorageShape().GetShapeSize(),
601- OP_LOGE(
602- context_->GetNodeName(),
603- "The shapeSize of all input should be consistent, but %uth is not consistent, and detected as %ld, %ld.",
604- idx, tempShapeFirst->GetStorageShape().GetShapeSize(), tempShapeSecond->GetStorageShape().GetShapeSize()),
605 return ge::GRAPH_FAILED);649 return ge::GRAPH_FAILED);
650+ if (tempShapeFirst->GetStorageShape().GetShapeSize() != tempShapeSecond->GetStorageShape().GetShapeSize()) {
651+ OP_LOGE_FOR_INVALID_SHAPESIZES_WITH_REASON(
652+ context_->GetNodeName(), "x1 and x2",
653+ (std::to_string(tempShapeFirst->GetStorageShape().GetShapeSize()) + " and " +
654+ std::to_string(tempShapeSecond->GetStorageShape().GetShapeSize())).c_str(),
655+ "The shape sizes of x1 and x2 must be the same");
656+ return ge::GRAPH_FAILED;
657+ }
606 658 
607 return ge::GRAPH_SUCCESS;659 return ge::GRAPH_SUCCESS;
608}660}
@@ -613,24 +665,31 @@ ge::graphStatus ForeachRegbaseTilingBinaryScalar::CheckScalar()
613 OP_CHECK_IF(scalarDesc == nullptr, OP_LOGE(context_, "The scalar desc is null."), return ge::GRAPH_FAILED);665 OP_CHECK_IF(scalarDesc == nullptr, OP_LOGE(context_, "The scalar desc is null."), return ge::GRAPH_FAILED);
614 scalarDtype_ = scalarDesc->GetDataType();666 scalarDtype_ = scalarDesc->GetDataType();
615 OP_CHECK_IF(667 OP_CHECK_IF(
616- scalarDtype_ != ge::DT_FLOAT, OP_LOGE(context_, "The data type of the scalar only supports FP32."),668+ scalarDtype_ != ge::DT_FLOAT,
669+ OP_LOGE_FOR_INVALID_DTYPE(
670+ context_->GetNodeName(), "weight",
671+ ge::TypeUtils::DataTypeToSerialString(scalarDtype_).c_str(), "FP32"),
617 return ge::GRAPH_FAILED);672 return ge::GRAPH_FAILED);
618 OP_CHECK_IF(673 OP_CHECK_IF(
619 dataType_ != ge::DT_FLOAT && dataType_ != ge::DT_FLOAT16 && dataType_ != ge::DT_BF16,674 dataType_ != ge::DT_FLOAT && dataType_ != ge::DT_FLOAT16 && dataType_ != ge::DT_BF16,
620- OP_LOGE(675+ OP_LOGE_FOR_INVALID_DTYPE(
621- context_, "The input dtype only support F32/FP16/BF16 but got %s.",676+ context_->GetNodeName(), "x1",
622- ge::TypeUtils::DataTypeToSerialString(dataType_).c_str()),677+ ge::TypeUtils::DataTypeToSerialString(dataType_).c_str(), "FP32, FP16 or BF16"),
623 return ge::GRAPH_FAILED);678 return ge::GRAPH_FAILED);
624 auto scalarShape = context_->GetRequiredInputShape(THIRD_INPUT_IDX);679 auto scalarShape = context_->GetRequiredInputShape(THIRD_INPUT_IDX);
625 OP_CHECK_IF(scalarShape == nullptr, OP_LOGE(context_, "The scalar shape is null."), return ge::GRAPH_FAILED);680 OP_CHECK_IF(scalarShape == nullptr, OP_LOGE(context_, "The scalar shape is null."), return ge::GRAPH_FAILED);
626 OP_CHECK_IF(681 OP_CHECK_IF(
627 scalarShape->GetStorageShape().GetDimNum() > MAX_SUPPORT_DIM_NUMS,682 scalarShape->GetStorageShape().GetDimNum() > MAX_SUPPORT_DIM_NUMS,
628- OP_LOGE(683+ OP_LOGE_FOR_INVALID_SHAPEDIM(
629- context_, "The scalar shape is invaild, and it cannot be larger than 8 dimensions, but its %zu dims.",684+ context_->GetNodeName(), "weight",
630- scalarShape->GetStorageShape().GetDimNum()),685+ std::to_string(scalarShape->GetStorageShape().GetDimNum()).c_str(),
686+ "less than or equal to 8"),
631 return ge::GRAPH_FAILED);687 return ge::GRAPH_FAILED);
632 OP_CHECK_IF(688 OP_CHECK_IF(
633- scalarShape->GetStorageShape().GetShapeSize() != 1, OP_LOGE(context_, "The scalar shape must be 1."),689+ scalarShape->GetStorageShape().GetShapeSize() != 1,
690+ OP_LOGE_FOR_INVALID_SHAPESIZE(
691+ context_->GetNodeName(), "weight",
692+ std::to_string(scalarShape->GetStorageShape().GetShapeSize()).c_str(), "1"),
634 return ge::GRAPH_FAILED);693 return ge::GRAPH_FAILED);
635 return ge::GRAPH_SUCCESS;694 return ge::GRAPH_SUCCESS;
636}695}
@@ -651,7 +710,12 @@ ge::graphStatus ForeachRegbaseTilingBinaryScalar::GetShapeAttrsInfo()
651 // check datatype710 // check datatype
652 auto srcDtypeSecond = tempDescSecond->GetDataType();711 auto srcDtypeSecond = tempDescSecond->GetDataType();
653 OP_CHECK_IF(712 OP_CHECK_IF(
654- dataType_ != srcDtypeSecond, OP_LOGE(context_, "DataType of all input should be same."),713+ dataType_ != srcDtypeSecond,
714+ OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON(
715+ context_->GetNodeName(), "x1 and x2",
716+ (ge::TypeUtils::DataTypeToSerialString(dataType_) + " and " +
717+ ge::TypeUtils::DataTypeToSerialString(srcDtypeSecond)).c_str(),
718+ "The dtypes of x1 and x2 must be the same"),
655 return ge::GRAPH_FAILED);719 return ge::GRAPH_FAILED);
656 720 
657 if (CheckShape(i) != ge::GRAPH_SUCCESS) {721 if (CheckShape(i) != ge::GRAPH_SUCCESS) {
@@ -712,15 +776,20 @@ ge::graphStatus ForeachRegbaseTilingUnaryScalarList2::CheckScalarList(int64_t sc
712 OP_CHECK_IF(776 OP_CHECK_IF(
713 std::find(SCALAR_LIST_SUPPORT_DTYPE_COMB.begin(), SCALAR_LIST_SUPPORT_DTYPE_COMB.end(), dtypeComb) ==777 std::find(SCALAR_LIST_SUPPORT_DTYPE_COMB.begin(), SCALAR_LIST_SUPPORT_DTYPE_COMB.end(), dtypeComb) ==
714 SCALAR_LIST_SUPPORT_DTYPE_COMB.end(),778 SCALAR_LIST_SUPPORT_DTYPE_COMB.end(),
715- OP_LOGE(context_, "Only support F32/F32, INT32/INT64, BF16/F32, F16/F32 datetype combination."),779+ OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON(
780+ context_->GetNodeName(), "x and scalars",
781+ (ge::TypeUtils::DataTypeToSerialString(dataType_) + " and " +
782+ ge::TypeUtils::DataTypeToSerialString(scalarDtype_)).c_str(),
783+ "The dtypes of x and scalars must be within the range {F32/F32, INT32/INT64, BF16/F32, F16/F32}"),
716 return ge::GRAPH_FAILED);784 return ge::GRAPH_FAILED);
717 auto scalarShape = context_->GetRequiredInputShape(scalarIdx);785 auto scalarShape = context_->GetRequiredInputShape(scalarIdx);
718 OP_CHECK_IF(scalarShape == nullptr, OP_LOGE(context_, "The scalars shape is null."), return ge::GRAPH_FAILED);786 OP_CHECK_IF(scalarShape == nullptr, OP_LOGE(context_, "The scalars shape is null."), return ge::GRAPH_FAILED);
719 OP_CHECK_IF(787 OP_CHECK_IF(
720 scalarShape->GetStorageShape().GetShapeSize() != totalTensorCount_,788 scalarShape->GetStorageShape().GetShapeSize() != totalTensorCount_,
721- OP_LOGE(789+ OP_LOGE_FOR_INVALID_SHAPESIZE(
722- context_, "The scalars count must equal to tensor count %hu, but got %ld.", totalTensorCount_,790+ context_->GetNodeName(), "scalars",
723- scalarShape->GetStorageShape().GetShapeSize()),791+ std::to_string(scalarShape->GetStorageShape().GetShapeSize()).c_str(),
792+ (std::to_string(totalTensorCount_)).c_str()),
724 return ge::GRAPH_FAILED);793 return ge::GRAPH_FAILED);
725 return ge::GRAPH_SUCCESS;794 return ge::GRAPH_SUCCESS;
726}795}
@@ -73,6 +73,7 @@ protected:
73private:73private:
74 void AssignDataToEachCore(int64_t needCoreNum, int64_t elementsPerBlock);74 void AssignDataToEachCore(int64_t needCoreNum, int64_t elementsPerBlock);
75 ge::graphStatus CheckShapeAllPositive(const gert::Shape& shape, uint32_t idx);75 ge::graphStatus CheckShapeAllPositive(const gert::Shape& shape, uint32_t idx);
76+ const char* GetFirstTensorName() const;
76};77};
77 78 
78class ForeachRegbaseTilingUnaryScalar : public ForeachRegbaseTiling79class ForeachRegbaseTilingUnaryScalar : public ForeachRegbaseTiling
@@ -278,6 +278,9 @@ private:
278 ge::graphStatus CheckForeachCopyDtype(ge::DataType dstDtype)278 ge::graphStatus CheckForeachCopyDtype(ge::DataType dstDtype)
279 {279 {
280 if (dstDtype != dstDataType) {280 if (dstDtype != dstDataType) {
281+ OP_LOGE_FOR_INVALID_DTYPE(
282+ tilingContext->GetNodeName(), "y", ge::TypeUtils::DataTypeToSerialString(dstDtype).c_str(),
283+ ge::TypeUtils::DataTypeToSerialString(dstDataType).c_str());
281 return ge::GRAPH_FAILED;284 return ge::GRAPH_FAILED;
282 }285 }
283 if (dataType == dstDtype) {286 if (dataType == dstDtype) {
@@ -292,6 +295,12 @@ private:
292 } else if (dataType == ge::DT_BF16 && dstDtype == ge::DT_FLOAT) {295 } else if (dataType == ge::DT_BF16 && dstDtype == ge::DT_FLOAT) {
293 return ge::GRAPH_SUCCESS;296 return ge::GRAPH_SUCCESS;
294 } else {297 } else {
298+ std::string reasonMsg =
299+ "The dtype of y must be the same as x "
300+ "when the dtypes of x and y are not within the supported floating-point combinations: x is float16 or "
301+ "bf16 and y is float, or x is float and y is float16 or bf16";
302+ OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(
303+ tilingContext->GetNodeName(), "y", ge::TypeUtils::DataTypeToSerialString(dstDtype).c_str(), reasonMsg);
295 return ge::GRAPH_FAILED;304 return ge::GRAPH_FAILED;
296 }305 }
297 }306 }
@@ -324,7 +333,10 @@ private:
324 } else {333 } else {
325 OP_CHECK_IF(334 OP_CHECK_IF(
326 dstDtype != dataType,335 dstDtype != dataType,
327- OP_LOGE(tilingContext->GetNodeName(), "The tensor %u of output datatype should be same with input.", i),336+ OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(
337+ tilingContext->GetNodeName(), "y",
338+ ge::TypeUtils::DataTypeToSerialString(dstDtype).c_str(),
339+ "The dtype of y must be same as x"),
328 return ge::GRAPH_FAILED);340 return ge::GRAPH_FAILED);
329 }341 }
330 auto srcShape = tilingContext->GetDynamicInputShape(inputIndexZero, i);342 auto srcShape = tilingContext->GetDynamicInputShape(inputIndexZero, i);
@@ -335,16 +347,18 @@ private:
335 OP_CHECK_IF(347 OP_CHECK_IF(
336 dstShape == nullptr, OP_LOGE(tilingContext->GetNodeName(), "The output %u shape is null.", i),348 dstShape == nullptr, OP_LOGE(tilingContext->GetNodeName(), "The output %u shape is null.", i),
337 return ge::GRAPH_FAILED);349 return ge::GRAPH_FAILED);
338- OP_CHECK_IF(350+ if (srcShape->GetStorageShape() != dstShape->GetStorageShape() &&
339- srcShape->GetStorageShape() != dstShape->GetStorageShape() &&351+ srcShape->GetStorageShape().GetShapeSize() > dstShape->GetStorageShape().GetShapeSize()) {
340- srcShape->GetStorageShape().GetShapeSize() > dstShape->GetStorageShape().GetShapeSize(),352+ std::string reasonMsg = "The shape size of " + std::to_string(i) +
341- OP_LOGE(353+ "th tensor in tensor list y should be greater than or equal to that of the tensor "
342- tilingContext->GetNodeName(),354+ "in the same position of the another tensor list x";
343- "The tensor %u of output shape should be same with input. self tensor shape: [%s], but out tensor "355+ OP_LOGE_FOR_INVALID_SHAPESIZES_WITH_REASON(
344- "shape: [%s]",356+ tilingContext->GetNodeName(), "x and y",
345- i, Ops::Base::ToString(srcShape->GetStorageShape()).c_str(),357+ (std::to_string(srcShape->GetStorageShape().GetShapeSize()) + " and " +
346- Ops::Base::ToString(dstShape->GetStorageShape()).c_str()),358+ std::to_string(dstShape->GetStorageShape().GetShapeSize())).c_str(),
347- return ge::GRAPH_FAILED);359+ reasonMsg.c_str());
360+ return ge::GRAPH_FAILED;
361+ }
348 }362 }
349 return ge::GRAPH_SUCCESS;363 return ge::GRAPH_SUCCESS;
350 }364 }
@@ -364,14 +378,17 @@ private:
364 return ge::GRAPH_FAILED);378 return ge::GRAPH_FAILED);
365 OP_CHECK_IF(379 OP_CHECK_IF(
366 scalarShape->GetStorageShape().GetShapeSize() != 1,380 scalarShape->GetStorageShape().GetShapeSize() != 1,
367- OP_LOGE(tilingContext->GetNodeName(), "The scalar elements must be 1."), return ge::GRAPH_FAILED);381+ OP_LOGE_FOR_INVALID_SHAPESIZE(
382+ tilingContext->GetNodeName(), "scalar",
383+ std::to_string(scalarShape->GetStorageShape().GetShapeSize()).c_str(), "1"),
384+ return ge::GRAPH_FAILED);
368 // check max dim385 // check max dim
369 OP_CHECK_IF(386 OP_CHECK_IF(
370 scalarShape->GetStorageShape().GetDimNum() > MAX_SUPPORT_DIMS_NUMS,387 scalarShape->GetStorageShape().GetDimNum() > MAX_SUPPORT_DIMS_NUMS,
371- OP_LOGE(388+ OP_LOGE_FOR_INVALID_SHAPEDIM(
372- tilingContext->GetNodeName(),389+ tilingContext->GetNodeName(), "scalar",
373- "The scalar shape is invalid, and it cannot be larger than %zu dimensions.",390+ std::to_string(scalarShape->GetStorageShape().GetDimNum()).c_str(),
374- static_cast<size_t>(MAX_SUPPORT_DIMS_NUMS)),391+ "less than or equal to 8"),
375 return ge::GRAPH_FAILED);392 return ge::GRAPH_FAILED);
376 return ge::GRAPH_SUCCESS;393 return ge::GRAPH_SUCCESS;
377 }394 }
@@ -388,16 +405,17 @@ private:
388 return ge::GRAPH_FAILED);405 return ge::GRAPH_FAILED);
389 OP_CHECK_IF(406 OP_CHECK_IF(
390 scalarsShape->GetStorageShape().GetDimNum() > MAX_SUPPORT_DIMS_NUMS,407 scalarsShape->GetStorageShape().GetDimNum() > MAX_SUPPORT_DIMS_NUMS,
391- OP_LOGE(408+ OP_LOGE_FOR_INVALID_SHAPEDIM(
392- tilingContext->GetNodeName(),409+ tilingContext->GetNodeName(), "scalars",
393- "The scalars shape is invalid, and it cannot be larger than %zu dimensions.",410+ std::to_string(scalarsShape->GetStorageShape().GetDimNum()).c_str(),
394- static_cast<size_t>(MAX_SUPPORT_DIMS_NUMS)),411+ "less than or equal to 8"),
395 return ge::GRAPH_FAILED);412 return ge::GRAPH_FAILED);
396 OP_CHECK_IF(413 OP_CHECK_IF(
397 scalarsShape->GetStorageShape().GetShapeSize() != totalTensorCount,414 scalarsShape->GetStorageShape().GetShapeSize() != totalTensorCount,
398- OP_LOGE(415+ OP_LOGE_FOR_INVALID_SHAPESIZE(
399- tilingContext->GetNodeName(), "The scalars count must equal to tensor count %hu, but got %ld.",416+ tilingContext->GetNodeName(), "scalars",
400- totalTensorCount, scalarsShape->GetStorageShape().GetShapeSize()),417+ std::to_string(scalarsShape->GetStorageShape().GetShapeSize()).c_str(),
418+ (std::to_string(totalTensorCount)).c_str()),
401 return ge::GRAPH_FAILED);419 return ge::GRAPH_FAILED);
402 return ge::GRAPH_SUCCESS;420 return ge::GRAPH_SUCCESS;
403 }421 }
@@ -423,22 +441,27 @@ private:
423 // check max dim441 // check max dim
424 OP_CHECK_IF(442 OP_CHECK_IF(
425 x1Shape->GetStorageShape().GetDimNum() > MAX_SUPPORT_DIMS_NUMS,443 x1Shape->GetStorageShape().GetDimNum() > MAX_SUPPORT_DIMS_NUMS,
426- OP_LOGE(444+ OP_LOGE_FOR_INVALID_SHAPEDIM(
427- tilingContext->GetNodeName(),445+ tilingContext->GetNodeName(), "x/x1",
428- "The input %lu shape is invalid, and it cannot be larger than %zu dimensions.", inputIndexZero,446+ std::to_string(x1Shape->GetStorageShape().GetDimNum()).c_str(),
429- static_cast<size_t>(MAX_SUPPORT_DIMS_NUMS)),447+ "less than or equal to 8"),
430 return ge::GRAPH_FAILED);448 return ge::GRAPH_FAILED);
431 449 
432- // checke tensorlist input shape consistent450+ // check tensorlist input shape consistent
433 for (size_t listId = static_cast<size_t>(inputIndexZero) + 1U;451 for (size_t listId = static_cast<size_t>(inputIndexZero) + 1U;
434 listId < static_cast<size_t>(inputTensorsNum); ++listId) {452 listId < static_cast<size_t>(inputTensorsNum); ++listId) {
435- OP_CHECK_IF(453+ if (x1Shape->GetStorageShape() !=
436- x1Shape->GetStorageShape() !=454+ tilingContext->GetDynamicInputShape(listId, tensorIndex)->GetStorageShape()) {
437- tilingContext->GetDynamicInputShape(listId, tensorIndex)->GetStorageShape(),455+ std::string errMsg = Ops::Base::ToString(
438- OP_LOGE(456+ tilingContext->GetDynamicInputShape(listId, tensorIndex)->GetStorageShape());
439- tilingContext->GetNodeName(), "The input %lu shape should be same with input %lu.", listId,457+ std::string reasonMsg = "The shapes of " + std::to_string(tensorIndex) +
440- inputIndexZero),458+ "th tensor in tensor list input " + std::to_string(listId) + " and input " +
441- return ge::GRAPH_FAILED);459+ std::to_string(inputIndexZero) + " must be the same";
460+ OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(
461+ tilingContext->GetNodeName(), ("input " + std::to_string(listId)).c_str(), errMsg.c_str(),
462+ reasonMsg.c_str());
463+ return ge::GRAPH_FAILED;
464+ }
442 }465 }
443 }466 }
444 return ge::GRAPH_SUCCESS;467 return ge::GRAPH_SUCCESS;
@@ -471,13 +494,17 @@ private:
471 tempAnchorInstanceInfo == nullptr,494 tempAnchorInstanceInfo == nullptr,
472 OP_LOGE(tilingContext->GetNodeName(), "GetInputInstanceInfo failed."), return ge::GRAPH_FAILED);495 OP_LOGE(tilingContext->GetNodeName(), "GetInputInstanceInfo failed."), return ge::GRAPH_FAILED);
473 size_t otherSize = tempAnchorInstanceInfo->GetInstanceNum();496 size_t otherSize = tempAnchorInstanceInfo->GetInstanceNum();
474- OP_CHECK_IF(497+ if (otherSize != xSize){
475- otherSize != xSize,498+ std::string otherName = "x" + std::to_string(i + 1);
476- OP_LOGE(499+ std::string paramName = "x1 and "+ otherName;
477- tilingContext->GetNodeName(),500+ std::string errMsg = std::to_string(xSize) + " and " + std::to_string(otherSize);
478- "The number of input tensors [%lu] should be same with input tensors [0], expect: %lu, actual: %lu",501+ std::string reasonMsg = "The tensorNums of dynamic input tensor lists x1 and " + otherName + " must be the same";
479- i, xSize, otherSize),502+ OP_LOGE_FOR_INVALID_TENSORNUMS_WITH_REASON(
480- return ge::GRAPH_FAILED);503+ tilingContext->GetNodeName(), paramName,
504+ errMsg.c_str(),
505+ reasonMsg.c_str());
506+ return ge::GRAPH_FAILED;
507+ }
481 }508 }
482 return ge::GRAPH_SUCCESS;509 return ge::GRAPH_SUCCESS;
483 }510 }
@@ -557,11 +584,13 @@ private:
557 if (dataType == ge::DT_UNDEFINED) {584 if (dataType == ge::DT_UNDEFINED) {
558 return ge::GRAPH_FAILED;585 return ge::GRAPH_FAILED;
559 } else if (dataType != checkDtype) {586 } else if (dataType != checkDtype) {
560- OP_LOGE(587+ std::string paramName = "x" + std::to_string(i + 1);
561- tilingContext->GetNodeName(),588+ OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(
562- "DataType of all input should be same. The tensor %u of input %lu datatype is not same with "589+ tilingContext->GetNodeName(), paramName.c_str(),
563- "other input.",590+ ge::TypeUtils::DataTypeToSerialString(checkDtype).c_str(),
564- j, i);591+ ("The dtypes of all tensors in the tensor list must be the same. "
592+ "Currently, the dtype of the " + std::to_string(j) + "th tensor is inconsistent with that (" +
593+ ge::TypeUtils::DataTypeToSerialString(dataType) + ") of other tensors").c_str());
565 return ge::GRAPH_FAILED;594 return ge::GRAPH_FAILED;
566 }595 }
567 }596 }
@@ -46,9 +46,9 @@ ge::graphStatus EmbeddingHashTableApplyAdamWTiling::GetShapeAttrsInfo() {
46 auto const keyShapeVal = keyShape->GetStorageShape();46 auto const keyShapeVal = keyShape->GetStorageShape();
47 int64_t keyShapeSize = keyShapeVal.GetShapeSize();47 int64_t keyShapeSize = keyShapeVal.GetShapeSize();
48 OP_CHECK_IF((keyShapeSize < 0) || (keyShapeSize > MAX_UINT32),48 OP_CHECK_IF((keyShapeSize < 0) || (keyShapeSize > MAX_UINT32),
49- OP_LOGE_FOR_INVALID_SHAPESIZE(opName, "keys",49+ OP_LOGE_FOR_INVALID_SHAPESIZE_WITH_REASON(opName, "keys",
50 std::to_string(keyShapeSize).c_str(),50 std::to_string(keyShapeSize).c_str(),
51- "keys's shape exceeds the representable range of the uint32_t type."),51+ "The shape size of keys must in the representable range of the uint32_t type"),
52 return ge::GRAPH_FAILED);52 return ge::GRAPH_FAILED);
53 keyNum_ = static_cast<uint32_t>(keyShapeSize);53 keyNum_ = static_cast<uint32_t>(keyShapeSize);
54 54 
@@ -36,7 +36,7 @@ graphStatus CheckEmbeddingHashTableExportParams(
36 const gert::InferShapeContext* context, int64_t numTable, int64_t numEmbeddingDim)36 const gert::InferShapeContext* context, int64_t numTable, int64_t numEmbeddingDim)
37{37{
38 if (numTable < 0) {38 if (numTable < 0) {
39- std::string errMsg = "numTable must be greater than or equal to 0";39+ std::string errMsg = "The shape size of table_sizes must be greater than or equal to 0";
40 OP_LOGE_FOR_INVALID_SHAPESIZE_WITH_REASON(40 OP_LOGE_FOR_INVALID_SHAPESIZE_WITH_REASON(
41 context->GetNodeName(), "table_sizes", std::to_string(numTable).c_str(), errMsg.c_str());41 context->GetNodeName(), "table_sizes", std::to_string(numTable).c_str(), errMsg.c_str());
42 return GRAPH_FAILED;42 return GRAPH_FAILED;
@@ -140,8 +140,8 @@ ge::graphStatus InferDataType4EmbeddingHashTableImport(gert::InferDataTypeContex
140 for (uint32_t i = 0; i < countersInfo->GetInstanceNum(); i++) {140 for (uint32_t i = 0; i < countersInfo->GetInstanceNum(); i++) {
141 auto countersDtype = context->GetDynamicInputDataType(COUNTERS_IDX, i);141 auto countersDtype = context->GetDynamicInputDataType(COUNTERS_IDX, i);
142 if(countersDtype != DT_UINT64){142 if(countersDtype != DT_UINT64){
143- std::string errMsg = "The datatype of " + std::to_string(i) +143+ std::string errMsg = "The dtype of " + std::to_string(i) +
144- "th counters must be same as uint64";144+ "th tensor in tensor list counters must be uint64";
145 OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(145 OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(
146 context->GetNodeName(), "counters", ge::TypeUtils::DataTypeToSerialString(countersDtype).c_str(),146 context->GetNodeName(), "counters", ge::TypeUtils::DataTypeToSerialString(countersDtype).c_str(),
147 errMsg.c_str());147 errMsg.c_str());
@@ -152,8 +152,8 @@ ge::graphStatus InferDataType4EmbeddingHashTableImport(gert::InferDataTypeContex
152 for (uint32_t i = 0; i < filterFlagsInfo->GetInstanceNum(); i++) {152 for (uint32_t i = 0; i < filterFlagsInfo->GetInstanceNum(); i++) {
153 auto filterFlagsDtype = context->GetDynamicInputDataType(FILTER_FLAGS_IDX, i);153 auto filterFlagsDtype = context->GetDynamicInputDataType(FILTER_FLAGS_IDX, i);
154 if (filterFlagsDtype != DT_UINT8) {154 if (filterFlagsDtype != DT_UINT8) {
155- std::string errMsg = "The datatype of " + std::to_string(i) +155+ std::string errMsg = "The dtype of " + std::to_string(i) +
156- "th filter_flags must be same as uint8";156+ "th tensor in tensor list filter_flags must be uint8";
157 OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(157 OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(
158 context->GetNodeName(), "filter_flags", ge::TypeUtils::DataTypeToSerialString(filterFlagsDtype).c_str(),158 context->GetNodeName(), "filter_flags", ge::TypeUtils::DataTypeToSerialString(filterFlagsDtype).c_str(),
159 errMsg.c_str());159 errMsg.c_str());
@@ -165,8 +165,8 @@ ge::graphStatus InferDataType4EmbeddingHashTableImport(gert::InferDataTypeContex
165 for (uint32_t i = 0; i < valuesInfo->GetInstanceNum(); i++) {165 for (uint32_t i = 0; i < valuesInfo->GetInstanceNum(); i++) {
166 auto valuesDtype = context->GetDynamicInputDataType(VALUES_IDX, i);166 auto valuesDtype = context->GetDynamicInputDataType(VALUES_IDX, i);
167 if (valuesDtype != DT_FLOAT) {167 if (valuesDtype != DT_FLOAT) {
168- std::string errMsg = "The datatype of " + std::to_string(i) +168+ std::string errMsg = "The dtype of " + std::to_string(i) +
169- "th values must be same as float";169+ "th tensor in tensor list values must be float";
170 OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(170 OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(
171 context->GetNodeName(), "values", ge::TypeUtils::DataTypeToSerialString(valuesDtype).c_str(),171 context->GetNodeName(), "values", ge::TypeUtils::DataTypeToSerialString(valuesDtype).c_str(),
172 errMsg.c_str());172 errMsg.c_str());
@@ -141,12 +141,11 @@ static ge::graphStatus TilingPrepare4InitEmbeddingHashTable(gert::TilingParseCon
141 auto platformInfo = context->GetPlatformInfo();141 auto platformInfo = context->GetPlatformInfo();
142 auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo);142 auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo);
143 compileInfo->coreNum = ascendcPlatform.GetCoreNumAiv();143 compileInfo->coreNum = ascendcPlatform.GetCoreNumAiv();
144- OP_CHECK_IF((compileInfo->coreNum <= 0), OP_LOGE(context->GetNodeName(), "The core num is invaild."), return ge::GRAPH_FAILED);144+ OP_CHECK_IF((compileInfo->coreNum <= 0), OP_LOGE(context->GetNodeName(), "The core num is invalid."), return ge::GRAPH_FAILED);
145 compileInfo->maxThread = GetSimtMaxThreadNum(context);145 compileInfo->maxThread = GetSimtMaxThreadNum(context);
146- OP_CHECK_IF((compileInfo->maxThread <= 0), OP_LOGE(context->GetNodeName(), "The Thread num is invaild."), return ge::GRAPH_FAILED);146+ OP_CHECK_IF((compileInfo->maxThread <= 0), OP_LOGE(context->GetNodeName(), "The Thread num is invalid."), return ge::GRAPH_FAILED);
147 return ge::GRAPH_SUCCESS;147 return ge::GRAPH_SUCCESS;
148}148}
149- 
150IMPL_OP_OPTILING(InitEmbeddingHashTable)149IMPL_OP_OPTILING(InitEmbeddingHashTable)
151 .Tiling(Tiling4InitEmbeddingHashTable)150 .Tiling(Tiling4InitEmbeddingHashTable)
152 .TilingParse<InitEmbeddingHashTableCompileInfo>(TilingPrepare4InitEmbeddingHashTable);151 .TilingParse<InitEmbeddingHashTableCompileInfo>(TilingPrepare4InitEmbeddingHashTable);
@@ -64,7 +64,7 @@ static ge::graphStatus InferShapeForCrossEntropyLoss(gert::InferShapeContext* co
64 64 
65 if(inputShape->GetDim(DIM_0) != UNKNOWN_DIM && targetShape->GetDim(DIM_0) != UNKNOWN_DIM && inputShape->GetDim(DIM_0) != targetShape->GetDim(DIM_0)){65 if(inputShape->GetDim(DIM_0) != UNKNOWN_DIM && targetShape->GetDim(DIM_0) != UNKNOWN_DIM && inputShape->GetDim(DIM_0) != targetShape->GetDim(DIM_0)){
66 std::string shapeMsg = Ops::Base::ToString(*inputShape) + " and " + Ops::Base::ToString(*targetShape);66 std::string shapeMsg = Ops::Base::ToString(*inputShape) + " and " + Ops::Base::ToString(*targetShape);
67- std::string errMsg = "The dim 0 of input and target should be the same";67+ std::string errMsg = "The dim 0 of input and target must be the same";
68 OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(68 OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(
69 context->GetNodeName(), "input and target", shapeMsg.c_str(), errMsg.c_str());69 context->GetNodeName(), "input and target", shapeMsg.c_str(), errMsg.c_str());
70 return ge::GRAPH_FAILED;70 return ge::GRAPH_FAILED;
@@ -82,7 +82,7 @@ static ge::graphStatus InferShapeForCrossEntropyLoss(gert::InferShapeContext* co
82 if (inputShape->GetDim(DIM_1) != UNKNOWN_DIM && weightShape->GetDim(DIM_0) != UNKNOWN_DIM &&82 if (inputShape->GetDim(DIM_1) != UNKNOWN_DIM && weightShape->GetDim(DIM_0) != UNKNOWN_DIM &&
83 inputShape->GetDim(DIM_1) != weightShape->GetDim(DIM_0)) {83 inputShape->GetDim(DIM_1) != weightShape->GetDim(DIM_0)) {
84 std::string shapeMsg = Ops::Base::ToString(*inputShape) + " and " + Ops::Base::ToString(*targetShape);84 std::string shapeMsg = Ops::Base::ToString(*inputShape) + " and " + Ops::Base::ToString(*targetShape);
85- std::string errMsg = "The dim 1 of input and the dim 0 of weight should be the same";85+ std::string errMsg = "The dim 1 of input and the dim 0 of weight must be the same";
86 OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(86 OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(
87 context->GetNodeName(), "input and weight", shapeMsg.c_str(), errMsg.c_str());87 context->GetNodeName(), "input and weight", shapeMsg.c_str(), errMsg.c_str());
88 return ge::GRAPH_FAILED;88 return ge::GRAPH_FAILED;
@@ -299,7 +299,7 @@ static ge::graphStatus CheckInputDtype(gert::TilingContext* context)
299 OP_CHECK_IF(299 OP_CHECK_IF(
300 !validDtype,300 !validDtype,
301 OP_LOGE_FOR_INVALID_DTYPE(301 OP_LOGE_FOR_INVALID_DTYPE(
302- context->GetNodeName(), "x",302+ context->GetNodeName(), "input",
303 ge::TypeUtils::DataTypeToSerialString(inputDtype).c_str(),303 ge::TypeUtils::DataTypeToSerialString(inputDtype).c_str(),
304 "BF16, FLOAT or FLOAT16"),304 "BF16, FLOAT or FLOAT16"),
305 return ge::GRAPH_FAILED);305 return ge::GRAPH_FAILED);
@@ -265,7 +265,7 @@ ge::graphStatus CrossEntropyLossRegbaseTiling::CheckInputShape()
265 OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(265 OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(
266 context_->GetNodeName(), "x",266 context_->GetNodeName(), "x",
267 (std::to_string(inputShape.GetDim(DIM_0)) + ", " + std::to_string(inputShape.GetDim(DIM_1))).c_str(),267 (std::to_string(inputShape.GetDim(DIM_0)) + ", " + std::to_string(inputShape.GetDim(DIM_1))).c_str(),
268- "The C-dimension of x can not be zero, when the N-dimension of x is not zero, where N is the 0th axis and "268+ "The C-dimension of x cannot be zero, when the N-dimension of x is not zero, where N is the 0th axis and "
269 "C is the 1st axis"),269 "C is the 1st axis"),
270 return ge::GRAPH_FAILED);270 return ge::GRAPH_FAILED);
271 auto target = context_->GetInputShape(INPUT_TARGET_IDX);271 auto target = context_->GetInputShape(INPUT_TARGET_IDX);
@@ -294,7 +294,7 @@ ge::graphStatus CrossEntropyLossRegbaseTiling::CheckInputShape()
294 OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(294 OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(
295 context_->GetNodeName(), "x and weight",295 context_->GetNodeName(), "x and weight",
296 (std::to_string(inputShape.GetDim(DIM_1)) + " and " + std::to_string(weightShape.GetDim(0))).c_str(),296 (std::to_string(inputShape.GetDim(DIM_1)) + " and " + std::to_string(weightShape.GetDim(0))).c_str(),
297- "The dim 1 of input should be the same as the shape size of weight."),297+ "The dim 1 of input should be the same as the shape size of weight"),
298 return ge::GRAPH_FAILED);298 return ge::GRAPH_FAILED);
299 }299 }
300 return ge::GRAPH_SUCCESS;300 return ge::GRAPH_SUCCESS;
@@ -66,7 +66,7 @@ static graphStatus InferShape4CrossEntropyLossGrad(gert::InferShapeContext* cont
66 OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(66 OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(
67 context->GetNodeName(), "log_prob and target",67 context->GetNodeName(), "log_prob and target",
68 (Ops::Base::ToString(*logProbShape) + " and " + Ops::Base::ToString(*targetShape)).c_str(),68 (Ops::Base::ToString(*logProbShape) + " and " + Ops::Base::ToString(*targetShape)).c_str(),
69- "The dim 0 of log_prob and target must be the same"),69+ "The dim 0 of log_prob and that of target must be the same"),
70 return ge::GRAPH_FAILED);70 return ge::GRAPH_FAILED);
71 }71 }
72 72 
@@ -469,7 +469,7 @@ ge::graphStatus CrossEntropyLossGradRegbaseTiling::CheckDtype() {
469 OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON(469 OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON(
470 tilingContext->GetNodeName(), "log_prob and grad_loss",470 tilingContext->GetNodeName(), "log_prob and grad_loss",
471 (ge::TypeUtils::DataTypeToSerialString(dataType) + " and " + ge::TypeUtils::DataTypeToSerialString(gradLossDataType)).c_str(),471 (ge::TypeUtils::DataTypeToSerialString(dataType) + " and " + ge::TypeUtils::DataTypeToSerialString(gradLossDataType)).c_str(),
472- "datatype of grad_loss and log_prob should be the same"),472+ "The dtypes of grad_loss and log_prob must be the same"),
473 return ge::GRAPH_FAILED);473 return ge::GRAPH_FAILED);
474 474 
475 auto weightDesc = tilingContext->GetOptionalInputDesc(INPUT_WEIGHT_IDX);475 auto weightDesc = tilingContext->GetOptionalInputDesc(INPUT_WEIGHT_IDX);