已合并
fix: Autofuse 输出日志和错误提示文案标准化 (#312) #2098
高煜博创建于 15 天前
fix: Autofuse 输出日志和错误提示文案标准化 (#312) #2098
已合并
共 80 个文件变更+788-668
| @@ -328,7 +328,7 @@ inline __aicore__ void BroadcastCommon(const LocalTensor<T> &dst, const LocalTen | |||
| 328 | const uint32_t src_shape[2]{src_m, src_k}; | 328 | const uint32_t src_shape[2]{src_m, src_k}; |
| 329 | AscendC::Broadcast<T, 2, 1>(dst, src, dst_shape, src_shape, tmp_buf); | 329 | AscendC::Broadcast<T, 2, 1>(dst, src, dst_shape, src_shape, tmp_buf); |
| 330 | } else { | 330 | } else { |
| 331 | - ASSERT(false && "Broadcast size not support."); | 331 | + ASSERT(false && "Broadcast size is not supported."); |
| 332 | } | 332 | } |
| 333 | } | 333 | } |
| 334 | 334 | ||
| @@ -368,7 +368,7 @@ inline __aicore__ void BroadcastWithCast(const LocalTensor<T> &dst, const LocalT | |||
| 368 | const uint32_t dst_shape[2]{dst_m, dst_k}; | 368 | const uint32_t dst_shape[2]{dst_m, dst_k}; |
| 369 | AscendC::Broadcast<T, 2, 1>(dst, src, dst_shape, src_shape, tmp_buf); | 369 | AscendC::Broadcast<T, 2, 1>(dst, src, dst_shape, src_shape, tmp_buf); |
| 370 | } else { | 370 | } else { |
| 371 | - ASSERT(false && "Broadcast size not support."); | 371 | + ASSERT(false && "Broadcast size is not supported."); |
| 372 | } | 372 | } |
| 373 | } | 373 | } |
| 374 | 374 | ||
| @@ -504,7 +504,7 @@ inline __aicore__ void BroadcastInt64(const LocalTensor<T> &dst, const LocalTens | |||
| 504 | AscendC::WaitFlag<HardEvent::S_V>(event_id); | 504 | AscendC::WaitFlag<HardEvent::S_V>(event_id); |
| 505 | Duplicate(dst, scalarVlue, dst_m * dst_k, tmp_buf); | 505 | Duplicate(dst, scalarVlue, dst_m * dst_k, tmp_buf); |
| 506 | } else { | 506 | } else { |
| 507 | - ASSERT(false && "Broadcast size not support."); | 507 | + ASSERT(false && "Broadcast size is not supported."); |
| 508 | } | 508 | } |
| 509 | } | 509 | } |
| 510 | 510 | ||
| @@ -520,7 +520,7 @@ inline __aicore__ void Broadcast(const LocalTensor<T> &dst, const LocalTensor<T> | |||
| 520 | } else if constexpr (AscendC::SupportType<T, int16_t, uint16_t, half, float, int32_t, uint32_t>()) { | 520 | } else if constexpr (AscendC::SupportType<T, int16_t, uint16_t, half, float, int32_t, uint32_t>()) { |
| 521 | BroadcastCommon(dst, src, src_m, src_k, src_z, dst_m, dst_k, dst_z, tmp_buf, last_dim_stride); | 521 | BroadcastCommon(dst, src, src_m, src_k, src_z, dst_m, dst_k, dst_z, tmp_buf, last_dim_stride); |
| 522 | } else { | 522 | } else { |
| 523 | - ASSERT(false && "Broadcast type not support."); | 523 | + ASSERT(false && "Broadcast type is not supported."); |
| 524 | } | 524 | } |
| 525 | } | 525 | } |
| 526 | 526 | ||
| @@ -546,7 +546,7 @@ inline __aicore__ void Broadcast(const LocalTensor<T> &dst, const LocalTensor<T> | |||
| 546 | // (A, 1, AB) -> (A, B, AB) | 546 | // (A, 1, AB) -> (A, B, AB) |
| 547 | Broadcast(dst, inter_buf, src_m, 1, dst_k * dst_z, dst_m, dst_n, dst_k * dst_z, left_buf); | 547 | Broadcast(dst, inter_buf, src_m, 1, dst_k * dst_z, dst_m, dst_n, dst_k * dst_z, left_buf); |
| 548 | } else { | 548 | } else { |
| 549 | - ASSERT(false && "Broadcast type not support."); | 549 | + ASSERT(false && "Broadcast type is not supported."); |
| 550 | } | 550 | } |
| 551 | } | 551 | } |
| 552 | 552 | ||
| @@ -403,7 +403,7 @@ inline __aicore__ void CompareScalarExtend(const LocalTensor<T> &dst, const Loca | |||
| 403 | } | 403 | } |
| 404 | const int32_t tail_size = cal_cnt - cnt; | 404 | const int32_t tail_size = cal_cnt - cnt; |
| 405 | if (tail_size > 0) { | 405 | if (tail_size > 0) { |
| 406 | - ASSERT(false && "CompareScalarExtend size not support."); | 406 | + ASSERT(false && "CompareScalarExtend size is not supported."); |
| 407 | } | 407 | } |
| 408 | } | 408 | } |
| 409 | 409 | ||
| @@ -672,7 +672,7 @@ inline __aicore__ void CompareExtend(const LocalTensor<T> &dst, const LocalTenso | |||
| 672 | } | 672 | } |
| 673 | const int32_t tail_size = cal_cnt - cnt; | 673 | const int32_t tail_size = cal_cnt - cnt; |
| 674 | if (tail_size > 0) { | 674 | if (tail_size > 0) { |
| 675 | - ASSERT(false && "CompareExtend size not support."); | 675 | + ASSERT(false && "CompareExtend size is not supported."); |
| 676 | } | 676 | } |
| 677 | } | 677 | } |
| 678 | 678 | ||
| @@ -720,11 +720,11 @@ inline __aicore__ void ConcatExtend(const ConcatParams<T, dimSize> &dst, const C | |||
| 720 | } | 720 | } |
| 721 | ASSERT(((sizeof(T) == kOneByte) || (sizeof(T) == kTwoBytes) || (sizeof(T) == kFourBytes) || | 721 | ASSERT(((sizeof(T) == kOneByte) || (sizeof(T) == kTwoBytes) || (sizeof(T) == kFourBytes) || |
| 722 | (sizeof(T) == kEightBytes)) && | 722 | (sizeof(T) == kEightBytes)) && |
| 723 | - "ConcatExtend data type is not support."); | 723 | + "ConcatExtend data type is not supported."); |
| 724 | 724 | ||
| 725 | if (concatDim == 0U) { | 725 | if (concatDim == 0U) { |
| 726 | // 首轴concat不使用api方式实现 | 726 | // 首轴concat不使用api方式实现 |
| 727 | - ASSERT(false && "ConcatExtend axis 0 is not support."); | 727 | + ASSERT(false && "ConcatExtend axis 0 is not supported."); |
| 728 | } else { | 728 | } else { |
| 729 | ConcatParams<T, kMergedDimNum> mergedDst{}; | 729 | ConcatParams<T, kMergedDimNum> mergedDst{}; |
| 730 | ConcatParams<T, kMergedDimNum> mergedSrcs[inputNum]{}; | 730 | ConcatParams<T, kMergedDimNum> mergedSrcs[inputNum]{}; |
| @@ -73,7 +73,7 @@ inline __aicore__ void ReduceLast(const LocalTensor<T> &dst, const LocalTensor<T | |||
| 73 | BinaryFunc(dst, dst, tmp_tensor, m); | 73 | BinaryFunc(dst, dst, tmp_tensor, m); |
| 74 | } | 74 | } |
| 75 | } else { | 75 | } else { |
| 76 | - ASSERT(false && "Reduce k size not support."); | 76 | + ASSERT(false && "Reduce k size is not supported."); |
| 77 | } | 77 | } |
| 78 | } | 78 | } |
| 79 | 79 | ||
| @@ -273,7 +273,7 @@ __aicore__ inline U GetScalarValueByBitCode(T bit_code) { | |||
| 273 | 273 | ||
| 274 | template <typename T> | 274 | template <typename T> |
| 275 | constexpr __aicore__ static inline T AfInfinity() { | 275 | constexpr __aicore__ static inline T AfInfinity() { |
| 276 | - static_assert(SupportType<T, half, float>(), "current data type is not support inf"); | 276 | + static_assert(SupportType<T, half, float>(), "current data type does not support inf"); |
| 277 | if constexpr (std::is_same_v<T, half>) { | 277 | if constexpr (std::is_same_v<T, half>) { |
| 278 | return GetScalarValueByBitCode<uint16_t, T>(0x7C00U); | 278 | return GetScalarValueByBitCode<uint16_t, T>(0x7C00U); |
| 279 | } else if constexpr (std::is_same_v<T, float>) { | 279 | } else if constexpr (std::is_same_v<T, float>) { |
| @@ -110,7 +110,7 @@ class LoadAscIrCodegenImpl : public AscIrCodegen { | |||
| 110 | return {}; | 110 | return {}; |
| 111 | } | 111 | } |
| 112 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 112 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 113 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 113 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 114 | node.GetNamePtr()); | 114 | node.GetNamePtr()); |
| 115 | return true; | 115 | return true; |
| 116 | } | 116 | } |
| @@ -177,7 +177,7 @@ class CastAscIrCodegenImpl : public AscIrCodegen { | |||
| 177 | }; | 177 | }; |
| 178 | } | 178 | } |
| 179 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 179 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 180 | - GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] not support brc inline", | 180 | + GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] has inconsistent shape", |
| 181 | node.GetTypePtr(), node.GetNamePtr()); | 181 | node.GetTypePtr(), node.GetNamePtr()); |
| 182 | return true; | 182 | return true; |
| 183 | } | 183 | } |
| @@ -209,7 +209,7 @@ class AbsAscIrCodegenImpl : public AscIrCodegen { | |||
| 209 | }; | 209 | }; |
| 210 | } | 210 | } |
| 211 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 211 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 212 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 212 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 213 | node.GetNamePtr()); | 213 | node.GetNamePtr()); |
| 214 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", | 214 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", |
| 215 | node.GetTypePtr(), node.GetNamePtr()); | 215 | node.GetTypePtr(), node.GetNamePtr()); |
| @@ -235,7 +235,7 @@ class ExpAscIrCodegenImpl : public AscIrCodegen { | |||
| 235 | }; | 235 | }; |
| 236 | } | 236 | } |
| 237 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 237 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 238 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 238 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 239 | node.GetNamePtr()); | 239 | node.GetNamePtr()); |
| 240 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", | 240 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", |
| 241 | node.GetTypePtr(), node.GetNamePtr()); | 241 | node.GetTypePtr(), node.GetNamePtr()); |
| @@ -260,7 +260,7 @@ class RemovePadAscIrCodegenImpl : public AscIrCodegen { | |||
| 260 | }; | 260 | }; |
| 261 | } | 261 | } |
| 262 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 262 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 263 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 263 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 264 | node.GetNamePtr()); | 264 | node.GetNamePtr()); |
| 265 | return true; | 265 | return true; |
| 266 | } | 266 | } |
| @@ -288,7 +288,7 @@ class PadAscIrCodegenImpl : public AscIrCodegen { | |||
| 288 | }; | 288 | }; |
| 289 | } | 289 | } |
| 290 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 290 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 291 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 291 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 292 | node.GetNamePtr()); | 292 | node.GetNamePtr()); |
| 293 | return true; | 293 | return true; |
| 294 | } | 294 | } |
| @@ -312,7 +312,7 @@ class LnAscIrCodegenImpl : public AscIrCodegen { | |||
| 312 | }; | 312 | }; |
| 313 | } | 313 | } |
| 314 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 314 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 315 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 315 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 316 | node.GetNamePtr()); | 316 | node.GetNamePtr()); |
| 317 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", | 317 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", |
| 318 | node.GetTypePtr(), node.GetNamePtr()); | 318 | node.GetTypePtr(), node.GetNamePtr()); |
| @@ -338,7 +338,7 @@ class SqrtAscIrCodegenImpl : public AscIrCodegen { | |||
| 338 | }; | 338 | }; |
| 339 | } | 339 | } |
| 340 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 340 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 341 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 341 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 342 | node.GetNamePtr()); | 342 | node.GetNamePtr()); |
| 343 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", | 343 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", |
| 344 | node.GetTypePtr(), node.GetNamePtr()); | 344 | node.GetTypePtr(), node.GetNamePtr()); |
| @@ -372,7 +372,7 @@ class RsqrtAscIrCodegenImpl : public AscIrCodegen { | |||
| 372 | }; | 372 | }; |
| 373 | } | 373 | } |
| 374 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 374 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 375 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 375 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 376 | node.GetNamePtr()); | 376 | node.GetNamePtr()); |
| 377 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", | 377 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", |
| 378 | node.GetTypePtr(), node.GetNamePtr()); | 378 | node.GetTypePtr(), node.GetNamePtr()); |
| @@ -401,7 +401,7 @@ class NegAscIrCodegenImpl : public AscIrCodegen { | |||
| 401 | }; | 401 | }; |
| 402 | } | 402 | } |
| 403 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 403 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 404 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 404 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 405 | node.GetNamePtr()); | 405 | node.GetNamePtr()); |
| 406 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", | 406 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", |
| 407 | node.GetTypePtr(), node.GetNamePtr()); | 407 | node.GetTypePtr(), node.GetNamePtr()); |
| @@ -427,7 +427,7 @@ class ReluAscIrCodegenImpl : public AscIrCodegen { | |||
| 427 | }; | 427 | }; |
| 428 | } | 428 | } |
| 429 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 429 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 430 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 430 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 431 | node.GetNamePtr()); | 431 | node.GetNamePtr()); |
| 432 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", | 432 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", |
| 433 | node.GetTypePtr(), node.GetNamePtr()); | 433 | node.GetTypePtr(), node.GetNamePtr()); |
| @@ -460,7 +460,7 @@ class ReciprocalAscIrCodegenImpl : public AscIrCodegen { | |||
| 460 | }; | 460 | }; |
| 461 | } | 461 | } |
| 462 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 462 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 463 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 463 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 464 | node.GetNamePtr()); | 464 | node.GetNamePtr()); |
| 465 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", | 465 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", |
| 466 | node.GetTypePtr(), node.GetNamePtr()); | 466 | node.GetTypePtr(), node.GetNamePtr()); |
| @@ -490,7 +490,7 @@ class SignAscIrCodegenImpl : public AscIrCodegen { | |||
| 490 | }; | 490 | }; |
| 491 | } | 491 | } |
| 492 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 492 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 493 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 493 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 494 | node.GetNamePtr()); | 494 | node.GetNamePtr()); |
| 495 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", | 495 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", |
| 496 | node.GetTypePtr(), node.GetNamePtr()); | 496 | node.GetTypePtr(), node.GetNamePtr()); |
| @@ -523,7 +523,7 @@ class IsnanAscIrCodegenImpl : public AscIrCodegen { | |||
| 523 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 523 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 524 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", | 524 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", |
| 525 | node.GetTypePtr(), node.GetNamePtr()); | 525 | node.GetTypePtr(), node.GetNamePtr()); |
| 526 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 526 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 527 | node.GetNamePtr()); | 527 | node.GetNamePtr()); |
| 528 | return true; | 528 | return true; |
| 529 | } | 529 | } |
| @@ -551,7 +551,7 @@ class IsFiniteAscIrCodegenImpl : public AscIrCodegen { | |||
| 551 | }; | 551 | }; |
| 552 | } | 552 | } |
| 553 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 553 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 554 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 554 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 555 | node.GetNamePtr()); | 555 | node.GetNamePtr()); |
| 556 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", | 556 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", |
| 557 | node.GetTypePtr(), node.GetNamePtr()); | 557 | node.GetTypePtr(), node.GetNamePtr()); |
| @@ -583,7 +583,7 @@ class IsInfAscIrCodegenImpl : public AscIrCodegen { | |||
| 583 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 583 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 584 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", | 584 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", |
| 585 | node.GetTypePtr(), node.GetNamePtr()); | 585 | node.GetTypePtr(), node.GetNamePtr()); |
| 586 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 586 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 587 | node.GetNamePtr()); | 587 | node.GetNamePtr()); |
| 588 | return true; | 588 | return true; |
| 589 | } | 589 | } |
| @@ -615,7 +615,7 @@ class LogicalNotAscIrCodegenImpl : public AscIrCodegen { | |||
| 615 | }; | 615 | }; |
| 616 | } | 616 | } |
| 617 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 617 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 618 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 618 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 619 | node.GetNamePtr()); | 619 | node.GetNamePtr()); |
| 620 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", | 620 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", |
| 621 | node.GetTypePtr(), node.GetNamePtr()); | 621 | node.GetTypePtr(), node.GetNamePtr()); |
| @@ -649,7 +649,7 @@ class MaxAscIrCodegenImpl : public AscIrCodegen { | |||
| 649 | }; | 649 | }; |
| 650 | } | 650 | } |
| 651 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 651 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 652 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 652 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 653 | node.GetNamePtr()); | 653 | node.GetNamePtr()); |
| 654 | return true; | 654 | return true; |
| 655 | } | 655 | } |
| @@ -760,7 +760,7 @@ class SumAscIrCodegenImpl : public AscIrCodegen { | |||
| 760 | }; | 760 | }; |
| 761 | } | 761 | } |
| 762 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 762 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 763 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 763 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 764 | node.GetNamePtr()); | 764 | node.GetNamePtr()); |
| 765 | return true; | 765 | return true; |
| 766 | } | 766 | } |
| @@ -792,7 +792,7 @@ class MinAscIrCodegenImpl : public AscIrCodegen { | |||
| 792 | }; | 792 | }; |
| 793 | } | 793 | } |
| 794 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 794 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 795 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 795 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 796 | node.GetNamePtr()); | 796 | node.GetNamePtr()); |
| 797 | return true; | 797 | return true; |
| 798 | } | 798 | } |
| @@ -824,7 +824,7 @@ class MeanAscIrCodegenImpl : public AscIrCodegen { | |||
| 824 | }; | 824 | }; |
| 825 | } | 825 | } |
| 826 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 826 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 827 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 827 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 828 | node.GetNamePtr()); | 828 | node.GetNamePtr()); |
| 829 | return true; | 829 | return true; |
| 830 | } | 830 | } |
| @@ -856,7 +856,7 @@ class ProdAscIrCodegenImpl : public AscIrCodegen { | |||
| 856 | }; | 856 | }; |
| 857 | } | 857 | } |
| 858 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 858 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 859 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 859 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 860 | node.GetNamePtr()); | 860 | node.GetNamePtr()); |
| 861 | return true; | 861 | return true; |
| 862 | } | 862 | } |
| @@ -888,7 +888,7 @@ class AnyAscIrCodegenImpl : public AscIrCodegen { | |||
| 888 | }; | 888 | }; |
| 889 | } | 889 | } |
| 890 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 890 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 891 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 891 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 892 | node.GetNamePtr()); | 892 | node.GetNamePtr()); |
| 893 | return true; | 893 | return true; |
| 894 | } | 894 | } |
| @@ -920,7 +920,7 @@ class AllAscIrCodegenImpl : public AscIrCodegen { | |||
| 920 | }; | 920 | }; |
| 921 | } | 921 | } |
| 922 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 922 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 923 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 923 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 924 | node.GetNamePtr()); | 924 | node.GetNamePtr()); |
| 925 | return true; | 925 | return true; |
| 926 | } | 926 | } |
| @@ -952,7 +952,7 @@ class GeAscIrCodegenImpl : public AscIrCodegen { | |||
| 952 | }; | 952 | }; |
| 953 | } | 953 | } |
| 954 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 954 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 955 | - GE_ASSERT_TRUE(!IsNodeFirstInputScalar(node), "Node %s[%s] not support first input scalar", node.GetTypePtr(), | 955 | + GE_ASSERT_TRUE(!IsNodeFirstInputScalar(node), "Node %s[%s] does not support first input scalar", node.GetTypePtr(), |
| 956 | node.GetNamePtr()); | 956 | node.GetNamePtr()); |
| 957 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node, {false, {1}}), | 957 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node, {false, {1}}), |
| 958 | "Node %s[%s] check shape consistency failed", node.GetTypePtr(), node.GetNamePtr()); | 958 | "Node %s[%s] check shape consistency failed", node.GetTypePtr(), node.GetNamePtr()); |
| @@ -991,7 +991,7 @@ class EqAscIrCodegenImpl : public AscIrCodegen { | |||
| 991 | }; | 991 | }; |
| 992 | } | 992 | } |
| 993 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 993 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 994 | - GE_ASSERT_TRUE(!IsNodeFirstInputScalar(node), "Node %s[%s] not support first input scalar", node.GetTypePtr(), | 994 | + GE_ASSERT_TRUE(!IsNodeFirstInputScalar(node), "Node %s[%s] does not support first input scalar", node.GetTypePtr(), |
| 995 | node.GetNamePtr()); | 995 | node.GetNamePtr()); |
| 996 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node, {false, {1}}), | 996 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node, {false, {1}}), |
| 997 | "Node %s[%s] check shape consistency failed", node.GetTypePtr(), node.GetNamePtr()); | 997 | "Node %s[%s] check shape consistency failed", node.GetTypePtr(), node.GetNamePtr()); |
| @@ -1029,7 +1029,7 @@ class NeAscIrCodegenImpl : public AscIrCodegen { | |||
| 1029 | }; | 1029 | }; |
| 1030 | } | 1030 | } |
| 1031 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 1031 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 1032 | - GE_ASSERT_TRUE(!IsNodeFirstInputScalar(node), "Node %s[%s] not support first input scalar", node.GetTypePtr(), | 1032 | + GE_ASSERT_TRUE(!IsNodeFirstInputScalar(node), "Node %s[%s] does not support first input scalar", node.GetTypePtr(), |
| 1033 | node.GetNamePtr()); | 1033 | node.GetNamePtr()); |
| 1034 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node, {false, {1}}), | 1034 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node, {false, {1}}), |
| 1035 | "Node %s[%s] check shape consistency failed", node.GetTypePtr(), node.GetNamePtr()); | 1035 | "Node %s[%s] check shape consistency failed", node.GetTypePtr(), node.GetNamePtr()); |
| @@ -1063,7 +1063,7 @@ class GtAscIrCodegenImpl : public AscIrCodegen { | |||
| 1063 | }; | 1063 | }; |
| 1064 | } | 1064 | } |
| 1065 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 1065 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 1066 | - GE_ASSERT_TRUE(!IsNodeFirstInputScalar(node), "Node %s[%s] not support first input scalar", node.GetTypePtr(), | 1066 | + GE_ASSERT_TRUE(!IsNodeFirstInputScalar(node), "Node %s[%s] does not support first input scalar", node.GetTypePtr(), |
| 1067 | node.GetNamePtr()); | 1067 | node.GetNamePtr()); |
| 1068 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node, {false, {1}}), | 1068 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node, {false, {1}}), |
| 1069 | "Node %s[%s] check shape consistency failed", node.GetTypePtr(), node.GetNamePtr()); | 1069 | "Node %s[%s] check shape consistency failed", node.GetTypePtr(), node.GetNamePtr()); |
| @@ -1097,7 +1097,7 @@ class LeAscIrCodegenImpl : public AscIrCodegen { | |||
| 1097 | }; | 1097 | }; |
| 1098 | } | 1098 | } |
| 1099 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 1099 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 1100 | - GE_ASSERT_TRUE(!IsNodeFirstInputScalar(node), "Node %s[%s] not support first input scalar", node.GetTypePtr(), | 1100 | + GE_ASSERT_TRUE(!IsNodeFirstInputScalar(node), "Node %s[%s] does not support first input scalar", node.GetTypePtr(), |
| 1101 | node.GetNamePtr()); | 1101 | node.GetNamePtr()); |
| 1102 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node, {false, {1}}), | 1102 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node, {false, {1}}), |
| 1103 | "Node %s[%s] check shape consistency failed", node.GetTypePtr(), node.GetNamePtr()); | 1103 | "Node %s[%s] check shape consistency failed", node.GetTypePtr(), node.GetNamePtr()); |
| @@ -1131,7 +1131,7 @@ class LtAscIrCodegenImpl : public AscIrCodegen { | |||
| 1131 | }; | 1131 | }; |
| 1132 | } | 1132 | } |
| 1133 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 1133 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 1134 | - GE_ASSERT_TRUE(!IsNodeFirstInputScalar(node), "Node %s[%s] not support first input scalar", node.GetTypePtr(), | 1134 | + GE_ASSERT_TRUE(!IsNodeFirstInputScalar(node), "Node %s[%s] does not support first input scalar", node.GetTypePtr(), |
| 1135 | node.GetNamePtr()); | 1135 | node.GetNamePtr()); |
| 1136 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node, {false, {1}}), | 1136 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node, {false, {1}}), |
| 1137 | "Node %s[%s] check shape consistency failed", node.GetTypePtr(), node.GetNamePtr()); | 1137 | "Node %s[%s] check shape consistency failed", node.GetTypePtr(), node.GetNamePtr()); |
| @@ -1164,7 +1164,7 @@ class SigmoidAscIrCodegenImpl : public AscIrCodegen { | |||
| 1164 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 1164 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 1165 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", | 1165 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", |
| 1166 | node.GetTypePtr(), node.GetNamePtr()); | 1166 | node.GetTypePtr(), node.GetNamePtr()); |
| 1167 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 1167 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 1168 | node.GetNamePtr()); | 1168 | node.GetNamePtr()); |
| 1169 | return true; | 1169 | return true; |
| 1170 | } | 1170 | } |
| @@ -1182,7 +1182,7 @@ class Ub2ubAscIrCodegenImpl : public AscIrCodegen { | |||
| 1182 | return {}; | 1182 | return {}; |
| 1183 | } | 1183 | } |
| 1184 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 1184 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 1185 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 1185 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 1186 | node.GetNamePtr()); | 1186 | node.GetNamePtr()); |
| 1187 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", | 1187 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", |
| 1188 | node.GetTypePtr(), node.GetNamePtr()); | 1188 | node.GetTypePtr(), node.GetNamePtr()); |
| @@ -1403,7 +1403,7 @@ class RemainderAscIrCodegenImpl : public AscIrCodegen { | |||
| 1403 | }; | 1403 | }; |
| 1404 | } | 1404 | } |
| 1405 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 1405 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 1406 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 1406 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 1407 | node.GetNamePtr()); | 1407 | node.GetNamePtr()); |
| 1408 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node, {true, {0, 1}}), | 1408 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node, {true, {0, 1}}), |
| 1409 | "Node %s[%s] check shape consistency failed", node.GetTypePtr(), node.GetNamePtr()); | 1409 | "Node %s[%s] check shape consistency failed", node.GetTypePtr(), node.GetNamePtr()); |
| @@ -1514,7 +1514,7 @@ class WhereAscIrCodegenImpl : public AscIrCodegen { | |||
| 1514 | }; | 1514 | }; |
| 1515 | } | 1515 | } |
| 1516 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 1516 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 1517 | - GE_ASSERT_TRUE(!IsNodeFirstInputScalar(node), "Node %s[%s] not support first input scalar", node.GetTypePtr(), | 1517 | + GE_ASSERT_TRUE(!IsNodeFirstInputScalar(node), "Node %s[%s] does not support first input scalar", node.GetTypePtr(), |
| 1518 | node.GetNamePtr()); | 1518 | node.GetNamePtr()); |
| 1519 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node, {false, {1, 2}}), | 1519 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node, {false, {1, 2}}), |
| 1520 | "Node %s[%s] check shape consistency failed", node.GetTypePtr(), node.GetNamePtr()); | 1520 | "Node %s[%s] check shape consistency failed", node.GetTypePtr(), node.GetNamePtr()); |
| @@ -1548,7 +1548,7 @@ class SelectAscIrCodegenImpl : public AscIrCodegen { | |||
| 1548 | }; | 1548 | }; |
| 1549 | } | 1549 | } |
| 1550 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 1550 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 1551 | - GE_ASSERT_TRUE(!IsNodeFirstInputScalar(node), "Node %s[%s] not support first input scalar", node.GetTypePtr(), | 1551 | + GE_ASSERT_TRUE(!IsNodeFirstInputScalar(node), "Node %s[%s] does not support first input scalar", node.GetTypePtr(), |
| 1552 | node.GetNamePtr()); | 1552 | node.GetNamePtr()); |
| 1553 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node, {false, {1, 2}}), | 1553 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node, {false, {1, 2}}), |
| 1554 | "Node %s[%s] check shape consistency failed", node.GetTypePtr(), node.GetNamePtr()); | 1554 | "Node %s[%s] check shape consistency failed", node.GetTypePtr(), node.GetNamePtr()); |
| @@ -1587,7 +1587,7 @@ class LeakyReluAscIrCodegenImpl : public AscIrCodegen { | |||
| 1587 | }; | 1587 | }; |
| 1588 | } | 1588 | } |
| 1589 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 1589 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 1590 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 1590 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 1591 | node.GetNamePtr()); | 1591 | node.GetNamePtr()); |
| 1592 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", | 1592 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", |
| 1593 | node.GetTypePtr(), node.GetNamePtr()); | 1593 | node.GetTypePtr(), node.GetNamePtr()); |
| @@ -1643,7 +1643,7 @@ class StoreAscIrCodegenImpl : public AscIrCodegen { | |||
| 1643 | return {}; | 1643 | return {}; |
| 1644 | } | 1644 | } |
| 1645 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 1645 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 1646 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 1646 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 1647 | node.GetNamePtr()); | 1647 | node.GetNamePtr()); |
| 1648 | return true; | 1648 | return true; |
| 1649 | } | 1649 | } |
| @@ -1670,7 +1670,7 @@ class ConcatAscIrCodegenImpl : public AscIrCodegen { | |||
| 1670 | }; | 1670 | }; |
| 1671 | } | 1671 | } |
| 1672 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 1672 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 1673 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 1673 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 1674 | node.GetNamePtr()); | 1674 | node.GetNamePtr()); |
| 1675 | return true; | 1675 | return true; |
| 1676 | } | 1676 | } |
| @@ -1698,7 +1698,7 @@ class GatherAscIrCodegenImpl : public AscIrCodegen { | |||
| 1698 | }; | 1698 | }; |
| 1699 | } | 1699 | } |
| 1700 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 1700 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 1701 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 1701 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 1702 | node.GetNamePtr()); | 1702 | node.GetNamePtr()); |
| 1703 | return true; | 1703 | return true; |
| 1704 | } | 1704 | } |
| @@ -1728,7 +1728,7 @@ class TransposeAscIrCodegenImpl : public AscIrCodegen { | |||
| 1728 | }; | 1728 | }; |
| 1729 | } | 1729 | } |
| 1730 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 1730 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 1731 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 1731 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 1732 | node.GetNamePtr()); | 1732 | node.GetNamePtr()); |
| 1733 | return true; | 1733 | return true; |
| 1734 | } | 1734 | } |
| @@ -1752,7 +1752,7 @@ class ErfAscIrCodegenImpl : public AscIrCodegen { | |||
| 1752 | }; | 1752 | }; |
| 1753 | } | 1753 | } |
| 1754 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 1754 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 1755 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 1755 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 1756 | node.GetNamePtr()); | 1756 | node.GetNamePtr()); |
| 1757 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", | 1757 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", |
| 1758 | node.GetTypePtr(), node.GetNamePtr()); | 1758 | node.GetTypePtr(), node.GetNamePtr()); |
| @@ -1777,7 +1777,7 @@ class TanhAscIrCodegenImpl : public AscIrCodegen { | |||
| 1777 | }; | 1777 | }; |
| 1778 | } | 1778 | } |
| 1779 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 1779 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 1780 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 1780 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 1781 | node.GetNamePtr()); | 1781 | node.GetNamePtr()); |
| 1782 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", | 1782 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", |
| 1783 | node.GetTypePtr(), node.GetNamePtr()); | 1783 | node.GetTypePtr(), node.GetNamePtr()); |
| @@ -1803,7 +1803,7 @@ class GeluAscIrCodegenImpl : public AscIrCodegen { | |||
| 1803 | }; | 1803 | }; |
| 1804 | } | 1804 | } |
| 1805 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 1805 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 1806 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 1806 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 1807 | node.GetNamePtr()); | 1807 | node.GetNamePtr()); |
| 1808 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", | 1808 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", |
| 1809 | node.GetTypePtr(), node.GetNamePtr()); | 1809 | node.GetTypePtr(), node.GetNamePtr()); |
| @@ -1905,7 +1905,7 @@ class BitwiseAndAscIrCodegenImpl : public AscIrCodegen { | |||
| 1905 | }; | 1905 | }; |
| 1906 | } | 1906 | } |
| 1907 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 1907 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 1908 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 1908 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 1909 | node.GetNamePtr()); | 1909 | node.GetNamePtr()); |
| 1910 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", | 1910 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", |
| 1911 | node.GetTypePtr(), node.GetNamePtr()); | 1911 | node.GetTypePtr(), node.GetNamePtr()); |
| @@ -1935,7 +1935,7 @@ class FloorDivAscIrCodegenImpl : public AscIrCodegen { | |||
| 1935 | }; | 1935 | }; |
| 1936 | } | 1936 | } |
| 1937 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 1937 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 1938 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 1938 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 1939 | node.GetNamePtr()); | 1939 | node.GetNamePtr()); |
| 1940 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", | 1940 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", |
| 1941 | node.GetTypePtr(), node.GetNamePtr()); | 1941 | node.GetTypePtr(), node.GetNamePtr()); |
| @@ -2002,7 +2002,7 @@ class AxpyAscIrCodegenImpl : public AscIrCodegen { | |||
| 2002 | }; | 2002 | }; |
| 2003 | } | 2003 | } |
| 2004 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 2004 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 2005 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 2005 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 2006 | node.GetNamePtr()); | 2006 | node.GetNamePtr()); |
| 2007 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", | 2007 | GE_ASSERT_SUCCESS(ValidateShapeConsistencyWithSingleOutput(node), "Node %s[%s] check shape consistency failed", |
| 2008 | node.GetTypePtr(), node.GetNamePtr()); | 2008 | node.GetTypePtr(), node.GetNamePtr()); |
| @@ -2035,7 +2035,7 @@ class MatMulAscIrCodegenImpl : public AscIrCodegen { | |||
| 2035 | }; | 2035 | }; |
| 2036 | } | 2036 | } |
| 2037 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 2037 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 2038 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 2038 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 2039 | node.GetNamePtr()); | 2039 | node.GetNamePtr()); |
| 2040 | return true; | 2040 | return true; |
| 2041 | } | 2041 | } |
| @@ -2067,7 +2067,7 @@ class BatchMatMulAscIrCodegenImpl : public AscIrCodegen { | |||
| 2067 | }; | 2067 | }; |
| 2068 | } | 2068 | } |
| 2069 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { | 2069 | [[nodiscard]] bool IsNodeValid(const AscNode &node) const override { |
| 2070 | - GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] not support scalar input", node.GetTypePtr(), | 2070 | + GE_ASSERT_TRUE(!IsNodeHasScalarInput(node), "Node %s[%s] does not support scalar input", node.GetTypePtr(), |
| 2071 | node.GetNamePtr()); | 2071 | node.GetNamePtr()); |
| 2072 | return true; | 2072 | return true; |
| 2073 | } | 2073 | } |
| @@ -2091,9 +2091,9 @@ class Conv2DAscIrCodegenImpl : public AscIrCodegen { | |||
| 2091 | std::string node_type = node.GetType(); | 2091 | std::string node_type = node.GetType(); |
| 2092 | const auto &inputs = node.GetInDataNodes(); | 2092 | const auto &inputs = node.GetInDataNodes(); |
| 2093 | GE_ASSERT_TRUE(!(inputs.size() > 0 && inputs.at(0)->GetType() == "Scalar"), | 2093 | GE_ASSERT_TRUE(!(inputs.size() > 0 && inputs.at(0)->GetType() == "Scalar"), |
| 2094 | - "Node %s[%s] not support scalar input at index 0", node.GetTypePtr(), node.GetNamePtr()); | 2094 | + "Node %s[%s] does not support scalar input at index 0", node.GetTypePtr(), node.GetNamePtr()); |
| 2095 | GE_ASSERT_TRUE(!(inputs.size() > 1 && inputs.at(1)->GetType() == "Scalar"), | 2095 | GE_ASSERT_TRUE(!(inputs.size() > 1 && inputs.at(1)->GetType() == "Scalar"), |
| 2096 | - "Node %s[%s] not support scalar input at index 1", node.GetTypePtr(), node.GetNamePtr()); | 2096 | + "Node %s[%s] does not support scalar input at index 1", node.GetTypePtr(), node.GetNamePtr()); |
| 2097 | return true; | 2097 | return true; |
| 2098 | } | 2098 | } |
| 2099 | }; | 2099 | }; |
| @@ -917,7 +917,7 @@ bool UseSmallTailConcatApi(const af::AscNode &node, bool *output_need_align) { | |||
| 917 | gcd = ascgen_utils::Gcd(gcd, src_col_size); | 917 | gcd = ascgen_utils::Gcd(gcd, src_col_size); |
| 918 | } | 918 | } |
| 919 | // 全对齐, 使用全对齐的api性能更好 | 919 | // 全对齐, 使用全对齐的api性能更好 |
| 920 | - GE_CHK_BOOL_RET_SPECIAL_STATUS(aligned_cnt == node_inputs.Size(), false, "[%s] inputs is all aligned", | 920 | + GE_CHK_BOOL_RET_SPECIAL_STATUS(aligned_cnt == node_inputs.Size(), false, "[%s] inputs are all aligned", |
| 921 | node.GetNamePtr()); | 921 | node.GetNamePtr()); |
| 922 | constexpr int64_t kSrcMaxSrcColSize = 64; | 922 | constexpr int64_t kSrcMaxSrcColSize = 64; |
| 923 | constexpr uint32_t kMaxDstColSize = 96; // 最大96K的tmp buffer, 只支持96 | 923 | constexpr uint32_t kMaxDstColSize = 96; // 最大96K的tmp buffer, 只支持96 |
| @@ -963,7 +963,7 @@ bool IsConcatAllInputsAligned(const af::AscNode &node) { | |||
| 963 | return false; | 963 | return false; |
| 964 | } | 964 | } |
| 965 | } | 965 | } |
| 966 | - GELOGI("[%s] All inputs is aligned", node.GetNamePtr()); | 966 | + GELOGI("[%s] All inputs are aligned", node.GetNamePtr()); |
| 967 | return true; | 967 | return true; |
| 968 | } | 968 | } |
| 969 | 969 | ||
| @@ -110,7 +110,7 @@ af::Status StringToJson(const std::string &json_str, Json &json) { | |||
| 110 | af::Status LinearFunc(const std::map<std::string, float> ¶m_map, const std::vector<Expr> &dims, const Expr &stride, | 110 | af::Status LinearFunc(const std::map<std::string, float> ¶m_map, const std::vector<Expr> &dims, const Expr &stride, |
| 111 | Expr &res) { | 111 | Expr &res) { |
| 112 | (void)stride; | 112 | (void)stride; |
| 113 | - GE_ASSERT_TRUE(!dims.empty(), "Dims is empty."); | 113 | + GE_ASSERT_TRUE(!dims.empty(), "Dims are empty."); |
| 114 | GE_ASSERT_TRUE(param_map.find("k") != param_map.end(), "Param k not found in param_map."); | 114 | GE_ASSERT_TRUE(param_map.find("k") != param_map.end(), "Param k not found in param_map."); |
| 115 | GE_ASSERT_TRUE(param_map.find("b") != param_map.end(), "Param b not found in param_map."); | 115 | GE_ASSERT_TRUE(param_map.find("b") != param_map.end(), "Param b not found in param_map."); |
| 116 | Expr k = CreateExpr(param_map.at("k")); | 116 | Expr k = CreateExpr(param_map.at("k")); |
| @@ -122,7 +122,7 @@ af::Status LinearFunc(const std::map<std::string, float> ¶m_map, const std:: | |||
| 122 | 122 | ||
| 123 | af::Status LoadStoreStrideFunc(const std::map<std::string, float> ¶m_map, const std::vector<Expr> &dims, | 123 | af::Status LoadStoreStrideFunc(const std::map<std::string, float> ¶m_map, const std::vector<Expr> &dims, |
| 124 | const Expr &stride, Expr &res) { | 124 | const Expr &stride, Expr &res) { |
| 125 | - GE_ASSERT_TRUE(!dims.empty(), "Dims is empty."); | 125 | + GE_ASSERT_TRUE(!dims.empty(), "Dims are empty."); |
| 126 | GE_ASSERT_TRUE(param_map.find("k") != param_map.end(), "Param k not found in param_map."); | 126 | GE_ASSERT_TRUE(param_map.find("k") != param_map.end(), "Param k not found in param_map."); |
| 127 | Expr k = CreateExpr(param_map.at("k")); | 127 | Expr k = CreateExpr(param_map.at("k")); |
| 128 | Expr block_count = accumulate(dims.begin(), dims.end() - 1, CreateExpr(1), [](Expr a, Expr b) { return a * b; }); | 128 | Expr block_count = accumulate(dims.begin(), dims.end() - 1, CreateExpr(1), [](Expr a, Expr b) { return a * b; }); |
| @@ -249,7 +249,7 @@ std::map<std::string, float> EnrichParamMapForModel(const std::map<std::string, | |||
| 249 | 249 | ||
| 250 | af::Status LoadStoreStrideV2Func(const std::map<std::string, float> ¶m_map, const std::vector<Expr> &dims, | 250 | af::Status LoadStoreStrideV2Func(const std::map<std::string, float> ¶m_map, const std::vector<Expr> &dims, |
| 251 | const Expr &stride, Expr &res) { | 251 | const Expr &stride, Expr &res) { |
| 252 | - GE_ASSERT_TRUE(!dims.empty(), "Dims is empty."); | 252 | + GE_ASSERT_TRUE(!dims.empty(), "Dims are empty."); |
| 253 | const auto k_iter = param_map.find("k"); | 253 | const auto k_iter = param_map.find("k"); |
| 254 | const auto u_iter = param_map.find("u"); | 254 | const auto u_iter = param_map.find("u"); |
| 255 | GE_ASSERT_TRUE(k_iter != param_map.end(), "Param k not found in param_map."); | 255 | GE_ASSERT_TRUE(k_iter != param_map.end(), "Param k not found in param_map."); |
| @@ -274,7 +274,7 @@ af::Status LoadStoreStrideV2Func(const std::map<std::string, float> ¶m_map, | |||
| 274 | 274 | ||
| 275 | af::Status LoadStoreStrideV2WithPenaltyFunc(const std::map<std::string, float> ¶m_map, | 275 | af::Status LoadStoreStrideV2WithPenaltyFunc(const std::map<std::string, float> ¶m_map, |
| 276 | const std::vector<Expr> &dims, const Expr &stride, Expr &res) { | 276 | const std::vector<Expr> &dims, const Expr &stride, Expr &res) { |
| 277 | - GE_ASSERT_TRUE(!dims.empty(), "Dims is empty."); | 277 | + GE_ASSERT_TRUE(!dims.empty(), "Dims are empty."); |
| 278 | const auto k_iter = param_map.find("k"); | 278 | const auto k_iter = param_map.find("k"); |
| 279 | const auto u_iter = param_map.find("u"); | 279 | const auto u_iter = param_map.find("u"); |
| 280 | GE_ASSERT_TRUE(k_iter != param_map.end(), "Param k not found in param_map."); | 280 | GE_ASSERT_TRUE(k_iter != param_map.end(), "Param k not found in param_map."); |
| @@ -299,7 +299,7 @@ af::Status LoadStoreStrideV2WithPenaltyFunc(const std::map<std::string, float> & | |||
| 299 | af::Status LoadStoreFunc(const std::map<std::string, float> ¶m_map, const std::vector<Expr> &dims, | 299 | af::Status LoadStoreFunc(const std::map<std::string, float> ¶m_map, const std::vector<Expr> &dims, |
| 300 | const Expr &stride, Expr &res, bool expand_data) { | 300 | const Expr &stride, Expr &res, bool expand_data) { |
| 301 | (void)stride; | 301 | (void)stride; |
| 302 | - GE_ASSERT_TRUE(!dims.empty(), "Dims is empty."); | 302 | + GE_ASSERT_TRUE(!dims.empty(), "Dims are empty."); |
| 303 | GE_ASSERT_TRUE(param_map.find("h") != param_map.end(), "Param h not found in param_map."); | 303 | GE_ASSERT_TRUE(param_map.find("h") != param_map.end(), "Param h not found in param_map."); |
| 304 | GE_ASSERT_TRUE(param_map.find("a") != param_map.end(), "Param a not found in param_map."); | 304 | GE_ASSERT_TRUE(param_map.find("a") != param_map.end(), "Param a not found in param_map."); |
| 305 | GE_ASSERT_TRUE(param_map.find("b") != param_map.end(), "Param b not found in param_map."); | 305 | GE_ASSERT_TRUE(param_map.find("b") != param_map.end(), "Param b not found in param_map."); |
| @@ -340,7 +340,7 @@ af::Status LoadUbStride(const std::map<std::string, float> ¶m_map, const std | |||
| 340 | af::Status StoreFunc(const std::map<std::string, float> ¶m_map, const std::vector<Expr> &dims, const Expr &stride, | 340 | af::Status StoreFunc(const std::map<std::string, float> ¶m_map, const std::vector<Expr> &dims, const Expr &stride, |
| 341 | Expr &res) { | 341 | Expr &res) { |
| 342 | (void)stride; | 342 | (void)stride; |
| 343 | - GE_ASSERT_TRUE(!dims.empty(), "Dims is empty."); | 343 | + GE_ASSERT_TRUE(!dims.empty(), "Dims are empty."); |
| 344 | GE_ASSERT_TRUE(param_map.find("h") != param_map.end(), "Param h not found in param_map."); | 344 | GE_ASSERT_TRUE(param_map.find("h") != param_map.end(), "Param h not found in param_map."); |
| 345 | GE_ASSERT_TRUE(param_map.find("ak") != param_map.end(), "Param ak not found in param_map."); | 345 | GE_ASSERT_TRUE(param_map.find("ak") != param_map.end(), "Param ak not found in param_map."); |
| 346 | GE_ASSERT_TRUE(param_map.find("ab") != param_map.end(), "Param ab not found in param_map."); | 346 | GE_ASSERT_TRUE(param_map.find("ab") != param_map.end(), "Param ab not found in param_map."); |
| @@ -137,7 +137,7 @@ af::Status VfPerfUtils::AddVfInstructPerf(const std::string &vf_instruct_type, c | |||
| 137 | GELOGD("Begin to add perf of vf instruct [%s].", vf_instruct_type.c_str()); | 137 | GELOGD("Begin to add perf of vf instruct [%s].", vf_instruct_type.c_str()); |
| 138 | for (const auto &api_perf : api_perf_table) { | 138 | for (const auto &api_perf : api_perf_table) { |
| 139 | if (std::count(api_perf.support_data_types.begin(), api_perf.support_data_types.end(), data_type) > 0) { | 139 | if (std::count(api_perf.support_data_types.begin(), api_perf.support_data_types.end(), data_type) > 0) { |
| 140 | - GELOGD("Found perf of vf instruct [%s]: latency is {%d}, throughput is {%d}, repeat_time is [%s].", | 140 | + GELOGD("Found perf of vf instruct [%s]: latency is {%d} cycles, throughput is {%d} cycles, repeat_time is [%s].", |
| 141 | vf_instruct_type.c_str(), api_perf.latency, api_perf.throughput, | 141 | vf_instruct_type.c_str(), api_perf.latency, api_perf.throughput, |
| 142 | af::SymbolicUtils::ToString(repeat_time).c_str()); | 142 | af::SymbolicUtils::ToString(repeat_time).c_str()); |
| 143 | latency = af::sym::Max(CreateExpr(api_perf.latency), latency); | 143 | latency = af::sym::Max(CreateExpr(api_perf.latency), latency); |
| @@ -189,7 +189,7 @@ af::Status CheckExecConditionBroadcast(const TuningSpacePtr tuning_space, const | |||
| 189 | GE_ASSERT_NOTNULL(fused_axis); | 189 | GE_ASSERT_NOTNULL(fused_axis); |
| 190 | if (node.exec_condition != af::ExecuteCondition::kCacheBlockSplitFusedBroadcastAxis && | 190 | if (node.exec_condition != af::ExecuteCondition::kCacheBlockSplitFusedBroadcastAxis && |
| 191 | node.exec_condition != af::ExecuteCondition::kCacheBlockSplitOriginBroadcastAxis) { | 191 | node.exec_condition != af::ExecuteCondition::kCacheBlockSplitOriginBroadcastAxis) { |
| 192 | - GELOGD("exec_condition not match"); | 192 | + GELOGD("exec_condition does not match"); |
| 193 | return af::SUCCESS; | 193 | return af::SUCCESS; |
| 194 | } | 194 | } |
| 195 | is_split = true; | 195 | is_split = true; |
| @@ -436,7 +436,7 @@ af::Status AscendGraphParser::ParseTensorMemInfo(const af::AscTensorAttr &ascir_ | |||
| 436 | combined_tensors_[container][ascir_tensor_info.mem.reuse_id].emplace_back(tensor); | 436 | combined_tensors_[container][ascir_tensor_info.mem.reuse_id].emplace_back(tensor); |
| 437 | } | 437 | } |
| 438 | if (container == nullptr) { | 438 | if (container == nullptr) { |
| 439 | - GELOGW("Tensor [%s] container not get.", tensor->name.c_str()); | 439 | + GELOGW("Tensor [%s] container was not found.", tensor->name.c_str()); |
| 440 | } else { | 440 | } else { |
| 441 | GELOGD("Get tensor [%s] container [%s][%d] success.", tensor->name.c_str(), container->name.c_str(), | 441 | GELOGD("Get tensor [%s] container [%s][%d] success.", tensor->name.c_str(), container->name.c_str(), |
| 442 | container->container_id); | 442 | container->container_id); |
| @@ -19,49 +19,49 @@ namespace att { | |||
| 19 | namespace { | 19 | namespace { |
| 20 | af::Status FillReduceParams(const ascir_param::AscirNodeParams ¶ms, NodeInfo &node_info) { | 20 | af::Status FillReduceParams(const ascir_param::AscirNodeParams ¶ms, NodeInfo &node_info) { |
| 21 | const auto *reduce = ascir_param::GetSpecificParams<ascir_param::ReduceNodeParams>(params); | 21 | const auto *reduce = ascir_param::GetSpecificParams<ascir_param::ReduceNodeParams>(params); |
| 22 | - GE_ASSERT_NOTNULL(reduce, "Reduce specific params is null, node[%s].", node_info.name.c_str()); | 22 | + GE_ASSERT_NOTNULL(reduce, "Reduce specific params are null, node[%s].", node_info.name.c_str()); |
| 23 | node_info.reduce_specific_params = *reduce; | 23 | node_info.reduce_specific_params = *reduce; |
| 24 | return af::SUCCESS; | 24 | return af::SUCCESS; |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | af::Status FillVectorFuncParams(const ascir_param::AscirNodeParams ¶ms, NodeInfo &node_info) { | 27 | af::Status FillVectorFuncParams(const ascir_param::AscirNodeParams ¶ms, NodeInfo &node_info) { |
| 28 | const auto *vector_func_params = ascir_param::GetSpecificParams<ascir_param::VectorFuncNodeParams>(params); | 28 | const auto *vector_func_params = ascir_param::GetSpecificParams<ascir_param::VectorFuncNodeParams>(params); |
| 29 | - GE_ASSERT_NOTNULL(vector_func_params, "VectorFunc specific params is null, node[%s].", node_info.name.c_str()); | 29 | + GE_ASSERT_NOTNULL(vector_func_params, "VectorFunc specific params are null, node[%s].", node_info.name.c_str()); |
| 30 | node_info.vector_func_params = *vector_func_params; | 30 | node_info.vector_func_params = *vector_func_params; |
| 31 | return af::SUCCESS; | 31 | return af::SUCCESS; |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | af::Status FillCastParams(const ascir_param::AscirNodeParams ¶ms, NodeInfo &node_info) { | 34 | af::Status FillCastParams(const ascir_param::AscirNodeParams ¶ms, NodeInfo &node_info) { |
| 35 | const auto *cast_params = ascir_param::GetSpecificParams<ascir_param::CastNodeParams>(params); | 35 | const auto *cast_params = ascir_param::GetSpecificParams<ascir_param::CastNodeParams>(params); |
| 36 | - GE_ASSERT_NOTNULL(cast_params, "Cast specific params is null, node[%s].", node_info.name.c_str()); | 36 | + GE_ASSERT_NOTNULL(cast_params, "Cast specific params are null, node[%s].", node_info.name.c_str()); |
| 37 | node_info.cast_node_params = *cast_params; | 37 | node_info.cast_node_params = *cast_params; |
| 38 | return af::SUCCESS; | 38 | return af::SUCCESS; |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | af::Status FillCompareParams(const ascir_param::AscirNodeParams ¶ms, NodeInfo &node_info) { | 41 | af::Status FillCompareParams(const ascir_param::AscirNodeParams ¶ms, NodeInfo &node_info) { |
| 42 | const auto *compare_params = ascir_param::GetSpecificParams<ascir_param::CompareNodeParams>(params); | 42 | const auto *compare_params = ascir_param::GetSpecificParams<ascir_param::CompareNodeParams>(params); |
| 43 | - GE_ASSERT_NOTNULL(compare_params, "Compare specific params is null, node[%s].", node_info.name.c_str()); | 43 | + GE_ASSERT_NOTNULL(compare_params, "Compare specific params are null, node[%s].", node_info.name.c_str()); |
| 44 | node_info.compare_node_params = *compare_params; | 44 | node_info.compare_node_params = *compare_params; |
| 45 | return af::SUCCESS; | 45 | return af::SUCCESS; |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | af::Status FillWhereParams(const ascir_param::AscirNodeParams ¶ms, NodeInfo &node_info) { | 48 | af::Status FillWhereParams(const ascir_param::AscirNodeParams ¶ms, NodeInfo &node_info) { |
| 49 | const auto *where_params = ascir_param::GetSpecificParams<ascir_param::WhereNodeParams>(params); | 49 | const auto *where_params = ascir_param::GetSpecificParams<ascir_param::WhereNodeParams>(params); |
| 50 | - GE_ASSERT_NOTNULL(where_params, "Where specific params is null, node[%s].", node_info.name.c_str()); | 50 | + GE_ASSERT_NOTNULL(where_params, "Where specific params are null, node[%s].", node_info.name.c_str()); |
| 51 | node_info.where_node_params = *where_params; | 51 | node_info.where_node_params = *where_params; |
| 52 | return af::SUCCESS; | 52 | return af::SUCCESS; |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | af::Status FillUnaryBitWidthChangeParams(const ascir_param::AscirNodeParams ¶ms, NodeInfo &node_info) { | 55 | af::Status FillUnaryBitWidthChangeParams(const ascir_param::AscirNodeParams ¶ms, NodeInfo &node_info) { |
| 56 | const auto *unary_params = ascir_param::GetSpecificParams<ascir_param::UnaryBitWidthChangeNodeParams>(params); | 56 | const auto *unary_params = ascir_param::GetSpecificParams<ascir_param::UnaryBitWidthChangeNodeParams>(params); |
| 57 | - GE_ASSERT_NOTNULL(unary_params, "Unary bitwidth change specific params is null, node[%s].", node_info.name.c_str()); | 57 | + GE_ASSERT_NOTNULL(unary_params, "Unary bitwidth change specific params are null, node[%s].", node_info.name.c_str()); |
| 58 | node_info.unary_bitwidth_change_node_params = *unary_params; | 58 | node_info.unary_bitwidth_change_node_params = *unary_params; |
| 59 | return af::SUCCESS; | 59 | return af::SUCCESS; |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | af::Status FillTransposeParams(const ascir_param::AscirNodeParams ¶ms, NodeInfo &node_info) { | 62 | af::Status FillTransposeParams(const ascir_param::AscirNodeParams ¶ms, NodeInfo &node_info) { |
| 63 | const auto *transpose_params = ascir_param::GetSpecificParams<ascir_param::TransposeNodeParams>(params); | 63 | const auto *transpose_params = ascir_param::GetSpecificParams<ascir_param::TransposeNodeParams>(params); |
| 64 | - GE_ASSERT_NOTNULL(transpose_params, "Transpose specific params is null, node[%s].", node_info.name.c_str()); | 64 | + GE_ASSERT_NOTNULL(transpose_params, "Transpose specific params are null, node[%s].", node_info.name.c_str()); |
| 65 | node_info.transpose_node_params = *transpose_params; | 65 | node_info.transpose_node_params = *transpose_params; |
| 66 | return af::SUCCESS; | 66 | return af::SUCCESS; |
| 67 | } | 67 | } |
| @@ -350,31 +350,35 @@ std::string GeneralSolverGen::GenAlignInput(const Expr arg, const std::string in | |||
| 350 | std::string GeneralSolverGen::GenClassAnotataion() { | 350 | std::string GeneralSolverGen::GenClassAnotataion() { |
| 351 | uint16_t idx = 0; | 351 | uint16_t idx = 0; |
| 352 | std::string strs = ""; | 352 | std::string strs = ""; |
| 353 | - strs += "用户可以在派生类中重载Run函数,构造自定义的求解算法,即\n"; | 353 | + strs += "Users can override the Run function in a derived class to construct a custom solving algorithm:\n"; |
| 354 | strs += " void bool Run(int32_t &solution_num, uint64_t *solutions) override;\n"; | 354 | strs += " void bool Run(int32_t &solution_num, uint64_t *solutions) override;\n"; |
| 355 | - strs += "其中:\n"; | 355 | + strs += "where:\n"; |
| 356 | - strs += " solution_num:int32_t类型的参数,用来输出实际得到的解的个数\n"; | 356 | + strs += " solution_num: an int32_t parameter for the actual number of solutions found\n"; |
| 357 | - strs += " solutions:uint64_t类型的数组,指向一块num_var * top_num的内存,算法将可行解放入该空间\n"; | 357 | + strs += |
| 358 | - strs += "Run函数可以使用下述函数辅助求解:\n"; | 358 | + " solutions: a uint64_t array pointing to num_var * top_num elements where the algorithm stores feasible " |
| 359 | + "solutions\n"; | ||
| 360 | + strs += "The Run function can use the following helper functions:\n"; | ||
| 359 | strs += " bool CheckValid()\n"; | 361 | strs += " bool CheckValid()\n"; |
| 360 | - strs += " 用于检测当前解是否为可行解\n"; | 362 | + strs += " Checks whether the current solution is feasible\n"; |
| 361 | strs += " bool UpdateCurVarVal(uint64_t value, int32_t idx)\n"; | 363 | strs += " bool UpdateCurVarVal(uint64_t value, int32_t idx)\n"; |
| 362 | - strs += " 将下标为idx的待求解变量改为value,同时更新cons_info_->leqs中的值\n"; | 364 | + strs += " Sets the variable at index idx to value and updates cons_info_->leqs\n"; |
| 363 | strs += " bool RecordBestVarVal()\n"; | 365 | strs += " bool RecordBestVarVal()\n"; |
| 364 | - strs += " 待求解变量的当前值所对应的目标函数寻优\n"; | 366 | + strs += " Optimizes the objective function for the current variable values\n"; |
| 365 | - strs += "Run函数可以使用下述参数辅助求解:\n"; | 367 | + strs += "The Run function can use the following parameters:\n"; |
| 366 | - strs += " cons_info_->leqs, double类型的数组, 用于记录不等式约束的函数值, 其下标含义如下:\n"; | 368 | + strs += |
| 369 | + " cons_info_->leqs, a double array storing inequality constraint values; its indices are defined as follows:\n"; | ||
| 367 | for (size_t j = 0u; j < leqs_.size(); j++) { | 370 | for (size_t j = 0u; j < leqs_.size(); j++) { |
| 368 | strs += " cons_info_->leqs[" + std::to_string(j) + "] = " + Str(leqs_[j]) + "\n"; | 371 | strs += " cons_info_->leqs[" + std::to_string(j) + "] = " + Str(leqs_[j]) + "\n"; |
| 369 | } | 372 | } |
| 370 | - strs += " var_info_->cur_vars, uint64_t类型的数组, 用于记录待求解变量的当前值, 其下标含义如下:\n"; | 373 | + strs += |
| 374 | + " var_info_->cur_vars, a uint64_t array storing current variable values; its indices are defined as follows:\n"; | ||
| 371 | for (size_t j = 0u; j < search_args_.size(); j++) { | 375 | for (size_t j = 0u; j < search_args_.size(); j++) { |
| 372 | if (fixed_args_.find(j) != fixed_args_.end()) { | 376 | if (fixed_args_.find(j) != fixed_args_.end()) { |
| 373 | strs += " var_info_->cur_vars[" + std::to_string(idx++) + "] = " + Str(search_args_[j]) + "\n"; | 377 | strs += " var_info_->cur_vars[" + std::to_string(idx++) + "] = " + Str(search_args_[j]) + "\n"; |
| 374 | } | 378 | } |
| 375 | } | 379 | } |
| 376 | - strs += " var_info_->upper_bound, uint64_t类型的数组, 用于记录待求解变量的上界\n"; | 380 | + strs += " var_info_->upper_bound, a uint64_t array storing upper bounds for the variables\n"; |
| 377 | - strs += " var_info_->lower_bound, uint64_t类型的数组, 用于记录待求解变量的下界\n"; | 381 | + strs += " var_info_->lower_bound, a uint64_t array storing lower bounds for the variables\n"; |
| 378 | return AddAnotationBlock(strs); | 382 | return AddAnotationBlock(strs); |
| 379 | } | 383 | } |
| 380 | 384 | ||
| @@ -440,11 +444,11 @@ bool GeneralSolverGen::GenBuffFunc() { | |||
| 440 | std::string strs; | 444 | std::string strs; |
| 441 | for (const auto &pair : buffer_cost_) { | 445 | for (const auto &pair : buffer_cost_) { |
| 442 | strs = ""; | 446 | strs = ""; |
| 443 | - strs += "函数名:Get" + pair.first + "Cost(重要函数)\n"; | 447 | + strs += "Function: Get" + pair.first + "Cost(important)\n"; |
| 444 | - strs += "功能描述:\n"; | 448 | + strs += "Description:\n"; |
| 445 | - strs += " 根据待求解变量值" + pair.first + "缓存占用信息(occupy-buff)\n"; | 449 | + strs += " Gets cache occupancy information (occupy-buff) from " + pair.first + "\n"; |
| 446 | - strs += "输入参数:\n"; | 450 | + strs += "Input parameters:\n"; |
| 447 | - strs += " vars:一个长度为num_var的数组,对应了待求解变量\n"; | 451 | + strs += " vars:an array of length num_var corresponding to the variables\n"; |
| 448 | impl_codes_ += AddAnotationBlock(strs); | 452 | impl_codes_ += AddAnotationBlock(strs); |
| 449 | impl_codes_ += "inline double GeneralSolver"; | 453 | impl_codes_ += "inline double GeneralSolver"; |
| 450 | impl_codes_ += tiling_case_id_; | 454 | impl_codes_ += tiling_case_id_; |
| @@ -456,12 +460,12 @@ bool GeneralSolverGen::GenBuffFunc() { | |||
| 456 | impl_codes_ += "\n"; | 460 | impl_codes_ += "\n"; |
| 457 | 461 | ||
| 458 | strs = ""; | 462 | strs = ""; |
| 459 | - strs += "函数名:GetSmooth" + pair.first + "Cost(重要函数)\n"; | 463 | + strs += "Function: GetSmooth" + pair.first + "Cost(important)\n"; |
| 460 | - strs += "功能描述:\n"; | 464 | + strs += "Description:\n"; |
| 461 | - strs += " 根据待求解变量值" + pair.first + "的平滑化缓存占用信息\n"; | 465 | + strs += " Gets smoothed cache occupancy information from " + pair.first + "\n"; |
| 462 | - strs += " 与Get" + pair.first + "Cost函数相比,整除运算被替换为浮点数的除法运算\n"; | 466 | + strs += " Compared with Get" + pair.first + "Cost, integer division is replaced with floating-point division\n"; |
| 463 | - strs += "输入参数:\n"; | 467 | + strs += "Input parameters:\n"; |
| 464 | - strs += " vars:一个长度为num_var的数组,对应了待求解变量\n"; | 468 | + strs += " vars:an array of length num_var corresponding to the variables\n"; |
| 465 | impl_codes_ += AddAnotationBlock(strs); | 469 | impl_codes_ += AddAnotationBlock(strs); |
| 466 | impl_codes_ += "inline double GeneralSolver"; | 470 | impl_codes_ += "inline double GeneralSolver"; |
| 467 | impl_codes_ += tiling_case_id_; | 471 | impl_codes_ += tiling_case_id_; |
| @@ -498,18 +502,18 @@ bool GeneralSolverGen::GenBuffExpr() { | |||
| 498 | std::string GeneralSolverGen::GenAnnotation(FuncType func_type) const { | 502 | std::string GeneralSolverGen::GenAnnotation(FuncType func_type) const { |
| 499 | std::string strs = ""; | 503 | std::string strs = ""; |
| 500 | if (func_type == FuncType::OBJ) { | 504 | if (func_type == FuncType::OBJ) { |
| 501 | - strs += "函数名:GetObj(重要函数)\n"; | 505 | + strs += "Function: GetObj(important)\n"; |
| 502 | - strs += "功能描述:\n"; | 506 | + strs += "Description:\n"; |
| 503 | - strs += " 根据待求解变量值输出目标函数\n"; | 507 | + strs += " Outputs the objective function for the variable values\n"; |
| 504 | - strs += "输入参数:\n"; | 508 | + strs += "Input parameters:\n"; |
| 505 | - strs += " vars:一个长度为num_var的数组,对应了待求解变量\n"; | 509 | + strs += " vars:an array of length num_var corresponding to the variables\n"; |
| 506 | } else if (func_type == FuncType::BUFFER) { | 510 | } else if (func_type == FuncType::BUFFER) { |
| 507 | - strs += "函数名:GetBuffCost(重要函数)\n"; | 511 | + strs += "Function: GetBuffCost(important)\n"; |
| 508 | - strs += "功能描述:\n"; | 512 | + strs += "Description:\n"; |
| 509 | - strs += " 根据待求解变量值输出缓存占用信息的罚函数(sigma(min(0, occupy-buff)^2))\n"; | 513 | + strs += " Outputs the cache occupancy penalty function (sigma(min(0, occupy-buff)^2))\n"; |
| 510 | - strs += " 该函数用于量化解在缓存占用方面的质量\n"; | 514 | + strs += " Quantifies solution quality in terms of cache occupancy\n"; |
| 511 | - strs += "输入参数:\n"; | 515 | + strs += "Input parameters:\n"; |
| 512 | - strs += " vars:一个长度为num_var的数组,对应了待求解变量\n"; | 516 | + strs += " vars:an array of length num_var corresponding to the variables\n"; |
| 513 | } | 517 | } |
| 514 | return AddAnotationBlock(strs); | 518 | return AddAnotationBlock(strs); |
| 515 | } | 519 | } |
| @@ -564,10 +568,10 @@ bool GeneralSolverGen::GenGetSmoothObj() { | |||
| 564 | std::string strs = ""; | 568 | std::string strs = ""; |
| 565 | std::string pipe_strs = ""; | 569 | std::string pipe_strs = ""; |
| 566 | std::vector<Expr> related_expr; | 570 | std::vector<Expr> related_expr; |
| 567 | - strs += "函数名:GetSmoothObj(重要函数)\n"; | 571 | + strs += "Function: GetSmoothObj(important)\n"; |
| 568 | - strs += "功能描述:\n"; | 572 | + strs += "Description:\n"; |
| 569 | - strs += " 根据待求解变量值输出平滑化目标函数\n"; | 573 | + strs += " Outputs the smoothed objective function for the variable values\n"; |
| 570 | - strs += " 与GetObj函数相比,整除运算被替换为浮点数的除法运算\n"; | 574 | + strs += " Compared with GetObj, integer division is replaced with floating-point division\n"; |
| 571 | impl_codes_ += AddAnotationBlock(strs); | 575 | impl_codes_ += AddAnotationBlock(strs); |
| 572 | impl_codes_ += "inline double GeneralSolver"; | 576 | impl_codes_ += "inline double GeneralSolver"; |
| 573 | impl_codes_ += tiling_case_id_; | 577 | impl_codes_ += tiling_case_id_; |
| @@ -601,25 +605,31 @@ bool GeneralSolverGen::GenGetSmoothObj() { | |||
| 601 | std::string GeneralSolverGen::GenDiffAnnotation(FuncType func_type) const { | 605 | std::string GeneralSolverGen::GenDiffAnnotation(FuncType func_type) const { |
| 602 | std::string strs = ""; | 606 | std::string strs = ""; |
| 603 | if (func_type == FuncType::BUFFER) { | 607 | if (func_type == FuncType::BUFFER) { |
| 604 | - strs += "函数名:GetBuffDiff(重要函数)\n"; | 608 | + strs += "Function: GetBuffDiff(important)\n"; |
| 605 | - strs += "功能描述:\n"; | 609 | + strs += "Description:\n"; |
| 606 | - strs += " 获取缓冲占用加权差分值,计算平滑缓冲占用的差分\n"; | 610 | + strs += " Gets the weighted cache occupancy difference for smooth cache occupancy\n"; |
| 607 | - strs += " 输出的计算公式为sigma_j(delta_{var_i}(g_j(var))) * g_j(var))\n"; | 611 | + strs += " The formula is sigma_j(delta_{var_i}(g_j(var))) * g_j(var))\n"; |
| 608 | - strs += " 其中g_j为第j个缓冲占用不等式,delta_{var_i}(g_j(var))为g_j(var)沿var_i方向更新一个单位后的变化值\n"; | 612 | + strs += |
| 609 | - strs += " 该函数用于确定变量沿缓冲占用增大的更新方向\n"; | 613 | + " where g_j is the j-th cache occupancy inequality, and delta_{var_i}(g_j(var)) is the change in g_j(var) " |
| 610 | - strs += "输入参数:\n"; | 614 | + "when var_i increases by one unit\n"; |
| 611 | - strs += " vars:一个长度为num_var的数组,对应了待求解变量\n"; | 615 | + strs += " Determines the update direction that increases cache occupancy\n"; |
| 612 | - strs += " weight:一个长度为num_leq的数组,代表了每个缓冲占用的权值\n"; | 616 | + strs += "Input parameters:\n"; |
| 617 | + strs += " vars:an array of length num_var corresponding to the variables\n"; | ||
| 618 | + strs += " weight:an array of length num_leq representing the weight of each cache occupancy\n"; | ||
| 613 | } else if (func_type == FuncType::LEQ) { | 619 | } else if (func_type == FuncType::LEQ) { |
| 614 | - strs += "函数名:GetLeqDiff(重要函数)\n"; | 620 | + strs += "Function: GetLeqDiff(important)\n"; |
| 615 | - strs += "功能描述:\n"; | 621 | + strs += "Description:\n"; |
| 616 | - strs += " 获取不等式约束的加权差分值,计算平滑的不等式函数的差分,权值为实际不等式函数值\n"; | 622 | + strs += |
| 617 | - strs += " 输出的计算公式为sigma_j(delta_{var_i}(f_j(var))) * f_j(var))\n"; | 623 | + " Gets the weighted difference of inequality constraints; the weight is the actual inequality function " |
| 618 | - strs += " 其中f_j为第j个不等式约束式,delta_{var_i}(f_j(var))为f_j(var)沿var_i方向更新一个单位后的变化值\n"; | 624 | + "value\n"; |
| 619 | - strs += " 该函数用于确定变量从可行域外侧沿不等式边界方向移动的更新方向\n"; | 625 | + strs += " The formula is sigma_j(delta_{var_i}(f_j(var))) * f_j(var))\n"; |
| 620 | - strs += "输入参数:\n"; | 626 | + strs += |
| 621 | - strs += " vars:一个长度为num_var的数组,对应了待求解变量\n"; | 627 | + " where f_j is the j-th inequality constraint, and delta_{var_i}(f_j(var)) is the change in f_j(var) when " |
| 622 | - strs += " weight:一个长度为num_leq的数组,代表了每个缓冲占用的权值\n"; | 628 | + "var_i increases by one unit\n"; |
| 629 | + strs += " Determines the update direction from outside the feasible region toward the inequality boundary\n"; | ||
| 630 | + strs += "Input parameters:\n"; | ||
| 631 | + strs += " vars:an array of length num_var corresponding to the variables\n"; | ||
| 632 | + strs += " weight:an array of length num_leq representing the weight of each cache occupancy\n"; | ||
| 623 | } | 633 | } |
| 624 | return AddAnotationBlock(strs); | 634 | return AddAnotationBlock(strs); |
| 625 | } | 635 | } |
| @@ -871,13 +881,15 @@ std::string GeneralSolverGen::InitiateValue() { | |||
| 871 | } | 881 | } |
| 872 | } | 882 | } |
| 873 | codes += AddAnotationLine( | 883 | codes += AddAnotationLine( |
| 874 | - "可修改参数:待求解变量的上界,过大的上界将导致搜索范围与耗时增加,过小的上界更有可能获得较差的局部最优解\n", | 884 | + "Configurable:Variable upper bounds; overly large bounds increase search range and time, while overly small " |
| 885 | + "bounds may produce a worse local optimum\n", | ||
| 875 | " "); | 886 | " "); |
| 876 | for (size_t i = 0u; i < upper_expr.size(); i++) { | 887 | for (size_t i = 0u; i < upper_expr.size(); i++) { |
| 877 | codes += " uint_space[" + std::to_string(i) + "] = " + upper_expr[i] + ";\n"; | 888 | codes += " uint_space[" + std::to_string(i) + "] = " + upper_expr[i] + ";\n"; |
| 878 | } | 889 | } |
| 879 | codes += AddAnotationLine( | 890 | codes += AddAnotationLine( |
| 880 | - "可修改参数:待求解变量的下界,过小的下界将导致搜索范围与耗时增加,过大的下界更有可能获得较差的局部最优解\n", | 891 | + "Configurable:Variable lower bounds; overly small bounds increase search range and time, while overly large " |
| 892 | + "bounds may produce a worse local optimum\n", | ||
| 881 | " "); | 893 | " "); |
| 882 | for (size_t i = 0u; i < lower_expr.size(); i++) { | 894 | for (size_t i = 0u; i < lower_expr.size(); i++) { |
| 883 | codes += " uint_space[" + std::to_string(i + upper_expr.size()) + "] = " + lower_expr[i] + ";\n"; | 895 | codes += " uint_space[" + std::to_string(i + upper_expr.size()) + "] = " + lower_expr[i] + ";\n"; |
| @@ -889,7 +901,8 @@ std::string GeneralSolverGen::InitiateValue() { | |||
| 889 | codes += " }\n"; | 901 | codes += " }\n"; |
| 890 | } | 902 | } |
| 891 | } | 903 | } |
| 892 | - codes += AddAnotationLine("可修改参数:待求解变量的初始值,算法趋向于求初始值附近的局部最优解\n", " "); | 904 | + codes += AddAnotationLine( |
| 905 | + "Configurable:Initial variable values; the algorithm tends to find a local optimum near them\n", " "); | ||
| 893 | for (size_t i = 0u; i < init_expr.size(); i++) { | 906 | for (size_t i = 0u; i < init_expr.size(); i++) { |
| 894 | codes += " uint_space[" + std::to_string(i + init_offset * upper_expr.size()) + "] = " + init_expr[i] + ";\n"; | 907 | codes += " uint_space[" + std::to_string(i + init_offset * upper_expr.size()) + "] = " + init_expr[i] + ";\n"; |
| 895 | } | 908 | } |
| @@ -899,7 +912,8 @@ std::string GeneralSolverGen::InitiateValue() { | |||
| 899 | if (open_dt_ && !training_) { | 912 | if (open_dt_ && !training_) { |
| 900 | codes += GenDTInit(); | 913 | codes += GenDTInit(); |
| 901 | } | 914 | } |
| 902 | - codes += AddAnotationLine("可修改参数:最后更新的待求解变量,设置为true的对应变量会更接近初始值\n", " "); | 915 | + codes += AddAnotationLine( |
| 916 | + "Configurable:Last updated variables; variables set to true stay closer to their initial values\n", " "); | ||
| 903 | for (size_t i = 0u; i < update_last.size(); i++) { | 917 | for (size_t i = 0u; i < update_last.size(); i++) { |
| 904 | codes += " bool_space[" + std::to_string(i) + "] = " + update_last[i] + ";\n"; | 918 | codes += " bool_space[" + std::to_string(i) + "] = " + update_last[i] + ";\n"; |
| 905 | } | 919 | } |
| @@ -1019,13 +1033,13 @@ bool GeneralSolverGen::CreateInput() { | |||
| 1019 | std::string add_log; | 1033 | std::string add_log; |
| 1020 | std::string arg_name; | 1034 | std::string arg_name; |
| 1021 | std::string search_arg_str; | 1035 | std::string search_arg_str; |
| 1022 | - invoke_codes_ += AddAnotationLine("以下参数若未注明是可修改参数,则不建议修改\n", " "); | 1036 | + invoke_codes_ += AddAnotationLine("Do not modify parameters unless marked as configurable\n", " "); |
| 1023 | invoke_codes_ += InitiateDefInputs(); | 1037 | invoke_codes_ += InitiateDefInputs(); |
| 1024 | invoke_codes_ += InitiateDefArgs(hardware_args_); | 1038 | invoke_codes_ += InitiateDefArgs(hardware_args_); |
| 1025 | invoke_codes_ += InitiateDefArgs(solved_args_); | 1039 | invoke_codes_ += InitiateDefArgs(solved_args_); |
| 1026 | - invoke_codes_ += AddAnotationLine("由modelinfo传入的待求解变量个数\n", " "); | 1040 | + invoke_codes_ += AddAnotationLine("Number of variables passed from modelinfo\n", " "); |
| 1027 | invoke_codes_ += " int32_t num_var = " + std::to_string(search_args_.size() - fixed_args_.size()) + ";\n"; | 1041 | invoke_codes_ += " int32_t num_var = " + std::to_string(search_args_.size() - fixed_args_.size()) + ";\n"; |
| 1028 | - invoke_codes_ += AddAnotationLine("由modelinfo传入的不等式约束个数\n", " "); | 1042 | + invoke_codes_ += AddAnotationLine("Number of inequality constraints passed from modelinfo\n", " "); |
| 1029 | invoke_codes_ += " int32_t num_leq = " + std::to_string(leqs_.size()) + ";\n"; | 1043 | invoke_codes_ += " int32_t num_leq = " + std::to_string(leqs_.size()) + ";\n"; |
| 1030 | for (size_t i = 0u; i < search_args_.size(); i++) { | 1044 | for (size_t i = 0u; i < search_args_.size(); i++) { |
| 1031 | if (IsValid(search_args_[i])) { | 1045 | if (IsValid(search_args_[i])) { |
| @@ -1041,10 +1055,10 @@ bool GeneralSolverGen::CreateInput() { | |||
| 1041 | } | 1055 | } |
| 1042 | invoke_codes_ += " OP_LOGD(OP_NAME, \"The number of variable is %d(" + search_arg_str + | 1056 | invoke_codes_ += " OP_LOGD(OP_NAME, \"The number of variable is %d(" + search_arg_str + |
| 1043 | "), the number of constraints is %d.\", num_var, num_leq);\n"; | 1057 | "), the number of constraints is %d.\", num_var, num_leq);\n"; |
| 1044 | - invoke_codes_ += AddAnotationLine("初始化解的个数为0\n", " "); | 1058 | + invoke_codes_ += AddAnotationLine("Initialize the number of solutions to 0\n", " "); |
| 1045 | invoke_codes_ += " int32_t solution_num = 0;\n"; | 1059 | invoke_codes_ += " int32_t solution_num = 0;\n"; |
| 1046 | invoke_codes_ += GenMemoryPool(); | 1060 | invoke_codes_ += GenMemoryPool(); |
| 1047 | - invoke_codes_ += AddAnotationLine("通用求解器的输入参数\n", " "); | 1061 | + invoke_codes_ += AddAnotationLine("Generic solver input parameters\n", " "); |
| 1048 | invoke_codes_ += " SolverInput input;\n"; | 1062 | invoke_codes_ += " SolverInput input;\n"; |
| 1049 | invoke_codes_ += " input.corenum = corenum_;\n"; | 1063 | invoke_codes_ += " input.corenum = corenum_;\n"; |
| 1050 | invoke_codes_ += " input.var_info = var_info;\n"; | 1064 | invoke_codes_ += " input.var_info = var_info;\n"; |
| @@ -1063,10 +1077,10 @@ bool GeneralSolverGen::RunSolver(bool is_dt) { | |||
| 1063 | " std::shared_ptr<" + class_name + "> solver = std::make_shared<" + class_name + ">(cfg, tiling_data);\n"; | 1077 | " std::shared_ptr<" + class_name + "> solver = std::make_shared<" + class_name + ">(cfg, tiling_data);\n"; |
| 1064 | 1078 | ||
| 1065 | invoke_codes_ += " if (solver != nullptr) {\n"; | 1079 | invoke_codes_ += " if (solver != nullptr) {\n"; |
| 1066 | - invoke_codes_ += AddAnotationLine("导入通用求解器的输入参数并完成初始化\n", " "); | 1080 | + invoke_codes_ += AddAnotationLine("Import and initialize generic solver input parameters\n", " "); |
| 1067 | invoke_codes_ += " OP_LOGD(OP_NAME, \"Start initializing the input.\");\n"; | 1081 | invoke_codes_ += " OP_LOGD(OP_NAME, \"Start initializing the input.\");\n"; |
| 1068 | invoke_codes_ += " if (solver -> Init(input)) {\n"; | 1082 | invoke_codes_ += " if (solver -> Init(input)) {\n"; |
| 1069 | - invoke_codes_ += AddAnotationLine("运行通用求解器并获取算法的解\n", " "); | 1083 | + invoke_codes_ += AddAnotationLine("Run the generic solver and obtain algorithm solutions\n", " "); |
| 1070 | invoke_codes_ += " OP_LOGD(OP_NAME, \"Initialization finished, start running the solver.\");\n"; | 1084 | invoke_codes_ += " OP_LOGD(OP_NAME, \"Initialization finished, start running the solver.\");\n"; |
| 1071 | invoke_codes_ += " if (solver -> Run(solution_num, solution)) {\n"; | 1085 | invoke_codes_ += " if (solver -> Run(solution_num, solution)) {\n"; |
| 1072 | invoke_codes_ += " solver -> GetResult(solution_num, solution, tiling_data);\n"; | 1086 | invoke_codes_ += " solver -> GetResult(solution_num, solution, tiling_data);\n"; |
| @@ -1197,7 +1197,7 @@ bool TilingCodeGenImpl::HitSmallShapePattern(ArgsManager &args_manager) const { | |||
| 1197 | (hardware_cons.find(HardwareDef::L0A) != hardware_cons.end()) || | 1197 | (hardware_cons.find(HardwareDef::L0A) != hardware_cons.end()) || |
| 1198 | (hardware_cons.find(HardwareDef::L0B) != hardware_cons.end()) || | 1198 | (hardware_cons.find(HardwareDef::L0B) != hardware_cons.end()) || |
| 1199 | (hardware_cons.find(HardwareDef::L0C) != hardware_cons.end())) { | 1199 | (hardware_cons.find(HardwareDef::L0C) != hardware_cons.end())) { |
| 1200 | - GELOGD("HitSmallShapePattern: not support this case"); | 1200 | + GELOGD("HitSmallShapePattern: does not support this case"); |
| 1201 | return false; | 1201 | return false; |
| 1202 | } | 1202 | } |
| 1203 | // 如果ub相关变量的原始轴和多核相关变量的原始轴不一致,那么不做优化 | 1203 | // 如果ub相关变量的原始轴和多核相关变量的原始轴不一致,那么不做优化 |
| @@ -295,7 +295,7 @@ af::Status AxesTilingDataGen::AddSplitOuterAxisTailArgs() { | |||
| 295 | SetAxisArgExpr(axis->name, | 295 | SetAxisArgExpr(axis->name, |
| 296 | {TilingDataType::SPLIT_OUTER_AXIS_TAIL_TAIL_SIZE, | 296 | {TilingDataType::SPLIT_OUTER_AXIS_TAIL_TAIL_SIZE, |
| 297 | GetSplitTailPrefix(parent_axis->name, axis).append(kTailSizeSuffix), tail_part_tail_size}), | 297 | GetSplitTailPrefix(parent_axis->name, axis).append(kTailSizeSuffix), tail_part_tail_size}), |
| 298 | - "Set split outer axis tail tail size failed, axis[%s]", axis->name.c_str()); | 298 | + "Set split outer axis tail size failed, axis[%s]", axis->name.c_str()); |
| 299 | // 轴对应的{外轴}Tail{切分类型}{轴}LoopNum = StrCeilDiv({外轴}TailSize / {轴}BaseSize) | 299 | // 轴对应的{外轴}Tail{切分类型}{轴}LoopNum = StrCeilDiv({外轴}TailSize / {轴}BaseSize) |
| 300 | const auto tail_part_loop_num = StrCeilDiv(parent_axis_tail_size.first, axis_base_size_str); | 300 | const auto tail_part_loop_num = StrCeilDiv(parent_axis_tail_size.first, axis_base_size_str); |
| 301 | GE_ASSERT_SUCCESS( | 301 | GE_ASSERT_SUCCESS( |
| @@ -247,7 +247,7 @@ std::vector<std::pair<Expr, Expr>> ConcursiveReplaceVars(const std::map<Expr, Te | |||
| 247 | replace_var = CreateExpr(cur_ternary_op.GetTernaryOpStr().c_str()); | 247 | replace_var = CreateExpr(cur_ternary_op.GetTernaryOpStr().c_str()); |
| 248 | res[cur_var] = replace_var; | 248 | res[cur_var] = replace_var; |
| 249 | replace_vars.emplace_back(std::make_pair(cur_var, replace_var)); | 249 | replace_vars.emplace_back(std::make_pair(cur_var, replace_var)); |
| 250 | - GELOGD("Make concursive replace [%s] -> [%s].", Str(cur_var).c_str(), Str(replace_var).c_str()); | 250 | + GELOGD("Make recursive replace [%s] -> [%s].", Str(cur_var).c_str(), Str(replace_var).c_str()); |
| 251 | replace_stack.pop(); | 251 | replace_stack.pop(); |
| 252 | } | 252 | } |
| 253 | } | 253 | } |
| @@ -257,7 +257,7 @@ std::vector<std::pair<Expr, Expr>> ConcursiveReplaceVars(const std::map<Expr, Te | |||
| 257 | replace_var = CreateExpr(cur_ternary_op.GetTernaryOpStr().c_str()); | 257 | replace_var = CreateExpr(cur_ternary_op.GetTernaryOpStr().c_str()); |
| 258 | res[cur_var] = replace_var; | 258 | res[cur_var] = replace_var; |
| 259 | replace_vars.emplace_back(std::make_pair(cur_var, replace_var)); | 259 | replace_vars.emplace_back(std::make_pair(cur_var, replace_var)); |
| 260 | - GELOGD("Make concursive replace [%s] -> [%s].", Str(cur_var).c_str(), Str(replace_var).c_str()); | 260 | + GELOGD("Make recursive replace [%s] -> [%s].", Str(cur_var).c_str(), Str(replace_var).c_str()); |
| 261 | } | 261 | } |
| 262 | return replace_vars; | 262 | return replace_vars; |
| 263 | } | 263 | } |
| @@ -273,7 +273,7 @@ std::map<Expr, std::vector<Expr>, ExprCmp> ConcursiveRelatedVars( | |||
| 273 | AddRelatedVars(pair.first, pair.second, ternary_ops, res); | 273 | AddRelatedVars(pair.first, pair.second, ternary_ops, res); |
| 274 | } | 274 | } |
| 275 | for (const auto &pair : res) { | 275 | for (const auto &pair : res) { |
| 276 | - GELOGD("Make concursive vars [%s]:{%s}.", Str(pair.first).c_str(), GetVecString(pair.second).c_str()); | 276 | + GELOGD("Make recursive vars [%s]:{%s}.", Str(pair.first).c_str(), GetVecString(pair.second).c_str()); |
| 277 | } | 277 | } |
| 278 | return res; | 278 | return res; |
| 279 | } | 279 | } |
| @@ -181,8 +181,9 @@ Status IsDataTypeSupported(const ascir::ImplGraph &graph) { | |||
| 181 | std::string npu_arch; | 181 | std::string npu_arch; |
| 182 | GE_ASSERT_SUCCESS(ge::PlatformContext::GetInstance().GetCurrentPlatformString(npu_arch)); | 182 | GE_ASSERT_SUCCESS(ge::PlatformContext::GetInstance().GetCurrentPlatformString(npu_arch)); |
| 183 | if (af::ascir::CommonInferDtype(node->GetType(), input_dtypes, output_dtypes, npu_arch) != af::SUCCESS) { | 183 | if (af::ascir::CommonInferDtype(node->GetType(), input_dtypes, output_dtypes, npu_arch) != af::SUCCESS) { |
| 184 | - GELOGE(af::FAILED, "ASCIR(%s) not support dtypes(input dtype:%s, output dtype:%s), node:%s", node->GetTypePtr(), | 184 | + GELOGE(af::FAILED, "ASCIR(%s) does not support dtypes(input dtype:%s, output dtype:%s), node:%s", |
| 185 | - VectorToStr(input_dtypes).c_str(), VectorToStr(output_dtypes).c_str(), node->GetNamePtr()); | 185 | + node->GetTypePtr(), VectorToStr(input_dtypes).c_str(), VectorToStr(output_dtypes).c_str(), |
| 186 | + node->GetNamePtr()); | ||
| 186 | return af::FAILED; | 187 | return af::FAILED; |
| 187 | } | 188 | } |
| 188 | } | 189 | } |
| @@ -87,7 +87,7 @@ ge::Expression ResolveForAtt(const ParamExprProduct &expr) { | |||
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | af::Status ValidateReduceNodeParams(const ReduceNodeParams ¶ms) { | 89 | af::Status ValidateReduceNodeParams(const ReduceNodeParams ¶ms) { |
| 90 | - GE_ASSERT_TRUE(params.canonical_params.valid, "Reduce canonical params is invalid."); | 90 | + GE_ASSERT_TRUE(params.canonical_params.valid, "Reduce canonical params are invalid."); |
| 91 | GE_ASSERT_SUCCESS( | 91 | GE_ASSERT_SUCCESS( |
| 92 | ValidateParamExprProduct(params.exprs.merge_size, params.canonical_params.merge_size, "merge size")); | 92 | ValidateParamExprProduct(params.exprs.merge_size, params.canonical_params.merge_size, "merge size")); |
| 93 | GE_ASSERT_SUCCESS( | 93 | GE_ASSERT_SUCCESS( |
| @@ -797,7 +797,8 @@ bool ParseOpsOperatorInitArgs(PyObject *args, bool support_dynamic_output, const | |||
| 797 | return false; | 797 | return false; |
| 798 | } | 798 | } |
| 799 | if (output_num > std::numeric_limits<uint32_t>::max()) { | 799 | if (output_num > std::numeric_limits<uint32_t>::max()) { |
| 800 | - PyErr_SetString(PyExc_OverflowError, "Dynamic output num is out of range."); | 800 | + PyErr_Format(PyExc_OverflowError, "Dynamic output num %lu is out of range [0, %u].", output_num, |
| 801 | + std::numeric_limits<uint32_t>::max()); | ||
| 801 | return false; | 802 | return false; |
| 802 | } | 803 | } |
| 803 | dynamic_output_num = static_cast<uint32_t>(output_num); | 804 | dynamic_output_num = static_cast<uint32_t>(output_num); |
| @@ -37,6 +37,14 @@ from tbe.tikcpp.get_op_tiling import ( | |||
| 37 | from tbe.common.utils.op_tiling import do_op_tiling | 37 | from tbe.common.utils.op_tiling import do_op_tiling |
| 38 | from tbe.common.context import get_context | 38 | from tbe.common.context import get_context |
| 39 | 39 | ||
| 40 | + | ||
| 41 | +def _log_warning(message, *args): | ||
| 42 | + warning = getattr(logger, "warning", None) | ||
| 43 | + if warning is None: | ||
| 44 | + warning = getattr(logger, "warn") | ||
| 45 | + warning(message, *args) | ||
| 46 | + | ||
| 47 | + | ||
| 40 | PYF_PATH = os.path.dirname(os.path.realpath(__file__)) | 48 | PYF_PATH = os.path.dirname(os.path.realpath(__file__)) |
| 41 | ASCEND_PATH = os.path.join(PYF_PATH, "..", "..", "..") | 49 | ASCEND_PATH = os.path.join(PYF_PATH, "..", "..", "..") |
| 42 | timestamp_list = [] | 50 | timestamp_list = [] |
| @@ -1065,7 +1073,7 @@ def pgo_cleanup_kernel_and_json(pgo_temp_files, config_path=None): | |||
| 1065 | os.remove(item) | 1073 | os.remove(item) |
| 1066 | logger.info("[PGO] cleanup file: %s", item) | 1074 | logger.info("[PGO] cleanup file: %s", item) |
| 1067 | except Exception as e: | 1075 | except Exception as e: |
| 1068 | - logger.warn("[PGO] cleanup file failed: %s, err: %s", item, str(e)) | 1076 | + _log_warning("[PGO] cleanup file failed: %s, err: %s", item, str(e)) |
| 1069 | 1077 | ||
| 1070 | 1078 | ||
| 1071 | def check_dir_permissions(path): | 1079 | def check_dir_permissions(path): |
| @@ -1113,7 +1121,7 @@ def get_replace_kernel_root(): | |||
| 1113 | pattern = r'replace_kernel=([^";]+)' | 1121 | pattern = r'replace_kernel=([^";]+)' |
| 1114 | match = re.search(pattern, autofuse_dfx_flags_env) | 1122 | match = re.search(pattern, autofuse_dfx_flags_env) |
| 1115 | if not match: | 1123 | if not match: |
| 1116 | - logger.info( | 1124 | + _log_warning( |
| 1117 | "match env replace_kernel failed. AUTOFUSE_DFX_FLAGS is %s: ", | 1125 | "match env replace_kernel failed. AUTOFUSE_DFX_FLAGS is %s: ", |
| 1118 | autofuse_dfx_flags_env, | 1126 | autofuse_dfx_flags_env, |
| 1119 | ) | 1127 | ) |
| @@ -1503,7 +1511,7 @@ def asc_pgo_exec(*args, temp_dir, params, op_kernel_src, code_gen): | |||
| 1503 | logger.info(f"[PGO] Start PGO tuning for graph: {graph_name}") | 1511 | logger.info(f"[PGO] Start PGO tuning for graph: {graph_name}") |
| 1504 | mspti_cfg = pgo_get_mspti_config() | 1512 | mspti_cfg = pgo_get_mspti_config() |
| 1505 | if mspti_cfg is None: | 1513 | if mspti_cfg is None: |
| 1506 | - logger.warn("[PGO] libmspti.so not installed, skip pgo tuning") | 1514 | + _log_warning("[PGO] libmspti.so not installed, skip pgo tuning") |
| 1507 | return | 1515 | return |
| 1508 | mspti_dir, mspti_so_list, mspti_link_flags = mspti_cfg | 1516 | mspti_dir, mspti_so_list, mspti_link_flags = mspti_cfg |
| 1509 | 1517 | ||
| @@ -16,6 +16,7 @@ import json | |||
| 16 | import os | 16 | import os |
| 17 | import re | 17 | import re |
| 18 | import sys | 18 | import sys |
| 19 | +import tbe.common.utils.log as logger | ||
| 19 | import shutil | 20 | import shutil |
| 20 | import argparse | 21 | import argparse |
| 21 | import subprocess | 22 | import subprocess |
| @@ -30,6 +31,14 @@ from functools import wraps | |||
| 30 | from typing import List | 31 | from typing import List |
| 31 | from asc_op_compile_base.common.platform.platform_info import get_soc_spec | 32 | from asc_op_compile_base.common.platform.platform_info import get_soc_spec |
| 32 | 33 | ||
| 34 | + | ||
| 35 | +def _log_warning(message, *args): | ||
| 36 | + warning = getattr(logger, "warning", None) | ||
| 37 | + if warning is None: | ||
| 38 | + warning = getattr(logger, "warn") | ||
| 39 | + warning(message, *args) | ||
| 40 | + | ||
| 41 | + | ||
| 33 | PYF_PATH = os.path.dirname(os.path.realpath(__file__)) | 42 | PYF_PATH = os.path.dirname(os.path.realpath(__file__)) |
| 34 | ASCEND_PATH = os.path.join(PYF_PATH, "..", "..", "..") | 43 | ASCEND_PATH = os.path.join(PYF_PATH, "..", "..", "..") |
| 35 | machine = platform.machine() | 44 | machine = platform.machine() |
| @@ -166,7 +175,7 @@ def get_compile_diagnostic_flags(output_file): | |||
| 166 | COMPILE_TRACE_ROOT, | 175 | COMPILE_TRACE_ROOT, |
| 167 | f"{os.path.basename(output_file)}.{uuid.uuid4().hex}.json", | 176 | f"{os.path.basename(output_file)}.{uuid.uuid4().hex}.json", |
| 168 | ) | 177 | ) |
| 169 | - print(f"[CompileTrace] {trace_file}") | 178 | + logger.info("[CompileTrace] %s", trace_file) |
| 170 | return [ | 179 | return [ |
| 171 | "-ftime-report=per-pass", | 180 | "-ftime-report=per-pass", |
| 172 | f"-ftime-trace={trace_file}", | 181 | f"-ftime-trace={trace_file}", |
| @@ -186,7 +195,7 @@ def run_compile_command(cmd: List[str], stage_name): | |||
| 186 | error_msg += f"\nstderr: {result.stderr}" | 195 | error_msg += f"\nstderr: {result.stderr}" |
| 187 | raise CompileError(error_msg) | 196 | raise CompileError(error_msg) |
| 188 | if result.stdout: | 197 | if result.stdout: |
| 189 | - print(f"[{stage_name}] {result.stdout}") | 198 | + logger.info("[%s] %s", stage_name, result.stdout) |
| 190 | 199 | ||
| 191 | 200 | ||
| 192 | def link_shared(target_file, obj_files, link_libraries=None, extra_link_options=None): | 201 | def link_shared(target_file, obj_files, link_libraries=None, extra_link_options=None): |
| @@ -929,10 +938,10 @@ def clean_before_modify(temp_dir): | |||
| 929 | entry_path = os.path.join(temp_dir, entry) | 938 | entry_path = os.path.join(temp_dir, entry) |
| 930 | if os.path.isfile(entry_path): | 939 | if os.path.isfile(entry_path): |
| 931 | os.remove(entry_path) | 940 | os.remove(entry_path) |
| 932 | - print(f"delete file: {entry_path}") | 941 | + logger.info("delete file: %s", entry_path) |
| 933 | elif entry not in keep_dirs: | 942 | elif entry not in keep_dirs: |
| 934 | shutil.rmtree(entry_path) | 943 | shutil.rmtree(entry_path) |
| 935 | - print(f"delete dir: {entry_path}") | 944 | + logger.info("delete dir: %s", entry_path) |
| 936 | os.chdir(src_directory) | 945 | os.chdir(src_directory) |
| 937 | 946 | ||
| 938 | 947 | ||
| @@ -1151,7 +1160,7 @@ def try_static_shape_compile(args: argparse.Namespace, temp_dir, so_path): | |||
| 1151 | lib.AutofuseIsStaticShape.restype = ctypes.c_bool | 1160 | lib.AutofuseIsStaticShape.restype = ctypes.c_bool |
| 1152 | if not bool(lib.AutofuseIsStaticShape()): | 1161 | if not bool(lib.AutofuseIsStaticShape()): |
| 1153 | return False | 1162 | return False |
| 1154 | - print("static shape detected, recompile kernel with const tiling data") | 1163 | + logger.info("static shape detected, recompile kernel with const tiling data") |
| 1155 | static_shape_kernel_proc(args, temp_dir) | 1164 | static_shape_kernel_proc(args, temp_dir) |
| 1156 | with InductorCompileDuration(args, "InitTorchNpu"): | 1165 | with InductorCompileDuration(args, "InitTorchNpu"): |
| 1157 | init_torch_npu_for_const_tiling() | 1166 | init_torch_npu_for_const_tiling() |
| @@ -1205,7 +1214,7 @@ def build_kernel_target(args, tiling_obj_paths, temp_dir): | |||
| 1205 | args.tiling_repr is not None or has_inductor_const_tiling_data(args, temp_dir) | 1214 | args.tiling_repr is not None or has_inductor_const_tiling_data(args, temp_dir) |
| 1206 | ): | 1215 | ): |
| 1207 | if args.tiling_repr is not None: | 1216 | if args.tiling_repr is not None: |
| 1208 | - print("process static shape kernel with tiling_repr") | 1217 | + logger.info("process static shape kernel with tiling_repr") |
| 1209 | static_shape_kernel_proc(args, temp_dir, args.tiling_repr) | 1218 | static_shape_kernel_proc(args, temp_dir, args.tiling_repr) |
| 1210 | 1219 | ||
| 1211 | kernel_obj_path = compile_device_obj(args, temp_dir) | 1220 | kernel_obj_path = compile_device_obj(args, temp_dir) |
| @@ -1252,7 +1261,7 @@ def copy_so_to_output(so_file, args, src_directory): | |||
| 1252 | ) | 1261 | ) |
| 1253 | if os.path.realpath(shared_cv_wrapper_so) != os.path.realpath(wrapper_dst_file): | 1262 | if os.path.realpath(shared_cv_wrapper_so) != os.path.realpath(wrapper_dst_file): |
| 1254 | shutil.copy(shared_cv_wrapper_so, wrapper_dst_file) | 1263 | shutil.copy(shared_cv_wrapper_so, wrapper_dst_file) |
| 1255 | - print(f"copy file {so_file} to {dst_file}") | 1264 | + logger.info("copy file %s to %s", so_file, dst_file) |
| 1256 | os.chdir(src_directory) | 1265 | os.chdir(src_directory) |
| 1257 | 1266 | ||
| 1258 | 1267 | ||
| @@ -1284,7 +1293,7 @@ def build_host_output(args, pch_path=None): | |||
| 1284 | ) | 1293 | ) |
| 1285 | return None | 1294 | return None |
| 1286 | except CompileError as ex: | 1295 | except CompileError as ex: |
| 1287 | - print(f"[PGO] Inductor PGO sidecar build failed, skip PGO: {ex}") | 1296 | + _log_warning("[PGO] Inductor PGO sidecar build failed, skip PGO: %s", ex) |
| 1288 | return so_file | 1297 | return so_file |
| 1289 | 1298 | ||
| 1290 | 1299 | ||
| @@ -1305,10 +1314,10 @@ def validate_artifact_paths(paths, kind): | |||
| 1305 | 1314 | ||
| 1306 | 1315 | ||
| 1307 | def main(args): | 1316 | def main(args): |
| 1308 | - print("compile args:", args) | 1317 | + logger.info("compile args: %s", args) |
| 1309 | src_directory = os.getcwd() | 1318 | src_directory = os.getcwd() |
| 1310 | os.chdir(args.temp_dir) | 1319 | os.chdir(args.temp_dir) |
| 1311 | - print("change work dir:", os.getcwd()) | 1320 | + logger.info("change work dir: %s", os.getcwd()) |
| 1312 | # 原子编译 stage 返回结构化 artifact,避免进程间共享 Python 状态。 | 1321 | # 原子编译 stage 返回结构化 artifact,避免进程间共享 Python 状态。 |
| 1313 | try: | 1322 | try: |
| 1314 | if args.stage == "host": | 1323 | if args.stage == "host": |
| @@ -1363,10 +1372,10 @@ def main(args): | |||
| 1363 | def main_with_except(argv: List[str]): | 1372 | def main_with_except(argv: List[str]): |
| 1364 | """Main process with except exceptions.""" | 1373 | """Main process with except exceptions.""" |
| 1365 | try: | 1374 | try: |
| 1366 | - print("Enter main func") | 1375 | + logger.info("Enter main func") |
| 1367 | return main(argv) | 1376 | return main(argv) |
| 1368 | except argparse.ArgumentError as ex: | 1377 | except argparse.ArgumentError as ex: |
| 1369 | - print(f"error: check arguments error, {ex}") | 1378 | + logger.error("error: check arguments error, %s", ex) |
| 1370 | return False | 1379 | return False |
| 1371 | 1380 | ||
| 1372 | 1381 | ||
| @@ -84,7 +84,7 @@ def _infer_or_set_view(view_holder: ascir.OpsOperatorOutput, axis, size, stride) | |||
| 84 | elif size is not None and stride is None: | 84 | elif size is not None and stride is None: |
| 85 | view_holder.strides = _derive_strides(size) | 85 | view_holder.strides = _derive_strides(size) |
| 86 | elif size is None and stride is not None: | 86 | elif size is None and stride is not None: |
| 87 | - raise ValueError("when stride is given,size must be also given") | 87 | + raise ValueError("when stride is given, size must also be given") |
| 88 | 88 | ||
| 89 | 89 | ||
| 90 | def _generate_op_name(graph: ascir.HintGraph, op_type: str) -> str: | 90 | def _generate_op_name(graph: ascir.HintGraph, op_type: str) -> str: |
| @@ -16,6 +16,15 @@ import time | |||
| 16 | from typing import List | 16 | from typing import List |
| 17 | from autofuse import ascendc_compile | 17 | from autofuse import ascendc_compile |
| 18 | import re | 18 | import re |
| 19 | +import tbe.common.utils.log as logger | ||
| 20 | + | ||
| 21 | + | ||
| 22 | +def _log_warning(message, *args): | ||
| 23 | + warning = getattr(logger, "warning", None) | ||
| 24 | + if warning is None: | ||
| 25 | + warning = getattr(logger, "warn") | ||
| 26 | + warning(message, *args) | ||
| 27 | + | ||
| 19 | 28 | ||
| 20 | HOST_DEFAULT_CXX11_ABI = "-D_GLIBCXX_USE_CXX11_ABI=1" | 29 | HOST_DEFAULT_CXX11_ABI = "-D_GLIBCXX_USE_CXX11_ABI=1" |
| 21 | HOST_CXX11_ABI_PREFIX = "-D_GLIBCXX_USE_CXX11_ABI=" | 30 | HOST_CXX11_ABI_PREFIX = "-D_GLIBCXX_USE_CXX11_ABI=" |
| @@ -130,7 +139,7 @@ def parse_compile_args(argv): | |||
| 130 | # 使用 parse_known_args 容忍上层透传的未声明参数,避免触发 SystemExit 终止编译。 | 139 | # 使用 parse_known_args 容忍上层透传的未声明参数,避免触发 SystemExit 终止编译。 |
| 131 | args, unknown = parser.parse_known_args(argv) | 140 | args, unknown = parser.parse_known_args(argv) |
| 132 | if unknown: | 141 | if unknown: |
| 133 | - print(f"[CompileArgs] ignored unrecognized arguments: {unknown}") | 142 | + logger.info("[CompileArgs] ignored unrecognized arguments: %s", unknown) |
| 134 | return args | 143 | return args |
| 135 | 144 | ||
| 136 | 145 | ||
| @@ -481,7 +490,7 @@ def write_compile_host_sources(sources, args, tiling_def_file, base_host_file): | |||
| 481 | ) | 490 | ) |
| 482 | args.pgo_mspti_config = get_inductor_pgo_mspti_config() | 491 | args.pgo_mspti_config = get_inductor_pgo_mspti_config() |
| 483 | if args.pgo_mspti_config is None: | 492 | if args.pgo_mspti_config is None: |
| 484 | - print("[PGO] MSPTI is unavailable, skip Inductor PGO sidecars") | 493 | + _log_warning("[PGO] MSPTI is unavailable, skip Inductor PGO sidecars") |
| 485 | 494 | ||
| 486 | 495 | ||
| 487 | def write_compile_device_sources(sources, args, tiling_def_file, base_device_file): | 496 | def write_compile_device_sources(sources, args, tiling_def_file, base_device_file): |
| @@ -296,14 +296,14 @@ bool PluginManager::GetRequiredOppAbiVersion(std::vector<std::pair<uint32_t, uin | |||
| 296 | } else if (mmIsDir((model_path + kRuntimePath).c_str()) == EN_OK) { | 296 | } else if (mmIsDir((model_path + kRuntimePath).c_str()) == EN_OK) { |
| 297 | version_path = model_path + kRuntimePath + kVersionInfo; | 297 | version_path = model_path + kRuntimePath + kVersionInfo; |
| 298 | } else { | 298 | } else { |
| 299 | - GELOGW("compiler and runtime not exist"); | 299 | + GELOGW("compiler and runtime do not exist"); |
| 300 | return true; | 300 | return true; |
| 301 | } | 301 | } |
| 302 | GELOGI("extract required opp abi version info from %s", version_path.c_str()); | 302 | GELOGI("extract required opp abi version info from %s", version_path.c_str()); |
| 303 | 303 | ||
| 304 | std::string version; | 304 | std::string version; |
| 305 | if (!PluginManager::GetVersionFromPathWithName(version_path, version, kRequiredOppAbiVersion)) { | 305 | if (!PluginManager::GetVersionFromPathWithName(version_path, version, kRequiredOppAbiVersion)) { |
| 306 | - GELOGW("Not get required_opp_abi_version from path:%s", version_path.c_str()); | 306 | + GELOGW("Failed to get required_opp_abi_version from path:%s", version_path.c_str()); |
| 307 | return true; | 307 | return true; |
| 308 | } | 308 | } |
| 309 | 309 | ||
| @@ -1060,7 +1060,7 @@ void PluginManager::GetCurEnvPackageOsAndCpuType(std::string &host_env_os, std:: | |||
| 1060 | } else if (mmAccess2((model_path + kRuntimePath + kScene).c_str(), M_R_OK) == EN_OK) { | 1060 | } else if (mmAccess2((model_path + kRuntimePath + kScene).c_str(), M_R_OK) == EN_OK) { |
| 1061 | scene = model_path + kRuntimePath + kScene; | 1061 | scene = model_path + kRuntimePath + kScene; |
| 1062 | } else { | 1062 | } else { |
| 1063 | - GELOGW("opp and runtime not exist"); | 1063 | + GELOGW("opp and runtime do not exist"); |
| 1064 | return; | 1064 | return; |
| 1065 | } | 1065 | } |
| 1066 | GELOGI("extract os and cpu info from %s", scene.c_str()); | 1066 | GELOGI("extract os and cpu info from %s", scene.c_str()); |
| @@ -240,7 +240,7 @@ AscendString TypeUtilsImpl::DataTypeToAscendString(const DataType data_type) { | |||
| 240 | if (it != kDataTypeToStringMap.end()) { | 240 | if (it != kDataTypeToStringMap.end()) { |
| 241 | return it->second.c_str(); | 241 | return it->second.c_str(); |
| 242 | } else { | 242 | } else { |
| 243 | - GELOGW("DataTypeToSerialString: datatype not support %d", data_type); | 243 | + GELOGW("DataTypeToSerialString: datatype is not supported %d", data_type); |
| 244 | return "UNDEFINED"; | 244 | return "UNDEFINED"; |
| 245 | } | 245 | } |
| 246 | } | 246 | } |
| @@ -250,7 +250,7 @@ DataType TypeUtilsImpl::AscendStringToDataType(const AscendString &str) { | |||
| 250 | if (it != kStringTodataTypeMap.end()) { | 250 | if (it != kStringTodataTypeMap.end()) { |
| 251 | return it->second; | 251 | return it->second; |
| 252 | } else { | 252 | } else { |
| 253 | - GELOGW("[Check][Param] SerialStringToDataType: datatype not support %s", str.GetString()); | 253 | + GELOGW("[Check][Param] SerialStringToDataType: datatype is not supported %s", str.GetString()); |
| 254 | return DT_UNDEFINED; | 254 | return DT_UNDEFINED; |
| 255 | } | 255 | } |
| 256 | } | 256 | } |
| @@ -263,7 +263,7 @@ AscendString TypeUtilsImpl::FormatToAscendString(const Format format) { | |||
| 263 | } | 263 | } |
| 264 | return it->second.c_str(); | 264 | return it->second.c_str(); |
| 265 | } else { | 265 | } else { |
| 266 | - GELOGW("[Check][Param] Format not support %d", format); | 266 | + GELOGW("[Check][Param] Format is not supported %d", format); |
| 267 | return "RESERVED"; | 267 | return "RESERVED"; |
| 268 | } | 268 | } |
| 269 | } | 269 | } |
| @@ -335,7 +335,7 @@ Format TypeUtilsImpl::AscendStringToFormat(const AscendString &str) { | |||
| 335 | if (it != kStringToFormatMap.end()) { | 335 | if (it != kStringToFormatMap.end()) { |
| 336 | primary_format = it->second; | 336 | primary_format = it->second; |
| 337 | } else { | 337 | } else { |
| 338 | - GELOGW("[Check][Param] Format not support %s", str.GetString()); | 338 | + GELOGW("[Check][Param] Format is not supported %s", str.GetString()); |
| 339 | return FORMAT_RESERVED; | 339 | return FORMAT_RESERVED; |
| 340 | } | 340 | } |
| 341 | return static_cast<Format>(GetFormatFromSub(primary_format, sub_format)); | 341 | return static_cast<Format>(GetFormatFromSub(primary_format, sub_format)); |
| @@ -353,7 +353,7 @@ Format TypeUtilsImpl::DataFormatToFormat(const AscendString &str) { | |||
| 353 | if (it != kDataFormatMap.end()) { | 353 | if (it != kDataFormatMap.end()) { |
| 354 | primary_format = it->second; | 354 | primary_format = it->second; |
| 355 | } else { | 355 | } else { |
| 356 | - GELOGW("[Check][Param] Format not support %s", str.GetString()); | 356 | + GELOGW("[Check][Param] Format is not supported %s", str.GetString()); |
| 357 | return FORMAT_RESERVED; | 357 | return FORMAT_RESERVED; |
| 358 | } | 358 | } |
| 359 | return static_cast<Format>(GetFormatFromSub(primary_format, sub_format)); | 359 | return static_cast<Format>(GetFormatFromSub(primary_format, sub_format)); |
| @@ -371,8 +371,9 @@ bool TypeUtilsImpl::GetDataTypeLength(const ge::DataType data_type, uint32_t &le | |||
| 371 | length = static_cast<uint32_t>(size); | 371 | length = static_cast<uint32_t>(size); |
| 372 | return true; | 372 | return true; |
| 373 | } else { | 373 | } else { |
| 374 | - REPORT_INNER_ERR_MSG("E18888", "data_type not support [%s]", DataTypeToAscendString(data_type).GetString()); | 374 | + REPORT_INNER_ERR_MSG("E18888", "data_type is not supported [%s]", DataTypeToAscendString(data_type).GetString()); |
| 375 | - GELOGE(GRAPH_FAILED, "[Check][Param] data_type not support [%s]", DataTypeToAscendString(data_type).GetString()); | 375 | + GELOGE(GRAPH_FAILED, "[Check][Param] data_type is not supported [%s]", |
| 376 | + DataTypeToAscendString(data_type).GetString()); | ||
| 376 | return false; | 377 | return false; |
| 377 | } | 378 | } |
| 378 | } | 379 | } |
| @@ -145,7 +145,7 @@ af::graphStatus ValidateIrInputOutputOrderCompatibility(const af::OpDescPtr &des | |||
| 145 | // 验证输入顺序兼容性 | 145 | // 验证输入顺序兼容性 |
| 146 | GE_ASSERT_TRUE(ValidateIrOrderCompatibility(ir_inputs_in_node, ir_def.inputs), | 146 | GE_ASSERT_TRUE(ValidateIrOrderCompatibility(ir_inputs_in_node, ir_def.inputs), |
| 147 | "Compatibility failed: operator[%s][%s] input order or type has changed. " | 147 | "Compatibility failed: operator[%s][%s] input order or type has changed. " |
| 148 | - "ir_inputs_in_node is [%s], ir_def.inputs is [%s]", | 148 | + "ir_inputs_in_node are [%s], ir_def.inputs are [%s]", |
| 149 | desc->GetName().c_str(), desc->GetType().c_str(), | 149 | desc->GetName().c_str(), desc->GetType().c_str(), |
| 150 | IrDefsToString<af::RecoverIrUtils::InputIrDefs>(ir_inputs_in_node).c_str(), | 150 | IrDefsToString<af::RecoverIrUtils::InputIrDefs>(ir_inputs_in_node).c_str(), |
| 151 | IrDefsToString<af::RecoverIrUtils::InputIrDefs>(ir_def.inputs).c_str()); | 151 | IrDefsToString<af::RecoverIrUtils::InputIrDefs>(ir_def.inputs).c_str()); |
| @@ -775,7 +775,7 @@ bool ComputeGraphImpl::operator==(const ComputeGraphImpl &r_graph) const { | |||
| 775 | const auto &node_name = left_node->GetName(); | 775 | const auto &node_name = left_node->GetName(); |
| 776 | // After TopologicalSorting, node order can change, so find node by name | 776 | // After TopologicalSorting, node order can change, so find node by name |
| 777 | const auto &right_node = r_graph.FindNode(node_name); | 777 | const auto &right_node = r_graph.FindNode(node_name); |
| 778 | - GE_IF_BOOL_EXEC(right_node == nullptr, REPORT_INNER_ERR_MSG("E18888", "left_node:%s not find in r_graph:%s", | 778 | + GE_IF_BOOL_EXEC(right_node == nullptr, REPORT_INNER_ERR_MSG("E18888", "left_node:%s was not found in r_graph:%s", |
| 779 | node_name.c_str(), r_graph.GetName().c_str()); | 779 | node_name.c_str(), r_graph.GetName().c_str()); |
| 780 | GELOGE(GRAPH_FAILED, "[Check][Param] right_node is NULL!!!"); return false); | 780 | GELOGE(GRAPH_FAILED, "[Check][Param] right_node is NULL!!!"); return false); |
| 781 | if (!((*right_node) == (*left_node))) { | 781 | if (!((*right_node) == (*left_node))) { |
| @@ -840,7 +840,7 @@ graphStatus GNode::SetAttr(const AscendString &name, std::vector<AscendString> & | |||
| 840 | for (auto &attr_val : attr_values) { | 840 | for (auto &attr_val : attr_values) { |
| 841 | const char_t *const ascend_attr_value = attr_val.GetString(); | 841 | const char_t *const ascend_attr_value = attr_val.GetString(); |
| 842 | if (std::string(ascend_attr_value).empty()) { | 842 | if (std::string(ascend_attr_value).empty()) { |
| 843 | - REPORT_INNER_ERR_MSG("E18888", "param attr values is invalid"); | 843 | + REPORT_INNER_ERR_MSG("E18888", "param attr values are invalid"); |
| 844 | GELOGE(GRAPH_PARAM_INVALID, "[Check][Param] SetAttr: attr val error."); | 844 | GELOGE(GRAPH_PARAM_INVALID, "[Check][Param] SetAttr: attr val error."); |
| 845 | return GRAPH_PARAM_INVALID; | 845 | return GRAPH_PARAM_INVALID; |
| 846 | } | 846 | } |
| @@ -1702,7 +1702,7 @@ graphStatus Operator::GetAttr(const std::string &name, std::vector<std::string> | |||
| 1702 | Operator &Operator::SetAttr(const char_t *name, const char_t *attr_value) { | 1702 | Operator &Operator::SetAttr(const char_t *name, const char_t *attr_value) { |
| 1703 | if ((name == nullptr) || (attr_value == nullptr)) { | 1703 | if ((name == nullptr) || (attr_value == nullptr)) { |
| 1704 | REPORT_INNER_ERR_MSG("E18888", "param name is nullptr or attr_value is nullptr, check invalid"); | 1704 | REPORT_INNER_ERR_MSG("E18888", "param name is nullptr or attr_value is nullptr, check invalid"); |
| 1705 | - GELOGE(ge::GRAPH_FAILED, "[Check][Param] Operator input parameters is nullptr."); | 1705 | + GELOGE(ge::GRAPH_FAILED, "[Check][Param] Operator input parameters are nullptr."); |
| 1706 | return *this; | 1706 | return *this; |
| 1707 | } | 1707 | } |
| 1708 | 1708 | ||
| @@ -1721,8 +1721,8 @@ Operator &Operator::SetAttr(const char_t *name, const char_t *attr_value) { | |||
| 1721 | 1721 | ||
| 1722 | Operator &Operator::SetInputAttr(const int32_t index, const char_t *name, const char_t *attr_value) { | 1722 | Operator &Operator::SetInputAttr(const int32_t index, const char_t *name, const char_t *attr_value) { |
| 1723 | if ((name == nullptr) || (attr_value == nullptr)) { | 1723 | if ((name == nullptr) || (attr_value == nullptr)) { |
| 1724 | - REPORT_INNER_ERR_MSG("E18888", "Operator parameters is nullptr, check invalid"); | 1724 | + REPORT_INNER_ERR_MSG("E18888", "Operator parameters are nullptr, check invalid"); |
| 1725 | - GELOGE(ge::GRAPH_FAILED, "[Check][Param] Operator input parameters is nullptr."); | 1725 | + GELOGE(ge::GRAPH_FAILED, "[Check][Param] Operator input parameters are nullptr."); |
| 1726 | return *this; | 1726 | return *this; |
| 1727 | } | 1727 | } |
| 1728 | if ((operator_impl_ == nullptr) || (operator_impl_->GetOpDescImpl() == nullptr)) { | 1728 | if ((operator_impl_ == nullptr) || (operator_impl_->GetOpDescImpl() == nullptr)) { |
| @@ -1746,8 +1746,8 @@ Operator &Operator::SetInputAttr(const int32_t index, const char_t *name, const | |||
| 1746 | 1746 | ||
| 1747 | Operator &Operator::SetInputAttr(const char_t *dst_name, const char_t *name, const char_t *attr_value) { | 1747 | Operator &Operator::SetInputAttr(const char_t *dst_name, const char_t *name, const char_t *attr_value) { |
| 1748 | if ((dst_name == nullptr) || (name == nullptr) || (attr_value == nullptr)) { | 1748 | if ((dst_name == nullptr) || (name == nullptr) || (attr_value == nullptr)) { |
| 1749 | - REPORT_INNER_ERR_MSG("E18888", "Operator parameters is nullptr, check invalid"); | 1749 | + REPORT_INNER_ERR_MSG("E18888", "Operator parameters are nullptr, check invalid"); |
| 1750 | - GELOGE(ge::GRAPH_FAILED, "[Check][Param] Operator input parameters is nullptr."); | 1750 | + GELOGE(ge::GRAPH_FAILED, "[Check][Param] Operator input parameters are nullptr."); |
| 1751 | return *this; | 1751 | return *this; |
| 1752 | } | 1752 | } |
| 1753 | if ((operator_impl_ == nullptr) || (operator_impl_->GetOpDescImpl() == nullptr)) { | 1753 | if ((operator_impl_ == nullptr) || (operator_impl_->GetOpDescImpl() == nullptr)) { |
| @@ -1771,8 +1771,8 @@ Operator &Operator::SetInputAttr(const char_t *dst_name, const char_t *name, con | |||
| 1771 | 1771 | ||
| 1772 | Operator &Operator::SetOutputAttr(const int32_t index, const char_t *name, const char_t *attr_value) { | 1772 | Operator &Operator::SetOutputAttr(const int32_t index, const char_t *name, const char_t *attr_value) { |
| 1773 | if ((name == nullptr) || (attr_value == nullptr)) { | 1773 | if ((name == nullptr) || (attr_value == nullptr)) { |
| 1774 | - REPORT_INNER_ERR_MSG("E18888", "Operator parameters is nullptr, check invalid"); | 1774 | + REPORT_INNER_ERR_MSG("E18888", "Operator parameters are nullptr, check invalid"); |
| 1775 | - GELOGE(ge::GRAPH_FAILED, "[Check][Param] Operator parameters is nullptr."); | 1775 | + GELOGE(ge::GRAPH_FAILED, "[Check][Param] Operator parameters are nullptr."); |
| 1776 | return *this; | 1776 | return *this; |
| 1777 | } | 1777 | } |
| 1778 | if ((operator_impl_ == nullptr) || (operator_impl_->GetOpDescImpl() == nullptr)) { | 1778 | if ((operator_impl_ == nullptr) || (operator_impl_->GetOpDescImpl() == nullptr)) { |
| @@ -1796,8 +1796,8 @@ Operator &Operator::SetOutputAttr(const int32_t index, const char_t *name, const | |||
| 1796 | 1796 | ||
| 1797 | Operator &Operator::SetOutputAttr(const char_t *dst_name, const char_t *name, const char_t *attr_value) { | 1797 | Operator &Operator::SetOutputAttr(const char_t *dst_name, const char_t *name, const char_t *attr_value) { |
| 1798 | if ((dst_name == nullptr) || (name == nullptr) || (attr_value == nullptr)) { | 1798 | if ((dst_name == nullptr) || (name == nullptr) || (attr_value == nullptr)) { |
| 1799 | - REPORT_INNER_ERR_MSG("E18888", "Operator parameters is nullptr, check invalid"); | 1799 | + REPORT_INNER_ERR_MSG("E18888", "Operator parameters are nullptr, check invalid"); |
| 1800 | - GELOGE(ge::GRAPH_FAILED, "[Check][Param] Operator output parameters is nullptr."); | 1800 | + GELOGE(ge::GRAPH_FAILED, "[Check][Param] Operator output parameters are nullptr."); |
| 1801 | return *this; | 1801 | return *this; |
| 1802 | } | 1802 | } |
| 1803 | if ((operator_impl_ == nullptr) || (operator_impl_->GetOpDescImpl() == nullptr)) { | 1803 | if ((operator_impl_ == nullptr) || (operator_impl_->GetOpDescImpl() == nullptr)) { |
| @@ -1822,8 +1822,8 @@ Operator &Operator::SetOutputAttr(const char_t *dst_name, const char_t *name, co | |||
| 1822 | 1822 | ||
| 1823 | Operator &Operator::SetInputAttr(const int32_t index, const char_t *name, const AscendString &attr_value) { | 1823 | Operator &Operator::SetInputAttr(const int32_t index, const char_t *name, const AscendString &attr_value) { |
| 1824 | if ((name == nullptr) || (attr_value.GetString() == nullptr)) { | 1824 | if ((name == nullptr) || (attr_value.GetString() == nullptr)) { |
| 1825 | - REPORT_INNER_ERR_MSG("E18888", "Operator parameters is nullptr, check invalid"); | 1825 | + REPORT_INNER_ERR_MSG("E18888", "Operator parameters are nullptr, check invalid"); |
| 1826 | - GELOGE(ge::GRAPH_FAILED, "[Check][Param] Operator input parameters is nullptr."); | 1826 | + GELOGE(ge::GRAPH_FAILED, "[Check][Param] Operator input parameters are nullptr."); |
| 1827 | return *this; | 1827 | return *this; |
| 1828 | } | 1828 | } |
| 1829 | if ((operator_impl_ == nullptr) || (operator_impl_->GetOpDescImpl() == nullptr)) { | 1829 | if ((operator_impl_ == nullptr) || (operator_impl_->GetOpDescImpl() == nullptr)) { |
| @@ -1847,8 +1847,8 @@ Operator &Operator::SetInputAttr(const int32_t index, const char_t *name, const | |||
| 1847 | 1847 | ||
| 1848 | Operator &Operator::SetInputAttr(const char_t *dst_name, const char_t *name, const AscendString &attr_value) { | 1848 | Operator &Operator::SetInputAttr(const char_t *dst_name, const char_t *name, const AscendString &attr_value) { |
| 1849 | if ((dst_name == nullptr) || (name == nullptr) || (attr_value.GetString() == nullptr)) { | 1849 | if ((dst_name == nullptr) || (name == nullptr) || (attr_value.GetString() == nullptr)) { |
| 1850 | - REPORT_INNER_ERR_MSG("E18888", "Operator parameters is nullptr, check invalid"); | 1850 | + REPORT_INNER_ERR_MSG("E18888", "Operator parameters are nullptr, check invalid"); |
| 1851 | - GELOGE(ge::GRAPH_FAILED, "[Check][Param] Operator input parameters is nullptr."); | 1851 | + GELOGE(ge::GRAPH_FAILED, "[Check][Param] Operator input parameters are nullptr."); |
| 1852 | return *this; | 1852 | return *this; |
| 1853 | } | 1853 | } |
| 1854 | if ((operator_impl_ == nullptr) || (operator_impl_->GetOpDescImpl() == nullptr)) { | 1854 | if ((operator_impl_ == nullptr) || (operator_impl_->GetOpDescImpl() == nullptr)) { |
| @@ -1979,8 +1979,8 @@ graphStatus Operator::GetOutputAttr(const int32_t index, const char_t *name, | |||
| 1979 | 1979 | ||
| 1980 | Operator &Operator::SetOutputAttr(const int32_t index, const char_t *name, const AscendString &attr_value) { | 1980 | Operator &Operator::SetOutputAttr(const int32_t index, const char_t *name, const AscendString &attr_value) { |
| 1981 | if ((name == nullptr) || (attr_value.GetString() == nullptr)) { | 1981 | if ((name == nullptr) || (attr_value.GetString() == nullptr)) { |
| 1982 | - REPORT_INNER_ERR_MSG("E18888", "Operator parameters is nullptr, check invalid"); | 1982 | + REPORT_INNER_ERR_MSG("E18888", "Operator parameters are nullptr, check invalid"); |
| 1983 | - GELOGE(ge::GRAPH_FAILED, "[Check][Param] Operator output parameters is nullptr."); | 1983 | + GELOGE(ge::GRAPH_FAILED, "[Check][Param] Operator output parameters are nullptr."); |
| 1984 | return *this; | 1984 | return *this; |
| 1985 | } | 1985 | } |
| 1986 | if ((operator_impl_ == nullptr) || (operator_impl_->GetOpDescImpl() == nullptr)) { | 1986 | if ((operator_impl_ == nullptr) || (operator_impl_->GetOpDescImpl() == nullptr)) { |
| @@ -2004,8 +2004,8 @@ Operator &Operator::SetOutputAttr(const int32_t index, const char_t *name, const | |||
| 2004 | 2004 | ||
| 2005 | Operator &Operator::SetOutputAttr(const char_t *dst_name, const char_t *name, const AscendString &attr_value) { | 2005 | Operator &Operator::SetOutputAttr(const char_t *dst_name, const char_t *name, const AscendString &attr_value) { |
| 2006 | if ((dst_name == nullptr) || (name == nullptr) || (attr_value.GetString() == nullptr)) { | 2006 | if ((dst_name == nullptr) || (name == nullptr) || (attr_value.GetString() == nullptr)) { |
| 2007 | - REPORT_INNER_ERR_MSG("E18888", "Operator parameters is nullptr, check invalid"); | 2007 | + REPORT_INNER_ERR_MSG("E18888", "Operator parameters are nullptr, check invalid"); |
| 2008 | - GELOGE(ge::GRAPH_FAILED, "[Check][Param] Operator output parameters is nullptr."); | 2008 | + GELOGE(ge::GRAPH_FAILED, "[Check][Param] Operator output parameters are nullptr."); |
| 2009 | return *this; | 2009 | return *this; |
| 2010 | } | 2010 | } |
| 2011 | if ((operator_impl_ == nullptr) || (operator_impl_->GetOpDescImpl() == nullptr)) { | 2011 | if ((operator_impl_ == nullptr) || (operator_impl_->GetOpDescImpl() == nullptr)) { |
| @@ -2029,8 +2029,8 @@ Operator &Operator::SetOutputAttr(const char_t *dst_name, const char_t *name, co | |||
| 2029 | 2029 | ||
| 2030 | graphStatus Operator::GetOutputAttr(const char_t *dst_name, const char_t *name, AscendString &attr_value) const { | 2030 | graphStatus Operator::GetOutputAttr(const char_t *dst_name, const char_t *name, AscendString &attr_value) const { |
| 2031 | if ((dst_name == nullptr) || (name == nullptr)) { | 2031 | if ((dst_name == nullptr) || (name == nullptr)) { |
| 2032 | - REPORT_INNER_ERR_MSG("E18888", "Operator name parameters is nullptr, check invalid"); | 2032 | + REPORT_INNER_ERR_MSG("E18888", "Operator name parameters are nullptr, check invalid"); |
| 2033 | - GELOGE(ge::GRAPH_FAILED, "[Check][Param] Operator output parameters is nullptr."); | 2033 | + GELOGE(ge::GRAPH_FAILED, "[Check][Param] Operator output parameters are nullptr."); |
| 2034 | return ge::GRAPH_FAILED; | 2034 | return ge::GRAPH_FAILED; |
| 2035 | } | 2035 | } |
| 2036 | if ((operator_impl_ == nullptr) || (operator_impl_->GetOpDescImpl() == nullptr)) { | 2036 | if ((operator_impl_ == nullptr) || (operator_impl_->GetOpDescImpl() == nullptr)) { |
| @@ -2057,8 +2057,8 @@ graphStatus Operator::GetOutputAttr(const char_t *dst_name, const char_t *name, | |||
| 2057 | 2057 | ||
| 2058 | graphStatus Operator::GetInputAttr(const char_t *dst_name, const char_t *name, AscendString &attr_value) const { | 2058 | graphStatus Operator::GetInputAttr(const char_t *dst_name, const char_t *name, AscendString &attr_value) const { |
| 2059 | if ((dst_name == nullptr) || (name == nullptr)) { | 2059 | if ((dst_name == nullptr) || (name == nullptr)) { |
| 2060 | - REPORT_INNER_ERR_MSG("E18888", "Operator name parameters is nullptr, check invalid"); | 2060 | + REPORT_INNER_ERR_MSG("E18888", "Operator name parameters are nullptr, check invalid"); |
| 2061 | - GELOGE(ge::GRAPH_FAILED, "[Check][Param] Operator input parameters is nullptr."); | 2061 | + GELOGE(ge::GRAPH_FAILED, "[Check][Param] Operator input parameters are nullptr."); |
| 2062 | return ge::GRAPH_FAILED; | 2062 | return ge::GRAPH_FAILED; |
| 2063 | } | 2063 | } |
| 2064 | if ((operator_impl_ == nullptr) || (operator_impl_->GetOpDescImpl() == nullptr)) { | 2064 | if ((operator_impl_ == nullptr) || (operator_impl_->GetOpDescImpl() == nullptr)) { |
| @@ -2084,8 +2084,8 @@ graphStatus Operator::GetInputAttr(const char_t *dst_name, const char_t *name, A | |||
| 2084 | 2084 | ||
| 2085 | graphStatus Operator::GetInputAttr(const int32_t index, const char_t *name, AscendString &attr_value) const { | 2085 | graphStatus Operator::GetInputAttr(const int32_t index, const char_t *name, AscendString &attr_value) const { |
| 2086 | if (name == nullptr) { | 2086 | if (name == nullptr) { |
| 2087 | - REPORT_INNER_ERR_MSG("E18888", "Operator name parameters is nullptr, check invalid"); | 2087 | + REPORT_INNER_ERR_MSG("E18888", "Operator name parameters are nullptr, check invalid"); |
| 2088 | - GELOGE(ge::GRAPH_FAILED, "[Check][Param] Operator input parameters is nullptr."); | 2088 | + GELOGE(ge::GRAPH_FAILED, "[Check][Param] Operator input parameters are nullptr."); |
| 2089 | return ge::GRAPH_FAILED; | 2089 | return ge::GRAPH_FAILED; |
| 2090 | } | 2090 | } |
| 2091 | if ((operator_impl_ == nullptr) || (operator_impl_->GetOpDescImpl() == nullptr)) { | 2091 | if ((operator_impl_ == nullptr) || (operator_impl_->GetOpDescImpl() == nullptr)) { |
| @@ -2111,8 +2111,8 @@ graphStatus Operator::GetInputAttr(const int32_t index, const char_t *name, Asce | |||
| 2111 | 2111 | ||
| 2112 | graphStatus Operator::GetOutputAttr(const int32_t index, const char_t *name, AscendString &attr_value) const { | 2112 | graphStatus Operator::GetOutputAttr(const int32_t index, const char_t *name, AscendString &attr_value) const { |
| 2113 | if (name == nullptr) { | 2113 | if (name == nullptr) { |
| 2114 | - REPORT_INNER_ERR_MSG("E18888", "Operator parameters is nullptr, check invalid"); | 2114 | + REPORT_INNER_ERR_MSG("E18888", "Operator parameters are nullptr, check invalid"); |
| 2115 | - GELOGE(ge::GRAPH_FAILED, "[Check][Param] Operator output parameters is nullptr."); | 2115 | + GELOGE(ge::GRAPH_FAILED, "[Check][Param] Operator output parameters are nullptr."); |
| 2116 | return ge::GRAPH_FAILED; | 2116 | return ge::GRAPH_FAILED; |
| 2117 | } | 2117 | } |
| 2118 | if ((operator_impl_ == nullptr) || (operator_impl_->GetOpDescImpl() == nullptr)) { | 2118 | if ((operator_impl_ == nullptr) || (operator_impl_->GetOpDescImpl() == nullptr)) { |
| @@ -2138,8 +2138,8 @@ graphStatus Operator::GetOutputAttr(const int32_t index, const char_t *name, Asc | |||
| 2138 | 2138 | ||
| 2139 | Operator &Operator::SetAttr(const char_t *name, const AscendString &attr_value) { | 2139 | Operator &Operator::SetAttr(const char_t *name, const AscendString &attr_value) { |
| 2140 | if ((name == nullptr) || (attr_value.GetString() == nullptr)) { | 2140 | if ((name == nullptr) || (attr_value.GetString() == nullptr)) { |
| 2141 | - REPORT_INNER_ERR_MSG("E18888", "Operator input parameters is nullptr, check invalid"); | 2141 | + REPORT_INNER_ERR_MSG("E18888", "Operator input parameters are nullptr, check invalid"); |
| 2142 | - GELOGE(ge::GRAPH_FAILED, "[Check][Param] Operator input parameters is nullptr."); | 2142 | + GELOGE(ge::GRAPH_FAILED, "[Check][Param] Operator input parameters are nullptr."); |
| 2143 | return *this; | 2143 | return *this; |
| 2144 | } | 2144 | } |
| 2145 | if ((operator_impl_ == nullptr) || (operator_impl_->GetOpDescImpl() == nullptr)) { | 2145 | if ((operator_impl_ == nullptr) || (operator_impl_->GetOpDescImpl() == nullptr)) { |
| @@ -2158,7 +2158,7 @@ Operator &Operator::SetAttr(const char_t *name, const AscendString &attr_value) | |||
| 2158 | graphStatus Operator::GetAttr(const char_t *name, AscendString &attr_value) const { | 2158 | graphStatus Operator::GetAttr(const char_t *name, AscendString &attr_value) const { |
| 2159 | if (name == nullptr) { | 2159 | if (name == nullptr) { |
| 2160 | REPORT_INNER_ERR_MSG("E18888", "Operator input parameters name is nullptr, check invalid"); | 2160 | REPORT_INNER_ERR_MSG("E18888", "Operator input parameters name is nullptr, check invalid"); |
| 2161 | - GELOGE(ge::GRAPH_FAILED, "[Check][Param] Operator input parameters is nullptr."); | 2161 | + GELOGE(ge::GRAPH_FAILED, "[Check][Param] Operator input parameters are nullptr."); |
| 2162 | return ge::GRAPH_FAILED; | 2162 | return ge::GRAPH_FAILED; |
| 2163 | } | 2163 | } |
| 2164 | if ((operator_impl_ == nullptr) || (operator_impl_->GetOpDescImpl() == nullptr)) { | 2164 | if ((operator_impl_ == nullptr) || (operator_impl_->GetOpDescImpl() == nullptr)) { |
| @@ -190,7 +190,7 @@ graphStatus UpdateParentNodeForWhile(const ConstNodePtr &node, std::vector<std:: | |||
| 190 | auto data_shape = tensor.MutableShape(); | 190 | auto data_shape = tensor.MutableShape(); |
| 191 | // input is dynamic, here use dim_num | 191 | // input is dynamic, here use dim_num |
| 192 | if (data_shape.GetDims() != out_shape.GetDims()) { | 192 | if (data_shape.GetDims() != out_shape.GetDims()) { |
| 193 | - GELOGI("After infer, While %s %zu output shape [%s] is not match with input shape [%s].Need infer again.", | 193 | + GELOGI("After infer, While %s %zu output shape [%s] does not match input shape [%s]. Need infer again.", |
| 194 | node->GetName().c_str(), i, out_shape.ToString().c_str(), data_shape.ToString().c_str()); | 194 | node->GetName().c_str(), i, out_shape.ToString().c_str(), data_shape.ToString().c_str()); |
| 195 | if (data_shape.GetDimNum() != out_shape.GetDimNum()) { | 195 | if (data_shape.GetDimNum() != out_shape.GetDimNum()) { |
| 196 | ref_out_tensor.SetUnknownDimNumShape(); | 196 | ref_out_tensor.SetUnknownDimNumShape(); |
| @@ -48,7 +48,7 @@ graphStatus ListValueSerializer::Serialize(const AnyValue &av, GeIrAttrDef &def) | |||
| 48 | 48 | ||
| 49 | const auto iter = type_serializer_map.find(av.GetValueType()); | 49 | const auto iter = type_serializer_map.find(av.GetValueType()); |
| 50 | if (iter == type_serializer_map.end()) { | 50 | if (iter == type_serializer_map.end()) { |
| 51 | - GELOGE(GRAPH_FAILED, "Value type [%d] not support.", static_cast<int32_t>(av.GetValueType())); | 51 | + GELOGE(GRAPH_FAILED, "Value type [%d] is not supported.", static_cast<int32_t>(av.GetValueType())); |
| 52 | return GRAPH_FAILED; | 52 | return GRAPH_FAILED; |
| 53 | } | 53 | } |
| 54 | return iter->second(av, def); | 54 | return iter->second(av, def); |
| @@ -70,7 +70,7 @@ graphStatus ListValueSerializer::Deserialize(const GeIrAttrDef &def, AnyValue &a | |||
| 70 | 70 | ||
| 71 | const auto iter = type_deserializer_map.find(def.list().val_type()); | 71 | const auto iter = type_deserializer_map.find(def.list().val_type()); |
| 72 | if (iter == type_deserializer_map.end()) { | 72 | if (iter == type_deserializer_map.end()) { |
| 73 | - GELOGE(GRAPH_FAILED, "Value type [%d] not support.", static_cast<int32_t>(def.list().val_type())); | 73 | + GELOGE(GRAPH_FAILED, "Value type [%d] is not supported.", static_cast<int32_t>(def.list().val_type())); |
| 74 | return GRAPH_FAILED; | 74 | return GRAPH_FAILED; |
| 75 | } | 75 | } |
| 76 | return iter->second(def, av); | 76 | return iter->second(def, av); |
| @@ -121,7 +121,7 @@ int64_t GetSizeInBytes(int64_t element_count, DataType data_type) { | |||
| 121 | } | 121 | } |
| 122 | uint32_t type_size = 0U; | 122 | uint32_t type_size = 0U; |
| 123 | if (!TypeUtils::GetDataTypeLength(data_type, type_size)) { | 123 | if (!TypeUtils::GetDataTypeLength(data_type, type_size)) { |
| 124 | - GELOGW("[Check][DataType]GetSizeInBytes failed, data_type:%d not support.", data_type); | 124 | + GELOGW("[Check][DataType]GetSizeInBytes failed, data_type:%d is not supported.", data_type); |
| 125 | return -1; | 125 | return -1; |
| 126 | } else if (type_size > kDataTypeSizeBitOffset) { | 126 | } else if (type_size > kDataTypeSizeBitOffset) { |
| 127 | const auto bit_size = type_size - kDataTypeSizeBitOffset; | 127 | const auto bit_size = type_size - kDataTypeSizeBitOffset; |
| @@ -389,7 +389,7 @@ static graphStatus OutputParser(const OpDescPtr &op_desc, const std::string &pat | |||
| 389 | static graphStatus InputDescCalcSize(const OpDescPtr &op_desc, const ArgDesc &arg_desc, size_t &size) { | 389 | static graphStatus InputDescCalcSize(const OpDescPtr &op_desc, const ArgDesc &arg_desc, size_t &size) { |
| 390 | const auto &ir_inputs = op_desc->GetIrInputs(); | 390 | const auto &ir_inputs = op_desc->GetIrInputs(); |
| 391 | GE_ASSERT((arg_desc.ir_idx >= 0 && static_cast<size_t>(arg_desc.ir_idx) < ir_inputs.size()), | 391 | GE_ASSERT((arg_desc.ir_idx >= 0 && static_cast<size_t>(arg_desc.ir_idx) < ir_inputs.size()), |
| 392 | - "ir_index is out of range"); | 392 | + "ir_index [%d] is out of range [0, %zu)", arg_desc.ir_idx, ir_inputs.size()); |
| 393 | auto ir_name = ir_inputs[static_cast<size_t>(arg_desc.ir_idx)].first; | 393 | auto ir_name = ir_inputs[static_cast<size_t>(arg_desc.ir_idx)].first; |
| 394 | if (arg_desc.folded) { | 394 | if (arg_desc.folded) { |
| 395 | size += sizeof(uintptr_t); // pointer to desc | 395 | size += sizeof(uintptr_t); // pointer to desc |
| @@ -117,7 +117,7 @@ bool ConstantUtils::GetPotentialWeight(const OpDescPtr &op_desc, std::vector<uin | |||
| 117 | return false; | 117 | return false; |
| 118 | } | 118 | } |
| 119 | if (weight_indices.size() != weights.size()) { | 119 | if (weight_indices.size() != weights.size()) { |
| 120 | - GELOGW("Weight indices not match with weight size on potential const %s.", op_desc->GetName().c_str()); | 120 | + GELOGW("Weight indices do not match with weight size on potential const %s.", op_desc->GetName().c_str()); |
| 121 | return false; | 121 | return false; |
| 122 | } | 122 | } |
| 123 | return true; | 123 | return true; |
| @@ -135,7 +135,7 @@ bool ConstantUtils::MutablePotentialWeight(const OpDescPtr &op_desc, std::vector | |||
| 135 | return false; | 135 | return false; |
| 136 | } | 136 | } |
| 137 | if (weight_indices.size() != weights.size()) { | 137 | if (weight_indices.size() != weights.size()) { |
| 138 | - GELOGW("Weight indices not match with weight size on potential const %s.", op_desc->GetName().c_str()); | 138 | + GELOGW("Weight indices do not match with weight size on potential const %s.", op_desc->GetName().c_str()); |
| 139 | return false; | 139 | return false; |
| 140 | } | 140 | } |
| 141 | return true; | 141 | return true; |
| @@ -335,8 +335,14 @@ graphStatus FftsGraphUtils::GraphPartition(ComputeGraph &graph, const CalcFunc & | |||
| 335 | GE_CHK_STATUS_RET(Calculate(ffts_plus_graph, calc_func, node_value, graph_value), | 335 | GE_CHK_STATUS_RET(Calculate(ffts_plus_graph, calc_func, node_value, graph_value), |
| 336 | "[Calculate][Value] failed for graph %s", ffts_plus_graph->GetName().c_str()); | 336 | "[Calculate][Value] failed for graph %s", ffts_plus_graph->GetName().c_str()); |
| 337 | if (!IsValueValid(ffts_plus_graph, upper_limit, node_value, graph_value)) { | 337 | if (!IsValueValid(ffts_plus_graph, upper_limit, node_value, graph_value)) { |
| 338 | - REPORT_INNER_ERR_MSG("E18888", "Check value invalid"); | 338 | + REPORT_INNER_ERR_MSG( |
| 339 | - GELOGE(GRAPH_FAILED, "[Check][Value] invalid"); | 339 | + "E18888", |
| 340 | + "Check value is invalid for graph[%s], node_value size[%zu], graph_value size[%zu], upper_limit size[%zu].", | ||
| 341 | + ffts_plus_graph->GetName().c_str(), node_value.size(), graph_value.size(), upper_limit.size()); | ||
| 342 | + GELOGE(GRAPH_FAILED, | ||
| 343 | + "[Check][Value] Value is invalid for graph[%s], node_value size[%zu], graph_value size[%zu], upper_limit " | ||
| 344 | + "size[%zu].", | ||
| 345 | + ffts_plus_graph->GetName().c_str(), node_value.size(), graph_value.size(), upper_limit.size()); | ||
| 340 | return GRAPH_FAILED; | 346 | return GRAPH_FAILED; |
| 341 | } | 347 | } |
| 342 | 348 | ||
| @@ -400,12 +406,12 @@ graphStatus FftsGraphUtils::Calculate(const ComputeGraphPtr &graph, const CalcFu | |||
| 400 | cur_graph_value = cur_node_value; | 406 | cur_graph_value = cur_node_value; |
| 401 | } else if (cur_graph_value.size() != cur_node_value.size()) { | 407 | } else if (cur_graph_value.size() != cur_node_value.size()) { |
| 402 | REPORT_INNER_ERR_MSG("E18888", | 408 | REPORT_INNER_ERR_MSG("E18888", |
| 403 | - "Value size not match, value size of graph %s is %zu, " | 409 | + "Value size does not match, value size of graph %s is %zu, " |
| 404 | "value size of node %s is %zu", | 410 | "value size of node %s is %zu", |
| 405 | graph->GetName().c_str(), cur_graph_value.size(), node->GetName().c_str(), | 411 | graph->GetName().c_str(), cur_graph_value.size(), node->GetName().c_str(), |
| 406 | cur_node_value.size()); | 412 | cur_node_value.size()); |
| 407 | GELOGE(GRAPH_FAILED, | 413 | GELOGE(GRAPH_FAILED, |
| 408 | - "[Check][Param] Value size not match, value size of graph %s is %zu, " | 414 | + "[Check][Param] Value size does not match, value size of graph %s is %zu, " |
| 409 | "value size of node %s is %zu", | 415 | "value size of node %s is %zu", |
| 410 | graph->GetName().c_str(), cur_graph_value.size(), node->GetName().c_str(), cur_node_value.size()); | 416 | graph->GetName().c_str(), cur_graph_value.size(), node->GetName().c_str(), cur_node_value.size()); |
| 411 | return GRAPH_FAILED; | 417 | return GRAPH_FAILED; |
| @@ -449,12 +455,12 @@ std::vector<uint32_t> FftsGraphUtils::Calculate(const NodePtr &node, const CalcF | |||
| 449 | cur_node_value = subgraph_value; | 455 | cur_node_value = subgraph_value; |
| 450 | } else if (cur_node_value.size() != subgraph_value.size()) { | 456 | } else if (cur_node_value.size() != subgraph_value.size()) { |
| 451 | REPORT_INNER_ERR_MSG("E18888", | 457 | REPORT_INNER_ERR_MSG("E18888", |
| 452 | - "Value size not match, value size of node %s is %zu, value size of subgraph %s " | 458 | + "Value size does not match, value size of node %s is %zu, value size of subgraph %s " |
| 453 | "is %zu", | 459 | "is %zu", |
| 454 | node->GetName().c_str(), cur_node_value.size(), subgraph->GetName().c_str(), | 460 | node->GetName().c_str(), cur_node_value.size(), subgraph->GetName().c_str(), |
| 455 | subgraph_value.size()); | 461 | subgraph_value.size()); |
| 456 | GELOGE(GRAPH_FAILED, | 462 | GELOGE(GRAPH_FAILED, |
| 457 | - "[Check][Param] Value size not match, value size of node %s is %zu, " | 463 | + "[Check][Param] Value size does not match, value size of node %s is %zu, " |
| 458 | "value size of subgraph %s is %zu", | 464 | "value size of subgraph %s is %zu", |
| 459 | node->GetName().c_str(), cur_node_value.size(), subgraph->GetName().c_str(), subgraph_value.size()); | 465 | node->GetName().c_str(), cur_node_value.size(), subgraph->GetName().c_str(), subgraph_value.size()); |
| 460 | return {}; | 466 | return {}; |
| @@ -497,8 +503,8 @@ bool FftsGraphUtils::IsValueValid(const ComputeGraphPtr &graph, const std::vecto | |||
| 497 | return pair_item.second.size() != upper_limit.size(); | 503 | return pair_item.second.size() != upper_limit.size(); |
| 498 | }; | 504 | }; |
| 499 | if (std::find_if(node_value.begin(), node_value.end(), is_node_value_match) != node_value.end()) { | 505 | if (std::find_if(node_value.begin(), node_value.end(), is_node_value_match) != node_value.end()) { |
| 500 | - REPORT_INNER_ERR_MSG("E18888", "Node value size not match"); | 506 | + REPORT_INNER_ERR_MSG("E18888", "Node value size does not match"); |
| 501 | - GELOGE(GRAPH_FAILED, "[Check][Param] Node value size not match"); | 507 | + GELOGE(GRAPH_FAILED, "[Check][Param] Node value size does not match"); |
| 502 | return false; | 508 | return false; |
| 503 | } | 509 | } |
| 504 | 510 | ||
| @@ -506,8 +512,8 @@ bool FftsGraphUtils::IsValueValid(const ComputeGraphPtr &graph, const std::vecto | |||
| 506 | return pair_item.second.size() != upper_limit.size(); | 512 | return pair_item.second.size() != upper_limit.size(); |
| 507 | }; | 513 | }; |
| 508 | if (std::find_if(graph_value.begin(), graph_value.end(), is_graph_value_match) != graph_value.end()) { | 514 | if (std::find_if(graph_value.begin(), graph_value.end(), is_graph_value_match) != graph_value.end()) { |
| 509 | - REPORT_INNER_ERR_MSG("E18888", "Graph value size not match"); | 515 | + REPORT_INNER_ERR_MSG("E18888", "Graph value size does not match"); |
| 510 | - GELOGE(GRAPH_FAILED, "[Check][Param] Graph value size not match"); | 516 | + GELOGE(GRAPH_FAILED, "[Check][Param] Graph value size does not match"); |
| 511 | return false; | 517 | return false; |
| 512 | } | 518 | } |
| 513 | 519 | ||
| @@ -100,7 +100,7 @@ onnx::TensorProto_DataType OnnxUtils::EncodeDataType(const DataType data_type) { | |||
| 100 | if (it != kGeDataTypeToOnnxMap.end()) { | 100 | if (it != kGeDataTypeToOnnxMap.end()) { |
| 101 | return it->second; | 101 | return it->second; |
| 102 | } else { | 102 | } else { |
| 103 | - GELOGW("[Encode][DataType] Datatype %u not support", data_type); | 103 | + GELOGW("[Encode][DataType] Datatype %u is not supported", data_type); |
| 104 | return onnx::TensorProto_DataType_UNDEFINED; | 104 | return onnx::TensorProto_DataType_UNDEFINED; |
| 105 | } | 105 | } |
| 106 | } | 106 | } |
| @@ -3509,7 +3509,7 @@ ComputeGraphPtr GraphUtils::BuildSubgraphWithNodes(const ComputeGraphPtr &graph, | |||
| 3509 | ComputeGraphPtr GraphUtils::BuildSubgraphWithNodes(ComputeGraph &graph, const std::set<NodePtr> &nodes, | 3509 | ComputeGraphPtr GraphUtils::BuildSubgraphWithNodes(ComputeGraph &graph, const std::set<NodePtr> &nodes, |
| 3510 | const std::string &subgraph_name) { | 3510 | const std::string &subgraph_name) { |
| 3511 | if (nodes.empty()) { | 3511 | if (nodes.empty()) { |
| 3512 | - GELOGW("nodes is empty, no need to build subgraph"); | 3512 | + GELOGW("nodes are empty, no need to build subgraph"); |
| 3513 | return nullptr; | 3513 | return nullptr; |
| 3514 | } | 3514 | } |
| 3515 | 3515 | ||
| @@ -4908,7 +4908,7 @@ GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY graphStatus GraphUtils::GetSuppor | |||
| 4908 | GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY ComputeGraphPtr | 4908 | GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY ComputeGraphPtr |
| 4909 | GraphUtils::BuildGraphFromNodes(const std::unordered_set<NodePtr> &nodes, const std::string &name) { | 4909 | GraphUtils::BuildGraphFromNodes(const std::unordered_set<NodePtr> &nodes, const std::string &name) { |
| 4910 | if (nodes.empty()) { | 4910 | if (nodes.empty()) { |
| 4911 | - GELOGW("nodes is empty, no need to build subgraph"); | 4911 | + GELOGW("nodes are empty, no need to build subgraph"); |
| 4912 | return nullptr; | 4912 | return nullptr; |
| 4913 | } | 4913 | } |
| 4914 | 4914 | ||
| @@ -319,7 +319,7 @@ GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY bool NodeUtils::ClearInputDesc(co | |||
| 319 | if (iter < op_desc->impl_->inputs_desc_.end()) { | 319 | if (iter < op_desc->impl_->inputs_desc_.end()) { |
| 320 | (void)op_desc->impl_->inputs_desc_.erase(iter); | 320 | (void)op_desc->impl_->inputs_desc_.erase(iter); |
| 321 | } else { | 321 | } else { |
| 322 | - GELOGW("[Clear][InputDesc] inputs_desc_ iterator out of range."); | 322 | + GELOGW("[Clear][InputDesc] index %u is out of range [0, %zu).", index, op_desc->impl_->inputs_desc_.size()); |
| 323 | } | 323 | } |
| 324 | return true; | 324 | return true; |
| 325 | } | 325 | } |
| @@ -338,7 +338,7 @@ GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY bool NodeUtils::ClearOutputDesc(c | |||
| 338 | if (iter < op_desc->impl_->outputs_desc_.end()) { | 338 | if (iter < op_desc->impl_->outputs_desc_.end()) { |
| 339 | (void)op_desc->impl_->outputs_desc_.erase(iter); | 339 | (void)op_desc->impl_->outputs_desc_.erase(iter); |
| 340 | } else { | 340 | } else { |
| 341 | - GELOGW("[Clear][OutputDesc] outputs_desc_ iterator out of range."); | 341 | + GELOGW("[Clear][OutputDesc] index %u is out of range [0, %zu).", index, op_desc->impl_->outputs_desc_.size()); |
| 342 | } | 342 | } |
| 343 | return true; | 343 | return true; |
| 344 | } | 344 | } |
| @@ -1141,7 +1141,7 @@ graphStatus NodeUtils::GetInNodeCrossPartionedCallNode(const NodePtr &node, uint | |||
| 1141 | return GRAPH_SUCCESS; | 1141 | return GRAPH_SUCCESS; |
| 1142 | } | 1142 | } |
| 1143 | // other subgraph(if,while,case) currently not support, return node and warn | 1143 | // other subgraph(if,while,case) currently not support, return node and warn |
| 1144 | - GELOGW("Node [%s] type [%s], real peer in node [%s] type[%s] has subgraph. Current not support.", | 1144 | + GELOGW("Node [%s] type [%s], real peer in node [%s] type[%s] has subgraph. Current operation is not supported.", |
| 1145 | node->GetName().c_str(), node->GetType().c_str(), peer_node->GetName().c_str(), | 1145 | node->GetName().c_str(), node->GetType().c_str(), peer_node->GetName().c_str(), |
| 1146 | peer_node->GetType().c_str()); | 1146 | peer_node->GetType().c_str()); |
| 1147 | 1147 | ||
| @@ -364,7 +364,7 @@ TensorUtils::CheckShapeByShapeRange(const GeShape &shape, const std::vector<std: | |||
| 364 | std::vector<const char *>({std::to_string(shape_range.size()).c_str(), | 364 | std::vector<const char *>({std::to_string(shape_range.size()).c_str(), |
| 365 | std::to_string(shape.GetDimNum()).c_str()})); | 365 | std::to_string(shape.GetDimNum()).c_str()})); |
| 366 | GELOGE(PARAM_INVALID, | 366 | GELOGE(PARAM_INVALID, |
| 367 | - "[Check][Param] Given shape_range dim num [%zu] and current dim num [%zu] are not match. " | 367 | + "[Check][Param] Given shape_range dim num [%zu] and current dim num [%zu] do not match. " |
| 368 | "Please check", | 368 | "Please check", |
| 369 | shape_range.size(), shape.GetDimNum()); | 369 | shape_range.size(), shape.GetDimNum()); |
| 370 | return PARAM_INVALID; | 370 | return PARAM_INVALID; |
| @@ -102,9 +102,9 @@ std::string TypeUtilsInner::ImplyTypeToSerialString(const domi::ImplyType imply_ | |||
| 102 | if (it != kImplyTypeToString.end()) { | 102 | if (it != kImplyTypeToString.end()) { |
| 103 | return it->second; | 103 | return it->second; |
| 104 | } else { | 104 | } else { |
| 105 | - REPORT_INNER_ERR_MSG("E18888", "ImplyTypeToSerialString: imply_type not support %u", | 105 | + REPORT_INNER_ERR_MSG("E18888", "ImplyTypeToSerialString: imply_type is not supported %u", |
| 106 | static_cast<uint32_t>(imply_type)); | 106 | static_cast<uint32_t>(imply_type)); |
| 107 | - GELOGE(GRAPH_FAILED, "[Check][Param] ImplyTypeToSerialString: imply_type not support %u", | 107 | + GELOGE(GRAPH_FAILED, "[Check][Param] ImplyTypeToSerialString: imply_type is not supported %u", |
| 108 | static_cast<uint32_t>(imply_type)); | 108 | static_cast<uint32_t>(imply_type)); |
| 109 | return "UNDEFINED"; | 109 | return "UNDEFINED"; |
| 110 | } | 110 | } |
| @@ -131,7 +131,7 @@ std::string TypeUtilsInner::FmkTypeToSerialString(const domi::FrameworkType fmk_ | |||
| 131 | if (it != kFmkTypeToString.end()) { | 131 | if (it != kFmkTypeToString.end()) { |
| 132 | return it->second; | 132 | return it->second; |
| 133 | } else { | 133 | } else { |
| 134 | - GELOGW("[Util][Serialize] Framework type %d not support.", fmk_type); | 134 | + GELOGW("[Util][Serialize] Framework type %d is not supported.", fmk_type); |
| 135 | return ""; | 135 | return ""; |
| 136 | } | 136 | } |
| 137 | } | 137 | } |
| @@ -34,12 +34,12 @@ bool IsSupportInplace(const af::AscNodePtr &node) { | |||
| 34 | return false; | 34 | return false; |
| 35 | } | 35 | } |
| 36 | // 2. 当前节点如果是多输出,不支持复用(白名单可保证没有多输出节点,但是还是加一个校验) | 36 | // 2. 当前节点如果是多输出,不支持复用(白名单可保证没有多输出节点,但是还是加一个校验) |
| 37 | - GE_WARN_ASSERT(node->GetAllOutDataAnchorsSize() == 1U, "%s[%s] not support output anchor size=%u.", // 单输出 | 37 | + GE_WARN_ASSERT(node->GetAllOutDataAnchorsSize() == 1U, "%s[%s] does not support output anchor size=%u.", // 单输出 |
| 38 | node->GetTypePtr(), node->GetNamePtr(), node->GetAllOutDataAnchorsSize()); | 38 | node->GetTypePtr(), node->GetNamePtr(), node->GetAllOutDataAnchorsSize()); |
| 39 | GE_WARN_ASSERT(node->GetInDataNodesSize() > 0UL, // 多输入 | 39 | GE_WARN_ASSERT(node->GetInDataNodesSize() > 0UL, // 多输入 |
| 40 | - "%s[%s] not support input size=0.", node->GetTypePtr(), node->GetNamePtr()); | 40 | + "%s[%s] does not support input size=0.", node->GetTypePtr(), node->GetNamePtr()); |
| 41 | GE_WARN_ASSERT(node->GetOutDataNodesSize() > 0UL, // 单输出,多引用 | 41 | GE_WARN_ASSERT(node->GetOutDataNodesSize() > 0UL, // 单输出,多引用 |
| 42 | - "%s[%s] not support output size=0.", node->GetTypePtr(), node->GetNamePtr()); | 42 | + "%s[%s] does not support output size=0.", node->GetTypePtr(), node->GetNamePtr()); |
| 43 | 43 | ||
| 44 | // 3. 若节点的任一输入是个单输出多引用,则不支持复用(存在优化空间,当前先不细化 | 44 | // 3. 若节点的任一输入是个单输出多引用,则不支持复用(存在优化空间,当前先不细化 |
| 45 | for (const auto &input_node : node->GetInDataNodes()) { | 45 | for (const auto &input_node : node->GetInDataNodes()) { |
| @@ -121,14 +121,15 @@ Status ScalarBroadcastOptimizationPass::IsNextNodeSupportScalarInput(const NodeV | |||
| 121 | // step5: 若调换的输入已经是scalar,则不支持,结束 | 121 | // step5: 若调换的输入已经是scalar,则不支持,结束 |
| 122 | const int32_t swap_input_index = kSecondInputIndex - static_cast<int32_t>(idx); // 总共2个输入 | 122 | const int32_t swap_input_index = kSecondInputIndex - static_cast<int32_t>(idx); // 总共2个输入 |
| 123 | if (ascgen_utils::IsScalarInput(next_node->inputs[swap_input_index].attr.repeats)) { | 123 | if (ascgen_utils::IsScalarInput(next_node->inputs[swap_input_index].attr.repeats)) { |
| 124 | - GELOGD("The input index 1 of %s[%s] is already scalar, not support swap with %d.", next_node->GetTypePtr(), | 124 | + GELOGD("The input index 1 of %s[%s] is already scalar, so swapping it with %d is not supported.", |
| 125 | - next_node->GetNamePtr(), idx); | 125 | + next_node->GetTypePtr(), next_node->GetNamePtr(), idx); |
| 126 | return af::SUCCESS; // 直接返回, is_supported 为 false | 126 | return af::SUCCESS; // 直接返回, is_supported 为 false |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | // step6: 可以交换顺序,但又不支持全部是Scalar,则不允许输入是相同节点(即输入都是Scalar),结束。 | 129 | // step6: 可以交换顺序,但又不支持全部是Scalar,则不允许输入是相同节点(即输入都是Scalar),结束。 |
| 130 | if (ScheduleUtils::HasSameInput(next_node)) { | 130 | if (ScheduleUtils::HasSameInput(next_node)) { |
| 131 | - GELOGD("Node %s(%s) has same input, not support.", next_node->GetTypePtr(), next_node->GetNamePtr()); | 131 | + GELOGD("Node %s(%s) has the same input, so swapping is not supported.", next_node->GetTypePtr(), |
| 132 | + next_node->GetNamePtr()); | ||
| 132 | return af::SUCCESS; | 133 | return af::SUCCESS; |
| 133 | } | 134 | } |
| 134 | 135 | ||
| @@ -59,7 +59,7 @@ af::Status BrcInlineTemplate::Generate(const af::AscGraph &origin_graph, const a | |||
| 59 | (void)based_case; | 59 | (void)based_case; |
| 60 | int32_t brc_inlined_count = 0; | 60 | int32_t brc_inlined_count = 0; |
| 61 | for (const auto &node : new_case.GetAllNodes()) { | 61 | for (const auto &node : new_case.GetAllNodes()) { |
| 62 | - GE_WARN_ASSERT(!ScheduleUtils::IsReduce(node), "Brc inline not support Reduce(%s) now.", node->GetNamePtr()); | 62 | + GE_WARN_ASSERT(!ScheduleUtils::IsReduce(node), "Brc inline does not support Reduce(%s) now.", node->GetNamePtr()); |
| 63 | if (!af::ops::IsOps<af::ascir_op::Broadcast>(node)) { | 63 | if (!af::ops::IsOps<af::ascir_op::Broadcast>(node)) { |
| 64 | continue; | 64 | continue; |
| 65 | } | 65 | } |
| @@ -160,7 +160,7 @@ class ScheduleUtils { | |||
| 160 | GE_ASSERT_SUCCESS(ge::PlatformContext::GetInstance().GetCurrentPlatformString(npu_arch)); | 160 | GE_ASSERT_SUCCESS(ge::PlatformContext::GetInstance().GetCurrentPlatformString(npu_arch)); |
| 161 | std::vector exp_dtypes{data_type}; | 161 | std::vector exp_dtypes{data_type}; |
| 162 | if (T::InferDataType({data_type}, exp_dtypes, npu_arch) != af::SUCCESS) { | 162 | if (T::InferDataType({data_type}, exp_dtypes, npu_arch) != af::SUCCESS) { |
| 163 | - GELOGD("%s not support dtype=%s", T::Type, af::TypeUtils::DataTypeToSerialString(data_type).c_str()); | 163 | + GELOGD("%s does not support dtype=%s", T::Type, af::TypeUtils::DataTypeToSerialString(data_type).c_str()); |
| 164 | return false; | 164 | return false; |
| 165 | } | 165 | } |
| 166 | return true; | 166 | return true; |
| @@ -179,7 +179,8 @@ af::Status GetBroadcastPhysicalAttr(const af::AscNodePtr &broadcast, ascir::Temp | |||
| 179 | af::Status InlineBroadcastPath(NodePath &path, int64_t path_broadcast_index, ascir::TemplateId template_id) { | 179 | af::Status InlineBroadcastPath(NodePath &path, int64_t path_broadcast_index, ascir::TemplateId template_id) { |
| 180 | GE_ASSERT_TRUE(path_broadcast_index >= 0L, "IndirectLoad Broadcast index is invalid."); | 180 | GE_ASSERT_TRUE(path_broadcast_index >= 0L, "IndirectLoad Broadcast index is invalid."); |
| 181 | const size_t broadcast_index = static_cast<size_t>(path_broadcast_index); | 181 | const size_t broadcast_index = static_cast<size_t>(path_broadcast_index); |
| 182 | - GE_ASSERT_TRUE(broadcast_index < path.size(), "IndirectLoad Broadcast index is out of range."); | 182 | + GE_ASSERT_TRUE(broadcast_index < path.size(), "IndirectLoad Broadcast index %zu is out of range [0, %zu).", |
| 183 | + broadcast_index, path.size()); | ||
| 183 | const af::AscNodePtr broadcast = path[broadcast_index]; | 184 | const af::AscNodePtr broadcast = path[broadcast_index]; |
| 184 | const auto owner_graph = broadcast->GetOwnerComputeGraph(); | 185 | const auto owner_graph = broadcast->GetOwnerComputeGraph(); |
| 185 | GE_ASSERT_NOTNULL(owner_graph); | 186 | GE_ASSERT_NOTNULL(owner_graph); |
| @@ -564,7 +565,9 @@ af::Status ValidateSimdPostReduceLayout(const af::AscNodePtr &indirect_load, con | |||
| 564 | GE_ASSERT_TRUE(axis_index != kIndirectLoadInvalidAxisIndex, "IndirectLoad axis index of node[%s] is invalid.", | 565 | GE_ASSERT_TRUE(axis_index != kIndirectLoadInvalidAxisIndex, "IndirectLoad axis index of node[%s] is invalid.", |
| 565 | indirect_load->GetNamePtr()); | 566 | indirect_load->GetNamePtr()); |
| 566 | const size_t boundary = axis_index; | 567 | const size_t boundary = axis_index; |
| 567 | - GE_ASSERT_TRUE(boundary <= layout.axes.size(), "IndirectLoad axis is out of range for post Reduce output."); | 568 | + GE_ASSERT_TRUE(boundary <= layout.axes.size(), |
| 569 | + "IndirectLoad axis %zu is out of range [0, %zu] for post Reduce output.", boundary, | ||
| 570 | + layout.axes.size()); | ||
| 568 | 571 | ||
| 569 | for (size_t i = 0UL; i < boundary; ++i) { | 572 | for (size_t i = 0UL; i < boundary; ++i) { |
| 570 | if (layout.kinds[i] == ReduceAxisKind::kReduced) { | 573 | if (layout.kinds[i] == ReduceAxisKind::kReduced) { |
| @@ -827,7 +830,8 @@ af::Status BuildSimdInnerAxis(af::AscGraph &graph, const af::AscNodePtr &input_p | |||
| 827 | const char *name, ascir::AxisId &input_inner_axis) { | 830 | const char *name, ascir::AxisId &input_inner_axis) { |
| 828 | GE_ASSERT_TRUE(!input_producer->outputs().empty(), "IndirectLoad SIMD input tensor producer has no output."); | 831 | GE_ASSERT_TRUE(!input_producer->outputs().empty(), "IndirectLoad SIMD input tensor producer has no output."); |
| 829 | const auto input_axes = input_producer->outputs()[0]->attr.axis; | 832 | const auto input_axes = input_producer->outputs()[0]->attr.axis; |
| 830 | - GE_ASSERT_TRUE(axis_index < input_axes.size(), "IndirectLoad SIMD input axis index is out of range."); | 833 | + GE_ASSERT_TRUE(axis_index < input_axes.size(), "IndirectLoad SIMD input axis index %zu is out of range [0, %zu).", |
| 834 | + axis_index, input_axes.size()); | ||
| 831 | std::vector<ascir::AxisId> input_inner_axes(input_axes.begin() + static_cast<int64_t>(axis_index), input_axes.end()); | 835 | std::vector<ascir::AxisId> input_inner_axes(input_axes.begin() + static_cast<int64_t>(axis_index), input_axes.end()); |
| 832 | GE_ASSERT_SUCCESS(MergeAxesForTemplate(graph, input_inner_axes, name, input_inner_axis)); | 836 | GE_ASSERT_SUCCESS(MergeAxesForTemplate(graph, input_inner_axes, name, input_inner_axis)); |
| 833 | return af::SUCCESS; | 837 | return af::SUCCESS; |
| @@ -844,7 +848,8 @@ af::Status BuildSkInputInnerAxis(af::AscGraph &graph, const af::AscNodePtr &indi | |||
| 844 | af::Status BuildAxisViewByBoundary(af::AscGraph &graph, const std::vector<af::AxisId> &axes, size_t boundary, | 848 | af::Status BuildAxisViewByBoundary(af::AscGraph &graph, const std::vector<af::AxisId> &axes, size_t boundary, |
| 845 | af::AxisId &outer_axis, af::AxisId &inner_axis) { | 849 | af::AxisId &outer_axis, af::AxisId &inner_axis) { |
| 846 | GE_ASSERT_TRUE(!axes.empty(), "IndirectLoad output axis is empty."); | 850 | GE_ASSERT_TRUE(!axes.empty(), "IndirectLoad output axis is empty."); |
| 847 | - GE_ASSERT_TRUE(boundary <= axes.size(), "IndirectLoad axis boundary is out of range."); | 851 | + GE_ASSERT_TRUE(boundary <= axes.size(), "IndirectLoad axis boundary %zu is out of range [0, %zu].", boundary, |
| 852 | + axes.size()); | ||
| 848 | const size_t split = boundary; | 853 | const size_t split = boundary; |
| 849 | const std::vector<af::AxisId> outer_axes(axes.begin(), axes.begin() + static_cast<int64_t>(split)); | 854 | const std::vector<af::AxisId> outer_axes(axes.begin(), axes.begin() + static_cast<int64_t>(split)); |
| 850 | const std::vector<af::AxisId> inner_axes(axes.begin() + static_cast<int64_t>(split), axes.end()); | 855 | const std::vector<af::AxisId> inner_axes(axes.begin() + static_cast<int64_t>(split), axes.end()); |
| @@ -999,7 +1004,8 @@ af::Status NormalizeSimdAxesForTemplate(af::AscGraph &graph, const af::AscNodePt | |||
| 999 | af::Status NormalizeSimtAxesForTemplate(af::AscGraph &graph, const af::AscNodePtr &indirect_load, size_t boundary) { | 1004 | af::Status NormalizeSimtAxesForTemplate(af::AscGraph &graph, const af::AscNodePtr &indirect_load, size_t boundary) { |
| 1000 | const auto output_axes = indirect_load->outputs()[0]->attr.axis; | 1005 | const auto output_axes = indirect_load->outputs()[0]->attr.axis; |
| 1001 | GE_ASSERT_TRUE(!output_axes.empty(), "IndirectLoad SIMT output axis is empty."); | 1006 | GE_ASSERT_TRUE(!output_axes.empty(), "IndirectLoad SIMT output axis is empty."); |
| 1002 | - GE_ASSERT_TRUE(boundary <= output_axes.size(), "IndirectLoad SIMT boundary is out of range."); | 1007 | + GE_ASSERT_TRUE(boundary <= output_axes.size(), "IndirectLoad SIMT boundary %zu is out of range [0, %zu].", boundary, |
| 1008 | + output_axes.size()); | ||
| 1003 | GE_ASSERT_SUCCESS(NormalizeAxesForTemplate(graph, indirect_load, boundary, af::kIdNone, af::kIdNone)); | 1009 | GE_ASSERT_SUCCESS(NormalizeAxesForTemplate(graph, indirect_load, boundary, af::kIdNone, af::kIdNone)); |
| 1004 | return af::SUCCESS; | 1010 | return af::SUCCESS; |
| 1005 | } | 1011 | } |
| @@ -83,26 +83,30 @@ class ST_GENERAL_SOLVER_GEN : public ::testing::Test { | |||
| 83 | namespace { | 83 | namespace { |
| 84 | void AppendSolverImplPart0(std::string &codes) { | 84 | void AppendSolverImplPart0(std::string &codes) { |
| 85 | codes += "/*\n"; | 85 | codes += "/*\n"; |
| 86 | - codes += "用户可以在派生类中重载Run函数,构造自定义的求解算法,即\n"; | 86 | + codes += "Users can override the Run function in a derived class to construct a custom solving algorithm:\n"; |
| 87 | codes += " void bool Run(int32_t &solution_num, uint64_t *solutions) override;\n"; | 87 | codes += " void bool Run(int32_t &solution_num, uint64_t *solutions) override;\n"; |
| 88 | - codes += "其中:\n"; | 88 | + codes += "where:\n"; |
| 89 | - codes += " solution_num:int32_t类型的参数,用来输出实际得到的解的个数\n"; | 89 | + codes += " solution_num: an int32_t parameter for the actual number of solutions found\n"; |
| 90 | - codes += " solutions:uint64_t类型的数组,指向一块num_var * top_num的内存,算法将可行解放入该空间\n"; | 90 | + codes += |
| 91 | - codes += "Run函数可以使用下述函数辅助求解:\n"; | 91 | + " solutions: a uint64_t array pointing to num_var * top_num elements where the algorithm stores feasible " |
| 92 | + "solutions\n"; | ||
| 93 | + codes += "The Run function can use the following helper functions:\n"; | ||
| 92 | codes += " bool CheckValid()\n"; | 94 | codes += " bool CheckValid()\n"; |
| 93 | - codes += " 用于检测当前解是否为可行解\n"; | 95 | + codes += " Checks whether the current solution is feasible\n"; |
| 94 | codes += " bool UpdateCurVarVal(uint64_t value, int32_t idx)\n"; | 96 | codes += " bool UpdateCurVarVal(uint64_t value, int32_t idx)\n"; |
| 95 | - codes += " 将下标为idx的待求解变量改为value,同时更新cons_info_->leqs中的值\n"; | 97 | + codes += " Sets the variable at index idx to value and updates cons_info_->leqs\n"; |
| 96 | codes += " bool RecordBestVarVal()\n"; | 98 | codes += " bool RecordBestVarVal()\n"; |
| 97 | - codes += " 待求解变量的当前值所对应的目标函数寻优\n"; | 99 | + codes += " Optimizes the objective function for the current variable values\n"; |
| 98 | - codes += "Run函数可以使用下述参数辅助求解:\n"; | 100 | + codes += "The Run function can use the following parameters:\n"; |
| 99 | - codes += " cons_info_->leqs, double类型的数组, 用于记录不等式约束的函数值, 其下标含义如下:\n"; | 101 | + codes += |
| 102 | + " cons_info_->leqs, a double array storing inequality constraint values; its indices are defined as follows:\n"; | ||
| 100 | codes += " cons_info_->leqs[0] = (x0 + x1 - hbm_size)\n"; | 103 | codes += " cons_info_->leqs[0] = (x0 + x1 - hbm_size)\n"; |
| 101 | codes += " cons_info_->leqs[1] = (x0 + x1 - a)\n"; | 104 | codes += " cons_info_->leqs[1] = (x0 + x1 - a)\n"; |
| 102 | - codes += " var_info_->cur_vars, uint64_t类型的数组, 用于记录待求解变量的当前值, 其下标含义如下:\n"; | 105 | + codes += |
| 106 | + " var_info_->cur_vars, a uint64_t array storing current variable values; its indices are defined as follows:\n"; | ||
| 103 | codes += " var_info_->cur_vars[0] = x3\n"; | 107 | codes += " var_info_->cur_vars[0] = x3\n"; |
| 104 | - codes += " var_info_->upper_bound, uint64_t类型的数组, 用于记录待求解变量的上界\n"; | 108 | + codes += " var_info_->upper_bound, a uint64_t array storing upper bounds for the variables\n"; |
| 105 | - codes += " var_info_->lower_bound, uint64_t类型的数组, 用于记录待求解变量的下界\n"; | 109 | + codes += " var_info_->lower_bound, a uint64_t array storing lower bounds for the variables\n"; |
| 106 | codes += "*/\n"; | 110 | codes += "*/\n"; |
| 107 | codes += "class GeneralSolverCase0 : public GeneralSolver<GeneralSolverCase0>\n"; | 111 | codes += "class GeneralSolverCase0 : public GeneralSolver<GeneralSolverCase0>\n"; |
| 108 | codes += "{\n"; | 112 | codes += "{\n"; |
| @@ -137,11 +141,11 @@ void AppendSolverImplPart1(std::string &codes) { | |||
| 137 | codes += "};\n"; | 141 | codes += "};\n"; |
| 138 | 142 | ||
| 139 | codes += "/*\n"; | 143 | codes += "/*\n"; |
| 140 | - codes += "函数名:Gethbm_sizeCost(重要函数)\n"; | 144 | + codes += "Function: Gethbm_sizeCost(important)\n"; |
| 141 | - codes += "功能描述:\n"; | 145 | + codes += "Description:\n"; |
| 142 | - codes += " 根据待求解变量值hbm_size缓存占用信息(occupy-buff)\n"; | 146 | + codes += " Gets cache occupancy information (occupy-buff) from hbm_size\n"; |
| 143 | - codes += "输入参数:\n"; | 147 | + codes += "Input parameters:\n"; |
| 144 | - codes += " vars:一个长度为num_var的数组,对应了待求解变量\n"; | 148 | + codes += " vars:an array of length num_var corresponding to the variables\n"; |
| 145 | codes += "*/\n"; | 149 | codes += "*/\n"; |
| 146 | codes += "inline double GeneralSolverCase0::Gethbm_sizeCost(uint64_t* vars)\n"; | 150 | codes += "inline double GeneralSolverCase0::Gethbm_sizeCost(uint64_t* vars)\n"; |
| 147 | codes += "{\n"; | 151 | codes += "{\n"; |
| @@ -152,12 +156,12 @@ void AppendSolverImplPart1(std::string &codes) { | |||
| 152 | codes += "\n"; | 156 | codes += "\n"; |
| 153 | 157 | ||
| 154 | codes += "/*\n"; | 158 | codes += "/*\n"; |
| 155 | - codes += "函数名:GetSmoothhbm_sizeCost(重要函数)\n"; | 159 | + codes += "Function: GetSmoothhbm_sizeCost(important)\n"; |
| 156 | - codes += "功能描述:\n"; | 160 | + codes += "Description:\n"; |
| 157 | - codes += " 根据待求解变量值hbm_size的平滑化缓存占用信息\n"; | 161 | + codes += " Gets smoothed cache occupancy information from hbm_size\n"; |
| 158 | - codes += " 与Gethbm_sizeCost函数相比,整除运算被替换为浮点数的除法运算\n"; | 162 | + codes += " Compared with Gethbm_sizeCost, integer division is replaced with floating-point division\n"; |
| 159 | - codes += "输入参数:\n"; | 163 | + codes += "Input parameters:\n"; |
| 160 | - codes += " vars:一个长度为num_var的数组,对应了待求解变量\n"; | 164 | + codes += " vars:an array of length num_var corresponding to the variables\n"; |
| 161 | codes += "*/\n"; | 165 | codes += "*/\n"; |
| 162 | codes += "inline double GeneralSolverCase0::GetSmoothhbm_sizeCost(uint64_t* vars)\n"; | 166 | codes += "inline double GeneralSolverCase0::GetSmoothhbm_sizeCost(uint64_t* vars)\n"; |
| 163 | codes += "{\n"; | 167 | codes += "{\n"; |
| @@ -168,14 +172,14 @@ void AppendSolverImplPart1(std::string &codes) { | |||
| 168 | codes += "\n"; | 172 | codes += "\n"; |
| 169 | 173 | ||
| 170 | codes += "/*\n"; | 174 | codes += "/*\n"; |
| 171 | - codes += "函数名:GetObj(重要函数)\n"; | 175 | + codes += "Function: GetObj(important)\n"; |
| 172 | - codes += "功能描述:\n"; | 176 | + codes += "Description:\n"; |
| 173 | - codes += " 根据待求解变量值输出目标函数\n"; | 177 | + codes += " Outputs the objective function for the variable values\n"; |
| 174 | } | 178 | } |
| 175 | 179 | ||
| 176 | void AppendSolverImplPart2(std::string &codes) { | 180 | void AppendSolverImplPart2(std::string &codes) { |
| 177 | - codes += "输入参数:\n"; | 181 | + codes += "Input parameters:\n"; |
| 178 | - codes += " vars:一个长度为num_var的数组,对应了待求解变量\n"; | 182 | + codes += " vars:an array of length num_var corresponding to the variables\n"; |
| 179 | codes += "*/\n"; | 183 | codes += "*/\n"; |
| 180 | codes += "inline double GeneralSolverCase0::GetObj(uint64_t* vars)\n"; | 184 | codes += "inline double GeneralSolverCase0::GetObj(uint64_t* vars)\n"; |
| 181 | codes += "{\n"; | 185 | codes += "{\n"; |
| @@ -187,10 +191,10 @@ void AppendSolverImplPart2(std::string &codes) { | |||
| 187 | codes += "}\n"; | 191 | codes += "}\n"; |
| 188 | 192 | ||
| 189 | codes += "/*\n"; | 193 | codes += "/*\n"; |
| 190 | - codes += "函数名:GetSmoothObj(重要函数)\n"; | 194 | + codes += "Function: GetSmoothObj(important)\n"; |
| 191 | - codes += "功能描述:\n"; | 195 | + codes += "Description:\n"; |
| 192 | - codes += " 根据待求解变量值输出平滑化目标函数\n"; | 196 | + codes += " Outputs the smoothed objective function for the variable values\n"; |
| 193 | - codes += " 与GetObj函数相比,整除运算被替换为浮点数的除法运算\n"; | 197 | + codes += " Compared with GetObj, integer division is replaced with floating-point division\n"; |
| 194 | codes += "*/\n"; | 198 | codes += "*/\n"; |
| 195 | codes += "inline double GeneralSolverCase0::GetSmoothObj(uint64_t* vars)\n"; | 199 | codes += "inline double GeneralSolverCase0::GetSmoothObj(uint64_t* vars)\n"; |
| 196 | codes += "{\n"; | 200 | codes += "{\n"; |
| @@ -201,12 +205,12 @@ void AppendSolverImplPart2(std::string &codes) { | |||
| 201 | codes += "}\n"; | 205 | codes += "}\n"; |
| 202 | 206 | ||
| 203 | codes += "/*\n"; | 207 | codes += "/*\n"; |
| 204 | - codes += "函数名:GetBuffCost(重要函数)\n"; | 208 | + codes += "Function: GetBuffCost(important)\n"; |
| 205 | - codes += "功能描述:\n"; | 209 | + codes += "Description:\n"; |
| 206 | - codes += " 根据待求解变量值输出缓存占用信息的罚函数(sigma(min(0, occupy-buff)^2))\n"; | 210 | + codes += " Outputs the cache occupancy penalty function (sigma(min(0, occupy-buff)^2))\n"; |
| 207 | - codes += " 该函数用于量化解在缓存占用方面的质量\n"; | 211 | + codes += " Quantifies solution quality in terms of cache occupancy\n"; |
| 208 | - codes += "输入参数:\n"; | 212 | + codes += "Input parameters:\n"; |
| 209 | - codes += " vars:一个长度为num_var的数组,对应了待求解变量\n"; | 213 | + codes += " vars:an array of length num_var corresponding to the variables\n"; |
| 210 | codes += "*/\n"; | 214 | codes += "*/\n"; |
| 211 | codes += "inline double GeneralSolverCase0::GetBuffCost(uint64_t* vars)\n"; | 215 | codes += "inline double GeneralSolverCase0::GetBuffCost(uint64_t* vars)\n"; |
| 212 | codes += "{\n"; | 216 | codes += "{\n"; |
| @@ -215,18 +219,20 @@ void AppendSolverImplPart2(std::string &codes) { | |||
| 215 | codes += "}\n"; | 219 | codes += "}\n"; |
| 216 | 220 | ||
| 217 | codes += "/*\n"; | 221 | codes += "/*\n"; |
| 218 | - codes += "函数名:GetBuffDiff(重要函数)\n"; | 222 | + codes += "Function: GetBuffDiff(important)\n"; |
| 219 | - codes += "功能描述:\n"; | 223 | + codes += "Description:\n"; |
| 220 | - codes += " 获取缓冲占用加权差分值,计算平滑缓冲占用的差分\n"; | 224 | + codes += " Gets the weighted cache occupancy difference for smooth cache occupancy\n"; |
| 221 | - codes += " 输出的计算公式为sigma_j(delta_{var_i}(g_j(var))) * g_j(var))\n"; | 225 | + codes += " The formula is sigma_j(delta_{var_i}(g_j(var))) * g_j(var))\n"; |
| 222 | } | 226 | } |
| 223 | 227 | ||
| 224 | void AppendSolverImplPart3(std::string &codes) { | 228 | void AppendSolverImplPart3(std::string &codes) { |
| 225 | - codes += " 其中g_j为第j个缓冲占用不等式,delta_{var_i}(g_j(var))为g_j(var)沿var_i方向更新一个单位后的变化值\n"; | 229 | + codes += |
| 226 | - codes += " 该函数用于确定变量沿缓冲占用增大的更新方向\n"; | 230 | + " where g_j is the j-th cache occupancy inequality, and delta_{var_i}(g_j(var)) is the change in g_j(var) when " |
| 227 | - codes += "输入参数:\n"; | 231 | + "var_i increases by one unit\n"; |
| 228 | - codes += " vars:一个长度为num_var的数组,对应了待求解变量\n"; | 232 | + codes += " Determines the update direction that increases cache occupancy\n"; |
| 229 | - codes += " weight:一个长度为num_leq的数组,代表了每个缓冲占用的权值\n"; | 233 | + codes += "Input parameters:\n"; |
| 234 | + codes += " vars:an array of length num_var corresponding to the variables\n"; | ||
| 235 | + codes += " weight:an array of length num_leq representing the weight of each cache occupancy\n"; | ||
| 230 | codes += "*/\n"; | 236 | codes += "*/\n"; |
| 231 | codes += "inline double GeneralSolverCase0::GetBuffDiff(uint64_t* vars, double* weight)\n"; | 237 | codes += "inline double GeneralSolverCase0::GetBuffDiff(uint64_t* vars, double* weight)\n"; |
| 232 | codes += "{\n"; | 238 | codes += "{\n"; |
| @@ -236,15 +242,18 @@ void AppendSolverImplPart3(std::string &codes) { | |||
| 236 | codes += "}\n"; | 242 | codes += "}\n"; |
| 237 | 243 | ||
| 238 | codes += "/*\n"; | 244 | codes += "/*\n"; |
| 239 | - codes += "函数名:GetLeqDiff(重要函数)\n"; | 245 | + codes += "Function: GetLeqDiff(important)\n"; |
| 240 | - codes += "功能描述:\n"; | 246 | + codes += "Description:\n"; |
| 241 | - codes += " 获取不等式约束的加权差分值,计算平滑的不等式函数的差分,权值为实际不等式函数值\n"; | 247 | + codes += |
| 242 | - codes += " 输出的计算公式为sigma_j(delta_{var_i}(f_j(var))) * f_j(var))\n"; | 248 | + " Gets the weighted difference of inequality constraints; the weight is the actual inequality function value\n"; |
| 243 | - codes += " 其中f_j为第j个不等式约束式,delta_{var_i}(f_j(var))为f_j(var)沿var_i方向更新一个单位后的变化值\n"; | 249 | + codes += " The formula is sigma_j(delta_{var_i}(f_j(var))) * f_j(var))\n"; |
| 244 | - codes += " 该函数用于确定变量从可行域外侧沿不等式边界方向移动的更新方向\n"; | 250 | + codes += |
| 245 | - codes += "输入参数:\n"; | 251 | + " where f_j is the j-th inequality constraint, and delta_{var_i}(f_j(var)) is the change in f_j(var) when var_i " |
| 246 | - codes += " vars:一个长度为num_var的数组,对应了待求解变量\n"; | 252 | + "increases by one unit\n"; |
| 247 | - codes += " weight:一个长度为num_leq的数组,代表了每个缓冲占用的权值\n"; | 253 | + codes += " Determines the update direction from outside the feasible region toward the inequality boundary\n"; |
| 254 | + codes += "Input parameters:\n"; | ||
| 255 | + codes += " vars:an array of length num_var corresponding to the variables\n"; | ||
| 256 | + codes += " weight:an array of length num_leq representing the weight of each cache occupancy\n"; | ||
| 248 | codes += "*/\n"; | 257 | codes += "*/\n"; |
| 249 | codes += "inline double GeneralSolverCase0::GetLeqDiff(uint64_t* vars, double* weight)\n"; | 258 | codes += "inline double GeneralSolverCase0::GetLeqDiff(uint64_t* vars, double* weight)\n"; |
| 250 | codes += "{\n"; | 259 | codes += "{\n"; |
| @@ -343,39 +352,41 @@ void AppendSolverImplPart5(std::string &codes) { | |||
| 343 | codes += " OP_LOGD(OP_NAME, \"The momentum factor is %f.\", cfg.momentum_factor);\n"; | 352 | codes += " OP_LOGD(OP_NAME, \"The momentum factor is %f.\", cfg.momentum_factor);\n"; |
| 344 | codes += "\n"; | 353 | codes += "\n"; |
| 345 | 354 | ||
| 346 | - codes += " // 以下参数若未注明是可修改参数,则不建议修改\n"; | 355 | + codes += " // Do not modify parameters unless marked as configurable\n"; |
| 347 | - codes += " // 由modelinfo传入的待求解变量个数\n"; | 356 | + codes += " // Number of variables passed from modelinfo\n"; |
| 348 | codes += " int32_t num_var = 2;\n"; | 357 | codes += " int32_t num_var = 2;\n"; |
| 349 | - codes += " // 由modelinfo传入的不等式约束个数\n"; | 358 | + codes += " // Number of inequality constraints passed from modelinfo\n"; |
| 350 | codes += " int32_t num_leq = 2;\n"; | 359 | codes += " int32_t num_leq = 2;\n"; |
| 351 | codes += | 360 | codes += |
| 352 | " OP_LOGD(OP_NAME, \"The number of variable is %d(x0, x1), the number of constraints is %d.\", num_var, " | 361 | " OP_LOGD(OP_NAME, \"The number of variable is %d(x0, x1), the number of constraints is %d.\", num_var, " |
| 353 | "num_leq);\n"; | 362 | "num_leq);\n"; |
| 354 | - codes += " // (可修改参数) 待求解变量的初始值,算法趋向于求初始值附近的局部最优解\n"; | 363 | + codes += " // (Configurable) Initial variable values; the algorithm tends to find a local optimum near them\n"; |
| 355 | codes += " uint64_t init_vars[num_var] = {static_cast<uint64_t>(5), static_cast<uint64_t>((2 * a))};\n"; | 364 | codes += " uint64_t init_vars[num_var] = {static_cast<uint64_t>(5), static_cast<uint64_t>((2 * a))};\n"; |
| 356 | codes += | 365 | codes += |
| 357 | - " // (可修改参数) " | 366 | + " // (Configurable) " |
| 358 | - "待求解变量的上界,过大的上界将导致搜索范围与耗时增加,过小的上界更有可能获得较差的局部最优解\n"; | 367 | + "Variable upper bounds; overly large bounds increase search range and time, while overly small bounds may " |
| 368 | + "produce a worse local optimum\n"; | ||
| 359 | codes += " uint64_t upper_bound[num_var] = {static_cast<uint64_t>(5), static_cast<uint64_t>((2 * a))};\n"; | 369 | codes += " uint64_t upper_bound[num_var] = {static_cast<uint64_t>(5), static_cast<uint64_t>((2 * a))};\n"; |
| 360 | codes += | 370 | codes += |
| 361 | - " // (可修改参数) " | 371 | + " // (Configurable) " |
| 362 | - "待求解变量的下界,过小的下界将导致搜索范围与耗时增加,过大的下界更有可能获得较差的局部最优解\n"; | 372 | + "Variable lower bounds; overly small bounds increase search range and time, while overly large bounds may " |
| 373 | + "produce a worse local optimum\n"; | ||
| 363 | codes += " uint64_t lower_bound[num_var] = {static_cast<uint64_t>(1), static_cast<uint64_t>(1)};\n"; | 374 | codes += " uint64_t lower_bound[num_var] = {static_cast<uint64_t>(1), static_cast<uint64_t>(1)};\n"; |
| 364 | - codes += " // (可修改参数) 最后更新的待求解变量,设置为true的对应变量会更接近初始值\n"; | 375 | + codes += " // (Configurable) Last updated variables; variables set to true stay closer to their initial values\n"; |
| 365 | codes += " bool update_last[num_var] = {true, false};\n"; | 376 | codes += " bool update_last[num_var] = {true, false};\n"; |
| 366 | - codes += " // 初始化解的个数为0\n"; | 377 | + codes += " // Initialize the number of solutions to 0\n"; |
| 367 | } | 378 | } |
| 368 | 379 | ||
| 369 | void AppendSolverImplPart6(std::string &codes) { | 380 | void AppendSolverImplPart6(std::string &codes) { |
| 370 | codes += " int32_t solution_num = 0;\n"; | 381 | codes += " int32_t solution_num = 0;\n"; |
| 371 | - codes += " // 为求解器的输出分配内存\n"; | 382 | + codes += " // Allocate memory for solver output\n"; |
| 372 | codes += " uint64_t* solution = new(std::nothrow) uint64_t[num_var * cfg.top_num];\n"; | 383 | codes += " uint64_t* solution = new(std::nothrow) uint64_t[num_var * cfg.top_num];\n"; |
| 373 | codes += " if (solution == nullptr)\n"; | 384 | codes += " if (solution == nullptr)\n"; |
| 374 | codes += " {\n"; | 385 | codes += " {\n"; |
| 375 | codes += " OP_LOGW(OP_NAME, \"Create solution failed.\");\n"; | 386 | codes += " OP_LOGW(OP_NAME, \"Create solution failed.\");\n"; |
| 376 | codes += " return false;\n"; | 387 | codes += " return false;\n"; |
| 377 | codes += " }\n"; | 388 | codes += " }\n"; |
| 378 | - codes += " // 通用求解器的输入参数\n"; | 389 | + codes += " // Generic solver input parameters\n"; |
| 379 | codes += " SolverInput input;\n"; | 390 | codes += " SolverInput input;\n"; |
| 380 | codes += " input.var_num = num_var;\n"; | 391 | codes += " input.var_num = num_var;\n"; |
| 381 | codes += " input.leq_num = num_leq;\n"; | 392 | codes += " input.leq_num = num_leq;\n"; |
| @@ -393,10 +404,10 @@ void AppendSolverImplPart6(std::string &codes) { | |||
| 393 | 404 | ||
| 394 | codes += " GeneralSolverCase0* solver = new(std::nothrow) GeneralSolverCase0(cfg, tiling_data);\n"; | 405 | codes += " GeneralSolverCase0* solver = new(std::nothrow) GeneralSolverCase0(cfg, tiling_data);\n"; |
| 395 | codes += " if (solver != nullptr) {\n"; | 406 | codes += " if (solver != nullptr) {\n"; |
| 396 | - codes += " // 导入通用求解器的输入参数并完成初始化\n"; | 407 | + codes += " // Import and initialize generic solver input parameters\n"; |
| 397 | codes += " OP_LOGD(OP_NAME, \"Start initializing the input.\");\n"; | 408 | codes += " OP_LOGD(OP_NAME, \"Start initializing the input.\");\n"; |
| 398 | codes += " if (solver -> Init(input)) {\n"; | 409 | codes += " if (solver -> Init(input)) {\n"; |
| 399 | - codes += " // 运行通用求解器并获取算法的解\n"; | 410 | + codes += " // Run the generic solver and obtain algorithm solutions\n"; |
| 400 | codes += " OP_LOGD(OP_NAME, \"Initialization finished, start running the solver.\");\n"; | 411 | codes += " OP_LOGD(OP_NAME, \"Initialization finished, start running the solver.\");\n"; |
| 401 | codes += " if (solver -> Run(solution_num, solution)) {\n"; | 412 | codes += " if (solver -> Run(solution_num, solution)) {\n"; |
| 402 | codes += " solver -> GetResult(solution_num, solution, tiling_data);\n"; | 413 | codes += " solver -> GetResult(solution_num, solution, tiling_data);\n"; |
| @@ -459,39 +470,41 @@ void AppendSolverInvokePart0(std::string &codes) { | |||
| 459 | codes += " OP_LOGD(OP_NAME, \"The momentum factor is %f.\", cfg.momentum_factor);\n"; | 470 | codes += " OP_LOGD(OP_NAME, \"The momentum factor is %f.\", cfg.momentum_factor);\n"; |
| 460 | codes += "\n"; | 471 | codes += "\n"; |
| 461 | 472 | ||
| 462 | - codes += " // 以下参数若未注明是可修改参数,则不建议修改\n"; | 473 | + codes += " // Do not modify parameters unless marked as configurable\n"; |
| 463 | - codes += " // 由modelinfo传入的待求解变量个数\n"; | 474 | + codes += " // Number of variables passed from modelinfo\n"; |
| 464 | codes += " int32_t num_var = 2;\n"; | 475 | codes += " int32_t num_var = 2;\n"; |
| 465 | - codes += " // 由modelinfo传入的不等式约束个数\n"; | 476 | + codes += " // Number of inequality constraints passed from modelinfo\n"; |
| 466 | codes += " int32_t num_leq = 2;\n"; | 477 | codes += " int32_t num_leq = 2;\n"; |
| 467 | codes += | 478 | codes += |
| 468 | " OP_LOGD(OP_NAME, \"The number of variable is %d(x0, x1), the number of constraints is %d.\", num_var, " | 479 | " OP_LOGD(OP_NAME, \"The number of variable is %d(x0, x1), the number of constraints is %d.\", num_var, " |
| 469 | "num_leq);\n"; | 480 | "num_leq);\n"; |
| 470 | - codes += " // (可修改参数) 待求解变量的初始值,算法趋向于求初始值附近的局部最优解\n"; | 481 | + codes += " // (Configurable) Initial variable values; the algorithm tends to find a local optimum near them\n"; |
| 471 | codes += " uint64_t init_vars[num_var] = {static_cast<uint64_t>(5), static_cast<uint64_t>((2 * a))};\n"; | 482 | codes += " uint64_t init_vars[num_var] = {static_cast<uint64_t>(5), static_cast<uint64_t>((2 * a))};\n"; |
| 472 | codes += | 483 | codes += |
| 473 | - " // (可修改参数) " | 484 | + " // (Configurable) " |
| 474 | - "待求解变量的上界,过大的上界将导致搜索范围与耗时增加,过小的上界更有可能获得较差的局部最优解\n"; | 485 | + "Variable upper bounds; overly large bounds increase search range and time, while overly small bounds may " |
| 486 | + "produce a worse local optimum\n"; | ||
| 475 | codes += " uint64_t upper_bound[num_var] = {static_cast<uint64_t>(5), static_cast<uint64_t>((2 * a))};\n"; | 487 | codes += " uint64_t upper_bound[num_var] = {static_cast<uint64_t>(5), static_cast<uint64_t>((2 * a))};\n"; |
| 476 | codes += | 488 | codes += |
| 477 | - " // (可修改参数) " | 489 | + " // (Configurable) " |
| 478 | - "待求解变量的下界,过小的下界将导致搜索范围与耗时增加,过大的下界更有可能获得较差的局部最优解\n"; | 490 | + "Variable lower bounds; overly small bounds increase search range and time, while overly large bounds may " |
| 491 | + "produce a worse local optimum\n"; | ||
| 479 | codes += " uint64_t lower_bound[num_var] = {static_cast<uint64_t>(1), static_cast<uint64_t>(1)};\n"; | 492 | codes += " uint64_t lower_bound[num_var] = {static_cast<uint64_t>(1), static_cast<uint64_t>(1)};\n"; |
| 480 | - codes += " // (可修改参数) 最后更新的待求解变量,设置为true的对应变量会更接近初始值\n"; | 493 | + codes += " // (Configurable) Last updated variables; variables set to true stay closer to their initial values\n"; |
| 481 | codes += " bool update_last[num_var] = {true, false};\n"; | 494 | codes += " bool update_last[num_var] = {true, false};\n"; |
| 482 | - codes += " // 初始化解的个数为0\n"; | 495 | + codes += " // Initialize the number of solutions to 0\n"; |
| 483 | codes += " int32_t solution_num = 0;\n"; | 496 | codes += " int32_t solution_num = 0;\n"; |
| 484 | } | 497 | } |
| 485 | 498 | ||
| 486 | void AppendSolverInvokePart1(std::string &codes) { | 499 | void AppendSolverInvokePart1(std::string &codes) { |
| 487 | - codes += " // 为求解器的输出分配内存\n"; | 500 | + codes += " // Allocate memory for solver output\n"; |
| 488 | codes += " uint64_t* solution = new(std::nothrow) uint64_t[num_var * cfg.top_num];\n"; | 501 | codes += " uint64_t* solution = new(std::nothrow) uint64_t[num_var * cfg.top_num];\n"; |
| 489 | codes += " if (solution == nullptr)\n"; | 502 | codes += " if (solution == nullptr)\n"; |
| 490 | codes += " {\n"; | 503 | codes += " {\n"; |
| 491 | codes += " OP_LOGW(OP_NAME, \"Create solution failed.\");\n"; | 504 | codes += " OP_LOGW(OP_NAME, \"Create solution failed.\");\n"; |
| 492 | codes += " return false;\n"; | 505 | codes += " return false;\n"; |
| 493 | codes += " }\n"; | 506 | codes += " }\n"; |
| 494 | - codes += " // 通用求解器的输入参数\n"; | 507 | + codes += " // Generic solver input parameters\n"; |
| 495 | codes += " SolverInput input;\n"; | 508 | codes += " SolverInput input;\n"; |
| 496 | codes += " input.var_num = num_var;\n"; | 509 | codes += " input.var_num = num_var;\n"; |
| 497 | codes += " input.leq_num = num_leq;\n"; | 510 | codes += " input.leq_num = num_leq;\n"; |
| @@ -509,10 +522,10 @@ void AppendSolverInvokePart1(std::string &codes) { | |||
| 509 | 522 | ||
| 510 | codes += " GeneralSolverCase0* solver = new(std::nothrow) GeneralSolverCase0(cfg, tiling_data);\n"; | 523 | codes += " GeneralSolverCase0* solver = new(std::nothrow) GeneralSolverCase0(cfg, tiling_data);\n"; |
| 511 | codes += " if (solver != nullptr) {\n"; | 524 | codes += " if (solver != nullptr) {\n"; |
| 512 | - codes += " // 导入通用求解器的输入参数并完成初始化\n"; | 525 | + codes += " // Import and initialize generic solver input parameters\n"; |
| 513 | codes += " OP_LOGD(OP_NAME, \"Start initializing the input.\");\n"; | 526 | codes += " OP_LOGD(OP_NAME, \"Start initializing the input.\");\n"; |
| 514 | codes += " if (solver -> Init(input)) {\n"; | 527 | codes += " if (solver -> Init(input)) {\n"; |
| 515 | - codes += " // 运行通用求解器并获取算法的解\n"; | 528 | + codes += " // Run the generic solver and obtain algorithm solutions\n"; |
| 516 | codes += " OP_LOGD(OP_NAME, \"Initialization finished, start running the solver.\");\n"; | 529 | codes += " OP_LOGD(OP_NAME, \"Initialization finished, start running the solver.\");\n"; |
| 517 | codes += " if (solver -> Run(solution_num, solution)) {\n"; | 530 | codes += " if (solver -> Run(solution_num, solution)) {\n"; |
| 518 | codes += " solver -> GetResult(solution_num, solution, tiling_data);\n"; | 531 | codes += " solver -> GetResult(solution_num, solution, tiling_data);\n"; |
| @@ -63,7 +63,7 @@ bool ResultCheckerUtils::IsFileContainsString(const std::string &filename, const | |||
| 63 | 63 | ||
| 64 | bool ResultCheckerUtils::ReadFileLines(const std::string &filename, std::vector<std::string> &lines) { | 64 | bool ResultCheckerUtils::ReadFileLines(const std::string &filename, std::vector<std::string> &lines) { |
| 65 | if (!fs::exists(filename)) { | 65 | if (!fs::exists(filename)) { |
| 66 | - std::cerr << "Error: filename " << filename << " is not exist!" << std::endl; | 66 | + std::cerr << "Error: filename " << filename << " does not exist!" << std::endl; |
| 67 | return false; | 67 | return false; |
| 68 | } | 68 | } |
| 69 | 69 | ||
| @@ -2,10 +2,10 @@ | |||
| 2 | # -*- coding: utf-8 -*- | 2 | # -*- coding: utf-8 -*- |
| 3 | # ----------------------------------------------------------------------------------------------------------- | 3 | # ----------------------------------------------------------------------------------------------------------- |
| 4 | # Copyright (c) 2025 Huawei Technologies Co., Ltd. | 4 | # Copyright (c) 2025 Huawei Technologies Co., Ltd. |
| 5 | -# This program is free software, you can redistribute it and/or modify it under the terms and conditions of | 5 | +# This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 6 | # CANN Open Software License Agreement Version 2.0 (the "License"). | 6 | # CANN Open Software License Agreement Version 2.0 (the "License"). |
| 7 | # Please refer to the License for details. You may not use this file except in compliance with the License. | 7 | # Please refer to the License for details. You may not use this file except in compliance with the License. |
| 8 | -# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | 8 | +# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, |
| 9 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | 9 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. |
| 10 | # See LICENSE in the root of the software repository for the full text of the License. | 10 | # See LICENSE in the root of the software repository for the full text of the License. |
| 11 | # ----------------------------------------------------------------------------------------------------------- | 11 | # ----------------------------------------------------------------------------------------------------------- |
| @@ -25,28 +25,31 @@ def verify_result(output, golden, output_dtype): | |||
| 25 | print("#################TEST RESULT#####################") | 25 | print("#################TEST RESULT#####################") |
| 26 | print("output result:", output) | 26 | print("output result:", output) |
| 27 | print("golden result:", golden) | 27 | print("golden result:", golden) |
| 28 | - different_element_results = np.isclose(output, | 28 | + different_element_results = np.isclose( |
| 29 | - golden, | 29 | + output, golden, rtol=relative_tol, atol=absolute_tol, equal_nan=True |
| 30 | - rtol=relative_tol, | 30 | + ) |
| 31 | - atol=absolute_tol, | 31 | + different_element_indexes = np.where(np.logical_not(different_element_results))[0] |
| 32 | - equal_nan=True) | ||
| 33 | - different_element_indexes = np.where(different_element_results == False)[0] | ||
| 34 | for index in range(len(different_element_indexes)): | 32 | for index in range(len(different_element_indexes)): |
| 35 | real_index = different_element_indexes[index] | 33 | real_index = different_element_indexes[index] |
| 36 | golden_data = golden[real_index] | 34 | golden_data = golden[real_index] |
| 37 | output_data = output[real_index] | 35 | output_data = output[real_index] |
| 38 | print( | 36 | print( |
| 39 | - "data index: %06d, expected: %-.9f, actual: %-.9f, rdiff: %-.6f" % | 37 | + "data index: %06d, expected: %-.9f, actual: %-.9f, rdiff: %-.6f" |
| 40 | - (real_index, golden_data, output_data, | 38 | + % ( |
| 41 | - abs(output_data - golden_data) / golden_data)) | 39 | + real_index, |
| 40 | + golden_data, | ||
| 41 | + output_data, | ||
| 42 | + abs(output_data - golden_data) / golden_data, | ||
| 43 | + ) | ||
| 44 | + ) | ||
| 42 | if index == 100: | 45 | if index == 100: |
| 43 | break | 46 | break |
| 44 | error_ratio = float(different_element_indexes.size) / golden.size | 47 | error_ratio = float(different_element_indexes.size) / golden.size |
| 45 | - print("error ratio: %.4f, tolrence: %.4f" % (error_ratio, error_tol)) | 48 | + print("error ratio: %.4f, tolerance: %.4f" % (error_ratio, error_tol)) |
| 46 | return error_ratio <= error_tol | 49 | return error_ratio <= error_tol |
| 47 | 50 | ||
| 48 | 51 | ||
| 49 | -if __name__ == '__main__': | 52 | +if __name__ == "__main__": |
| 50 | try: | 53 | try: |
| 51 | if sys.argv[4] == "float16": | 54 | if sys.argv[4] == "float16": |
| 52 | print("output dtype is float16") | 55 | print("output dtype is float16") |
| @@ -64,7 +67,9 @@ if __name__ == '__main__': | |||
| 64 | print("output dtype is float32") | 67 | print("output dtype is float32") |
| 65 | output_dtype = np.float32 | 68 | output_dtype = np.float32 |
| 66 | else: | 69 | else: |
| 67 | - raise ValueError("[ERROR]current output type(", sys.argv[4], ") not support") | 70 | + raise ValueError( |
| 71 | + "[ERROR]current output type(", sys.argv[4], ") is not supported" | ||
| 72 | + ) | ||
| 68 | res = verify_result(sys.argv[1], sys.argv[2], output_dtype) | 73 | res = verify_result(sys.argv[1], sys.argv[2], output_dtype) |
| 69 | if not res: | 74 | if not res: |
| 70 | raise ValueError("[ERROR] testcase: ", sys.argv[3], ", Result: ERROR") | 75 | raise ValueError("[ERROR] testcase: ", sys.argv[3], ", Result: ERROR") |
| @@ -272,7 +272,7 @@ __aicore__ inline U GetScalarValueByBitCode(T bit_code) { | |||
| 272 | 272 | ||
| 273 | template <typename T> | 273 | template <typename T> |
| 274 | constexpr __aicore__ static inline T AfInfinity() { | 274 | constexpr __aicore__ static inline T AfInfinity() { |
| 275 | - static_assert(SupportType<T, half, float>(), "current data type is not support inf"); | 275 | + static_assert(SupportType<T, half, float>(), "current data type does not support inf"); |
| 276 | if constexpr (std::is_same_v<T, half>) { | 276 | if constexpr (std::is_same_v<T, half>) { |
| 277 | return GetScalarValueByBitCode<uint16_t, T>(0x7C00U); | 277 | return GetScalarValueByBitCode<uint16_t, T>(0x7C00U); |
| 278 | } else if constexpr (std::is_same_v<T, float>) { | 278 | } else if constexpr (std::is_same_v<T, float>) { |
| @@ -684,7 +684,7 @@ bool AxesReorderSolver::AutoTuning(const bool is_trade_off) { | |||
| 684 | // 4.当前档位差于下档位,向下找更优解(考虑多核头开销对小Shape场景的影响和同地址冲突对多核的影响,当前更倾向于下档位) | 684 | // 4.当前档位差于下档位,向下找更优解(考虑多核头开销对小Shape场景的影响和同地址冲突对多核的影响,当前更倾向于下档位) |
| 685 | if (current_perf > next_lower_perf) { | 685 | if (current_perf > next_lower_perf) { |
| 686 | OP_LOGD(OP_NAME, | 686 | OP_LOGD(OP_NAME, |
| 687 | - "Find lower block dim, as next_lower_perf: %f(block_dim=%u) is better than" | 687 | + "Find lower block dim, as next_lower_perf: %f(block_dim=%u) is better than " |
| 688 | "current_perf: %f(block_dim=%u), input: %s", | 688 | "current_perf: %f(block_dim=%u), input: %s", |
| 689 | current_perf, block_dim, next_lower_perf, next_lower_block_dim, input_.DebugString().c_str()); | 689 | current_perf, block_dim, next_lower_perf, next_lower_block_dim, input_.DebugString().c_str()); |
| 690 | FindBetterSolutionByLowerBlockDim(next_lower_perf, next_lower_block_dim); | 690 | FindBetterSolutionByLowerBlockDim(next_lower_perf, next_lower_block_dim); |
Mautofuse/tests/ut/att/testcase/solver_pass_gen/general_solver_gen/ut_general_solver_gen_01.cpp+17-13
| @@ -261,23 +261,27 @@ TEST_F(UTTEST_GENERAL_SOLVER_GEN_01, test_gen_class_def) { | |||
| 261 | solver->GenClassDef(); | 261 | solver->GenClassDef(); |
| 262 | std::string expect_codes = ""; | 262 | std::string expect_codes = ""; |
| 263 | expect_codes += "/*\n"; | 263 | expect_codes += "/*\n"; |
| 264 | - expect_codes += "用户可以在派生类中重载Run函数,构造自定义的求解算法,即\n"; | 264 | + expect_codes += "Users can override the Run function in a derived class to construct a custom solving algorithm:\n"; |
| 265 | expect_codes += " void bool Run(int32_t &solution_num, uint64_t *solutions) override;\n"; | 265 | expect_codes += " void bool Run(int32_t &solution_num, uint64_t *solutions) override;\n"; |
| 266 | - expect_codes += "其中:\n"; | 266 | + expect_codes += "where:\n"; |
| 267 | - expect_codes += " solution_num:int32_t类型的参数,用来输出实际得到的解的个数\n"; | 267 | + expect_codes += " solution_num: an int32_t parameter for the actual number of solutions found\n"; |
| 268 | - expect_codes += " solutions:uint64_t类型的数组,指向一块num_var * top_num的内存,算法将可行解放入该空间\n"; | 268 | + expect_codes += |
| 269 | - expect_codes += "Run函数可以使用下述函数辅助求解:\n"; | 269 | + " solutions: a uint64_t array pointing to num_var * top_num elements where the algorithm stores feasible " |
| 270 | + "solutions\n"; | ||
| 271 | + expect_codes += "The Run function can use the following helper functions:\n"; | ||
| 270 | expect_codes += " bool CheckValid()\n"; | 272 | expect_codes += " bool CheckValid()\n"; |
| 271 | - expect_codes += " 用于检测当前解是否为可行解\n"; | 273 | + expect_codes += " Checks whether the current solution is feasible\n"; |
| 272 | expect_codes += " bool UpdateCurVarVal(uint64_t value, int32_t idx)\n"; | 274 | expect_codes += " bool UpdateCurVarVal(uint64_t value, int32_t idx)\n"; |
| 273 | - expect_codes += " 将下标为idx的待求解变量改为value,同时更新cons_info_->leqs中的值\n"; | 275 | + expect_codes += " Sets the variable at index idx to value and updates cons_info_->leqs\n"; |
| 274 | expect_codes += " bool RecordBestVarVal()\n"; | 276 | expect_codes += " bool RecordBestVarVal()\n"; |
| 275 | - expect_codes += " 待求解变量的当前值所对应的目标函数寻优\n"; | 277 | + expect_codes += " Optimizes the objective function for the current variable values\n"; |
| 276 | - expect_codes += "Run函数可以使用下述参数辅助求解:\n"; | 278 | + expect_codes += "The Run function can use the following parameters:\n"; |
| 277 | - expect_codes += " cons_info_->leqs, double类型的数组, 用于记录不等式约束的函数值, 其下标含义如下:\n"; | 279 | + expect_codes += |
| 278 | - expect_codes += " var_info_->cur_vars, uint64_t类型的数组, 用于记录待求解变量的当前值, 其下标含义如下:\n"; | 280 | + " cons_info_->leqs, a double array storing inequality constraint values; its indices are defined as follows:\n"; |
| 279 | - expect_codes += " var_info_->upper_bound, uint64_t类型的数组, 用于记录待求解变量的上界\n"; | 281 | + expect_codes += |
| 280 | - expect_codes += " var_info_->lower_bound, uint64_t类型的数组, 用于记录待求解变量的下界\n"; | 282 | + " var_info_->cur_vars, a uint64_t array storing current variable values; its indices are defined as follows:\n"; |
| 283 | + expect_codes += " var_info_->upper_bound, a uint64_t array storing upper bounds for the variables\n"; | ||
| 284 | + expect_codes += " var_info_->lower_bound, a uint64_t array storing lower bounds for the variables\n"; | ||
| 281 | expect_codes += "*/\n"; | 285 | expect_codes += "*/\n"; |
| 282 | expect_codes += "class GeneralSolverCase0 : public GeneralSolver<GeneralSolverCase0>\n"; | 286 | expect_codes += "class GeneralSolverCase0 : public GeneralSolver<GeneralSolverCase0>\n"; |
| 283 | expect_codes += "{\n"; | 287 | expect_codes += "{\n"; |
Mautofuse/tests/ut/att/testcase/solver_pass_gen/general_solver_gen/ut_general_solver_gen_02.cpp+37-33
| @@ -74,11 +74,11 @@ TEST_F(UTTEST_GENERAL_SOLVER_GEN_02, test_gen_buffer_cost) { | |||
| 74 | solver_->impl_codes_ = ""; | 74 | solver_->impl_codes_ = ""; |
| 75 | solver_->GenBuffFunc(); | 75 | solver_->GenBuffFunc(); |
| 76 | expect_codes += "/*\n"; | 76 | expect_codes += "/*\n"; |
| 77 | - expect_codes += "函数名:Gethbm_sizeCost(重要函数)\n"; | 77 | + expect_codes += "Function: Gethbm_sizeCost(important)\n"; |
| 78 | - expect_codes += "功能描述:\n"; | 78 | + expect_codes += "Description:\n"; |
| 79 | - expect_codes += " 根据待求解变量值hbm_size缓存占用信息(occupy-buff)\n"; | 79 | + expect_codes += " Gets cache occupancy information (occupy-buff) from hbm_size\n"; |
| 80 | - expect_codes += "输入参数:\n"; | 80 | + expect_codes += "Input parameters:\n"; |
| 81 | - expect_codes += " vars:一个长度为num_var的数组,对应了待求解变量\n"; | 81 | + expect_codes += " vars:an array of length num_var corresponding to the variables\n"; |
| 82 | expect_codes += "*/\n"; | 82 | expect_codes += "*/\n"; |
| 83 | expect_codes += "inline double GeneralSolverCase0::Gethbm_sizeCost(uint64_t* vars)\n"; | 83 | expect_codes += "inline double GeneralSolverCase0::Gethbm_sizeCost(uint64_t* vars)\n"; |
| 84 | expect_codes += "{\n"; | 84 | expect_codes += "{\n"; |
| @@ -89,12 +89,12 @@ TEST_F(UTTEST_GENERAL_SOLVER_GEN_02, test_gen_buffer_cost) { | |||
| 89 | expect_codes += "\n"; | 89 | expect_codes += "\n"; |
| 90 | 90 | ||
| 91 | expect_codes += "/*\n"; | 91 | expect_codes += "/*\n"; |
| 92 | - expect_codes += "函数名:GetSmoothhbm_sizeCost(重要函数)\n"; | 92 | + expect_codes += "Function: GetSmoothhbm_sizeCost(important)\n"; |
| 93 | - expect_codes += "功能描述:\n"; | 93 | + expect_codes += "Description:\n"; |
| 94 | - expect_codes += " 根据待求解变量值hbm_size的平滑化缓存占用信息\n"; | 94 | + expect_codes += " Gets smoothed cache occupancy information from hbm_size\n"; |
| 95 | - expect_codes += " 与Gethbm_sizeCost函数相比,整除运算被替换为浮点数的除法运算\n"; | 95 | + expect_codes += " Compared with Gethbm_sizeCost, integer division is replaced with floating-point division\n"; |
| 96 | - expect_codes += "输入参数:\n"; | 96 | + expect_codes += "Input parameters:\n"; |
| 97 | - expect_codes += " vars:一个长度为num_var的数组,对应了待求解变量\n"; | 97 | + expect_codes += " vars:an array of length num_var corresponding to the variables\n"; |
| 98 | expect_codes += "*/\n"; | 98 | expect_codes += "*/\n"; |
| 99 | expect_codes += "inline double GeneralSolverCase0::GetSmoothhbm_sizeCost(uint64_t* vars)\n"; | 99 | expect_codes += "inline double GeneralSolverCase0::GetSmoothhbm_sizeCost(uint64_t* vars)\n"; |
| 100 | expect_codes += "{\n"; | 100 | expect_codes += "{\n"; |
| @@ -113,11 +113,11 @@ TEST_F(UTTEST_GENERAL_SOLVER_GEN_02, test_gen_get_func) { | |||
| 113 | solver_->impl_codes_ = ""; | 113 | solver_->impl_codes_ = ""; |
| 114 | solver_->GenGetFunc(FuncType::OBJ); | 114 | solver_->GenGetFunc(FuncType::OBJ); |
| 115 | expect_codes = "/*\n"; | 115 | expect_codes = "/*\n"; |
| 116 | - expect_codes += "函数名:GetObj(重要函数)\n"; | 116 | + expect_codes += "Function: GetObj(important)\n"; |
| 117 | - expect_codes += "功能描述:\n"; | 117 | + expect_codes += "Description:\n"; |
| 118 | - expect_codes += " 根据待求解变量值输出目标函数\n"; | 118 | + expect_codes += " Outputs the objective function for the variable values\n"; |
| 119 | - expect_codes += "输入参数:\n"; | 119 | + expect_codes += "Input parameters:\n"; |
| 120 | - expect_codes += " vars:一个长度为num_var的数组,对应了待求解变量\n"; | 120 | + expect_codes += " vars:an array of length num_var corresponding to the variables\n"; |
| 121 | expect_codes += "*/\n"; | 121 | expect_codes += "*/\n"; |
| 122 | expect_codes += "inline double GeneralSolverCase0::GetObj(uint64_t* vars)\n"; | 122 | expect_codes += "inline double GeneralSolverCase0::GetObj(uint64_t* vars)\n"; |
| 123 | expect_codes += "{\n"; | 123 | expect_codes += "{\n"; |
| @@ -134,12 +134,12 @@ TEST_F(UTTEST_GENERAL_SOLVER_GEN_02, test_gen_get_func) { | |||
| 134 | solver_->impl_codes_ = ""; | 134 | solver_->impl_codes_ = ""; |
| 135 | solver_->GenGetFunc(FuncType::BUFFER); | 135 | solver_->GenGetFunc(FuncType::BUFFER); |
| 136 | expect_codes = "/*\n"; | 136 | expect_codes = "/*\n"; |
| 137 | - expect_codes += "函数名:GetBuffCost(重要函数)\n"; | 137 | + expect_codes += "Function: GetBuffCost(important)\n"; |
| 138 | - expect_codes += "功能描述:\n"; | 138 | + expect_codes += "Description:\n"; |
| 139 | - expect_codes += " 根据待求解变量值输出缓存占用信息的罚函数(sigma(min(0, occupy-buff)^2))\n"; | 139 | + expect_codes += " Outputs the cache occupancy penalty function (sigma(min(0, occupy-buff)^2))\n"; |
| 140 | - expect_codes += " 该函数用于量化解在缓存占用方面的质量\n"; | 140 | + expect_codes += " Quantifies solution quality in terms of cache occupancy\n"; |
| 141 | - expect_codes += "输入参数:\n"; | 141 | + expect_codes += "Input parameters:\n"; |
| 142 | - expect_codes += " vars:一个长度为num_var的数组,对应了待求解变量\n"; | 142 | + expect_codes += " vars:an array of length num_var corresponding to the variables\n"; |
| 143 | expect_codes += "*/\n"; | 143 | expect_codes += "*/\n"; |
| 144 | expect_codes += "inline double GeneralSolverCase0::GetBuffCost(uint64_t* vars)\n"; | 144 | expect_codes += "inline double GeneralSolverCase0::GetBuffCost(uint64_t* vars)\n"; |
| 145 | expect_codes += "{\n"; | 145 | expect_codes += "{\n"; |
| @@ -262,15 +262,15 @@ TEST_F(UTTEST_GENERAL_SOLVER_GEN_02, test_gen_get_result) { | |||
| 262 | 262 | ||
| 263 | TEST_F(UTTEST_GENERAL_SOLVER_GEN_02, test_create_input) { | 263 | TEST_F(UTTEST_GENERAL_SOLVER_GEN_02, test_create_input) { |
| 264 | std::string expect_codes = ""; | 264 | std::string expect_codes = ""; |
| 265 | - expect_codes += " // 以下参数若未注明是可修改参数,则不建议修改\n"; | 265 | + expect_codes += " // Do not modify parameters unless marked as configurable\n"; |
| 266 | - expect_codes += " // 由modelinfo传入的待求解变量个数\n"; | 266 | + expect_codes += " // Number of variables passed from modelinfo\n"; |
| 267 | expect_codes += " int32_t num_var = 2;\n"; | 267 | expect_codes += " int32_t num_var = 2;\n"; |
| 268 | - expect_codes += " // 由modelinfo传入的不等式约束个数\n"; | 268 | + expect_codes += " // Number of inequality constraints passed from modelinfo\n"; |
| 269 | expect_codes += " int32_t num_leq = 2;\n"; | 269 | expect_codes += " int32_t num_leq = 2;\n"; |
| 270 | expect_codes += | 270 | expect_codes += |
| 271 | " OP_LOGD(OP_NAME, \"The number of variable is %d(x0, x1), the number of constraints is %d.\", num_var, " | 271 | " OP_LOGD(OP_NAME, \"The number of variable is %d(x0, x1), the number of constraints is %d.\", num_var, " |
| 272 | "num_leq);\n"; | 272 | "num_leq);\n"; |
| 273 | - expect_codes += " // 初始化解的个数为0\n"; | 273 | + expect_codes += " // Initialize the number of solutions to 0\n"; |
| 274 | expect_codes += " int32_t solution_num = 0;\n"; | 274 | expect_codes += " int32_t solution_num = 0;\n"; |
| 275 | expect_codes += " size_t uint_size = 6 * static_cast<size_t>(num_var) * sizeof(uint64_t);\n"; | 275 | expect_codes += " size_t uint_size = 6 * static_cast<size_t>(num_var) * sizeof(uint64_t);\n"; |
| 276 | expect_codes += " size_t double_size = 2 * static_cast<size_t>(num_leq + num_var) * sizeof(double);\n"; | 276 | expect_codes += " size_t double_size = 2 * static_cast<size_t>(num_leq + num_var) * sizeof(double);\n"; |
| @@ -305,11 +305,13 @@ TEST_F(UTTEST_GENERAL_SOLVER_GEN_02, test_create_input) { | |||
| 305 | expect_codes += " double* double_space = (double*)((char*)memory_pool + offset_double);\n"; | 305 | expect_codes += " double* double_space = (double*)((char*)memory_pool + offset_double);\n"; |
| 306 | expect_codes += " bool* bool_space = (bool*)((char*)memory_pool + offset_bool);\n"; | 306 | expect_codes += " bool* bool_space = (bool*)((char*)memory_pool + offset_bool);\n"; |
| 307 | expect_codes += | 307 | expect_codes += |
| 308 | - " // 可修改参数:待求解变量的上界,过大的上界将导致搜索范围与耗时增加,过小的上界更有可能获得较差的局部最优解\n"; | 308 | + " // Configurable:Variable upper bounds; overly large bounds increase search range and time, while overly " |
| 309 | + "small bounds may produce a worse local optimum\n"; | ||
| 309 | expect_codes += " uint_space[0] = static_cast<uint64_t>((2 * a));\n"; | 310 | expect_codes += " uint_space[0] = static_cast<uint64_t>((2 * a));\n"; |
| 310 | expect_codes += " uint_space[1] = static_cast<uint64_t>((2 * a));\n"; | 311 | expect_codes += " uint_space[1] = static_cast<uint64_t>((2 * a));\n"; |
| 311 | expect_codes += | 312 | expect_codes += |
| 312 | - " // 可修改参数:待求解变量的下界,过小的下界将导致搜索范围与耗时增加,过大的下界更有可能获得较差的局部最优解\n"; | 313 | + " // Configurable:Variable lower bounds; overly small bounds increase search range and time, while overly " |
| 314 | + "large bounds may produce a worse local optimum\n"; | ||
| 313 | expect_codes += " uint_space[2] = static_cast<uint64_t>(1);\n"; | 315 | expect_codes += " uint_space[2] = static_cast<uint64_t>(1);\n"; |
| 314 | expect_codes += " if (static_cast<uint64_t>(1) > static_cast<uint64_t>((2 * a))) {\n"; | 316 | expect_codes += " if (static_cast<uint64_t>(1) > static_cast<uint64_t>((2 * a))) {\n"; |
| 315 | expect_codes += " OP_LOGW(OP_NAME, \"Lower_bound[0] is larger than upper_bound[0].\");\n"; | 317 | expect_codes += " OP_LOGW(OP_NAME, \"Lower_bound[0] is larger than upper_bound[0].\");\n"; |
| @@ -320,13 +322,15 @@ TEST_F(UTTEST_GENERAL_SOLVER_GEN_02, test_create_input) { | |||
| 320 | expect_codes += " OP_LOGW(OP_NAME, \"Lower_bound[1] is larger than upper_bound[1].\");\n"; | 322 | expect_codes += " OP_LOGW(OP_NAME, \"Lower_bound[1] is larger than upper_bound[1].\");\n"; |
| 321 | expect_codes += " return false;\n"; | 323 | expect_codes += " return false;\n"; |
| 322 | expect_codes += " }\n"; | 324 | expect_codes += " }\n"; |
| 323 | - expect_codes += " // 可修改参数:待求解变量的初始值,算法趋向于求初始值附近的局部最优解\n"; | 325 | + expect_codes += |
| 326 | + " // Configurable:Initial variable values; the algorithm tends to find a local optimum near them\n"; | ||
| 324 | expect_codes += " uint_space[8] = static_cast<uint64_t>((2 * a));\n"; | 327 | expect_codes += " uint_space[8] = static_cast<uint64_t>((2 * a));\n"; |
| 325 | expect_codes += " uint_space[9] = static_cast<uint64_t>((2 * a));\n"; | 328 | expect_codes += " uint_space[9] = static_cast<uint64_t>((2 * a));\n"; |
| 326 | expect_codes += " uint64_t* upper_bound = uint_space;\n"; | 329 | expect_codes += " uint64_t* upper_bound = uint_space;\n"; |
| 327 | expect_codes += " uint64_t* lower_bound = uint_space + 2;\n"; | 330 | expect_codes += " uint64_t* lower_bound = uint_space + 2;\n"; |
| 328 | expect_codes += " uint64_t* init_vars = uint_space + 8;\n"; | 331 | expect_codes += " uint64_t* init_vars = uint_space + 8;\n"; |
| 329 | - expect_codes += " // 可修改参数:最后更新的待求解变量,设置为true的对应变量会更接近初始值\n"; | 332 | + expect_codes += |
| 333 | + " // Configurable:Last updated variables; variables set to true stay closer to their initial values\n"; | ||
| 330 | expect_codes += " bool_space[0] = true;\n"; | 334 | expect_codes += " bool_space[0] = true;\n"; |
| 331 | expect_codes += " bool_space[1] = false;\n"; | 335 | expect_codes += " bool_space[1] = false;\n"; |
| 332 | expect_codes += " VarInfo* var_info = (VarInfo*)((char*)memory_pool + offset_var_info);\n"; | 336 | expect_codes += " VarInfo* var_info = (VarInfo*)((char*)memory_pool + offset_var_info);\n"; |
| @@ -351,7 +355,7 @@ TEST_F(UTTEST_GENERAL_SOLVER_GEN_02, test_create_input) { | |||
| 351 | " result->SetResult(cfg_top_num, num_var, (VarVal*)((char*)memory_pool + offset_varVal),((char*)memory_pool + " | 355 | " result->SetResult(cfg_top_num, num_var, (VarVal*)((char*)memory_pool + offset_varVal),((char*)memory_pool + " |
| 352 | "offset_temp), ((char*)memory_pool + offset_solution));\n"; | 356 | "offset_temp), ((char*)memory_pool + offset_solution));\n"; |
| 353 | expect_codes += " visited_node->SetVisitedNode(num_var, visited_head);\n"; | 357 | expect_codes += " visited_node->SetVisitedNode(num_var, visited_head);\n"; |
| 354 | - expect_codes += " // 通用求解器的输入参数\n"; | 358 | + expect_codes += " // Generic solver input parameters\n"; |
| 355 | expect_codes += " SolverInput input;\n"; | 359 | expect_codes += " SolverInput input;\n"; |
| 356 | expect_codes += " input.corenum = corenum_;\n"; | 360 | expect_codes += " input.corenum = corenum_;\n"; |
| 357 | expect_codes += " input.var_info = var_info;\n"; | 361 | expect_codes += " input.var_info = var_info;\n"; |
| @@ -377,10 +381,10 @@ TEST_F(UTTEST_GENERAL_SOLVER_GEN_02, test_run_solver) { | |||
| 377 | expect_codes += | 381 | expect_codes += |
| 378 | " std::shared_ptr<GeneralSolverCase0> solver = std::make_shared<GeneralSolverCase0>(cfg, tiling_data);\n"; | 382 | " std::shared_ptr<GeneralSolverCase0> solver = std::make_shared<GeneralSolverCase0>(cfg, tiling_data);\n"; |
| 379 | expect_codes += " if (solver != nullptr) {\n"; | 383 | expect_codes += " if (solver != nullptr) {\n"; |
| 380 | - expect_codes += " // 导入通用求解器的输入参数并完成初始化\n"; | 384 | + expect_codes += " // Import and initialize generic solver input parameters\n"; |
| 381 | expect_codes += " OP_LOGD(OP_NAME, \"Start initializing the input.\");\n"; | 385 | expect_codes += " OP_LOGD(OP_NAME, \"Start initializing the input.\");\n"; |
| 382 | expect_codes += " if (solver -> Init(input)) {\n"; | 386 | expect_codes += " if (solver -> Init(input)) {\n"; |
| 383 | - expect_codes += " // 运行通用求解器并获取算法的解\n"; | 387 | + expect_codes += " // Run the generic solver and obtain algorithm solutions\n"; |
| 384 | expect_codes += " OP_LOGD(OP_NAME, \"Initialization finished, start running the solver.\");\n"; | 388 | expect_codes += " OP_LOGD(OP_NAME, \"Initialization finished, start running the solver.\");\n"; |
| 385 | expect_codes += " if (solver -> Run(solution_num, solution)) {\n"; | 389 | expect_codes += " if (solver -> Run(solution_num, solution)) {\n"; |
| 386 | expect_codes += " solver -> GetResult(solution_num, solution, tiling_data);\n"; | 390 | expect_codes += " solver -> GetResult(solution_num, solution, tiling_data);\n"; |
| @@ -63,7 +63,7 @@ bool ResultCheckerUtils::IsFileContainsString(const std::string &filename, const | |||
| 63 | 63 | ||
| 64 | bool ResultCheckerUtils::ReadFileLines(const std::string &filename, std::vector<std::string> &lines) { | 64 | bool ResultCheckerUtils::ReadFileLines(const std::string &filename, std::vector<std::string> &lines) { |
| 65 | if (!fs::exists(filename)) { | 65 | if (!fs::exists(filename)) { |
| 66 | - std::cerr << "Error: filename " << filename << " is not exist!" << std::endl; | 66 | + std::cerr << "Error: filename " << filename << " does not exist!" << std::endl; |
| 67 | return false; | 67 | return false; |
| 68 | } | 68 | } |
| 69 | 69 | ||
| @@ -1306,7 +1306,7 @@ bool PGOGetTilingKey(const char *config_file_path, AutofuseTilingData &tiling_da | |||
| 1306 | if (best_config == 0) { | 1306 | if (best_config == 0) { |
| 1307 | std::ifstream config_file(config_file_path); | 1307 | std::ifstream config_file(config_file_path); |
| 1308 | if (!config_file.is_open()) { | 1308 | if (!config_file.is_open()) { |
| 1309 | - OP_LOGD(OP_NAME, "failed to open or not exist: %s.", config_file_path); | 1309 | + OP_LOGD(OP_NAME, "failed to open or does not exist: %s.", config_file_path); |
| 1310 | return false; | 1310 | return false; |
| 1311 | } | 1311 | } |
| 1312 | OP_LOGD(OP_NAME, "[Start to use tiling result]: %s.", config_file_path); | 1312 | OP_LOGD(OP_NAME, "[Start to use tiling result]: %s.", config_file_path); |
| @@ -177,13 +177,13 @@ def asc_codegen_compile_module(): | |||
| 177 | 177 | ||
| 178 | 178 | ||
| 179 | class TestBuildConvArgs: | 179 | class TestBuildConvArgs: |
| 180 | - """测试 _build_conv_args 函数""" | 180 | + """Test _build_conv_args""" |
| 181 | 181 | ||
| 182 | 182 | ||
| 183 | def test_build_conv_args_basic(asc_codegen_compile_module): | 183 | def test_build_conv_args_basic(asc_codegen_compile_module): |
| 184 | - """测试基本的 Conv2D 参数构建 - 验证格式转换功能""" | 184 | + """Test basic Conv2D argument construction - verify format conversion""" |
| 185 | - # 重要:当列表长度为3时,args_list[1] == args_list[-2],会导致引用共享 | 185 | + # Important: when the list length is 3, args_list[1] == args_list[-2], causing shared references |
| 186 | - # 需要至少4个元素才能避免 args_list[1] 和 args_list[-2] 指向同一对象 | 186 | + # At least 4 elements are required to avoid args_list[1] and args_list[-2] referring to the same object |
| 187 | args_list = [ | 187 | args_list = [ |
| 188 | { | 188 | { |
| 189 | "shape": [1, 64, 224, 224], | 189 | "shape": [1, 64, 224, 224], |
| @@ -232,7 +232,7 @@ class TestBuildConvArgs: | |||
| 232 | 232 | ||
| 233 | 233 | ||
| 234 | def test_build_conv_args_nhwc_to_nchw(asc_codegen_compile_module): | 234 | def test_build_conv_args_nhwc_to_nchw(asc_codegen_compile_module): |
| 235 | - """测试 x 槽位被强制写成 NCHW""" | 235 | + """Test that the x slot is forced to NCHW""" |
| 236 | origin_inputs, origin_outputs = _build_nchw_conv_args( | 236 | origin_inputs, origin_outputs = _build_nchw_conv_args( |
| 237 | asc_codegen_compile_module, [1, 224, 224, 64], "NHWC" | 237 | asc_codegen_compile_module, [1, 224, 224, 64], "NHWC" |
| 238 | ) | 238 | ) |
| @@ -243,7 +243,7 @@ class TestBuildConvArgs: | |||
| 243 | 243 | ||
| 244 | 244 | ||
| 245 | def test_build_conv_args_same_format_no_conversion(asc_codegen_compile_module): | 245 | def test_build_conv_args_same_format_no_conversion(asc_codegen_compile_module): |
| 246 | - """测试格式相同时 shape 保持原值""" | 246 | + """Test that shape remains unchanged when formats match""" |
| 247 | origin_inputs, origin_outputs = _build_nchw_conv_args( | 247 | origin_inputs, origin_outputs = _build_nchw_conv_args( |
| 248 | asc_codegen_compile_module, [1, 64, 224, 224], "NCHW" | 248 | asc_codegen_compile_module, [1, 64, 224, 224], "NCHW" |
| 249 | ) | 249 | ) |
| @@ -253,7 +253,7 @@ class TestBuildConvArgs: | |||
| 253 | 253 | ||
| 254 | 254 | ||
| 255 | def test_build_conv_args_extend_conv2d_slots(asc_codegen_compile_module): | 255 | def test_build_conv_args_extend_conv2d_slots(asc_codegen_compile_module): |
| 256 | - """ExtendConv2D 固定 10 个逻辑输入槽,并补第二输出占位""" | 256 | + """ExtendConv2D Has 10 fixed logical input slots and adds a placeholder for the second output""" |
| 257 | args_list = [ | 257 | args_list = [ |
| 258 | {"shape": [1, 64, 56, 56], "format": "NCHW", "dtype": "float16"}, | 258 | {"shape": [1, 64, 56, 56], "format": "NCHW", "dtype": "float16"}, |
| 259 | {"shape": [64, 64, 3, 3], "format": "NCHW", "dtype": "float16"}, | 259 | {"shape": [64, 64, 3, 3], "format": "NCHW", "dtype": "float16"}, |
| @@ -290,7 +290,7 @@ class TestBuildConvArgs: | |||
| 290 | 290 | ||
| 291 | 291 | ||
| 292 | def test_build_conv_args_extend_conv2d_empty_optional(asc_codegen_compile_module): | 292 | def test_build_conv_args_extend_conv2d_empty_optional(asc_codegen_compile_module): |
| 293 | - """ExtendConv2D 无 bias/scale0 时对应槽位为空""" | 293 | + """ExtendConv2D Corresponding slots are empty without bias/scale0""" |
| 294 | args_list = [ | 294 | args_list = [ |
| 295 | {"shape": [1, 64, 56, 56], "format": "NCHW", "dtype": "float16"}, | 295 | {"shape": [1, 64, 56, 56], "format": "NCHW", "dtype": "float16"}, |
| 296 | {"shape": [64, 64, 3, 3], "format": "NCHW", "dtype": "float16"}, | 296 | {"shape": [64, 64, 3, 3], "format": "NCHW", "dtype": "float16"}, |
| @@ -315,13 +315,13 @@ class TestBuildConvArgs: | |||
| 315 | 315 | ||
| 316 | 316 | ||
| 317 | class TestGetGraphBasicInfo: | 317 | class TestGetGraphBasicInfo: |
| 318 | - """测试 get_graph_basic_info 函数新增的 is_conv 返回值""" | 318 | + """Test the new is_conv return value of get_graph_basic_info""" |
| 319 | 319 | ||
| 320 | 320 | ||
| 321 | def test_get_graph_basic_info_returns_is_conv_for_conv2d( | 321 | def test_get_graph_basic_info_returns_is_conv_for_conv2d( |
| 322 | asc_codegen_compile_module, | 322 | asc_codegen_compile_module, |
| 323 | ): | 323 | ): |
| 324 | - """测试 Conv2D 场景返回 is_conv=True""" | 324 | + """Test that the Conv2D case returns is_conv=True""" |
| 325 | params = {"vector_core_num": 8} | 325 | params = {"vector_core_num": 8} |
| 326 | 326 | ||
| 327 | class MockScheduleResults: | 327 | class MockScheduleResults: |
| @@ -368,7 +368,7 @@ class TestGetGraphBasicInfo: | |||
| 368 | def test_get_graph_basic_info_returns_is_conv_false_for_matmul( | 368 | def test_get_graph_basic_info_returns_is_conv_false_for_matmul( |
| 369 | asc_codegen_compile_module, | 369 | asc_codegen_compile_module, |
| 370 | ): | 370 | ): |
| 371 | - """测试 MatMul 场景返回 is_conv=False""" | 371 | + """Test that the MatMul case returns is_conv=False""" |
| 372 | params = {"vector_core_num": 8} | 372 | params = {"vector_core_num": 8} |
| 373 | 373 | ||
| 374 | class MockScheduleResults: | 374 | class MockScheduleResults: |
| @@ -412,13 +412,13 @@ class TestGetGraphBasicInfo: | |||
| 412 | 412 | ||
| 413 | 413 | ||
| 414 | class TestGenerateCmakeLists: | 414 | class TestGenerateCmakeLists: |
| 415 | - """测试 generate_cmake_lists 函数包含 Conv2D 编译路径""" | 415 | + """Test that generate_cmake_lists includes Conv2D compile paths""" |
| 416 | 416 | ||
| 417 | 417 | ||
| 418 | def test_generate_cmake_lists_includes_conv2d_paths( | 418 | def test_generate_cmake_lists_includes_conv2d_paths( |
| 419 | asc_codegen_compile_module, tmpdir | 419 | asc_codegen_compile_module, tmpdir |
| 420 | ): | 420 | ): |
| 421 | - """测试生成的 CMakeLists.txt 包含 Conv2D 头文件路径""" | 421 | + """Test that generated CMakeLists.txt includes Conv2D header paths""" |
| 422 | host_build_dir = str(tmpdir) | 422 | host_build_dir = str(tmpdir) |
| 423 | 423 | ||
| 424 | asc_codegen_compile_module.generate_cmake_lists( | 424 | asc_codegen_compile_module.generate_cmake_lists( |
| @@ -444,7 +444,7 @@ class TestGenerateCmakeLists: | |||
| 444 | def test_generate_cmake_lists_includes_matmul_paths( | 444 | def test_generate_cmake_lists_includes_matmul_paths( |
| 445 | asc_codegen_compile_module, tmpdir | 445 | asc_codegen_compile_module, tmpdir |
| 446 | ): | 446 | ): |
| 447 | - """测试生成的 CMakeLists.txt 包含 MatMul 头文件路径""" | 447 | + """Test that generated CMakeLists.txt includes MatMul header paths""" |
| 448 | host_build_dir = str(tmpdir) | 448 | host_build_dir = str(tmpdir) |
| 449 | 449 | ||
| 450 | asc_codegen_compile_module.generate_cmake_lists( | 450 | asc_codegen_compile_module.generate_cmake_lists( |
| @@ -465,13 +465,13 @@ class TestGenerateCmakeLists: | |||
| 465 | 465 | ||
| 466 | 466 | ||
| 467 | class TestStaticShapeCompileHasattrCheck: | 467 | class TestStaticShapeCompileHasattrCheck: |
| 468 | - """测试 static_shape_compile 函数的 hasattr 检查""" | 468 | + """Test the hasattr check in static_shape_compile""" |
| 469 | 469 | ||
| 470 | 470 | ||
| 471 | def test_static_shape_compile_related_api_keeps_argument_count( | 471 | def test_static_shape_compile_related_api_keeps_argument_count( |
| 472 | asc_codegen_compile_module, | 472 | asc_codegen_compile_module, |
| 473 | ): | 473 | ): |
| 474 | - """新增上下文参数后,相关 API 入参不超过代码检查阈值""" | 474 | + """After adding the context parameter, related API argument counts stay within the code-check threshold""" |
| 475 | function_names = [ | 475 | function_names = [ |
| 476 | "template_decider", | 476 | "template_decider", |
| 477 | "create_matmul_tiling_data", | 477 | "create_matmul_tiling_data", |
| @@ -488,7 +488,7 @@ class TestStaticShapeCompileHasattrCheck: | |||
| 488 | def test_static_shape_compile_keeps_soc_vector_core_num_by_default( | 488 | def test_static_shape_compile_keeps_soc_vector_core_num_by_default( |
| 489 | asc_codegen_compile_module, tmpdir, monkeypatch | 489 | asc_codegen_compile_module, tmpdir, monkeypatch |
| 490 | ): | 490 | ): |
| 491 | - """未传 vector_core_num 时保持原有 get_soc_spec 行为""" | 491 | + """Preserve existing get_soc_spec behavior when vector_core_num is not passed""" |
| 492 | temp_dir = str(tmpdir) | 492 | temp_dir = str(tmpdir) |
| 493 | fake_lib = SimpleNamespace(GenConstTilingData=FakeCFunc(b"new tiling")) | 493 | fake_lib = SimpleNamespace(GenConstTilingData=FakeCFunc(b"new tiling")) |
| 494 | TestStaticShapeCompileHasattrCheck._prepare_tiling_file(temp_dir) | 494 | TestStaticShapeCompileHasattrCheck._prepare_tiling_file(temp_dir) |
| @@ -506,7 +506,7 @@ class TestStaticShapeCompileHasattrCheck: | |||
| 506 | def test_static_shape_compile_uses_vector_core_num_when_provided( | 506 | def test_static_shape_compile_uses_vector_core_num_when_provided( |
| 507 | asc_codegen_compile_module, tmpdir, monkeypatch | 507 | asc_codegen_compile_module, tmpdir, monkeypatch |
| 508 | ): | 508 | ): |
| 509 | - """传入 vector_core_num 时静态化 tiling 使用同源核数""" | 509 | + """Static tiling uses the same core count when vector_core_num is passed""" |
| 510 | temp_dir = str(tmpdir) | 510 | temp_dir = str(tmpdir) |
| 511 | fake_lib = SimpleNamespace(GenConstTilingData=FakeCFunc(b"new tiling")) | 511 | fake_lib = SimpleNamespace(GenConstTilingData=FakeCFunc(b"new tiling")) |
| 512 | TestStaticShapeCompileHasattrCheck._prepare_tiling_file(temp_dir) | 512 | TestStaticShapeCompileHasattrCheck._prepare_tiling_file(temp_dir) |
| @@ -543,7 +543,7 @@ class TestStaticShapeCompileHasattrCheck: | |||
| 543 | def test_static_shape_cv_compile_uses_vector_core_num_when_provided( | 543 | def test_static_shape_cv_compile_uses_vector_core_num_when_provided( |
| 544 | asc_codegen_compile_module, tmpdir, monkeypatch | 544 | asc_codegen_compile_module, tmpdir, monkeypatch |
| 545 | ): | 545 | ): |
| 546 | - """CV 模板选择使用传入的 vector_core_num""" | 546 | + """CV Template selection uses the passed vector_core_num""" |
| 547 | fake_lib = SimpleNamespace(GenCVFusionTilingKey=FakeCFunc(0)) | 547 | fake_lib = SimpleNamespace(GenCVFusionTilingKey=FakeCFunc(0)) |
| 548 | TestStaticShapeCompileHasattrCheck._mock_static_compile_dependencies( | 548 | TestStaticShapeCompileHasattrCheck._mock_static_compile_dependencies( |
| 549 | asc_codegen_compile_module, monkeypatch, fake_lib | 549 | asc_codegen_compile_module, monkeypatch, fake_lib |
| @@ -562,7 +562,7 @@ class TestStaticShapeCompileHasattrCheck: | |||
| 562 | def test_static_shape_cv_common_compile_uses_vector_core_num_when_provided( | 562 | def test_static_shape_cv_common_compile_uses_vector_core_num_when_provided( |
| 563 | asc_codegen_compile_module, tmpdir, monkeypatch | 563 | asc_codegen_compile_module, tmpdir, monkeypatch |
| 564 | ): | 564 | ): |
| 565 | - """CV common block dim/wss 计算使用传入的 vector_core_num""" | 565 | + """CV common block dim/wss Calculation uses the passed vector_core_num""" |
| 566 | 566 | ||
| 567 | def fill_outputs(config_path, aiv_num, ub_size, workspace_size, block_dim): | 567 | def fill_outputs(config_path, aiv_num, ub_size, workspace_size, block_dim): |
| 568 | ctypes.cast( | 568 | ctypes.cast( |
| @@ -594,7 +594,7 @@ class TestStaticShapeCompileHasattrCheck: | |||
| 594 | def test_template_decider_passes_vector_core_num_to_cv_static_compile( | 594 | def test_template_decider_passes_vector_core_num_to_cv_static_compile( |
| 595 | asc_codegen_compile_module, tmpdir, monkeypatch | 595 | asc_codegen_compile_module, tmpdir, monkeypatch |
| 596 | ): | 596 | ): |
| 597 | - """CV 模板决策继续向底层静态编译透传 vector_core_num""" | 597 | + """CV Template decisions continue to pass vector_core_num to static compilation""" |
| 598 | calls = [] | 598 | calls = [] |
| 599 | monkeypatch.setattr( | 599 | monkeypatch.setattr( |
| 600 | asc_codegen_compile_module, | 600 | asc_codegen_compile_module, |
| @@ -626,7 +626,7 @@ class TestStaticShapeCompileHasattrCheck: | |||
| 626 | def test_asc_codegen_compile_logs_core_limits( | 626 | def test_asc_codegen_compile_logs_core_limits( |
| 627 | asc_codegen_compile_module, tmpdir, monkeypatch | 627 | asc_codegen_compile_module, tmpdir, monkeypatch |
| 628 | ): | 628 | ): |
| 629 | - """入口保留控核日志,并将 vector_core_num 继续透传""" | 629 | + """Keep core-count logging at the entry point and pass vector_core_num through""" |
| 630 | log_messages = [] | 630 | log_messages = [] |
| 631 | set_platform_calls = [] | 631 | set_platform_calls = [] |
| 632 | compile_calls = [] | 632 | compile_calls = [] |
| @@ -694,7 +694,7 @@ class TestStaticShapeCompileHasattrCheck: | |||
| 694 | def test_static_shape_compile_uses_hasattr_for_gen_const_tiling_data( | 694 | def test_static_shape_compile_uses_hasattr_for_gen_const_tiling_data( |
| 695 | asc_codegen_compile_module, tmpdir | 695 | asc_codegen_compile_module, tmpdir |
| 696 | ): | 696 | ): |
| 697 | - """验证 static_shape_compile 使用 hasattr 检查 GenConstTilingData""" | 697 | + """Verify that static_shape_compile uses hasattr to check GenConstTilingData""" |
| 698 | temp_dir = str(tmpdir) | 698 | temp_dir = str(tmpdir) |
| 699 | 699 | ||
| 700 | # 创建必要的目录结构 | 700 | # 创建必要的目录结构 |
| @@ -784,16 +784,16 @@ class TestStaticShapeCompileHasattrCheck: | |||
| 784 | 784 | ||
| 785 | 785 | ||
| 786 | class TestDynamicShapeCompile: | 786 | class TestDynamicShapeCompile: |
| 787 | - """测试新增的 dynamic_shape_compile 函数""" | 787 | + """Test the new dynamic_shape_compile function""" |
| 788 | 788 | ||
| 789 | 789 | ||
| 790 | def test_dynamic_shape_compile_exists(asc_codegen_compile_module): | 790 | def test_dynamic_shape_compile_exists(asc_codegen_compile_module): |
| 791 | - """验证 dynamic_shape_compile 函数存在""" | 791 | + """Verify that dynamic_shape_compile exists""" |
| 792 | assert hasattr(asc_codegen_compile_module, "dynamic_shape_compile") | 792 | assert hasattr(asc_codegen_compile_module, "dynamic_shape_compile") |
| 793 | 793 | ||
| 794 | 794 | ||
| 795 | def test_dynamic_shape_compile_signature(asc_codegen_compile_module): | 795 | def test_dynamic_shape_compile_signature(asc_codegen_compile_module): |
| 796 | - """验证 dynamic_shape_compile 函数签名""" | 796 | + """Verify the dynamic_shape_compile function signature""" |
| 797 | sig = inspect.signature(asc_codegen_compile_module.dynamic_shape_compile) | 797 | sig = inspect.signature(asc_codegen_compile_module.dynamic_shape_compile) |
| 798 | params = list(sig.parameters.keys()) | 798 | params = list(sig.parameters.keys()) |
| 799 | 799 | ||
| @@ -805,16 +805,16 @@ class TestDynamicShapeCompile: | |||
| 805 | 805 | ||
| 806 | 806 | ||
| 807 | class TestAscbcConvKernelTilingPro: | 807 | class TestAscbcConvKernelTilingPro: |
| 808 | - """测试新增的 ascbc_conv_kernel_tiling_pro 函数""" | 808 | + """Test the new ascbc_conv_kernel_tiling_pro function""" |
| 809 | 809 | ||
| 810 | 810 | ||
| 811 | def test_ascbc_conv_kernel_tiling_pro_exists(asc_codegen_compile_module): | 811 | def test_ascbc_conv_kernel_tiling_pro_exists(asc_codegen_compile_module): |
| 812 | - """验证 ascbc_conv_kernel_tiling_pro 函数存在""" | 812 | + """Verify that ascbc_conv_kernel_tiling_pro exists""" |
| 813 | assert hasattr(asc_codegen_compile_module, "ascbc_conv_kernel_tiling_pro") | 813 | assert hasattr(asc_codegen_compile_module, "ascbc_conv_kernel_tiling_pro") |
| 814 | 814 | ||
| 815 | 815 | ||
| 816 | def test_ascbc_conv_kernel_tiling_pro_signature(asc_codegen_compile_module): | 816 | def test_ascbc_conv_kernel_tiling_pro_signature(asc_codegen_compile_module): |
| 817 | - """验证函数签名""" | 817 | + """Verify the function signature""" |
| 818 | sig = inspect.signature(asc_codegen_compile_module.ascbc_conv_kernel_tiling_pro) | 818 | sig = inspect.signature(asc_codegen_compile_module.ascbc_conv_kernel_tiling_pro) |
| 819 | params = list(sig.parameters.keys()) | 819 | params = list(sig.parameters.keys()) |
| 820 | 820 | ||
| @@ -827,11 +827,11 @@ class TestAscbcConvKernelTilingPro: | |||
| 827 | 827 | ||
| 828 | 828 | ||
| 829 | class TestAscbcMatmulKernelDynamicTilingPro: | 829 | class TestAscbcMatmulKernelDynamicTilingPro: |
| 830 | - """测试新增的 ascbc_matmul_kernel_dynamic_tiling_pro 函数""" | 830 | + """Test the new ascbc_matmul_kernel_dynamic_tiling_pro function""" |
| 831 | 831 | ||
| 832 | 832 | ||
| 833 | def test_ascbc_matmul_kernel_dynamic_tiling_pro_exists(asc_codegen_compile_module): | 833 | def test_ascbc_matmul_kernel_dynamic_tiling_pro_exists(asc_codegen_compile_module): |
| 834 | - """验证函数存在""" | 834 | + """Verify that the function exists""" |
| 835 | assert hasattr( | 835 | assert hasattr( |
| 836 | asc_codegen_compile_module, "ascbc_matmul_kernel_dynamic_tiling_pro" | 836 | asc_codegen_compile_module, "ascbc_matmul_kernel_dynamic_tiling_pro" |
| 837 | ) | 837 | ) |
| @@ -840,7 +840,7 @@ class TestAscbcMatmulKernelDynamicTilingPro: | |||
| 840 | def test_ascbc_matmul_kernel_dynamic_tiling_pro_signature( | 840 | def test_ascbc_matmul_kernel_dynamic_tiling_pro_signature( |
| 841 | asc_codegen_compile_module, | 841 | asc_codegen_compile_module, |
| 842 | ): | 842 | ): |
| 843 | - """验证函数签名""" | 843 | + """Verify the function signature""" |
| 844 | sig = inspect.signature( | 844 | sig = inspect.signature( |
| 845 | asc_codegen_compile_module.ascbc_matmul_kernel_dynamic_tiling_pro | 845 | asc_codegen_compile_module.ascbc_matmul_kernel_dynamic_tiling_pro |
| 846 | ) | 846 | ) |
| @@ -567,12 +567,23 @@ def test_main_host_pgo_builds_bundle_and_skips_plain_copy( | |||
| 567 | 567 | ||
| 568 | 568 | ||
| 569 | def test_main_host_pgo_failure_falls_back_to_plain_tiling( | 569 | def test_main_host_pgo_failure_falls_back_to_plain_tiling( |
| 570 | - ascendc_compile_module, tmpdir | 570 | + ascendc_compile_module, tmpdir, monkeypatch |
| 571 | ): | 571 | ): |
| 572 | original_dir = os.getcwd() | 572 | original_dir = os.getcwd() |
| 573 | copied = [] | 573 | copied = [] |
| 574 | + warnings = [] | ||
| 574 | args = _make_host_pgo_args(tmpdir, ("/mspti", [], [])) | 575 | args = _make_host_pgo_args(tmpdir, ("/mspti", [], [])) |
| 575 | 576 | ||
| 577 | + monkeypatch.setattr( | ||
| 578 | + ascendc_compile_module.module, | ||
| 579 | + "logger", | ||
| 580 | + types.SimpleNamespace( | ||
| 581 | + info=lambda *_args: None, | ||
| 582 | + error=lambda *_args: None, | ||
| 583 | + warning=lambda message, *args: warnings.append(message % args), | ||
| 584 | + ), | ||
| 585 | + ) | ||
| 586 | + | ||
| 576 | def fake_link_tiling_so(*_): | 587 | def fake_link_tiling_so(*_): |
| 577 | return str(tmpdir.join("built_tiling.so")) | 588 | return str(tmpdir.join("built_tiling.so")) |
| 578 | 589 | ||
| @@ -596,6 +607,9 @@ def test_main_host_pgo_failure_falls_back_to_plain_tiling( | |||
| 596 | original_dir, | 607 | original_dir, |
| 597 | ) | 608 | ) |
| 598 | ] | 609 | ] |
| 610 | + assert warnings == [ | ||
| 611 | + "[PGO] Inductor PGO sidecar build failed, skip PGO: sidecar failed" | ||
| 612 | + ] | ||
| 599 | assert os.getcwd() == original_dir | 613 | assert os.getcwd() == original_dir |
| 600 | 614 | ||
| 601 | 615 | ||
| @@ -1218,11 +1232,17 @@ def test_build_pch_command_uses_cpp17(ascendc_compile_module): | |||
| 1218 | 1232 | ||
| 1219 | 1233 | ||
| 1220 | def test_compile_diagnostics_write_trace_to_default_directory( | 1234 | def test_compile_diagnostics_write_trace_to_default_directory( |
| 1221 | - ascendc_compile_module, monkeypatch, tmpdir, capsys | 1235 | + ascendc_compile_module, monkeypatch, tmpdir |
| 1222 | ): | 1236 | ): |
| 1223 | trace_dir = tmpdir.mkdir("trace") | 1237 | trace_dir = tmpdir.mkdir("trace") |
| 1224 | ascendc_compile_module.module.COMPILE_TRACE_ROOT = str(trace_dir) | 1238 | ascendc_compile_module.module.COMPILE_TRACE_ROOT = str(trace_dir) |
| 1225 | monkeypatch.setenv("AUTOFUSE_DFX_FLAGS", "codegen_compile_debug=true") | 1239 | monkeypatch.setenv("AUTOFUSE_DFX_FLAGS", "codegen_compile_debug=true") |
| 1240 | + log_messages = [] | ||
| 1241 | + monkeypatch.setattr( | ||
| 1242 | + ascendc_compile_module.module.logger, | ||
| 1243 | + "info", | ||
| 1244 | + lambda message, *args: log_messages.append(message % args), | ||
| 1245 | + ) | ||
| 1226 | 1246 | ||
| 1227 | flags = ascendc_compile_module.get_compile_diagnostic_flags("/tmp/host.o") | 1247 | flags = ascendc_compile_module.get_compile_diagnostic_flags("/tmp/host.o") |
| 1228 | 1248 | ||
| @@ -1230,10 +1250,7 @@ def test_compile_diagnostics_write_trace_to_default_directory( | |||
| 1230 | trace_flag = next(flag for flag in flags if flag.startswith("-ftime-trace=")) | 1250 | trace_flag = next(flag for flag in flags if flag.startswith("-ftime-trace=")) |
| 1231 | assert trace_flag.startswith(f"-ftime-trace={trace_dir}/host.o.") | 1251 | assert trace_flag.startswith(f"-ftime-trace={trace_dir}/host.o.") |
| 1232 | assert trace_flag.endswith(".json") | 1252 | assert trace_flag.endswith(".json") |
| 1233 | - assert ( | 1253 | + assert f"[CompileTrace] {trace_flag.removeprefix('-ftime-trace=')}" in log_messages |
| 1234 | - f"[CompileTrace] {trace_flag.removeprefix('-ftime-trace=')}" | ||
| 1235 | - in capsys.readouterr().out | ||
| 1236 | - ) | ||
| 1237 | 1254 | ||
| 1238 | 1255 | ||
| 1239 | def test_compile_diagnostics_use_unique_trace_files( | 1256 | def test_compile_diagnostics_use_unique_trace_files( |
| @@ -584,6 +584,7 @@ def test_execute_compile_scheme_a_without_mspti_keeps_pgo_proxy_runtime_linkage( | |||
| 584 | compile_adapter_module, tmpdir, monkeypatch | 584 | compile_adapter_module, tmpdir, monkeypatch |
| 585 | ): | 585 | ): |
| 586 | captured = {} | 586 | captured = {} |
| 587 | + warnings = [] | ||
| 587 | 588 | ||
| 588 | def capture_args(args): | 589 | def capture_args(args): |
| 589 | captured["args"] = args | 590 | captured["args"] = args |
| @@ -592,12 +593,22 @@ def test_execute_compile_scheme_a_without_mspti_keeps_pgo_proxy_runtime_linkage( | |||
| 592 | monkeypatch.setattr( | 593 | monkeypatch.setattr( |
| 593 | compile_adapter_module.module, "get_inductor_pgo_mspti_config", lambda: None | 594 | compile_adapter_module.module, "get_inductor_pgo_mspti_config", lambda: None |
| 594 | ) | 595 | ) |
| 596 | + monkeypatch.setattr( | ||
| 597 | + compile_adapter_module.module, | ||
| 598 | + "logger", | ||
| 599 | + types.SimpleNamespace( | ||
| 600 | + info=lambda *_args: None, | ||
| 601 | + error=lambda *_args: None, | ||
| 602 | + warning=lambda message, *args: warnings.append(message % args), | ||
| 603 | + ), | ||
| 604 | + ) | ||
| 595 | _execute_scheme_a_host_compile(compile_adapter_module, tmpdir) | 605 | _execute_scheme_a_host_compile(compile_adapter_module, tmpdir) |
| 596 | 606 | ||
| 597 | compiled_args = captured["args"] | 607 | compiled_args = captured["args"] |
| 598 | assert compiled_args.pgo_runner_file.endswith("graph_tiling_func_PgoRunner.cpp") | 608 | assert compiled_args.pgo_runner_file.endswith("graph_tiling_func_PgoRunner.cpp") |
| 599 | assert compiled_args.pgo_device_file.endswith("graph_pgo_device.cpp") | 609 | assert compiled_args.pgo_device_file.endswith("graph_pgo_device.cpp") |
| 600 | assert compiled_args.pgo_mspti_config is None | 610 | assert compiled_args.pgo_mspti_config is None |
| 611 | + assert warnings == ["[PGO] MSPTI is unavailable, skip Inductor PGO sidecars"] | ||
| 601 | 612 | ||
| 602 | 613 | ||
| 603 | def test_execute_compile_scheme_a_rejects_stage_all( | 614 | def test_execute_compile_scheme_a_rejects_stage_all( |
| @@ -120,7 +120,7 @@ std::pair<std::vector<uint32_t>, std::vector<uint32_t>> ParseBlockDimFromLog(con | |||
| 120 | return {first_tiling_blocks, second_tiling_blocks}; | 120 | return {first_tiling_blocks, second_tiling_blocks}; |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | -// 辅助函数:验证二次tiling核数大于首次tiling且大于总核数的80% | 123 | +// Verify that secondary tiling uses more than the initial tiling and 80% of total cores. |
| 124 | bool VerifySecondaryTilingCoreUsage(const std::string &filename, uint32_t total_cores = 64) { | 124 | bool VerifySecondaryTilingCoreUsage(const std::string &filename, uint32_t total_cores = 64) { |
| 125 | auto [first_blocks, second_blocks] = ParseBlockDimFromLog(filename); | 125 | auto [first_blocks, second_blocks] = ParseBlockDimFromLog(filename); |
| 126 | 126 | ||
| @@ -134,21 +134,22 @@ bool VerifySecondaryTilingCoreUsage(const std::string &filename, uint32_t total_ | |||
| 134 | uint32_t second_total = second_blocks[0] + second_blocks[1]; | 134 | uint32_t second_total = second_blocks[0] + second_blocks[1]; |
| 135 | uint32_t threshold = static_cast<uint32_t>(total_cores * 0.8); | 135 | uint32_t threshold = static_cast<uint32_t>(total_cores * 0.8); |
| 136 | 136 | ||
| 137 | - std::cout << "首次tiling核数: Group0=" << first_blocks[0] << ", Group1=" << first_blocks[1] | 137 | + std::cout << "Initial tiling core count: Group0=" << first_blocks[0] << ", Group1=" << first_blocks[1] |
| 138 | - << ", 总和=" << first_total << std::endl; | 138 | + << ", total=" << first_total << std::endl; |
| 139 | - std::cout << "二次tiling核数: Group0=" << second_blocks[0] << ", Group1=" << second_blocks[1] | 139 | + std::cout << "Secondary tiling core count: Group0=" << second_blocks[0] << ", Group1=" << second_blocks[1] |
| 140 | - << ", 总和=" << second_total << std::endl; | 140 | + << ", total=" << second_total << std::endl; |
| 141 | - std::cout << "总核数阈值(80%): " << threshold << std::endl; | 141 | + std::cout << "Total core threshold (80%): " << threshold << std::endl; |
| 142 | 142 | ||
| 143 | bool condition1 = second_total > first_total; | 143 | bool condition1 = second_total > first_total; |
| 144 | bool condition2 = second_total > threshold; | 144 | bool condition2 = second_total > threshold; |
| 145 | 145 | ||
| 146 | if (!condition1) { | 146 | if (!condition1) { |
| 147 | - std::cerr << "验证失败: 二次tiling核数(" << second_total << ") 不大于首次tiling核数(" << first_total << ")" | 147 | + std::cerr << "Validation failed: secondary tiling core count (" << second_total |
| 148 | - << std::endl; | 148 | + << ") is not greater than initial tiling core count (" << first_total << ")" << std::endl; |
| 149 | } | 149 | } |
| 150 | if (!condition2) { | 150 | if (!condition2) { |
| 151 | - std::cerr << "验证失败: 二次tiling核数(" << second_total << ") 不大于总核数的80%(" << threshold << ")" << std::endl; | 151 | + std::cerr << "Validation failed: secondary tiling core count (" << second_total |
| 152 | + << ") is not greater than 80% of total cores (" << threshold << ")" << std::endl; | ||
| 152 | } | 153 | } |
| 153 | 154 | ||
| 154 | return condition1 && condition2; | 155 | return condition1 && condition2; |
| @@ -603,7 +604,7 @@ void VerifyTwoGroupTestOutput() { | |||
| 603 | EXPECT_EQ(ResultCheckerUtils::IsFileContainsString("./info.log", "Two Group Test"), true); | 604 | EXPECT_EQ(ResultCheckerUtils::IsFileContainsString("./info.log", "Two Group Test"), true); |
| 604 | EXPECT_EQ(ResultCheckerUtils::IsFileContainsString("./info.log", "Test passed"), true); | 605 | EXPECT_EQ(ResultCheckerUtils::IsFileContainsString("./info.log", "Test passed"), true); |
| 605 | EXPECT_TRUE(VerifySecondaryTilingCoreUsage("./info.log", 64)) | 606 | EXPECT_TRUE(VerifySecondaryTilingCoreUsage("./info.log", 64)) |
| 606 | - << "二次tiling核数应该大于首次tiling且大于总核数(64)的80%"; | 607 | + << "Secondary tiling core count should exceed the initial tiling core count and 80% of total cores (64)"; |
| 607 | } | 608 | } |
| 608 | 609 | ||
| 609 | // 测试用例:两个Group,每个Group有一个AscGraph | 610 | // 测试用例:两个Group,每个Group有一个AscGraph |
| @@ -2222,8 +2222,9 @@ TEST_F(STestAscirPerfV2, TestReorderGmStrideByTransposeNddmaMultipleCases) { | |||
| 2222 | std::string description; | 2222 | std::string description; |
| 2223 | }; | 2223 | }; |
| 2224 | 2224 | ||
| 2225 | - std::vector<TestCase> test_cases = { | 2225 | + std::vector<TestCase> test_cases = {{{0, 1, 2}, {2, 1, 0}, "Full reversal"}, |
| 2226 | - {{0, 1, 2}, {2, 1, 0}, "完全反转"}, {{0, 1, 2}, {1, 0, 2}, "前两轴交换"}, {{0, 1, 2}, {0, 1, 2}, "无转置"}}; | 2226 | + {{0, 1, 2}, {1, 0, 2}, "Swap first two axes"}, |
| 2227 | + {{0, 1, 2}, {0, 1, 2}, "No transpose"}}; | ||
| 2227 | 2228 | ||
| 2228 | for (const auto &tc : test_cases) { | 2229 | for (const auto &tc : test_cases) { |
| 2229 | std::vector<att::TensorShapeInfo> input_shapes(1); | 2230 | std::vector<att::TensorShapeInfo> input_shapes(1); |
| @@ -2267,6 +2268,6 @@ TEST_F(STestAscirPerfV2, TestReorderGmStrideByTransposeNddmaMultipleCases) { | |||
| 2267 | for (auto &pipe_res : perf_res.pipe_res) { | 2268 | for (auto &pipe_res : perf_res.pipe_res) { |
| 2268 | std::cout << static_cast<int32_t>(pipe_res.first) << " PERF=" << Str(pipe_res.second) << std::endl; | 2269 | std::cout << static_cast<int32_t>(pipe_res.first) << " PERF=" << Str(pipe_res.second) << std::endl; |
| 2269 | } | 2270 | } |
| 2270 | - EXPECT_EQ(result, af::SUCCESS) << "测试用例失败: " << tc.description; | 2271 | + EXPECT_EQ(result, af::SUCCESS) << "Test case failed: " << tc.description; |
| 2271 | } | 2272 | } |
| 2272 | } | 2273 | } |
| @@ -17,8 +17,8 @@ from summary_templates import LogParser, print_summary_table | |||
| 17 | 17 | ||
| 18 | 18 | ||
| 19 | def example_1_cli_usage(): | 19 | def example_1_cli_usage(): |
| 20 | - """示例1:命令行调用(只展示命令,不会执行)""" | 20 | + """Example 1: Command-line usage (commands only; not executed)""" |
| 21 | - print("示例1:命令行调用(只展示命令,不会执行)") | 21 | + print("Example 1: Command-line usage (commands only; not executed)") |
| 22 | print("=" * 80) | 22 | print("=" * 80) |
| 23 | print("请在仓库根目录执行以下命令,并将路径替换为自己的日志或产物目录:") | 23 | print("请在仓库根目录执行以下命令,并将路径替换为自己的日志或产物目录:") |
| 24 | commands = ( | 24 | commands = ( |
| @@ -36,7 +36,7 @@ def example_1_cli_usage(): | |||
| 36 | 36 | ||
| 37 | def example_2_basic_usage(): | 37 | def example_2_basic_usage(): |
| 38 | """示例2:基本使用""" | 38 | """示例2:基本使用""" |
| 39 | - print("示例2:基本使用") | 39 | + print("Example 2: Basic usage") |
| 40 | print("=" * 80) | 40 | print("=" * 80) |
| 41 | 41 | ||
| 42 | parser = LogParser() | 42 | parser = LogParser() |
| @@ -47,7 +47,7 @@ def example_2_basic_usage(): | |||
| 47 | 47 | ||
| 48 | def example_3_multiple_operators(): | 48 | def example_3_multiple_operators(): |
| 49 | """示例3:多个算子""" | 49 | """示例3:多个算子""" |
| 50 | - print("示例3:多个算子") | 50 | + print("Example 3: Multiple operators") |
| 51 | print("=" * 80) | 51 | print("=" * 80) |
| 52 | 52 | ||
| 53 | parser = LogParser() | 53 | parser = LogParser() |
| @@ -58,23 +58,23 @@ def example_3_multiple_operators(): | |||
| 58 | 58 | ||
| 59 | def example_4_programmatic_access(): | 59 | def example_4_programmatic_access(): |
| 60 | """示例4:编程方式访问数据""" | 60 | """示例4:编程方式访问数据""" |
| 61 | - print("示例4:编程方式访问数据") | 61 | + print("Example 4: Programmatic access") |
| 62 | print("=" * 80) | 62 | print("=" * 80) |
| 63 | 63 | ||
| 64 | parser = LogParser() | 64 | parser = LogParser() |
| 65 | summaries = parser.parse_log_file("test_concat.log") | 65 | summaries = parser.parse_log_file("test_concat.log") |
| 66 | 66 | ||
| 67 | for summary in summaries: | 67 | for summary in summaries: |
| 68 | - print(f"算子名称: {summary.operator_name}") | 68 | + print(f"Operator name: {summary.operator_name}") |
| 69 | print( | 69 | print( |
| 70 | - f"选择的配置: graph{summary.graph}_result{summary.result}_g{summary.group}_case{summary.case}" | 70 | + f"Selected configuration: graph{summary.graph}_result{summary.result}_g{summary.group}_case{summary.case}" |
| 71 | ) | 71 | ) |
| 72 | - print("性能指标:") | 72 | + print("Performance metrics:") |
| 73 | print(f" - AIV_MTE2: {summary.aiv_mte2}") | 73 | print(f" - AIV_MTE2: {summary.aiv_mte2}") |
| 74 | print(f" - AIV_MTE3: {summary.aiv_mte3}") | 74 | print(f" - AIV_MTE3: {summary.aiv_mte3}") |
| 75 | print(f" - Objective Value: {summary.objective_value}") | 75 | print(f" - Objective Value: {summary.objective_value}") |
| 76 | print(f" - Result Performance: {summary.result_performance}") | 76 | print(f" - Result Performance: {summary.result_performance}") |
| 77 | - print("切分参数:") | 77 | + print("Tiling parameters:") |
| 78 | for key, value in summary.tiling_values.items(): | 78 | for key, value in summary.tiling_values.items(): |
| 79 | print(f" - {key}: {value}") | 79 | print(f" - {key}: {value}") |
| 80 | print() | 80 | print() |
| @@ -98,17 +98,17 @@ def example_5_custom_processing(): | |||
| 98 | best_operator = summary | 98 | best_operator = summary |
| 99 | 99 | ||
| 100 | if best_operator: | 100 | if best_operator: |
| 101 | - print(f"性能最好的算子: {best_operator.operator_name}") | 101 | + print(f"Best-performing operator: {best_operator.operator_name}") |
| 102 | print(f"Objective Value: {best_operator.objective_value}") | 102 | print(f"Objective Value: {best_operator.objective_value}") |
| 103 | print( | 103 | print( |
| 104 | - f"选择的配置: graph{best_operator.graph}_result{best_operator.result}_g{best_operator.group}_case{best_operator.case}" | 104 | + f"Selected configuration: graph{best_operator.graph}_result{best_operator.result}_g{best_operator.group}_case{best_operator.case}" |
| 105 | ) | 105 | ) |
| 106 | print() | 106 | print() |
| 107 | 107 | ||
| 108 | 108 | ||
| 109 | def example_6_export_to_csv(): | 109 | def example_6_export_to_csv(): |
| 110 | """示例6:导出到CSV""" | 110 | """示例6:导出到CSV""" |
| 111 | - print("示例6:导出到CSV") | 111 | + print("Example 6: Export to CSV") |
| 112 | print("=" * 80) | 112 | print("=" * 80) |
| 113 | 113 | ||
| 114 | parser = LogParser() | 114 | parser = LogParser() |
| @@ -164,7 +164,7 @@ def example_6_export_to_csv(): | |||
| 164 | 164 | ||
| 165 | writer.writerow(row) | 165 | writer.writerow(row) |
| 166 | 166 | ||
| 167 | - print("数据已导出到 output.csv") | 167 | + print("Data exported to output.csv") |
| 168 | print() | 168 | print() |
| 169 | 169 | ||
| 170 | 170 | ||
| @@ -176,4 +176,4 @@ if __name__ == "__main__": | |||
| 176 | example_5_custom_processing() | 176 | example_5_custom_processing() |
| 177 | example_6_export_to_csv() | 177 | example_6_export_to_csv() |
| 178 | 178 | ||
| 179 | - print("所有示例运行完成!") | 179 | + print("All examples completed!") |
| @@ -51,7 +51,9 @@ def parse_case_arg(value: Optional[str]) -> Optional[CaseFilter]: | |||
| 51 | raw_dim = raw_dim.strip() | 51 | raw_dim = raw_dim.strip() |
| 52 | dim = _DIM_ALIASES.get(raw_dim) | 52 | dim = _DIM_ALIASES.get(raw_dim) |
| 53 | if dim is None: | 53 | if dim is None: |
| 54 | - raise ValueError(f"未知维度: {raw_dim!r},支持 r/result/g/group/c/case") | 54 | + raise ValueError( |
| 55 | + f"Unknown dimension: {raw_dim!r}; supported values: r/result/g/group/c/case" | ||
| 56 | + ) | ||
| 55 | current_dim = dim | 57 | current_dim = dim |
| 56 | if dims[current_dim] is None: | 58 | if dims[current_dim] is None: |
| 57 | dims[current_dim] = [] | 59 | dims[current_dim] = [] |
| @@ -59,7 +61,7 @@ def parse_case_arg(value: Optional[str]) -> Optional[CaseFilter]: | |||
| 59 | else: | 61 | else: |
| 60 | if current_dim is None: | 62 | if current_dim is None: |
| 61 | raise ValueError( | 63 | raise ValueError( |
| 62 | - f"--case 解析错误:{token!r} 前缺少维度标识(r=/g=/c=)" | 64 | + f"--case parse error: missing dimension prefix before {token!r} (r=/g=/c=)" |
| 63 | ) | 65 | ) |
| 64 | dims[current_dim].append(int(token)) | 66 | dims[current_dim].append(int(token)) |
| 65 | return CaseFilter(**dims) | 67 | return CaseFilter(**dims) |
| @@ -33,7 +33,7 @@ def detect_scene(source_dir: str) -> str: | |||
| 33 | if any("tiling_func" in f and f.endswith(".cpp") for f in files): | 33 | if any("tiling_func" in f and f.endswith(".cpp") for f in files): |
| 34 | return "tf" | 34 | return "tf" |
| 35 | raise ValueError( | 35 | raise ValueError( |
| 36 | - f"无法自动检测场景:{source_dir} 中未找到 *tiling_func*.cpp 或 output_code.py" | 36 | + f"Unable to detect scene automatically: neither *tiling_func*.cpp nor output_code.py was found in {source_dir}" |
| 37 | ) | 37 | ) |
| 38 | 38 | ||
| 39 | 39 | ||
| @@ -66,8 +66,8 @@ def print_input_config(input_params: Dict, source: str) -> None: | |||
| 66 | f"dynamic_dims={input_params.get('dynamic_dims', [])}" | 66 | f"dynamic_dims={input_params.get('dynamic_dims', [])}" |
| 67 | ) | 67 | ) |
| 68 | print( | 68 | print( |
| 69 | - "[verify-tiling] aiv_num 是传入 tiling 的配置值,请根据实际设备核数检查;" | 69 | + "[verify-tiling] aiv_num is the tiling configuration value; check it against the device core count;" |
| 70 | - "如不一致可使用 --aiv-num 或 --input-json 修改" | 70 | + "use --aiv-num or --input-json to override it if they differ" |
| 71 | ) | 71 | ) |
| 72 | 72 | ||
| 73 | 73 | ||
| @@ -139,7 +139,7 @@ def extract_inductor_artifacts(output_code_py: str) -> Tuple[str, str]: | |||
| 139 | src = f.read() | 139 | src = f.read() |
| 140 | artifacts_match = re.search(r"(\w+_artifacts)\s*=\s*\{", src) | 140 | artifacts_match = re.search(r"(\w+_artifacts)\s*=\s*\{", src) |
| 141 | if not artifacts_match: | 141 | if not artifacts_match: |
| 142 | - raise ValueError("output_code.py 中未找到 *_artifacts 字典") | 142 | + raise ValueError("*_artifacts dictionary not found in output_code.py") |
| 143 | var_name = artifacts_match.group(1) | 143 | var_name = artifacts_match.group(1) |
| 144 | tree = ast.parse(src, filename=output_code_py) | 144 | tree = ast.parse(src, filename=output_code_py) |
| 145 | artifacts = None | 145 | artifacts = None |
| @@ -151,10 +151,12 @@ def extract_inductor_artifacts(output_code_py: str) -> Tuple[str, str]: | |||
| 151 | try: | 151 | try: |
| 152 | artifacts = ast.literal_eval(node.value) | 152 | artifacts = ast.literal_eval(node.value) |
| 153 | except (ValueError, TypeError, SyntaxError) as exc: | 153 | except (ValueError, TypeError, SyntaxError) as exc: |
| 154 | - raise ValueError(f"{var_name} 必须是可解析的字面量字典") from exc | 154 | + raise ValueError( |
| 155 | + f"{var_name} must be a parseable literal dictionary" | ||
| 156 | + ) from exc | ||
| 155 | break | 157 | break |
| 156 | if not isinstance(artifacts, dict): | 158 | if not isinstance(artifacts, dict): |
| 157 | - raise ValueError(f"{var_name} 不是字典") | 159 | + raise ValueError(f"{var_name} is not a dictionary") |
| 158 | return artifacts["tiling_def"], artifacts["host_impl"] | 160 | return artifacts["tiling_def"], artifacts["host_impl"] |
| 159 | 161 | ||
| 160 | 162 | ||
| @@ -324,7 +326,7 @@ def execute_tiling(so_path: str, input_params: Dict, scene: str) -> Dict: | |||
| 324 | def run(args): | 326 | def run(args): |
| 325 | source_dir = os.path.abspath(args.source_dir) | 327 | source_dir = os.path.abspath(args.source_dir) |
| 326 | if not os.path.isdir(source_dir): | 328 | if not os.path.isdir(source_dir): |
| 327 | - print(f"✗ 源目录不存在: {source_dir}") | 329 | + print(f"✗ Source directory does not exist: {source_dir}") |
| 328 | return 2 | 330 | return 2 |
| 329 | try: | 331 | try: |
| 330 | scene = args.scene or detect_scene(source_dir) | 332 | scene = args.scene or detect_scene(source_dir) |
| @@ -334,7 +336,7 @@ def run(args): | |||
| 334 | input_params = load_input_params(args) | 336 | input_params = load_input_params(args) |
| 335 | compile_cfg = load_compile_config(args) | 337 | compile_cfg = load_compile_config(args) |
| 336 | if args.log and not os.path.exists(args.log): | 338 | if args.log and not os.path.exists(args.log): |
| 337 | - print(f"✗ 日志不存在: {args.log}") | 339 | + print(f"✗ Log does not exist: {args.log}") |
| 338 | return 2 | 340 | return 2 |
| 339 | 341 | ||
| 340 | print(f"[verify-tiling] scene={scene}") | 342 | print(f"[verify-tiling] scene={scene}") |
| @@ -363,7 +365,7 @@ def run(args): | |||
| 363 | print("\n=== Compile Check ===") | 365 | print("\n=== Compile Check ===") |
| 364 | ok, result = compile_tiling(build_dir, kernel_name) | 366 | ok, result = compile_tiling(build_dir, kernel_name) |
| 365 | if not ok: | 367 | if not ok: |
| 366 | - print(f"✗ 编译失败:\n{result}") | 368 | + print(f"✗ Compilation failed:\n{result}") |
| 367 | record.update(status="COMPILE_FAILED", error=result) | 369 | record.update(status="COMPILE_FAILED", error=result) |
| 368 | return_code = 1 | 370 | return_code = 1 |
| 369 | else: | 371 | else: |
| @@ -630,9 +630,9 @@ def main(): | |||
| 630 | reporter.save_excel_report(output_file) | 630 | reporter.save_excel_report(output_file) |
| 631 | 631 | ||
| 632 | except FileNotFoundError as e: | 632 | except FileNotFoundError as e: |
| 633 | - print(f"错误: {e}") | 633 | + print(f"Error: {e}") |
| 634 | except Exception as e: | 634 | except Exception as e: |
| 635 | - print(f"错误: {e}") | 635 | + print(f"Error: {e}") |
| 636 | 636 | ||
| 637 | 637 | ||
| 638 | if __name__ == "__main__": | 638 | if __name__ == "__main__": |
| @@ -25,45 +25,45 @@ DATA_DIR = os.path.join(os.path.dirname(__file__), "..", "data") | |||
| 25 | 25 | ||
| 26 | 26 | ||
| 27 | def test_console_output(): | 27 | def test_console_output(): |
| 28 | - """测试控制台输出""" | 28 | + """Test console output""" |
| 29 | print("=" * 80) | 29 | print("=" * 80) |
| 30 | - print("测试1:控制台输出") | 30 | + print("Test 1: Console output") |
| 31 | print("=" * 80) | 31 | print("=" * 80) |
| 32 | 32 | ||
| 33 | parser = LogParser() | 33 | parser = LogParser() |
| 34 | summaries = parser.parse_log_file(os.path.join(DATA_DIR, "test_concat.log")) | 34 | summaries = parser.parse_log_file(os.path.join(DATA_DIR, "test_concat.log")) |
| 35 | print_summary_table(summaries) | 35 | print_summary_table(summaries) |
| 36 | - print("\n✅ 控制台输出测试完成\n") | 36 | + print("\n✅ Console output test completed\n") |
| 37 | 37 | ||
| 38 | 38 | ||
| 39 | def test_csv_export(): | 39 | def test_csv_export(): |
| 40 | - """测试CSV导出""" | 40 | + """Test CSV export""" |
| 41 | print("=" * 80) | 41 | print("=" * 80) |
| 42 | - print("测试2:CSV导出") | 42 | + print("Test 2: CSV export") |
| 43 | print("=" * 80) | 43 | print("=" * 80) |
| 44 | 44 | ||
| 45 | parser = LogParser() | 45 | parser = LogParser() |
| 46 | summaries = parser.parse_log_file(os.path.join(DATA_DIR, "test_complete.log")) | 46 | summaries = parser.parse_log_file(os.path.join(DATA_DIR, "test_complete.log")) |
| 47 | export_to_csv(summaries, "test_output.csv") | 47 | export_to_csv(summaries, "test_output.csv") |
| 48 | - print("✅ CSV导出测试完成\n") | 48 | + print("✅ CSV export test completed\n") |
| 49 | 49 | ||
| 50 | 50 | ||
| 51 | def test_excel_export(): | 51 | def test_excel_export(): |
| 52 | - """测试Excel导出""" | 52 | + """Test Excel export""" |
| 53 | print("=" * 80) | 53 | print("=" * 80) |
| 54 | - print("测试3:Excel导出") | 54 | + print("Test 3: Excel export") |
| 55 | print("=" * 80) | 55 | print("=" * 80) |
| 56 | 56 | ||
| 57 | parser = LogParser() | 57 | parser = LogParser() |
| 58 | summaries = parser.parse_log_file(os.path.join(DATA_DIR, "test_complete.log")) | 58 | summaries = parser.parse_log_file(os.path.join(DATA_DIR, "test_complete.log")) |
| 59 | export_to_excel(summaries, "test_output.xlsx") | 59 | export_to_excel(summaries, "test_output.xlsx") |
| 60 | - print("✅ Excel导出测试完成\n") | 60 | + print("✅ Excel export test completed\n") |
| 61 | 61 | ||
| 62 | 62 | ||
| 63 | def test_no_duplicate_performance_keys(): | 63 | def test_no_duplicate_performance_keys(): |
| 64 | - """测试性能指标不重复显示""" | 64 | + """Test that performance metrics are not duplicated""" |
| 65 | print("=" * 80) | 65 | print("=" * 80) |
| 66 | - print("测试4:验证AIV_MTE2/AIV_MTE3不重复显示") | 66 | + print("Test 4: Verify that AIV_MTE2/AIV_MTE3 are not duplicated") |
| 67 | print("=" * 80) | 67 | print("=" * 80) |
| 68 | 68 | ||
| 69 | parser = LogParser() | 69 | parser = LogParser() |
| @@ -78,13 +78,13 @@ def test_no_duplicate_performance_keys(): | |||
| 78 | all_tiling_keys - set(["ub_size", "block_dim"]) - set(performance_keys) | 78 | all_tiling_keys - set(["ub_size", "block_dim"]) - set(performance_keys) |
| 79 | ) | 79 | ) |
| 80 | 80 | ||
| 81 | - print(f"所有切分键: {sorted(all_tiling_keys)}") | 81 | + print(f"All tiling keys: {sorted(all_tiling_keys)}") |
| 82 | - print(f"动态切分键(排除性能指标): {dynamic_tiling_keys}") | 82 | + print(f"Dynamic tiling keys (excluding performance metrics): {dynamic_tiling_keys}") |
| 83 | 83 | ||
| 84 | if "AIV_MTE2" not in dynamic_tiling_keys and "AIV_MTE3" not in dynamic_tiling_keys: | 84 | if "AIV_MTE2" not in dynamic_tiling_keys and "AIV_MTE3" not in dynamic_tiling_keys: |
| 85 | - print("✅ AIV_MTE2和AIV_MTE3没有在动态切分键中重复显示\n") | 85 | + print("✅ AIV_MTE2 and AIV_MTE3 are not duplicated in dynamic tiling keys\n") |
| 86 | else: | 86 | else: |
| 87 | - print("❌ AIV_MTE2或AIV_MTE3在动态切分键中重复显示\n") | 87 | + print("❌ AIV_MTE2 or AIV_MTE3 are duplicated in dynamic tiling keys\n") |
| 88 | 88 | ||
| 89 | 89 | ||
| 90 | if __name__ == "__main__": | 90 | if __name__ == "__main__": |
| @@ -94,5 +94,5 @@ if __name__ == "__main__": | |||
| 94 | test_no_duplicate_performance_keys() | 94 | test_no_duplicate_performance_keys() |
| 95 | 95 | ||
| 96 | print("=" * 80) | 96 | print("=" * 80) |
| 97 | - print("所有测试完成!") | 97 | + print("All tests completed!") |
| 98 | print("=" * 80) | 98 | print("=" * 80) |
| @@ -15,9 +15,9 @@ | |||
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | def test_regex_pattern(): | 17 | def test_regex_pattern(): |
| 18 | - """测试正则表达式是否正确排除AIV_MTE2/AIV_MTE3""" | 18 | + """Test that the regular expression correctly excludes AIV_MTE2/AIV_MTE3""" |
| 19 | 19 | ||
| 20 | - # 模拟tiling_values | 20 | + # Mock tiling_values |
| 21 | tiling_values = { | 21 | tiling_values = { |
| 22 | "s0t_size": 256, | 22 | "s0t_size": 256, |
| 23 | "s1Ts0Tb_size": 4096, | 23 | "s1Ts0Tb_size": 4096, |
| @@ -36,23 +36,23 @@ def test_regex_pattern(): | |||
| 36 | all_tiling_keys - set(fixed_tiling_keys) - set(performance_keys) | 36 | all_tiling_keys - set(fixed_tiling_keys) - set(performance_keys) |
| 37 | ) | 37 | ) |
| 38 | 38 | ||
| 39 | - print("验证AIV_MTE2/AIV_MTE3不重复显示") | 39 | + print("Verify that AIV_MTE2/AIV_MTE3 are not duplicated") |
| 40 | print("=" * 80) | 40 | print("=" * 80) |
| 41 | - print(f"所有切分键: {sorted(all_tiling_keys)}") | 41 | + print(f"All tiling keys: {sorted(all_tiling_keys)}") |
| 42 | - print(f"固定切分键: {fixed_tiling_keys}") | 42 | + print(f"Fixed tiling keys: {fixed_tiling_keys}") |
| 43 | - print(f"性能指标键: {performance_keys}") | 43 | + print(f"Performance metric keys: {performance_keys}") |
| 44 | - print(f"动态切分键(排除性能指标): {dynamic_tiling_keys}") | 44 | + print(f"Dynamic tiling keys (excluding performance metrics): {dynamic_tiling_keys}") |
| 45 | print() | 45 | print() |
| 46 | 46 | ||
| 47 | # 验证 | 47 | # 验证 |
| 48 | if "AIV_MTE2" in dynamic_tiling_keys: | 48 | if "AIV_MTE2" in dynamic_tiling_keys: |
| 49 | - print("❌ 错误:AIV_MTE2在动态切分键中重复显示") | 49 | + print("❌ Error: AIV_MTE2 is duplicated in dynamic tiling keys") |
| 50 | return False | 50 | return False |
| 51 | if "AIV_MTE3" in dynamic_tiling_keys: | 51 | if "AIV_MTE3" in dynamic_tiling_keys: |
| 52 | - print("❌ 错误:AIV_MTE3在动态切分键中重复显示") | 52 | + print("❌ Error: AIV_MTE3 is duplicated in dynamic tiling keys") |
| 53 | return False | 53 | return False |
| 54 | 54 | ||
| 55 | - print("✅ 正确:AIV_MTE2和AIV_MTE3没有在动态切分键中重复显示") | 55 | + print("✅ Correct: AIV_MTE2 and AIV_MTE3 are not duplicated in dynamic tiling keys") |
| 56 | print() | 56 | print() |
| 57 | 57 | ||
| 58 | # 显示最终列顺序 | 58 | # 显示最终列顺序 |
| @@ -70,7 +70,7 @@ def test_regex_pattern(): | |||
| 70 | all_columns.extend(dynamic_tiling_keys) | 70 | all_columns.extend(dynamic_tiling_keys) |
| 71 | all_columns.extend(fixed_tiling_keys) | 71 | all_columns.extend(fixed_tiling_keys) |
| 72 | 72 | ||
| 73 | - print("最终列顺序:") | 73 | + print("Final column order:") |
| 74 | for i, col in enumerate(all_columns, 1): | 74 | for i, col in enumerate(all_columns, 1): |
| 75 | print(f" {i}. {col}") | 75 | print(f" {i}. {col}") |
| 76 | 76 | ||
| @@ -80,6 +80,6 @@ def test_regex_pattern(): | |||
| 80 | if __name__ == "__main__": | 80 | if __name__ == "__main__": |
| 81 | success = test_regex_pattern() | 81 | success = test_regex_pattern() |
| 82 | if success: | 82 | if success: |
| 83 | - print("\n✅ 验证通过!") | 83 | + print("\n✅ Verification passed!") |
| 84 | else: | 84 | else: |
| 85 | - print("\n❌ 验证失败!") | 85 | + print("\n❌ Verification failed!") |
| @@ -45,7 +45,7 @@ def test_examples_start_with_cli_usage(capsys): | |||
| 45 | examples.example_1_cli_usage() | 45 | examples.example_1_cli_usage() |
| 46 | output = capsys.readouterr().out | 46 | output = capsys.readouterr().out |
| 47 | 47 | ||
| 48 | - assert output.startswith("示例1:命令行调用") | 48 | + assert output.startswith("Example 1: Command-line usage") |
| 49 | for command in ( | 49 | for command in ( |
| 50 | "summary", | 50 | "summary", |
| 51 | "compare", | 51 | "compare", |
| @@ -47,7 +47,7 @@ def make_case(result_id=1, group_id=0, case_id=0): | |||
| 47 | 47 | ||
| 48 | 48 | ||
| 49 | class TestRenderOpSection(unittest.TestCase): | 49 | class TestRenderOpSection(unittest.TestCase): |
| 50 | - """render_svg 返回 (svg_fragment, height) 元组,fragment 是 <g> 元素""" | 50 | + """render_svg returns (svg_fragment, height) tuple; fragment is <g> element""" |
| 51 | 51 | ||
| 52 | def test_produces_g_fragment(self): | 52 | def test_produces_g_fragment(self): |
| 53 | cases = [make_case()] | 53 | cases = [make_case()] |
| @@ -72,7 +72,7 @@ class TestRenderOpSection(unittest.TestCase): | |||
| 72 | 72 | ||
| 73 | 73 | ||
| 74 | class TestBuildFullSvg(unittest.TestCase): | 74 | class TestBuildFullSvg(unittest.TestCase): |
| 75 | - """build_full_svg 将多个算子 section 合并为合法单 SVG""" | 75 | + """build_full_svg combines multiple operator sections into a valid single SVG""" |
| 76 | 76 | ||
| 77 | def test_single_root_svg(self): | 77 | def test_single_root_svg(self): |
| 78 | sections = [ | 78 | sections = [ |
| @@ -62,7 +62,7 @@ def load_graph(json_path): | |||
| 62 | def get_ops(graph_data): | 62 | def get_ops(graph_data): |
| 63 | graphs = graph_data.get("graph", []) | 63 | graphs = graph_data.get("graph", []) |
| 64 | if not graphs: | 64 | if not graphs: |
| 65 | - print("WARNING: 图 JSON 中没有找到 graph 数组") | 65 | + print("WARNING: graph array not found in graph JSON") |
| 66 | return [] | 66 | return [] |
| 67 | return graphs[0].get("op", []) | 67 | return graphs[0].get("op", []) |
| 68 | 68 | ||
| @@ -100,8 +100,8 @@ def extract_output_mappings(op, fused_op_name): | |||
| 100 | fused_format = desc.get("layout") | 100 | fused_format = desc.get("layout") |
| 101 | if origin_name is None or origin_output_index is None: | 101 | if origin_name is None or origin_output_index is None: |
| 102 | print( | 102 | print( |
| 103 | - f"WARNING: 融合算子 {fused_op_name} 输出 {idx} 缺少 " | 103 | + f"WARNING: Fused operator {fused_op_name} output {idx} is missing " |
| 104 | - "_datadump_origin_name 或 _datadump_origin_output_index,跳过" | 104 | + "_datadump_origin_name or _datadump_origin_output_index; skipping" |
| 105 | ) | 105 | ) |
| 106 | mappings.append( | 106 | mappings.append( |
| 107 | { | 107 | { |
| @@ -134,7 +134,7 @@ def extract_input_mappings(op, fused_op_name): | |||
| 134 | for idx, ref in enumerate(input_refs): | 134 | for idx, ref in enumerate(input_refs): |
| 135 | if ":" not in ref: | 135 | if ":" not in ref: |
| 136 | print( | 136 | print( |
| 137 | - f"WARNING: 融合算子 {fused_op_name} 输入 {idx} 引用格式无法解析: {ref},跳过" | 137 | + f"WARNING: Reference format cannot be parsed for fused operator {fused_op_name} input {idx}: {ref}; skipping" |
| 138 | ) | 138 | ) |
| 139 | mappings.append( | 139 | mappings.append( |
| 140 | { | 140 | { |
| @@ -229,7 +229,7 @@ def find_npy(data_dir, op_name, kind, index): | |||
| 229 | if not matches: | 229 | if not matches: |
| 230 | return None | 230 | return None |
| 231 | if len(matches) > 1: | 231 | if len(matches) > 1: |
| 232 | - print(f"WARNING: 匹配到多个 NPY 文件,使用第一个: {matches}") | 232 | + print(f"WARNING: Multiple NPY files matched; using the first: {matches}") |
| 233 | return matches[0] | 233 | return matches[0] |
| 234 | 234 | ||
| 235 | 235 | ||
| @@ -301,17 +301,17 @@ class NpySource: | |||
| 301 | 301 | ||
| 302 | def compare_data(fused_src: NpySource, origin_src: NpySource): | 302 | def compare_data(fused_src: NpySource, origin_src: NpySource): |
| 303 | if fused_src.npy_path is None: | 303 | if fused_src.npy_path is None: |
| 304 | - print(f"WARNING: 未找到融合侧 NPY: {fused_src.label}") | 304 | + print(f"WARNING: Fused-side NPY not found: {fused_src.label}") |
| 305 | return None, None, None, "FILE_NOT_FOUND" | 305 | return None, None, None, "FILE_NOT_FOUND" |
| 306 | if origin_src.npy_path is None: | 306 | if origin_src.npy_path is None: |
| 307 | - print(f"WARNING: 未找到原算子侧 NPY: {origin_src.label}") | 307 | + print(f"WARNING: Original-side NPY not found: {origin_src.label}") |
| 308 | return None, None, None, "FILE_NOT_FOUND" | 308 | return None, None, None, "FILE_NOT_FOUND" |
| 309 | 309 | ||
| 310 | try: | 310 | try: |
| 311 | fused_data = load_npy(fused_src.npy_path) | 311 | fused_data = load_npy(fused_src.npy_path) |
| 312 | origin_data = load_npy(origin_src.npy_path) | 312 | origin_data = load_npy(origin_src.npy_path) |
| 313 | except Exception as e: | 313 | except Exception as e: |
| 314 | - print(f"WARNING: NPY 加载失败 - {fused_src.label} / {origin_src.label}: {e}") | 314 | + print(f"WARNING: NPY Load failed - {fused_src.label} / {origin_src.label}: {e}") |
| 315 | return None, None, None, "NPY_LOAD_ERROR" | 315 | return None, None, None, "NPY_LOAD_ERROR" |
| 316 | 316 | ||
| 317 | status_parts = [] | 317 | status_parts = [] |
| @@ -321,7 +321,7 @@ def compare_data(fused_src: NpySource, origin_src: NpySource): | |||
| 321 | ) | 321 | ) |
| 322 | if fmt_parts is None: | 322 | if fmt_parts is None: |
| 323 | print( | 323 | print( |
| 324 | - f"WARNING: 不支持的 format 转换 - {fused_src.label}: {fused_src.fmt}" | 324 | + f"WARNING: Unsupported format conversion - {fused_src.label}: {fused_src.fmt}" |
| 325 | f" vs {origin_src.label}: {origin_src.fmt}" | 325 | f" vs {origin_src.label}: {origin_src.fmt}" |
| 326 | ) | 326 | ) |
| 327 | return None, None, None, "FORMAT_UNSUPPORTED" | 327 | return None, None, None, "FORMAT_UNSUPPORTED" |
| @@ -338,7 +338,7 @@ def compare_data(fused_src: NpySource, origin_src: NpySource): | |||
| 338 | status_parts.append("SHAPE_FLATTENED") | 338 | status_parts.append("SHAPE_FLATTENED") |
| 339 | else: | 339 | else: |
| 340 | print( | 340 | print( |
| 341 | - f"WARNING: shape 不一致且元素数不同 - {fused_src.label}: {fused_data.shape}" | 341 | + f"WARNING: Shape mismatch with different element counts - {fused_src.label}: {fused_data.shape}" |
| 342 | f" vs {origin_src.label}: {origin_data.shape}" | 342 | f" vs {origin_src.label}: {origin_data.shape}" |
| 343 | ) | 343 | ) |
| 344 | return None, None, None, "SHAPE_MISMATCH" | 344 | return None, None, None, "SHAPE_MISMATCH" |
| @@ -346,7 +346,9 @@ def compare_data(fused_src: NpySource, origin_src: NpySource): | |||
| 346 | try: | 346 | try: |
| 347 | cosine, max_abs, max_rel = compute_metrics(fused_data, origin_data) | 347 | cosine, max_abs, max_rel = compute_metrics(fused_data, origin_data) |
| 348 | except Exception as e: | 348 | except Exception as e: |
| 349 | - print(f"WARNING: 指标计算失败 - {fused_src.label} / {origin_src.label}: {e}") | 349 | + print( |
| 350 | + f"WARNING: Metric calculation failed - {fused_src.label} / {origin_src.label}: {e}" | ||
| 351 | + ) | ||
| 350 | return None, None, None, "COMPUTE_ERROR" | 352 | return None, None, None, "COMPUTE_ERROR" |
| 351 | 353 | ||
| 352 | return cosine, max_abs, max_rel, "_".join(status_parts) if status_parts else "OK" | 354 | return cosine, max_abs, max_rel, "_".join(status_parts) if status_parts else "OK" |
| @@ -540,14 +542,14 @@ def validate_mode1_args(args): | |||
| 540 | def run_mode1(args): | 542 | def run_mode1(args): |
| 541 | validate_mode1_args(args) | 543 | validate_mode1_args(args) |
| 542 | 544 | ||
| 543 | - print(f"解析开启融合 dump 图: {args.af_open_graph}") | 545 | + print(f"Parsing fusion-enabled dump graph: {args.af_open_graph}") |
| 544 | graph_data = load_graph(args.af_open_graph) | 546 | graph_data = load_graph(args.af_open_graph) |
| 545 | ops = get_ops(graph_data) | 547 | ops = get_ops(graph_data) |
| 546 | node_types, _ = build_node_lookup(ops) | 548 | node_types, _ = build_node_lookup(ops) |
| 547 | output_mappings, input_mappings = extract_fusion_mappings(graph_data) | 549 | output_mappings, input_mappings = extract_fusion_mappings(graph_data) |
| 548 | fused_output_resolver = build_fused_output_resolver(output_mappings) | 550 | fused_output_resolver = build_fused_output_resolver(output_mappings) |
| 549 | 551 | ||
| 550 | - print(f"解析关闭融合 dump 图: {args.af_close_graph}") | 552 | + print(f"Parsing fusion-disabled dump graph: {args.af_close_graph}") |
| 551 | af_close_graph_data = load_graph(args.af_close_graph) | 553 | af_close_graph_data = load_graph(args.af_close_graph) |
| 552 | af_close_ops = get_ops(af_close_graph_data) | 554 | af_close_ops = get_ops(af_close_graph_data) |
| 553 | _, af_close_node_formats = build_node_lookup(af_close_ops) | 555 | _, af_close_node_formats = build_node_lookup(af_close_ops) |
| @@ -560,11 +562,11 @@ def run_mode1(args): | |||
| 560 | continue | 562 | continue |
| 561 | resolve_source(m, fused_output_resolver, node_types) | 563 | resolve_source(m, fused_output_resolver, node_types) |
| 562 | print( | 564 | print( |
| 563 | - f"找到 {len(output_mappings)} 个融合算子输出映射, " | 565 | + f"Found {len(output_mappings)} fused operator output mappings, " |
| 564 | - f"{len(input_mappings)} 个融合算子输入映射\n" | 566 | + f"{len(input_mappings)} fused operator input mappings\n" |
| 565 | ) | 567 | ) |
| 566 | else: | 568 | else: |
| 567 | - print(f"找到 {len(output_mappings)} 个融合算子输出映射\n") | 569 | + print(f"Found {len(output_mappings)} fused operator output mappings\n") |
| 568 | 570 | ||
| 569 | results = [] | 571 | results = [] |
| 570 | for mapping in output_mappings: | 572 | for mapping in output_mappings: |
| @@ -180,7 +180,7 @@ bool IsB64TransferCast(const NodeDetail &node_info) { | |||
| 180 | Expr GetUnaryBitWidthChangeCallCount(const NodeDetail &node_info, Expr &cal_count) { | 180 | Expr GetUnaryBitWidthChangeCallCount(const NodeDetail &node_info, Expr &cal_count) { |
| 181 | const auto ¶ms = node_info.unary_bitwidth_change_node_params; | 181 | const auto ¶ms = node_info.unary_bitwidth_change_node_params; |
| 182 | if (!params.valid) { | 182 | if (!params.valid) { |
| 183 | - GE_ASSERT_TRUE(!node_info.input_dims.empty(), "Unary bitwidth change input dims is empty."); | 183 | + GE_ASSERT_TRUE(!node_info.input_dims.empty(), "Unary bitwidth change input dims are empty."); |
| 184 | cal_count = ProductExprs(node_info.input_dims, node_info.input_dims.size()); | 184 | cal_count = ProductExprs(node_info.input_dims, node_info.input_dims.size()); |
| 185 | return CreateExpr(1); | 185 | return CreateExpr(1); |
| 186 | } | 186 | } |
| @@ -1726,7 +1726,7 @@ af::Status AddWhereExtend2DPerf(const NodeDetail &node_info, Expr &max_latency, | |||
| 1726 | 1726 | ||
| 1727 | af::Status AddWhereExtendPerf(const NodeDetail &node_info, Expr &max_latency, Expr &all_vf_instruct_cost) { | 1727 | af::Status AddWhereExtendPerf(const NodeDetail &node_info, Expr &max_latency, Expr &all_vf_instruct_cost) { |
| 1728 | const auto ¶ms = node_info.where_node_params; | 1728 | const auto ¶ms = node_info.where_node_params; |
| 1729 | - GE_ASSERT_TRUE(!params.output_dims.empty(), "Where output dims is empty."); | 1729 | + GE_ASSERT_TRUE(!params.output_dims.empty(), "Where output dims are empty."); |
| 1730 | GE_ASSERT_TRUE(!node_info.output_dtype.empty(), "Where output dtype is empty."); | 1730 | GE_ASSERT_TRUE(!node_info.output_dtype.empty(), "Where output dtype is empty."); |
| 1731 | if (params.output_dims.size() == 1U) { | 1731 | if (params.output_dims.size() == 1U) { |
| 1732 | return AddWhereImplPerf(node_info, max_latency, all_vf_instruct_cost); | 1732 | return AddWhereImplPerf(node_info, max_latency, all_vf_instruct_cost); |
| @@ -127,12 +127,12 @@ af::Status BuildReduceContext(const std::vector<TensorShapeInfo> &input_shapes, | |||
| 127 | const std::vector<TensorShapeInfo> &output_shapes, const NodeInfo &node, | 127 | const std::vector<TensorShapeInfo> &output_shapes, const NodeInfo &node, |
| 128 | ascendcapi_v2::ReduceApiPerfContext &context) { | 128 | ascendcapi_v2::ReduceApiPerfContext &context) { |
| 129 | const auto ¶ms = node.reduce_specific_params; | 129 | const auto ¶ms = node.reduce_specific_params; |
| 130 | - GE_ASSERT_SUCCESS(ascir_param::ValidateReduceNodeParams(params), "Reduce specific params is invalid, node[%s].", | 130 | + GE_ASSERT_SUCCESS(ascir_param::ValidateReduceNodeParams(params), "Reduce specific params are invalid, node[%s].", |
| 131 | node.name.c_str()); | 131 | node.name.c_str()); |
| 132 | const auto &codegen_params = ascir_param::GetCanonicalReduceParams(params); | 132 | const auto &codegen_params = ascir_param::GetCanonicalReduceParams(params); |
| 133 | GE_ASSERT_TRUE(!input_shapes.empty() && !output_shapes.empty()); | 133 | GE_ASSERT_TRUE(!input_shapes.empty() && !output_shapes.empty()); |
| 134 | GE_ASSERT_SUCCESS(SetNodeDetail(input_shapes, output_shapes, context.node_detail)); | 134 | GE_ASSERT_SUCCESS(SetNodeDetail(input_shapes, output_shapes, context.node_detail)); |
| 135 | - GE_ASSERT_TRUE(!context.node_detail.input_dims.empty(), "Reduce input dims is empty, node[%s].", node.name.c_str()); | 135 | + GE_ASSERT_TRUE(!context.node_detail.input_dims.empty(), "Reduce input dims are empty, node[%s].", node.name.c_str()); |
| 136 | GE_ASSERT_SUCCESS(ConvertReducePattern(codegen_params.pattern, context.pattern)); | 136 | GE_ASSERT_SUCCESS(ConvertReducePattern(codegen_params.pattern, context.pattern)); |
| 137 | GE_ASSERT_SUCCESS(ConvertReduceMergeMode(codegen_params.merge_mode, context.merge_mode)); | 137 | GE_ASSERT_SUCCESS(ConvertReduceMergeMode(codegen_params.merge_mode, context.merge_mode)); |
| 138 | codegen::ReduceSpecificParams current_shape_params; | 138 | codegen::ReduceSpecificParams current_shape_params; |
| @@ -40,7 +40,7 @@ af::Status FillCastNodeParams(const af::AscNodePtr &node, const std::vector<ge:: | |||
| 40 | params->specific_params = ascir_param::CastNodeParams{}; | 40 | params->specific_params = ascir_param::CastNodeParams{}; |
| 41 | cast_params = std::get_if<ascir_param::CastNodeParams>(¶ms->specific_params); | 41 | cast_params = std::get_if<ascir_param::CastNodeParams>(¶ms->specific_params); |
| 42 | } | 42 | } |
| 43 | - GE_ASSERT_NOTNULL(cast_params, "Cast specific params is null, node[%s].", node->GetNamePtr()); | 43 | + GE_ASSERT_NOTNULL(cast_params, "Cast specific params are null, node[%s].", node->GetNamePtr()); |
| 44 | params->api_name = node->GetType(); | 44 | params->api_name = node->GetType(); |
| 45 | params->status = ascir_param::ParamBuildStatus::kBuilt; | 45 | params->status = ascir_param::ParamBuildStatus::kBuilt; |
| 46 | 46 | ||
| @@ -41,7 +41,7 @@ af::Status FillCompareNodeParams(const af::AscNodePtr &node, bool is_scalar, con | |||
| 41 | params->specific_params = ascir_param::CompareNodeParams{}; | 41 | params->specific_params = ascir_param::CompareNodeParams{}; |
| 42 | compare_params = std::get_if<ascir_param::CompareNodeParams>(¶ms->specific_params); | 42 | compare_params = std::get_if<ascir_param::CompareNodeParams>(¶ms->specific_params); |
| 43 | } | 43 | } |
| 44 | - GE_ASSERT_NOTNULL(compare_params, "Compare specific params is null, node[%s].", node->GetNamePtr()); | 44 | + GE_ASSERT_NOTNULL(compare_params, "Compare specific params are null, node[%s].", node->GetNamePtr()); |
| 45 | params->api_name = node->GetType(); | 45 | params->api_name = node->GetType(); |
| 46 | params->status = ascir_param::ParamBuildStatus::kBuilt; | 46 | params->status = ascir_param::ParamBuildStatus::kBuilt; |
| 47 | 47 | ||
| @@ -83,7 +83,8 @@ af::Status BuildTensorWindowInfo(const ascgen_utils::indirect_load::IndirectLoad | |||
| 83 | const Tensor &tensor, size_t axis_pos, LogicalTensorInfo &info) { | 83 | const Tensor &tensor, size_t axis_pos, LogicalTensorInfo &info) { |
| 84 | GE_ASSERT_TRUE(layout.axis_ids.size() == layout.sizes.size() && layout.sizes.size() == layout.strides.size(), | 84 | GE_ASSERT_TRUE(layout.axis_ids.size() == layout.sizes.size() && layout.sizes.size() == layout.strides.size(), |
| 85 | "IndirectLoad tensor window layout rank mismatch."); | 85 | "IndirectLoad tensor window layout rank mismatch."); |
| 86 | - GE_ASSERT_TRUE(axis_pos < layout.sizes.size(), "IndirectLoad tensor window axis is out of range."); | 86 | + GE_ASSERT_TRUE(axis_pos < layout.sizes.size(), "IndirectLoad tensor window axis %zu is out of range [0, %zu).", |
| 87 | + axis_pos, layout.sizes.size()); | ||
| 87 | GE_ASSERT_TRUE(tensor.vectorized_axis.size() == tensor.vectorized_strides.size(), | 88 | GE_ASSERT_TRUE(tensor.vectorized_axis.size() == tensor.vectorized_strides.size(), |
| 88 | "IndirectLoad tensor vectorized axis/stride rank mismatch."); | 89 | "IndirectLoad tensor vectorized axis/stride rank mismatch."); |
| 89 | info = LogicalTensorInfo(layout); | 90 | info = LogicalTensorInfo(layout); |
| @@ -736,7 +737,8 @@ Status IndirectLoadRegApiCall::ParseAttr(const ascir::NodeView &node) { | |||
| 736 | GE_ASSERT_SUCCESS(ascgen_utils::indirect_load::AnalyzeIndirectLoadAccess(node, logical_view_, access_info_)); | 737 | GE_ASSERT_SUCCESS(ascgen_utils::indirect_load::AnalyzeIndirectLoadAccess(node, logical_view_, access_info_)); |
| 737 | GE_ASSERT_SUCCESS(ascgen_utils::indirect_load::GetImplementation(node, implementation_)); | 738 | GE_ASSERT_SUCCESS(ascgen_utils::indirect_load::GetImplementation(node, implementation_)); |
| 738 | const int64_t rank = static_cast<int64_t>(logical_view_.input.sizes.size()); | 739 | const int64_t rank = static_cast<int64_t>(logical_view_.input.sizes.size()); |
| 739 | - GE_ASSERT_TRUE(axis >= -rank && axis < rank, "IndirectLoad axis is out of range."); | 740 | + GE_ASSERT_TRUE(axis >= -rank && axis < rank, "IndirectLoad axis %ld is out of range [%ld, %ld).", axis, -rank, |
| 741 | + rank); | ||
| 740 | axis_ = axis < 0L ? axis + rank : axis; | 742 | axis_ = axis < 0L ? axis + rank : axis; |
| 741 | } else { | 743 | } else { |
| 742 | ascgen_utils::indirect_load::IndirectLoadLoweringMetadata metadata; | 744 | ascgen_utils::indirect_load::IndirectLoadLoweringMetadata metadata; |
| @@ -168,7 +168,7 @@ af::Status FillTransposeNodeParams(const af::AscNodePtr &node, | |||
| 168 | params->specific_params = ascir_param::TransposeNodeParams{}; | 168 | params->specific_params = ascir_param::TransposeNodeParams{}; |
| 169 | transpose_params = std::get_if<ascir_param::TransposeNodeParams>(¶ms->specific_params); | 169 | transpose_params = std::get_if<ascir_param::TransposeNodeParams>(¶ms->specific_params); |
| 170 | } | 170 | } |
| 171 | - GE_ASSERT_NOTNULL(transpose_params, "Transpose specific params is null, node[%s].", node->GetNamePtr()); | 171 | + GE_ASSERT_NOTNULL(transpose_params, "Transpose specific params are null, node[%s].", node->GetNamePtr()); |
| 172 | params->api_name = node->GetType(); | 172 | params->api_name = node->GetType(); |
| 173 | params->status = ascir_param::ParamBuildStatus::kBuilt; | 173 | params->status = ascir_param::ParamBuildStatus::kBuilt; |
| 174 | 174 | ||
| @@ -43,7 +43,7 @@ af::Status FillWhereNodeParams(const af::AscNodePtr &node, bool is_bcast_src0, b | |||
| 43 | params->specific_params = ascir_param::WhereNodeParams{}; | 43 | params->specific_params = ascir_param::WhereNodeParams{}; |
| 44 | where_params = std::get_if<ascir_param::WhereNodeParams>(¶ms->specific_params); | 44 | where_params = std::get_if<ascir_param::WhereNodeParams>(¶ms->specific_params); |
| 45 | } | 45 | } |
| 46 | - GE_ASSERT_NOTNULL(where_params, "Where specific params is null, node[%s].", node->GetNamePtr()); | 46 | + GE_ASSERT_NOTNULL(where_params, "Where specific params are null, node[%s].", node->GetNamePtr()); |
| 47 | params->api_name = node->GetType(); | 47 | params->api_name = node->GetType(); |
| 48 | params->status = ascir_param::ParamBuildStatus::kBuilt; | 48 | params->status = ascir_param::ParamBuildStatus::kBuilt; |
| 49 | 49 | ||
| @@ -47,7 +47,7 @@ Status SplitRegApiCall::ParseSplitDim(const Tensor &x, const Tensor &y0, size_t | |||
| 47 | break; | 47 | break; |
| 48 | } | 48 | } |
| 49 | } | 49 | } |
| 50 | - GE_ASSERT_TRUE(find_split_dim, "not find split dim in vectorized_axis"); | 50 | + GE_ASSERT_TRUE(find_split_dim, "split dim was not found in vectorized_axis"); |
| 51 | return af::SUCCESS; | 51 | return af::SUCCESS; |
| 52 | } | 52 | } |
| 53 | 53 | ||
| @@ -41,7 +41,7 @@ af::Status FillUnaryBitWidthChangeNodeParams(const af::AscNodePtr &node, const A | |||
| 41 | params->specific_params = ascir_param::UnaryBitWidthChangeNodeParams{}; | 41 | params->specific_params = ascir_param::UnaryBitWidthChangeNodeParams{}; |
| 42 | unary_params = std::get_if<ascir_param::UnaryBitWidthChangeNodeParams>(¶ms->specific_params); | 42 | unary_params = std::get_if<ascir_param::UnaryBitWidthChangeNodeParams>(¶ms->specific_params); |
| 43 | } | 43 | } |
| 44 | - GE_ASSERT_NOTNULL(unary_params, "Unary bitwidth change specific params is null, node[%s].", node->GetNamePtr()); | 44 | + GE_ASSERT_NOTNULL(unary_params, "Unary bitwidth change specific params are null, node[%s].", node->GetNamePtr()); |
| 45 | params->api_name = node->GetType(); | 45 | params->api_name = node->GetType(); |
| 46 | params->status = ascir_param::ParamBuildStatus::kBuilt; | 46 | params->status = ascir_param::ParamBuildStatus::kBuilt; |
| 47 | 47 | ||
| @@ -579,7 +579,7 @@ Status CubeFusionCaseGenerator::GeneratorUbTask(const std::vector<::ascir::ImplG | |||
| 579 | } | 579 | } |
| 580 | tmp_grouped_graphs.emplace_back(optimize_graph); | 580 | tmp_grouped_graphs.emplace_back(optimize_graph); |
| 581 | if (HasBroadCastNode(optimize_graph)) { | 581 | if (HasBroadCastNode(optimize_graph)) { |
| 582 | - GELOGW("The graph %s still contains broadcast nodes and not support generating ub task.", | 582 | + GELOGW("The graph %s still contains broadcast nodes and does not support generating ub task.", |
| 583 | grouped_graph.GetName().c_str()); | 583 | grouped_graph.GetName().c_str()); |
| 584 | return af::GRAPH_SUCCESS; | 584 | return af::GRAPH_SUCCESS; |
| 585 | } | 585 | } |
| @@ -45,8 +45,8 @@ bool BrcInlineTemplateV2::IsNodeSupportBrcInline(const af::NodePtr &node) { | |||
| 45 | // RemovePad不支持的数据类型,broadcast inline也不支持 | 45 | // RemovePad不支持的数据类型,broadcast inline也不支持 |
| 46 | const auto &dtype = std::dynamic_pointer_cast<af::AscNode>(node)->outputs[0].attr.dtype; | 46 | const auto &dtype = std::dynamic_pointer_cast<af::AscNode>(node)->outputs[0].attr.dtype; |
| 47 | if (!ScheduleUtils::IsNodeSupportDataType<af::ascir_op::RemovePad>(dtype)) { | 47 | if (!ScheduleUtils::IsNodeSupportDataType<af::ascir_op::RemovePad>(dtype)) { |
| 48 | - GELOGD("Broadcast inline not support dtype=%s, node=%s", ge::TypeUtils::DataTypeToSerialString(dtype).c_str(), | 48 | + GELOGD("Broadcast inline does not support dtype=%s, node=%s", |
| 49 | - node->GetNamePtr()); | 49 | + ge::TypeUtils::DataTypeToSerialString(dtype).c_str(), node->GetNamePtr()); |
| 50 | return false; | 50 | return false; |
| 51 | } | 51 | } |
| 52 | std::unique_ptr<af::AscTensor> input0; | 52 | std::unique_ptr<af::AscTensor> input0; |
| @@ -57,12 +57,12 @@ bool BrcInlineTemplateV2::IsNodeSupportBrcInline(const af::NodePtr &node) { | |||
| 57 | ascgen_utils::MergeBrcAxisParams in1(input1->attr.repeats, input1->attr.strides); | 57 | ascgen_utils::MergeBrcAxisParams in1(input1->attr.repeats, input1->attr.strides); |
| 58 | ascgen_utils::MergeBrcAxisRepeats(in0, in1); | 58 | ascgen_utils::MergeBrcAxisRepeats(in0, in1); |
| 59 | if (in0.merge_repeats.size() > 4UL) { | 59 | if (in0.merge_repeats.size() > 4UL) { |
| 60 | - GELOGD("V2 broadcast inline [%s] not support merged axes count > 4", node->GetNamePtr()); | 60 | + GELOGD("V2 broadcast inline [%s] does not support merged axes count > 4", node->GetNamePtr()); |
| 61 | return false; | 61 | return false; |
| 62 | } | 62 | } |
| 63 | // 暂时不支持尾轴广播inline,因为涉及VF内节点根据loop_axis重新做topo排序,逻辑非常复杂 | 63 | // 暂时不支持尾轴广播inline,因为涉及VF内节点根据loop_axis重新做topo排序,逻辑非常复杂 |
| 64 | if (in0.merge_repeats.back() != in1.merge_repeats.back()) { | 64 | if (in0.merge_repeats.back() != in1.merge_repeats.back()) { |
| 65 | - GELOGD("V2 broadcast inline [%s] not support broadcast axis is last.", node->GetNamePtr()); | 65 | + GELOGD("V2 broadcast inline [%s] does not support broadcast axis is last.", node->GetNamePtr()); |
| 66 | return false; | 66 | return false; |
| 67 | } | 67 | } |
| 68 | } | 68 | } |
| @@ -142,13 +142,13 @@ af::Status BrcInlineTemplateV2::Generate([[maybe_unused]] const af::AscGraph &or | |||
| 142 | [[maybe_unused]] const af::AscGraph &based_case, af::AscGraph &new_case) { | 142 | [[maybe_unused]] const af::AscGraph &based_case, af::AscGraph &new_case) { |
| 143 | int32_t brc_inlined_count = 0; | 143 | int32_t brc_inlined_count = 0; |
| 144 | for (const auto &node : new_case.GetAllNodes()) { | 144 | for (const auto &node : new_case.GetAllNodes()) { |
| 145 | - GE_WARN_ASSERT(!ScheduleUtils::IsReduce(node), "Brc inline not support Reduce[%s] now.", node->GetNamePtr()); | 145 | + GE_WARN_ASSERT(!ScheduleUtils::IsReduce(node), "Brc inline does not support Reduce[%s] now.", node->GetNamePtr()); |
| 146 | if (!af::ops::IsOps<af::ascir_op::Broadcast>(node) || ScheduleUtils::IsScalarBroadcastNode(node)) { | 146 | if (!af::ops::IsOps<af::ascir_op::Broadcast>(node) || ScheduleUtils::IsScalarBroadcastNode(node)) { |
| 147 | continue; | 147 | continue; |
| 148 | } | 148 | } |
| 149 | GE_ASSERT_TRUE(node->GetOutDataNodesSize() > 0U); | 149 | GE_ASSERT_TRUE(node->GetOutDataNodesSize() > 0U); |
| 150 | if (!IsNodeSupportBrcInline(node)) { | 150 | if (!IsNodeSupportBrcInline(node)) { |
| 151 | - GELOGD("Graph[%s] Broadcast[%s] is not support brc inline", new_case.GetName().c_str(), node->GetNamePtr()); | 151 | + GELOGD("Graph[%s] Broadcast[%s] does not support brc inline", new_case.GetName().c_str(), node->GetNamePtr()); |
| 152 | continue; | 152 | continue; |
| 153 | } | 153 | } |
| 154 | // 若支持inline,要做的是: | 154 | // 若支持inline,要做的是: |
🟡 Medium Priority
本 PR 将通用求解器生成代码中的中文注释翻译为英文,但只改了测试侧的期望字符串,没有改动生产生成器 autofuse/att/generator/solver_pass_gen/general_solver/general_solver_gen.cpp(该文件不在本次 77 个变更文件列表中)。
证据链:
建议:在同一 PR 中同步更新 autofuse/att/generator/solver_pass_gen/general_solver/general_solver_gen.cpp 的所有中文注释字符串为与测试期望一致的英文(GenClassAnotataion、GenBuffFunc、GenGetFunc、GenDiffFunc 系列、GenCreateInput/GenRunSolver 相关),使测试 EXPECT_EQ 与生产输出一致。