Merged
fix(matmul): 规范 RotateQuant 和 MatmulEmuSplitWeight 错误上报 #13582
HKFLYEAdd on 18 days ago
fix(matmul): 规范 RotateQuant 和 MatmulEmuSplitWeight 错误上报 #13582
Merged
Total: 9 files changed+455-152
| @@ -19,7 +19,7 @@ namespace Ops { | |||
| 19 | namespace NN { | 19 | namespace NN { |
| 20 | inline void ReportMatmulParamError(const char* opName, const std::string& message) | 20 | inline void ReportMatmulParamError(const char* opName, const std::string& message) |
| 21 | { | 21 | { |
| 22 | - OP_LOGE_WITHOUT_REPORT(opName == nullptr ? "Matmul" : opName, "%s", message.c_str()); | 22 | + OP_LOGE_LIBOPAPI_REPORT(opName == nullptr ? "Matmul" : opName, "%s", message.c_str()); |
| 23 | const std::vector<const char*> keys = {"message"}; | 23 | const std::vector<const char*> keys = {"message"}; |
| 24 | const std::vector<const char*> values = {message.c_str()}; | 24 | const std::vector<const char*> values = {message.c_str()}; |
| 25 | REPORT_PREDEFINED_ERR_MSG("EZ1001", keys, values); | 25 | REPORT_PREDEFINED_ERR_MSG("EZ1001", keys, values); |
| @@ -28,10 +28,28 @@ inline void ReportMatmulParamError(const char* opName, const std::string& messag | |||
| 28 | inline void ReportMatmulTilingError(const char* opName, const std::string& reason) | 28 | inline void ReportMatmulTilingError(const char* opName, const std::string& reason) |
| 29 | { | 29 | { |
| 30 | const char* name = opName == nullptr ? "Matmul" : opName; | 30 | const char* name = opName == nullptr ? "Matmul" : opName; |
| 31 | - OP_LOGE_WITHOUT_REPORT(name, "%s", reason.c_str()); | 31 | + OP_LOGE_LIBOPAPI_REPORT(name, "%s", reason.c_str()); |
| 32 | const std::vector<const char*> keys = {"opName", "reason"}; | 32 | const std::vector<const char*> keys = {"opName", "reason"}; |
| 33 | const std::vector<const char*> values = {name, reason.c_str()}; | 33 | const std::vector<const char*> values = {name, reason.c_str()}; |
| 34 | REPORT_PREDEFINED_ERR_MSG("EZ1008", keys, values); | 34 | REPORT_PREDEFINED_ERR_MSG("EZ1008", keys, values); |
| 35 | } | 35 | } |
| 36 | + | ||
| 37 | +inline void ReportMatmulExecutionError(const char* opName, const std::string& reason) | ||
| 38 | +{ | ||
| 39 | + const char* name = opName == nullptr ? "Matmul" : opName; | ||
| 40 | + OP_LOGE_LIBOPAPI_REPORT(name, "%s", reason.c_str()); | ||
| 41 | + const std::vector<const char*> keys = {"opName", "reason"}; | ||
| 42 | + const std::vector<const char*> values = {name, reason.c_str()}; | ||
| 43 | + REPORT_PREDEFINED_ERR_MSG("EZ1009", keys, values); | ||
| 44 | +} | ||
| 45 | + | ||
| 46 | +inline void ReportMatmulInferShapeError(const char* opName, const std::string& reason) | ||
| 47 | +{ | ||
| 48 | + const char* name = opName == nullptr ? "Matmul" : opName; | ||
| 49 | + OP_LOGE_LIBOPAPI_REPORT(name, "%s", reason.c_str()); | ||
| 50 | + const std::vector<const char*> keys = {"opName", "reason"}; | ||
| 51 | + const std::vector<const char*> values = {name, reason.c_str()}; | ||
| 52 | + REPORT_PREDEFINED_ERR_MSG("EZ1014", keys, values); | ||
| 53 | +} | ||
| 36 | } // namespace NN | 54 | } // namespace NN |
| 37 | } // namespace Ops | 55 | } // namespace Ops |
| @@ -29,19 +29,29 @@ const aclTensor* MatmulEmuSplitWeight(const aclTensor* x, const aclTensor* wHigh | |||
| 29 | L0_DFX(MatmulEmuSplitWeight, x, wHigh, wLow, outDtype, wLowScale, yDtype, transposeX, transposeW); | 29 | L0_DFX(MatmulEmuSplitWeight, x, wHigh, wLow, outDtype, wLowScale, yDtype, transposeX, transposeW); |
| 30 | 30 | ||
| 31 | auto out = executor->AllocTensor(outDtype, Format::FORMAT_ND, Format::FORMAT_ND); | 31 | auto out = executor->AllocTensor(outDtype, Format::FORMAT_ND, Format::FORMAT_ND); |
| 32 | - OP_CHECK_NULL(out, return nullptr); | 32 | + if (out == nullptr) { |
| 33 | + OP_LOGE_WITHOUT_REPORT(ACLNN_ERR_INNER_NULLPTR, | ||
| 34 | + "Failed to allocate the MatmulEmuSplitWeight output tensor; see the allocator error."); | ||
| 35 | + return nullptr; | ||
| 36 | + } | ||
| 33 | 37 | ||
| 34 | auto ret = INFER_SHAPE(MatmulEmuSplitWeight, OP_INPUT(x, wHigh, wLow), OP_OUTPUT(out), | 38 | auto ret = INFER_SHAPE(MatmulEmuSplitWeight, OP_INPUT(x, wHigh, wLow), OP_OUTPUT(out), |
| 35 | OP_ATTR(wLowScale, transposeX, transposeW, yDtype)); | 39 | OP_ATTR(wLowScale, transposeX, transposeW, yDtype)); |
| 36 | if (ret != ACLNN_SUCCESS) { | 40 | if (ret != ACLNN_SUCCESS) { |
| 37 | - OP_LOGE(ACLNN_ERR_INNER_INFERSHAPE_ERROR, "InferShape failed."); | 41 | + OP_LOGE_WITHOUT_REPORT(ACLNN_ERR_INNER_INFERSHAPE_ERROR, |
| 42 | + "Failed to infer the output shape for MatmulEmuSplitWeight, error code: %d.", | ||
| 43 | + static_cast<int>(ret)); | ||
| 38 | return nullptr; | 44 | return nullptr; |
| 39 | } | 45 | } |
| 40 | 46 | ||
| 41 | ret = ADD_TO_LAUNCHER_LIST_AICORE(MatmulEmuSplitWeight, OP_INPUT(x, wHigh, wLow), OP_OUTPUT(out), | 47 | ret = ADD_TO_LAUNCHER_LIST_AICORE(MatmulEmuSplitWeight, OP_INPUT(x, wHigh, wLow), OP_OUTPUT(out), |
| 42 | OP_ATTR(wLowScale, transposeX, transposeW, yDtype)); | 48 | OP_ATTR(wLowScale, transposeX, transposeW, yDtype)); |
| 43 | - OP_CHECK_ADD_TO_LAUNCHER_LIST_AICORE(ret != ACLNN_SUCCESS, return nullptr, | 49 | + if (ret != ACLNN_SUCCESS) { |
| 44 | - "MatmulEmuSplitWeight ADD_TO_LAUNCHER_LIST_AICORE failed."); | 50 | + OP_LOGE_WITHOUT_REPORT(ACLNN_ERR_INNER_STATIC_WORKSPACE_INVALID, |
| 51 | + "Failed to prepare the MatmulEmuSplitWeight kernel for execution, error code: %d.", | ||
| 52 | + static_cast<int>(ret)); | ||
| 53 | + return nullptr; | ||
| 54 | + } | ||
| 45 | return out; | 55 | return out; |
| 46 | } | 56 | } |
| 47 | 57 | ||
| @@ -10,6 +10,8 @@ | |||
| 10 | 10 | ||
| 11 | #include "register/op_impl_registry.h" | 11 | #include "register/op_impl_registry.h" |
| 12 | #include "error_util.h" | 12 | #include "error_util.h" |
| 13 | +#include "matmul/common/op_host/matmul_error_report.h" | ||
| 14 | +#include <string> | ||
| 13 | 15 | ||
| 14 | namespace { | 16 | namespace { |
| 15 | const size_t kXIdx = 0; | 17 | const size_t kXIdx = 0; |
| @@ -27,8 +29,13 @@ const size_t kAttrTransWIdx = 2; | |||
| 27 | namespace Ops::NN::MatMul { | 29 | namespace Ops::NN::MatMul { |
| 28 | ge::graphStatus InferShapeForMatmulEmuSplitWeight(gert::InferShapeContext* context) | 30 | ge::graphStatus InferShapeForMatmulEmuSplitWeight(gert::InferShapeContext* context) |
| 29 | { | 31 | { |
| 30 | - OP_CHECK_IF(context == nullptr, CUBE_INNER_ERR_REPORT("MatmulEmuSplitWeight", "context is null"), | 32 | + OP_CHECK_IF( |
| 31 | - return ge::GRAPH_FAILED); | 33 | + context == nullptr, |
| 34 | + { | ||
| 35 | + Ops::NN::ReportMatmulInferShapeError("MatmulEmuSplitWeight", | ||
| 36 | + "InferShapeContext is null; check the infer-shape invocation."); | ||
| 37 | + }, | ||
| 38 | + return ge::GRAPH_FAILED); | ||
| 32 | auto op_name = context->GetNodeName(); | 39 | auto op_name = context->GetNodeName(); |
| 33 | auto xShape = context->GetInputShape(kXIdx); | 40 | auto xShape = context->GetInputShape(kXIdx); |
| 34 | auto wHighShape = context->GetInputShape(kWHighIdx); | 41 | auto wHighShape = context->GetInputShape(kWHighIdx); |
| @@ -38,16 +45,33 @@ ge::graphStatus InferShapeForMatmulEmuSplitWeight(gert::InferShapeContext* conte | |||
| 38 | 45 | ||
| 39 | OP_CHECK_IF( | 46 | OP_CHECK_IF( |
| 40 | xShape == nullptr || wHighShape == nullptr || wLowShape == nullptr || yShape == nullptr || attrs == nullptr, | 47 | xShape == nullptr || wHighShape == nullptr || wLowShape == nullptr || yShape == nullptr || attrs == nullptr, |
| 41 | - CUBE_INNER_ERR_REPORT(op_name, "input or output shape or attrs is null"), return ge::GRAPH_FAILED); | 48 | + { |
| 49 | + if (xShape == nullptr || wHighShape == nullptr || wLowShape == nullptr) { | ||
| 50 | + OP_LOGE_WITH_INVALID_INPUT(op_name, | ||
| 51 | + xShape == nullptr ? "x" : (wHighShape == nullptr ? "w_high" : "w_low")); | ||
| 52 | + } else { | ||
| 53 | + const char* reason = yShape == nullptr ? "Output y shape storage is null." : | ||
| 54 | + "Infer-shape attributes are null."; | ||
| 55 | + Ops::NN::ReportMatmulInferShapeError(op_name, reason); | ||
| 56 | + } | ||
| 57 | + }, | ||
| 58 | + return ge::GRAPH_FAILED); | ||
| 42 | 59 | ||
| 43 | OP_CHECK_IF(xShape->GetDimNum() != kMinDimNum || wHighShape->GetDimNum() != kMinDimNum || | 60 | OP_CHECK_IF(xShape->GetDimNum() != kMinDimNum || wHighShape->GetDimNum() != kMinDimNum || |
| 44 | wLowShape->GetDimNum() != kMinDimNum, | 61 | wLowShape->GetDimNum() != kMinDimNum, |
| 45 | - CUBE_INNER_ERR_REPORT(op_name, "all inputs must be 2D"), return ge::GRAPH_FAILED); | 62 | + OP_LOGE_FOR_INVALID_SHAPEDIMS_WITH_REASON( |
| 63 | + op_name, "x, w_high, w_low", | ||
| 64 | + (std::to_string(xShape->GetDimNum()) + ", " + std::to_string(wHighShape->GetDimNum()) + ", " + | ||
| 65 | + std::to_string(wLowShape->GetDimNum())) | ||
| 66 | + .c_str(), | ||
| 67 | + "All inputs must have rank 2."), | ||
| 68 | + return ge::GRAPH_FAILED); | ||
| 46 | 69 | ||
| 47 | auto transXPtr = attrs->GetAttrPointer<bool>(kAttrTransXIdx); | 70 | auto transXPtr = attrs->GetAttrPointer<bool>(kAttrTransXIdx); |
| 48 | auto transWPtr = attrs->GetAttrPointer<bool>(kAttrTransWIdx); | 71 | auto transWPtr = attrs->GetAttrPointer<bool>(kAttrTransWIdx); |
| 49 | OP_CHECK_IF(transXPtr == nullptr || transWPtr == nullptr, | 72 | OP_CHECK_IF(transXPtr == nullptr || transWPtr == nullptr, |
| 50 | - CUBE_INNER_ERR_REPORT(op_name, "transX or transW attr is null"), return ge::GRAPH_FAILED); | 73 | + OP_LOGE_WITH_INVALID_INPUT(op_name, transXPtr == nullptr ? "transpose_x" : "transpose_w"), |
| 74 | + return ge::GRAPH_FAILED); | ||
| 51 | bool transX = *transXPtr; | 75 | bool transX = *transXPtr; |
| 52 | bool transW = *transWPtr; | 76 | bool transW = *transWPtr; |
| 53 | 77 | ||
| @@ -58,11 +82,23 @@ ge::graphStatus InferShapeForMatmulEmuSplitWeight(gert::InferShapeContext* conte | |||
| 58 | int64_t wLowK = transW ? wLowShape->GetDim(1) : wLowShape->GetDim(0); | 82 | int64_t wLowK = transW ? wLowShape->GetDim(1) : wLowShape->GetDim(0); |
| 59 | int64_t wLowN = transW ? wLowShape->GetDim(0) : wLowShape->GetDim(1); | 83 | int64_t wLowN = transW ? wLowShape->GetDim(0) : wLowShape->GetDim(1); |
| 60 | 84 | ||
| 61 | - OP_CHECK_IF(K != wHighK, CUBE_INNER_ERR_REPORT(op_name, "x K(%ld) must match w_high K(%ld)", K, wHighK), | 85 | + OP_CHECK_IF( |
| 62 | - return ge::GRAPH_FAILED); | 86 | + K != wHighK, |
| 63 | - OP_CHECK_IF(K != wLowK, CUBE_INNER_ERR_REPORT(op_name, "x K(%ld) must match w_low K(%ld)", K, wLowK), | 87 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( |
| 64 | - return ge::GRAPH_FAILED); | 88 | + op_name, "x, w_high", (Ops::Base::ToString(*xShape) + ", " + Ops::Base::ToString(*wHighShape)).c_str(), |
| 65 | - OP_CHECK_IF(N != wLowN, CUBE_INNER_ERR_REPORT(op_name, "w_high N(%ld) must match w_low N(%ld)", N, wLowN), | 89 | + "The contraction dimensions K of x and w_high must match after applying transpose_x and transpose_w."), |
| 90 | + return ge::GRAPH_FAILED); | ||
| 91 | + OP_CHECK_IF( | ||
| 92 | + K != wLowK, | ||
| 93 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( | ||
| 94 | + op_name, "x, w_low", (Ops::Base::ToString(*xShape) + ", " + Ops::Base::ToString(*wLowShape)).c_str(), | ||
| 95 | + "The contraction dimensions K of x and w_low must match after applying transpose_x and transpose_w."), | ||
| 96 | + return ge::GRAPH_FAILED); | ||
| 97 | + OP_CHECK_IF(N != wLowN, | ||
| 98 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( | ||
| 99 | + op_name, "w_high, w_low", | ||
| 100 | + (Ops::Base::ToString(*wHighShape) + ", " + Ops::Base::ToString(*wLowShape)).c_str(), | ||
| 101 | + "The output dimensions N of w_high and w_low must match after applying transpose_w."), | ||
| 66 | return ge::GRAPH_FAILED); | 102 | return ge::GRAPH_FAILED); |
| 67 | 103 | ||
| 68 | yShape->SetDimNum(kMinDimNum); | 104 | yShape->SetDimNum(kMinDimNum); |
| @@ -11,6 +11,8 @@ | |||
| 11 | #include "matmul_emu_split_weight_tiling.h" | 11 | #include "matmul_emu_split_weight_tiling.h" |
| 12 | #include "matmul_emu_split_weight_tiling_key.h" | 12 | #include "matmul_emu_split_weight_tiling_key.h" |
| 13 | #include "error_util.h" | 13 | #include "error_util.h" |
| 14 | +#include "matmul/common/op_host/matmul_error_report.h" | ||
| 15 | +#include <string> | ||
| 14 | #include "matmul/common/op_host/math_util_nn.h" | 16 | #include "matmul/common/op_host/math_util_nn.h" |
| 15 | #include <cmath> | 17 | #include <cmath> |
| 16 | 18 | ||
| @@ -40,8 +42,13 @@ bool MatmulEmuSplitWeightBaseTiling::IsCapable() { return true; } | |||
| 40 | ge::graphStatus MatmulEmuSplitWeightBaseTiling::GetPlatformInfo() | 42 | ge::graphStatus MatmulEmuSplitWeightBaseTiling::GetPlatformInfo() |
| 41 | { | 43 | { |
| 42 | auto platformInfo = context_->GetPlatformInfo(); | 44 | auto platformInfo = context_->GetPlatformInfo(); |
| 43 | - OP_TILING_CHECK(platformInfo == nullptr, CUBE_INNER_ERR_REPORT(context_->GetNodeName(), "platformInfo is null"), | 45 | + OP_TILING_CHECK( |
| 44 | - return ge::GRAPH_FAILED); | 46 | + platformInfo == nullptr, |
| 47 | + { | ||
| 48 | + Ops::NN::ReportMatmulTilingError(context_->GetNodeName(), | ||
| 49 | + "Platform information is null; check tiling platform initialization."); | ||
| 50 | + }, | ||
| 51 | + return ge::GRAPH_FAILED); | ||
| 45 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo); | 52 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo); |
| 46 | aicNum_ = ascendcPlatform.GetCoreNumAic(); | 53 | aicNum_ = ascendcPlatform.GetCoreNumAic(); |
| 47 | return ge::GRAPH_SUCCESS; | 54 | return ge::GRAPH_SUCCESS; |
| @@ -50,8 +57,13 @@ ge::graphStatus MatmulEmuSplitWeightBaseTiling::GetPlatformInfo() | |||
| 50 | ge::graphStatus MatmulEmuSplitWeightBaseTiling::ExtractAttrs() | 57 | ge::graphStatus MatmulEmuSplitWeightBaseTiling::ExtractAttrs() |
| 51 | { | 58 | { |
| 52 | auto attrs = context_->GetAttrs(); | 59 | auto attrs = context_->GetAttrs(); |
| 53 | - OP_TILING_CHECK(attrs == nullptr, CUBE_INNER_ERR_REPORT(context_->GetNodeName(), "attrs is null"), | 60 | + OP_TILING_CHECK( |
| 54 | - return ge::GRAPH_FAILED); | 61 | + attrs == nullptr, |
| 62 | + { | ||
| 63 | + Ops::NN::ReportMatmulTilingError(context_->GetNodeName(), | ||
| 64 | + "Tiling attributes are null; check operator attribute initialization."); | ||
| 65 | + }, | ||
| 66 | + return ge::GRAPH_FAILED); | ||
| 55 | 67 | ||
| 56 | const int32_t* yDtypePtr = attrs->GetAttrPointer<int32_t>(INDEX_ATTR_Y_DTYPE); | 68 | const int32_t* yDtypePtr = attrs->GetAttrPointer<int32_t>(INDEX_ATTR_Y_DTYPE); |
| 57 | yDtype_ = (yDtypePtr != nullptr) ? *yDtypePtr : Y_DTYPE_FP32; | 69 | yDtype_ = (yDtypePtr != nullptr) ? *yDtypePtr : Y_DTYPE_FP32; |
| @@ -89,24 +101,41 @@ ge::graphStatus MatmulEmuSplitWeightBaseTiling::ValidateShape() | |||
| 89 | 101 | ||
| 90 | OP_TILING_CHECK( | 102 | OP_TILING_CHECK( |
| 91 | xShape.GetDimNum() != NUM_TWO || wHighShape.GetDimNum() != NUM_TWO || wLowShape.GetDimNum() != NUM_TWO, | 103 | xShape.GetDimNum() != NUM_TWO || wHighShape.GetDimNum() != NUM_TWO || wLowShape.GetDimNum() != NUM_TWO, |
| 92 | - CUBE_INNER_ERR_REPORT(context_->GetNodeName(), "all inputs must be 2D"), return ge::GRAPH_FAILED); | 104 | + OP_LOGE_FOR_INVALID_SHAPEDIMS_WITH_REASON( |
| 105 | + context_->GetNodeName(), "x, w_high, w_low", | ||
| 106 | + (std::to_string(xShape.GetDimNum()) + ", " + std::to_string(wHighShape.GetDimNum()) + ", " + | ||
| 107 | + std::to_string(wLowShape.GetDimNum())) | ||
| 108 | + .c_str(), | ||
| 109 | + "All inputs must have rank 2."), | ||
| 110 | + return ge::GRAPH_FAILED); | ||
| 93 | 111 | ||
| 94 | OP_TILING_CHECK(m_ == 0 || m_ > static_cast<uint64_t>(INT32_MAX) || n_ == 0 || | 112 | OP_TILING_CHECK(m_ == 0 || m_ > static_cast<uint64_t>(INT32_MAX) || n_ == 0 || |
| 95 | n_ > static_cast<uint64_t>(INT32_MAX) || k_ == 0 || k_ > static_cast<uint64_t>(INT32_MAX), | 113 | n_ > static_cast<uint64_t>(INT32_MAX) || k_ == 0 || k_ > static_cast<uint64_t>(INT32_MAX), |
| 96 | - CUBE_INNER_ERR_REPORT(context_->GetNodeName(), | 114 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( |
| 97 | - "m, k, n of x, w must be within the range (0, INT32_MAX], " | 115 | + context_->GetNodeName(), "x, w_high", |
| 98 | - "got m=%lu, k=%lu, n=%lu", | 116 | + (Ops::Base::ToString(xShape) + ", " + Ops::Base::ToString(wHighShape)).c_str(), |
| 99 | - m_, k_, n_), | 117 | + "M, K and N must be in [1, INT32_MAX] after applying transpose_x and transpose_w."), |
| 100 | return ge::GRAPH_FAILED); | 118 | return ge::GRAPH_FAILED); |
| 101 | 119 | ||
| 102 | - OP_TILING_CHECK(k_ != wHighK_, | 120 | + OP_TILING_CHECK( |
| 103 | - CUBE_INNER_ERR_REPORT(context_->GetNodeName(), "x K(%lu) must match w_high K(%lu)", k_, wHighK_), | 121 | + k_ != wHighK_, |
| 104 | - return ge::GRAPH_FAILED); | 122 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( |
| 105 | - OP_TILING_CHECK(k_ != wLowK_, | 123 | + context_->GetNodeName(), "x, w_high", |
| 106 | - CUBE_INNER_ERR_REPORT(context_->GetNodeName(), "x K(%lu) must match w_low K(%lu)", k_, wLowK_), | 124 | + (Ops::Base::ToString(xShape) + ", " + Ops::Base::ToString(wHighShape)).c_str(), |
| 107 | - return ge::GRAPH_FAILED); | 125 | + "The contraction dimensions K of x and w_high must match after applying transpose_x and transpose_w."), |
| 126 | + return ge::GRAPH_FAILED); | ||
| 127 | + OP_TILING_CHECK( | ||
| 128 | + k_ != wLowK_, | ||
| 129 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( | ||
| 130 | + context_->GetNodeName(), "x, w_low", | ||
| 131 | + (Ops::Base::ToString(xShape) + ", " + Ops::Base::ToString(wLowShape)).c_str(), | ||
| 132 | + "The contraction dimensions K of x and w_low must match after applying transpose_x and transpose_w."), | ||
| 133 | + return ge::GRAPH_FAILED); | ||
| 108 | OP_TILING_CHECK(n_ != wLowN_, | 134 | OP_TILING_CHECK(n_ != wLowN_, |
| 109 | - CUBE_INNER_ERR_REPORT(context_->GetNodeName(), "w_high N(%lu) must match w_low N(%lu)", n_, wLowN_), | 135 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( |
| 136 | + context_->GetNodeName(), "w_high, w_low", | ||
| 137 | + (Ops::Base::ToString(wHighShape) + ", " + Ops::Base::ToString(wLowShape)).c_str(), | ||
| 138 | + "The output dimensions N of w_high and w_low must match after applying transpose_w."), | ||
| 110 | return ge::GRAPH_FAILED); | 139 | return ge::GRAPH_FAILED); |
| 111 | 140 | ||
| 112 | return ge::GRAPH_SUCCESS; | 141 | return ge::GRAPH_SUCCESS; |
| @@ -114,12 +143,14 @@ ge::graphStatus MatmulEmuSplitWeightBaseTiling::ValidateShape() | |||
| 114 | 143 | ||
| 115 | ge::graphStatus MatmulEmuSplitWeightBaseTiling::ValidateAttrs() | 144 | ge::graphStatus MatmulEmuSplitWeightBaseTiling::ValidateAttrs() |
| 116 | { | 145 | { |
| 117 | - OP_TILING_CHECK(yDtype_ != Y_DTYPE_FP32, | 146 | + OP_TILING_CHECK( |
| 118 | - CUBE_INNER_ERR_REPORT(context_->GetNodeName(), "y_dtype only supports 0 (FP32), got %d", yDtype_), | 147 | + yDtype_ != Y_DTYPE_FP32, |
| 119 | - return ge::GRAPH_FAILED); | 148 | + OP_LOGE_FOR_INVALID_VALUE(context_->GetNodeName(), "y_dtype", std::to_string(yDtype_).c_str(), "0 (FP32)"), |
| 149 | + return ge::GRAPH_FAILED); | ||
| 120 | OP_TILING_CHECK( | 150 | OP_TILING_CHECK( |
| 121 | std::fabs(scale_ - EXPECTED_SCALE) > 1e-7f, | 151 | std::fabs(scale_ - EXPECTED_SCALE) > 1e-7f, |
| 122 | - CUBE_INNER_ERR_REPORT(context_->GetNodeName(), "w_low_scale only supports 1/256 (0.00390625), got %f", scale_), | 152 | + OP_LOGE_FOR_INVALID_VALUE_WITH_REASON(context_->GetNodeName(), "w_low_scale", std::to_string(scale_).c_str(), |
| 153 | + "Must equal 0.00390625 (1/256), within a tolerance of 1e-7."), | ||
| 123 | return ge::GRAPH_FAILED); | 154 | return ge::GRAPH_FAILED); |
| 124 | return ge::GRAPH_SUCCESS; | 155 | return ge::GRAPH_SUCCESS; |
| 125 | } | 156 | } |
| @@ -195,16 +226,32 @@ ge::graphStatus MatmulEmuSplitWeightBaseTiling::GetWorkspaceSize() | |||
| 195 | ge::graphStatus MatmulEmuSplitWeightBaseTiling::PostTiling() | 226 | ge::graphStatus MatmulEmuSplitWeightBaseTiling::PostTiling() |
| 196 | { | 227 | { |
| 197 | size_t sizeTilingData = sizeof(MatmulEmuSplitWeightTilingData); | 228 | size_t sizeTilingData = sizeof(MatmulEmuSplitWeightTilingData); |
| 198 | - OP_TILING_CHECK(sizeTilingData % sizeof(uint64_t) != 0, | 229 | + OP_TILING_CHECK( |
| 199 | - OP_LOGE(context_->GetNodeName(), "tiling data size[%zu] is not aligned to 8", sizeTilingData), | 230 | + sizeTilingData % sizeof(uint64_t) != 0, |
| 200 | - return ge::GRAPH_FAILED); | 231 | + { |
| 201 | - OPS_CHECK_NULL_WITH_CONTEXT(context_, context_->GetRawTilingData()); | 232 | + const std::string reason = "Tiling data size " + std::to_string(sizeTilingData) + |
| 233 | + " bytes must be aligned to 8 bytes; check the tiling data layout."; | ||
| 234 | + Ops::NN::ReportMatmulTilingError(context_->GetNodeName(), reason.c_str()); | ||
| 235 | + }, | ||
| 236 | + return ge::GRAPH_FAILED); | ||
| 237 | + OP_TILING_CHECK( | ||
| 238 | + context_->GetRawTilingData() == nullptr, | ||
| 239 | + { | ||
| 240 | + Ops::NN::ReportMatmulTilingError(context_->GetNodeName(), | ||
| 241 | + "Raw tiling data storage is null; check tiling context initialization."); | ||
| 242 | + }, | ||
| 243 | + return ge::GRAPH_FAILED); | ||
| 202 | context_->GetRawTilingData()->SetDataSize(sizeTilingData); | 244 | context_->GetRawTilingData()->SetDataSize(sizeTilingData); |
| 203 | context_->SetBlockDim(tilingData_.usedCoreNum); | 245 | context_->SetBlockDim(tilingData_.usedCoreNum); |
| 204 | 246 | ||
| 205 | size_t* workspaces = context_->GetWorkspaceSizes(1); | 247 | size_t* workspaces = context_->GetWorkspaceSizes(1); |
| 206 | - OP_TILING_CHECK(workspaces == nullptr, CUBE_INNER_ERR_REPORT(context_->GetNodeName(), "workspaces is null"), | 248 | + OP_TILING_CHECK( |
| 207 | - return ge::GRAPH_FAILED); | 249 | + workspaces == nullptr, |
| 250 | + { | ||
| 251 | + Ops::NN::ReportMatmulTilingError( | ||
| 252 | + context_->GetNodeName(), "Workspace size output storage is null; check tiling context initialization."); | ||
| 253 | + }, | ||
| 254 | + return ge::GRAPH_FAILED); | ||
| 208 | workspaces[0] = workspaceSize_; | 255 | workspaces[0] = workspaceSize_; |
| 209 | 256 | ||
| 210 | auto tilingPtr = static_cast<MatmulEmuSplitWeightTilingData*>(context_->GetRawTilingData()->GetData()); | 257 | auto tilingPtr = static_cast<MatmulEmuSplitWeightTilingData*>(context_->GetRawTilingData()->GetData()); |
| @@ -14,6 +14,7 @@ | |||
| 14 | 14 | ||
| 15 | #include "register/op_impl_registry.h" | 15 | #include "register/op_impl_registry.h" |
| 16 | #include "error_util.h" | 16 | #include "error_util.h" |
| 17 | +#include "matmul/common/op_host/matmul_error_report.h" | ||
| 17 | #include "op_host/tiling_templates_registry.h" | 18 | #include "op_host/tiling_templates_registry.h" |
| 18 | #include "op_common/op_host/util/op_const_def.h" | 19 | #include "op_common/op_host/util/op_const_def.h" |
| 19 | 20 | ||
| @@ -30,11 +31,21 @@ REGISTER_TILING_TEMPLATE("MatmulEmuSplitWeight", MatmulEmuSplitWeightTiling, MAT | |||
| 30 | 31 | ||
| 31 | static ge::graphStatus MatmulEmuSplitWeightTilingFunc(gert::TilingContext* context) | 32 | static ge::graphStatus MatmulEmuSplitWeightTilingFunc(gert::TilingContext* context) |
| 32 | { | 33 | { |
| 33 | - OP_TILING_CHECK(context == nullptr, CUBE_INNER_ERR_REPORT("MatmulEmuSplitWeight", "context is null"), | 34 | + OP_TILING_CHECK( |
| 34 | - return ge::GRAPH_FAILED); | 35 | + context == nullptr, |
| 36 | + { | ||
| 37 | + Ops::NN::ReportMatmulTilingError("MatmulEmuSplitWeight", | ||
| 38 | + "Tiling context is null; check the registered tiling invocation."); | ||
| 39 | + }, | ||
| 40 | + return ge::GRAPH_FAILED); | ||
| 35 | auto platformInfo = context->GetPlatformInfo(); | 41 | auto platformInfo = context->GetPlatformInfo(); |
| 36 | - OP_TILING_CHECK(platformInfo == nullptr, CUBE_INNER_ERR_REPORT("MatmulEmuSplitWeight", "platformInfo is null"), | 42 | + OP_TILING_CHECK( |
| 37 | - return ge::GRAPH_FAILED); | 43 | + platformInfo == nullptr, |
| 44 | + { | ||
| 45 | + Ops::NN::ReportMatmulTilingError("MatmulEmuSplitWeight", | ||
| 46 | + "Platform information is null; check tiling platform initialization."); | ||
| 47 | + }, | ||
| 48 | + return ge::GRAPH_FAILED); | ||
| 38 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo); | 49 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo); |
| 39 | auto npuArch = ascendcPlatform.GetCurNpuArch(); | 50 | auto npuArch = ascendcPlatform.GetCurNpuArch(); |
| 40 | if (npuArch == Ops::Base::DAV_3510) { | 51 | if (npuArch == Ops::Base::DAV_3510) { |
| @@ -46,14 +57,29 @@ static ge::graphStatus MatmulEmuSplitWeightTilingFunc(gert::TilingContext* conte | |||
| 46 | 57 | ||
| 47 | static ge::graphStatus TilingPrepareForMatmulEmuSplitWeight(gert::TilingParseContext* context) | 58 | static ge::graphStatus TilingPrepareForMatmulEmuSplitWeight(gert::TilingParseContext* context) |
| 48 | { | 59 | { |
| 49 | - OP_TILING_CHECK(context == nullptr, CUBE_INNER_ERR_REPORT("MatmulEmuSplitWeight", "context is null"), | 60 | + OP_TILING_CHECK( |
| 50 | - return ge::GRAPH_FAILED); | 61 | + context == nullptr, |
| 62 | + { | ||
| 63 | + Ops::NN::ReportMatmulTilingError("MatmulEmuSplitWeight", | ||
| 64 | + "Tiling context is null; check the registered tiling invocation."); | ||
| 65 | + }, | ||
| 66 | + return ge::GRAPH_FAILED); | ||
| 51 | fe::PlatFormInfos* platformInfo = context->GetPlatformInfo(); | 67 | fe::PlatFormInfos* platformInfo = context->GetPlatformInfo(); |
| 52 | - OP_TILING_CHECK(platformInfo == nullptr, CUBE_INNER_ERR_REPORT("MatmulEmuSplitWeight", "platformInfo is null"), | 68 | + OP_TILING_CHECK( |
| 53 | - return ge::GRAPH_FAILED); | 69 | + platformInfo == nullptr, |
| 70 | + { | ||
| 71 | + Ops::NN::ReportMatmulTilingError("MatmulEmuSplitWeight", | ||
| 72 | + "Platform information is null; check tiling platform initialization."); | ||
| 73 | + }, | ||
| 74 | + return ge::GRAPH_FAILED); | ||
| 54 | auto compileInfoPtr = context->GetCompiledInfo<MatmulEmuSplitWeightCompileInfo>(); | 75 | auto compileInfoPtr = context->GetCompiledInfo<MatmulEmuSplitWeightCompileInfo>(); |
| 55 | - OP_TILING_CHECK(compileInfoPtr == nullptr, CUBE_INNER_ERR_REPORT("MatmulEmuSplitWeight", "compileInfoPtr is null"), | 76 | + OP_TILING_CHECK( |
| 56 | - return ge::GRAPH_FAILED); | 77 | + compileInfoPtr == nullptr, |
| 78 | + { | ||
| 79 | + Ops::NN::ReportMatmulTilingError( | ||
| 80 | + "MatmulEmuSplitWeight", "Compile-info storage is null; check tiling-prepare context initialization."); | ||
| 81 | + }, | ||
| 82 | + return ge::GRAPH_FAILED); | ||
| 57 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo); | 83 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo); |
| 58 | compileInfoPtr->aicNum = ascendcPlatform.GetCoreNumAic(); | 84 | compileInfoPtr->aicNum = ascendcPlatform.GetCoreNumAic(); |
| 59 | ascendcPlatform.GetCoreMemSize(platform_ascendc::CoreMemType::L1, compileInfoPtr->l1Size); | 85 | ascendcPlatform.GetCoreMemSize(platform_ascendc::CoreMemType::L1, compileInfoPtr->l1Size); |
| @@ -9,6 +9,7 @@ | |||
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | #include "../../../common/inc/op_host/op_const_def_nn.h" | 11 | #include "../../../common/inc/op_host/op_const_def_nn.h" |
| 12 | +#include "matmul/common/op_host/matmul_error_report.h" | ||
| 12 | #include "aclnn_rotate_quant.h" | 13 | #include "aclnn_rotate_quant.h" |
| 13 | #include "aclnn_rotate_quant_v2.h" | 14 | #include "aclnn_rotate_quant_v2.h" |
| 14 | #include <algorithm> | 15 | #include <algorithm> |
| @@ -113,14 +114,21 @@ static const std::initializer_list<op::DataType>& GetDtypeSupportList( | |||
| 113 | if (found != socSupportDtypes.end()) { | 114 | if (found != socSupportDtypes.end()) { |
| 114 | return *(found->second); | 115 | return *(found->second); |
| 115 | } | 116 | } |
| 116 | - OP_LOGE(ACLNN_ERR_RUNTIME_ERROR, "support for arch %u is not implemented", static_cast<uint32_t>(curArch)); | 117 | + Ops::NN::ReportMatmulExecutionError( |
| 118 | + kOpName, Ops::NN::FormatString("Architecture %u has no RotateQuant implementation; supported " | ||
| 119 | + "architectures are DAV_2201, DAV_3510, DAV_9201 and DAV_9202.", | ||
| 120 | + static_cast<uint32_t>(curArch)) | ||
| 121 | + .c_str()); | ||
| 117 | return EMPTY_LIST; | 122 | return EMPTY_LIST; |
| 118 | } | 123 | } |
| 119 | 124 | ||
| 120 | static bool CheckOutDtypeValid(const aclTensor* yOut) | 125 | static bool CheckOutDtypeValid(const aclTensor* yOut) |
| 121 | { | 126 | { |
| 122 | auto yDtype = yOut->GetDataType(); | 127 | auto yDtype = yOut->GetDataType(); |
| 123 | - auto outList = GetDtypeSupportList(SOC_OUT_SUPPORT_DTYPES); | 128 | + const auto& outList = GetDtypeSupportList(SOC_OUT_SUPPORT_DTYPES); |
| 129 | + if (outList.size() == 0) { | ||
| 130 | + return false; | ||
| 131 | + } | ||
| 124 | if (std::find(outList.begin(), outList.end(), yDtype) != outList.end()) { | 132 | if (std::find(outList.begin(), outList.end(), yDtype) != outList.end()) { |
| 125 | return true; | 133 | return true; |
| 126 | } | 134 | } |
| @@ -152,6 +160,9 @@ static bool CheckScaleDtypeValid(const aclTensor* scaleOut, const aclTensor* yOu | |||
| 152 | auto yDtype = yOut->GetDataType(); | 160 | auto yDtype = yOut->GetDataType(); |
| 153 | auto scaleDtype = scaleOut->GetDataType(); | 161 | auto scaleDtype = scaleOut->GetDataType(); |
| 154 | const std::initializer_list<op::DataType>* scaleList = &GetDtypeSupportList(SOC_SCALE_SUPPORT_DTYPES); | 162 | const std::initializer_list<op::DataType>* scaleList = &GetDtypeSupportList(SOC_SCALE_SUPPORT_DTYPES); |
| 163 | + if (scaleList->size() == 0) { | ||
| 164 | + return false; | ||
| 165 | + } | ||
| 155 | if (yDtype == static_cast<op::DataType>(Ops::NN::DT_HIFLOAT4)) { | 166 | if (yDtype == static_cast<op::DataType>(Ops::NN::DT_HIFLOAT4)) { |
| 156 | scaleList = &SCALE_DTYPE_SUPPORT_LIST_HIF4; | 167 | scaleList = &SCALE_DTYPE_SUPPORT_LIST_HIF4; |
| 157 | } | 168 | } |
| @@ -190,19 +201,19 @@ static bool CheckNotNull(const aclTensor* x, const aclTensor* rotation, const ac | |||
| 190 | static bool CheckDtypeValid(const aclTensor* x, const aclTensor* rotation, const aclTensor* yOut, | 201 | static bool CheckDtypeValid(const aclTensor* x, const aclTensor* rotation, const aclTensor* yOut, |
| 191 | const aclTensor* scaleOut) | 202 | const aclTensor* scaleOut) |
| 192 | { | 203 | { |
| 193 | - OP_CHECK(CheckType(x->GetDataType(), GetDtypeSupportList(SOC_IN_SUPPORT_DTYPES)), | 204 | + const auto& inList = GetDtypeSupportList(SOC_IN_SUPPORT_DTYPES); |
| 205 | + if (inList.size() == 0) { | ||
| 206 | + return false; | ||
| 207 | + } | ||
| 208 | + OP_CHECK(CheckType(x->GetDataType(), inList), | ||
| 194 | OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON( | 209 | OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON( |
| 195 | kOpName, "x", op::ToString(x->GetDataType()).GetString(), | 210 | kOpName, "x", op::ToString(x->GetDataType()).GetString(), |
| 196 | - FormatString("The dtype of %s must be in %s", "x", | 211 | + FormatString("The dtype of %s must be in %s", "x", op::ToString(inList).GetString()).c_str()), |
| 197 | - op::ToString(GetDtypeSupportList(SOC_IN_SUPPORT_DTYPES)).GetString()) | ||
| 198 | - .c_str()), | ||
| 199 | return false); | 212 | return false); |
| 200 | - OP_CHECK(CheckType(rotation->GetDataType(), GetDtypeSupportList(SOC_IN_SUPPORT_DTYPES)), | 213 | + OP_CHECK(CheckType(rotation->GetDataType(), inList), |
| 201 | OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON( | 214 | OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON( |
| 202 | kOpName, "rotation", op::ToString(rotation->GetDataType()).GetString(), | 215 | kOpName, "rotation", op::ToString(rotation->GetDataType()).GetString(), |
| 203 | - FormatString("The dtype of %s must be in %s", "rotation", | 216 | + FormatString("The dtype of %s must be in %s", "rotation", op::ToString(inList).GetString()).c_str()), |
| 204 | - op::ToString(GetDtypeSupportList(SOC_IN_SUPPORT_DTYPES)).GetString()) | ||
| 205 | - .c_str()), | ||
| 206 | return false); | 217 | return false); |
| 207 | OP_CHECK(x->GetDataType() == rotation->GetDataType(), | 218 | OP_CHECK(x->GetDataType() == rotation->GetDataType(), |
| 208 | OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON( | 219 | OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON( |
| @@ -38,8 +38,12 @@ static std::tuple<aclTensor*, aclTensor*> RotateQuantAICore(const aclTensor* x, | |||
| 38 | auto retAicore = ADD_TO_LAUNCHER_LIST_AICORE( | 38 | auto retAicore = ADD_TO_LAUNCHER_LIST_AICORE( |
| 39 | RotateQuant, OP_INPUT(x, rotation, alpha, groupList), OP_OUTPUT(yOut, scaleOut), | 39 | RotateQuant, OP_INPUT(x, rotation, alpha, groupList), OP_OUTPUT(yOut, scaleOut), |
| 40 | OP_ATTR(dstType, axis, roundMode, scaleAlg, dstTypeMax, trans, groupListType)); | 40 | OP_ATTR(dstType, axis, roundMode, scaleAlg, dstTypeMax, trans, groupListType)); |
| 41 | - OP_CHECK_ADD_TO_LAUNCHER_LIST_AICORE(retAicore != ACLNN_SUCCESS, return std::tuple(nullptr, nullptr), | 41 | + if (retAicore != ACLNN_SUCCESS) { |
| 42 | - "RotateQuant add to aicore launch list failed."); | 42 | + OP_LOGE_WITHOUT_REPORT(ACLNN_ERR_INNER_STATIC_WORKSPACE_INVALID, |
| 43 | + "Failed to add RotateQuant to the AICore launch list, error code: %d.", | ||
| 44 | + static_cast<int>(retAicore)); | ||
| 45 | + return std::tuple(nullptr, nullptr); | ||
| 46 | + } | ||
| 43 | return std::tie(yOut, scaleOut); | 47 | return std::tie(yOut, scaleOut); |
| 44 | } | 48 | } |
| 45 | 49 | ||
| @@ -57,7 +61,9 @@ const std::tuple<aclTensor*, aclTensor*> RotateQuant(const aclTensor* x, const a | |||
| 57 | int64_t M = x->GetViewShape().GetDim(0); | 61 | int64_t M = x->GetViewShape().GetDim(0); |
| 58 | auto scaleAlloc = executor->AllocTensor(op::Shape({M}), op::DataType::DT_FLOAT, op::Format::FORMAT_ND); | 62 | auto scaleAlloc = executor->AllocTensor(op::Shape({M}), op::DataType::DT_FLOAT, op::Format::FORMAT_ND); |
| 59 | if (yAlloc == nullptr || scaleAlloc == nullptr) { | 63 | if (yAlloc == nullptr || scaleAlloc == nullptr) { |
| 60 | - OP_LOGE(ACLNN_ERR_INNER_NULLPTR, "AllocTensor failed for yOut or scaleOut."); | 64 | + OP_LOGE_WITHOUT_REPORT( |
| 65 | + ACLNN_ERR_INNER_NULLPTR, | ||
| 66 | + "Failed to allocate y or scale tensor in RotateQuant; AllocTensor returned nullptr."); | ||
| 61 | return std::tuple(nullptr, nullptr); | 67 | return std::tuple(nullptr, nullptr); |
| 62 | } | 68 | } |
| 63 | yOut = yAlloc; | 69 | yOut = yAlloc; |
| @@ -13,6 +13,8 @@ | |||
| 13 | * \brief | 13 | * \brief |
| 14 | */ | 14 | */ |
| 15 | #include "rotate_quant_tiling.h" | 15 | #include "rotate_quant_tiling.h" |
| 16 | +#include "matmul/common/op_host/log_format_util.h" | ||
| 17 | +#include "matmul/common/op_host/matmul_error_report.h" | ||
| 16 | #include "error_util.h" | 18 | #include "error_util.h" |
| 17 | #include "log/log.h" | 19 | #include "log/log.h" |
| 18 | #include "matmul/common/op_host/op_tiling/debug_tiling.h" | 20 | #include "matmul/common/op_host/op_tiling/debug_tiling.h" |
| @@ -58,17 +60,31 @@ constexpr int64_t SYS_WORKSPACE_SIZE = 16777216; | |||
| 58 | namespace Ops { | 60 | namespace Ops { |
| 59 | namespace NN { | 61 | namespace NN { |
| 60 | namespace RotateQuant { | 62 | namespace RotateQuant { |
| 61 | -ge::graphStatus RotateQuantTiling::GetPlatformInfo() { return ge::GRAPH_SUCCESS; } | 63 | +ge::graphStatus RotateQuantTiling::GetPlatformInfo() |
| 64 | +{ | ||
| 65 | + if (compileInfo_.aicNum == 0) { | ||
| 66 | + OP_LOGE_WITHOUT_REPORT(context_->GetNodeName(), "Platform initialization failed; cannot calculate tiling."); | ||
| 67 | + return ge::GRAPH_FAILED; | ||
| 68 | + } | ||
| 69 | + if (compileInfo_.aivNum == 0) { | ||
| 70 | + Ops::NN::ReportMatmulTilingError( | ||
| 71 | + context_->GetNodeName(), | ||
| 72 | + "Platform vector core count must be positive, got 0; check platform initialization."); | ||
| 73 | + return ge::GRAPH_FAILED; | ||
| 74 | + } | ||
| 75 | + return ge::GRAPH_SUCCESS; | ||
| 76 | +} | ||
| 62 | 77 | ||
| 63 | void RotateQuantTiling::InitCompileInfo() | 78 | void RotateQuantTiling::InitCompileInfo() |
| 64 | { | 79 | { |
| 65 | if (context_ == nullptr) { | 80 | if (context_ == nullptr) { |
| 66 | - OP_LOGE("RotateQuant", "context_ is null"); | 81 | + Ops::NN::ReportMatmulTilingError("RotateQuant", "Tiling context is null; check the tiling invocation."); |
| 67 | return; | 82 | return; |
| 68 | } | 83 | } |
| 69 | auto platformInfoPtr = context_->GetPlatformInfo(); | 84 | auto platformInfoPtr = context_->GetPlatformInfo(); |
| 70 | if (platformInfoPtr == nullptr) { | 85 | if (platformInfoPtr == nullptr) { |
| 71 | - OP_LOGE(context_->GetNodeName(), "platformInfoPtr is null"); | 86 | + Ops::NN::ReportMatmulTilingError(context_->GetNodeName(), |
| 87 | + "Platform information is null; check platform initialization."); | ||
| 72 | return; | 88 | return; |
| 73 | } | 89 | } |
| 74 | 90 | ||
| @@ -83,7 +99,11 @@ void RotateQuantTiling::InitCompileInfo() | |||
| 83 | compileInfo_.aivNum = ascendcPlatform.GetCoreNumAiv(); | 99 | compileInfo_.aivNum = ascendcPlatform.GetCoreNumAiv(); |
| 84 | 100 | ||
| 85 | if (compileInfo_.aicNum <= 0) { | 101 | if (compileInfo_.aicNum <= 0) { |
| 86 | - OP_LOGE(context_->GetNodeName(), "aicNum <= 0"); | 102 | + Ops::NN::ReportMatmulTilingError( |
| 103 | + context_->GetNodeName(), | ||
| 104 | + Ops::NN::FormatString("Platform cube core count must be positive, got %lu; check platform initialization.", | ||
| 105 | + static_cast<unsigned long>(compileInfo_.aicNum)) | ||
| 106 | + .c_str()); | ||
| 87 | return; | 107 | return; |
| 88 | } | 108 | } |
🟡 Medium Priority 变更行: 影响行为:本次 PR 的核心约定是「每个失败出口只做一次首报,包装层只补 PLOG」。这三处现在会向 ErrorManager 注册一个正式错误码,但控制流不会向上传递失败(void 返回值使调用方无法观察失败),tiling 随即继续执行。 失效模式:当平台信息为空或 建议:将 InitCompileInfo 改为返回 ge::graphStatus 并在失败时传播到 DoTiling;或在这些上报后不再继续使用 compileInfo_,避免「已上报错误码但流程继续」导致后续二次首报/除零。 ![]() ![]() Incorrect? | |||
| 89 | OP_LOGD(context_->GetNodeName(), "RotateQuant InitCompileInfo Success"); | 109 | OP_LOGD(context_->GetNodeName(), "RotateQuant InitCompileInfo Success"); |
| @@ -99,15 +119,15 @@ ge::graphStatus RotateQuantTiling::GetShapeAttrsInfo() | |||
| 99 | 119 | ||
| 100 | inputParams_.opName = context_->GetNodeName(); | 120 | inputParams_.opName = context_->GetNodeName(); |
| 101 | OP_LOGI(inputParams_.opName, "TilingContext: %s", Ops::NN::DebugTilingContext(context_).c_str()); | 121 | OP_LOGI(inputParams_.opName, "TilingContext: %s", Ops::NN::DebugTilingContext(context_).c_str()); |
| 102 | - OP_TILING_CHECK(CheckContext() != ge::GRAPH_SUCCESS, OP_LOGE(inputParams_.opName, "Invalid context."), | 122 | + OP_TILING_CHECK(CheckContext() != ge::GRAPH_SUCCESS, |
| 103 | - return ge::GRAPH_FAILED); | 123 | + OP_LOGE_WITHOUT_REPORT(inputParams_.opName, "Invalid context."), return ge::GRAPH_FAILED); |
| 104 | 124 | ||
| 105 | - OP_TILING_CHECK(AnalyzeAttrs() != ge::GRAPH_SUCCESS, OP_LOGE(inputParams_.opName, "Invalid attrs."), | 125 | + OP_TILING_CHECK(AnalyzeAttrs() != ge::GRAPH_SUCCESS, OP_LOGE_WITHOUT_REPORT(inputParams_.opName, "Invalid attrs."), |
| 106 | return ge::GRAPH_FAILED); | 126 | return ge::GRAPH_FAILED); |
| 107 | - OP_TILING_CHECK(AnalyzeDtype() != ge::GRAPH_SUCCESS, OP_LOGE(inputParams_.opName, "Invalid dtypes."), | 127 | + OP_TILING_CHECK(AnalyzeDtype() != ge::GRAPH_SUCCESS, OP_LOGE_WITHOUT_REPORT(inputParams_.opName, "Invalid dtypes."), |
| 108 | - return ge::GRAPH_FAILED); | ||
| 109 | - OP_TILING_CHECK(AnalyzeShapes() != ge::GRAPH_SUCCESS, OP_LOGE(inputParams_.opName, "Invalid shapes."), | ||
| 110 | return ge::GRAPH_FAILED); | 128 | return ge::GRAPH_FAILED); |
| 129 | + OP_TILING_CHECK(AnalyzeShapes() != ge::GRAPH_SUCCESS, | ||
| 130 | + OP_LOGE_WITHOUT_REPORT(inputParams_.opName, "Invalid shapes."), return ge::GRAPH_FAILED); | ||
| 111 | 131 | ||
| 112 | OP_LOGD(inputParams_.opName, "Input params: MNK[%ld, %ld, %ld], numBlocks[%ld].", inputParams_.M, inputParams_.N, | 132 | OP_LOGD(inputParams_.opName, "Input params: MNK[%ld, %ld, %ld], numBlocks[%ld].", inputParams_.M, inputParams_.N, |
| 113 | inputParams_.K, inputParams_.numBlocks); | 133 | inputParams_.K, inputParams_.numBlocks); |
| @@ -121,20 +141,45 @@ ge::graphStatus RotateQuantTiling::CheckContext() | |||
| 121 | OP_TILING_CHECK(context_->GetOptionalInputDesc(GROUP_INDEX) != nullptr, | 141 | OP_TILING_CHECK(context_->GetOptionalInputDesc(GROUP_INDEX) != nullptr, |
| 122 | OP_LOGE(inputParams_.opName, "groupList must be nullptr on this platform."), | 142 | OP_LOGE(inputParams_.opName, "groupList must be nullptr on this platform."), |
| 123 | return ge::GRAPH_FAILED); | 143 | return ge::GRAPH_FAILED); |
| 124 | - OPS_CHECK_NULL_WITH_CONTEXT(context_, context_->GetInputShape(X_INDEX)); | 144 | + OP_CHECK_IF(context_->GetInputShape(X_INDEX) == nullptr, OP_LOGE_WITH_INVALID_INPUT(context_->GetNodeName(), "x"), |
| 125 | - OPS_CHECK_NULL_WITH_CONTEXT(context_, context_->GetInputDesc(X_INDEX)); | 145 | + return ge::GRAPH_FAILED); |
| 126 | - OPS_CHECK_NULL_WITH_CONTEXT(context_, context_->GetInputShape(ROT_INDEX)); | 146 | + OP_CHECK_IF(context_->GetInputDesc(X_INDEX) == nullptr, OP_LOGE_WITH_INVALID_INPUT(context_->GetNodeName(), "x"), |
| 127 | - OPS_CHECK_NULL_WITH_CONTEXT(context_, context_->GetInputDesc(ROT_INDEX)); | 147 | + return ge::GRAPH_FAILED); |
| 128 | - OPS_CHECK_NULL_WITH_CONTEXT(context_, context_->GetOutputShape(Y_INDEX)); | 148 | + OP_CHECK_IF(context_->GetInputShape(ROT_INDEX) == nullptr, |
| 129 | - OPS_CHECK_NULL_WITH_CONTEXT(context_, context_->GetOutputDesc(Y_INDEX)); | 149 | + OP_LOGE_WITH_INVALID_INPUT(context_->GetNodeName(), "rotation"), return ge::GRAPH_FAILED); |
| 130 | - OPS_CHECK_NULL_WITH_CONTEXT(context_, context_->GetOutputShape(SCALE_INDEX)); | 150 | + OP_CHECK_IF(context_->GetInputDesc(ROT_INDEX) == nullptr, |
| 131 | - OPS_CHECK_NULL_WITH_CONTEXT(context_, context_->GetOutputDesc(SCALE_INDEX)); | 151 | + OP_LOGE_WITH_INVALID_INPUT(context_->GetNodeName(), "rotation"), return ge::GRAPH_FAILED); |
| 132 | - OPS_CHECK_NULL_WITH_CONTEXT(context_, context_->GetRawTilingData()); | 152 | + OP_CHECK_IF(context_->GetOutputShape(Y_INDEX) == nullptr, |
| 133 | - OPS_CHECK_NULL_WITH_CONTEXT(context_, context_->GetRawTilingData()->GetData()); | 153 | + Ops::NN::ReportMatmulTilingError(context_->GetNodeName(), |
| 154 | + "Output y shape storage is null; check tiling output initialization."), | ||
| 155 | + return ge::GRAPH_FAILED); | ||
| 156 | + OP_CHECK_IF(context_->GetOutputDesc(Y_INDEX) == nullptr, | ||
| 157 | + Ops::NN::ReportMatmulTilingError(context_->GetNodeName(), | ||
| 158 | + "Output y descriptor is null; check tiling output initialization."), | ||
| 159 | + return ge::GRAPH_FAILED); | ||
| 160 | + OP_CHECK_IF(context_->GetOutputShape(SCALE_INDEX) == nullptr, | ||
| 161 | + Ops::NN::ReportMatmulTilingError( | ||
| 162 | + context_->GetNodeName(), "Output scale shape storage is null; check tiling output initialization."), | ||
| 163 | + return ge::GRAPH_FAILED); | ||
| 164 | + OP_CHECK_IF(context_->GetOutputDesc(SCALE_INDEX) == nullptr, | ||
| 165 | + Ops::NN::ReportMatmulTilingError( | ||
| 166 | + context_->GetNodeName(), "Output scale descriptor is null; check tiling output initialization."), | ||
| 167 | + return ge::GRAPH_FAILED); | ||
| 168 | + OP_CHECK_IF(context_->GetRawTilingData() == nullptr, | ||
| 169 | + Ops::NN::ReportMatmulTilingError( | ||
| 170 | + context_->GetNodeName(), "Raw tiling data storage is null; check tiling output initialization."), | ||
| 171 | + return ge::GRAPH_FAILED); | ||
| 172 | + OP_CHECK_IF(context_->GetRawTilingData()->GetData() == nullptr, | ||
| 173 | + Ops::NN::ReportMatmulTilingError(context_->GetNodeName(), | ||
| 174 | + "Raw tiling data buffer is null; check tiling output initialization."), | ||
| 175 | + return ge::GRAPH_FAILED); | ||
| 134 | OP_TILING_CHECK( | 176 | OP_TILING_CHECK( |
| 135 | context_->GetRawTilingData()->GetCapacity() < tilingDataSize_, | 177 | context_->GetRawTilingData()->GetCapacity() < tilingDataSize_, |
| 136 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, "context tiling data capacity %zu < actual tiling data size %zu.", | 178 | + Ops::NN::ReportMatmulTilingError( |
| 137 | - context_->GetRawTilingData()->GetCapacity(), tilingDataSize_), | 179 | + inputParams_.opName, Ops::NN::FormatString("Tiling buffer capacity %zu bytes is smaller than the " |
| 180 | + "required %zu bytes; check the tiling output buffer.", | ||
| 181 | + context_->GetRawTilingData()->GetCapacity(), tilingDataSize_) | ||
| 182 | + .c_str()), | ||
| 138 | return ge::GRAPH_FAILED); | 183 | return ge::GRAPH_FAILED); |
| 139 | return ge::GRAPH_SUCCESS; | 184 | return ge::GRAPH_SUCCESS; |
| 140 | } | 185 | } |
| @@ -149,15 +194,33 @@ ge::graphStatus RotateQuantTiling::AnalyzeDtype() | |||
| 149 | auto scaleDtype = context_->GetOutputDesc(SCALE_INDEX)->GetDataType(); | 194 | auto scaleDtype = context_->GetOutputDesc(SCALE_INDEX)->GetDataType(); |
| 150 | 195 | ||
| 151 | OP_TILING_CHECK(inputParams_.xDtype != ge::DT_FLOAT16 && inputParams_.xDtype != ge::DT_BF16, | 196 | OP_TILING_CHECK(inputParams_.xDtype != ge::DT_FLOAT16 && inputParams_.xDtype != ge::DT_BF16, |
| 152 | - OP_LOGE(inputParams_.opName, "x dtype should be fp16 or bf16."), return ge::GRAPH_FAILED); | 197 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(inputParams_.opName, "x", |
| 153 | - OP_TILING_CHECK(rotDtype != ge::DT_FLOAT16 && rotDtype != ge::DT_BF16, | 198 | + Ops::Base::ToString(inputParams_.xDtype).c_str(), |
| 154 | - OP_LOGE(inputParams_.opName, "rotation dtype should be fp16 or bf16."), return ge::GRAPH_FAILED); | 199 | + "Supported dtypes are FLOAT16 and BF16."), |
| 155 | - OP_TILING_CHECK(inputParams_.xDtype != rotDtype, | ||
| 156 | - OP_LOGE(inputParams_.opName, "x and rotation dtype should be same."), return ge::GRAPH_FAILED); | ||
| 157 | - OP_TILING_CHECK(inputParams_.yDtype != ge::DT_INT8 && inputParams_.yDtype != ge::DT_INT4, | ||
| 158 | - OP_LOGE(inputParams_.opName, "y dtype should be int8 or int4."), return ge::GRAPH_FAILED); | ||
| 159 | - OP_TILING_CHECK(scaleDtype != ge::DT_FLOAT, OP_LOGE(inputParams_.opName, "scale dtype should be float."), | ||
| 160 | return ge::GRAPH_FAILED); | 200 | return ge::GRAPH_FAILED); |
| 201 | + OP_TILING_CHECK( | ||
| 202 | + rotDtype != ge::DT_FLOAT16 && rotDtype != ge::DT_BF16, | ||
| 203 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(inputParams_.opName, "rotation", Ops::Base::ToString(rotDtype).c_str(), | ||
| 204 | + "Supported dtypes are FLOAT16 and BF16."), | ||
| 205 | + return ge::GRAPH_FAILED); | ||
| 206 | + OP_TILING_CHECK(inputParams_.xDtype != rotDtype, | ||
| 207 | + OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON( | ||
| 208 | + inputParams_.opName, "x, rotation", | ||
| 209 | + Ops::NN::FormatString("%s, %s", Ops::Base::ToString(inputParams_.xDtype).c_str(), | ||
| 210 | + Ops::Base::ToString(rotDtype).c_str()) | ||
| 211 | + .c_str(), | ||
| 212 | + "x and rotation must have the same dtype."), | ||
| 213 | + return ge::GRAPH_FAILED); | ||
| 214 | + OP_TILING_CHECK(inputParams_.yDtype != ge::DT_INT8 && inputParams_.yDtype != ge::DT_INT4, | ||
| 215 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(inputParams_.opName, "y", | ||
| 216 | + Ops::Base::ToString(inputParams_.yDtype).c_str(), | ||
| 217 | + "Supported output dtypes are INT8 and INT4."), | ||
| 218 | + return ge::GRAPH_FAILED); | ||
| 219 | + OP_TILING_CHECK( | ||
| 220 | + scaleDtype != ge::DT_FLOAT, | ||
| 221 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(inputParams_.opName, "scale", Ops::Base::ToString(scaleDtype).c_str(), | ||
| 222 | + "scale must have dtype FLOAT."), | ||
| 223 | + return ge::GRAPH_FAILED); | ||
| 161 | 224 | ||
| 162 | return ge::GRAPH_SUCCESS; | 225 | return ge::GRAPH_SUCCESS; |
| 163 | } | 226 | } |
| @@ -174,36 +237,58 @@ ge::graphStatus RotateQuantTiling::AnalyzeShapes() | |||
| 174 | inputParams_.K = rotShape.GetDim(0); | 237 | inputParams_.K = rotShape.GetDim(0); |
| 175 | int64_t rotK = rotShape.GetDim(1); | 238 | int64_t rotK = rotShape.GetDim(1); |
| 176 | 239 | ||
| 177 | - OP_TILING_CHECK(inputParams_.N % inputParams_.K != 0, | 240 | + OP_TILING_CHECK( |
| 178 | - OP_LOGE(inputParams_.opName, "N(%ld) must be divisible by K(%ld).", inputParams_.N, inputParams_.K), | 241 | + inputParams_.N % inputParams_.K != 0, |
| 179 | - return ge::GRAPH_FAILED); | 242 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( |
| 243 | + inputParams_.opName, "x, rotation", | ||
| 244 | + Ops::NN::FormatString("%s, %s", Ops::Base::ToString(xShape).c_str(), Ops::Base::ToString(rotShape).c_str()) | ||
| 245 | + .c_str(), | ||
| 246 | + "x N must be divisible by rotation K."), | ||
| 247 | + return ge::GRAPH_FAILED); | ||
| 180 | 248 | ||
| 181 | - OP_TILING_CHECK(inputParams_.K != rotK, | 249 | + OP_TILING_CHECK( |
| 182 | - OP_LOGE(inputParams_.opName, "RotK(%ld) must be the same as K(%ld).", rotK, inputParams_.K), | 250 | + inputParams_.K != rotK, |
| 183 | - return ge::GRAPH_FAILED); | 251 | + OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(inputParams_.opName, "rotation", Ops::Base::ToString(rotShape).c_str(), |
| 252 | + "rotation must be a square matrix."), | ||
| 253 | + return ge::GRAPH_FAILED); | ||
| 184 | 254 | ||
| 185 | OP_TILING_CHECK(inputParams_.N > N_MAX || inputParams_.N < N_MIN, | 255 | OP_TILING_CHECK(inputParams_.N > N_MAX || inputParams_.N < N_MIN, |
| 186 | - OP_LOGE(inputParams_.opName, "N(%ld) must be between 128 and 16000.", inputParams_.N), | 256 | + OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(inputParams_.opName, "x", Ops::Base::ToString(xShape).c_str(), |
| 187 | - return ge::GRAPH_FAILED); | 257 | + "x N must be between 128 and 16000."), |
| 188 | - | ||
| 189 | - OP_TILING_CHECK(inputParams_.K > K_MAX || inputParams_.K < K_MIN, | ||
| 190 | - OP_LOGE(inputParams_.opName, "K(%ld) must be between 16 and 1024.", inputParams_.K), | ||
| 191 | return ge::GRAPH_FAILED); | 258 | return ge::GRAPH_FAILED); |
| 192 | 259 | ||
| 260 | + OP_TILING_CHECK( | ||
| 261 | + inputParams_.K > K_MAX || inputParams_.K < K_MIN, | ||
| 262 | + OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(inputParams_.opName, "rotation", Ops::Base::ToString(rotShape).c_str(), | ||
| 263 | + "rotation K must be between 16 and 1024."), | ||
| 264 | + return ge::GRAPH_FAILED); | ||
| 265 | + | ||
| 193 | OP_TILING_CHECK( | 266 | OP_TILING_CHECK( |
| 194 | inputParams_.M != yShape.GetDim(0), | 267 | inputParams_.M != yShape.GetDim(0), |
| 195 | - OP_LOGE(inputParams_.opName, "x dim0(%ld) must be the same as y dim0(%ld).", inputParams_.M, yShape.GetDim(0)), | 268 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( |
| 269 | + inputParams_.opName, "x, y", | ||
| 270 | + Ops::NN::FormatString("%s, %s", Ops::Base::ToString(xShape).c_str(), Ops::Base::ToString(yShape).c_str()) | ||
| 271 | + .c_str(), | ||
| 272 | + "x and y must have equal first dimensions."), | ||
| 196 | return ge::GRAPH_FAILED); | 273 | return ge::GRAPH_FAILED); |
| 197 | 274 | ||
| 198 | OP_TILING_CHECK( | 275 | OP_TILING_CHECK( |
| 199 | inputParams_.N != yShape.GetDim(1), | 276 | inputParams_.N != yShape.GetDim(1), |
| 200 | - OP_LOGE(inputParams_.opName, "x dim1(%ld) must be the same as y dim1(%ld).", inputParams_.N, yShape.GetDim(1)), | 277 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( |
| 278 | + inputParams_.opName, "x, y", | ||
| 279 | + Ops::NN::FormatString("%s, %s", Ops::Base::ToString(xShape).c_str(), Ops::Base::ToString(yShape).c_str()) | ||
| 280 | + .c_str(), | ||
| 281 | + "x and y must have equal second dimensions."), | ||
| 201 | return ge::GRAPH_FAILED); | 282 | return ge::GRAPH_FAILED); |
| 202 | 283 | ||
| 203 | - OP_TILING_CHECK(inputParams_.M != scaleShape.GetDim(0), | 284 | + OP_TILING_CHECK( |
| 204 | - OP_LOGE(inputParams_.opName, "x dim0(%ld) must be the same as scale dim0(%ld).", inputParams_.M, | 285 | + inputParams_.M != scaleShape.GetDim(0), |
| 205 | - scaleShape.GetDim(0)), | 286 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(inputParams_.opName, "x, scale", |
| 206 | - return ge::GRAPH_FAILED); | 287 | + Ops::NN::FormatString("%s, %s", Ops::Base::ToString(xShape).c_str(), |
| 288 | + Ops::Base::ToString(scaleShape).c_str()) | ||
| 289 | + .c_str(), | ||
| 290 | + "x and scale must have equal first dimensions."), | ||
| 291 | + return ge::GRAPH_FAILED); | ||
| 207 | 292 | ||
| 208 | inputParams_.numBlocks = inputParams_.N / inputParams_.K; | 293 | inputParams_.numBlocks = inputParams_.N / inputParams_.K; |
| 209 | 294 | ||
| @@ -267,7 +352,7 @@ ge::graphStatus RotateQuantTiling::CaclVecTilingData() | |||
| 267 | uint32_t stepLoop; | 352 | uint32_t stepLoop; |
| 268 | OP_TILING_CHECK( | 353 | OP_TILING_CHECK( |
| 269 | CalcStepLoop(maxHandleRowsPerUb, loopPerHeadCore, loopPerHeadCubeCore, stepLoop) != ge::GRAPH_SUCCESS, | 354 | CalcStepLoop(maxHandleRowsPerUb, loopPerHeadCore, loopPerHeadCubeCore, stepLoop) != ge::GRAPH_SUCCESS, |
| 270 | - OP_LOGE(inputParams_.opName, "CalcStepLoop failed."), return ge::GRAPH_FAILED); | 355 | + OP_LOGE_WITHOUT_REPORT(inputParams_.opName, "CalcStepLoop failed."), return ge::GRAPH_FAILED); |
| 271 | 356 | ||
| 272 | tilingData_.headCoreNum = headCoreNum; | 357 | tilingData_.headCoreNum = headCoreNum; |
| 273 | tilingData_.rowPerHeadCore = rowPerHeadCore; | 358 | tilingData_.rowPerHeadCore = rowPerHeadCore; |
| @@ -312,7 +397,8 @@ ge::graphStatus RotateQuantTiling::CalcStepLoop(uint32_t maxHandleRowsPerUb, uin | |||
| 312 | stepLoop = std::max( | 397 | stepLoop = std::max( |
| 313 | BASE_M / (static_cast<uint32_t>(inputParams_.numBlocks) * maxHandleRowsPerUb * STEP_LOOP_UB_COEFF), 1U); | 398 | BASE_M / (static_cast<uint32_t>(inputParams_.numBlocks) * maxHandleRowsPerUb * STEP_LOOP_UB_COEFF), 1U); |
| 314 | if (stepLoop == 0) { | 399 | if (stepLoop == 0) { |
| 315 | - OP_LOGE(context_->GetNodeName(), "stepLoop cannot be zero."); | 400 | + Ops::NN::ReportMatmulTilingError( |
| 401 | + context_->GetNodeName(), "Calculated tiling stepLoop is zero; check the tiling loop configuration."); | ||
| 316 | return ge::GRAPH_FAILED; | 402 | return ge::GRAPH_FAILED; |
| 317 | } | 403 | } |
| 318 | if (loopPerHeadCore / stepLoop >= STEP_LOOP_MIN_ITERS_PER_CORE) { | 404 | if (loopPerHeadCore / stepLoop >= STEP_LOOP_MIN_ITERS_PER_CORE) { |
| @@ -345,7 +431,9 @@ bool RotateQuantTiling::SetMatmulTiling() | |||
| 345 | mm.SetShape(rowsPerCore * numBlocks, K, K); | 431 | mm.SetShape(rowsPerCore * numBlocks, K, K); |
| 346 | 432 | ||
| 347 | if (mm.GetTiling(mt) == -1) { | 433 | if (mm.GetTiling(mt) == -1) { |
| 348 | - OP_LOGE(context_->GetNodeName(), "RotateQuant Get Tiling Failed!"); | 434 | + Ops::NN::ReportMatmulTilingError( |
| 435 | + context_->GetNodeName(), | ||
| 436 | + "Matrix multiplication GetTiling returned -1; check the tiling shape and platform resources."); | ||
| 349 | return false; | 437 | return false; |
| 350 | } | 438 | } |
| 351 | 439 | ||
| @@ -378,9 +466,11 @@ bool RotateQuantTiling::SetRotateQuantTiling() { return CaclVecTilingData() == g | |||
| 378 | 466 | ||
| 379 | ge::graphStatus RotateQuantTiling::DoOpTiling() | 467 | ge::graphStatus RotateQuantTiling::DoOpTiling() |
| 380 | { | 468 | { |
| 381 | - OP_LOGE_IF(!SetRotateQuantTiling(), ge::GRAPH_FAILED, "RotateQuant", "SetRotateQuantTiling failed."); | 469 | + OP_CHECK_IF(!SetRotateQuantTiling(), OP_LOGE_WITHOUT_REPORT("RotateQuant", "SetRotateQuantTiling failed."), |
| 470 | + return ge::GRAPH_FAILED); | ||
| 382 | inputParams_.usedCoreNum = tilingData_.aicCoreNum; | 471 | inputParams_.usedCoreNum = tilingData_.aicCoreNum; |
| 383 | - OP_LOGE_IF(!SetMatmulTiling(), ge::GRAPH_FAILED, "RotateQuant", "SetMatmulTiling failed."); | 472 | + OP_CHECK_IF(!SetMatmulTiling(), OP_LOGE_WITHOUT_REPORT("RotateQuant", "SetMatmulTiling failed."), |
| 473 | + return ge::GRAPH_FAILED); | ||
| 384 | PrintTilingData(); | 474 | PrintTilingData(); |
| 385 | return ge::GRAPH_SUCCESS; | 475 | return ge::GRAPH_SUCCESS; |
| 386 | } | 476 | } |
| @@ -403,7 +493,12 @@ ge::graphStatus RotateQuantTiling::PostTiling() | |||
| 403 | errno_t ret = memcpy_s(context_->GetRawTilingData()->GetData(), context_->GetRawTilingData()->GetCapacity(), | 493 | errno_t ret = memcpy_s(context_->GetRawTilingData()->GetData(), context_->GetRawTilingData()->GetCapacity(), |
| 404 | static_cast<void*>(&tilingData_), tilingDataSize_); | 494 | static_cast<void*>(&tilingData_), tilingDataSize_); |
| 405 | if (ret != EOK) { | 495 | if (ret != EOK) { |
| 406 | - OP_LOGE(context_->GetNodeName(), "memcpy_s failed, ret=%d", ret); | 496 | + Ops::NN::ReportMatmulTilingError( |
| 497 | + context_->GetNodeName(), | ||
| 498 | + Ops::NN::FormatString("Failed to serialize tiling data: memcpy_s returned %d, requiredBytes=%zu, " | ||
| 499 | + "capacityBytes=%zu; check the tiling output buffer.", | ||
| 500 | + ret, tilingDataSize_, context_->GetRawTilingData()->GetCapacity()) | ||
| 501 | + .c_str()); | ||
| 407 | return ge::GRAPH_FAILED; | 502 | return ge::GRAPH_FAILED; |
| 408 | } | 503 | } |
| 409 | context_->GetRawTilingData()->SetDataSize(tilingDataSize_); | 504 | context_->GetRawTilingData()->SetDataSize(tilingDataSize_); |
| @@ -416,13 +511,18 @@ REGISTER_TILING_TEMPLATE("RotateQuant", RotateQuantTiling, 0); | |||
| 416 | 511 | ||
| 417 | static ge::graphStatus RotateQuantTilingFunc(gert::TilingContext* context) | 512 | static ge::graphStatus RotateQuantTilingFunc(gert::TilingContext* context) |
| 418 | { | 513 | { |
| 419 | - OP_LOGE_IF(context == nullptr, ge::GRAPH_FAILED, "RotateQuant", "TilingContext is null!"); | 514 | + OP_CHECK_IF(context == nullptr, |
| 515 | + Ops::NN::ReportMatmulTilingError("RotateQuant", "Tiling context is null; check the tiling invocation."), | ||
| 516 | + return ge::GRAPH_FAILED); | ||
| 420 | return Ops::NN::Optiling::TilingRegistry::GetInstance().DoTilingImpl(context); | 517 | return Ops::NN::Optiling::TilingRegistry::GetInstance().DoTilingImpl(context); |
| 421 | } | 518 | } |
| 422 | 519 | ||
| 423 | static ge::graphStatus TilingParseForRotateQuant(gert::TilingParseContext* context) | 520 | static ge::graphStatus TilingParseForRotateQuant(gert::TilingParseContext* context) |
| 424 | { | 521 | { |
| 425 | - OP_LOGE_IF(context == nullptr, ge::GRAPH_FAILED, "RotateQuant", "TilingParseContext is null!"); | 522 | + OP_CHECK_IF(context == nullptr, |
| 523 | + Ops::NN::ReportMatmulTilingError("RotateQuant", | ||
| 524 | + "Tiling parse context is null; check the tiling prepare invocation."), | ||
| 525 | + return ge::GRAPH_FAILED); | ||
| 426 | return ge::GRAPH_SUCCESS; | 526 | return ge::GRAPH_SUCCESS; |
| 427 | } | 527 | } |
| 428 | 528 | ||
| @@ -14,6 +14,8 @@ | |||
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | #include "../../../common/inc/op_host/op_const_def_nn.h" | 16 | #include "../../../common/inc/op_host/op_const_def_nn.h" |
| 17 | +#include "matmul/common/op_host/log_format_util.h" | ||
| 18 | +#include "matmul/common/op_host/matmul_error_report.h" | ||
| 17 | #include "register/op_impl_registry.h" | 19 | #include "register/op_impl_registry.h" |
| 18 | #include "error_util.h" | 20 | #include "error_util.h" |
| 19 | #include "log/log.h" | 21 | #include "log/log.h" |
| @@ -70,14 +72,14 @@ static ge::graphStatus CheckComputeNodeNum(gert::InferShapeContext* context) | |||
| 70 | { | 72 | { |
| 71 | size_t inputNum = context->GetComputeNodeInputNum(); | 73 | size_t inputNum = context->GetComputeNodeInputNum(); |
| 72 | if (inputNum < INPUT_NUM_MIN_ROTATE_QUANT || inputNum > INPUT_NUM_MAX_ROTATE_QUANT) { | 74 | if (inputNum < INPUT_NUM_MIN_ROTATE_QUANT || inputNum > INPUT_NUM_MAX_ROTATE_QUANT) { |
| 73 | - OP_LOGE(context, "Input num must be in [%u, %u], but got %zu", INPUT_NUM_MIN_ROTATE_QUANT, | 75 | + OP_LOGE_FOR_INVALID_TENSORNUMS_WITH_REASON( |
| 74 | - INPUT_NUM_MAX_ROTATE_QUANT, inputNum); | 76 | + context->GetNodeName(), "x, rotation, alpha, group_list", Ops::NN::FormatString("%zu", inputNum).c_str(), |
| 77 | + "Provide x and rotation, with optional alpha and group_list (2 to 4 inputs)."); | ||
| 75 | return ge::GRAPH_FAILED; | 78 | return ge::GRAPH_FAILED; |
| 76 | } | 79 | } |
| 77 | 80 | ||
| 78 | if (context->GetComputeNodeOutputNum() != OUTPUT_NUM_ROTATE_QUANT) { | 81 | if (context->GetComputeNodeOutputNum() != OUTPUT_NUM_ROTATE_QUANT) { |
| 79 | - OP_LOGE(context, "Output num must be %u, but got %zu", OUTPUT_NUM_ROTATE_QUANT, | 82 | + OP_LOGE_FOR_INVALID_TENSORNUM(context->GetNodeName(), "y, scale", context->GetComputeNodeOutputNum(), "2"); |
| 80 | - context->GetComputeNodeOutputNum()); | ||
| 81 | return ge::GRAPH_FAILED; | 83 | return ge::GRAPH_FAILED; |
| 82 | } | 84 | } |
| 83 | 85 | ||
| @@ -92,7 +94,11 @@ static ge::graphStatus InferShapeCheck(gert::InferShapeContext* context) | |||
| 92 | 94 | ||
| 93 | for (uint32_t i = 0; i < OUTPUT_NUM_ROTATE_QUANT; ++i) { | 95 | for (uint32_t i = 0; i < OUTPUT_NUM_ROTATE_QUANT; ++i) { |
| 94 | if (context->GetOutputShape(i) == nullptr) { | 96 | if (context->GetOutputShape(i) == nullptr) { |
| 95 | - OP_LOGE(context, "Output shape %u is nullptr", i); | 97 | + Ops::NN::ReportMatmulInferShapeError( |
| 98 | + context->GetNodeName(), | ||
| 99 | + Ops::NN::FormatString( | ||
| 100 | + "Output shape storage at index %u is null; check InferShape output initialization.", i) | ||
| 101 | + .c_str()); | ||
| 96 | return ge::GRAPH_FAILED; | 102 | return ge::GRAPH_FAILED; |
| 97 | } | 103 | } |
| 98 | } | 104 | } |
| @@ -105,7 +111,9 @@ static ge::graphStatus CheckAlphaShape(gert::InferShapeContext* context) | |||
| 105 | const gert::Shape* alphaShape = context->GetOptionalInputShape(ALPHA_INDEX); | 111 | const gert::Shape* alphaShape = context->GetOptionalInputShape(ALPHA_INDEX); |
| 106 | if (alphaShape != nullptr) { | 112 | if (alphaShape != nullptr) { |
| 107 | if (alphaShape->GetDimNum() != ALPHA_DIM_NUM || alphaShape->GetDim(0) != ALPHA_DIM_SIZE) { | 113 | if (alphaShape->GetDimNum() != ALPHA_DIM_NUM || alphaShape->GetDim(0) != ALPHA_DIM_SIZE) { |
| 108 | - OP_LOGE(context, "alpha shape must be (1), but got %zu dims", alphaShape->GetDimNum()); | 114 | + OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(context->GetNodeName(), "alpha", |
| 115 | + Ops::Base::ToString(*alphaShape).c_str(), | ||
| 116 | + "alpha must have shape [1]."); | ||
| 109 | return ge::GRAPH_FAILED; | 117 | return ge::GRAPH_FAILED; |
| 110 | } | 118 | } |
| 111 | } | 119 | } |
| @@ -118,19 +126,22 @@ static ge::graphStatus CheckInputShape4Int(gert::InferShapeContext* context) | |||
| 118 | const gert::Shape* rotShape = context->GetInputShape(ROT_INDEX); | 126 | const gert::Shape* rotShape = context->GetInputShape(ROT_INDEX); |
| 119 | 127 | ||
| 120 | if (xShape == nullptr || rotShape == nullptr) { | 128 | if (xShape == nullptr || rotShape == nullptr) { |
| 121 | - OP_LOGE(context, "Input shape is nullptr"); | 129 | + OP_LOGE_WITH_INVALID_INPUT(context->GetNodeName(), xShape == nullptr ? "x" : "rotation"); |
| 122 | return ge::GRAPH_FAILED; | 130 | return ge::GRAPH_FAILED; |
| 123 | } | 131 | } |
| 124 | 132 | ||
| 125 | size_t xDimNum = xShape->GetDimNum(); | 133 | size_t xDimNum = xShape->GetDimNum(); |
| 126 | if (xDimNum != DIMENSION_2) { | 134 | if (xDimNum != DIMENSION_2) { |
| 127 | - OP_LOGE(context, "x shape dimension must be 2, but got %zu", xDimNum); | 135 | + OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON(context->GetNodeName(), "x", |
| 136 | + Ops::NN::FormatString("%zu", xDimNum).c_str(), "x must have rank 2."); | ||
| 128 | return ge::GRAPH_FAILED; | 137 | return ge::GRAPH_FAILED; |
| 129 | } | 138 | } |
| 130 | 139 | ||
| 131 | size_t rotDimNum = rotShape->GetDimNum(); | 140 | size_t rotDimNum = rotShape->GetDimNum(); |
| 132 | if (rotDimNum != DIMENSION_2) { | 141 | if (rotDimNum != DIMENSION_2) { |
| 133 | - OP_LOGE(context, "rot shape dimension must be 2, but got %zu", rotDimNum); | 142 | + OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON(context->GetNodeName(), "rotation", |
| 143 | + Ops::NN::FormatString("%zu", rotDimNum).c_str(), | ||
| 144 | + "rotation must have rank 2."); | ||
| 134 | return ge::GRAPH_FAILED; | 145 | return ge::GRAPH_FAILED; |
| 135 | } | 146 | } |
| 136 | 147 | ||
| @@ -138,16 +149,23 @@ static ge::graphStatus CheckInputShape4Int(gert::InferShapeContext* context) | |||
| 138 | int64_t rotK = rotShape->GetDim(0); | 149 | int64_t rotK = rotShape->GetDim(0); |
| 139 | int64_t rotN = rotShape->GetDim(1); | 150 | int64_t rotN = rotShape->GetDim(1); |
| 140 | if (rotK != rotN) { | 151 | if (rotK != rotN) { |
| 141 | - OP_LOGE(context, "rot must be a square matrix, but got shape [%ld, %ld]", rotK, rotN); | 152 | + OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(context->GetNodeName(), "rotation", |
| 153 | + Ops::Base::ToString(*rotShape).c_str(), | ||
| 154 | + "rotation must be a square matrix."); | ||
| 142 | return ge::GRAPH_FAILED; | 155 | return ge::GRAPH_FAILED; |
| 143 | } | 156 | } |
| 144 | 157 | ||
| 145 | if (rotK == 0) { | 158 | if (rotK == 0) { |
| 146 | - OP_LOGE(context, "rot K dimension cannot be zero"); | 159 | + OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(context->GetNodeName(), "rotation", |
| 160 | + Ops::Base::ToString(*rotShape).c_str(), "rotation K must be nonzero."); | ||
| 147 | return ge::GRAPH_FAILED; | 161 | return ge::GRAPH_FAILED; |
| 148 | } | 162 | } |
| 149 | if (xN % rotK != 0) { | 163 | if (xN % rotK != 0) { |
| 150 | - OP_LOGE(context, "x N dimension (%ld) must be divisible by rot K dimension (%ld)", xN, rotK); | 164 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(context->GetNodeName(), "x, rotation", |
| 165 | + Ops::NN::FormatString("%s, %s", Ops::Base::ToString(*xShape).c_str(), | ||
| 166 | + Ops::Base::ToString(*rotShape).c_str()) | ||
| 167 | + .c_str(), | ||
| 168 | + "x N must be divisible by rotation K."); | ||
| 151 | return ge::GRAPH_FAILED; | 169 | return ge::GRAPH_FAILED; |
| 152 | } | 170 | } |
| 153 | return ge::GRAPH_SUCCESS; | 171 | return ge::GRAPH_SUCCESS; |
| @@ -159,14 +177,15 @@ static ge::graphStatus CheckInputShape4Mx(gert::InferShapeContext* context) | |||
| 159 | const gert::Shape* rotShape = context->GetInputShape(ROT_INDEX); | 177 | const gert::Shape* rotShape = context->GetInputShape(ROT_INDEX); |
| 160 | 178 | ||
| 161 | if (xShape == nullptr || rotShape == nullptr) { | 179 | if (xShape == nullptr || rotShape == nullptr) { |
| 162 | - OP_LOGE(context, "Input shape is nullptr"); | 180 | + OP_LOGE_WITH_INVALID_INPUT(context->GetNodeName(), xShape == nullptr ? "x" : "rotation"); |
| 163 | return ge::GRAPH_FAILED; | 181 | return ge::GRAPH_FAILED; |
| 164 | } | 182 | } |
| 165 | 183 | ||
| 166 | size_t xDimNum = xShape->GetDimNum(); | 184 | size_t xDimNum = xShape->GetDimNum(); |
| 167 | if (xDimNum < MIN_X_DIM_NUM || xDimNum > MAX_X_DIM_NUM) { | 185 | if (xDimNum < MIN_X_DIM_NUM || xDimNum > MAX_X_DIM_NUM) { |
| 168 | - OP_LOGE(context, "For mxfp8, x shape dimension must be in [%d, %d], but got %zu", MIN_X_DIM_NUM, MAX_X_DIM_NUM, | 186 | + OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON(context->GetNodeName(), "x", |
| 169 | - xDimNum); | 187 | + Ops::NN::FormatString("%zu", xDimNum).c_str(), |
| 188 | + "For MXFP output, x must have rank between 1 and 7."); | ||
| 170 | return ge::GRAPH_FAILED; | 189 | return ge::GRAPH_FAILED; |
| 171 | } | 190 | } |
| 172 | 191 | ||
| @@ -175,8 +194,12 @@ static ge::graphStatus CheckInputShape4Mx(gert::InferShapeContext* context) | |||
| 175 | const size_t minRotRank = groupShape != nullptr ? 3 : MIN_ROT_DIM_NUM; | 194 | const size_t minRotRank = groupShape != nullptr ? 3 : MIN_ROT_DIM_NUM; |
| 176 | const size_t maxRotRank = groupShape != nullptr ? 4 : MAX_ROT_DIM_NUM; | 195 | const size_t maxRotRank = groupShape != nullptr ? 4 : MAX_ROT_DIM_NUM; |
| 177 | if (rotDimNum < minRotRank || rotDimNum > maxRotRank) { | 196 | if (rotDimNum < minRotRank || rotDimNum > maxRotRank) { |
| 178 | - OP_LOGE(context, "For mxfp8, rot shape dimension must be in [%zu, %zu], but got %zu", minRotRank, maxRotRank, | 197 | + OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON( |
| 179 | - rotDimNum); | 198 | + context->GetNodeName(), "rotation", Ops::NN::FormatString("%zu", rotDimNum).c_str(), |
| 199 | + Ops::NN::FormatString( | ||
| 200 | + "For MXFP output, rotation rank must be between %zu and %zu for the selected group mode.", minRotRank, | ||
| 201 | + maxRotRank) | ||
| 202 | + .c_str()); | ||
| 180 | return ge::GRAPH_FAILED; | 203 | return ge::GRAPH_FAILED; |
| 181 | } | 204 | } |
| 182 | 205 | ||
| @@ -185,16 +208,23 @@ static ge::graphStatus CheckInputShape4Mx(gert::InferShapeContext* context) | |||
| 185 | int64_t rotSecondLastDim = rotShape->GetDim(rotDimNum - 2); | 208 | int64_t rotSecondLastDim = rotShape->GetDim(rotDimNum - 2); |
| 186 | 209 | ||
| 187 | if (rotSecondLastDim != rotLastDim) { | 210 | if (rotSecondLastDim != rotLastDim) { |
| 188 | - OP_LOGE(context, "rot last two dimensions must be equal, but got [%ld, %ld]", rotSecondLastDim, rotLastDim); | 211 | + OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(context->GetNodeName(), "rotation", |
| 212 | + Ops::Base::ToString(*rotShape).c_str(), | ||
| 213 | + "The last two dimensions of rotation must be equal."); | ||
| 189 | return ge::GRAPH_FAILED; | 214 | return ge::GRAPH_FAILED; |
| 190 | } | 215 | } |
| 191 | 216 | ||
| 192 | if (rotLastDim == 0) { | 217 | if (rotLastDim == 0) { |
| 193 | - OP_LOGE(context, "rot K dimension cannot be zero"); | 218 | + OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(context->GetNodeName(), "rotation", |
| 219 | + Ops::Base::ToString(*rotShape).c_str(), "rotation K must be nonzero."); | ||
| 194 | return ge::GRAPH_FAILED; | 220 | return ge::GRAPH_FAILED; |
| 195 | } | 221 | } |
| 196 | if (xN % rotLastDim != 0) { | 222 | if (xN % rotLastDim != 0) { |
| 197 | - OP_LOGE(context, "x last dimension (%ld) must be divisible by rot K dimension (%ld)", xN, rotLastDim); | 223 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(context->GetNodeName(), "x, rotation", |
| 224 | + Ops::NN::FormatString("%s, %s", Ops::Base::ToString(*xShape).c_str(), | ||
| 225 | + Ops::Base::ToString(*rotShape).c_str()) | ||
| 226 | + .c_str(), | ||
| 227 | + "The last dimension of x must be divisible by rotation K."); | ||
| 198 | return ge::GRAPH_FAILED; | 228 | return ge::GRAPH_FAILED; |
| 199 | } | 229 | } |
| 200 | 230 | ||
| @@ -218,7 +248,12 @@ static ge::graphStatus CheckInputShape4Mx(gert::InferShapeContext* context) | |||
| 218 | int64_t nKRatio = xN / rotLastDim; | 248 | int64_t nKRatio = xN / rotLastDim; |
| 219 | int64_t rotFirstDim = rotShape->GetDim(0); | 249 | int64_t rotFirstDim = rotShape->GetDim(0); |
| 220 | if (rotFirstDim != nKRatio) { | 250 | if (rotFirstDim != nKRatio) { |
| 221 | - OP_LOGE(context, "For 3D rot, first dimension (%ld) must equal N/K (%ld)", rotFirstDim, nKRatio); | 251 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( |
| 252 | + context->GetNodeName(), "x, rotation", | ||
| 253 | + Ops::NN::FormatString("%s, %s", Ops::Base::ToString(*xShape).c_str(), | ||
| 254 | + Ops::Base::ToString(*rotShape).c_str()) | ||
| 255 | + .c_str(), | ||
| 256 | + "For a 3D rotation, its first dimension must equal x N divided by rotation K."); | ||
| 222 | return ge::GRAPH_FAILED; | 257 | return ge::GRAPH_FAILED; |
| 223 | } | 258 | } |
| 224 | } | 259 | } |
| @@ -279,6 +314,8 @@ static ge::graphStatus InferShape4Mx(gert::InferShapeContext* context) | |||
| 279 | static ge::graphStatus RotateQuantInferShape(gert::InferShapeContext* context) | 314 | static ge::graphStatus RotateQuantInferShape(gert::InferShapeContext* context) |
| 280 | { | 315 | { |
| 281 | if (context == nullptr) { | 316 | if (context == nullptr) { |
| 317 | + Ops::NN::ReportMatmulInferShapeError("RotateQuant", | ||
| 318 | + "InferShape context is null; check the shape inference invocation."); | ||
| 282 | return ge::GRAPH_FAILED; | 319 | return ge::GRAPH_FAILED; |
| 283 | } | 320 | } |
| 284 | OP_LOGD(context->GetNodeName(), "Begin to do InferShape RotateQuant"); | 321 | OP_LOGD(context->GetNodeName(), "Begin to do InferShape RotateQuant"); |
| @@ -303,19 +340,23 @@ static ge::graphStatus RotateQuantInferShape(gert::InferShapeContext* context) | |||
| 303 | if (yDtype == ge::DT_FLOAT4_E2M1 || yDtype == ge::DT_FLOAT8_E4M3FN || yDtype == ge::DT_FLOAT8_E5M2 || | 340 | if (yDtype == ge::DT_FLOAT4_E2M1 || yDtype == ge::DT_FLOAT8_E4M3FN || yDtype == ge::DT_FLOAT8_E5M2 || |
| 304 | yDtype == Ops::NN::DT_HIFLOAT4) { | 341 | yDtype == Ops::NN::DT_HIFLOAT4) { |
| 305 | OP_CHECK_IF(CheckInputShape4Mx(context) == ge::GRAPH_FAILED, | 342 | OP_CHECK_IF(CheckInputShape4Mx(context) == ge::GRAPH_FAILED, |
| 306 | - OP_LOGE(context, "Invalid input shape for mxfp8"), return ge::GRAPH_FAILED); | 343 | + OP_LOGE_WITHOUT_REPORT(context, "Invalid input shape for mxfp8"), return ge::GRAPH_FAILED); |
| 307 | return InferShape4Mx(context); | 344 | return InferShape4Mx(context); |
| 308 | } else { | 345 | } else { |
| 309 | - OP_LOGE(context, | 346 | + OP_LOGE_FOR_INVALID_VALUE_WITH_REASON( |
| 310 | - "For dav3510, y_dtype must be float4_e2m1, float8_e4m3fn, float8_e5m2 or hifloat4, but got %d", | 347 | + context->GetNodeName(), "y_dtype", Ops::NN::FormatString("%d", static_cast<int32_t>(yDtype)).c_str(), |
| 311 | - static_cast<int32_t>(yDtype)); | 348 | + "For this platform, supported output dtypes are FLOAT4_E2M1, FLOAT8_E4M3FN, FLOAT8_E5M2 and HIFLOAT4."); |
| 312 | return ge::GRAPH_FAILED; | 349 | return ge::GRAPH_FAILED; |
| 313 | } | 350 | } |
| 314 | } else { | 351 | } else { |
| 315 | - OP_CHECK_IF(std::find(INT_OUT_TYPE_LIST.begin(), INT_OUT_TYPE_LIST.end(), yDtype) == INT_OUT_TYPE_LIST.end(), | 352 | + OP_CHECK_IF( |
| 316 | - OP_LOGE(context, "For ascend910b, y_dtype only support int4, int8"), return ge::GRAPH_FAILED); | 353 | + std::find(INT_OUT_TYPE_LIST.begin(), INT_OUT_TYPE_LIST.end(), yDtype) == INT_OUT_TYPE_LIST.end(), |
| 317 | - OP_CHECK_IF(CheckInputShape4Int(context) == ge::GRAPH_FAILED, OP_LOGE(context, "Invalid input shape for int"), | 354 | + OP_LOGE_FOR_INVALID_VALUE_WITH_REASON(context->GetNodeName(), "y_dtype", |
| 318 | - return ge::GRAPH_FAILED); | 355 | + Ops::NN::FormatString("%d", static_cast<int32_t>(yDtype)).c_str(), |
| 356 | + "For Ascend910B, supported output dtypes are INT4 and INT8."), | ||
| 357 | + return ge::GRAPH_FAILED); | ||
| 358 | + OP_CHECK_IF(CheckInputShape4Int(context) == ge::GRAPH_FAILED, | ||
| 359 | + OP_LOGE_WITHOUT_REPORT(context, "Invalid input shape for int"), return ge::GRAPH_FAILED); | ||
| 319 | return InferShape4Int(context); | 360 | return InferShape4Int(context); |
| 320 | } | 361 | } |
| 321 | } | 362 | } |
| @@ -323,6 +364,8 @@ static ge::graphStatus RotateQuantInferShape(gert::InferShapeContext* context) | |||
| 323 | static ge::graphStatus RotateQuantInferDataType(gert::InferDataTypeContext* context) | 364 | static ge::graphStatus RotateQuantInferDataType(gert::InferDataTypeContext* context) |
| 324 | { | 365 | { |
| 325 | if (context == nullptr) { | 366 | if (context == nullptr) { |
| 367 | + Ops::NN::ReportMatmulInferShapeError("RotateQuant", | ||
| 368 | + "InferDataType context is null; check the dtype inference invocation."); | ||
| 326 | return ge::GRAPH_FAILED; | 369 | return ge::GRAPH_FAILED; |
| 327 | } | 370 | } |
| 328 | 371 | ||
| @@ -348,12 +391,18 @@ static ge::graphStatus RotateQuantInferDataType(gert::InferDataTypeContext* cont | |||
| 348 | context->SetOutputDataType(Y_INDEX, Ops::NN::DT_HIFLOAT4); | 391 | context->SetOutputDataType(Y_INDEX, Ops::NN::DT_HIFLOAT4); |
| 349 | context->SetOutputDataType(SCALE_INDEX, Ops::NN::DT_HIFLOAT4_SCALE); | 392 | context->SetOutputDataType(SCALE_INDEX, Ops::NN::DT_HIFLOAT4_SCALE); |
| 350 | } else { | 393 | } else { |
| 351 | - OP_LOGE(context, "For dav3510, y_dtype must be float4_e2m1, float8_e4m3fn, float8_e5m2 or hifloat4"); | 394 | + OP_LOGE_FOR_INVALID_VALUE_WITH_REASON( |
| 395 | + context->GetNodeName(), "y_dtype", Ops::NN::FormatString("%d", static_cast<int32_t>(yDtype)).c_str(), | ||
| 396 | + "For this platform, supported output dtypes are FLOAT4_E2M1, FLOAT8_E4M3FN, FLOAT8_E5M2 and HIFLOAT4."); | ||
| 352 | return ge::GRAPH_FAILED; | 397 | return ge::GRAPH_FAILED; |
| 353 | } | 398 | } |
| 354 | } else { | 399 | } else { |
| 355 | - OP_CHECK_IF(std::find(INT_OUT_TYPE_LIST.begin(), INT_OUT_TYPE_LIST.end(), yDtype) == INT_OUT_TYPE_LIST.end(), | 400 | + OP_CHECK_IF( |
| 356 | - OP_LOGE(context, "For ascend910b, y_dtype only support int4, int8"), return ge::GRAPH_FAILED); | 401 | + std::find(INT_OUT_TYPE_LIST.begin(), INT_OUT_TYPE_LIST.end(), yDtype) == INT_OUT_TYPE_LIST.end(), |
| 402 | + OP_LOGE_FOR_INVALID_VALUE_WITH_REASON(context->GetNodeName(), "y_dtype", | ||
| 403 | + Ops::NN::FormatString("%d", static_cast<int32_t>(yDtype)).c_str(), | ||
| 404 | + "For Ascend910B, supported output dtypes are INT4 and INT8."), | ||
| 405 | + return ge::GRAPH_FAILED); | ||
| 357 | context->SetOutputDataType(Y_INDEX, yDtype); | 406 | context->SetOutputDataType(Y_INDEX, yDtype); |
| 358 | context->SetOutputDataType(SCALE_INDEX, ge::DT_FLOAT); | 407 | context->SetOutputDataType(SCALE_INDEX, ge::DT_FLOAT); |
| 359 | } | 408 | } |


请问这里由 OP_LOGE_WITHOUT_REPORT 换成 OP_LOGE_LIBOPAPI_REPORT 是否会和紧随其后的 REPORT_PREDEFINED_ERR_MSG 重复上报。