Merged
fix(all): Fix spelling errors in source comments and diagnostic messages #5392
fix(all): Fix spelling errors in source comments and diagnostic messages #5392
Merged
wangmingjunAdd on Aug 11
Total: 17 files changed+72-19
@@ -1468,6 +1468,10 @@ class BuildCtrl(CMakeParam):
1468 shutil.rmtree(self.build_root)1468 shutil.rmtree(self.build_root)
1469 if self.install_root.exists():1469 if self.install_root.exists():
1470 logging.info("Clean Install-Tree(%s)", self.install_root)1470 logging.info("Clean Install-Tree(%s)", self.install_root)
1471+ cann_install_root = self.install_root / "cann"
1472+ if cann_install_root.exists():
1473+ logging.info("Restore owner write permission for Install-Tree(%s)", cann_install_root)
1474+ subprocess.run(["chmod", "-R", "u+w", str(cann_install_root)], check=True)
1471 shutil.rmtree(self.install_root)1475 shutil.rmtree(self.install_root)
1472 home_dir = os.environ.get('HOME')1476 home_dir = os.environ.get('HOME')
1473 astdata_folder = os.path.join(home_dir, 'ast_data')1477 astdata_folder = os.path.join(home_dir, 'ast_data')
@@ -52,7 +52,7 @@ namespace npu::tile_fwk {
52#define PYPTO_DEVICE_ERROR_EVENT_CAPTURED 107028 // event is captured52#define PYPTO_DEVICE_ERROR_EVENT_CAPTURED 107028 // event is captured
53#define PYPTO_DEVICE_ERROR_STREAM_NOT_CAPTURED 107029 // stream is not in capture status53#define PYPTO_DEVICE_ERROR_STREAM_NOT_CAPTURED 107029 // stream is not in capture status
54#define PYPTO_DEVICE_ERROR_CAPTURE_MODE_NOT_SUPPORT 107030 // stream is captured, not support current oper54#define PYPTO_DEVICE_ERROR_CAPTURE_MODE_NOT_SUPPORT 107030 // stream is captured, not support current oper
55-#define PYPTO_DEVICE_ERROR_STREAM_CAPTURE_IMPLICIT 107031 // a disallowed implicit dependency from defalut stream55+#define PYPTO_DEVICE_ERROR_STREAM_CAPTURE_IMPLICIT 107031 // a disallowed implicit dependency from default stream
56#define PYPTO_DEVICE_ERROR_STREAM_CAPTURE_CONFLICT 107032 // interdependent stream cannot begin capture together56#define PYPTO_DEVICE_ERROR_STREAM_CAPTURE_CONFLICT 107032 // interdependent stream cannot begin capture together
57#define PYPTO_DEVICE_ERROR_STREAM_TASK_GROUP_STATUS 107033 // task group status error57#define PYPTO_DEVICE_ERROR_STREAM_TASK_GROUP_STATUS 107033 // task group status error
58#define PYPTO_DEVICE_ERROR_STREAM_TASK_GROUP_INTR 107034 // task group interrupted58#define PYPTO_DEVICE_ERROR_STREAM_TASK_GROUP_INTR 107034 // task group interrupted
@@ -620,7 +620,7 @@ std::string CodeGenOpNPU::GenRangeOp() const
620 stepVal = std::to_string(AnyCast<Element>(step).Cast<int64_t>());620 stepVal = std::to_string(AnyCast<Element>(step).Cast<int64_t>());
621 break;621 break;
622 default:622 default:
623- CODEGEN_LOGE(GenCodeErr::DATA_TYPE_UNSUPPORTED, "RangeOp from PASS occured unsupport DataType: %d",623+ CODEGEN_LOGE(GenCodeErr::DATA_TYPE_UNSUPPORTED, "RangeOp from PASS occurred unsupported DataType: %d",
624 operandDtype[ID0]);624 operandDtype[ID0]);
625 return CG_ERROR;625 return CG_ERROR;
626 }626 }
@@ -1361,7 +1361,7 @@ void Assemble(const Tensor& tensor, const std::vector<SymbolicScalar>& dynOffset
1361 CHECK_OP(dstShape.size() == dynOffset.size()) << "Assemble: dynOffset and dest requires same shape";1361 CHECK_OP(dstShape.size() == dynOffset.size()) << "Assemble: dynOffset and dest requires same shape";
1362 1362 
1363 for (size_t dimIdx = 0; dimIdx < srcShape.size(); ++dimIdx) {1363 for (size_t dimIdx = 0; dimIdx < srcShape.size(); ++dimIdx) {
1364- CHECK_OP(srcShape[dimIdx] > 0) << "Assemble: shape of src tensor requires interger";1364+ CHECK_OP(srcShape[dimIdx] > 0) << "Assemble: shape of src tensor requires integer";
1365 }1365 }
1366 1366 
1367 CHECK_OP(dest.GetStorage(false)->Format() == tensor.GetStorage(false)->Format())1367 CHECK_OP(dest.GetStorage(false)->Format() == tensor.GetStorage(false)->Format())
@@ -125,7 +125,7 @@ void DeviceTaskContext::ShowStats()
125 DEV_DEBUG(" Stitched function count: %10lu.", stitchedFuncNum);125 DEV_DEBUG(" Stitched function count: %10lu.", stitchedFuncNum);
126 DEV_DEBUG(" Root function count: %10lu.", rootFuncNum);126 DEV_DEBUG(" Root function count: %10lu.", rootFuncNum);
127 DEV_DEBUG(" Leaf function count: %10lu.", leafFuncNum);127 DEV_DEBUG(" Leaf function count: %10lu.", leafFuncNum);
128- DEV_DEBUG(" Inital ready task count: %10lu.", readyTaskNum);128+ DEV_DEBUG(" Initial ready task count: %10lu.", readyTaskNum);
129 DEV_DEBUG(" Static function data size: %10lu bytes.", dynFuncDataSize);129 DEV_DEBUG(" Static function data size: %10lu bytes.", dynFuncDataSize);
130 DEV_DEBUG(" Leaf function data size: %10lu bytes.", leafFuncDataSize);130 DEV_DEBUG(" Leaf function data size: %10lu bytes.", leafFuncDataSize);
131}131}
@@ -63,7 +63,7 @@ VWorkwT<GraphT> CriticalPathWeight(const GraphT& graph)
63 std::vector<VWorkwT<GraphT>> topLength(graph.NumVertices(), 0);63 std::vector<VWorkwT<GraphT>> topLength(graph.NumVertices(), 0);
64 VWorkwT<GraphT> criticalPathWeight = 0;64 VWorkwT<GraphT> criticalPathWeight = 0;
65 65 
66- // calculating lenght of longest path66+ // calculating length of longest path
67 for (const auto& node : GetTopOrder(graph)) {67 for (const auto& node : GetTopOrder(graph)) {
68 VWorkwT<GraphT> maxTemp = 0;68 VWorkwT<GraphT> maxTemp = 0;
69 for (const auto& parent : graph.Parents(node)) {69 for (const auto& parent : graph.Parents(node)) {
@@ -130,7 +130,7 @@ Status TuneSyncForVF::UpdatePipeVTime(Operation* vecTileOp1, int groupNum, size_
130 }130 }
131 }131 }
132 if (!findFlag) {132 if (!findFlag) {
133- APASS_LOG_ERROR_F(Elements::Operation, "Cannot find %d %s in %s oplist, UpdatePipeVTime falied.",133+ APASS_LOG_ERROR_F(Elements::Operation, "Cannot find %d %s in %s oplist, UpdatePipeVTime failed.",
134 vecTileOp1->GetOpMagic(), vecTileOp1->GetOpcodeStr().c_str(),134 vecTileOp1->GetOpMagic(), vecTileOp1->GetOpcodeStr().c_str(),
135 GetPipeTypeDict().Find(PipeType::PIPE_V).c_str());135 GetPipeTypeDict().Find(PipeType::PIPE_V).c_str());
136 return FAILED;136 return FAILED;
@@ -166,7 +166,7 @@ Status TuneSyncForVF::UpdateSetPipeTime(Function* subGraphFunc, std::vector<Oper
166 }166 }
167 }167 }
168 if (!findFlag) {168 if (!findFlag) {
169- APASS_LOG_ERROR_F(Elements::Operation, "Cannot find %d %s in %s oplist, UpdateSetPipeTime falied.",169+ APASS_LOG_ERROR_F(Elements::Operation, "Cannot find %d %s in %s oplist, UpdateSetPipeTime failed.",
170 tileOpZ->GetOpMagic(), tileOpZ->GetOpcodeStr().c_str(),170 tileOpZ->GetOpMagic(), tileOpZ->GetOpcodeStr().c_str(),
171 GetPipeTypeDict().Find(pipeX).c_str());171 GetPipeTypeDict().Find(pipeX).c_str());
172 return FAILED;172 return FAILED;
@@ -192,7 +192,7 @@ Status TuneSyncForVF::UpdateWaitPipeTime(Function* subGraphFunc, std::vector<Ope
192 }192 }
193 }193 }
194 if (!findFlag) {194 if (!findFlag) {
195- APASS_LOG_ERROR_F(Elements::Operation, "Cannot find %d %s in %s oplist, UpdateWaitPipeTime falied.",195+ APASS_LOG_ERROR_F(Elements::Operation, "Cannot find %d %s in %s oplist, UpdateWaitPipeTime failed.",
196 tileOpZ->GetOpMagic(), tileOpZ->GetOpcodeStr().c_str(),196 tileOpZ->GetOpMagic(), tileOpZ->GetOpcodeStr().c_str(),
197 GetPipeTypeDict().Find(pipeX).c_str());197 GetPipeTypeDict().Find(pipeX).c_str());
198 return FAILED;198 return FAILED;
@@ -217,7 +217,7 @@ Status TuneSyncForVF::MoveBackPipeVOps(int groupNum, const int& maxMoveBackDist)
217 }217 }
218 }218 }
219 if (!findFlag) {219 if (!findFlag) {
220- APASS_LOG_ERROR_F(Elements::Operation, "Cannot find %d %s in %s oplist, MoveBackPipeVOps falied.",220+ APASS_LOG_ERROR_F(Elements::Operation, "Cannot find %d %s in %s oplist, MoveBackPipeVOps failed.",
221 firstOp->GetOpMagic(), firstOp->GetOpcodeStr().c_str(),221 firstOp->GetOpMagic(), firstOp->GetOpcodeStr().c_str(),
222 GetPipeTypeDict().Find(PipeType::PIPE_V).c_str());222 GetPipeTypeDict().Find(PipeType::PIPE_V).c_str());
223 return FAILED;223 return FAILED;
@@ -128,7 +128,7 @@ public:
128 */128 */
129 static void SetAssembleAttr(Operation& op, const AssembleOp& assemble);129 static void SetAssembleAttr(Operation& op, const AssembleOp& assemble);
130 /**130 /**
131- * @brief Determine it is a CV seperate or CV mix platform.131+ * @brief Determine it is a CV separate or CV mix platform.
132 */132 */
133 static bool IsCVMixPlatform();133 static bool IsCVMixPlatform();
134 /**134 /**
@@ -127,7 +127,7 @@ Status ExpandFunction::VerifyScopeInfo(Function& function, std::ostringstream& o
127 for (auto& [scopeId, coreTypes] : scopeCoreTypes) {127 for (auto& [scopeId, coreTypes] : scopeCoreTypes) {
128 if (coreTypes.count(CoreType::AIC) > 0 && coreTypes.count(CoreType::AIV) > 0) {128 if (coreTypes.count(CoreType::AIC) > 0 && coreTypes.count(CoreType::AIV) > 0) {
129 if (!GraphUtils::IsCVMixPlatform()) {129 if (!GraphUtils::IsCVMixPlatform()) {
130- oss << "Cannot mix cube and vector op on a CV seperate platform in function: " << function.GetRawName()130+ oss << "Cannot mix cube and vector op on a CV separate platform in function: " << function.GetRawName()
131 << ", please check your setting: sg_set_scope=" << scopeId;131 << ", please check your setting: sg_set_scope=" << scopeId;
132 return FAILED;132 return FAILED;
133 }133 }
@@ -245,7 +245,7 @@ Status CubeProcess::GetL0CCopyOuts(Operation& op, std::vector<Operation*>& l0CCo
245 if (finalOutput->GetMemoryTypeOriginal() != MemoryType::MEM_DEVICE_DDR &&245 if (finalOutput->GetMemoryTypeOriginal() != MemoryType::MEM_DEVICE_DDR &&
246 finalOutput->GetMemoryTypeOriginal() != MemoryType::MEM_L1 &&246 finalOutput->GetMemoryTypeOriginal() != MemoryType::MEM_L1 &&
247 finalOutput->GetMemoryTypeOriginal() != MemoryType::MEM_UB) {247 finalOutput->GetMemoryTypeOriginal() != MemoryType::MEM_UB) {
248- APASS_LOG_ERROR_F(Elements::Operation, "%s[%d] has invlid output memType: %s. %s",248+ APASS_LOG_ERROR_F(Elements::Operation, "%s[%d] has invalid output memType: %s. %s",
249 chainEndCopyOut->GetOpcodeStr().c_str(), chainEndCopyOut->GetOpMagic(),249 chainEndCopyOut->GetOpcodeStr().c_str(), chainEndCopyOut->GetOpMagic(),
250 MemoryTypeToString(finalOutput->GetMemoryTypeOriginal()).c_str(),250 MemoryTypeToString(finalOutput->GetMemoryTypeOriginal()).c_str(),
251 GetFormatBacktrace(op).c_str());251 GetFormatBacktrace(op).c_str());
@@ -392,7 +392,7 @@ void TestDynMatmul(MatrixOpParams& opParams)
392 EXPECT_TRUE(resultCmp(golden, (outputDtype*)outs->data(), 0.001f));392 EXPECT_TRUE(resultCmp(golden, (outputDtype*)outs->data(), 0.001f));
393}393}
394 394 
395-// intput:fp16 output:fp16 bias:fp16395+// input:fp16 output:fp16 bias:fp16
396TEST_F(DynamicMatmulTest, mm_A_Bt_ND_fp16_BIAS)396TEST_F(DynamicMatmulTest, mm_A_Bt_ND_fp16_BIAS)
397{397{
398 TileShape::Current().SetCubeTile({128, 128}, {128, 128}, {128, 128});398 TileShape::Current().SetCubeTile({128, 128}, {128, 128}, {128, 128});
@@ -408,7 +408,7 @@ TEST_F(DynamicMatmulTest, mm_A_Bt_ND_fp16_BIAS)
408 TestDynMatmul<TestMatmulType>(opParams);408 TestDynMatmul<TestMatmulType>(opParams);
409}409}
410 410 
411-// intput:fp16 output:fp32 bias:fp32411+// input:fp16 output:fp32 bias:fp32
412TEST_F(DynamicMatmulTest, mm_A_Bt_NZ_fp16_BIAS)412TEST_F(DynamicMatmulTest, mm_A_Bt_NZ_fp16_BIAS)
413{413{
414 int64_t m = 1;414 int64_t m = 1;
@@ -423,7 +423,7 @@ TEST_F(DynamicMatmulTest, mm_A_Bt_NZ_fp16_BIAS)
423 TestDynMatmul<TestMatmulType>(opParams);423 TestDynMatmul<TestMatmulType>(opParams);
424}424}
425 425 
426-// intput:fp32 output:fp32 bias:fp32426+// input:fp32 output:fp32 bias:fp32
427TEST_F(DynamicMatmulTest, mm_A_B_NZ_fp32_BIAS)427TEST_F(DynamicMatmulTest, mm_A_B_NZ_fp32_BIAS)
428{428{
429 TileShape::Current().SetCubeTile({128, 128}, {128, 128}, {128, 128});429 TileShape::Current().SetCubeTile({128, 128}, {128, 128}, {128, 128});
@@ -438,7 +438,7 @@ TEST_F(DynamicMatmulTest, mm_A_B_NZ_fp32_BIAS)
438 TestDynMatmul<TestMatmulType>(opParams);438 TestDynMatmul<TestMatmulType>(opParams);
439}439}
440 440 
441-// intput:int8 output:int32 bias:int32441+// input:int8 output:int32 bias:int32
442TEST_F(DynamicMatmulTest, mm_A_Bt_NZ_int8_BIAS)442TEST_F(DynamicMatmulTest, mm_A_Bt_NZ_int8_BIAS)
443{443{
444 int64_t m = 1;444 int64_t m = 1;
@@ -80,4 +80,16 @@ TEST_F(TestCodegenDynRange, RangeTileTensor)
80 80 
81 GenOpCodeFromOp(*function, op, {.isMainBlk = true});81 GenOpCodeFromOp(*function, op, {.isMainBlk = true});
82}82}
83+ 
84+TEST_F(TestCodegenDynRange, RangeUnsupportedDtype)
85+{
86+ config::SetCodeGenConfig(KEY_CODEGEN_SUPPORT_TILE_TENSOR, false);
87+ auto function = GenMockFuncDyn("RangeUnsupportedDtype");
88+ auto localTensor = CreateLogicalTensor({*function, DataType::DT_BOOL, MemoryType::MEM_UB, {64, 64}});
89+ auto& op = function->AddOperation(Opcode::OP_RANGE, {}, {localTensor});
90+ op.SetAttribute(OP_ATTR_PREFIX + "START", Element(DataType::DT_INT32, 1));
91+ op.SetAttribute(OP_ATTR_PREFIX + "STEP", Element(DataType::DT_INT32, 1));
92+ op.SetAttribute(OP_ATTR_PREFIX + "SIZE", Element(DataType::DT_INT32, 1));
93+ EXPECT_EQ(GenOpCodeFromOp(*function, op), CG_ERROR);
94+}
83} // namespace npu::tile_fwk95} // namespace npu::tile_fwk
@@ -162,6 +162,21 @@ TEST_F(ProcessAtomicTest, TestMMINT8) { CheckL0cType(DataType::DT_INT8, DataType
162TEST_F(ProcessAtomicTest, TestMMINT16) { CheckL0cType(DataType::DT_INT16, DataType::DT_INT16, DataType::DT_INT32); }162TEST_F(ProcessAtomicTest, TestMMINT16) { CheckL0cType(DataType::DT_INT16, DataType::DT_INT16, DataType::DT_INT32); }
163TEST_F(ProcessAtomicTest, TestMMINT32) { CheckL0cType(DataType::DT_INT32, DataType::DT_INT32, DataType::DT_INT32); }163TEST_F(ProcessAtomicTest, TestMMINT32) { CheckL0cType(DataType::DT_INT32, DataType::DT_INT32, DataType::DT_INT32); }
164 164 
165+TEST_F(ProcessAtomicTest, TestGetL0CCopyOutsInvalidOutputMemory)
166+{
167+ ComputationalGraphBuilder G;
168+ G.AddTensor(DataType::DT_FP32, {16, 16}, "l0_c");
169+ auto l0c = G.GetTensor("l0_c");
170+ l0c->SetMemoryTypeBoth(MemoryType::MEM_L0C, true);
171+ G.AddTensor(DataType::DT_FP32, {16, 16}, "bad_out");
172+ auto badOut = G.GetTensor("bad_out");
173+ badOut->SetMemoryTypeBoth(MemoryType::MEM_L0C, true);
174+ G.AddOp(Opcode::OP_COPY_OUT, {"l0_c"}, {"bad_out"}, "L0C_Copy_out");
175+ CubeProcess cubeProcess;
176+ std::vector<Operation*> copyOuts;
177+ EXPECT_EQ(cubeProcess.GetL0CCopyOuts(*G.GetOp("L0C_Copy_out"), copyOuts), FAILED);
178+}
179+ 
165TEST_F(ProcessAtomicTest, TestReducAccProcessAtomicOn)180TEST_F(ProcessAtomicTest, TestReducAccProcessAtomicOn)
166{181{
167 ComputationalGraphBuilder G;182 ComputationalGraphBuilder G;
@@ -174,6 +174,28 @@ TEST_F(TuneSyncForVFTest, TestSkip)
174 EXPECT_EQ(tuneSync.RunOnFunction(*rootFuncPtr.get()), SUCCESS);174 EXPECT_EQ(tuneSync.RunOnFunction(*rootFuncPtr.get()), SUCCESS);
175}175}
176 176 
177+TEST_F(TuneSyncForVFTest, TestErrorLogPaths)
178+{
179+ auto rootFuncPtr = std::make_shared<Function>(Program::GetInstance(), "TestErrorPaths", "TestErrorPaths", nullptr);
180+ rootFuncPtr->rootFunc_ = rootFuncPtr.get();
181+ auto currFunctionPtr = std::make_shared<Function>(Program::GetInstance(), "TestErrorPathsLeaf",
182+ "TestErrorPathsLeaf", rootFuncPtr.get());
183+ std::vector<Operation*> opList;
184+ BuildGraphForTest(currFunctionPtr, opList);
185+ TuneSyncForVF tuneSync;
186+ tuneSync.opList_ = opList;
187+ tuneSync.mergedOps = {{opList[TS_NUM3]}};
188+ int vfStart = 0;
189+ int opEnd = 0;
190+ EXPECT_EQ(tuneSync.UpdatePipeVTime(opList[TS_NUM3], 0, 1, vfStart, opEnd), FAILED);
191+ std::vector<Operation*> setFlags{opList[1]};
192+ EXPECT_EQ(tuneSync.UpdateSetPipeTime(currFunctionPtr.get(), setFlags, opEnd), FAILED);
193+ int maxMoveBack = 0;
194+ std::vector<Operation*> waitFlags{opList[4]};
195+ EXPECT_EQ(tuneSync.UpdateWaitPipeTime(currFunctionPtr.get(), waitFlags, vfStart, maxMoveBack), FAILED);
196+ EXPECT_EQ(tuneSync.MoveBackPipeVOps(0, 1), FAILED);
197+}
198+ 
177} // namespace tile_fwk199} // namespace tile_fwk
178} // namespace npu200} // namespace npu
179 201 
@@ -95,6 +95,6 @@ def compile(pyfunc, *args, **kwargs):
95 all_args, tensor_args = _init_arguments(bound.arguments)95 all_args, tensor_args = _init_arguments(bound.arguments)
96 with pypto.function("__entry__", *tensor_args):96 with pypto.function("__entry__", *tensor_args):
97 func_def = pil2ir(func, all_args, tensor_args)97 func_def = pil2ir(func, all_args, tensor_args)
98- # funtion input args still need to be valid, it'll be used later by tensor slot98+ # function input args still need to be valid, it'll be used later by tensor slot
99 setattr(func_def, "__args__", tensor_args)99 setattr(func_def, "__args__", tensor_args)
100 return func_def100 return func_def
@@ -20,7 +20,7 @@ import pypto
20logging.basicConfig(level=logging.INFO, format="", force=True)20logging.basicConfig(level=logging.INFO, format="", force=True)
21SIM_RUNTIME_OPTIONS = {"run_mode": pypto.RunMode.SIM}21SIM_RUNTIME_OPTIONS = {"run_mode": pypto.RunMode.SIM}
22DYNAMIC_SHAPE_ERROR = "Dynamic shape tensors are not allowed as operation operands"22DYNAMIC_SHAPE_ERROR = "Dynamic shape tensors are not allowed as operation operands"
23-ASSEMBLE_DYNAMIC_SHAPE_ERROR = "Assemble: shape of src tensor requires interger"23+ASSEMBLE_DYNAMIC_SHAPE_ERROR = "Assemble: shape of src tensor requires integer"
24 24 
25 25 
26@pypto.frontend.jit(runtime_options=SIM_RUNTIME_OPTIONS)26@pypto.frontend.jit(runtime_options=SIM_RUNTIME_OPTIONS)
@@ -8,7 +8,7 @@
8# See LICENSE in the root of the software repository for the full text of the License.8# See LICENSE in the root of the software repository for the full text of the License.
9# -----------------------------------------------------------------------------------------------------------9# -----------------------------------------------------------------------------------------------------------
10 10 
11-set_cann_package(pypto VERSION "9.1.0")11+set_cann_package(pypto VERSION "9.2.0")
12set_cann_build_dependencies(runtime "CUR_MAJOR_MINOR_VER")12set_cann_build_dependencies(runtime "CUR_MAJOR_MINOR_VER")
13set_cann_build_dependencies(hcomm "CUR_MAJOR_MINOR_VER")13set_cann_build_dependencies(hcomm "CUR_MAJOR_MINOR_VER")
14set_cann_run_dependencies(driver ">=25.5.0")14set_cann_run_dependencies(driver ">=25.5.0")