已合并
QBMMV4 算子 OPLOGE 整改 #4881
liuyang_806创建于 5月15日
QBMMV4 算子 OPLOGE 整改 #4881
已合并
共 10 个文件变更+445-423
| @@ -161,9 +161,7 @@ ge::graphStatus AdaptiveSlidingWindowBasicTilingV4::CheckContext() | |||
| 161 | auto outputShape = context_->GetOutputShape(0); | 161 | auto outputShape = context_->GetOutputShape(0); |
| 162 | auto outputDesc = context_->GetOutputDesc(0); | 162 | auto outputDesc = context_->GetOutputDesc(0); |
| 163 | auto attrs = context_->GetAttrs(); | 163 | auto attrs = context_->GetAttrs(); |
| 164 | - OP_TILING_CHECK( | 164 | + OPS_CHECK_NULL_WITH_CONTEXT(context_, attrs); |
| 165 | - attrs == nullptr, CUBE_INNER_ERR_REPORT(inputParams_.opName, "Function context_->GetAttrs() failed!"), | ||
| 166 | - return ge::GRAPH_FAILED); | ||
| 167 | auto dtypeAttr = attrs->GetAttrPointer<int64_t>(0); | 165 | auto dtypeAttr = attrs->GetAttrPointer<int64_t>(0); |
| 168 | 166 | ||
| 169 | OPS_CHECK_NULL_WITH_CONTEXT(context_, x1Shape); | 167 | OPS_CHECK_NULL_WITH_CONTEXT(context_, x1Shape); |
| @@ -177,7 +175,7 @@ ge::graphStatus AdaptiveSlidingWindowBasicTilingV4::CheckContext() | |||
| 177 | OPS_CHECK_NULL_WITH_CONTEXT(context_, context_->GetRawTilingData()->GetData()); | 175 | OPS_CHECK_NULL_WITH_CONTEXT(context_, context_->GetRawTilingData()->GetData()); |
| 178 | OP_TILING_CHECK( | 176 | OP_TILING_CHECK( |
| 179 | context_->GetRawTilingData()->GetCapacity() < tilingDataSize_, | 177 | context_->GetRawTilingData()->GetCapacity() < tilingDataSize_, |
| 180 | - CUBE_INNER_ERR_REPORT( | 178 | + OP_LOGE( |
| 181 | inputParams_.opName, "context tiling data capacity %zu < actual tiling data size %zu.", | 179 | inputParams_.opName, "context tiling data capacity %zu < actual tiling data size %zu.", |
| 182 | context_->GetRawTilingData()->GetCapacity(), tilingDataSize_), | 180 | context_->GetRawTilingData()->GetCapacity(), tilingDataSize_), |
| 183 | return ge::GRAPH_FAILED); | 181 | return ge::GRAPH_FAILED); |
| @@ -223,24 +221,21 @@ bool AdaptiveSlidingWindowBasicTilingV4::CheckInputValidInPertileMode( | |||
| 223 | bool AdaptiveSlidingWindowBasicTilingV4::CheckGroupValidInPertileMode() const | 221 | bool AdaptiveSlidingWindowBasicTilingV4::CheckGroupValidInPertileMode() const |
| 224 | { | 222 | { |
| 225 | OP_TILING_CHECK(inputParams_.groupSizeM != 1, | 223 | OP_TILING_CHECK(inputParams_.groupSizeM != 1, |
| 226 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, | 224 | + OP_LOGE_FOR_INVALID_VALUE_WITH_REASON( |
| 227 | - "In G-B quantification, input or infered groupSizeM should be 1, but now is %lu, \ | 225 | + inputParams_.opName, "groupSizeM", std::to_string(inputParams_.groupSizeM).c_str(), |
| 228 | -groupSizeM = (groupSize >> 32) & 0xFFFF.", | 226 | + "When the quant mode is G-B, the value of groupSizeM must be 1"), |
| 229 | - inputParams_.groupSizeM), | ||
| 230 | return false); | 227 | return false); |
| 231 | OP_TILING_CHECK(inputParams_.groupSizeK != PER_BLOCK_SIZE, | 228 | OP_TILING_CHECK(inputParams_.groupSizeK != PER_BLOCK_SIZE, |
| 232 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, | 229 | + OP_LOGE_FOR_INVALID_VALUE_WITH_REASON( |
| 233 | - "In G-B quantification, input or infered groupSizeK should be 128, but now is %lu, \ | 230 | + inputParams_.opName, "groupSizeK", std::to_string(inputParams_.groupSizeK).c_str(), |
| 234 | -groupSizeK = groupSize & 0xFFFF.", | 231 | + "When the quant mode is G-B, the value of groupSizeK must be 128"), |
| 235 | - inputParams_.groupSizeK), | ||
| 236 | return false); | 232 | return false); |
| 237 | OP_TILING_CHECK(inputParams_.groupSizeN != PER_BLOCK_SIZE, | 233 | OP_TILING_CHECK(inputParams_.groupSizeN != PER_BLOCK_SIZE, |
| 238 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, | 234 | + OP_LOGE_FOR_INVALID_VALUE_WITH_REASON( |
| 239 | - "In G-B quantification, input or infered groupSizeN should be 128, but now is %lu, \ | 235 | + inputParams_.opName, "groupSizeN", std::to_string(inputParams_.groupSizeN).c_str(), |
| 240 | -groupSizeN = (groupSize >> 16) & 0xFFFF.", | 236 | + "When the quant mode is G-B, the value of groupSizeN must be 128"), |
| 241 | - inputParams_.groupSizeN), | ||
| 242 | return false); | 237 | return false); |
| 243 | - return true; | 238 | + return true; |
| 244 | } | 239 | } |
| 245 | 240 | ||
| 246 | bool AdaptiveSlidingWindowBasicTilingV4::CheckShapeValidInPertileMode(const gert::Shape& scaleShape, | 241 | bool AdaptiveSlidingWindowBasicTilingV4::CheckShapeValidInPertileMode(const gert::Shape& scaleShape, |
| @@ -254,13 +249,9 @@ bool AdaptiveSlidingWindowBasicTilingV4::CheckShapeValidInPertileMode(const gert | |||
| 254 | static_cast<uint64_t>(scaleShape.GetDim(x2ShapeLen - 2)) || | 249 | static_cast<uint64_t>(scaleShape.GetDim(x2ShapeLen - 2)) || |
| 255 | ops::CeilDiv(static_cast<uint64_t>(x2Shape.GetDim(x2ShapeLen - 1)), PER_BLOCK_SIZE) != | 250 | ops::CeilDiv(static_cast<uint64_t>(x2Shape.GetDim(x2ShapeLen - 1)), PER_BLOCK_SIZE) != |
| 256 | static_cast<uint64_t>(scaleShape.GetDim(x2ShapeLen - 1))), | 251 | static_cast<uint64_t>(scaleShape.GetDim(x2ShapeLen - 1))), |
| 257 | - CUBE_INNER_ERR_REPORT( | 252 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( |
| 258 | - inputParams_.opName, | 253 | + inputParams_.opName, "scale, x2", "scaleShape[-1], scaleShape[-2]", |
| 259 | - "In G-B quantification, the size of last two dimensions of scale should be both equal to \ | 254 | + "When the quant mode is G-B, the shape of scale must be equal to ceilDiv(x2Shape, 128)"), |
| 260 | -the size of last two dimensions of x2 ceildivided by groupSize 128, but now, \ | ||
| 261 | -scaleShape[-1] is %ld, x2Shape[-1] is %ld, scaleShape[-2] is %ld, x2Shape[-2] is %ld.", | ||
| 262 | - scaleShape.GetDim(x2ShapeLen - 1), x2Shape.GetDim(x2ShapeLen - 1), | ||
| 263 | - scaleShape.GetDim(x2ShapeLen - 2), x2Shape.GetDim(x2ShapeLen - 2)), | ||
| 264 | return false); | 255 | return false); |
| 265 | int64_t x1MIndex = inputParams_.transA ? (x1ShapeLen - 1) : (x1ShapeLen - 2); | 256 | int64_t x1MIndex = inputParams_.transA ? (x1ShapeLen - 1) : (x1ShapeLen - 2); |
| 266 | int64_t x1KIndex = inputParams_.transA ? (x1ShapeLen - 2) : (x1ShapeLen - 1); | 257 | int64_t x1KIndex = inputParams_.transA ? (x1ShapeLen - 2) : (x1ShapeLen - 1); |
| @@ -270,21 +261,15 @@ scaleShape[-1] is %ld, x2Shape[-1] is %ld, scaleShape[-2] is %ld, x2Shape[-2] is | |||
| 270 | uint64_t scaleX1K = pertoken.GetDim(x1KIndex); | 261 | uint64_t scaleX1K = pertoken.GetDim(x1KIndex); |
| 271 | OP_TILING_CHECK( | 262 | OP_TILING_CHECK( |
| 272 | (ops::CeilDiv(x1M, inputParams_.groupSizeM) != scaleX1M), | 263 | (ops::CeilDiv(x1M, inputParams_.groupSizeM) != scaleX1M), |
| 273 | - CUBE_INNER_ERR_REPORT( | 264 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( |
| 274 | - inputParams_.opName, | 265 | + inputParams_.opName, "x1, pertokenScale", "m dim mismatch", |
| 275 | - "In G-B quantification, the m dimension size of x1 ceildivided by groupSizeM should be equal to \ | 266 | + "When the quant mode is G-B, the m dim of pertokenScale must be equal to CeilDiv(x1M, groupSizeM)"), |
| 276 | -the m dimension size of pertokenScale, but now, groupSizeM is %lu, \ | ||
| 277 | -m dimension size of pertokenScale is %lu, m dimension size of x1Shape is %lu.", | ||
| 278 | - inputParams_.groupSizeM, scaleX1M, x1M), | ||
| 279 | return false); | 267 | return false); |
| 280 | OP_TILING_CHECK( | 268 | OP_TILING_CHECK( |
| 281 | (ops::CeilDiv(x1K, inputParams_.groupSizeK) != scaleX1K), | 269 | (ops::CeilDiv(x1K, inputParams_.groupSizeK) != scaleX1K), |
| 282 | - CUBE_INNER_ERR_REPORT( | 270 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( |
| 283 | - inputParams_.opName, | 271 | + inputParams_.opName, "x1, pertokenScale", "k dim mismatch", |
| 284 | - "In G-B quantification, the k dimension size of x1 ceildivided by groupSizeK should be equal to \ | 272 | + "When the quant mode is G-B, the k dim of pertokenScale must be equal to CeilDiv(x1K, groupSizeK)"), |
| 285 | -the k dimension size of pertokenScale, but now, groupSizeK is %lu, \ | ||
| 286 | -k dimension size of pertokenScale is %lu, k dimension size of x1Shape is %lu.", | ||
| 287 | - inputParams_.groupSizeK, scaleX1K, x1K), | ||
| 288 | return false); | 273 | return false); |
| 289 | return true; | 274 | return true; |
| 290 | } | 275 | } |
| @@ -292,20 +277,16 @@ k dimension size of pertokenScale is %lu, k dimension size of x1Shape is %lu.", | |||
| 292 | bool AdaptiveSlidingWindowBasicTilingV4::CheckDimValidInPertileMode(size_t x1ShapeLen, size_t x2ShapeLen, | 277 | bool AdaptiveSlidingWindowBasicTilingV4::CheckDimValidInPertileMode(size_t x1ShapeLen, size_t x2ShapeLen, |
| 293 | size_t pertokenShapeLen, size_t scaleShapeLen) const | 278 | size_t pertokenShapeLen, size_t scaleShapeLen) const |
| 294 | { | 279 | { |
| 295 | - OP_TILING_CHECK(scaleShapeLen != x2ShapeLen, | 280 | + OP_TILING_CHECK( |
| 296 | - CUBE_INNER_ERR_REPORT( | 281 | + scaleShapeLen != x2ShapeLen, |
| 297 | - inputParams_.opName, | 282 | + OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON(inputParams_.opName, "x2, scale", "dimension count mismatch", |
| 298 | - "In G-B quantification, x2 dimension and scale dimension should be equal, \ | 283 | + "The shape dims of x2 and scale must be equal"), |
| 299 | -but x2 dimension is: %zu, scale dimension is: %zu.", | 284 | + return false); |
| 300 | - x2ShapeLen, scaleShapeLen), | ||
| 301 | - return false); | ||
| 302 | OP_TILING_CHECK( | 285 | OP_TILING_CHECK( |
| 303 | pertokenShapeLen != x1ShapeLen, | 286 | pertokenShapeLen != x1ShapeLen, |
| 304 | - CUBE_INNER_ERR_REPORT( | 287 | + OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON( |
| 305 | - inputParams_.opName, | 288 | + inputParams_.opName, "x1, pertokenScale", "dimension count mismatch", |
| 306 | - "In G-B quantification, x1 dimension and pertoken dimension should be equal, \ | 289 | + "The shape dims of x1 and pertokenScale must be equal"), |
| 307 | -but x1 dimension is: %zu, pertoken dimension is: %zu.", | ||
| 308 | - x1ShapeLen, pertokenShapeLen), | ||
| 309 | return false); | 290 | return false); |
| 310 | return true; | 291 | return true; |
| 311 | } | 292 | } |
| @@ -318,20 +299,22 @@ bool AdaptiveSlidingWindowBasicTilingV4::CheckBatchValidInPertileMode(const gert | |||
| 318 | auto x1ShapeLen = x1Shape.GetDimNum(); | 299 | auto x1ShapeLen = x1Shape.GetDimNum(); |
| 319 | if (x2ShapeLen > DIM_NUM_TWO) { | 300 | if (x2ShapeLen > DIM_NUM_TWO) { |
| 320 | for (size_t i = 0; i < x2ShapeLen - DIM_NUM_TWO; ++i) { | 301 | for (size_t i = 0; i < x2ShapeLen - DIM_NUM_TWO; ++i) { |
| 321 | - OP_TILING_CHECK(scaleShape.GetDim(i) != x2Shape.GetDim(i), | 302 | + OP_TILING_CHECK( |
| 322 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, | 303 | + scaleShape.GetDim(i) != x2Shape.GetDim(i), |
| 323 | - "In G-B quantification, x2 batch and scale batch should be equal," | 304 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( |
| 324 | - "but at dimension %zu, x2 batch: %ld, scale batch: %ld.", | 305 | + inputParams_.opName, "x2, scale", "batch dim mismatch", |
| 325 | - i, x2Shape.GetDim(i), scaleShape.GetDim(i)), return false); | 306 | + "When the quant mode is G-B, the batch dims of x2 and scale must be equal"), |
| 307 | + return false); | ||
| 326 | } | 308 | } |
| 327 | } | 309 | } |
| 328 | if (x1ShapeLen > DIM_NUM_TWO) { | 310 | if (x1ShapeLen > DIM_NUM_TWO) { |
| 329 | for (size_t i = 0; i < x1ShapeLen - DIM_NUM_TWO; ++i) { | 311 | for (size_t i = 0; i < x1ShapeLen - DIM_NUM_TWO; ++i) { |
| 330 | - OP_TILING_CHECK(pertoken.GetDim(i) != x1Shape.GetDim(i), | 312 | + OP_TILING_CHECK( |
| 331 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, | 313 | + pertoken.GetDim(i) != x1Shape.GetDim(i), |
| 332 | - "In G-B quantification, x1 batch and pertoken batch should be equal," | 314 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( |
| 333 | - "but at dimension %zu, x1 batch: %ld, pertoken batch: %ld.", | 315 | + inputParams_.opName, "x1, pertokenScale", "batch dim mismatch", |
| 334 | - i, x1Shape.GetDim(i), pertoken.GetDim(i)), return false); | 316 | + "When the quant mode is G-B, the batch dims of x1 and pertokenScale must be equal"), |
| 317 | + return false); | ||
| 335 | } | 318 | } |
| 336 | } | 319 | } |
| 337 | return true; | 320 | return true; |
| @@ -343,7 +326,7 @@ bool AdaptiveSlidingWindowBasicTilingV4::CheckBatchValidInPertileMode(const gert | |||
| 343 | InitCompileInfo(); | 326 | InitCompileInfo(); |
| 344 | auto mmCompileInfo = reinterpret_cast<const QuantBatchMatmulV4CompileInfo *>(context_->GetCompileInfo()); | 327 | auto mmCompileInfo = reinterpret_cast<const QuantBatchMatmulV4CompileInfo *>(context_->GetCompileInfo()); |
| 345 | OP_TILING_CHECK(mmCompileInfo == nullptr, | 328 | OP_TILING_CHECK(mmCompileInfo == nullptr, |
| 346 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, "get compile info is null"), return false); | 329 | + OP_LOGE(inputParams_.opName, "get compile info is null"), return false); |
| 347 | try { | 330 | try { |
| 348 | compileInfoPtr_ = std::make_unique<QuantBatchMatmulV4CompileInfo>(*mmCompileInfo); | 331 | compileInfoPtr_ = std::make_unique<QuantBatchMatmulV4CompileInfo>(*mmCompileInfo); |
| 349 | } catch (const std::bad_alloc &e) { | 332 | } catch (const std::bad_alloc &e) { |
| @@ -361,6 +344,7 @@ bool AdaptiveSlidingWindowBasicTilingV4::CheckBatchValidInPertileMode(const gert | |||
| 361 | aicoreParams_.blockDim = 0; | 344 | aicoreParams_.blockDim = 0; |
| 362 | return true; | 345 | return true; |
| 363 | } | 346 | } |
| 347 | + | ||
| 364 | bool AdaptiveSlidingWindowBasicTilingV4::CheckCoreNum() const | 348 | bool AdaptiveSlidingWindowBasicTilingV4::CheckCoreNum() const |
| 365 | { | 349 | { |
| 366 | auto aicNum = compileInfoPtr_->aicNum; | 350 | auto aicNum = compileInfoPtr_->aicNum; |
| @@ -45,7 +45,7 @@ bool AdaptiveSlidingWindowTilingV4::CheckDtype() const | |||
| 45 | auto checker = std::unique_ptr<QuantBatchMatmulV4Checker4MmadS8S4>( | 45 | auto checker = std::unique_ptr<QuantBatchMatmulV4Checker4MmadS8S4>( |
| 46 | new (std::nothrow) QuantBatchMatmulV4Checker4MmadS8S4(context_, inputParams_)); | 46 | new (std::nothrow) QuantBatchMatmulV4Checker4MmadS8S4(context_, inputParams_)); |
| 47 | OP_TILING_CHECK(checker == nullptr, | 47 | OP_TILING_CHECK(checker == nullptr, |
| 48 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, "failed to instantiate checker"), | 48 | + OP_LOGE(inputParams_.opName, "failed to instantiate checker"), |
| 49 | return false); | 49 | return false); |
| 50 | 50 | ||
| 51 | OP_TILING_CHECK(!checker->CheckDtype(), | 51 | OP_TILING_CHECK(!checker->CheckDtype(), |
| @@ -64,7 +64,10 @@ bool AdaptiveSlidingWindowTilingV4::CheckShape(const std::vector<gert::Shape *> | |||
| 64 | if (x2TableShape != nullptr) { | 64 | if (x2TableShape != nullptr) { |
| 65 | auto x2TableShapeLen = x2TableShape->GetStorageShape().GetDimNum(); | 65 | auto x2TableShapeLen = x2TableShape->GetStorageShape().GetDimNum(); |
| 66 | OP_TILING_CHECK(x2TableShapeLen != 2, | 66 | OP_TILING_CHECK(x2TableShapeLen != 2, |
| 67 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, "x2 table shape should be 2 dim"), return false); | 67 | + OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON(inputParams_.opName, "x2Table", |
| 68 | + std::to_string(x2TableShapeLen).c_str(), | ||
| 69 | + "The shape dim of x2Table must be 2D"), | ||
| 70 | + return false); | ||
| 68 | // the x2Table is transposed | 71 | // the x2Table is transposed |
| 69 | inputParams_.x2TableNSize = | 72 | inputParams_.x2TableNSize = |
| 70 | static_cast<uint64_t>(x2TableShape->GetStorageShape().GetDim(x2TableShapeLen - LAST_SECOND_DIM_INDEX)); | 73 | static_cast<uint64_t>(x2TableShape->GetStorageShape().GetDim(x2TableShapeLen - LAST_SECOND_DIM_INDEX)); |
| @@ -74,10 +77,10 @@ bool AdaptiveSlidingWindowTilingV4::CheckShape(const std::vector<gert::Shape *> | |||
| 74 | auto checker = std::unique_ptr<QuantBatchMatmulV4Checker4MmadS8S4>( | 77 | auto checker = std::unique_ptr<QuantBatchMatmulV4Checker4MmadS8S4>( |
| 75 | new (std::nothrow) QuantBatchMatmulV4Checker4MmadS8S4(context_, inputParams_)); | 78 | new (std::nothrow) QuantBatchMatmulV4Checker4MmadS8S4(context_, inputParams_)); |
| 76 | OP_TILING_CHECK(checker == nullptr, | 79 | OP_TILING_CHECK(checker == nullptr, |
| 77 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, "failed to instantiate checker"), | 80 | + OP_LOGE(inputParams_.opName, "failed to instantiate checker"), |
| 78 | return false); | 81 | return false); |
| 79 | OP_TILING_CHECK(!checker->CheckShape(mandtoryShape, biasShape, pertokenShape, dimValueOfMKN), | 82 | OP_TILING_CHECK(!checker->CheckShape(mandtoryShape, biasShape, pertokenShape, dimValueOfMKN), |
| 80 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, "CheckShape fail"), | 83 | + OP_LOGE(inputParams_.opName, "CheckShape fail"), |
| 81 | return false); | 84 | return false); |
| 82 | 85 | ||
| 83 | return true; | 86 | return true; |
| @@ -92,9 +95,7 @@ ge::graphStatus AdaptiveSlidingWindowTilingV4::CheckContext() | |||
| 92 | auto outputShape = context_->GetOutputShape(0); | 95 | auto outputShape = context_->GetOutputShape(0); |
| 93 | auto outputDesc = context_->GetOutputDesc(0); | 96 | auto outputDesc = context_->GetOutputDesc(0); |
| 94 | auto attrs = context_->GetAttrs(); | 97 | auto attrs = context_->GetAttrs(); |
| 95 | - OP_TILING_CHECK(attrs == nullptr, | 98 | + OPS_CHECK_NULL_WITH_CONTEXT(context_, attrs); |
| 96 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, "Function context_->GetAttrs() failed!"), | ||
| 97 | - return ge::GRAPH_FAILED); | ||
| 98 | auto dtypeAttr = attrs->GetAttrPointer<int64_t>(0); | 99 | auto dtypeAttr = attrs->GetAttrPointer<int64_t>(0); |
| 99 | 100 | ||
| 100 | OPS_CHECK_NULL_WITH_CONTEXT(context_, x1Shape); | 101 | OPS_CHECK_NULL_WITH_CONTEXT(context_, x1Shape); |
| @@ -108,7 +109,7 @@ ge::graphStatus AdaptiveSlidingWindowTilingV4::CheckContext() | |||
| 108 | OPS_CHECK_NULL_WITH_CONTEXT(context_, context_->GetRawTilingData()->GetData()); | 109 | OPS_CHECK_NULL_WITH_CONTEXT(context_, context_->GetRawTilingData()->GetData()); |
| 109 | OP_TILING_CHECK( | 110 | OP_TILING_CHECK( |
| 110 | context_->GetRawTilingData()->GetCapacity() < tilingDataSize_, | 111 | context_->GetRawTilingData()->GetCapacity() < tilingDataSize_, |
| 111 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, "context tiling data capacity %zu < actual tiling data size %zu.", | 112 | + OP_LOGE(inputParams_.opName, "context tiling data capacity %zu < actual tiling data size %zu.", |
| 112 | context_->GetRawTilingData()->GetCapacity(), tilingDataSize_), | 113 | context_->GetRawTilingData()->GetCapacity(), tilingDataSize_), |
| 113 | return ge::GRAPH_FAILED); | 114 | return ge::GRAPH_FAILED); |
| 114 | return ge::GRAPH_SUCCESS; | 115 | return ge::GRAPH_SUCCESS; |
| @@ -131,14 +132,14 @@ bool AdaptiveSlidingWindowTilingV4::AnalyzeDtype() | |||
| 131 | 132 | ||
| 132 | // 当前AdaptiveSlidingWindowTilingV4仅支持LUT场景,x2Table必须存在 | 133 | // 当前AdaptiveSlidingWindowTilingV4仅支持LUT场景,x2Table必须存在 |
| 133 | OP_TILING_CHECK( | 134 | OP_TILING_CHECK( |
| 134 | - x2TableDesc == nullptr, CUBE_INNER_ERR_REPORT(inputParams_.opName, "X2Table does not exist."), return false); | 135 | + x2TableDesc == nullptr, OP_LOGE(inputParams_.opName, "X2Table does not exist."), return false); |
| 135 | inputParams_.isLut = true; | 136 | inputParams_.isLut = true; |
| 136 | 137 | ||
| 137 | inputParams_.cDtype = context_->GetOutputDesc(0)->GetDataType(); | 138 | inputParams_.cDtype = context_->GetOutputDesc(0)->GetDataType(); |
| 138 | isUbQuant_ = inputParams_.cDtype == ge::DT_BF16 || pertokenScaleDesc != nullptr; | 139 | isUbQuant_ = inputParams_.cDtype == ge::DT_BF16 || pertokenScaleDesc != nullptr; |
| 139 | SetFormat(); | 140 | SetFormat(); |
| 140 | 141 | ||
| 141 | - OP_TILING_CHECK(!CheckDtype(), CUBE_INNER_ERR_REPORT(inputParams_.opName, "CheckDtype failed!"), return false); | 142 | + OP_TILING_CHECK(!CheckDtype(), OP_LOGE(inputParams_.opName, "CheckDtype failed!"), return false); |
| 142 | return true; | 143 | return true; |
| 143 | } | 144 | } |
| 144 | 145 | ||
| @@ -156,13 +157,13 @@ bool AdaptiveSlidingWindowTilingV4::AnalyzeInputs() | |||
| 156 | auto x1ShapeLen = x1Shape.GetDimNum(); | 157 | auto x1ShapeLen = x1Shape.GetDimNum(); |
| 157 | auto x2ShapeLen = x2Shape.GetDimNum(); | 158 | auto x2ShapeLen = x2Shape.GetDimNum(); |
| 158 | OP_TILING_CHECK(x1ShapeLen != 2, | 159 | OP_TILING_CHECK(x1ShapeLen != 2, |
| 159 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, | 160 | + OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON(inputParams_.opName, "x1", std::to_string(x1ShapeLen).c_str(), |
| 160 | - "Input x1 dimension should equal to 2, but x1 dimension: %zu.", x1ShapeLen), | 161 | + "The shape dim of x1 must be 2D"), |
| 161 | - return false); | 162 | + return false); |
| 162 | OP_TILING_CHECK(x2ShapeLen != 2, | 163 | OP_TILING_CHECK(x2ShapeLen != 2, |
| 163 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, | 164 | + OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON(inputParams_.opName, "x2", std::to_string(x2ShapeLen).c_str(), |
| 164 | - "Input x2 dimension should equal to 2, but x2 dimension: %zu.", x2ShapeLen), | 165 | + "The shape dim of x2 must be 2D"), |
| 165 | - return false); | 166 | + return false); |
| 166 | 167 | ||
| 167 | auto x1Inner = x1Shape.GetDim(x1ShapeLen - LAST_FIRST_DIM_INDEX); | 168 | auto x1Inner = x1Shape.GetDim(x1ShapeLen - LAST_FIRST_DIM_INDEX); |
| 168 | auto x1Outer = x1Shape.GetDim(x1ShapeLen - LAST_SECOND_DIM_INDEX); | 169 | auto x1Outer = x1Shape.GetDim(x1ShapeLen - LAST_SECOND_DIM_INDEX); |
| @@ -180,8 +181,8 @@ bool AdaptiveSlidingWindowTilingV4::AnalyzeInputs() | |||
| 180 | AnalyzeBatchInfo(x1Shape, x2Shape); | 181 | AnalyzeBatchInfo(x1Shape, x2Shape); |
| 181 | OP_TILING_CHECK( | 182 | OP_TILING_CHECK( |
| 182 | !InferOutBatchDim(x1Shape, x2Shape), | 183 | !InferOutBatchDim(x1Shape, x2Shape), |
| 183 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, | 184 | + OP_LOGE(inputParams_.opName, |
| 184 | - "batch dim can not be broadcasted or the batch dims of output do not match with input."), | 185 | + "batch dim can not be broadcasted or the batch dims of output do not match with input."), |
| 185 | return false); | 186 | return false); |
| 186 | if (scaleShape != nullptr && !SetQuantMode(scaleShape->GetStorageShape(), pertokenShape)) { | 187 | if (scaleShape != nullptr && !SetQuantMode(scaleShape->GetStorageShape(), pertokenShape)) { |
| 187 | return false; | 188 | return false; |
| @@ -189,10 +190,11 @@ bool AdaptiveSlidingWindowTilingV4::AnalyzeInputs() | |||
| 189 | if (!CheckShape(mandtoryShape, biasShape, pertokenShape, x2TableShape, dimValueOfMKN)) { | 190 | if (!CheckShape(mandtoryShape, biasShape, pertokenShape, x2TableShape, dimValueOfMKN)) { |
| 190 | return false; | 191 | return false; |
| 191 | } | 192 | } |
| 192 | - OP_TILING_CHECK(!CheckOutputShapeAvailable(), | 193 | + OP_TILING_CHECK( |
| 193 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, | 194 | + !CheckOutputShapeAvailable(), |
| 194 | - "Multiple of output shape dims should be in boundary of INT64_MAX"), | 195 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( |
| 195 | - return false); | 196 | + inputParams_.opName, "y", "output shape product", "The shape size of y must be <= INT64_MAX"), |
| 197 | + return false); | ||
| 196 | 198 | ||
| 197 | auto isPerTensorStr = inputParams_.isPerTensor ? "true" : "false"; | 199 | auto isPerTensorStr = inputParams_.isPerTensor ? "true" : "false"; |
| 198 | auto isPertokenStr = inputParams_.isPertoken ? "true" : "false"; | 200 | auto isPertokenStr = inputParams_.isPertoken ? "true" : "false"; |
| @@ -231,7 +233,7 @@ bool AdaptiveSlidingWindowTilingV4::SetPlatformInfoForTiling() | |||
| 231 | InitCompileInfo(); | 233 | InitCompileInfo(); |
| 232 | auto mmCompileInfo = reinterpret_cast<const QuantBatchMatmulV4CompileInfo *>(context_->GetCompileInfo()); | 234 | auto mmCompileInfo = reinterpret_cast<const QuantBatchMatmulV4CompileInfo *>(context_->GetCompileInfo()); |
| 233 | OP_TILING_CHECK(mmCompileInfo == nullptr, | 235 | OP_TILING_CHECK(mmCompileInfo == nullptr, |
| 234 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, "get compile info is null"), return false); | 236 | + OP_LOGE(inputParams_.opName, "compile info is null"), return false); |
| 235 | try { | 237 | try { |
| 236 | compileInfoPtr_ = std::make_unique<QuantBatchMatmulV4CompileInfo>(*mmCompileInfo); | 238 | compileInfoPtr_ = std::make_unique<QuantBatchMatmulV4CompileInfo>(*mmCompileInfo); |
| 237 | } catch (const std::bad_alloc &e) { | 239 | } catch (const std::bad_alloc &e) { |
Mmatmul/quant_batch_matmul_v4/op_host/op_tiling/arch35/quant_batch_matmul_v4_basic_block_tiling.cpp+20-23
| @@ -168,24 +168,21 @@ void QuantBatchMatmulV4BasicBlockTiling::SetDtypeBits(const int64_t aDtypeBits, | |||
| 168 | bool QuantBatchMatmulV4BasicBlockTiling::ValidateInputParam() const | 168 | bool QuantBatchMatmulV4BasicBlockTiling::ValidateInputParam() const |
| 169 | { | 169 | { |
| 170 | OP_TILING_CHECK(basicBlockParam_.mSize <= 0 || basicBlockParam_.nSize <= 0 || basicBlockParam_.kSize <= 0, | 170 | OP_TILING_CHECK(basicBlockParam_.mSize <= 0 || basicBlockParam_.nSize <= 0 || basicBlockParam_.kSize <= 0, |
| 171 | - VECTOR_INNER_ERR_REPORT_TILIING( | 171 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(opName_, "mSize, nSize, kSize", "shape values", |
| 172 | - opName_, "Invalid param, shape size must gt 0, mSize: %ld, nSize: %ld, kSize: %ld", | 172 | + "The values of mSize, nSize, kSize must be > 0"), |
| 173 | - basicBlockParam_.mSize, basicBlockParam_.nSize, basicBlockParam_.kSize), | ||
| 174 | return false); | 173 | return false); |
| 175 | 174 | ||
| 176 | OP_TILING_CHECK( | 175 | OP_TILING_CHECK( |
| 177 | aDtypeBits_ <= 0 || bDtypeBits_ <= 0 || (hasBias_ && biasDtypeBits_ <= 0), | 176 | aDtypeBits_ <= 0 || bDtypeBits_ <= 0 || (hasBias_ && biasDtypeBits_ <= 0), |
| 178 | - VECTOR_INNER_ERR_REPORT_TILIING( | 177 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON( |
| 179 | - opName_, | 178 | + opName_, "aDtype/bDtype/biasDtype", "dtypeBits", "The dtype bits of aDtype, bDtype, biasDtype must be > 0"), |
| 180 | - "Invalid param, dtypeBits must be greater than 0, aDtypeBits_: %ld, bDtypeBits_: %ld, biasDtypeBits_: %ld", | ||
| 181 | - aDtypeBits_, bDtypeBits_, biasDtypeBits_), | ||
| 182 | return false); | 179 | return false); |
| 183 | 180 | ||
| 184 | - OP_TILING_CHECK(basicBlockParam_.groupSize < 0, | 181 | + OP_TILING_CHECK( |
| 185 | - VECTOR_INNER_ERR_REPORT_TILIING( | 182 | + basicBlockParam_.groupSize < 0, |
| 186 | - opName_, "Invalid param, groupSize must be greater than or equal to 0, groupSize: %ld", | 183 | + OP_LOGE_FOR_INVALID_VALUE_WITH_REASON(opName_, "groupSize", std::to_string(basicBlockParam_.groupSize).c_str(), |
| 187 | - basicBlockParam_.groupSize), | 184 | + "The value of groupSize must be >= 0"), |
| 188 | - return false); | 185 | + return false); |
| 189 | 186 | ||
| 190 | return true; | 187 | return true; |
| 191 | } | 188 | } |
| @@ -563,13 +560,13 @@ void QuantBatchMatmulV4BasicBlockTiling::PrintFinalResult(const BasicBlockParam | |||
| 563 | bool QuantBatchMatmulV4BasicBlockTiling::ValidateTilingResult() const | 560 | bool QuantBatchMatmulV4BasicBlockTiling::ValidateTilingResult() const |
| 564 | { | 561 | { |
| 565 | OP_TILING_CHECK(basicBlockParam_.mDim * basicBlockParam_.nDim * basicBlockParam_.kDim > platformParam_.blockNum, | 562 | OP_TILING_CHECK(basicBlockParam_.mDim * basicBlockParam_.nDim * basicBlockParam_.kDim > platformParam_.blockNum, |
| 566 | - VECTOR_INNER_ERR_REPORT_TILIING( | 563 | + OP_LOGE( |
| 567 | opName_, "Invalid block dim, mDim: %ld, nDim: %ld, kDim: %ld, maxDimNum: %ld", | 564 | opName_, "Invalid block dim, mDim: %ld, nDim: %ld, kDim: %ld, maxDimNum: %ld", |
| 568 | basicBlockParam_.mDim, basicBlockParam_.nDim, basicBlockParam_.kDim, platformParam_.blockNum), | 565 | basicBlockParam_.mDim, basicBlockParam_.nDim, basicBlockParam_.kDim, platformParam_.blockNum), |
| 569 | return false); | 566 | return false); |
| 570 | 567 | ||
| 571 | OP_TILING_CHECK(GetL1LoadSize(basicBlockParam_.basicBlock, basicBlockParam_.l1Param) > platformParam_.l1Size, | 568 | OP_TILING_CHECK(GetL1LoadSize(basicBlockParam_.basicBlock, basicBlockParam_.l1Param) > platformParam_.l1Size, |
| 572 | - VECTOR_INNER_ERR_REPORT_TILIING( | 569 | + OP_LOGE( |
| 573 | opName_, "The load size exceeds L1 buffer limit, load size: %ld, L1 buffer size: %ld", | 570 | opName_, "The load size exceeds L1 buffer limit, load size: %ld, L1 buffer size: %ld", |
| 574 | GetL1LoadSize(basicBlockParam_.basicBlock, basicBlockParam_.l1Param), platformParam_.l1Size), | 571 | GetL1LoadSize(basicBlockParam_.basicBlock, basicBlockParam_.l1Param), platformParam_.l1Size), |
| 575 | return false); | 572 | return false); |
| @@ -581,7 +578,7 @@ bool QuantBatchMatmulV4BasicBlockTiling::ValidateTilingResult() const | |||
| 581 | 578 | ||
| 582 | OP_TILING_CHECK( | 579 | OP_TILING_CHECK( |
| 583 | a2Size > platformParam_.l0aSize || b2Size > platformParam_.l0bSize || a2Size == 0 || b2Size == 0, | 580 | a2Size > platformParam_.l0aSize || b2Size > platformParam_.l0bSize || a2Size == 0 || b2Size == 0, |
| 584 | - VECTOR_INNER_ERR_REPORT_TILIING( | 581 | + OP_LOGE( |
| 585 | opName_, | 582 | opName_, |
| 586 | "The load size may exceed L0 buffer limit, L0A load size: %ld, L0B load size: %ld, L0 buffer size: %ld", | 583 | "The load size may exceed L0 buffer limit, L0A load size: %ld, L0B load size: %ld, L0 buffer size: %ld", |
| 587 | a2Size, b2Size, platformParam_.l0aSize), | 584 | a2Size, b2Size, platformParam_.l0aSize), |
| @@ -592,7 +589,7 @@ bool QuantBatchMatmulV4BasicBlockTiling::ValidateTilingResult() const | |||
| 592 | OP_TILING_CHECK((basicBlockParam_.l1Param.stepKa < stepKMax && basicBlockParam_.l1Param.stepKb < stepKMax) && | 589 | OP_TILING_CHECK((basicBlockParam_.l1Param.stepKa < stepKMax && basicBlockParam_.l1Param.stepKb < stepKMax) && |
| 593 | (basicBlockParam_.l1Param.stepKa % basicBlockParam_.l1Param.stepKb > 0 && | 590 | (basicBlockParam_.l1Param.stepKa % basicBlockParam_.l1Param.stepKb > 0 && |
| 594 | basicBlockParam_.l1Param.stepKb % basicBlockParam_.l1Param.stepKa > 0), | 591 | basicBlockParam_.l1Param.stepKb % basicBlockParam_.l1Param.stepKa > 0), |
| 595 | - VECTOR_INNER_ERR_REPORT_TILIING( | 592 | + OP_LOGE( |
| 596 | opName_, "Invalid stepK, stepKa (%ld) should be divisible by stepKb (%ld) or otherwise", | 593 | opName_, "Invalid stepK, stepKa (%ld) should be divisible by stepKb (%ld) or otherwise", |
| 597 | basicBlockParam_.l1Param.stepKa, basicBlockParam_.l1Param.stepKb), | 594 | basicBlockParam_.l1Param.stepKa, basicBlockParam_.l1Param.stepKb), |
| 598 | return false); | 595 | return false); |
| @@ -649,20 +646,20 @@ bool QuantBatchMatmulV4BasicBlockTiling::GetFallbackTiling() | |||
| 649 | const int64_t alignSize = | 646 | const int64_t alignSize = |
| 650 | isMxType_ ? (weightNzFlag_ ? BLOCK_CUBE : NZ_BASIC_BLOCK_ALIGN_SIZE) : NZ_BASIC_BLOCK_ALIGN_SIZE; | 647 | isMxType_ ? (weightNzFlag_ ? BLOCK_CUBE : NZ_BASIC_BLOCK_ALIGN_SIZE) : NZ_BASIC_BLOCK_ALIGN_SIZE; |
| 651 | const int64_t maxMNSize = isMxType_ ? BASE_MN_LIMIT_BUFF_2 : BASE_MN_LIMIT_BUFF_1; | 648 | const int64_t maxMNSize = isMxType_ ? BASE_MN_LIMIT_BUFF_2 : BASE_MN_LIMIT_BUFF_1; |
| 652 | - | 649 | + |
| 653 | // M轴切分 | 650 | // M轴切分 |
| 654 | basicBlockParam_.basicBlock.baseM = ops::CeilAlign(min(basicBlockParam_.mSize, DEFAULT_FALLBACK_BASEM), BLOCK_CUBE); | 651 | basicBlockParam_.basicBlock.baseM = ops::CeilAlign(min(basicBlockParam_.mSize, DEFAULT_FALLBACK_BASEM), BLOCK_CUBE); |
| 655 | - basicBlockParam_.mDim = min(CeilDiv(basicBlockParam_.mSize, basicBlockParam_.basicBlock.baseM), | 652 | + basicBlockParam_.mDim = min(CeilDiv(basicBlockParam_.mSize, basicBlockParam_.basicBlock.baseM), |
| 656 | platformParam_.blockNum); | 653 | platformParam_.blockNum); |
| 657 | basicBlockParam_.singleM = ops::CeilAlign(CeilDiv(basicBlockParam_.mSize, basicBlockParam_.mDim), BLOCK_CUBE); | 654 | basicBlockParam_.singleM = ops::CeilAlign(CeilDiv(basicBlockParam_.mSize, basicBlockParam_.mDim), BLOCK_CUBE); |
| 658 | - | 655 | + |
| 659 | // N轴切分 | 656 | // N轴切分 |
| 660 | - basicBlockParam_.basicBlock.baseN = min(BASE_BLOCK_MAX, | 657 | + basicBlockParam_.basicBlock.baseN = min(BASE_BLOCK_MAX, |
| 661 | (maxMNSize / basicBlockParam_.basicBlock.baseM) / BLOCK_CUBE * BLOCK_CUBE); | 658 | (maxMNSize / basicBlockParam_.basicBlock.baseM) / BLOCK_CUBE * BLOCK_CUBE); |
| 662 | basicBlockParam_.nDim = min(CeilDiv(basicBlockParam_.nSize, basicBlockParam_.basicBlock.baseN), | 659 | basicBlockParam_.nDim = min(CeilDiv(basicBlockParam_.nSize, basicBlockParam_.basicBlock.baseN), |
| 663 | platformParam_.blockNum / basicBlockParam_.mDim); | 660 | platformParam_.blockNum / basicBlockParam_.mDim); |
| 664 | basicBlockParam_.singleN = ops::CeilAlign(CeilDiv(basicBlockParam_.nSize, basicBlockParam_.nDim), alignSize); | 661 | basicBlockParam_.singleN = ops::CeilAlign(CeilDiv(basicBlockParam_.nSize, basicBlockParam_.nDim), alignSize); |
| 665 | - | 662 | + |
| 666 | // 修正分核和baseN大小 | 663 | // 修正分核和baseN大小 |
| 667 | basicBlockParam_.mDim = CeilDiv(basicBlockParam_.mSize, basicBlockParam_.singleM); | 664 | basicBlockParam_.mDim = CeilDiv(basicBlockParam_.mSize, basicBlockParam_.singleM); |
| 668 | basicBlockParam_.nDim = CeilDiv(basicBlockParam_.nSize, basicBlockParam_.singleN); | 665 | basicBlockParam_.nDim = CeilDiv(basicBlockParam_.nSize, basicBlockParam_.singleN); |
| @@ -692,8 +689,8 @@ bool QuantBatchMatmulV4BasicBlockTiling::GetFinalResult() | |||
| 692 | */ | 689 | */ |
| 693 | bool QuantBatchMatmulV4BasicBlockTiling::GetBasicBlockTiling() | 690 | bool QuantBatchMatmulV4BasicBlockTiling::GetBasicBlockTiling() |
| 694 | { | 691 | { |
| 695 | - OP_TILING_CHECK(!ValidateInputParam(), VECTOR_INNER_ERR_REPORT_TILIING(opName_, "Invalid input param"), | 692 | + OP_TILING_CHECK( |
| 696 | - return false); | 693 | + !ValidateInputParam(), OP_LOGE(opName_, "Invalid input param"), return false); |
| 697 | 694 | ||
| 698 | Reset(); | 695 | Reset(); |
| 699 | int64_t mDimMax = min(CeilDiv(basicBlockParam_.mSize, BLOCK_CUBE), platformParam_.blockNum); | 696 | int64_t mDimMax = min(CeilDiv(basicBlockParam_.mSize, BLOCK_CUBE), platformParam_.blockNum); |
Mmatmul/quant_batch_matmul_v4/op_host/op_tiling/arch35/quant_batch_matmul_v4_checker_for_mmads8s4.cpp+118-102
| @@ -61,76 +61,87 @@ bool QuantBatchMatmulV4Checker4MmadS8S4::CheckDtypesInRange() const | |||
| 61 | if (inputParams_.isLut) { | 61 | if (inputParams_.isLut) { |
| 62 | // isLut为true的条件是x2Table存在且平台支持lut_type为mte2_qtable | 62 | // isLut为true的条件是x2Table存在且平台支持lut_type为mte2_qtable |
| 63 | // LUT场景,仅支持x1 INT8,x2 UINT1/INT2/INT4 | 63 | // LUT场景,仅支持x1 INT8,x2 UINT1/INT2/INT4 |
| 64 | - OP_TILING_CHECK(std::find(legalInputX1Dtypes.begin(), legalInputX1Dtypes.end(), inputParams_.aDtype) == | 64 | + OP_TILING_CHECK( |
| 65 | - legalInputX1Dtypes.end(), | 65 | + std::find(legalInputX1Dtypes.begin(), legalInputX1Dtypes.end(), inputParams_.aDtype) == |
| 66 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, "The x1 dtype must be INT8, actual is %s.", | 66 | + legalInputX1Dtypes.end(), |
| 67 | - ge::TypeUtils::DataTypeToSerialString(inputParams_.aDtype).c_str()), | 67 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(inputParams_.opName, "x1", |
| 68 | - return false); | 68 | + ge::TypeUtils::DataTypeToSerialString(inputParams_.aDtype).c_str(), |
| 69 | + "The dtype of x1 must be INT8"), | ||
| 70 | + return false); | ||
| 69 | // x2可取 UINT1/INT2/INT4 | 71 | // x2可取 UINT1/INT2/INT4 |
| 70 | OP_TILING_CHECK( | 72 | OP_TILING_CHECK( |
| 71 | std::find(legalInputX2Dtypes.begin(), legalInputX2Dtypes.end(), inputParams_.bDtype) == | 73 | std::find(legalInputX2Dtypes.begin(), legalInputX2Dtypes.end(), inputParams_.bDtype) == |
| 72 | legalInputX2Dtypes.end(), | 74 | legalInputX2Dtypes.end(), |
| 73 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, "The x2 dtype must be UINT1/INT2/INT4, actual is %s.", | 75 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(inputParams_.opName, "x2", |
| 74 | - ge::TypeUtils::DataTypeToSerialString(inputParams_.bDtype).c_str()), | 76 | + ge::TypeUtils::DataTypeToSerialString(inputParams_.bDtype).c_str(), |
| 77 | + "The dtype of x2 must be UINT1, INT2, or INT4"), | ||
| 75 | return false); | 78 | return false); |
| 76 | } | 79 | } |
| 77 | // output可取INT8, FLOAT16 | 80 | // output可取INT8, FLOAT16 |
| 78 | OP_TILING_CHECK( | 81 | OP_TILING_CHECK( |
| 79 | std::find(legalOutputDtypes.begin(), legalOutputDtypes.end(), inputParams_.cDtype) == legalOutputDtypes.end(), | 82 | std::find(legalOutputDtypes.begin(), legalOutputDtypes.end(), inputParams_.cDtype) == legalOutputDtypes.end(), |
| 80 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, "Output dtype must be INT8/FLOAT16, actual is %s.", | 83 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(inputParams_.opName, "y", |
| 81 | - ge::TypeUtils::DataTypeToSerialString(inputParams_.cDtype).c_str()), | 84 | + ge::TypeUtils::DataTypeToSerialString(inputParams_.cDtype).c_str(), |
| 85 | + "The dtype of y must be INT8 or FLOAT16"), | ||
| 82 | return false); | 86 | return false); |
| 83 | // x1Offset不存在 | 87 | // x1Offset不存在 |
| 84 | OP_TILING_CHECK((context_->GetOptionalInputDesc(X1_OFFSET_INDEX_V4) != nullptr && | 88 | OP_TILING_CHECK((context_->GetOptionalInputDesc(X1_OFFSET_INDEX_V4) != nullptr && |
| 85 | context_->GetOptionalInputShape(X1_OFFSET_INDEX_V4) != nullptr), | 89 | context_->GetOptionalInputShape(X1_OFFSET_INDEX_V4) != nullptr), |
| 86 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, "X1Offset should be null."), return false); | 90 | + OP_LOGE(inputParams_.opName, "X1Offset should be null."), return false); |
| 87 | // x2ffset可取FLOAT | 91 | // x2ffset可取FLOAT |
| 88 | auto offsetDesc = context_->GetOptionalInputDesc(GetOffsetIdx()); | 92 | auto offsetDesc = context_->GetOptionalInputDesc(GetOffsetIdx()); |
| 89 | - OP_TILING_CHECK((offsetDesc && context_->GetOptionalInputShape(GetOffsetIdx()) != nullptr) && | 93 | + OP_TILING_CHECK( |
| 90 | - offsetDesc->GetDataType() != ge::DT_FLOAT, | 94 | + (offsetDesc && context_->GetOptionalInputShape(GetOffsetIdx()) != nullptr) && |
| 91 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, "X2Offset dtype should be FLOAT, actual dtype is %s.", | 95 | + offsetDesc->GetDataType() != ge::DT_FLOAT, |
| 92 | - ge::TypeUtils::DataTypeToSerialString(offsetDesc->GetDataType()).c_str()), | 96 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON( |
| 93 | - return false); | 97 | + inputParams_.opName, "x2Offset", ge::TypeUtils::DataTypeToSerialString(offsetDesc->GetDataType()).c_str(), |
| 98 | + "The dtype of x2Offset must be FLOAT"), | ||
| 99 | + return false); | ||
| 94 | // yOffset不存在 | 100 | // yOffset不存在 |
| 95 | OP_TILING_CHECK((context_->GetOptionalInputDesc(Y_OFFSET_INDEX_V4) != nullptr && | 101 | OP_TILING_CHECK((context_->GetOptionalInputDesc(Y_OFFSET_INDEX_V4) != nullptr && |
| 96 | context_->GetOptionalInputShape(Y_OFFSET_INDEX_V4) != nullptr), | 102 | context_->GetOptionalInputShape(Y_OFFSET_INDEX_V4) != nullptr), |
| 97 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, "YOffset should be null."), return false); | 103 | + OP_LOGE(inputParams_.opName, "YOffset should be null."), return false); |
| 98 | // x2Scale可取UINT64, INT64 | 104 | // x2Scale可取UINT64, INT64 |
| 99 | OP_TILING_CHECK( | 105 | OP_TILING_CHECK( |
| 100 | context_->GetOptionalInputDesc(GetScaleIdx()) != nullptr && | 106 | context_->GetOptionalInputDesc(GetScaleIdx()) != nullptr && |
| 101 | !(inputParams_.scaleDtype == ge::DT_UINT64 || inputParams_.scaleDtype == ge::DT_INT64), | 107 | !(inputParams_.scaleDtype == ge::DT_UINT64 || inputParams_.scaleDtype == ge::DT_INT64), |
| 102 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, "X2Scale dtype should be UINT64/INT64, actual dtype is %s.", | 108 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON( |
| 103 | - ge::TypeUtils::DataTypeToSerialString(inputParams_.scaleDtype).c_str()), | 109 | + inputParams_.opName, "x2Scale", ge::TypeUtils::DataTypeToSerialString(inputParams_.scaleDtype).c_str(), |
| 110 | + "The dtype of x2Scale must be UINT64 or INT64"), | ||
| 104 | return false); | 111 | return false); |
| 105 | // bias可取INT32 | 112 | // bias可取INT32 |
| 106 | - OP_TILING_CHECK((context_->GetOptionalInputDesc(GetBiasIdx()) != nullptr && | 113 | + OP_TILING_CHECK( |
| 107 | - context_->GetOptionalInputShape(GetBiasIdx()) != nullptr) && | 114 | + (context_->GetOptionalInputDesc(GetBiasIdx()) != nullptr && |
| 108 | - inputParams_.biasDtype != ge::DT_INT32, | 115 | + context_->GetOptionalInputShape(GetBiasIdx()) != nullptr) && |
| 109 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, "Bias dtype should be INT32, actual dtype is %s.", | 116 | + inputParams_.biasDtype != ge::DT_INT32, |
| 110 | - ge::TypeUtils::DataTypeToSerialString(inputParams_.biasDtype).c_str()), | 117 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON( |
| 111 | - return false); | 118 | + inputParams_.opName, "bias", ge::TypeUtils::DataTypeToSerialString(inputParams_.biasDtype).c_str(), |
| 119 | + "The dtype of bias must be INT32"), | ||
| 120 | + return false); | ||
| 112 | // x1Scale不存在 | 121 | // x1Scale不存在 |
| 113 | OP_TILING_CHECK((context_->GetOptionalInputDesc(GetPertokenIdx()) != nullptr && | 122 | OP_TILING_CHECK((context_->GetOptionalInputDesc(GetPertokenIdx()) != nullptr && |
| 114 | context_->GetOptionalInputShape(GetPertokenIdx()) != nullptr), | 123 | context_->GetOptionalInputShape(GetPertokenIdx()) != nullptr), |
| 115 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, "X1Scale should be null."), return false); | 124 | + OP_LOGE(inputParams_.opName, "X1Scale should be null."), return false); |
| 116 | // yScale不存在 | 125 | // yScale不存在 |
| 117 | OP_TILING_CHECK((context_->GetOptionalInputDesc(Y_SCALE_INDEX_V4) != nullptr && | 126 | OP_TILING_CHECK((context_->GetOptionalInputDesc(Y_SCALE_INDEX_V4) != nullptr && |
| 118 | context_->GetOptionalInputShape(Y_SCALE_INDEX_V4) != nullptr), | 127 | context_->GetOptionalInputShape(Y_SCALE_INDEX_V4) != nullptr), |
| 119 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, "YScale should be null."), return false); | 128 | + OP_LOGE(inputParams_.opName, "YScale should be null."), return false); |
| 120 | if (inputParams_.isLut) { | 129 | if (inputParams_.isLut) { |
| 121 | // LUT场景,x2 UINT1/INT2对应x2Table INT4, x2 INT4对应x2Table INT8 | 130 | // LUT场景,x2 UINT1/INT2对应x2Table INT4, x2 INT4对应x2Table INT8 |
| 122 | - OP_TILING_CHECK((inputParams_.bDtype == ge::DT_INT2 || inputParams_.bDtype == ge::DT_UINT1) && | 131 | + OP_TILING_CHECK( |
| 123 | - inputParams_.x2TableDtype != ge::DT_INT4, | 132 | + (inputParams_.bDtype == ge::DT_INT2 || inputParams_.bDtype == ge::DT_UINT1) && |
| 124 | - CUBE_INNER_ERR_REPORT( | 133 | + inputParams_.x2TableDtype != ge::DT_INT4, |
| 125 | - inputParams_.opName, | 134 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON( |
| 126 | - "In LUT scenario, when x2 dtype is UINT1/INT2, x2Table dtype should be INT4, actual is %s", | 135 | + inputParams_.opName, "x2Table", |
| 127 | - ge::TypeUtils::DataTypeToSerialString(inputParams_.x2TableDtype).c_str()), | 136 | + ge::TypeUtils::DataTypeToSerialString(inputParams_.x2TableDtype).c_str(), |
| 128 | - return false); | 137 | + "When the dtype of x2 is UINT1 or INT2, the dtype of x2Table must be INT4"), |
| 138 | + return false); | ||
| 129 | OP_TILING_CHECK( | 139 | OP_TILING_CHECK( |
| 130 | inputParams_.bDtype == ge::DT_INT4 && inputParams_.x2TableDtype != ge::DT_INT8, | 140 | inputParams_.bDtype == ge::DT_INT4 && inputParams_.x2TableDtype != ge::DT_INT8, |
| 131 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, | 141 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON( |
| 132 | - "In LUT scenario, when x2 dtype is INT4, x2Table dtype should be INT8, actual is %s", | 142 | + inputParams_.opName, "x2Table", |
| 133 | - ge::TypeUtils::DataTypeToSerialString(inputParams_.x2TableDtype).c_str()), | 143 | + ge::TypeUtils::DataTypeToSerialString(inputParams_.x2TableDtype).c_str(), |
| 144 | + "When the dtype of x2 is INT4, the dtype of x2Table must be INT8"), | ||
| 134 | return false); | 145 | return false); |
| 135 | } | 146 | } |
| 136 | return true; | 147 | return true; |
| @@ -151,17 +162,21 @@ bool QuantBatchMatmulV4Checker4MmadS8S4::CalcSingleLutSize(const ge::DataType bD | |||
| 151 | uint64_t &singleLutSize) const | 162 | uint64_t &singleLutSize) const |
| 152 | { | 163 | { |
| 153 | auto dtypeBitLengthIterator = DTYPE_BIT_LENGTH_MAP.find(x2TableDtype); | 164 | auto dtypeBitLengthIterator = DTYPE_BIT_LENGTH_MAP.find(x2TableDtype); |
| 154 | - OP_TILING_CHECK(dtypeBitLengthIterator == DTYPE_BIT_LENGTH_MAP.end(), | 165 | + OP_TILING_CHECK( |
| 155 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, "can't find key[%s] in DTYPE_BIT_LENGTH_MAP", | 166 | + dtypeBitLengthIterator == DTYPE_BIT_LENGTH_MAP.end(), |
| 156 | - ge::TypeUtils::DataTypeToSerialString(x2TableDtype).c_str()), | 167 | + OP_LOGE_FOR_INVALID_CONFIG_WITH_REASON( |
| 157 | - return false); | 168 | + inputParams_.opName, ge::TypeUtils::DataTypeToSerialString(x2TableDtype).c_str(), "x2TableDtype", |
| 169 | + "DTYPE_BIT_LENGTH_MAP", "dtype not found in bit length map"), | ||
| 170 | + return false); | ||
| 158 | uint64_t bitLength = dtypeBitLengthIterator->second; | 171 | uint64_t bitLength = dtypeBitLengthIterator->second; |
| 159 | 172 | ||
| 160 | auto dtypeIdxSizeIterator = DTYPE_INDEX_SIZE_MAP.find(bDtype); | 173 | auto dtypeIdxSizeIterator = DTYPE_INDEX_SIZE_MAP.find(bDtype); |
| 161 | - OP_TILING_CHECK(dtypeIdxSizeIterator == DTYPE_INDEX_SIZE_MAP.end(), | 174 | + OP_TILING_CHECK( |
| 162 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, "can't find key[%s] in DTYPE_INDEX_SIZE_MAP", | 175 | + dtypeIdxSizeIterator == DTYPE_INDEX_SIZE_MAP.end(), |
| 163 | - ge::TypeUtils::DataTypeToSerialString(bDtype).c_str()), | 176 | + OP_LOGE_FOR_INVALID_CONFIG_WITH_REASON( |
| 164 | - return false); | 177 | + inputParams_.opName, ge::TypeUtils::DataTypeToSerialString(bDtype).c_str(), "bDtype", |
| 178 | + "DTYPE_INDEX_SIZE_MAP", "dtype not found in index size map"), | ||
| 179 | + return false); | ||
| 165 | uint64_t idxSize = dtypeIdxSizeIterator->second; | 180 | uint64_t idxSize = dtypeIdxSizeIterator->second; |
| 166 | 181 | ||
| 167 | singleLutSize = ops::CeilAlign(idxSize * bitLength, LUT_ALIGN_BIT_LENGTH) / bitLength; | 182 | singleLutSize = ops::CeilAlign(idxSize * bitLength, LUT_ALIGN_BIT_LENGTH) / bitLength; |
| @@ -183,17 +198,20 @@ bool QuantBatchMatmulV4Checker4MmadS8S4::CheckX2TableShape() const | |||
| 183 | { | 198 | { |
| 184 | uint64_t singleLutSize = 0; | 199 | uint64_t singleLutSize = 0; |
| 185 | OP_TILING_CHECK(!CalcSingleLutSize(inputParams_.bDtype, inputParams_.x2TableDtype, singleLutSize), | 200 | OP_TILING_CHECK(!CalcSingleLutSize(inputParams_.bDtype, inputParams_.x2TableDtype, singleLutSize), |
| 186 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, "failed to calculate single LUT size"), return false); | 201 | + OP_LOGE(inputParams_.opName, "failed to calculate single LUT size"), return false); |
| 187 | OP_TILING_CHECK( | 202 | OP_TILING_CHECK( |
| 188 | ops::CeilDiv(inputParams_.kSize, inputParams_.groupSizeK) * singleLutSize != inputParams_.x2TableKSize, | 203 | ops::CeilDiv(inputParams_.kSize, inputParams_.groupSizeK) * singleLutSize != inputParams_.x2TableKSize, |
| 189 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, "x2TableKSize should be %zu, but it is %zu", | 204 | + OP_LOGE_FOR_INVALID_SHAPESIZE_WITH_REASON( |
| 190 | - ops::CeilDiv(inputParams_.kSize, inputParams_.groupSizeK) * singleLutSize, | 205 | + inputParams_.opName, "x2TableKSize", std::to_string(inputParams_.x2TableKSize).c_str(), |
| 191 | - inputParams_.x2TableKSize), | 206 | + "The shape size of x2TableKSize must be " + |
| 207 | + std::to_string(ops::CeilDiv(inputParams_.kSize, inputParams_.groupSizeK) * singleLutSize)), | ||
| 192 | return false); | 208 | return false); |
| 193 | OP_TILING_CHECK( | 209 | OP_TILING_CHECK( |
| 194 | ops::CeilDiv(inputParams_.nSize, inputParams_.groupSizeN) != inputParams_.x2TableNSize, | 210 | ops::CeilDiv(inputParams_.nSize, inputParams_.groupSizeN) != inputParams_.x2TableNSize, |
| 195 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, "x2TableNSize should be %zu, but it is %zu", | 211 | + OP_LOGE_FOR_INVALID_SHAPESIZE_WITH_REASON( |
| 196 | - ops::CeilDiv(inputParams_.nSize, inputParams_.groupSizeN), inputParams_.x2TableNSize), | 212 | + inputParams_.opName, "x2TableNSize", std::to_string(inputParams_.x2TableNSize).c_str(), |
| 213 | + "The shape size of x2TableNSize must be " + | ||
| 214 | + std::to_string(ops::CeilDiv(inputParams_.nSize, inputParams_.groupSizeN))), | ||
| 197 | return false); | 215 | return false); |
| 198 | return true; | 216 | return true; |
| 199 | } | 217 | } |
| @@ -208,64 +226,66 @@ bool QuantBatchMatmulV4Checker4MmadS8S4::CheckDimValue(const gert::StorageShape | |||
| 208 | auto x2Outer = dimValueOfMKN[3]; // using index 3 to get x2Outer | 226 | auto x2Outer = dimValueOfMKN[3]; // using index 3 to get x2Outer |
| 209 | auto kBSize = static_cast<uint64_t>(inputParams_.transB ? x2Inner : x2Outer); | 227 | auto kBSize = static_cast<uint64_t>(inputParams_.transB ? x2Inner : x2Outer); |
| 210 | OP_TILING_CHECK(inputParams_.kSize != kBSize, | 228 | OP_TILING_CHECK(inputParams_.kSize != kBSize, |
| 211 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, | 229 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(inputParams_.opName, "x1, x2", "kSize mismatch", |
| 212 | - "The size of k dimension of x1[%lu] is not equal to \ | 230 | + "The k dimension sizes of x1 and x2 must be equal"), |
| 213 | - the size of k dimension of x2[%lu]", | ||
| 214 | - inputParams_.kSize, kBSize), | ||
| 215 | return false); | 231 | return false); |
| 216 | // bias shape必须等于shapeN | 232 | // bias shape必须等于shapeN |
| 217 | OP_TILING_CHECK( | 233 | OP_TILING_CHECK( |
| 218 | biasShape != nullptr && static_cast<uint64_t>(biasShape->GetStorageShape().GetDim(0)) != inputParams_.nSize, | 234 | biasShape != nullptr && static_cast<uint64_t>(biasShape->GetStorageShape().GetDim(0)) != inputParams_.nSize, |
| 219 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, | 235 | + OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON(inputParams_.opName, "bias", |
| 220 | - "Input bias dimension shape should equal n, but it is %ld while n is %lu.", | 236 | + std::to_string(biasShape->GetStorageShape().GetDim(0)).c_str(), |
| 221 | - biasShape->GetStorageShape().GetDim(0), inputParams_.nSize), | 237 | + "The shape dim of bias must be equal to nSize"), |
| 222 | return false); | 238 | return false); |
| 223 | // offset shape必须是1或shapeN | 239 | // offset shape必须是1或shapeN |
| 224 | OP_TILING_CHECK( | 240 | OP_TILING_CHECK( |
| 225 | offsetShape != nullptr && | 241 | offsetShape != nullptr && |
| 226 | !(offsetShape->GetStorageShape().GetDim(0) == 1 || | 242 | !(offsetShape->GetStorageShape().GetDim(0) == 1 || |
| 227 | static_cast<uint64_t>(offsetShape->GetStorageShape().GetDim(0)) == inputParams_.nSize), | 243 | static_cast<uint64_t>(offsetShape->GetStorageShape().GetDim(0)) == inputParams_.nSize), |
| 228 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, "X2Offset dimension value must be 1 or n[%lu], but it is %ld.", | 244 | + OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON(inputParams_.opName, "x2Offset", |
| 229 | - inputParams_.nSize, offsetShape->GetStorageShape().GetDim(0)), | 245 | + std::to_string(offsetShape->GetStorageShape().GetDim(0)).c_str(), |
| 246 | + "The shape dim of x2Offset must be 1 or nSize"), | ||
| 230 | return false); | 247 | return false); |
| 231 | // scale维数必须存在 | 248 | // scale维数必须存在 |
| 232 | - OP_TILING_CHECK(scaleShape == nullptr, CUBE_INNER_ERR_REPORT(inputParams_.opName, "X2Scale does not exist"), | 249 | + OP_TILING_CHECK(scaleShape == nullptr, OP_LOGE(inputParams_.opName, "X2Scale does not exist"), |
| 233 | return false); | 250 | return false); |
| 234 | // scale维数必须是1维 | 251 | // scale维数必须是1维 |
| 235 | - OP_TILING_CHECK(scaleShape->GetStorageShape().GetDimNum() != 1, | 252 | + OP_TILING_CHECK( |
| 236 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, "X2Scale's dimension must be 1, actually is : %zu", | 253 | + scaleShape->GetStorageShape().GetDimNum() != 1, |
| 237 | - scaleShape->GetStorageShape().GetDimNum()), | 254 | + OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON(inputParams_.opName, "x2Scale", |
| 238 | - return false); | 255 | + std::to_string(scaleShape->GetStorageShape().GetDimNum()).c_str(), |
| 256 | + "The shape dim of x2Scale must be 1D"), | ||
| 257 | + return false); | ||
| 239 | // 当x1为INT8时,支持perchannel量化模式 | 258 | // 当x1为INT8时,支持perchannel量化模式 |
| 240 | OP_TILING_CHECK( | 259 | OP_TILING_CHECK( |
| 241 | inputParams_.aDtype == ge::DT_INT8 && !inputParams_.isPerChannel, | 260 | inputParams_.aDtype == ge::DT_INT8 && !inputParams_.isPerChannel, |
| 242 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, | 261 | + OP_LOGE_FOR_INVALID_CONFIG_WITH_REASON(inputParams_.opName, "perchannel", "antiQuantType", "quantMode", |
| 243 | - "When x1 dtype is INT8, the only supported quant mode is perchannel"), | 262 | + "When the dtype of x1 is INT8, the quant mode must be per_channel"), |
| 244 | return false); | 263 | return false); |
| 245 | // LUT场景x2 UIN1/INT2/INT4尾轴shape分别需要关于8/4/2对齐 | 264 | // LUT场景x2 UIN1/INT2/INT4尾轴shape分别需要关于8/4/2对齐 |
| 246 | if (inputParams_.isLut && (inputParams_.bDtype == ge::DT_INT4 || inputParams_.bDtype == ge::DT_INT2 || | 265 | if (inputParams_.isLut && (inputParams_.bDtype == ge::DT_INT4 || inputParams_.bDtype == ge::DT_INT2 || |
| 247 | inputParams_.bDtype == ge::DT_UINT1)) { | 266 | inputParams_.bDtype == ge::DT_UINT1)) { |
| 248 | auto it = DTYPE_NUMS_IN_BYTE_MAP.find(inputParams_.bDtype); | 267 | auto it = DTYPE_NUMS_IN_BYTE_MAP.find(inputParams_.bDtype); |
| 249 | OP_TILING_CHECK(it == DTYPE_NUMS_IN_BYTE_MAP.end(), | 268 | OP_TILING_CHECK(it == DTYPE_NUMS_IN_BYTE_MAP.end(), |
| 250 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, "DTYPE_NUMS_IN_BYTE_MAP[%s] is not exist", | 269 | + OP_LOGE_FOR_INVALID_CONFIG_WITH_REASON( |
| 251 | - ge::TypeUtils::DataTypeToSerialString(inputParams_.bDtype).c_str()), | 270 | + inputParams_.opName, ge::TypeUtils::DataTypeToSerialString(inputParams_.bDtype).c_str(), |
| 271 | + "bDtype", "DTYPE_NUMS_IN_BYTE_MAP", "dtype not found in nums map"), | ||
| 252 | return false); | 272 | return false); |
| 253 | 273 | ||
| 254 | - OP_TILING_CHECK(x2Inner % DTYPE_NUMS_IN_BYTE_MAP.at(inputParams_.bDtype) != 0, | 274 | + OP_TILING_CHECK( |
| 255 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, | 275 | + x2Inner % DTYPE_NUMS_IN_BYTE_MAP.at(inputParams_.bDtype) != 0, |
| 256 | - "the last dim of x2 should be a multiple of %u when x2 dtype is %s", | 276 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(inputParams_.opName, "x2", "x2Inner", |
| 257 | - DTYPE_NUMS_IN_BYTE_MAP.at(inputParams_.bDtype), | 277 | + "The last dim of x2 must be a multiple of dtypesPerByte"), |
| 258 | - ge::TypeUtils::DataTypeToSerialString(inputParams_.bDtype).c_str()), | 278 | + return false); |
| 259 | - return false); | 279 | + OP_TILING_CHECK( |
| 260 | - OP_TILING_CHECK(inputParams_.groupSizeK == 0 || inputParams_.groupSizeN == 0, | 280 | + inputParams_.groupSizeK == 0 || inputParams_.groupSizeN == 0, |
| 261 | - CUBE_INNER_ERR_REPORT( | 281 | + OP_LOGE_FOR_INVALID_VALUE_WITH_REASON( |
| 262 | - inputParams_.opName, | 282 | + inputParams_.opName, "groupSizeK/groupSizeN", "[inputParams_.groupSizeK, inputParams_.groupSizeN]", |
| 263 | - "groupSizeK or groupSizeN should not be zero when x2 dtype is %s, actual is [%lu, %lu]", | 283 | + "When in LUT mode, the values of groupSizeK and groupSizeN can not be 0"), |
| 264 | - ge::TypeUtils::DataTypeToSerialString(inputParams_.bDtype).c_str(), inputParams_.groupSizeK, | 284 | + return false); |
| 265 | - inputParams_.groupSizeN), | ||
| 266 | - return false); | ||
| 267 | OP_TILING_CHECK(!CheckX2TableShape(), | 285 | OP_TILING_CHECK(!CheckX2TableShape(), |
| 268 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, "x2Table shape is invalid"), return false); | 286 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(inputParams_.opName, "x2Table", "x2TableShape", |
| 287 | + "shape validation failed"), | ||
| 288 | + return false); | ||
| 269 | } | 289 | } |
| 270 | return true; | 290 | return true; |
| 271 | } | 291 | } |
| @@ -297,30 +317,24 @@ bool QuantBatchMatmulV4Checker4MmadS8S4::ExtraInputCheck() const | |||
| 297 | auto x1Format = static_cast<ge::Format>(ge::GetPrimaryFormat(x1Desc->GetStorageFormat())); | 317 | auto x1Format = static_cast<ge::Format>(ge::GetPrimaryFormat(x1Desc->GetStorageFormat())); |
| 298 | auto x2Desc = context_->GetInputDesc(GetX2Idx()); | 318 | auto x2Desc = context_->GetInputDesc(GetX2Idx()); |
| 299 | auto x2Format = static_cast<ge::Format>(ge::GetPrimaryFormat(x2Desc->GetStorageFormat())); | 319 | auto x2Format = static_cast<ge::Format>(ge::GetPrimaryFormat(x2Desc->GetStorageFormat())); |
| 300 | - OP_TILING_CHECK( | 320 | + OP_TILING_CHECK(x1Format != ge::Format::FORMAT_ND || x2Format != ge::Format::FORMAT_FRACTAL_NZ, |
| 301 | - x1Format != ge::Format::FORMAT_ND || x2Format != ge::Format::FORMAT_FRACTAL_NZ, | 321 | + OP_LOGE_FOR_INVALID_FORMATS_WITH_REASON( |
| 302 | - CUBE_INNER_ERR_REPORT( | 322 | + inputParams_.opName, "x1, x2", "x1Format, x2Format", |
| 303 | - inputParams_.opName, | 323 | + "When in LUT mode, the format of x1 must be ND and the format of x2 must be FRACTAL_NZ"), |
| 304 | - "In LUT scenario, input x1 format should be ND, x2 format should be FRACTAL_NZ, actual [%s, %s].", | 324 | + return false); |
| 305 | - ge::TypeUtils::FormatToSerialString(x1Format).c_str(), | ||
| 306 | - ge::TypeUtils::FormatToSerialString(x2Format).c_str()), | ||
| 307 | - return false); | ||
| 308 | 325 | ||
| 309 | // LUT场景,tranA/transB为false | 326 | // LUT场景,tranA/transB为false |
| 310 | OP_TILING_CHECK( | 327 | OP_TILING_CHECK( |
| 311 | inputParams_.transA || inputParams_.transB, | 328 | inputParams_.transA || inputParams_.transB, |
| 312 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, | 329 | + OP_LOGE_FOR_INVALID_VALUE_WITH_REASON(inputParams_.opName, "transA/transB", "actual_transA, actual_transB", |
| 313 | - "In LUT scenario, trans_a and trans_b should be false, actual [%s, %s]", | 330 | + "When in LUT mode, the values of transA and transB must be false"), |
| 314 | - inputParams_.transA ? "true" : "false", inputParams_.transB ? "true" : "false"), | ||
| 315 | return false); | 331 | return false); |
| 316 | 332 | ||
| 317 | // LUT场景,不支持batch | 333 | // LUT场景,不支持batch |
| 318 | - OP_TILING_CHECK( | 334 | + OP_TILING_CHECK(!(inputParams_.batchA == 1 && inputParams_.batchB == 1), |
| 319 | - !(inputParams_.batchA == 1 && inputParams_.batchB == 1), | 335 | + OP_LOGE_FOR_INVALID_VALUE_WITH_REASON(inputParams_.opName, "x1Batch/x2Batch", "actual_batches", |
| 320 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, | 336 | + "When in LUT mode, the batch of x1 and x2 must be 1"), |
| 321 | - "In LUT scenario, x1 batch and x2 batch should be 1/NULL, actual [%lu, %lu]", | 337 | + return false); |
| 322 | - inputParams_.batchA, inputParams_.batchB), | ||
| 323 | - return false); | ||
| 324 | } | 338 | } |
| 325 | 339 | ||
| 326 | return true; | 340 | return true; |
| @@ -332,13 +346,15 @@ bool QuantBatchMatmulV4Checker4MmadS8S4::CheckOffset(const gert::StorageShape* o | |||
| 332 | // 当outDtype不为INT8时,x2Offset不存在 | 346 | // 当outDtype不为INT8时,x2Offset不存在 |
| 333 | OP_TILING_CHECK( | 347 | OP_TILING_CHECK( |
| 334 | inputParams_.cDtype != ge::DT_INT8, | 348 | inputParams_.cDtype != ge::DT_INT8, |
| 335 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, "When outputDtype is not INT8, x2Offset must be null"), | 349 | + OP_LOGE_FOR_INVALID_CONFIG_WITH_REASON(inputParams_.opName, "x2Offset", "x2Offset", "quantConfig", |
| 350 | + "When the dtype of y is not INT8, x2Offset can not exist"), | ||
| 336 | return false); | 351 | return false); |
| 337 | // x2Offset维数只能是1维 | 352 | // x2Offset维数只能是1维 |
| 338 | OP_TILING_CHECK( | 353 | OP_TILING_CHECK( |
| 339 | offsetShape->GetStorageShape().GetDimNum() != 1, | 354 | offsetShape->GetStorageShape().GetDimNum() != 1, |
| 340 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, "X2Offset shape should be 1 dimension, but it is %zu", | 355 | + OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON(inputParams_.opName, "x2Offset", |
| 341 | - offsetShape->GetStorageShape().GetDimNum()), | 356 | + std::to_string(offsetShape->GetStorageShape().GetDimNum()).c_str(), |
| 357 | + "The shape dim of x2Offset must be 1D"), | ||
| 342 | return false); | 358 | return false); |
| 343 | } | 359 | } |
| 344 | return true; | 360 | return true; |
| @@ -149,11 +149,7 @@ ge::graphStatus QuantBatchMatmulV4PergroupArch35Tiling::CheckContext() | |||
| 149 | auto outputShape = context_->GetOutputShape(Y_OUTPUT_IDX); | 149 | auto outputShape = context_->GetOutputShape(Y_OUTPUT_IDX); |
| 150 | auto outputDesc = context_->GetOutputDesc(Y_OUTPUT_IDX); | 150 | auto outputDesc = context_->GetOutputDesc(Y_OUTPUT_IDX); |
| 151 | auto attrs = context_->GetAttrs(); | 151 | auto attrs = context_->GetAttrs(); |
| 152 | - | 152 | + OPS_CHECK_NULL_WITH_CONTEXT(context_, attrs); |
| 153 | - OP_TILING_CHECK( | ||
| 154 | - attrs == nullptr, VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, "Function context_.GetAttrs() failed!"), | ||
| 155 | - return ge::GRAPH_FAILED); | ||
| 156 | - | ||
| 157 | OPS_CHECK_NULL_WITH_CONTEXT(context_, x1Shape); | 153 | OPS_CHECK_NULL_WITH_CONTEXT(context_, x1Shape); |
| 158 | OPS_CHECK_NULL_WITH_CONTEXT(context_, x1Desc); | 154 | OPS_CHECK_NULL_WITH_CONTEXT(context_, x1Desc); |
| 159 | OPS_CHECK_NULL_WITH_CONTEXT(context_, x2Shape); | 155 | OPS_CHECK_NULL_WITH_CONTEXT(context_, x2Shape); |
| @@ -176,7 +172,7 @@ ge::graphStatus QuantBatchMatmulV4PergroupArch35Tiling::GetShapeAttrsInfo() | |||
| 176 | OPS_LOG_D(inputParams_.opName, "TilingContext: %s", Ops::NN::DebugTilingContext(context_).c_str()); | 172 | OPS_LOG_D(inputParams_.opName, "TilingContext: %s", Ops::NN::DebugTilingContext(context_).c_str()); |
| 177 | 173 | ||
| 178 | if (CheckContext() != ge::GRAPH_SUCCESS) { | 174 | if (CheckContext() != ge::GRAPH_SUCCESS) { |
| 179 | - CUBE_INNER_ERR_REPORT(inputParams_.opName, "Invalid context."); | 175 | + OP_LOGE(inputParams_.opName, "Invalid context."); |
| 180 | return ge::GRAPH_FAILED; | 176 | return ge::GRAPH_FAILED; |
| 181 | } | 177 | } |
| 182 | 178 | ||
Mmatmul/quant_batch_matmul_v4/op_host/op_tiling/arch35/quant_batch_matmul_v4_reg_base_tiling.cpp+25-26
| @@ -42,17 +42,13 @@ bool QuantBatchMatmulV4RegBase::IsCapable() | |||
| 42 | bool QuantBatchMatmulV4RegBase::CheckA8W4Params() const | 42 | bool QuantBatchMatmulV4RegBase::CheckA8W4Params() const |
| 43 | { | 43 | { |
| 44 | OP_CHECK_IF(inputParams_.transA, | 44 | OP_CHECK_IF(inputParams_.transA, |
| 45 | - VECTOR_INNER_ERR_REPORT_TILIING( | 45 | + OP_LOGE_FOR_INVALID_VALUE_WITH_REASON(inputParams_.opName, "transposeX1", (inputParams_.transA ? "true" : "false"), "The value of transposeX1 must be false"), |
| 46 | - inputParams_.opName, "Invalid params, only support transpose_x1 false. Actual transpose_x: %s.", | ||
| 47 | - inputParams_.transA ? "true" : "false"), | ||
| 48 | return false); | 46 | return false); |
| 49 | OP_CHECK_IF(inputParams_.bFormat == ge::FORMAT_ND && !inputParams_.transB, | 47 | OP_CHECK_IF(inputParams_.bFormat == ge::FORMAT_ND && !inputParams_.transB, |
| 50 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, | 48 | + OP_LOGE_FOR_INVALID_FORMATS_WITH_REASON(inputParams_.opName, "x2", "x2Format", "When transposeX2 is true, the format of x2 must be ND"), |
| 51 | - "Invalid params, only support x2 transpose FORMAT_ND."), | ||
| 52 | return false); | 49 | return false); |
| 53 | OP_CHECK_IF(inputParams_.antiQuantType == QuantType::PER_GROUP && inputParams_.bFormat == ge::FORMAT_FRACTAL_NZ && inputParams_.transB, | 50 | OP_CHECK_IF(inputParams_.antiQuantType == QuantType::PER_GROUP && inputParams_.bFormat == ge::FORMAT_FRACTAL_NZ && inputParams_.transB, |
| 54 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, | 51 | + OP_LOGE_FOR_INVALID_FORMATS_WITH_REASON(inputParams_.opName, "x2", "x2Format", "When the quant mode is per_group and transposeX2 is false, the format of x2 must be FRACTAL_NZ"), |
| 55 | - "Invalid params, only support x2 not transpose FORMAT_FRACTAL_NZ."), | ||
| 56 | return false); | 52 | return false); |
| 57 | 53 | ||
| 58 | if (inputParams_.antiQuantType == QuantType::MX) { | 54 | if (inputParams_.antiQuantType == QuantType::MX) { |
| @@ -72,9 +68,8 @@ bool QuantBatchMatmulV4RegBase::CheckA8W4Params() const | |||
| 72 | } | 68 | } |
| 73 | 69 | ||
| 74 | OP_CHECK_IF(inputParams_.groupSize % GROUP_ALIGN_SIZE > 0, | 70 | OP_CHECK_IF(inputParams_.groupSize % GROUP_ALIGN_SIZE > 0, |
| 75 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, | 71 | + OP_LOGE_FOR_INVALID_VALUE_WITH_REASON(inputParams_.opName, "groupSize", std::to_string(inputParams_.groupSize).c_str(), "The value of groupSize must be aligned to 32"), |
| 76 | - "Invalid params, groupSize must be 32 aligned, groupSize: %lu.", | 72 | + return false); |
| 77 | - inputParams_.groupSize), return false); | ||
| 78 | // A8W4 Nz场景要求n为32B对齐 | 73 | // A8W4 Nz场景要求n为32B对齐 |
| 79 | OP_CHECK_IF(inputParams_.bFormat == ge::FORMAT_FRACTAL_NZ && inputParams_.nSize % N_ALIGN_SIZE > 0, | 74 | OP_CHECK_IF(inputParams_.bFormat == ge::FORMAT_FRACTAL_NZ && inputParams_.nSize % N_ALIGN_SIZE > 0, |
| 80 | VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, | 75 | VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, |
| @@ -102,7 +97,7 @@ bool QuantBatchMatmulV4RegBase::CustomCheck() const | |||
| 102 | } | 97 | } |
| 103 | 98 | ||
| 104 | OP_CHECK_IF((inputParams_.cDtype != ge::DT_BF16) && (inputParams_.cDtype != ge::DT_FLOAT16), | 99 | OP_CHECK_IF((inputParams_.cDtype != ge::DT_BF16) && (inputParams_.cDtype != ge::DT_FLOAT16), |
| 105 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, "Invalid params, output only support DT_BF16 or DT_FLOAT16."), | 100 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(inputParams_.opName, "y", ge::TypeUtils::DataTypeToSerialString(inputParams_.cDtype).c_str(), "The dtype of y must be BF16 or FLOAT16"), |
| 106 | return false); | 101 | return false); |
| 107 | 102 | ||
| 108 | bool a8w4Flag = (inputParams_.aDtype == ge::DT_HIFLOAT8 || inputParams_.aDtype == ge::DT_FLOAT8_E5M2 || | 103 | bool a8w4Flag = (inputParams_.aDtype == ge::DT_HIFLOAT8 || inputParams_.aDtype == ge::DT_FLOAT8_E5M2 || |
| @@ -111,13 +106,18 @@ bool QuantBatchMatmulV4RegBase::CustomCheck() const | |||
| 111 | if (a8w4Flag) { | 106 | if (a8w4Flag) { |
| 112 | return CheckA8W4Params(); | 107 | return CheckA8W4Params(); |
| 113 | } else { | 108 | } else { |
| 114 | - OP_LOGE(inputParams_.opName, | 109 | + std::string incorrectVals = std::string("x1:") + |
| 115 | - "Only support x1 Dtype: %s, x2 Dtype: %s, y Dtype: %s, groupSize: " | 110 | + ge::TypeUtils::DataTypeToSerialString(inputParams_.aDtype) + ", x2:" + |
| 116 | - "%lu, transposeX1: %s, transposeX2: %s", | 111 | + ge::TypeUtils::DataTypeToSerialString(inputParams_.bDtype) + ", y:" + |
| 117 | - ge::TypeUtils::DataTypeToSerialString(inputParams_.aDtype).c_str(), | 112 | + ge::TypeUtils::DataTypeToSerialString(inputParams_.cDtype) + ", groupSize:" + |
| 118 | - ge::TypeUtils::DataTypeToSerialString(inputParams_.bDtype).c_str(), | 113 | + std::to_string(inputParams_.groupSize) + ", transA:" + |
| 119 | - ge::TypeUtils::DataTypeToSerialString(inputParams_.cDtype).c_str(), inputParams_.groupSize, | 114 | + (inputParams_.transA ? "true" : "false") + ", transB:" + |
| 120 | - inputParams_.transA ? "true" : "false", inputParams_.transB ? "true" : "false"); return false; | 115 | + (inputParams_.transB ? "true" : "false"); |
| 116 | + OP_LOGE_FOR_INVALID_VALUES_WITH_REASON( | ||
| 117 | + inputParams_.opName, "x1, x2, y, groupSize, transposeX1, transposeX2", | ||
| 118 | + incorrectVals.c_str(), | ||
| 119 | + "The dtype of x1 must be HIFLOAT8, FLOAT8_E5M2, or FLOAT8_E4M3FN, the dtype of x2 must be FLOAT4_E2M1 or FLOAT, and the dtype of y must be BF16 or FLOAT16"); | ||
| 120 | + return false; | ||
| 121 | } | 121 | } |
| 122 | return true; | 122 | return true; |
| 123 | } | 123 | } |
| @@ -140,10 +140,9 @@ bool QuantBatchMatmulV4RegBase::CheckCoreNum() const | |||
| 140 | ge::graphStatus QuantBatchMatmulV4RegBase::DoOpTiling() | 140 | ge::graphStatus QuantBatchMatmulV4RegBase::DoOpTiling() |
| 141 | { | 141 | { |
| 142 | OP_TILING_CHECK(InstantiateTilingData() == ge::GRAPH_FAILED, | 142 | OP_TILING_CHECK(InstantiateTilingData() == ge::GRAPH_FAILED, |
| 143 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, "unable to get pointer of tiling data"), | 143 | + OP_LOGE(inputParams_.opName, "unable to get pointer of tiling data"), |
| 144 | return ge::GRAPH_FAILED); | 144 | return ge::GRAPH_FAILED); |
| 145 | - OP_CHECK_IF(!CustomCheck(), VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, "Custom check failed."), | 145 | + OP_CHECK_IF(!CustomCheck(), OP_LOGE(inputParams_.opName, "Custom check failed."), return ge::GRAPH_FAILED); |
| 146 | - return ge::GRAPH_FAILED); | ||
| 147 | 146 | ||
| 148 | if (!CheckCoreNum()) { | 147 | if (!CheckCoreNum()) { |
| 149 | OP_LOGE(inputParams_.opName, "Check CoreNum fail."); | 148 | OP_LOGE(inputParams_.opName, "Check CoreNum fail."); |
| @@ -178,7 +177,7 @@ ge::graphStatus QuantBatchMatmulV4RegBase::DoOpTiling() | |||
| 178 | tilingSolver_.SetDtypeBits(GetDtypeBits(inputParams_.aDtype), GetDtypeBits(inputParams_.bDtype), | 177 | tilingSolver_.SetDtypeBits(GetDtypeBits(inputParams_.aDtype), GetDtypeBits(inputParams_.bDtype), |
| 179 | GetDtypeBits(inputParams_.biasDtype), B64_BITS); | 178 | GetDtypeBits(inputParams_.biasDtype), B64_BITS); |
| 180 | OP_CHECK_IF(!tilingSolver_.GetBasicBlockTiling(), | 179 | OP_CHECK_IF(!tilingSolver_.GetBasicBlockTiling(), |
| 181 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, "Unable to get matmul tiling for mnk[%lu, %lu, %lu]", | 180 | + OP_LOGE(inputParams_.opName, "Unable to get matmul tiling for mnk[%lu, %lu, %lu]", |
| 182 | inputParams_.mSize, inputParams_.nSize, inputParams_.kSize), | 181 | inputParams_.mSize, inputParams_.nSize, inputParams_.kSize), |
| 183 | return ge::GRAPH_FAILED); | 182 | return ge::GRAPH_FAILED); |
| 184 | SetMatmulTiling(); | 183 | SetMatmulTiling(); |
| @@ -207,10 +206,10 @@ ge::graphStatus QuantBatchMatmulV4RegBase::PostTiling() | |||
| 207 | { | 206 | { |
| 208 | OP_LOGD(inputParams_.opName, "final tiling data size: %zu", tilingDataSize_); | 207 | OP_LOGD(inputParams_.opName, "final tiling data size: %zu", tilingDataSize_); |
| 209 | 208 | ||
| 210 | - OP_TILING_CHECK(tilingDataSize_ % sizeof(uint64_t) != 0, | 209 | + OP_TILING_CHECK( |
| 211 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, "tiling data size[%zu] not aligned to 8", | 210 | + tilingDataSize_ % sizeof(uint64_t) != 0, |
| 212 | - tilingDataSize_), | 211 | + OP_LOGE(inputParams_.opName, "tiling data size[%zu] not aligned to 8", tilingDataSize_), |
| 213 | - return ge::GRAPH_FAILED); | 212 | + return ge::GRAPH_FAILED); |
| 214 | context_->GetRawTilingData()->SetDataSize(tilingDataSize_); | 213 | context_->GetRawTilingData()->SetDataSize(tilingDataSize_); |
| 215 | context_->SetBlockDim(tilingData_->cubeNumBlocksM * tilingData_->cubeNumBlocksN); | 214 | context_->SetBlockDim(tilingData_->cubeNumBlocksM * tilingData_->cubeNumBlocksN); |
| 216 | 215 | ||
| @@ -64,7 +64,7 @@ void QuantBatchMatmulV4TilingBase::InitCompileInfo() | |||
| 64 | compileInfoPtr_ = | 64 | compileInfoPtr_ = |
| 65 | std::unique_ptr<QuantBatchMatmulV4CompileInfo>(new (std::nothrow) QuantBatchMatmulV4CompileInfo()); | 65 | std::unique_ptr<QuantBatchMatmulV4CompileInfo>(new (std::nothrow) QuantBatchMatmulV4CompileInfo()); |
| 66 | OP_TILING_CHECK(compileInfoPtr_ == nullptr, | 66 | OP_TILING_CHECK(compileInfoPtr_ == nullptr, |
| 67 | - VECTOR_INNER_ERR_REPORT_TILIING(context_->GetNodeName(), "failed to instantiate compile info"), | 67 | + OP_LOGE(context_->GetNodeName(), "failed to instantiate compile info"), |
| 68 | return); | 68 | return); |
| 69 | 69 | ||
| 70 | compileInfoPtr_->aivNum = ascendcPlatform.GetCoreNumAiv(); | 70 | compileInfoPtr_->aivNum = ascendcPlatform.GetCoreNumAiv(); |
| @@ -136,11 +136,11 @@ ge::graphStatus QuantBatchMatmulV4TilingBase::GetShapeAttrsInfo() | |||
| 136 | OPS_LOG_D(inputParams_.opName, "TilingContext: %s", Ops::NN::DebugTilingContext(context_).c_str()); | 136 | OPS_LOG_D(inputParams_.opName, "TilingContext: %s", Ops::NN::DebugTilingContext(context_).c_str()); |
| 137 | auto compileInfoPtr = compileInfoPtr_ ? compileInfoPtr_.get() : | 137 | auto compileInfoPtr = compileInfoPtr_ ? compileInfoPtr_.get() : |
| 138 | reinterpret_cast<const QuantBatchMatmulV4CompileInfo *>(context_->GetCompileInfo()); | 138 | reinterpret_cast<const QuantBatchMatmulV4CompileInfo *>(context_->GetCompileInfo()); |
| 139 | - OP_LOGE_IF(compileInfoPtr == nullptr, ge::GRAPH_FAILED, context_->GetNodeName(), "compileInfoPtr is null"); | 139 | + OPS_CHECK_NULL_WITH_CONTEXT(context_, compileInfoPtr); |
| 140 | inputParams_.supportL0c2Out = compileInfoPtr->supportL0c2Out; | 140 | inputParams_.supportL0c2Out = compileInfoPtr->supportL0c2Out; |
| 141 | inputParams_.supportL12BtBf16 = compileInfoPtr->supportL12BtBf16; | 141 | inputParams_.supportL12BtBf16 = compileInfoPtr->supportL12BtBf16; |
| 142 | OPS_LOG_D(inputParams_.opName, "TilingContext: %s", Ops::NN::DebugTilingContext(context_).c_str()); | 142 | OPS_LOG_D(inputParams_.opName, "TilingContext: %s", Ops::NN::DebugTilingContext(context_).c_str()); |
| 143 | - OP_TILING_CHECK(CheckContext() != ge::GRAPH_SUCCESS, VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, "invalid context"), | 143 | + OP_TILING_CHECK(CheckContext() != ge::GRAPH_SUCCESS, OP_LOGE(inputParams_.opName, "invalid context"), |
| 144 | return ge::GRAPH_FAILED); | 144 | return ge::GRAPH_FAILED); |
| 145 | inputParams_.bFormat = static_cast<ge::Format>(ge::GetPrimaryFormat(context_->GetInputDesc(1)->GetStorageFormat())); | 145 | inputParams_.bFormat = static_cast<ge::Format>(ge::GetPrimaryFormat(context_->GetInputDesc(1)->GetStorageFormat())); |
| 146 | if (IsFormatNZ(inputParams_.bFormat)) { | 146 | if (IsFormatNZ(inputParams_.bFormat)) { |
| @@ -260,38 +260,38 @@ bool QuantBatchMatmulV4TilingBase::AnalyzeDtype() | |||
| 260 | inputParams_.templateDtype = inputParams_.cDtype == ge::DT_FLOAT16 ? DtypeEnum::FLOAT16 : DtypeEnum::BFLOAT16; | 260 | inputParams_.templateDtype = inputParams_.cDtype == ge::DT_FLOAT16 ? DtypeEnum::FLOAT16 : DtypeEnum::BFLOAT16; |
| 261 | // check x1 dtype | 261 | // check x1 dtype |
| 262 | OP_TILING_CHECK(inputParams_.aDtype != ge::DT_FLOAT8_E5M2 && inputParams_.aDtype != ge::DT_FLOAT8_E4M3FN, | 262 | OP_TILING_CHECK(inputParams_.aDtype != ge::DT_FLOAT8_E5M2 && inputParams_.aDtype != ge::DT_FLOAT8_E4M3FN, |
| 263 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, | 263 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON( |
| 264 | - "Unsupported data type [%s] for X1. Only DT_FLOAT8_E5M2 and DT_FLOAT8_E4M3FN are supported.", | 264 | + inputParams_.opName, "x1", ge::TypeUtils::DataTypeToSerialString(inputParams_.aDtype).c_str(), |
| 265 | - ge::TypeUtils::DataTypeToSerialString(inputParams_.aDtype).c_str()), | 265 | + "The dtype of x1 must be FLOAT8_E5M2 or FLOAT8_E4M3FN"), |
| 266 | - return false); | 266 | + return false); |
| 267 | // check x2 dtype | 267 | // check x2 dtype |
| 268 | OP_TILING_CHECK(inputParams_.bDtype != ge::DT_FLOAT4_E2M1, | 268 | OP_TILING_CHECK(inputParams_.bDtype != ge::DT_FLOAT4_E2M1, |
| 269 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, | 269 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON( |
| 270 | - "Unsupported data type [%s] for X2. Only DT_FLOAT4_E2M1 is supported.", | 270 | + inputParams_.opName, "x2", ge::TypeUtils::DataTypeToSerialString(inputParams_.bDtype).c_str(), |
| 271 | - ge::TypeUtils::DataTypeToSerialString(inputParams_.bDtype).c_str()), | 271 | + "The dtype of x2 must be FLOAT4_E2M1"), |
| 272 | - return false); | 272 | + return false); |
| 273 | OP_TILING_CHECK( | 273 | OP_TILING_CHECK( |
| 274 | inputParams_.antiQuantType == QuantType::PER_GROUP && inputParams_.bFormat == ge::FORMAT_FRACTAL_NZ && | 274 | inputParams_.antiQuantType == QuantType::PER_GROUP && inputParams_.bFormat == ge::FORMAT_FRACTAL_NZ && |
| 275 | - inputParams_.bDtype != ge::DT_FLOAT4_E2M1, | 275 | + inputParams_.bDtype != ge::DT_FLOAT4_E2M1, |
| 276 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, | 276 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON( |
| 277 | - "Unsupported data type [%s] for X2. Only DT_FLOAT4_E2M1 is supported for per_group and NZ format.", | 277 | + inputParams_.opName, "x2", ge::TypeUtils::DataTypeToSerialString(inputParams_.bDtype).c_str(), |
| 278 | - ge::TypeUtils::DataTypeToSerialString(inputParams_.bDtype).c_str()), | 278 | + "When the quant mode is per_group and the format of x2 is FRACTAL_NZ, the dtype of x2 must be FLOAT4_E2M1"), |
| 279 | return false); | 279 | return false); |
| 280 | // check y dtype | 280 | // check y dtype |
| 281 | - OP_TILING_CHECK(inputParams_.cDtype != ge::DT_BF16 && inputParams_.cDtype != ge::DT_FLOAT16, | 281 | + OP_TILING_CHECK( |
| 282 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, | 282 | + inputParams_.cDtype != ge::DT_BF16 && inputParams_.cDtype != ge::DT_FLOAT16, |
| 283 | - "Unsupported data type [%s] for Y. DT_BF16 and DT_FLOAT16 are supported.", | 283 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON( |
| 284 | - ge::TypeUtils::DataTypeToSerialString(inputParams_.cDtype).c_str()), | 284 | + inputParams_.opName, "y", ge::TypeUtils::DataTypeToSerialString(inputParams_.cDtype).c_str(), |
| 285 | + "The dtype of y must be BF16 or FLOAT16."), | ||
| 285 | return false); | 286 | return false); |
| 286 | if (inputParams_.antiQuantType != QuantType::MX) { | 287 | if (inputParams_.antiQuantType != QuantType::MX) { |
| 287 | // check yScale dtype | 288 | // check yScale dtype |
| 288 | - OP_TILING_CHECK(yScaleDesc == nullptr, | 289 | + OP_TILING_CHECK(yScaleDesc == nullptr, OP_LOGE(inputParams_.opName, "yScaleDesc is null"), return false); |
| 289 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, "yScaleDesc is null"), | 290 | + OP_TILING_CHECK( |
| 290 | - return false); | 291 | + yScaleDesc->GetDataType() != ge::DT_UINT64, |
| 291 | - OP_TILING_CHECK(yScaleDesc->GetDataType() != ge::DT_UINT64, | 292 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON( |
| 292 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, | 293 | + inputParams_.opName, "yScale", ge::TypeUtils::DataTypeToSerialString(yScaleDesc->GetDataType()).c_str(), |
| 293 | - "Unsupported data type [%s] for yScale. Only DT_UINT64 is supported.", | 294 | + "The dtype of yScale must be UINT64."), |
| 294 | - ge::TypeUtils::DataTypeToSerialString(yScaleDesc->GetDataType()).c_str()), | ||
| 295 | return false); | 295 | return false); |
| 296 | } | 296 | } |
| 297 | return AnalyzeBiasDtype(biasDesc) && AnalyzeX1scaleDtype(x1ScaleDesc) && AnalyzeX2scaleDtype(x2ScaleDesc); | 297 | return AnalyzeBiasDtype(biasDesc) && AnalyzeX1scaleDtype(x1ScaleDesc) && AnalyzeX2scaleDtype(x2ScaleDesc); |
| @@ -301,10 +301,11 @@ bool QuantBatchMatmulV4TilingBase::AnalyzeBiasDtype(const gert::CompileTimeTenso | |||
| 301 | { | 301 | { |
| 302 | if (inputParams_.hasBias && biasDesc != nullptr) { | 302 | if (inputParams_.hasBias && biasDesc != nullptr) { |
| 303 | inputParams_.biasDtype = biasDesc->GetDataType(); | 303 | inputParams_.biasDtype = biasDesc->GetDataType(); |
| 304 | - OP_TILING_CHECK(inputParams_.biasDtype != ge::DT_BF16 && inputParams_.biasDtype != ge::DT_FLOAT16, | 304 | + OP_TILING_CHECK( |
| 305 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, | 305 | + inputParams_.biasDtype != ge::DT_BF16 && inputParams_.biasDtype != ge::DT_FLOAT16, |
| 306 | - "Unsupported data type [%s] for Bias. Only DT_BF16 and DT_FLOAT16 is supported.", | 306 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(inputParams_.opName, "bias", |
| 307 | - ge::TypeUtils::DataTypeToSerialString(inputParams_.biasDtype).c_str()), | 307 | + ge::TypeUtils::DataTypeToSerialString(inputParams_.biasDtype).c_str(), |
| 308 | + "The dtype of bias must be BF16 or FLOAT16"), | ||
| 308 | return false); | 309 | return false); |
| 309 | mmBiasDtype_ = GetMatmulTilingDtype(inputParams_.biasDtype); | 310 | mmBiasDtype_ = GetMatmulTilingDtype(inputParams_.biasDtype); |
| 310 | } | 311 | } |
| @@ -318,9 +319,10 @@ bool QuantBatchMatmulV4TilingBase::AnalyzeX1scaleDtype(const gert::CompileTimeTe | |||
| 318 | inputParams_.x1ScaleDtype = x1ScaleDesc->GetDataType(); | 319 | inputParams_.x1ScaleDtype = x1ScaleDesc->GetDataType(); |
| 319 | OP_TILING_CHECK( | 320 | OP_TILING_CHECK( |
| 320 | inputParams_.x1ScaleDtype != ge::DT_FLOAT8_E8M0, | 321 | inputParams_.x1ScaleDtype != ge::DT_FLOAT8_E8M0, |
| 321 | - VECTOR_INNER_ERR_REPORT_TILIING( | 322 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON( |
| 322 | - inputParams_.opName, "Unsupported data type [%s] for X1 scale. Only DT_FLOAT8_E8M0 is supported.", | 323 | + inputParams_.opName, "x1Scale", |
| 323 | - ge::TypeUtils::DataTypeToSerialString(inputParams_.x1ScaleDtype).c_str()), | 324 | + ge::TypeUtils::DataTypeToSerialString(inputParams_.x1ScaleDtype).c_str(), |
| 325 | + "The dtype of x1Scale must be FLOAT8_E8M0"), | ||
| 324 | return false); | 326 | return false); |
| 325 | } | 327 | } |
| 326 | return true; | 328 | return true; |
| @@ -329,31 +331,27 @@ bool QuantBatchMatmulV4TilingBase::AnalyzeX1scaleDtype(const gert::CompileTimeTe | |||
| 329 | bool QuantBatchMatmulV4TilingBase::AnalyzeX2scaleDtype(const gert::CompileTimeTensorDesc* x2ScaleDesc) | 331 | bool QuantBatchMatmulV4TilingBase::AnalyzeX2scaleDtype(const gert::CompileTimeTensorDesc* x2ScaleDesc) |
| 330 | { | 332 | { |
| 331 | OP_TILING_CHECK(x2ScaleDesc == nullptr, | 333 | OP_TILING_CHECK(x2ScaleDesc == nullptr, |
| 332 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, "X2 scale can not be null."), return false); | 334 | + OP_LOGE(inputParams_.opName, "X2 scale can not be null."), return false); |
| 333 | inputParams_.x2ScaleDtype = x2ScaleDesc->GetDataType(); | 335 | inputParams_.x2ScaleDtype = x2ScaleDesc->GetDataType(); |
| 334 | OP_TILING_CHECK( | 336 | OP_TILING_CHECK( |
| 335 | inputParams_.antiQuantType == QuantType::PER_GROUP && inputParams_.x2ScaleDtype != ge::DT_BF16 && | 337 | inputParams_.antiQuantType == QuantType::PER_GROUP && inputParams_.x2ScaleDtype != ge::DT_BF16 && |
| 336 | inputParams_.x2ScaleDtype != ge::DT_FLOAT16, | 338 | inputParams_.x2ScaleDtype != ge::DT_FLOAT16, |
| 337 | - VECTOR_INNER_ERR_REPORT_TILIING( | 339 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON( |
| 338 | - inputParams_.opName, | 340 | + inputParams_.opName, "x2Scale", ge::TypeUtils::DataTypeToSerialString(inputParams_.x2ScaleDtype).c_str(), |
| 339 | - "In per_group quantization mode, the x2 scale dtype supports DT_BF16 and DT_FLOAT16, but the actual value " | 341 | + "When the quant mode is per_group, the dtype of x2Scale must be BF16 or FLOAT16"), |
| 340 | - "is %s.", | ||
| 341 | - ge::TypeUtils::DataTypeToSerialString(inputParams_.x2ScaleDtype).c_str()), | ||
| 342 | return false); | 342 | return false); |
| 343 | OP_TILING_CHECK( | 343 | OP_TILING_CHECK( |
| 344 | inputParams_.x2ScaleDtype != ge::DT_BF16 && inputParams_.x2ScaleDtype != ge::DT_FLOAT8_E8M0 && | 344 | inputParams_.x2ScaleDtype != ge::DT_BF16 && inputParams_.x2ScaleDtype != ge::DT_FLOAT8_E8M0 && |
| 345 | inputParams_.x2ScaleDtype != ge::DT_FLOAT16, | 345 | inputParams_.x2ScaleDtype != ge::DT_FLOAT16, |
| 346 | - VECTOR_INNER_ERR_REPORT_TILIING( | 346 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(inputParams_.opName, "x2Scale", |
| 347 | - inputParams_.opName, | 347 | + ge::TypeUtils::DataTypeToSerialString(inputParams_.x2ScaleDtype).c_str(), |
| 348 | - "Unsupported data type [%s] for X2 scale. Only DT_BF16, DT_FLOAT16 and DT_FLOAT8_E8M0 is supported.", | 348 | + "The dtype of x2Scale must be BF16, FLOAT16, or FLOAT8_E8M0"), |
| 349 | - ge::TypeUtils::DataTypeToSerialString(inputParams_.x2ScaleDtype).c_str()), | ||
| 350 | return false); | 349 | return false); |
| 351 | OP_TILING_CHECK( | 350 | OP_TILING_CHECK( |
| 352 | inputParams_.antiQuantType == QuantType::MX && inputParams_.x2ScaleDtype != ge::DT_FLOAT8_E8M0, | 351 | inputParams_.antiQuantType == QuantType::MX && inputParams_.x2ScaleDtype != ge::DT_FLOAT8_E8M0, |
| 353 | - VECTOR_INNER_ERR_REPORT_TILIING( | 352 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(inputParams_.opName, "x2Scale", |
| 354 | - inputParams_.opName, | 353 | + ge::TypeUtils::DataTypeToSerialString(inputParams_.x2ScaleDtype).c_str(), |
| 355 | - "In MX quantization mode, the x2 scale dtype supports only DT_FLOAT8_E8M0, but the actual value is %s.", | 354 | + "When the quant mode is MX, the dtype of x2Scale must be FLOAT8_E8M0"), |
| 356 | - ge::TypeUtils::DataTypeToSerialString(inputParams_.x2ScaleDtype).c_str()), | ||
| 357 | return false); | 355 | return false); |
| 358 | return true; | 356 | return true; |
| 359 | } | 357 | } |
| @@ -364,39 +362,37 @@ bool QuantBatchMatmulV4TilingBase::AnalyzeTranspose() | |||
| 364 | // check transposeX1 | 362 | // check transposeX1 |
| 365 | auto transposeX1 = attrs->GetAttrPointer<bool>(TRANSPOSE_X1_INDEX); | 363 | auto transposeX1 = attrs->GetAttrPointer<bool>(TRANSPOSE_X1_INDEX); |
| 366 | OP_TILING_CHECK(transposeX1 == nullptr, | 364 | OP_TILING_CHECK(transposeX1 == nullptr, |
| 367 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, "TransposeX1 false can not be nullptr"), | 365 | + OP_LOGE(inputParams_.opName, "TransposeX1 can not be nullptr"), |
| 368 | return false); | 366 | return false); |
| 369 | - OP_TILING_CHECK(*transposeX1 != false, | 367 | + OP_TILING_CHECK( |
| 370 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, | 368 | + *transposeX1 != false, |
| 371 | - "Unsupported value [%d] for transposeX1. Only transposeX1 = false is supported.", | 369 | + OP_LOGE_FOR_INVALID_VALUE_WITH_REASON(inputParams_.opName, "transposeX1", (*transposeX1 ? "true" : "false"), |
| 372 | - *transposeX1), | 370 | + "The value of transposeX1 must be false"), |
| 373 | return false); | 371 | return false); |
| 374 | inputParams_.transA = transposeX1 != nullptr && *transposeX1; | 372 | inputParams_.transA = transposeX1 != nullptr && *transposeX1; |
| 375 | // check transposeX2 | 373 | // check transposeX2 |
| 376 | auto transposeX2 = attrs->GetAttrPointer<bool>(TRANSPOSE_X2_INDEX); | 374 | auto transposeX2 = attrs->GetAttrPointer<bool>(TRANSPOSE_X2_INDEX); |
| 377 | OP_TILING_CHECK(transposeX2 == nullptr, | 375 | OP_TILING_CHECK(transposeX2 == nullptr, |
| 378 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, "TransposeX2 true can not be nullptr"), | 376 | + OP_LOGE(inputParams_.opName, "TransposeX2 can not be nullptr"), |
| 379 | return false); | 377 | return false); |
| 380 | OP_TILING_CHECK( | 378 | OP_TILING_CHECK( |
| 381 | inputParams_.bFormat == ge::FORMAT_ND && *transposeX2 != true, | 379 | inputParams_.bFormat == ge::FORMAT_ND && *transposeX2 != true, |
| 382 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, | 380 | + OP_LOGE_FOR_INVALID_VALUE_WITH_REASON(inputParams_.opName, "transposeX2", (*transposeX2 ? "true" : "false"), |
| 383 | - "Unsupported value [%d] for transposeX2 in ND format. Only transposeX2 = true is supported in ND format.", | 381 | + "When the format of x2 is ND, the value of transposeX2 must be true"), |
| 384 | - *transposeX2), | ||
| 385 | return false); | 382 | return false); |
| 386 | if (inputParams_.antiQuantType == QuantType::MX) { | 383 | if (inputParams_.antiQuantType == QuantType::MX) { |
| 387 | OP_TILING_CHECK( | 384 | OP_TILING_CHECK( |
| 388 | inputParams_.bFormat == ge::FORMAT_FRACTAL_NZ && *transposeX2 != true, | 385 | inputParams_.bFormat == ge::FORMAT_FRACTAL_NZ && *transposeX2 != true, |
| 389 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, | 386 | + OP_LOGE_FOR_INVALID_VALUE_WITH_REASON( |
| 390 | - "Unsupported value [%d] for transposeX2 in NZ format. Only transposeX2 = true is supported in NZ format.", | 387 | + inputParams_.opName, "transposeX2", (*transposeX2 ? "true" : "false"), |
| 391 | - *transposeX2), | 388 | + "When the quant mode is MX and the format of x2 is FRACTAL_NZ, the value of transposeX2 must be true"), |
| 392 | return false); | 389 | return false); |
| 393 | } else { | 390 | } else { |
| 394 | - OP_TILING_CHECK( | 391 | + OP_TILING_CHECK(inputParams_.bFormat == ge::FORMAT_FRACTAL_NZ && *transposeX2 != false, |
| 395 | - inputParams_.bFormat == ge::FORMAT_FRACTAL_NZ && *transposeX2 != false, | 392 | + OP_LOGE_FOR_INVALID_VALUE_WITH_REASON( |
| 396 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, | 393 | + inputParams_.opName, "transposeX2", (*transposeX2 ? "true" : "false"), |
| 397 | - "Unsupported value [%d] for transposeX2 in NZ format. Only transposeX2 = false is supported in NZ format.", | 394 | + "When the format of x2 is FRACTAL_NZ, the value of transposeX2 must be false"), |
| 398 | - *transposeX2), | 395 | + return false); |
| 399 | - return false); | ||
| 400 | } | 396 | } |
| 401 | inputParams_.transB = transposeX2 != nullptr && *transposeX2; | 397 | inputParams_.transB = transposeX2 != nullptr && *transposeX2; |
| 402 | return true; | 398 | return true; |
| @@ -408,39 +404,36 @@ bool QuantBatchMatmulV4TilingBase::AnalyzeAttrs() | |||
| 408 | // check groupSize | 404 | // check groupSize |
| 409 | const int64_t *groupSizePtr = attrs->GetAttrPointer<int64_t>(GROUP_SIZE_INDEX); | 405 | const int64_t *groupSizePtr = attrs->GetAttrPointer<int64_t>(GROUP_SIZE_INDEX); |
| 410 | OP_TILING_CHECK(groupSizePtr == nullptr, | 406 | OP_TILING_CHECK(groupSizePtr == nullptr, |
| 411 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, "Group size can not be nullptr"), | 407 | + OP_LOGE(inputParams_.opName, "Group size can not be nullptr"), |
| 408 | + return false); | ||
| 409 | + OP_TILING_CHECK( | ||
| 410 | + inputParams_.bFormat == ge::FORMAT_ND && *groupSizePtr != GROUP_ALIGN_SIZE, | ||
| 411 | + OP_LOGE_FOR_INVALID_VALUE_WITH_REASON(inputParams_.opName, "groupSize", std::to_string(*groupSizePtr).c_str(), | ||
| 412 | + "When the format of x2 is ND, the value of groupSize must be 32"), | ||
| 412 | return false); | 413 | return false); |
| 413 | - OP_TILING_CHECK(inputParams_.bFormat == ge::FORMAT_ND && *groupSizePtr != GROUP_ALIGN_SIZE, | ||
| 414 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, | ||
| 415 | - "Unsupported value [%ld] for groupSize in x2 ND format. Only " | ||
| 416 | - "groupSize = %ld is supported in x2 ND format.", | ||
| 417 | - *groupSizePtr, GROUP_ALIGN_SIZE), | ||
| 418 | - return false); | ||
| 419 | OP_TILING_CHECK( | 414 | OP_TILING_CHECK( |
| 420 | inputParams_.bFormat == ge::FORMAT_FRACTAL_NZ && *groupSizePtr != NZ_GROUP_SIZE_32, | 415 | inputParams_.bFormat == ge::FORMAT_FRACTAL_NZ && *groupSizePtr != NZ_GROUP_SIZE_32, |
| 421 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, "Unsupported value [%ld] for groupSize in x2 FRACTAL_NZ format. Only " | 416 | + OP_LOGE_FOR_INVALID_VALUE_WITH_REASON(inputParams_.opName, "groupSize", std::to_string(*groupSizePtr).c_str(), |
| 422 | - "groupSize = %ld is supported in x2 ND format.", *groupSizePtr, NZ_GROUP_SIZE_32), | 417 | + "When the format of x2 is FRACTAL_NZ, the value of groupSize must be 32"), |
| 423 | return false); | 418 | return false); |
| 424 | inputParams_.groupSize = static_cast<uint64_t>(*groupSizePtr); | 419 | inputParams_.groupSize = static_cast<uint64_t>(*groupSizePtr); |
| 425 | inputParams_.vecInnerAxisAlignUnit = inputParams_.groupSize; | 420 | inputParams_.vecInnerAxisAlignUnit = inputParams_.groupSize; |
| 426 | return AnalyzeTranspose();; | 421 | return AnalyzeTranspose();; |
| 427 | } | 422 | } |
| 428 | 423 | ||
| 429 | -bool QuantBatchMatmulV4TilingBase::AnalyzeX2InputDim(const gert::StorageShape *x2Shape) | 424 | +bool QuantBatchMatmulV4TilingBase::AnalyzeX2InputDim(const gert::StorageShape* x2Shape) |
| 430 | { | 425 | { |
| 431 | auto x2ShapeDimSize = x2Shape->GetStorageShape().GetDimNum(); | 426 | auto x2ShapeDimSize = x2Shape->GetStorageShape().GetDimNum(); |
| 432 | OP_TILING_CHECK( | 427 | OP_TILING_CHECK( |
| 433 | inputParams_.bFormat == ge::FORMAT_ND && x2ShapeDimSize != VALID_INPUT_DIM_NUM, | 428 | inputParams_.bFormat == ge::FORMAT_ND && x2ShapeDimSize != VALID_INPUT_DIM_NUM, |
| 434 | - VECTOR_INNER_ERR_REPORT_TILIING( | 429 | + OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON(inputParams_.opName, "x2", std::to_string(x2ShapeDimSize).c_str(), |
| 435 | - inputParams_.opName, | 430 | + "When the format of x2 is ND, the shape dim of x2 must be 2D"), |
| 436 | - "Unsupport value [%lu] for x2 shape dim in FORMAT_ND. Only shape size = %lu is supported.", x2ShapeDimSize, VALID_INPUT_DIM_NUM), | 431 | + return false); |
| 432 | + OP_TILING_CHECK( | ||
| 433 | + inputParams_.bFormat == ge::FORMAT_FRACTAL_NZ && x2ShapeDimSize != VALID_WEIGHT_NZ_DIM_NUM, | ||
| 434 | + OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON(inputParams_.opName, "x2", std::to_string(x2ShapeDimSize).c_str(), | ||
| 435 | + "When the format of x2 is FRACTAL_NZ, the shape dim of x2 must be 4D"), | ||
| 437 | return false); | 436 | return false); |
| 438 | - OP_TILING_CHECK(inputParams_.bFormat == ge::FORMAT_FRACTAL_NZ && x2ShapeDimSize != VALID_WEIGHT_NZ_DIM_NUM, | ||
| 439 | - VECTOR_INNER_ERR_REPORT_TILIING( | ||
| 440 | - inputParams_.opName, | ||
| 441 | - "Unsupport value [%lu] for x2 shape dim in FORMAT_FRACTAL_NZ. Only shape size = %lu is supported.", | ||
| 442 | - x2ShapeDimSize, VALID_WEIGHT_NZ_DIM_NUM), | ||
| 443 | - return false); | ||
| 444 | return true; | 437 | return true; |
| 445 | } | 438 | } |
| 446 | 439 | ||
| @@ -454,12 +447,18 @@ bool QuantBatchMatmulV4TilingBase::AnalyzeInputs() | |||
| 454 | auto yScaleShape = context_->GetOptionalInputShape(Y_SCALE_INDEX); | 447 | auto yScaleShape = context_->GetOptionalInputShape(Y_SCALE_INDEX); |
| 455 | auto yOffsetShape = context_->GetOptionalInputShape(Y_OFFSET_INDEX); | 448 | auto yOffsetShape = context_->GetOptionalInputShape(Y_OFFSET_INDEX); |
| 456 | auto yShape = context_->GetOutputShape(Y_OUTPUT_INDEX)->GetStorageShape(); | 449 | auto yShape = context_->GetOutputShape(Y_OUTPUT_INDEX)->GetStorageShape(); |
| 457 | - OP_TILING_CHECK(x1Shape->GetStorageShape().GetShapeSize() == 0, VECTOR_INNER_ERR_REPORT_TILIING( | 450 | + OP_TILING_CHECK( |
| 458 | - inputParams_.opName, "X1 shape can not be empty. Only support shape size greater than 0, but get [%s]", | 451 | + x1Shape->GetStorageShape().GetShapeSize() == 0, |
| 459 | - Ops::Base::ToString(x1Shape->GetStorageShape()).c_str()), return false); | 452 | + OP_LOGE_FOR_INVALID_SHAPESIZE_WITH_REASON( |
| 460 | - OP_TILING_CHECK(x2Shape->GetStorageShape().GetShapeSize() == 0, VECTOR_INNER_ERR_REPORT_TILIING( | 453 | + inputParams_.opName, "x1", Ops::Base::ToString(x1Shape->GetStorageShape()).c_str(), |
| 461 | - inputParams_.opName, "X2 shape can not be empty. Only support shape size greater than 0, but get [%s]", | 454 | + "The shape size of x1 must be > 0"), |
| 462 | - Ops::Base::ToString(x2Shape->GetStorageShape()).c_str()), return false); | 455 | + return false); |
| 456 | + OP_TILING_CHECK( | ||
| 457 | + x2Shape->GetStorageShape().GetShapeSize() == 0, | ||
| 458 | + OP_LOGE_FOR_INVALID_SHAPESIZE_WITH_REASON( | ||
| 459 | + inputParams_.opName, "x2", Ops::Base::ToString(x2Shape->GetStorageShape()).c_str(), | ||
| 460 | + "The shape size of x2 must be > 0"), | ||
| 461 | + return false); | ||
| 463 | uint64_t shapeBatch = 1; | 462 | uint64_t shapeBatch = 1; |
| 464 | auto outShapeDim = yShape.GetDimNum(); | 463 | auto outShapeDim = yShape.GetDimNum(); |
| 465 | uint64_t idx = 0; | 464 | uint64_t idx = 0; |
| @@ -469,24 +468,45 @@ bool QuantBatchMatmulV4TilingBase::AnalyzeInputs() | |||
| 469 | } | 468 | } |
| 470 | inputParams_.batchSize = shapeBatch; | 469 | inputParams_.batchSize = shapeBatch; |
| 471 | ge::Format aFormatCur = static_cast<ge::Format>(ge::GetPrimaryFormat(context_->GetInputDesc(0)->GetStorageFormat())); | 470 | ge::Format aFormatCur = static_cast<ge::Format>(ge::GetPrimaryFormat(context_->GetInputDesc(0)->GetStorageFormat())); |
| 472 | - OP_TILING_CHECK(aFormatCur != ge::FORMAT_ND, VECTOR_INNER_ERR_REPORT_TILIING( | 471 | + OP_TILING_CHECK(aFormatCur != ge::FORMAT_ND, OP_LOGE_FOR_INVALID_FORMATS_WITH_REASON( |
| 473 | - inputParams_.opName, "aFormat Only support Nd"), return false); | 472 | + inputParams_.opName, "x1", "aFormat", "The format of x1 must be ND"), return false); |
| 474 | return AnalyzeX2InputDim(x2Shape) && AnalyzeShapeSize(x1Shape, x2Shape) && AnalyzeBiasShape(biasShape) && | 473 | return AnalyzeX2InputDim(x2Shape) && AnalyzeShapeSize(x1Shape, x2Shape) && AnalyzeBiasShape(biasShape) && |
| 475 | AnalyzeX1ScaleShape(x1ScaleShape) && AnalyzeX2ScaleShape(x2ScaleShape) && | 474 | AnalyzeX1ScaleShape(x1ScaleShape) && AnalyzeX2ScaleShape(x2ScaleShape) && |
| 476 | AnalyzeYScaleOffsetShape(yScaleShape, yOffsetShape); | 475 | AnalyzeYScaleOffsetShape(yScaleShape, yOffsetShape); |
| 477 | } | 476 | } |
| 478 | 477 | ||
| 478 | +bool QuantBatchMatmulV4TilingBase::ValidateShapeDimensions() | ||
| 479 | +{ | ||
| 480 | + OP_TILING_CHECK( | ||
| 481 | + inputParams_.mSize < MIN_SHAPE_SIZE, | ||
| 482 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(inputParams_.opName, "mSize", std::to_string(inputParams_.mSize).c_str(), | ||
| 483 | + "The value of mSize must be >= 1"), | ||
| 484 | + return false); | ||
| 485 | + OP_TILING_CHECK( | ||
| 486 | + inputParams_.nSize < MIN_SHAPE_SIZE, | ||
| 487 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(inputParams_.opName, "nSize", std::to_string(inputParams_.nSize).c_str(), | ||
| 488 | + "The value of nSize must be >= 1"), | ||
| 489 | + return false); | ||
| 490 | + OP_TILING_CHECK( | ||
| 491 | + inputParams_.kSize < MIN_SHAPE_SIZE, | ||
| 492 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(inputParams_.opName, "kSize", std::to_string(inputParams_.kSize).c_str(), | ||
| 493 | + "The value of kSize must be >= 1"), | ||
| 494 | + return false); | ||
| 495 | + return true; | ||
| 496 | +} | ||
| 497 | + | ||
| 479 | bool QuantBatchMatmulV4TilingBase::AnalyzeShapeSize(const gert::StorageShape* x1Shape, | 498 | bool QuantBatchMatmulV4TilingBase::AnalyzeShapeSize(const gert::StorageShape* x1Shape, |
| 480 | - const gert::StorageShape* x2Shape) | 499 | + const gert::StorageShape* x2Shape) |
| 481 | { | 500 | { |
| 482 | auto x1ShapeDimSize = x1Shape->GetStorageShape().GetDimNum(); | 501 | auto x1ShapeDimSize = x1Shape->GetStorageShape().GetDimNum(); |
| 483 | inputParams_.mSize = static_cast<uint64_t>(inputParams_.transA ? | 502 | inputParams_.mSize = static_cast<uint64_t>(inputParams_.transA ? |
| 484 | x1Shape->GetStorageShape().GetDim(x1ShapeDimSize - 1) : | 503 | x1Shape->GetStorageShape().GetDim(x1ShapeDimSize - 1) : |
| 485 | x1Shape->GetStorageShape().GetDim(x1ShapeDimSize - MATMUL_SHAPE_DIM_NUM)); | 504 | x1Shape->GetStorageShape().GetDim(x1ShapeDimSize - MATMUL_SHAPE_DIM_NUM)); |
| 486 | OP_TILING_CHECK(x2Shape->GetStorageShape().GetShapeSize() == 0, | 505 | OP_TILING_CHECK(x2Shape->GetStorageShape().GetShapeSize() == 0, |
| 487 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, | 506 | + OP_LOGE_FOR_INVALID_SHAPESIZE_WITH_REASON(inputParams_.opName, "x2", |
| 488 | - "X2 shape can not be empty. Only support shape size greater than 0, but get [%s]", | 507 | + Ops::Base::ToString(x2Shape->GetStorageShape()).c_str(), |
| 489 | - Ops::Base::ToString(x2Shape->GetStorageShape()).c_str()), return false); | 508 | + "The shape size of x2 must be > 0"), |
| 509 | + return false); | ||
| 490 | inputParams_.kSize = static_cast<uint64_t>( | 510 | inputParams_.kSize = static_cast<uint64_t>( |
| 491 | inputParams_.transA ? x1Shape->GetStorageShape().GetDim(x1ShapeDimSize - MATMUL_SHAPE_DIM_NUM) | 511 | inputParams_.transA ? x1Shape->GetStorageShape().GetDim(x1ShapeDimSize - MATMUL_SHAPE_DIM_NUM) |
| 492 | : x1Shape->GetStorageShape().GetDim(x1ShapeDimSize - 1)); | 512 | : x1Shape->GetStorageShape().GetDim(x1ShapeDimSize - 1)); |
| @@ -499,8 +519,10 @@ bool QuantBatchMatmulV4TilingBase::AnalyzeShapeSize(const gert::StorageShape* x1 | |||
| 499 | kBSize = static_cast<uint64_t>(inputParams_.transB | 519 | kBSize = static_cast<uint64_t>(inputParams_.transB |
| 500 | ? x2Shape->GetStorageShape().GetDim(x2ShapeDimSize - 1) | 520 | ? x2Shape->GetStorageShape().GetDim(x2ShapeDimSize - 1) |
| 501 | : x2Shape->GetStorageShape().GetDim(x2ShapeDimSize - MATMUL_SHAPE_DIM_NUM)); | 521 | : x2Shape->GetStorageShape().GetDim(x2ShapeDimSize - MATMUL_SHAPE_DIM_NUM)); |
| 502 | - OP_TILING_CHECK(inputParams_.kSize != kBSize, VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, | 522 | + OP_TILING_CHECK(inputParams_.kSize != kBSize, |
| 503 | - "kA[%lu] is not equal kB[%lu]", inputParams_.kSize, kBSize), return false); | 523 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(inputParams_.opName, "x1, x2", "kSize mismatch", |
| 524 | + "The k dimension sizes of x1 and x2 must be equal"), | ||
| 525 | + return false); | ||
| 504 | } else if (x2ShapeDimSize == VALID_WEIGHT_NZ_DIM_NUM) { | 526 | } else if (x2ShapeDimSize == VALID_WEIGHT_NZ_DIM_NUM) { |
| 505 | auto x2OriginShape = x2Shape->GetOriginShape(); | 527 | auto x2OriginShape = x2Shape->GetOriginShape(); |
| 506 | auto x2ShapeDimSize = x2OriginShape.GetDimNum(); | 528 | auto x2ShapeDimSize = x2OriginShape.GetDimNum(); |
| @@ -511,19 +533,7 @@ bool QuantBatchMatmulV4TilingBase::AnalyzeShapeSize(const gert::StorageShape* x1 | |||
| 511 | inputParams_.nSize *= B4_IN_B32_NUMS; | 533 | inputParams_.nSize *= B4_IN_B32_NUMS; |
| 512 | } | 534 | } |
| 513 | } | 535 | } |
| 514 | - OP_TILING_CHECK(inputParams_.mSize < MIN_SHAPE_SIZE, | 536 | + return ValidateShapeDimensions(); |
| 515 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, | ||
| 516 | - "Unsupported value [%lu] for m, m shouldn't be less than %ld.", | ||
| 517 | - inputParams_.mSize, MIN_SHAPE_SIZE), return false); | ||
| 518 | - OP_TILING_CHECK(inputParams_.nSize < MIN_SHAPE_SIZE, | ||
| 519 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, | ||
| 520 | - "Unsupported value [%lu] for n. Only values greater than or equal to %ld is supported.", | ||
| 521 | - inputParams_.nSize, MIN_SHAPE_SIZE), return false); | ||
| 522 | - OP_TILING_CHECK(inputParams_.kSize < MIN_SHAPE_SIZE, | ||
| 523 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, | ||
| 524 | - "Unsupported value [%lu] for k. Only values greater than or equal to %ld is supported.", | ||
| 525 | - inputParams_.kSize, MIN_SHAPE_SIZE), return false); | ||
| 526 | - return true; | ||
| 527 | } | 537 | } |
| 528 | 538 | ||
| 529 | bool QuantBatchMatmulV4TilingBase::AnalyzeBiasShape(const gert::StorageShape* biasShape) | 539 | bool QuantBatchMatmulV4TilingBase::AnalyzeBiasShape(const gert::StorageShape* biasShape) |
| @@ -533,21 +543,23 @@ bool QuantBatchMatmulV4TilingBase::AnalyzeBiasShape(const gert::StorageShape* bi | |||
| 533 | return true; | 543 | return true; |
| 534 | } | 544 | } |
| 535 | OP_TILING_CHECK(inputParams_.antiQuantType != QuantType::MX, | 545 | OP_TILING_CHECK(inputParams_.antiQuantType != QuantType::MX, |
| 536 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, | 546 | + OP_LOGE_FOR_INVALID_CONFIG_WITH_REASON( |
| 537 | - "Only Mx quant scene supports bias, actual quant type is %d", | 547 | + inputParams_.opName, std::to_string(static_cast<int>(inputParams_.antiQuantType)).c_str(), |
| 538 | - static_cast<int>(inputParams_.antiQuantType)), | 548 | + "antiQuantType", "quantConfig", "When bias exists, the quant mode must be MX"), |
| 539 | return false); | 549 | return false); |
| 540 | inputParams_.hasBias = true; | 550 | inputParams_.hasBias = true; |
| 541 | auto biasShapeDimNum = static_cast<uint64_t>(biasShape->GetStorageShape().GetDimNum()); | 551 | auto biasShapeDimNum = static_cast<uint64_t>(biasShape->GetStorageShape().GetDimNum()); |
| 542 | auto biasStorageShape = biasShape->GetStorageShape(); | 552 | auto biasStorageShape = biasShape->GetStorageShape(); |
| 543 | - OP_TILING_CHECK(biasShapeDimNum != VALID_BIAS_MAX_DIM, | 553 | + OP_TILING_CHECK( |
| 544 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, "bias's dim should be 2. Actual is %lu", | 554 | + biasShapeDimNum != VALID_BIAS_MAX_DIM, |
| 545 | - biasShapeDimNum), | 555 | + OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON(inputParams_.opName, "bias", std::to_string(biasShapeDimNum).c_str(), |
| 546 | - return false); | 556 | + "The shape dim of bias must be 2D"), |
| 557 | + return false); | ||
| 547 | OP_TILING_CHECK(biasStorageShape.GetDim(DIM_INDEX_0) != VALID_BIAS_SHAPE_SIZE || | 558 | OP_TILING_CHECK(biasStorageShape.GetDim(DIM_INDEX_0) != VALID_BIAS_SHAPE_SIZE || |
| 548 | static_cast<size_t>(biasStorageShape.GetDim(DIM_INDEX_1)) != inputParams_.nSize, | 559 | static_cast<size_t>(biasStorageShape.GetDim(DIM_INDEX_1)) != inputParams_.nSize, |
| 549 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, "bias shape only support [1, %ld], input is %s", | 560 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( |
| 550 | - inputParams_.nSize, Ops::Base::ToString(biasStorageShape).c_str()), | 561 | + inputParams_.opName, "bias", Ops::Base::ToString(biasStorageShape).c_str(), |
| 562 | + "The shape of bias must be [1, " + std::to_string(inputParams_.nSize) + "]"), | ||
| 551 | return false); | 563 | return false); |
| 552 | return true; | 564 | return true; |
| 553 | } | 565 | } |
| @@ -561,20 +573,21 @@ bool QuantBatchMatmulV4TilingBase::AnalyzeX1ScaleShape(const gert::StorageShape* | |||
| 561 | auto x1ScaleShapeDimNum = static_cast<uint64_t>(x1ScaleShape->GetStorageShape().GetDimNum()); | 573 | auto x1ScaleShapeDimNum = static_cast<uint64_t>(x1ScaleShape->GetStorageShape().GetDimNum()); |
| 562 | auto x1ScaleStorageShape = x1ScaleShape->GetStorageShape(); | 574 | auto x1ScaleStorageShape = x1ScaleShape->GetStorageShape(); |
| 563 | OP_TILING_CHECK(x1ScaleShapeDimNum != VALID_X1_SCALE_DIM_NUM, | 575 | OP_TILING_CHECK(x1ScaleShapeDimNum != VALID_X1_SCALE_DIM_NUM, |
| 564 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, | 576 | + OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON(inputParams_.opName, "x1Scale", |
| 565 | - "Expected dimension of X1 scale to be %lu, but actual dimension is %lu.", | 577 | + std::to_string(x1ScaleShapeDimNum).c_str(), |
| 566 | - VALID_X1_SCALE_DIM_NUM, | 578 | + "The shape dim of x1Scale must be 3D"), |
| 567 | - x1ScaleShapeDimNum), | 579 | + return false); |
| 568 | - return false); | ||
| 569 | // x1ScaleStorageShape (m, k / GROUP_ALIGN_SIZE / 2, 2) | 580 | // x1ScaleStorageShape (m, k / GROUP_ALIGN_SIZE / 2, 2) |
| 570 | OP_TILING_CHECK( | 581 | OP_TILING_CHECK( |
| 571 | x1ScaleStorageShape.GetDim(0) != static_cast<int64_t>(inputParams_.mSize) || | 582 | x1ScaleStorageShape.GetDim(0) != static_cast<int64_t>(inputParams_.mSize) || |
| 572 | - x1ScaleStorageShape.GetDim(1) != ops::CeilDiv(static_cast<int64_t>(inputParams_.kSize), GROUP_ALIGN_SIZE * 2L) || | 583 | + x1ScaleStorageShape.GetDim(1) != |
| 584 | + ops::CeilDiv(static_cast<int64_t>(inputParams_.kSize), GROUP_ALIGN_SIZE * 2L) || | ||
| 573 | x1ScaleStorageShape.GetDim(2) != 2UL, | 585 | x1ScaleStorageShape.GetDim(2) != 2UL, |
| 574 | - VECTOR_INNER_ERR_REPORT_TILIING( | 586 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( |
| 575 | - inputParams_.opName, "Expected shape of X1 scale to be [%lu, %lu, 2], but actual shape is %s.", | 587 | + inputParams_.opName, "x1Scale", Ops::Base::ToString(x1ScaleStorageShape).c_str(), |
| 576 | - inputParams_.mSize, ops::CeilDiv<uint64_t>(inputParams_.kSize, GROUP_ALIGN_SIZE * 2), | 588 | + "The shape of x1Scale must be [" + std::to_string(static_cast<int64_t>(inputParams_.mSize)) + ", " + |
| 577 | - Ops::Base::ToString(x1ScaleStorageShape).c_str()), | 589 | + std::to_string(ops::CeilDiv(static_cast<int64_t>(inputParams_.kSize), GROUP_ALIGN_SIZE * 2L)) + |
| 590 | + ", 2]"), | ||
| 578 | return false); | 591 | return false); |
| 579 | } | 592 | } |
| 580 | return true; | 593 | return true; |
| @@ -582,10 +595,11 @@ bool QuantBatchMatmulV4TilingBase::AnalyzeX1ScaleShape(const gert::StorageShape* | |||
| 582 | 595 | ||
| 583 | bool QuantBatchMatmulV4TilingBase::AnalyzeX2ScalePerGroupShape(const gert::StorageShape* x2ScaleShape) | 596 | bool QuantBatchMatmulV4TilingBase::AnalyzeX2ScalePerGroupShape(const gert::StorageShape* x2ScaleShape) |
| 584 | { | 597 | { |
| 585 | - OP_TILING_CHECK( | 598 | + OP_TILING_CHECK(inputParams_.kSize % inputParams_.groupSize != 0, |
| 586 | - inputParams_.kSize % inputParams_.groupSize != 0, | 599 | + OP_LOGE_FOR_INVALID_VALUE_WITH_REASON( |
| 587 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, "The value of groupNum is not an integer multiple."), | 600 | + inputParams_.opName, "groupNum", std::to_string(inputParams_.kSize).c_str(), |
| 588 | - return false); | 601 | + "The value of kSize must be an integer multiple of groupSize"), |
| 602 | + return false); | ||
| 589 | uint64_t groupNum = ops::CeilDiv(inputParams_.kSize, inputParams_.groupSize); | 603 | uint64_t groupNum = ops::CeilDiv(inputParams_.kSize, inputParams_.groupSize); |
| 590 | gert::Shape expectShape; | 604 | gert::Shape expectShape; |
| 591 | if (inputParams_.transB) { | 605 | if (inputParams_.transB) { |
| @@ -595,48 +609,53 @@ bool QuantBatchMatmulV4TilingBase::AnalyzeX2ScalePerGroupShape(const gert::Stora | |||
| 595 | expectShape.AppendDim(static_cast<int64_t>(groupNum)); | 609 | expectShape.AppendDim(static_cast<int64_t>(groupNum)); |
| 596 | expectShape.AppendDim(static_cast<int64_t>(inputParams_.nSize)); | 610 | expectShape.AppendDim(static_cast<int64_t>(inputParams_.nSize)); |
| 597 | } | 611 | } |
| 598 | - OP_TILING_CHECK(expectShape != x2ScaleShape->GetStorageShape(), | 612 | + std::string shapeReason = std::string("Expected [") + Ops::Base::ToString(expectShape) + |
| 599 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, | 613 | + "], groupSize=" + std::to_string(inputParams_.groupSize) + ", K=" + std::to_string(inputParams_.kSize) + |
| 600 | - "X2 scale shape %s is invalid, it should be %s, " | 614 | + ", N=" + std::to_string(inputParams_.nSize) + ", transpose_weight=" + |
| 601 | - "N, group size[%lu], K[%lu], N[%lu], transpose_weight[%s].", | 615 | + (inputParams_.transB ? "true" : "false"); |
| 602 | - Ops::Base::ToString(x2ScaleShape->GetStorageShape()).c_str(), | 616 | + OP_TILING_CHECK( |
| 603 | - Ops::Base::ToString(expectShape).c_str(), | 617 | + expectShape != x2ScaleShape->GetStorageShape(), |
| 604 | - inputParams_.groupSize, inputParams_.kSize, inputParams_.nSize, | 618 | + OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON( |
| 605 | - inputParams_.transB ? "true" : "false"), return false); | 619 | + inputParams_.opName, "x2Scale", |
| 620 | + Ops::Base::ToString(x2ScaleShape->GetStorageShape()).c_str(), shapeReason.c_str()), | ||
| 621 | + return false); | ||
| 606 | return true; | 622 | return true; |
| 607 | } | 623 | } |
| 608 | 624 | ||
| 609 | bool QuantBatchMatmulV4TilingBase::AnalyzeX2ScaleShape(const gert::StorageShape* x2ScaleShape) | 625 | bool QuantBatchMatmulV4TilingBase::AnalyzeX2ScaleShape(const gert::StorageShape* x2ScaleShape) |
| 610 | { | 626 | { |
| 611 | OP_TILING_CHECK(x2ScaleShape == nullptr, | 627 | OP_TILING_CHECK(x2ScaleShape == nullptr, |
| 612 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, "X2 scale can not be null"), | 628 | + OP_LOGE(inputParams_.opName, "X2 scale can not be null"), |
| 613 | return false); | 629 | return false); |
| 614 | auto x2ScaleShapeSize = static_cast<size_t>(x2ScaleShape->GetStorageShape().GetShapeSize()); | 630 | auto x2ScaleShapeSize = static_cast<size_t>(x2ScaleShape->GetStorageShape().GetShapeSize()); |
| 615 | if (inputParams_.antiQuantType == QuantType::MX) { // check mx shape | 631 | if (inputParams_.antiQuantType == QuantType::MX) { // check mx shape |
| 616 | auto x2ScaleShapeDimNum = static_cast<uint64_t>(x2ScaleShape->GetStorageShape().GetDimNum()); | 632 | auto x2ScaleShapeDimNum = static_cast<uint64_t>(x2ScaleShape->GetStorageShape().GetDimNum()); |
| 617 | auto x2ScaleStorageShape = x2ScaleShape->GetStorageShape(); | 633 | auto x2ScaleStorageShape = x2ScaleShape->GetStorageShape(); |
| 618 | OP_TILING_CHECK(x2ScaleShapeDimNum != VALID_X2_SCALE_DIM_NUM, | 634 | OP_TILING_CHECK(x2ScaleShapeDimNum != VALID_X2_SCALE_DIM_NUM, |
| 619 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, | 635 | + OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON(inputParams_.opName, "x2Scale", |
| 620 | - "Expected dimension of X2 scale to be %lu, but actual dimension is %lu.", | 636 | + std::to_string(x2ScaleShapeDimNum).c_str(), |
| 621 | - VALID_X2_SCALE_DIM_NUM, x2ScaleShapeDimNum), return false); | 637 | + "The shape dim of x2Scale must be 3D"), |
| 638 | + return false); | ||
| 622 | // x2ScaleStorageShape: (n, k / GROUP_ALIGN_SIZE / 2, 2) | 639 | // x2ScaleStorageShape: (n, k / GROUP_ALIGN_SIZE / 2, 2) |
| 623 | OP_TILING_CHECK( | 640 | OP_TILING_CHECK( |
| 624 | x2ScaleStorageShape.GetDim(0) != static_cast<int64_t>(inputParams_.nSize) || | 641 | x2ScaleStorageShape.GetDim(0) != static_cast<int64_t>(inputParams_.nSize) || |
| 625 | x2ScaleStorageShape.GetDim(1) != ops::CeilDiv<int64_t>(inputParams_.kSize, (GROUP_ALIGN_SIZE * 2)) || | 642 | x2ScaleStorageShape.GetDim(1) != ops::CeilDiv<int64_t>(inputParams_.kSize, (GROUP_ALIGN_SIZE * 2)) || |
| 626 | x2ScaleStorageShape.GetDim(2) != 2, | 643 | x2ScaleStorageShape.GetDim(2) != 2, |
| 627 | - VECTOR_INNER_ERR_REPORT_TILIING( | 644 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( |
| 628 | - inputParams_.opName, "Expected shape of X2 scale to be [%lu, %lu, 2], but actual shape is %s.", | 645 | + inputParams_.opName, "x2Scale", Ops::Base::ToString(x2ScaleStorageShape).c_str(), |
| 629 | - inputParams_.nSize, ops::CeilDiv<int64_t>(inputParams_.kSize, (GROUP_ALIGN_SIZE * 2)), | 646 | + "The shape of x2Scale must be [" + std::to_string(static_cast<int64_t>(inputParams_.nSize)) + ", " + |
| 630 | - Ops::Base::ToString(x2ScaleStorageShape).c_str()), | 647 | + std::to_string(ops::CeilDiv<int64_t>(inputParams_.kSize, (GROUP_ALIGN_SIZE * 2))) + ", 2]"), |
| 631 | return false); | 648 | return false); |
| 632 | } else if (inputParams_.groupSize > 0) { | 649 | } else if (inputParams_.groupSize > 0) { |
| 633 | return AnalyzeX2ScalePerGroupShape(x2ScaleShape); | 650 | return AnalyzeX2ScalePerGroupShape(x2ScaleShape); |
| 634 | } else if (x2ScaleShapeSize == 1) { | 651 | } else if (x2ScaleShapeSize == 1) { |
| 635 | inputParams_.antiQuantType = QuantType::PER_TENSOR; | 652 | inputParams_.antiQuantType = QuantType::PER_TENSOR; |
| 636 | } else { | 653 | } else { |
| 637 | - OP_TILING_CHECK(x2ScaleShapeSize != inputParams_.nSize, VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, | 654 | + OP_TILING_CHECK(x2ScaleShapeSize != inputParams_.nSize, |
| 638 | - "X2 scale %s shape size should same as N[%lu].", Ops::Base::ToString(x2ScaleShape->GetStorageShape()).c_str(), | 655 | + OP_LOGE_FOR_INVALID_SHAPESIZE_WITH_REASON(inputParams_.opName, "x2Scale", |
| 639 | - inputParams_.nSize), return false); | 656 | + std::to_string(x2ScaleShapeSize).c_str(), |
| 657 | + "The shape size of x2Scale must be equal to nSize"), | ||
| 658 | + return false); | ||
| 640 | inputParams_.antiQuantType = QuantType::PER_CHANNEL; | 659 | inputParams_.antiQuantType = QuantType::PER_CHANNEL; |
| 641 | } | 660 | } |
| 642 | return true; | 661 | return true; |
| @@ -646,33 +665,36 @@ bool QuantBatchMatmulV4TilingBase::AnalyzeYScaleOffsetShape( | |||
| 646 | const gert::StorageShape *yScaleShape, const gert::StorageShape *yOffsetShape) const | 665 | const gert::StorageShape *yScaleShape, const gert::StorageShape *yOffsetShape) const |
| 647 | { | 666 | { |
| 648 | OP_TILING_CHECK(!IsNotEmptyShape(yScaleShape) && IsNotEmptyShape(yOffsetShape), | 667 | OP_TILING_CHECK(!IsNotEmptyShape(yScaleShape) && IsNotEmptyShape(yOffsetShape), |
| 649 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, "not support quant_offset without quant_scale"), | 668 | + OP_LOGE(inputParams_.opName, "not support quant_offset without quant_scale"), |
| 650 | return false); | 669 | return false); |
| 651 | if (!IsNotEmptyShape(yScaleShape)) { | 670 | if (!IsNotEmptyShape(yScaleShape)) { |
| 652 | OP_TILING_CHECK( | 671 | OP_TILING_CHECK( |
| 653 | inputParams_.antiQuantType == QuantType::PER_GROUP, | 672 | inputParams_.antiQuantType == QuantType::PER_GROUP, |
| 654 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, | 673 | + OP_LOGE_FOR_INVALID_SHAPESIZE_WITH_REASON(inputParams_.opName, "yScale", "0", |
| 655 | - "Unsupported quant_scale shape size 0 when per_group and NZ format."), | 674 | + "When the quant mode is per_group and the format of x2 is " |
| 675 | + "FRACTAL_NZ, the shape size of yScale can not be 0"), | ||
| 656 | return false); | 676 | return false); |
| 657 | return true; | 677 | return true; |
| 658 | } | 678 | } |
| 659 | size_t yScaleShapeSize = static_cast<size_t>(yScaleShape->GetStorageShape().GetShapeSize()); | 679 | size_t yScaleShapeSize = static_cast<size_t>(yScaleShape->GetStorageShape().GetShapeSize()); |
| 660 | OP_TILING_CHECK(yScaleShapeSize == 0 && inputParams_.cDtype == ge::DT_INT8, | 680 | OP_TILING_CHECK(yScaleShapeSize == 0 && inputParams_.cDtype == ge::DT_INT8, |
| 661 | - VECTOR_INNER_ERR_REPORT_TILIING( | 681 | + OP_LOGE_FOR_INVALID_SHAPESIZE_WITH_REASON( |
| 662 | - inputParams_.opName, "not support quant_scale shape size 0 when output dtype is int8"), | 682 | + inputParams_.opName, "yScale", std::to_string(yScaleShapeSize).c_str(), |
| 683 | + "When the dtype of y is INT8, the shape size of yScale can not be 0"), | ||
| 684 | + return false); | ||
| 685 | + OP_TILING_CHECK( | ||
| 686 | + yScaleShape->GetStorageShape().GetDimNum() > VALID_INPUT_DIM_NUM || | ||
| 687 | + (yScaleShape->GetStorageShape().GetDimNum() == VALID_INPUT_DIM_NUM && | ||
| 688 | + yScaleShape->GetStorageShape().GetDim(0) != 1), | ||
| 689 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( | ||
| 690 | + inputParams_.opName, "yScale", Ops::Base::ToString(yScaleShape->GetStorageShape()).c_str(), | ||
| 691 | + "The shape of yScale must be [1, n] or [n,]"), | ||
| 663 | return false); | 692 | return false); |
| 664 | - OP_TILING_CHECK(yScaleShape->GetStorageShape().GetDimNum() > VALID_INPUT_DIM_NUM || | 693 | + OP_TILING_CHECK( |
| 665 | - (yScaleShape->GetStorageShape().GetDimNum() == VALID_INPUT_DIM_NUM && | 694 | + IsNotEmptyShape(yOffsetShape) && yScaleShape->GetStorageShape() != yOffsetShape->GetStorageShape(), |
| 666 | - yScaleShape->GetStorageShape().GetDim(0) != 1), | 695 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( |
| 667 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, | 696 | + inputParams_.opName, "yScale, yOffset", Ops::Base::ToString(yScaleShape->GetStorageShape()).c_str(), |
| 668 | - "quant_scale shape only support [1, n] or [n,], input is %s", | 697 | + "The shape of yScale must be equal to the shape of yOffset"), |
| 669 | - Ops::Base::ToString(yScaleShape->GetStorageShape()).c_str()), | ||
| 670 | - return false); | ||
| 671 | - OP_TILING_CHECK(IsNotEmptyShape(yOffsetShape) && yScaleShape->GetStorageShape() != yOffsetShape->GetStorageShape(), | ||
| 672 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, | ||
| 673 | - "quant_scale %s and quant_offset %s should have same shape", | ||
| 674 | - Ops::Base::ToString(yScaleShape->GetStorageShape()).c_str(), | ||
| 675 | - Ops::Base::ToString(yOffsetShape->GetStorageShape()).c_str()), | ||
| 676 | return false); | 698 | return false); |
| 677 | 699 | ||
| 678 | return true; | 700 | return true; |
| @@ -709,7 +731,7 @@ ge::graphStatus QuantBatchMatmulV4TilingBase::GetPlatformInfo() | |||
| 709 | auto compileInfoPtr = compileInfoPtr_ | 731 | auto compileInfoPtr = compileInfoPtr_ |
| 710 | ? compileInfoPtr_.get() | 732 | ? compileInfoPtr_.get() |
| 711 | : reinterpret_cast<const QuantBatchMatmulV4CompileInfo *>(context_->GetCompileInfo()); | 733 | : reinterpret_cast<const QuantBatchMatmulV4CompileInfo *>(context_->GetCompileInfo()); |
| 712 | - OP_LOGE_IF(compileInfoPtr == nullptr, ge::GRAPH_FAILED, context_->GetNodeName(), "compileInfoPtr is null"); | 734 | + OPS_CHECK_NULL_WITH_CONTEXT(context_, compileInfoPtr); |
| 713 | 735 | ||
| 714 | aivNum_ = compileInfoPtr->aivNum; | 736 | aivNum_ = compileInfoPtr->aivNum; |
| 715 | aicNum_ = compileInfoPtr->aicNum; | 737 | aicNum_ = compileInfoPtr->aicNum; |
| @@ -728,9 +750,9 @@ ge::graphStatus QuantBatchMatmulV4TilingBase::GetPlatformInfo() | |||
| 728 | aicoreParams_.l0cSize); | 750 | aicoreParams_.l0cSize); |
| 729 | 751 | ||
| 730 | if (inputParams_.bDtype == ge::DT_INT4) { | 752 | if (inputParams_.bDtype == ge::DT_INT4) { |
| 731 | - OP_TILING_CHECK(!CalcUBSize(1UL, inputParams_.groupSize), | 753 | + OP_TILING_CHECK( |
| 732 | - VECTOR_INNER_ERR_REPORT_TILIING( | 754 | + !CalcUBSize(1UL, inputParams_.groupSize), |
| 733 | - inputParams_.opName, "group size[%lu] cannot full load to UB", inputParams_.groupSize), | 755 | + OP_LOGE(inputParams_.opName, "group size[%lu] cannot full load to UB", inputParams_.groupSize), |
| 734 | return ge::GRAPH_FAILED); | 756 | return ge::GRAPH_FAILED); |
| 735 | } | 757 | } |
| 736 | return ge::GRAPH_SUCCESS; | 758 | return ge::GRAPH_SUCCESS; |
| @@ -747,7 +769,7 @@ ge::graphStatus QuantBatchMatmulV4TilingBase::PostTiling() | |||
| 747 | OP_LOGD(inputParams_.opName, "final tiling data size: %zu", tilingDataSize_); | 769 | OP_LOGD(inputParams_.opName, "final tiling data size: %zu", tilingDataSize_); |
| 748 | 770 | ||
| 749 | OP_TILING_CHECK(tilingDataSize_ % sizeof(uint64_t) != 0, | 771 | OP_TILING_CHECK(tilingDataSize_ % sizeof(uint64_t) != 0, |
| 750 | - VECTOR_INNER_ERR_REPORT_TILIING( | 772 | + OP_LOGE( |
| 751 | inputParams_.opName, "tiling data size[%zu] not aligned to 8", tilingDataSize_), | 773 | inputParams_.opName, "tiling data size[%zu] not aligned to 8", tilingDataSize_), |
| 752 | return ge::GRAPH_FAILED); | 774 | return ge::GRAPH_FAILED); |
| 753 | context_->GetRawTilingData()->SetDataSize(tilingDataSize_); | 775 | context_->GetRawTilingData()->SetDataSize(tilingDataSize_); |
| @@ -757,7 +779,7 @@ ge::graphStatus QuantBatchMatmulV4TilingBase::PostTiling() | |||
| 757 | 779 | ||
| 758 | OP_TILING_CHECK( | 780 | OP_TILING_CHECK( |
| 759 | !CheckFinalTilingData(), PrintTilingData(false); | 781 | !CheckFinalTilingData(), PrintTilingData(false); |
| 760 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, "get invalid tiling data, check above validate rule"), | 782 | + OP_LOGE(inputParams_.opName, "get invalid tiling data, check above validate rule"), |
| 761 | return ge::GRAPH_FAILED); | 783 | return ge::GRAPH_FAILED); |
| 762 | size_t *workspaces = context_->GetWorkspaceSizes(1); // set workspace | 784 | size_t *workspaces = context_->GetWorkspaceSizes(1); // set workspace |
| 763 | workspaces[0] = workspaceSize_; | 785 | workspaces[0] = workspaceSize_; |
| @@ -819,16 +841,12 @@ ge::graphStatus QuantBatchMatmulV4TilingBase::InstantiateTilingData() | |||
| 819 | { | 841 | { |
| 820 | if (tilingData_ == nullptr) { | 842 | if (tilingData_ == nullptr) { |
| 821 | tilingDataManager_ = std::make_unique<qbmmv4_tiling::QuantBatchMatmulV4TilingDataParams>(); | 843 | tilingDataManager_ = std::make_unique<qbmmv4_tiling::QuantBatchMatmulV4TilingDataParams>(); |
| 822 | - OP_TILING_CHECK(tilingDataManager_ == nullptr, | 844 | + OPS_CHECK_NULL_WITH_CONTEXT(context_, tilingDataManager_); |
| 823 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, "failed to instantiate tilingData"), | ||
| 824 | - return ge::GRAPH_FAILED); | ||
| 825 | tilingData_ = tilingDataManager_.get(); | 845 | tilingData_ = tilingDataManager_.get(); |
| 826 | } | 846 | } |
| 827 | - OP_TILING_CHECK(tilingData_ == nullptr, | 847 | + OPS_CHECK_NULL_WITH_CONTEXT(context_, tilingData_); |
| 828 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, "failed to instantiate tilingData"), | ||
| 829 | - return ge::GRAPH_FAILED); | ||
| 830 | OP_TILING_CHECK(context_->GetRawTilingData()->GetCapacity() < tilingDataSize_, | 848 | OP_TILING_CHECK(context_->GetRawTilingData()->GetCapacity() < tilingDataSize_, |
| 831 | - VECTOR_INNER_ERR_REPORT_TILIING(inputParams_.opName, | 849 | + OP_LOGE(inputParams_.opName, |
| 832 | "tiling data capacity %zu < actual tiling data size %zu", | 850 | "tiling data capacity %zu < actual tiling data size %zu", |
| 833 | context_->GetRawTilingData()->GetCapacity(), | 851 | context_->GetRawTilingData()->GetCapacity(), |
| 834 | tilingDataSize_), | 852 | tilingDataSize_), |
| @@ -203,6 +203,7 @@ protected: | |||
| 203 | bool AnalyzeInputs(); | 203 | bool AnalyzeInputs(); |
| 204 | bool AnalyzeX2ScalePerGroupShape(const gert::StorageShape *x2ScaleShape); | 204 | bool AnalyzeX2ScalePerGroupShape(const gert::StorageShape *x2ScaleShape); |
| 205 | bool AnalyzeShapeSize(const gert::StorageShape *x1Shape, const gert::StorageShape *x2Shape); | 205 | bool AnalyzeShapeSize(const gert::StorageShape *x1Shape, const gert::StorageShape *x2Shape); |
| 206 | + bool ValidateShapeDimensions(); | ||
| 206 | bool AnalyzeBiasShape(const gert::StorageShape *biasShape); | 207 | bool AnalyzeBiasShape(const gert::StorageShape *biasShape); |
| 207 | bool AnalyzeX1ScaleShape(const gert::StorageShape *x1ScaleShape); | 208 | bool AnalyzeX1ScaleShape(const gert::StorageShape *x1ScaleShape); |
| 208 | bool AnalyzeX2ScaleShape(const gert::StorageShape *x2ScaleShape); | 209 | bool AnalyzeX2ScaleShape(const gert::StorageShape *x2ScaleShape); |
| @@ -28,7 +28,9 @@ static ge::graphStatus InferShapeForQuantBatchMatmulV4(gert::InferShapeContext* | |||
| 28 | if (!any_unknow_rank && | 28 | if (!any_unknow_rank && |
| 29 | (dim_a < QUANT_BATCH_MATMUL_V4_MIN_SHAPE_SIZE || dim_a > QUANT_BATCH_MATMUL_V4_MAX_SHAPE_SIZE || | 29 | (dim_a < QUANT_BATCH_MATMUL_V4_MIN_SHAPE_SIZE || dim_a > QUANT_BATCH_MATMUL_V4_MAX_SHAPE_SIZE || |
| 30 | dim_b < QUANT_BATCH_MATMUL_V4_MIN_SHAPE_SIZE || dim_b > QUANT_BATCH_MATMUL_V4_MAX_SHAPE_SIZE)) { | 30 | dim_b < QUANT_BATCH_MATMUL_V4_MIN_SHAPE_SIZE || dim_b > QUANT_BATCH_MATMUL_V4_MAX_SHAPE_SIZE)) { |
| 31 | - OP_LOGE(context->GetNodeName(), "[InferShape] The shape can only be in the range of 2 to 6."); | 31 | + OP_LOGE_FOR_INVALID_SHAPEDIMS_WITH_REASON( |
| 32 | + context->GetNodeName(), "x1, x2", (std::to_string(dim_a) + ", " + std::to_string(dim_b)).c_str(), | ||
| 33 | + "The shape dims of x1, x2 must be in [2D, 6D]"); | ||
| 32 | return ge::GRAPH_FAILED; | 34 | return ge::GRAPH_FAILED; |
| 33 | } | 35 | } |
| 34 | // first transpose attr is transpose_x1, its index is 2 and bias input tensor index is 2, is_x2_packed is true | 36 | // first transpose attr is transpose_x1, its index is 2 and bias input tensor index is 2, is_x2_packed is true |
| @@ -43,3 +43,10 @@ A8W4-LUT-Testcase-2_RESERVED_3072_2048_4096_0_0_16777344_ND_NZ_INT8_INT4_NULL_NU | |||
| 43 | A8W4-LUT-Testcase-3_RESERVED_1_2048_4096_0_0_16777344_ND_NZ_INT8_INT4_NULL_NULL_UINT64_NULL_INT8_INT8_2_2,2,GRAPH_SUCCESS,1280 | 43 | A8W4-LUT-Testcase-3_RESERVED_1_2048_4096_0_0_16777344_ND_NZ_INT8_INT4_NULL_NULL_UINT64_NULL_INT8_INT8_2_2,2,GRAPH_SUCCESS,1280 |
| 44 | A8W1-LUT-Testcase-4_RESERVED_3072_2048_4096_0_0_16777344_ND_NZ_INT8_UINT1_NULL_NULL_UINT64_NULL_INT4_INT8_14_14,14,GRAPH_SUCCESS,768 | 44 | A8W1-LUT-Testcase-4_RESERVED_3072_2048_4096_0_0_16777344_ND_NZ_INT8_UINT1_NULL_NULL_UINT64_NULL_INT4_INT8_14_14,14,GRAPH_SUCCESS,768 |
| 45 | A8W1-LUT-Testcase-5_RESERVED_1_2048_4096_0_0_16777344_ND_NZ_INT8_UINT1_NULL_NULL_UINT64_NULL_INT4_INT8_2_2,2,GRAPH_SUCCESS,1280 | 45 | A8W1-LUT-Testcase-5_RESERVED_1_2048_4096_0_0_16777344_ND_NZ_INT8_UINT1_NULL_NULL_UINT64_NULL_INT4_INT8_2_2,2,GRAPH_SUCCESS,1280 |
| 46 | +S8S4-LUT-err-x1Dtype_RESERVED_3072_2048_4096_0_0_16777344_ND_NZ_FP32_INT4_NULL_NULL_UINT64_NULL_INT8_INT8_14_14,0,GRAPH_FAILED,768 | ||
| 47 | +S8S4-LUT-err-x2Dtype_RESERVED_3072_2048_4096_0_0_16777344_ND_NZ_INT8_INT8_NULL_NULL_UINT64_NULL_INT8_INT8_14_14,0,GRAPH_FAILED,768 | ||
| 48 | +S8S4-LUT-err-yDtype_RESERVED_3072_2048_4096_0_0_16777344_ND_NZ_INT8_INT4_NULL_NULL_UINT64_NULL_INT8_BF16_14_14,0,GRAPH_FAILED,768 | ||
| 49 | +S8S4-LUT-err-x2ScaleDtype_RESERVED_3072_2048_4096_0_0_16777344_ND_NZ_INT8_INT4_NULL_NULL_FP32_NULL_INT8_INT8_14_14,0,GRAPH_FAILED,768 | ||
| 50 | +S8S4-LUT-err-x2TableDtype_RESERVED_3072_2048_4096_0_0_16777344_ND_NZ_INT8_INT4_NULL_NULL_UINT64_NULL_INT4_INT8_14_14,0,GRAPH_FAILED,768 | ||
| 51 | +S8S4-LUT-err-transA_RESERVED_3072_2048_4096_1_0_16777344_ND_NZ_INT8_INT4_NULL_NULL_UINT64_NULL_INT8_INT8_14_14,0,GRAPH_FAILED,768 | ||
| 52 | +S8S4-LUT-err-transB_RESERVED_3072_2048_4096_0_1_16777344_ND_NZ_INT8_INT4_NULL_NULL_UINT64_NULL_INT8_INT8_14_14,0,GRAPH_FAILED,768 | ||
pr类型标签没有选择