已合并
修改loge日志内容 #4471
tianqiguang创建于 4月30日
修改loge日志内容 #4471
已合并
共 13 个文件变更+140-99
| @@ -66,7 +66,7 @@ ge::graphStatus TilingForEmbeddingHashTableExport(gert::TilingContext *context) | |||
| 66 | OP_LOGE_FOR_INVALID_SHAPESIZES_WITH_REASON(context->GetNodeName(), | 66 | OP_LOGE_FOR_INVALID_SHAPESIZES_WITH_REASON(context->GetNodeName(), |
| 67 | "table_handles, table_sizes, embedding_dims and bucket_sizes", | 67 | "table_handles, table_sizes, embedding_dims and bucket_sizes", |
| 68 | shapeSizeMsg.c_str(), | 68 | shapeSizeMsg.c_str(), |
| 69 | - "The shapeSizes of table_handles, table_sizes, embedding_dims and bucket_sizes should be the same."); | 69 | + "The shape sizes of table_handles, table_sizes, embedding_dims and bucket_sizes must be the same"); |
| 70 | return ge::GRAPH_FAILED; | 70 | return ge::GRAPH_FAILED; |
| 71 | } | 71 | } |
| 72 | 72 | ||
| @@ -265,7 +265,8 @@ 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 | - "When the N dimension(first dimension) of x is NOT zero, the C dimension(second dimension) of x cann't be zero"), | 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 " |
| 269 | + "C is the 1st axis"), | ||
| 269 | return ge::GRAPH_FAILED); | 270 | return ge::GRAPH_FAILED); |
| 270 | auto target = context_->GetInputShape(INPUT_TARGET_IDX); | 271 | auto target = context_->GetInputShape(INPUT_TARGET_IDX); |
| 271 | OP_CHECK_NULL_WITH_CONTEXT(context_, target); | 272 | OP_CHECK_NULL_WITH_CONTEXT(context_, target); |
| @@ -226,22 +226,26 @@ static ge::graphStatus GetTilingInput(gert::TilingContext* context, uint64_t& we | |||
| 226 | const gert::StorageShape* targetShape = context->GetInputShape(INPUT_TARGET_IDX); | 226 | const gert::StorageShape* targetShape = context->GetInputShape(INPUT_TARGET_IDX); |
| 227 | OP_CHECK_NULL_WITH_CONTEXT(context, targetShape); | 227 | OP_CHECK_NULL_WITH_CONTEXT(context, targetShape); |
| 228 | 228 | ||
| 229 | - OP_CHECK_IF((targetShape->GetStorageShape().GetDim(0) != logProbShape->GetStorageShape().GetDim(0)), | 229 | + OP_CHECK_IF( |
| 230 | - OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( | 230 | + (targetShape->GetStorageShape().GetDim(0) != logProbShape->GetStorageShape().GetDim(0)), |
| 231 | - context->GetNodeName(), "log_prob and target", | 231 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( |
| 232 | - (std::to_string(logProbShape->GetStorageShape().GetDim(0)) + " and " + std::to_string(targetShape->GetStorageShape().GetDim(0))).c_str(), | 232 | + context->GetNodeName(), "log_prob and target", |
| 233 | - "The dim 0 of logProb should be equal to the shape size of target"), | 233 | + (std::to_string(logProbShape->GetStorageShape().GetDim(0)) + " and " + |
| 234 | - return ge::GRAPH_FAILED); | 234 | + std::to_string(targetShape->GetStorageShape().GetDim(0))).c_str(), |
| 235 | + "The dim 0 of log_prob must be equal to the shape size of target"), | ||
| 236 | + return ge::GRAPH_FAILED); | ||
| 235 | 237 | ||
| 236 | auto weightTensor = context->GetOptionalInputTensor(INPUT_WEIGHT_IDX); | 238 | auto weightTensor = context->GetOptionalInputTensor(INPUT_WEIGHT_IDX); |
| 237 | if (weightTensor != nullptr) { | 239 | if (weightTensor != nullptr) { |
| 238 | - auto weightShape = weightTensor->GetStorageShape(); | 240 | + auto weightShape = weightTensor->GetStorageShape(); |
| 239 | - OP_CHECK_IF((weightShape.GetDim(0) != logProbShape->GetStorageShape().GetDim(1)), | 241 | + OP_CHECK_IF( |
| 240 | - OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( | 242 | + (weightShape.GetDim(0) != logProbShape->GetStorageShape().GetDim(1)), |
| 241 | - context->GetNodeName(), "log_prob and weight", | 243 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( |
| 242 | - (std::to_string(logProbShape->GetStorageShape().GetDim(1)) + " and " + std::to_string(weightShape.GetDim(0))).c_str(), | 244 | + context->GetNodeName(), "log_prob and weight", |
| 243 | - "The dim 1 of logProb should be equal to the shape size of weight"), | 245 | + (std::to_string(logProbShape->GetStorageShape().GetDim(1)) + " and " + |
| 244 | - return ge::GRAPH_FAILED); | 246 | + std::to_string(weightShape.GetDim(0))).c_str(), |
| 247 | + "The dim 1 of log_prob must be equal to the shape size of weight"), | ||
| 248 | + return ge::GRAPH_FAILED); | ||
| 245 | } | 249 | } |
| 246 | weightKey = (weightTensor == nullptr) ? 0 : 1; | 250 | weightKey = (weightTensor == nullptr) ? 0 : 1; |
| 247 | 251 | ||
| @@ -354,28 +354,33 @@ ge::graphStatus CrossEntropyLossGradRegbaseTiling::GetTilingInput() { | |||
| 354 | return ge::GRAPH_FAILED); | 354 | return ge::GRAPH_FAILED); |
| 355 | } | 355 | } |
| 356 | 356 | ||
| 357 | - OP_CHECK_IF((targetStrorageShape.GetDimNum() != 1 || targetStrorageShape.GetDim(0) != logProbStrorageShape.GetDim(0)), | 357 | + OP_CHECK_IF( |
| 358 | - OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( | 358 | + (targetStrorageShape.GetDimNum() != 1 || targetStrorageShape.GetDim(0) != logProbStrorageShape.GetDim(0)), |
| 359 | - tilingContext->GetNodeName(), "log_prob and target", | 359 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( |
| 360 | - (std::to_string(logProbStrorageShape.GetDim(0)) + " and " + std::to_string(targetStrorageShape.GetDim(0))).c_str(), | 360 | + tilingContext->GetNodeName(), "log_prob and target", |
| 361 | - "The dim 0 of target and log_prob should be the same and the dim num of target should be 1"), | 361 | + (std::to_string(logProbStrorageShape.GetDim(0)) + " and " + std::to_string(targetStrorageShape.GetDim(0))) |
| 362 | - return ge::GRAPH_FAILED); | 362 | + .c_str(), |
| 363 | + "The shape of parameter target must be 1D, and the 0th dimension of target must be equal to the same axis " | ||
| 364 | + "of parameter log_prob"), | ||
| 365 | + return ge::GRAPH_FAILED); | ||
| 363 | 366 | ||
| 364 | auto weightTensor = tilingContext->GetOptionalInputTensor(INPUT_WEIGHT_IDX); | 367 | auto weightTensor = tilingContext->GetOptionalInputTensor(INPUT_WEIGHT_IDX); |
| 365 | if (weightTensor != nullptr) { | 368 | if (weightTensor != nullptr) { |
| 366 | ceLossGradTilingKey.isWeight = TILING_KEY_TRUE; | 369 | ceLossGradTilingKey.isWeight = TILING_KEY_TRUE; |
| 367 | auto weightShape = EnsureNotScalar4CELoss(weightTensor->GetStorageShape()); | 370 | auto weightShape = EnsureNotScalar4CELoss(weightTensor->GetStorageShape()); |
| 368 | - OP_CHECK_IF((weightShape.GetDimNum() != 1), | 371 | + OP_CHECK_IF( |
| 369 | - OP_LOGE_FOR_INVALID_SHAPEDIM( | 372 | + (weightShape.GetDimNum() != 1), |
| 370 | - tilingContext->GetNodeName(), "weight", | 373 | + OP_LOGE_FOR_INVALID_SHAPEDIM( |
| 371 | - std::to_string(weightShape.GetDimNum()).c_str(), "1D"), | 374 | + tilingContext->GetNodeName(), "weight", std::to_string(weightShape.GetDimNum()).c_str(), "1D"), |
| 372 | - return ge::GRAPH_FAILED); | 375 | + return ge::GRAPH_FAILED); |
| 373 | - OP_CHECK_IF((weightShape.GetDim(0) != logProbShape->GetStorageShape().GetDim(1)), | 376 | + OP_CHECK_IF( |
| 374 | - OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( | 377 | + (weightShape.GetDim(0) != logProbShape->GetStorageShape().GetDim(1)), |
| 375 | - tilingContext->GetNodeName(), "log_prob and weight", | 378 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( |
| 376 | - (std::to_string(logProbShape->GetStorageShape().GetDim(1)) + " and " + std::to_string(weightShape.GetDim(0))).c_str(), | 379 | + tilingContext->GetNodeName(), "log_prob and weight", |
| 377 | - "The dim 1 of logProb should be the same as the shape size of weight"), | 380 | + (std::to_string(logProbShape->GetStorageShape().GetDim(1)) + " and " + |
| 378 | - return ge::GRAPH_FAILED); | 381 | + std::to_string(weightShape.GetDim(0))).c_str(), |
| 382 | + "The dim 1 of log_prob must be the same as the shape size of weight"), | ||
| 383 | + return ge::GRAPH_FAILED); | ||
| 379 | } | 384 | } |
| 380 | rowVal = logProbShape->GetStorageShape().GetDim(0); | 385 | rowVal = logProbShape->GetStorageShape().GetDim(0); |
| 381 | colVal = logProbShape->GetStorageShape().GetDim(1); | 386 | colVal = logProbShape->GetStorageShape().GetDim(1); |
| @@ -246,13 +246,13 @@ bool AddLayerNormQuantRegbaseTiling::GetAttrs() | |||
| 246 | this->divMode_ = GetOptionalAttr<bool>(attrs, DIV_MODE_IDX, true); | 246 | this->divMode_ = GetOptionalAttr<bool>(attrs, DIV_MODE_IDX, true); |
| 247 | 247 | ||
| 248 | OP_CHECK_IF( | 248 | OP_CHECK_IF( |
| 249 | - this->eps_ <= 0, OP_LOGE_FOR_INVALID_VALUE_WITH_REASON(context_->GetNodeName(), "epsilon", | 249 | + this->eps_ <= 0, OP_LOGE_FOR_INVALID_VALUE(context_->GetNodeName(), "epsilon", |
| 250 | - std::to_string(this->eps_).c_str(), "epsilon should be greater than zero"), | 250 | + std::to_string(this->eps_).c_str(), "greater than zero"), |
| 251 | return false); | 251 | return false); |
| 252 | OP_CHECK_IF( | 252 | OP_CHECK_IF( |
| 253 | ((quantModeStr != "dynamic") && (quantModeStr != "static")), | 253 | ((quantModeStr != "dynamic") && (quantModeStr != "static")), |
| 254 | - OP_LOGE_FOR_INVALID_VALUE_WITH_REASON(context_->GetNodeName(), "quantMode", | 254 | + OP_LOGE_FOR_INVALID_VALUE(context_->GetNodeName(), "quant_mode", |
| 255 | - quantModeStr.c_str(), "quantMode should be 'dynamic' or 'static'"), | 255 | + quantModeStr.c_str(), "'dynamic' or 'static'"), |
| 256 | return false); | 256 | return false); |
| 257 | 257 | ||
| 258 | OP_LOGW( | 258 | OP_LOGW( |
| @@ -738,7 +738,8 @@ bool AddLayerNormQuantRegbaseTiling::CheckOptionalTensor() | |||
| 738 | context_->GetNodeName(), "outScale1 and x1", | 738 | context_->GetNodeName(), "outScale1 and x1", |
| 739 | (Ops::Base::ToString(outScale1Shape->GetStorageShape()) + " and " + | 739 | (Ops::Base::ToString(outScale1Shape->GetStorageShape()) + " and " + |
| 740 | Ops::Base::ToString(x1Shape->GetStorageShape())).c_str(), | 740 | Ops::Base::ToString(x1Shape->GetStorageShape())).c_str(), |
| 741 | - ("The " + std::to_string(i) + "th the dimNum of outScale1 and x1 should be equal").c_str()), | 741 | + ("The shape of outScale1 must be the same as the shape consisting of the first " + |
| 742 | + std::to_string(outScaleDimNum) + " axes of x").c_str()), | ||
| 742 | return false); | 743 | return false); |
| 743 | } | 744 | } |
| 744 | } | 745 | } |
| @@ -282,7 +282,7 @@ static bool CheckInputOutputShape(const gert::TilingContext* context) | |||
| 282 | OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON( | 282 | OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON( |
| 283 | context->GetNodeName(), "rstd", | 283 | context->GetNodeName(), "rstd", |
| 284 | Ops::Base::ToString(rstd_shape->GetStorageShape()).c_str(), | 284 | Ops::Base::ToString(rstd_shape->GetStorageShape()).c_str(), |
| 285 | - ("The " + std::to_string(x1DimNum - 1 - i) + "th the dimNum of rstd should be 1").c_str()), | 285 | + ("The " + std::to_string(x1DimNum - 1 - i) + "th dimension of rstd must be 1").c_str()), |
| 286 | return false); | 286 | return false); |
| 287 | } | 287 | } |
| 288 | } else if (norm_key == PRE_RMS_NORM || norm_key == POST_RMS_NORM) { | 288 | } else if (norm_key == PRE_RMS_NORM || norm_key == POST_RMS_NORM) { |
| @@ -293,7 +293,7 @@ static bool CheckInputOutputShape(const gert::TilingContext* context) | |||
| 293 | context->GetNodeName(), "gamma and x1", | 293 | context->GetNodeName(), "gamma and x1", |
| 294 | (Ops::Base::ToString(gamma_shape->GetStorageShape()) + " and " + | 294 | (Ops::Base::ToString(gamma_shape->GetStorageShape()) + " and " + |
| 295 | Ops::Base::ToString(x1_shape->GetStorageShape())).c_str(), | 295 | Ops::Base::ToString(x1_shape->GetStorageShape())).c_str(), |
| 296 | - "The first dim of gamma should be 1 and the last dim of gamma and x1 should be the same"), | 296 | + "The first dim of gamma should be 1 and the last dim of gamma and x1 must be the same"), |
| 297 | return false); | 297 | return false); |
| 298 | } | 298 | } |
| 299 | return true; | 299 | return true; |
| @@ -342,15 +342,14 @@ bool AddRmsNormQuantRegbaseTiling::CheckInputDtype() | |||
| 342 | return false; | 342 | return false; |
| 343 | } | 343 | } |
| 344 | if ((x1Dtype != scales1Dtype) && (scales1Dtype != ge::DataType::DT_FLOAT)) { | 344 | if ((x1Dtype != scales1Dtype) && (scales1Dtype != ge::DataType::DT_FLOAT)) { |
| 345 | - OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON(nodeName.c_str(), "x1 and scales1", | 345 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(nodeName.c_str(), "scales1", Ops::Base::ToString(x1Dtype).c_str(), |
| 346 | - (Ops::Base::ToString(x1Dtype) + " and " + Ops::Base::ToString(scales1Dtype)).c_str(), | 346 | + "The dtype of scales1 must be fp32 when the dtype of x1 and scales1 are not the same"); |
| 347 | - "The dtypes of x1 and scales1 should be fp32"); | ||
| 348 | return false; | 347 | return false; |
| 349 | } | 348 | } |
| 350 | if (tilingParams.hasScales2 && (scales1Dtype != scales2Dtype)) { | 349 | if (tilingParams.hasScales2 && (scales1Dtype != scales2Dtype)) { |
| 351 | OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON(nodeName.c_str(), "scales1 and scales2", | 350 | OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON(nodeName.c_str(), "scales1 and scales2", |
| 352 | (Ops::Base::ToString(scales1Dtype) + " and " + Ops::Base::ToString(scales2Dtype)).c_str(), | 351 | (Ops::Base::ToString(scales1Dtype) + " and " + Ops::Base::ToString(scales2Dtype)).c_str(), |
| 353 | - "The dtypes of scales1 and scales2 should be the same when scales2 is existed"); | 352 | + "The dtypes of scales1 and scales2 should be the same when scales2 exists"); |
| 354 | return false; | 353 | return false; |
| 355 | } | 354 | } |
| 356 | // check support dtypes | 355 | // check support dtypes |
| @@ -363,8 +362,8 @@ bool AddRmsNormQuantRegbaseTiling::CheckInputDtype() | |||
| 363 | } | 362 | } |
| 364 | if (hasZeroPoints && zeroPointsDtype != ge::DataType::DT_FLOAT) { | 363 | if (hasZeroPoints && zeroPointsDtype != ge::DataType::DT_FLOAT) { |
| 365 | OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON( | 364 | OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON( |
| 366 | - context_->GetNodeName(), "zeroPoints", Ops::Base::ToString(zeroPointsDtype).c_str(), | 365 | + context_->GetNodeName(), "zero_points1 or zero_points2", Ops::Base::ToString(zeroPointsDtype).c_str(), |
| 367 | - "The dtype of zeroPoints should be fp32 when the dtype of x is fp32"); | 366 | + "The dtype of zero_points1 or zero_points2 should be fp32 when the dtype of x is fp32"); |
| 368 | return false; | 367 | return false; |
| 369 | } | 368 | } |
| 370 | } else if (x1Dtype == ge::DataType::DT_FLOAT16) { | 369 | } else if (x1Dtype == ge::DataType::DT_FLOAT16) { |
| @@ -372,15 +371,19 @@ bool AddRmsNormQuantRegbaseTiling::CheckInputDtype() | |||
| 372 | if (hasZeroPoints && zeroPointsDtype != ge::DataType::DT_FLOAT && | 371 | if (hasZeroPoints && zeroPointsDtype != ge::DataType::DT_FLOAT && |
| 373 | zeroPointsDtype != ge::DataType::DT_INT32) { | 372 | zeroPointsDtype != ge::DataType::DT_INT32) { |
| 374 | OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON( | 373 | OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON( |
| 375 | - context_->GetNodeName(), "zeroPoints", Ops::Base::ToString(zeroPointsDtype).c_str(), | 374 | + context_->GetNodeName(), "zero_points1 or zero_points2", |
| 376 | - "The dtype of zeroPoints should be fp32 or int32 when the dtype of x is fp16 and the dtype of scales1 is fp32"); | 375 | + Ops::Base::ToString(zeroPointsDtype).c_str(), |
| 376 | + "The dtype of zero_points1 or zero_points2 should be fp32 or int32 when the dtype of x is fp16 and " | ||
| 377 | + "the dtype of scales1 is fp32"); | ||
| 377 | return false; | 378 | return false; |
| 378 | } | 379 | } |
| 379 | } else if (scales1Dtype == ge::DataType::DT_FLOAT16) { | 380 | } else if (scales1Dtype == ge::DataType::DT_FLOAT16) { |
| 380 | if (hasZeroPoints && zeroPointsDtype != ge::DataType::DT_FLOAT16) { | 381 | if (hasZeroPoints && zeroPointsDtype != ge::DataType::DT_FLOAT16) { |
| 381 | OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON( | 382 | OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON( |
| 382 | - context_->GetNodeName(), "zeroPoints", Ops::Base::ToString(zeroPointsDtype).c_str(), | 383 | + context_->GetNodeName(), "zero_points1 or zero_points2", |
| 383 | - "The dtype of zeroPoints should be fp16 when the dtypes of x and scales1 is fp16"); | 384 | + Ops::Base::ToString(zeroPointsDtype).c_str(), |
| 385 | + "The dtype of zero_points1 or zero_points2 should be fp16 when the dtypes of x and scales1 are " | ||
| 386 | + "fp16"); | ||
| 384 | return false; | 387 | return false; |
| 385 | } | 388 | } |
| 386 | } else { | 389 | } else { |
| @@ -394,15 +397,19 @@ bool AddRmsNormQuantRegbaseTiling::CheckInputDtype() | |||
| 394 | if (hasZeroPoints && zeroPointsDtype != ge::DataType::DT_FLOAT && | 397 | if (hasZeroPoints && zeroPointsDtype != ge::DataType::DT_FLOAT && |
| 395 | zeroPointsDtype != ge::DataType::DT_INT32) { | 398 | zeroPointsDtype != ge::DataType::DT_INT32) { |
| 396 | OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON( | 399 | OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON( |
| 397 | - context_->GetNodeName(), "zeroPoints", Ops::Base::ToString(zeroPointsDtype).c_str(), | 400 | + context_->GetNodeName(), "zero_points1 or zero_points2", |
| 398 | - "The dtype of zeroPoints should be fp32 or int32 when the dtype of x is bf16 and the dtype of scales1 is fp32"); | 401 | + Ops::Base::ToString(zeroPointsDtype).c_str(), |
| 402 | + "The dtype of zero_points1 or zero_points2 should be fp32 or int32 when the dtype of x is bf16 and " | ||
| 403 | + "the dtype of scales1 is fp32"); | ||
| 399 | return false; | 404 | return false; |
| 400 | } | 405 | } |
| 401 | } else if (scales1Dtype == ge::DataType::DT_BF16) { | 406 | } else if (scales1Dtype == ge::DataType::DT_BF16) { |
| 402 | if (hasZeroPoints && zeroPointsDtype != ge::DataType::DT_BF16) { | 407 | if (hasZeroPoints && zeroPointsDtype != ge::DataType::DT_BF16) { |
| 403 | OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON( | 408 | OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON( |
| 404 | - context_->GetNodeName(), "zeroPoints", Ops::Base::ToString(zeroPointsDtype).c_str(), | 409 | + context_->GetNodeName(), "zero_points1 or zero_points2", |
| 405 | - "The dtype of zeroPoints should be bf16 when the dtypes of x and scales1 is bf16"); | 410 | + Ops::Base::ToString(zeroPointsDtype).c_str(), |
| 411 | + "The dtype of zero_points1 or zero_points2 should be bf16 when the dtypes of x and scales1 are " | ||
| 412 | + "bf16"); | ||
| 406 | return false; | 413 | return false; |
| 407 | } | 414 | } |
| 408 | } else { | 415 | } else { |
| @@ -229,7 +229,7 @@ ge::graphStatus BatchNormGradTilingBase::CheckBigShapesValid() | |||
| 229 | // 校验dim相等 | 229 | // 校验dim相等 |
| 230 | if (dyDimNum != xDimNum || dyDimNum != dxDimNum) { | 230 | if (dyDimNum != xDimNum || dyDimNum != dxDimNum) { |
| 231 | std::string dimsStr = std::to_string(dyDimNum) + ", " + std::to_string(xDimNum) + " and " + std::to_string(dxDimNum); | 231 | std::string dimsStr = std::to_string(dyDimNum) + ", " + std::to_string(xDimNum) + " and " + std::to_string(dxDimNum); |
| 232 | - std::string reasonMsg = "the dimNum of input Dy, x and output dx should be the same"; | 232 | + std::string reasonMsg = "The shape dims of input Dy, x and output dx must be the same"; |
| 233 | OP_LOGE_FOR_INVALID_SHAPEDIMS_WITH_REASON(context_->GetNodeName(), "y_backprop, x and x_backprop", | 233 | OP_LOGE_FOR_INVALID_SHAPEDIMS_WITH_REASON(context_->GetNodeName(), "y_backprop, x and x_backprop", |
| 234 | dimsStr.c_str(), reasonMsg.c_str()); | 234 | dimsStr.c_str(), reasonMsg.c_str()); |
| 235 | return ge::GRAPH_FAILED; | 235 | return ge::GRAPH_FAILED; |
| @@ -242,22 +242,24 @@ ge::graphStatus BatchNormGradTilingBase::CheckBigShapesValid() | |||
| 242 | ge::TypeUtils::FormatToSerialString(dxFormat); | 242 | ge::TypeUtils::FormatToSerialString(dxFormat); |
| 243 | OP_LOGE_FOR_INVALID_FORMATS_WITH_REASON(context_->GetNodeName(), "y_backprop, x and x_backprop", | 243 | OP_LOGE_FOR_INVALID_FORMATS_WITH_REASON(context_->GetNodeName(), "y_backprop, x and x_backprop", |
| 244 | formatsStr.c_str(), | 244 | formatsStr.c_str(), |
| 245 | - "the format of Input format, x and output x_backprop should be the same"); | 245 | + "the format of Input format, x and output x_backprop must be the same"); |
| 246 | return ge::GRAPH_FAILED; | 246 | return ge::GRAPH_FAILED; |
| 247 | } | 247 | } |
| 248 | 248 | ||
| 249 | if (dyFormat == ge::FORMAT_NCHW || dyFormat == ge::FORMAT_NHWC) { | 249 | if (dyFormat == ge::FORMAT_NCHW || dyFormat == ge::FORMAT_NHWC) { |
| 250 | if (dyDimNum != DIM_NUM_4) { | 250 | if (dyDimNum != DIM_NUM_4) { |
| 251 | - std::string reason = "the dimNum of y_backprop should be 4 with " + std::string(ge::TypeUtils::FormatToSerialString(dyFormat)) + " format"; | 251 | + std::string reason = "The shape dim of y_backprop must be 4 when the format of y_backprop is " + |
| 252 | - OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON(context_->GetNodeName(), "y_backprop", | 252 | + std::string(ge::TypeUtils::FormatToSerialString(dyFormat)); |
| 253 | - std::to_string(dyDimNum).c_str(), reason.c_str()); | 253 | + OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON( |
| 254 | + context_->GetNodeName(), "y_backprop", std::to_string(dyDimNum).c_str(), reason.c_str()); | ||
| 254 | return ge::GRAPH_FAILED; | 255 | return ge::GRAPH_FAILED; |
| 255 | } | 256 | } |
| 256 | } else if (dyFormat == ge::FORMAT_NCDHW || dyFormat == ge::FORMAT_NDHWC) { | 257 | } else if (dyFormat == ge::FORMAT_NCDHW || dyFormat == ge::FORMAT_NDHWC) { |
| 257 | if (dyDimNum != DIM_NUM_5) { | 258 | if (dyDimNum != DIM_NUM_5) { |
| 258 | - std::string reason = "the dimNum of y_backprop should be 5 with " + std::string(ge::TypeUtils::FormatToSerialString(dyFormat)) + " format"; | 259 | + std::string reason = "The shape dim of y_backprop must be 5 when the format of y_backprop is " + |
| 259 | - OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON(context_->GetNodeName(), "y_backprop", | 260 | + std::string(ge::TypeUtils::FormatToSerialString(dyFormat)); |
| 260 | - std::to_string(dyDimNum).c_str(), reason.c_str()); | 261 | + OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON( |
| 262 | + context_->GetNodeName(), "y_backprop", std::to_string(dyDimNum).c_str(), reason.c_str()); | ||
| 261 | return ge::GRAPH_FAILED; | 263 | return ge::GRAPH_FAILED; |
| 262 | } | 264 | } |
| 263 | } else { | 265 | } else { |
| @@ -238,18 +238,26 @@ ge::graphStatus BatchNormGradV3Base::CheckInputValid() | |||
| 238 | "(fp16, float, float), (bf16, float, float), (fp16, fp16, float) or (bf16, bf16, float)) combination " | 238 | "(fp16, float, float), (bf16, float, float), (fp16, fp16, float) or (bf16, bf16, float)) combination " |
| 239 | "range"), | 239 | "range"), |
| 240 | return ge::GRAPH_FAILED); | 240 | return ge::GRAPH_FAILED); |
| 241 | - | 241 | + OP_CHECK_IF(!(weightDimNum_ == runningVarDimNum_ && weightDimNum_ == 1), |
| 242 | - bool shapeValid = weightDimNum_ == runningVarDimNum_ && dyDimNum_ == dxDimNum_ && weightDimNum_ == 1 && | ||
| 243 | - weightDimLen_ == runningVarDimLen_ && weightDimLen_ == fusedALen_; | ||
| 244 | - | ||
| 245 | - OP_CHECK_IF( | ||
| 246 | - !shapeValid, | ||
| 247 | OP_LOGE_FOR_INVALID_SHAPEDIMS_WITH_REASON( | 242 | OP_LOGE_FOR_INVALID_SHAPEDIMS_WITH_REASON( |
| 248 | - context_->GetNodeName(), "dy, weight, running_var and dx", | 243 | + context_->GetNodeName(), "weight and running_var", |
| 249 | - (std::to_string(dyDimNum_) + ", " + std::to_string(weightDimNum_) + ", " + | 244 | + (std::to_string(weightDimNum_) + " and " + std::to_string(runningVarDimNum_)).c_str(), |
| 250 | - std::to_string(runningVarDimNum_) + ", " + std::to_string(dxDimNum_)).c_str(), | 245 | + "The Shapes of weight and running_var must be 1D"), |
| 251 | - "weight and running_var should be 1D, and dy and dx should have the same dim num; the first dim of weight " | 246 | + return ge::GRAPH_FAILED); |
| 252 | - "and running_var should be equal, and they also should be equal to the second dim of dy"), | 247 | + |
| 248 | + OP_CHECK_IF(dyDimNum_ != dxDimNum_, | ||
| 249 | + OP_LOGE_FOR_INVALID_SHAPEDIMS_WITH_REASON( | ||
| 250 | + context_->GetNodeName(), "dy and dx", | ||
| 251 | + (std::to_string(dyDimNum_) + " and " + std::to_string(dxDimNum_)).c_str(), | ||
| 252 | + "The shape dims of dy and dx must be the same"), | ||
| 253 | + return ge::GRAPH_FAILED); | ||
| 254 | + OP_CHECK_IF(!(weightDimLen_ == runningVarDimLen_ && weightDimLen_ == fusedALen_), | ||
| 255 | + OP_LOGE_FOR_INVALID_SHAPEDIMS_WITH_REASON( | ||
| 256 | + context_->GetNodeName(), "weight, running_var and dy", | ||
| 257 | + (std::to_string(weightDimNum_) + ", " + std::to_string(dxDimNum_) + " and " + std::to_string(dyDimNum_)) | ||
| 258 | + .c_str(), | ||
| 259 | + "The number of elements of weight and running_var must be the same as the C-dimension of paremeter dy, " | ||
| 260 | + "where C is the 1st axis of dy"), | ||
| 253 | return ge::GRAPH_FAILED); | 261 | return ge::GRAPH_FAILED); |
| 254 | return ge::GRAPH_SUCCESS; | 262 | return ge::GRAPH_SUCCESS; |
| 255 | } | 263 | } |
| @@ -252,17 +252,29 @@ ge::graphStatus BatchNormGradV3InferBase::CheckInputValid() | |||
| 252 | "range"), | 252 | "range"), |
| 253 | return ge::GRAPH_FAILED); | 253 | return ge::GRAPH_FAILED); |
| 254 | 254 | ||
| 255 | - bool inputShapeValid = weightDimNum_ == runningVarDimNum_ && dyDimNum_ == dxDimNum_ && weightDimNum_ == 1 && | 255 | + OP_CHECK_IF( |
| 256 | - weightDimLen_ == runningVarDimLen_ && weightDimLen_ == fusedALen_; | 256 | + !(weightDimNum_ == runningVarDimNum_ && weightDimNum_ == 1), |
| 257 | + OP_LOGE_FOR_INVALID_SHAPEDIMS_WITH_REASON( | ||
| 258 | + context_->GetNodeName(), "weight and running_var", | ||
| 259 | + (std::to_string(weightDimNum_) + " and " + std::to_string(runningVarDimNum_)).c_str(), | ||
| 260 | + "The Shapes of weight and running_var must be 1D"), | ||
| 261 | + return ge::GRAPH_FAILED); | ||
| 257 | 262 | ||
| 258 | OP_CHECK_IF( | 263 | OP_CHECK_IF( |
| 259 | - !inputShapeValid, | 264 | + (dyDimNum_ != dxDimNum_), |
| 260 | OP_LOGE_FOR_INVALID_SHAPEDIMS_WITH_REASON( | 265 | OP_LOGE_FOR_INVALID_SHAPEDIMS_WITH_REASON( |
| 261 | - context_->GetNodeName(), "dy, weight, running_var and dx", | 266 | + context_->GetNodeName(), "dy and dx", |
| 262 | - (std::to_string(dyDimNum_) + ", " + std::to_string(weightDimNum_) + ", " + | 267 | + (std::to_string(dyDimNum_) + " and " + std::to_string(dxDimNum_)).c_str(), |
| 263 | - std::to_string(runningVarDimNum_) + ", " + std::to_string(dxDimNum_)).c_str(), | 268 | + "The shape dims of dy and dx must be the same"), |
| 264 | - "weight and running_var should be 1D, and dy and dx should have the same dim num; the first dim of weight " | 269 | + return ge::GRAPH_FAILED); |
| 265 | - "and running_var should be equal, and they also should be equal to the second dim of dy"), | 270 | + OP_CHECK_IF( |
| 271 | + !(weightDimLen_ == runningVarDimLen_ && weightDimLen_ == fusedALen_), | ||
| 272 | + OP_LOGE_FOR_INVALID_SHAPEDIMS_WITH_REASON( | ||
| 273 | + context_->GetNodeName(), "weight, running_var and dy", | ||
| 274 | + (std::to_string(dyDimNum_) + ", " + std::to_string(dxDimNum_) + " and " + std::to_string(dyDimNum_)) | ||
| 275 | + .c_str(), | ||
| 276 | + "The number of elements of weight and running_var must be the same as the C-dimension of paremeter dy, " | ||
| 277 | + "where C is the 1st axis of dy"), | ||
| 266 | return ge::GRAPH_FAILED); | 278 | return ge::GRAPH_FAILED); |
| 267 | return ge::GRAPH_SUCCESS; | 279 | return ge::GRAPH_SUCCESS; |
| 268 | } | 280 | } |
| @@ -273,13 +273,14 @@ ge::graphStatus DequantSwigluQuantDskTiling::CheckForStaticQuant() { | |||
| 273 | OP_CHECK_NULL_WITH_CONTEXT(context_, quantScaleDescPtr); | 273 | OP_CHECK_NULL_WITH_CONTEXT(context_, quantScaleDescPtr); |
| 274 | auto quantOffsetDtype = quantOffsetDescPtr->GetDataType(); | 274 | auto quantOffsetDtype = quantOffsetDescPtr->GetDataType(); |
| 275 | auto quantScaleDtype = quantScaleDescPtr->GetDataType(); | 275 | auto quantScaleDtype = quantScaleDescPtr->GetDataType(); |
| 276 | - OP_CHECK_IF(quantOffsetDtype != quantScaleDtype, | 276 | + OP_CHECK_IF( |
| 277 | - OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON( | 277 | + quantOffsetDtype != quantScaleDtype, |
| 278 | - context_->GetNodeName(), "quant_offset and quant_scale", | 278 | + OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON( |
| 279 | - (ge::TypeUtils::DataTypeToSerialString(quantOffsetDtype) + " and " + | 279 | + context_->GetNodeName(), "quant_offset and quant_scale", |
| 280 | - ge::TypeUtils::DataTypeToSerialString(quantScaleDtype)).c_str(), | 280 | + (ge::TypeUtils::DataTypeToSerialString(quantOffsetDtype) + " and " + |
| 281 | - "quantOffset dtype must be same as quantScale dtype"), | 281 | + ge::TypeUtils::DataTypeToSerialString(quantScaleDtype)).c_str(), |
| 282 | - return ge::GRAPH_FAILED); | 282 | + "The dtypes of quant_offset and quant_scale dtype must be the same"), |
| 283 | + return ge::GRAPH_FAILED); | ||
| 283 | 284 | ||
| 284 | int64_t quantScaleColLen = 0; | 285 | int64_t quantScaleColLen = 0; |
| 285 | int64_t quantOffsetColLen = 0; | 286 | int64_t quantOffsetColLen = 0; |
| @@ -511,7 +512,7 @@ ge::graphStatus DequantSwigluQuantDskTiling::GetShapeAttrsInfoInner() { | |||
| 511 | OP_CHECK_IF(inDimy_ % (BLOCK_SIZE * SWI_FACTOR) != 0, | 512 | OP_CHECK_IF(inDimy_ % (BLOCK_SIZE * SWI_FACTOR) != 0, |
| 512 | OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(context_->GetNodeName(), "x", | 513 | OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(context_->GetNodeName(), "x", |
| 513 | std::to_string(inDimy_).c_str(), | 514 | std::to_string(inDimy_).c_str(), |
| 514 | - "lastdimSize of x must be divisible by 64"), | 515 | + "The last dimension of x must be exactly divisible by 64"), |
| 515 | return ge::GRAPH_FAILED); | 516 | return ge::GRAPH_FAILED); |
| 516 | 517 | ||
| 517 | // set the relevant param of group, hasGroupIndex_, groupNum_ and speGroupType_ | 518 | // set the relevant param of group, hasGroupIndex_, groupNum_ and speGroupType_ |
| @@ -221,10 +221,11 @@ ge::graphStatus DequantSwigluQuantV35DskTiling::GetAttrActivateDim() | |||
| 221 | 221 | ||
| 222 | // activate_dim对应在x的轴需要是偶数 | 222 | // activate_dim对应在x的轴需要是偶数 |
| 223 | OP_CHECK_IF((xShape_.GetDim(activateDim_) % 2) != 0, | 223 | OP_CHECK_IF((xShape_.GetDim(activateDim_) % 2) != 0, |
| 224 | - OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(context_->GetNodeName(), "x", | 224 | + std::string reasonMsg = |
| 225 | - Ops::Base::ToString(xShape_).c_str(), | 225 | + "The " + std::to_string(activateDim_) + " dimension(activate_dim) of x must be an even number"; |
| 226 | - "the x dimension of activateDim must be even"), | 226 | + OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON( |
| 227 | - return ge::GRAPH_FAILED); | 227 | + context_->GetNodeName(), "x", Ops::Base::ToString(xShape_).c_str(), reasonMsg.c_str()), |
| 228 | + return ge::GRAPH_FAILED); | ||
| 228 | return ge::GRAPH_SUCCESS; | 229 | return ge::GRAPH_SUCCESS; |
| 229 | } | 230 | } |
| 230 | 231 | ||
| @@ -266,7 +266,7 @@ ge::graphStatus DequantSwigluQuantTiling::checkWeightBiasActivate(gert::TilingCo | |||
| 266 | OP_CHECK_IF(weightScaleShapeSize != tilingData.get_colLen() * 2, | 266 | OP_CHECK_IF(weightScaleShapeSize != tilingData.get_colLen() * 2, |
| 267 | OP_LOGE_FOR_INVALID_SHAPESIZES_WITH_REASON(context->GetNodeName(), "weight_scale", | 267 | OP_LOGE_FOR_INVALID_SHAPESIZES_WITH_REASON(context->GetNodeName(), "weight_scale", |
| 268 | std::to_string(weightScaleShapeSize).c_str(), | 268 | std::to_string(weightScaleShapeSize).c_str(), |
| 269 | - ("The shapesize of the weight scale is not equal to the last dimension of the xshape " | 269 | + ("The shape size of weight_scale must be equal to the last dimension of x" |
| 270 | + std::to_string(tilingData.get_colLen() * 2)).c_str()), | 270 | + std::to_string(tilingData.get_colLen() * 2)).c_str()), |
| 271 | return ge::GRAPH_FAILED); | 271 | return ge::GRAPH_FAILED); |
| 272 | 272 | ||
| @@ -502,7 +502,7 @@ bool DequantSwigluQuantTiling::CalcTiling( | |||
| 502 | (tilingData.get_colLen() % blockSizeOf64B != 0)) { | 502 | (tilingData.get_colLen() % blockSizeOf64B != 0)) { |
| 503 | OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(context_->GetNodeName(), "x", | 503 | OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(context_->GetNodeName(), "x", |
| 504 | std::to_string(tilingData.get_colLen()).c_str(), | 504 | std::to_string(tilingData.get_colLen()).c_str(), |
| 505 | - "colLen (the last dimension of x) must be 64B aligned on ASCEND310P"); | 505 | + "The last dimension of x must be 64B aligned on ASCEND310P"); |
| 506 | return false; | 506 | return false; |
| 507 | } | 507 | } |
| 508 | GluSingleTilingOptParam optTilingDb; | 508 | GluSingleTilingOptParam optTilingDb; |
| @@ -576,11 +576,10 @@ ge::graphStatus DequantSwigluQuantTiling::GetShapeAttrsInfoInner() | |||
| 576 | const gert::Shape scaleShape = scaleShapePtr->GetStorageShape(); | 576 | const gert::Shape scaleShape = scaleShapePtr->GetStorageShape(); |
| 577 | 577 | ||
| 578 | if (static_cast<uint64_t>(scaleShape.GetShapeSize()) != tilingData.get_rowLen()) { | 578 | if (static_cast<uint64_t>(scaleShape.GetShapeSize()) != tilingData.get_rowLen()) { |
| 579 | - std::string incorrectSize = std::to_string(static_cast<uint64_t>(scaleShape.GetShapeSize())); | 579 | + std::string incorrectSize = std::to_string(static_cast<uint64_t>(scaleShape.GetShapeSize())); |
| 580 | - std::string reason = | 580 | + std::string reason = "The numbers of elements in scale must be equal to the total number of elements in all " |
| 581 | - "scale's shapesize must be equal to row length" + std::to_string(tilingData.get_rowLen()) + | 581 | + "axes of x except the last one"; |
Z | |||
| 582 | - "(row length is total number of elements of x across all dimensions except the last one.)"; | 582 | + OP_LOGE_FOR_INVALID_SHAPESIZES_WITH_REASON(opName, "scale", incorrectSize.c_str(), reason.c_str()); |
| 583 | - OP_LOGE_FOR_INVALID_SHAPESIZES_WITH_REASON(opName, "scale", incorrectSize.c_str(), reason.c_str()); | ||
| 584 | } | 583 | } |
| 585 | return ge::GRAPH_SUCCESS; | 584 | return ge::GRAPH_SUCCESS; |
| 586 | } | 585 | } |
新增reason提交评审