Parallel Tile Operation (PTO) is a virtual instruction set architecture designed by Ascend CANN, focusing on tile-level operations. This repository offers high-performance, cross-platform tile operations across Ascend platforms.
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
update actions,add Code Conflict Detection 增加代码冲突检查 Co-authored-by: Larry_liuyi<larry.liuyi@huawei.com> # message auto-generated for no-merge-commit merge: !1421 merge master into master update actions,add Code Conflict Detection 增加代码冲突检查 Created-by: Larry_liuyi Commit-by: Larry_liuyi Merged-by: cann-robot Description: ## 描述 增加代码冲突检查 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:修改actions配置,增加代码冲突检查 See merge request: cann/pto-isa!1421 | 6 天前 | |
fix: normalize cache line constants and CPU sim edge cases Co-authored-by: zhywang<wangzhiyong74@huawei.com> # message auto-generated for no-merge-commit merge: !1415 merge github into master fix: normalize cache line constants and CPU sim edge cases Created-by: zhhywang Commit-by: zhywang Merged-by: cann-robot Description: Created-by: zhywang Commit-by: zhywang Merged-by: cann-robot Description: 统一 dcci cache line 参数为 cache_line_t::...,并修复 CPU 仿真初始化、TWait 调度识别和 TStore 越界写回问题。 ## 描述 42 文件 +88/-82: - **范围**:通信/同步头文件、CPU/costmodel stub、manual kernels、NPU ST 测试及相关文档。 - **接口同步**:SINGLE_CACHE_LINE/ENTIRE_DATA_CACHE 改为 cache_line_t::SINGLE_CACHE_LINE/cache_line_t::ENTIRE_DATA_CACHE。 - **CPU 仿真修复**:host malloc 改为零初始化;TStoreAcc 跳过无效行列;TWait 增加 _jit_l3_mtp_decode_layer_ 进度感知识别。 ## 关联的Issue ## 测试 - 未运行编译/单测;本次仅根据当前 staged diff 整理 commit message。 ## 文档更新 同步更新 cache line 参数写法相关说明。 ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/pto-isa!1415 | 9 天前 | |
cmake中的组件名(component)从pto_isa修改为pto-isa Co-authored-by: Feiteng Zheng<zhengfeiteng1@h-partners.com> # message auto-generated for no-merge-commit merge: !1440 merge 20260807-support-superbuild into master cmake中的组件名(component)从pto_isa修改为pto-isa Created-by: zhengfeiteng Commit-by: Feiteng Zheng Merged-by: cann-robot Description: ## 描述 cmake中的组件名(component)从pto_isa修改为pto-isa。 - cmake/package.cmake中CMAKE_SOURCE_DIR修改为CMAKE_CURRENT_SOURCE_DIR,适配多仓联编场景。 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 对比修改前后pto-isa包二进制,一致。 ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:重构 See merge request: cann/pto-isa!1440 | 5 天前 | |
typo-fix + eof: correct misspellings/rename identifiers (codespell/typos) and fix missing EOF newlines Co-authored-by: zhywang<wangzhiyong74@huawei.com> # message auto-generated for no-merge-commit merge: !1337 merge master into master typo-fix + eof: correct misspellings/rename identifiers (codespell/typos) and fix missing EOF newlines Created-by: zhhywang Commit-by: zhywang Merged-by: cann-robot Description: Created-by: zhywang Commit-by: zhywang Merged-by: cann-robot Description: 全仓拼写清理 + EOF 换行归一——新增 typos.toml(typos 工具配置)扫描源码拼写并据此修正字符串/注释/文档拼写,将拼错的内部标识符(命名空间、include guard、函数/变量名)一并改名;codespell -L 白名单扩展领域词;含文件名修正及少量 ruff 无用 import 清理。另补 41 个文件缺失的末行换行(end-of-file-fixer)。compatiable 作为外部 CANN-cmake 依赖文件名保留并加白名单。 ## 描述 158 文件 +323/−310,拼写归一,**含标识符 rename(非纯格式化)**: - **配置**:新增 typos.toml(领域词/短标识符白名单:nd/cann/subtile/fo/adn/eles/ands/tbe/typ/pn/binar/alog/mis/vitaliy/compatiable、SUBTILE/SUBTILES);.pre-commit-config.yaml 仅扩展 codespell -L 白名单(+fo/adn/eles/binar/mis/compatiable),--skip *.py/*.cpp/*.hpp/*.c/*.h 不变(源码拼写由 typos 工具负责)。 - **标识符 rename**(内部符号,同文件/编译单元内调用点同步更新): - 命名空间 TMatmulInternel→TMatmulInternal、TCvtInternel→TCvtInternal - include guard EXTENTION_CSRC_UTILS_H→EXTENSION_*、ELEMENT_TILE_SCLAR_OP_HPP→...SCALAR... - 函数 ReachExhaused/WriteExhaused→...Exhausted、complate_s32/s16_data→complete_* - 变量 vaild/Vaild→valid/Valid(77 处,主体)、fpAddres→fpAddress、enbleCountMode→enableCountMode、NeetCntDstIdx→NeedCntDstIdx、paramter→parameter - **字符串/注释/文档拼写**:convertion→conversion、Unsupport→Unsupported、ony→only、Undelying→Underlying、Indicies→Indices、differnent→different、Iteraions→Iterations、Simpify→Simplify、addressess→addresses、particulary→particularly、seperate→separate、accross→across(.md 中英双语同步)。 - **文件名修正**:图 permuate_all2all_count.png→permute_all2all_count.png。 - **EOF 换行归一(end-of-file-fixer)**:41 个文件补缺失末行 \n——本 PR 涉及的 ElementOp.h、tcmp(s)/gen_data.py、kirinDev0000 5 个 main.cpp(10)+ 全仓其余 kirinDev0000 testcases 与 tinterleave(31);多尾随换行 0。 - **compatiable**:外部依赖 version_compatiable.inc 路径改名已撤回,改为白名单(须与依赖方拼写一致)。 - **ruff**:删少量无用 import(shutil、Tuple)。 ## 关联的Issue ## 测试 - **标识符一致性**:各 rename 均在所在文件内同步更新定义与调用点,行为不变。 - **白名单收敛**:typos.toml/codespell -L 已收录全部领域词与外部依赖名,避免误报。 - **EOF 验证**:全仓复扫缺/多末行换行均 0;pre-commit run end-of-file-fixer --all-files Passed(CI 等价)。 - ⚠️ 含标识符 rename(非纯格式化),本机无 CANN/CPU-sim 工具链未做编译/单测;建议可编译环境跑一次 build + 测试复核(重点确认 namespace/guard/valid 系列无外部引用残留)。 - **改动量**:158 文件 +323/−310(.cpp 77 / .hpp 34 / .py 24 / .md 9 / .h 7 / .sh 4 / .yaml 1 / .toml 1 / .png 1)。 ## 文档更新 .md 仅修正拼写(中英双语),无内容/结构改动。 ## 类型标签 - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [x] 其他,请描述:全仓拼写清理(codespell/typos 修正拼写、rename 拼错标识符、新增 typos.toml)+ EOF 末行换行归一(end-of-file-fixer,41 文件);外部依赖名 compatiable 加白名单保留。 See merge request: cann/pto-isa!1337 | 26 天前 | |
A5: Adding support for TMOV ND->ZN in SIMD Co-authored-by: omarzohir<omar.zohiraly@huawei.com> # message auto-generated for no-merge-commit merge: !1450 merge feature/tmov-nd2zn into master A5: Adding support for TMOV ND->ZN in SIMD Created-by: omarzohir Commit-by: omarzohir Merged-by: cann-robot Description: ## 描述 A5: Adding support for TMOV ND->ZN in SIMD ## 关联的Issue https://gitcode.com/cann/pto-isa/issues/519 ## 测试 Passed all ST cases ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [X] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/pto-isa!1450 | 1 天前 | |
fix(a2a3): give the V2C ring its own base in a bidirectional TPipe Co-authored-by: puff_the_magic_dragon<vladimir.loncar@huawei.com> # message auto-generated for no-merge-commit merge: !1438 merge fix/a2a3-dir-both-ring-offset into master fix(a2a3): give the V2C ring its own base in a bidirectional TPipe Created-by: puff_the_magic_dragon Commit-by: puff_the_magic_dragon Merged-by: cann-robot Description: ## 描述 On A2A3 both directions of a DIR_BOTH TPipe addressed the shared GM buffer as (tileIndex % SLOT_NUM) * SLOT_SIZE + entryOffset, and entryOffset was never set for that direction mode — so the C2V and V2C rings occupied the **same** slots and silently overwrote each other's tiles once more than one tile was in flight. Wrong results, no fault, no hang. The entryOffset mechanism already exists and is wired through all thirteen addressing sites (Producer::setEntryOffset at TPush.hpp:96, Consumer::setEntryOffset at :316); nothing called it, because the TPipe constructor at :470 had an empty body. This sets the V2C ring base there for is_both — the consumer under __DAV_CUBE__, the producer under __DAV_VEC__ — giving the layout the TPUSH/TPOP design note specifies: C2V at offset 0, V2C at SLOT_NUM * SLOT_SIZE, total 2 * SLOT_NUM * SLOT_SIZE. Both terms are compile-time constants, so the generated address arithmetic is unchanged in cost. The bidirectional ST case allocated 2 * M * N * sizeof(T) = exactly **one** ring (tpushpop_dir_both/main.cpp:47); it is sized for two here, as the frontend now must. **Ordering.** This needs a frontend that allocates 2 * SLOT_NUM * SLOT_SIZE for a bidirectional pipe. pypto currently sizes it as one ring, and that half must ship first, or this fix writes the V2C ring past the end of the allocation. (On the GitHub mirror the frontend half is hw-native-sys/pypto#2269.) ## 关联的Issue Fixes #516 Mirrored from GitHub, where this is [hw-native-sys/pto-isa#227](https://github.com/hw-native-sys/pto-isa/pull/227) against [#226](https://github.com/hw-native-sys/pto-isa/issues/226). ## 测试 Atlas A2/A3, fp32, at the **stock** ring depth of 4, no DSL overrides, with both halves applied: | Check | Before | After | |---|---|---| | Minimal DIR_BOTH repro (issue #516), C=16, N ∈ {2,4,5,6,7,8,16} × 3 dispatches | 12/21 corrupted | **21/21 clean** | | Same kernel at 4 KiB slots, N ∈ {4,8,16,32} | corrupt at every N and every ring depth (4/8/16/32) | **clean** | | GLA/ZeCO fused forward, C ∈ {16,32} × P ∈ {1,2,4} × N ∈ {2,4,8,16} | 5/12 fail at C=16, 6/12 at C=32 | **24/24 pass**, max abs err ≤ 3.1e-5 | | Downstream regression suites | 4 / 3 / 3 pass | **4 / 3 / 3 pass** | The tpushpop_dir_both ST case passes both before and after: it is a single round trip, so the data dependency serialises the overwrite behind the read. Exposing the defect needs two tiles in flight in opposite directions, which needs a loop — hence the repro in the issue. ## 文档更新 None. The layout this implements is the one already described in the TPUSH/TPOP design note; no document changes. ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/pto-isa!1438 | 1 天前 | |
fix(a5): 解决__cce_simd 宏编译报错 Co-authored-by: zy_tt<zyuan.zhangyuan@huawei.com> # message auto-generated for no-merge-commit merge: !1451 merge master1 into master fix(a5): 解决__cce_simd 宏编译报错 Created-by: zy_tt Commit-by: zy_tt Merged-by: cann-robot Description: ## 描述 解决__cce_simd 宏编译报错 ## 测试 修复编译错误,基于pto-isa master分支 rank=0 max_diff=7.62939e-06 max_ratio=0.0076864 err=0/14680 -> PASS rank=1 max_diff=4.3869e-05 max_ratio=0.215385 err=0/14680 -> PASS ## 文档更新 无 ## 类型标签 Bug修复 See merge request: cann/pto-isa!1451 | 22 小时前 | |
feat: support rpm/deb packaging, fix package name, deps, path.cfg Co-authored-by: zoujiangjiang<zoujiangjiang@h-partners.com> # message auto-generated for no-merge-commit merge: !1357 merge codex/rpm-deb-packaging into master feat: support rpm/deb packaging, fix package name, deps, path.cfg Created-by: zoujiangjiang Commit-by: zoujiangjiang Merged-by: cann-robot Description: ## 描述 参考 ge PR #3508 和 metadef PR #382,为 pto-isa 增加多类型打包能力(rpm/deb/all),修复 path.cfg 不正交问题,并修复包名重复和依赖格式问题。所有改动压缩为单个 commit。 ## 变更类型 - [x] ✨ 新功能 (--pkg-type=rpm/deb/all) - [x] 🐛 Bug 修复 (path.cfg 不正交 / 包名重复 / 依赖格式错误 / postinst 硬编码架构路径) ## 改动清单 1. **升级 cann-cmake tag master-017 → master-042**:新版 set_cann_cpack_config 支持 PACKAGE_TYPE 参数,可切换 CPACK_GENERATOR 为 RPM/DEB/External;未传时回退 External run 包,向后兼容。同时引入 pre_package.cmake / gen_postinst_prerm.py / post_package.cmake 全套 RPM/DEB 支撑。 2. **build.sh 新增 --pkg-type=<run|rpm|deb|all> 选项**:check_pkg_type() 校验非法值(非 run/rpm/deb/all 报错退出 1)。all 模式经 cann-cmake 一次性产出 run+rpm+deb 三包。build_package() 透传 -D PACKAGE_TYPE 给 cmake。 3. **cmake/package.cmake 适配**: - set_cann_cpack_config 传 PACKAGE_TYPE - 移除 NO_COMPONENT_INSTALL 并给所有 install() 加 COMPONENT pto_isa(修复 cann-cmake 在 RPM 模式下组件路径不匹配导致 filelist 生成失败) - 参考 metadef PR #382 删除 path.cfg 的 install 与 EngineeringFiles block 引用,解决多包重复打包 path.cfg 的正交问题 - **修复包名重复 cann-pto-isa-pto-isa**:CPACK_RPM/DEB_COMPONENT_INSTALL=ON 时 CPack 会把组件名追加到包名后,原组件名 pto-isa(连字符)无法构造合法的大写 CMake 变量名(CPackDeb 只认大写形式),导致 deb 包名仍重复。将组件名改为 pto_isa(下划线),并显式设置 CPACK_RPM_PTO_ISA_PACKAGE_NAME / CPACK_DEBIAN_PTO_ISA_PACKAGE_NAME / *_FILE_NAME,使 rpm/deb 包名均为 cann-pto-isa,文件名统一 cann-pto-isa_9.1.0_linux-aarch64.* 4. **version.cmake 修复依赖格式**:set_cann_run_dependencies 的版本条件加 >= 运算符。原写法 "CUR_MAJOR_MINOR_VER"(纯版本号无运算符)经 cann-cmake convert_dependencies_to_package_formats 生成 "pkg 9.1"(无运算符),被 RPM 拆成 "pkg" + "9.1" 两条独立 Requires(9.1 作为不存在的包名导致默认安装报依赖失败)。改为 ">= CUR_MAJOR_MINOR_VER" 后生成 "pkg >= 9.1" / "pkg (>= 9.1)",格式正确,无幽灵 9.1 依赖。 5. **CMakeLists.txt**:新增 PACKAGE_TYPE 默认值 run(CACHE)。 6. **scripts/package/pto_isa/rpm_deb/custom_postinst.sh**:对齐 makeself run 包 root 安装的 IS_FOR_ALL=y 权限模式,使安装后的头文件对所有用户可读(BUILTIN_PERM=555、CUSTOM_PERM=755、ONLYREAD_PERM=444)。架构子目录(aarch64-linux / x86_64-linux)用 uname -m 动态获取 + *-linux 通配兜底,不再硬编码——postinst 跨架构可移植,且所有 chmod/find 加 || true 容错,架构目录不匹配时 postinst 不会在 set -e 下退出非 0(黄区报错根因修复)。不生成 cann_uninstall.sh 和 ascend_install.info:rpm/deb 用包管理器卸载,包数据库和符号链接已由 cann-cmake 生成的 postinst 主体处理。 注意:该脚本被 cann-cmake 内联进 RPM %post 段,RPM spec 宏会扫描百分号,故整个文件不得出现任何字面百分号。 ## 如何测试(root 真实安装验证) 构建: - ./build.sh --pkg → cann-pto-isa_9.1.0_linux-aarch64.run - ./build.sh --pkg --pkg-type=rpm → cann-pto-isa_9.1.0_linux-aarch64.rpm - ./build.sh --pkg --pkg-type=deb → cann-pto-isa_9.1.0_linux-aarch64.deb - ./build.sh --pkg --pkg-type=all → 一次出 run+rpm+deb 三包 - ./build.sh --pkg --pkg-type=foo → exit 1 包名/依赖: - rpm Name = cann-pto-isa(无重复) - deb Package = cann-pto-isa(无重复) - rpm Requires = runtime >= 9.1, opbase >= 9.1, ...(格式正确,无幽灵 9.1) - deb Depends = runtime (>= 9.1), opbase (>= 9.1), ...(格式正确) root 真实安装对比(1212 aarch64 机器,因缺 cann-9.1.0 子包 rpm/dpkg 用 --nodeps / --force-depends 跳依赖): - run 599 条,rpm/deb 597 条(少的 2 条是故意排除的 cann_uninstall.sh 和 ascend_install.info) - 权限:rpm/deb 597 条与 run 包 root 安装完全一致(0 差异) - rpm vs deb:597 条完全一致(0 差异) - postinst 在架构目录改名(模拟不匹配)下仍 exit 0,不会导致 dpkg 报 post-installation script returned error exit status 1 ## 已知问题(非本 PR 范围,属 cann-cmake master-042 上游) 1. cann-cmake 生成的 postinst 在 sh 下有 [: Illegal number: 警告(用 == 比较字符串)。上游问题。 2. 权限对齐目录列表需手动维护:custom_postinst.sh 里 755 目录列表(common/cpu/npu/a2a3/a5)是手列的,include/pto/ 下新增子目录需同步更新。属折中方案的脆弱性。 ## 核对清单 - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测(含 root 真实安装/卸载测试 + 三包权限逐条对比) - [x] 我已更新了相关的文档(AGENTS.md) - [x] 我在标题中使用了合适的类型标签(feat:) - [x] 我已经详细阅读了贡献指南 See merge request: cann/pto-isa!1357 | 19 天前 | |
fix(a2a3): give the V2C ring its own base in a bidirectional TPipe Co-authored-by: puff_the_magic_dragon<vladimir.loncar@huawei.com> # message auto-generated for no-merge-commit merge: !1438 merge fix/a2a3-dir-both-ring-offset into master fix(a2a3): give the V2C ring its own base in a bidirectional TPipe Created-by: puff_the_magic_dragon Commit-by: puff_the_magic_dragon Merged-by: cann-robot Description: ## 描述 On A2A3 both directions of a DIR_BOTH TPipe addressed the shared GM buffer as (tileIndex % SLOT_NUM) * SLOT_SIZE + entryOffset, and entryOffset was never set for that direction mode — so the C2V and V2C rings occupied the **same** slots and silently overwrote each other's tiles once more than one tile was in flight. Wrong results, no fault, no hang. The entryOffset mechanism already exists and is wired through all thirteen addressing sites (Producer::setEntryOffset at TPush.hpp:96, Consumer::setEntryOffset at :316); nothing called it, because the TPipe constructor at :470 had an empty body. This sets the V2C ring base there for is_both — the consumer under __DAV_CUBE__, the producer under __DAV_VEC__ — giving the layout the TPUSH/TPOP design note specifies: C2V at offset 0, V2C at SLOT_NUM * SLOT_SIZE, total 2 * SLOT_NUM * SLOT_SIZE. Both terms are compile-time constants, so the generated address arithmetic is unchanged in cost. The bidirectional ST case allocated 2 * M * N * sizeof(T) = exactly **one** ring (tpushpop_dir_both/main.cpp:47); it is sized for two here, as the frontend now must. **Ordering.** This needs a frontend that allocates 2 * SLOT_NUM * SLOT_SIZE for a bidirectional pipe. pypto currently sizes it as one ring, and that half must ship first, or this fix writes the V2C ring past the end of the allocation. (On the GitHub mirror the frontend half is hw-native-sys/pypto#2269.) ## 关联的Issue Fixes #516 Mirrored from GitHub, where this is [hw-native-sys/pto-isa#227](https://github.com/hw-native-sys/pto-isa/pull/227) against [#226](https://github.com/hw-native-sys/pto-isa/issues/226). ## 测试 Atlas A2/A3, fp32, at the **stock** ring depth of 4, no DSL overrides, with both halves applied: | Check | Before | After | |---|---|---| | Minimal DIR_BOTH repro (issue #516), C=16, N ∈ {2,4,5,6,7,8,16} × 3 dispatches | 12/21 corrupted | **21/21 clean** | | Same kernel at 4 KiB slots, N ∈ {4,8,16,32} | corrupt at every N and every ring depth (4/8/16/32) | **clean** | | GLA/ZeCO fused forward, C ∈ {16,32} × P ∈ {1,2,4} × N ∈ {2,4,8,16} | 5/12 fail at C=16, 6/12 at C=32 | **24/24 pass**, max abs err ≤ 3.1e-5 | | Downstream regression suites | 4 / 3 / 3 pass | **4 / 3 / 3 pass** | The tpushpop_dir_both ST case passes both before and after: it is a single round trip, so the data dependency serialises the overwrite behind the read. Exposing the defect needs two tiles in flight in opposite directions, which needs a loop — hence the repro in the issue. ## 文档更新 None. The layout this implements is the one already described in the TPUSH/TPOP design note; no document changes. ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/pto-isa!1438 | 1 天前 | |
Repo-wide pre-commit: reflow all C++ under updated .clang-format and modernize pre-commit/OAT config Co-authored-by: zhywang<wangzhiyong74@huawei.com> # message auto-generated for no-merge-commit merge: !1314 merge master into master Repo-wide pre-commit: reflow all C++ under updated .clang-format and modernize pre-commit/OAT config Created-by: zhhywang Commit-by: zhywang Merged-by: cann-robot Description: Created-by: zhhywang Commit-by: zhhywang Merged-by: cann-robot Description: 以更新后的 .clang-format(核心:PointerAlignment Right→Left;另 AfterEnum true→false、AlwaysBreakBeforeMultilineStrings true→false、AlignAfterOpenBracket AlwaysBreak、AllowShortFunctionsOnASingleLine false→true)为基准,对**全仓 C++**(含 tests//include//kernels//demos/)做确定性格式化重排;并重写 .pre-commit-config.yaml(gitcode 镜像、clang-format v16→v18,新增 ruff/codespell/typos/OAT 全套 hook)、细化 OAT.xml 合规策略。**不改变任何功能逻辑**,全仓无 Python 改动。 ## 描述 本次提交为「全仓 C++ 格式化 + pre-commit 工程配置升级」,原则:**只做确定性风格重排与配置强化,零逻辑变更**。按改动分三类: 1. **全仓 C++ 格式化(主体)**:clang-format 重排 1841 个 C++ 文件(.cpp 1273 / .hpp 506 / .h 58 / .cc 4),覆盖 tests(1227)、include(455)、kernels(137)、demos(22)。改动为指针对齐 Type &x→Type& x 及按新列宽/换行规则的逐行重排;每个删除行均有等价新增行(token 不变),git diff -w 验证为纯重排。净行数略减(短函数/紧凑换行合并)。 2. **.pre-commit-config.yaml 重写**:mirror 切换至 gitcode.com;clang-format v16.0.0→v18.1.8;补齐 pre-commit-hooks(trailing-ws/eof/check-yaml/large-files/merge-conflict/private-key/json);新增 ruff-check + ruff-format、codespell、typos、本地 oat-check;设 minimum_pre_commit_version: 4.0.0、default_stages:[pre-commit];顶层 exclude 增 ^(tests|demos)/.*\.py$。 3. **OAT.xml 合规策略细化**:license policyitem 补 filefilter/desc;新增 <policyitem type="copyright" name="Huawei Technologies Co., Ltd" .../>(Copyright 噪声下降);defaultPolicyFilter 增配置/图片/二进制文件过滤(xml/yaml/csv/png/so/o/om 等)。 > 说明:本次**无任何 Python 文件改动**(0 个 .py);codespell hook --skip *.cpp/*.hpp/*.c/*.h,不检查 C++ 拼写,故全仓 diff 无标识符 rename、无拼写修复、无 # noqa。 ## 关联的Issue ## 测试 - **pre-commit 全量**:trailing-whitespace / end-of-file-fixer / check-yaml / check-added-large-files / check-merge-conflict / detect-private-key / clang-format 等 hook PASS。 - **格式化收敛**:抽样文件 -w 验证为纯重排(token 等价,无语义变化)。 - ⚠️ **未做编译验证**(本机无 CANN 工具链):格式化不改逻辑;建议在可编译环境跑一次 build 复核。 - **改动量**:1844 文件,+69754 / −80029(主体为格式化重排,净行数略减)。 ## 文档更新 无文档内容改动;.clang-format 为本仓既有 Allman 规则更新(本次格式化基准)。 ## 类型标签 - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:全仓 pre-commit 工程治理——按更新后的 .clang-format(PointerAlignment Right→Left 等)重排全仓 C++,并重写 .pre-commit-config.yaml/细化 OAT.xml;无 Python 改动、无逻辑变更。 See merge request: cann/pto-isa!1314 | 28 天前 | |
lint+license: reformat with ruff/clang-format and normalize CANN OSL v2.0 headers Co-authored-by: zhywang<wangzhiyong74@huawei.com> # message auto-generated for no-merge-commit merge: !1333 merge master into master lint+license: reformat with ruff/clang-format and normalize CANN OSL v2.0 headers Created-by: zhhywang Commit-by: zhywang Merged-by: cann-robot Description: Created-by: zhywang Commit-by: zhywang Merged-by: cann-robot Description: 全仓 pre-commit 扫描——ruff format/black 与 clang-format 重排代码格式(零逻辑变更),并将源文件 License 头统一归一到 CANN Open Software License v2.0 全文(补缺失头、V1.0 升 V2.0、订正 "under the terms and conditions" 措辞),另补 .gitignore 忽略项。 ## 描述 63 文件 +1753/−1082,两类自动修复,**核心无逻辑/语义变更**: - **License 头归一(→ CANN OSL v2.0 全文)**: - 补缺失头: pyproject.toml、kernels/manual/a2a3/dispatch_mega_combine/main.cpp 等新增标准版权块。 - 升级旧头:run.sh 等 "a part of the CANN Open Software / Version 1.0" 短头 → v2.0 全文。 - 订正措辞:under terms and conditions of → under the terms and conditions of(21 处)。 - **代码格式化(零逻辑)**: - Python(54 文件,ruff format/black):多行函数调用折叠为单行、容器/字符串换行重排(docs/tools、kernels/tests 脚本为主)。 - C++(4 .cpp + 1 .hpp,clang-format):引用符号 &/* 贴类型、空体函数合并、长参数换行。 - **配置**:.gitignore 增 oat_reports/、log/;setup.py 补空行。 抽样 docs/tools/normalize_isa_docs.py、TPairReduceSum.hpp、tests/.../gen_data.py 均为格式/license 文本变更,无标识符 rename、无代码增删。 ## 关联的Issue ## 测试 - **格式化零逻辑**:Python 仅换行重排、C++ 仅 & 贴类型与换行;无语句增删、无标识符变化。 - **License 合规**:新增/升级头文本与仓内既有 v2.0 头一致;OAT 扫描头数应上升。 - ⚠️ 未做编译/单测验证(本机无 CANN/CPU-sim 工具链);格式化不改语义,建议可编译环境跑一次 build + 测试复核。 - **改动量**:63 文件 +1753/−1082(.py 54 / .cpp 4 / .sh 2 / .hpp 1 / .toml 1 / .gitignore 1)。 ## 文档更新 无文档内容改动;仅 License 头文本归一。 ## 类型标签 - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [x] 其他,请描述:全仓 pre-commit 清理——代码格式化(ruff format + clang-format)与 CANN OSL v2.0 License 头归一,零逻辑变更。 See merge request: cann/pto-isa!1333 | 27 天前 | |
typo-fix + eof: correct misspellings/rename identifiers (codespell/typos) and fix missing EOF newlines Co-authored-by: zhywang<wangzhiyong74@huawei.com> # message auto-generated for no-merge-commit merge: !1337 merge master into master typo-fix + eof: correct misspellings/rename identifiers (codespell/typos) and fix missing EOF newlines Created-by: zhhywang Commit-by: zhywang Merged-by: cann-robot Description: Created-by: zhywang Commit-by: zhywang Merged-by: cann-robot Description: 全仓拼写清理 + EOF 换行归一——新增 typos.toml(typos 工具配置)扫描源码拼写并据此修正字符串/注释/文档拼写,将拼错的内部标识符(命名空间、include guard、函数/变量名)一并改名;codespell -L 白名单扩展领域词;含文件名修正及少量 ruff 无用 import 清理。另补 41 个文件缺失的末行换行(end-of-file-fixer)。compatiable 作为外部 CANN-cmake 依赖文件名保留并加白名单。 ## 描述 158 文件 +323/−310,拼写归一,**含标识符 rename(非纯格式化)**: - **配置**:新增 typos.toml(领域词/短标识符白名单:nd/cann/subtile/fo/adn/eles/ands/tbe/typ/pn/binar/alog/mis/vitaliy/compatiable、SUBTILE/SUBTILES);.pre-commit-config.yaml 仅扩展 codespell -L 白名单(+fo/adn/eles/binar/mis/compatiable),--skip *.py/*.cpp/*.hpp/*.c/*.h 不变(源码拼写由 typos 工具负责)。 - **标识符 rename**(内部符号,同文件/编译单元内调用点同步更新): - 命名空间 TMatmulInternel→TMatmulInternal、TCvtInternel→TCvtInternal - include guard EXTENTION_CSRC_UTILS_H→EXTENSION_*、ELEMENT_TILE_SCLAR_OP_HPP→...SCALAR... - 函数 ReachExhaused/WriteExhaused→...Exhausted、complate_s32/s16_data→complete_* - 变量 vaild/Vaild→valid/Valid(77 处,主体)、fpAddres→fpAddress、enbleCountMode→enableCountMode、NeetCntDstIdx→NeedCntDstIdx、paramter→parameter - **字符串/注释/文档拼写**:convertion→conversion、Unsupport→Unsupported、ony→only、Undelying→Underlying、Indicies→Indices、differnent→different、Iteraions→Iterations、Simpify→Simplify、addressess→addresses、particulary→particularly、seperate→separate、accross→across(.md 中英双语同步)。 - **文件名修正**:图 permuate_all2all_count.png→permute_all2all_count.png。 - **EOF 换行归一(end-of-file-fixer)**:41 个文件补缺失末行 \n——本 PR 涉及的 ElementOp.h、tcmp(s)/gen_data.py、kirinDev0000 5 个 main.cpp(10)+ 全仓其余 kirinDev0000 testcases 与 tinterleave(31);多尾随换行 0。 - **compatiable**:外部依赖 version_compatiable.inc 路径改名已撤回,改为白名单(须与依赖方拼写一致)。 - **ruff**:删少量无用 import(shutil、Tuple)。 ## 关联的Issue ## 测试 - **标识符一致性**:各 rename 均在所在文件内同步更新定义与调用点,行为不变。 - **白名单收敛**:typos.toml/codespell -L 已收录全部领域词与外部依赖名,避免误报。 - **EOF 验证**:全仓复扫缺/多末行换行均 0;pre-commit run end-of-file-fixer --all-files Passed(CI 等价)。 - ⚠️ 含标识符 rename(非纯格式化),本机无 CANN/CPU-sim 工具链未做编译/单测;建议可编译环境跑一次 build + 测试复核(重点确认 namespace/guard/valid 系列无外部引用残留)。 - **改动量**:158 文件 +323/−310(.cpp 77 / .hpp 34 / .py 24 / .md 9 / .h 7 / .sh 4 / .yaml 1 / .toml 1 / .png 1)。 ## 文档更新 .md 仅修正拼写(中英双语),无内容/结构改动。 ## 类型标签 - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [x] 其他,请描述:全仓拼写清理(codespell/typos 修正拼写、rename 拼错标识符、新增 typos.toml)+ EOF 末行换行归一(end-of-file-fixer,41 文件);外部依赖名 compatiable 加白名单保留。 See merge request: cann/pto-isa!1337 | 26 天前 | |
低优先级指令&测试套相关内容 Co-authored-by: m0_71310678<lizhexun2@huawei.com> # message auto-generated for no-merge-commit merge: !1432 merge third-priority-branch into master 低优先级指令&测试套相关内容 Created-by: m0_71310678 Commit-by: m0_71310678 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 修复了CCE_VL硬编码导致的指令问题、用软实现和断言规范了kirinDev0000上的整形除法相关指令能力。 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/pto-isa!1432 | 5 天前 | |
cmake中的组件名(component)从pto_isa修改为pto-isa Co-authored-by: Feiteng Zheng<zhengfeiteng1@h-partners.com> # message auto-generated for no-merge-commit merge: !1440 merge 20260807-support-superbuild into master cmake中的组件名(component)从pto_isa修改为pto-isa Created-by: zhengfeiteng Commit-by: Feiteng Zheng Merged-by: cann-robot Description: ## 描述 cmake中的组件名(component)从pto_isa修改为pto-isa。 - cmake/package.cmake中CMAKE_SOURCE_DIR修改为CMAKE_CURRENT_SOURCE_DIR,适配多仓联编场景。 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 对比修改前后pto-isa包二进制,一致。 ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:重构 See merge request: cann/pto-isa!1440 | 5 天前 | |
Refactor the readme and update the implementation status of the instructions Co-authored-by: SherwinBai<baixiaorui1@h-partners.com> # message auto-generated for no-merge-commit merge: !754 merge feature/refactor_readme_clean into master Refactor the readme and update the implementation status of the instructions Created-by: SherwinBai Commit-by: SherwinBai Merged-by: cann-robot Description: ## 描述 关键修改: - 重构 README.md / README_zh.md,优化整体结构、导航信息和项目介绍 - 更新 CONTRIBUTING.md / CONTRIBUTING_zh.md 增加提交前本地检查pre-commit工具使用说明 - 门户README中文档构建流程下沉到 docs/mkdocs/README*.md - 同步并完善 include/README.md / include/README_zh.md 中的 PTO 指令实现状态表 - 对照 docs/isa/ 及其子目录补充缺失指令项,并调整状态说明位置与描述 - 同步更新多篇 ISA 文档、相关链接及部分配图内容 影响范围: - 仅涉及文档更新 - 不涉及功能逻辑和运行时行为变更 ## 类型标签 - [ ] 文档更新 See merge request: cann/pto-isa!754 | 3 个月前 | |
Refactor the readme and update the implementation status of the instructions Co-authored-by: SherwinBai<baixiaorui1@h-partners.com> # message auto-generated for no-merge-commit merge: !754 merge feature/refactor_readme_clean into master Refactor the readme and update the implementation status of the instructions Created-by: SherwinBai Commit-by: SherwinBai Merged-by: cann-robot Description: ## 描述 关键修改: - 重构 README.md / README_zh.md,优化整体结构、导航信息和项目介绍 - 更新 CONTRIBUTING.md / CONTRIBUTING_zh.md 增加提交前本地检查pre-commit工具使用说明 - 门户README中文档构建流程下沉到 docs/mkdocs/README*.md - 同步并完善 include/README.md / include/README_zh.md 中的 PTO 指令实现状态表 - 对照 docs/isa/ 及其子目录补充缺失指令项,并调整状态说明位置与描述 - 同步更新多篇 ISA 文档、相关链接及部分配图内容 影响范围: - 仅涉及文档更新 - 不涉及功能逻辑和运行时行为变更 ## 类型标签 - [ ] 文档更新 See merge request: cann/pto-isa!754 | 3 个月前 | |
fix: comprehensive punctuation, spelling, encoding, and C++ portability fixes Co-authored-by: SherwinBai<baixiaorui1@h-partners.com> # message auto-generated for no-merge-commit merge: !979 merge feature/fix-problems into master fix: comprehensive punctuation, spelling, encoding, and C++ portability fixes Created-by: SherwinBai Commit-by: SherwinBai Merged-by: cann-robot Description: ## 概述 对仓库进行全面的质量问题修复,涵盖标点符号错误、英文拼写/语法错误、中英文编码乱码、C++ 可移植性问题。 ## 修改内容 ### 新增 FAQ 页面,建立项目常见问题知识库 在仓库根目录新增中英文 FAQ 页面,用于记录开发者在 PTO 项目中遇到的常见问题及解决方案,降低重复排查成本。 FAQ.md — 英文版 FAQ_zh.md — 中文版 首条收录问题:调试模式(-d)下源码修改不生效 ### 关键 Bug 修复 - **[MXTypes.hpp]** 修复子正常浮点数转换中 for 循环体后缺少分号的 bug,该错误导致子正常数表示计算在循环体内执行而非循环后执行。 ### 编码乱码修复 - **[debug_zh.md]** 修复约 430 条断言条目中英文字母被中文字符系统性替换的问题( in→在、or→或、to→到、and→和),恢复正确的代码标识符路径。 ### 英文语法/拼写修复(debug.md) - constructors is → constructor is(4 处) - 32 bytes align → 32-byte aligned(3 处) - mube be → must be the same - Rigth → Right、shouuld → should - ony support → only support(3 处) - must be must be → must be(6 处,含 TGATHER.md、debug_zh.md) - GetValidRow() → GetValidCol()(CA-0001 逻辑修复) ### 英文文件中的中文标点修复 - [TTRANS.md]、[TABS.md]、[TGATHER.md]、[GlobalTensor.md]、[complex-ops.md]、matmul README — 中文标点 : , 。 、 → 英文标点 : , . , - [SKILL.md] — 14 个代码块中的中文标点替换 ### 中文文件修复 - [topk/README_zh.md] — 英文句号 . → 中文句号 。 - [auto_mode/README_zh.md] — 声定义 → 声明定义 - [topk/README.md] — seperately→separately、dependece→dependence、corresonding→corresponding ### C++ 可移植性修复 - long int/long → int64_t:[TBroadcast.hpp]、[TGather.hpp]、[TScatter.hpp]、[TGet.hpp] - dstSignaData → dstSignalData:[TNotify.hpp] - CAST_ODD_THRESHHOLD → CAST_ODD_THRESHOLD:[TCvt.hpp] ## 测试计划 - [ ] A2/A3/A5 目标构建验证 - [ ] 运行 tests/cpu/st/ 模拟器测试确认 MXTypes.hpp 修复正确 - [ ] 抽查 debug.md / debug_zh.md 断言 ID 可读性 - [ ] 检查 TTRANS.md、TGATHER.md 英文格式正确 ## 关联的ISSUE https://gitcode.com/cann/pto-isa/issues/375 ## 类型标签 - [ ] 文档更新 See merge request: cann/pto-isa!979 | 2 个月前 | |
fix: comprehensive punctuation, spelling, encoding, and C++ portability fixes Co-authored-by: SherwinBai<baixiaorui1@h-partners.com> # message auto-generated for no-merge-commit merge: !979 merge feature/fix-problems into master fix: comprehensive punctuation, spelling, encoding, and C++ portability fixes Created-by: SherwinBai Commit-by: SherwinBai Merged-by: cann-robot Description: ## 概述 对仓库进行全面的质量问题修复,涵盖标点符号错误、英文拼写/语法错误、中英文编码乱码、C++ 可移植性问题。 ## 修改内容 ### 新增 FAQ 页面,建立项目常见问题知识库 在仓库根目录新增中英文 FAQ 页面,用于记录开发者在 PTO 项目中遇到的常见问题及解决方案,降低重复排查成本。 FAQ.md — 英文版 FAQ_zh.md — 中文版 首条收录问题:调试模式(-d)下源码修改不生效 ### 关键 Bug 修复 - **[MXTypes.hpp]** 修复子正常浮点数转换中 for 循环体后缺少分号的 bug,该错误导致子正常数表示计算在循环体内执行而非循环后执行。 ### 编码乱码修复 - **[debug_zh.md]** 修复约 430 条断言条目中英文字母被中文字符系统性替换的问题( in→在、or→或、to→到、and→和),恢复正确的代码标识符路径。 ### 英文语法/拼写修复(debug.md) - constructors is → constructor is(4 处) - 32 bytes align → 32-byte aligned(3 处) - mube be → must be the same - Rigth → Right、shouuld → should - ony support → only support(3 处) - must be must be → must be(6 处,含 TGATHER.md、debug_zh.md) - GetValidRow() → GetValidCol()(CA-0001 逻辑修复) ### 英文文件中的中文标点修复 - [TTRANS.md]、[TABS.md]、[TGATHER.md]、[GlobalTensor.md]、[complex-ops.md]、matmul README — 中文标点 : , 。 、 → 英文标点 : , . , - [SKILL.md] — 14 个代码块中的中文标点替换 ### 中文文件修复 - [topk/README_zh.md] — 英文句号 . → 中文句号 。 - [auto_mode/README_zh.md] — 声定义 → 声明定义 - [topk/README.md] — seperately→separately、dependece→dependence、corresonding→corresponding ### C++ 可移植性修复 - long int/long → int64_t:[TBroadcast.hpp]、[TGather.hpp]、[TScatter.hpp]、[TGet.hpp] - dstSignaData → dstSignalData:[TNotify.hpp] - CAST_ODD_THRESHHOLD → CAST_ODD_THRESHOLD:[TCvt.hpp] ## 测试计划 - [ ] A2/A3/A5 目标构建验证 - [ ] 运行 tests/cpu/st/ 模拟器测试确认 MXTypes.hpp 修复正确 - [ ] 抽查 debug.md / debug_zh.md 断言 ID 可读性 - [ ] 检查 TTRANS.md、TGATHER.md 英文格式正确 ## 关联的ISSUE https://gitcode.com/cann/pto-isa/issues/375 ## 类型标签 - [ ] 文档更新 See merge request: cann/pto-isa!979 | 2 个月前 | |
origin code Signed-off-by: yujiangtao <yujiangtao11@h-partners.com> | 7 个月前 | |
support python package Co-authored-by: zhangjian_hz11<zhjian.zhang@huawei.com> # message auto-generated for no-merge-commit merge: !951 merge pypackage into master support python package Created-by: zhangjian_hz11 Commit-by: zhangjian_hz11 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/pto-isa!951 | 2 个月前 | |
Repo-wide pre-commit: reflow all C++ under updated .clang-format and modernize pre-commit/OAT config Co-authored-by: zhywang<wangzhiyong74@huawei.com> # message auto-generated for no-merge-commit merge: !1314 merge master into master Repo-wide pre-commit: reflow all C++ under updated .clang-format and modernize pre-commit/OAT config Created-by: zhhywang Commit-by: zhywang Merged-by: cann-robot Description: Created-by: zhhywang Commit-by: zhhywang Merged-by: cann-robot Description: 以更新后的 .clang-format(核心:PointerAlignment Right→Left;另 AfterEnum true→false、AlwaysBreakBeforeMultilineStrings true→false、AlignAfterOpenBracket AlwaysBreak、AllowShortFunctionsOnASingleLine false→true)为基准,对**全仓 C++**(含 tests//include//kernels//demos/)做确定性格式化重排;并重写 .pre-commit-config.yaml(gitcode 镜像、clang-format v16→v18,新增 ruff/codespell/typos/OAT 全套 hook)、细化 OAT.xml 合规策略。**不改变任何功能逻辑**,全仓无 Python 改动。 ## 描述 本次提交为「全仓 C++ 格式化 + pre-commit 工程配置升级」,原则:**只做确定性风格重排与配置强化,零逻辑变更**。按改动分三类: 1. **全仓 C++ 格式化(主体)**:clang-format 重排 1841 个 C++ 文件(.cpp 1273 / .hpp 506 / .h 58 / .cc 4),覆盖 tests(1227)、include(455)、kernels(137)、demos(22)。改动为指针对齐 Type &x→Type& x 及按新列宽/换行规则的逐行重排;每个删除行均有等价新增行(token 不变),git diff -w 验证为纯重排。净行数略减(短函数/紧凑换行合并)。 2. **.pre-commit-config.yaml 重写**:mirror 切换至 gitcode.com;clang-format v16.0.0→v18.1.8;补齐 pre-commit-hooks(trailing-ws/eof/check-yaml/large-files/merge-conflict/private-key/json);新增 ruff-check + ruff-format、codespell、typos、本地 oat-check;设 minimum_pre_commit_version: 4.0.0、default_stages:[pre-commit];顶层 exclude 增 ^(tests|demos)/.*\.py$。 3. **OAT.xml 合规策略细化**:license policyitem 补 filefilter/desc;新增 <policyitem type="copyright" name="Huawei Technologies Co., Ltd" .../>(Copyright 噪声下降);defaultPolicyFilter 增配置/图片/二进制文件过滤(xml/yaml/csv/png/so/o/om 等)。 > 说明:本次**无任何 Python 文件改动**(0 个 .py);codespell hook --skip *.cpp/*.hpp/*.c/*.h,不检查 C++ 拼写,故全仓 diff 无标识符 rename、无拼写修复、无 # noqa。 ## 关联的Issue ## 测试 - **pre-commit 全量**:trailing-whitespace / end-of-file-fixer / check-yaml / check-added-large-files / check-merge-conflict / detect-private-key / clang-format 等 hook PASS。 - **格式化收敛**:抽样文件 -w 验证为纯重排(token 等价,无语义变化)。 - ⚠️ **未做编译验证**(本机无 CANN 工具链):格式化不改逻辑;建议在可编译环境跑一次 build 复核。 - **改动量**:1844 文件,+69754 / −80029(主体为格式化重排,净行数略减)。 ## 文档更新 无文档内容改动;.clang-format 为本仓既有 Allman 规则更新(本次格式化基准)。 ## 类型标签 - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:全仓 pre-commit 工程治理——按更新后的 .clang-format(PointerAlignment Right→Left 等)重排全仓 C++,并重写 .pre-commit-config.yaml/细化 OAT.xml;无 Python 改动、无逻辑变更。 See merge request: cann/pto-isa!1314 | 28 天前 | |
fix: comprehensive punctuation, spelling, encoding, and C++ portability fixes Co-authored-by: SherwinBai<baixiaorui1@h-partners.com> # message auto-generated for no-merge-commit merge: !979 merge feature/fix-problems into master fix: comprehensive punctuation, spelling, encoding, and C++ portability fixes Created-by: SherwinBai Commit-by: SherwinBai Merged-by: cann-robot Description: ## 概述 对仓库进行全面的质量问题修复,涵盖标点符号错误、英文拼写/语法错误、中英文编码乱码、C++ 可移植性问题。 ## 修改内容 ### 新增 FAQ 页面,建立项目常见问题知识库 在仓库根目录新增中英文 FAQ 页面,用于记录开发者在 PTO 项目中遇到的常见问题及解决方案,降低重复排查成本。 FAQ.md — 英文版 FAQ_zh.md — 中文版 首条收录问题:调试模式(-d)下源码修改不生效 ### 关键 Bug 修复 - **[MXTypes.hpp]** 修复子正常浮点数转换中 for 循环体后缺少分号的 bug,该错误导致子正常数表示计算在循环体内执行而非循环后执行。 ### 编码乱码修复 - **[debug_zh.md]** 修复约 430 条断言条目中英文字母被中文字符系统性替换的问题( in→在、or→或、to→到、and→和),恢复正确的代码标识符路径。 ### 英文语法/拼写修复(debug.md) - constructors is → constructor is(4 处) - 32 bytes align → 32-byte aligned(3 处) - mube be → must be the same - Rigth → Right、shouuld → should - ony support → only support(3 处) - must be must be → must be(6 处,含 TGATHER.md、debug_zh.md) - GetValidRow() → GetValidCol()(CA-0001 逻辑修复) ### 英文文件中的中文标点修复 - [TTRANS.md]、[TABS.md]、[TGATHER.md]、[GlobalTensor.md]、[complex-ops.md]、matmul README — 中文标点 : , 。 、 → 英文标点 : , . , - [SKILL.md] — 14 个代码块中的中文标点替换 ### 中文文件修复 - [topk/README_zh.md] — 英文句号 . → 中文句号 。 - [auto_mode/README_zh.md] — 声定义 → 声明定义 - [topk/README.md] — seperately→separately、dependece→dependence、corresonding→corresponding ### C++ 可移植性修复 - long int/long → int64_t:[TBroadcast.hpp]、[TGather.hpp]、[TScatter.hpp]、[TGet.hpp] - dstSignaData → dstSignalData:[TNotify.hpp] - CAST_ODD_THRESHHOLD → CAST_ODD_THRESHOLD:[TCvt.hpp] ## 测试计划 - [ ] A2/A3/A5 目标构建验证 - [ ] 运行 tests/cpu/st/ 模拟器测试确认 MXTypes.hpp 修复正确 - [ ] 抽查 debug.md / debug_zh.md 断言 ID 可读性 - [ ] 检查 TTRANS.md、TGATHER.md 英文格式正确 ## 关联的ISSUE https://gitcode.com/cann/pto-isa/issues/375 ## 类型标签 - [ ] 文档更新 See merge request: cann/pto-isa!979 | 2 个月前 | |
docs(docs): Fix broken doc-site links and dead PTO-AS references Co-authored-by: zhywang<wangzhiyong74@huawei.com> # message auto-generated for no-merge-commit merge: !1090 merge docs/fix-isa-doc-links into master docs(docs): Fix broken doc-site links and dead PTO-AS references Created-by: zhhywang Commit-by: zhywang Merged-by: cann-robot Description: ## Summary - Replace 264 dead PTO-AS spec links in docs/isa/*.md and comm pages with an inline-code reference docs/grammar/PTO-AS.md, matching the already-migrated pages; the docs/assembly tree was deleted earlier but the per-instruction back-references were left dangling - Convert root-absolute /docs/... links in the hand-written manual pages (01-overview{,_zh}, appendix-d{,_zh}) to repo-relative paths so they resolve in the Gitcode repository file view as well as on the doc site, and fix gen_pages.py REL_LINK_RE so multi-level ../ prefixes are counted correctly by the relative-link rewriter - Repoint the build-guide links from the site-excluded docs/mkdocs/README{,_zh}.md to docs/website{,_zh}.md - Skip the repo-root README.md in gen_pages.py (it collides with the curated homepage index.md) and redirect inbound links to the homepage at build time, leaving the repo-relative source links untouched - Convert a .py script link in the flash_atten README to inline code ## Testing - [x] mkdocs build --strict passes with 0 warnings (down from 275) - [x] Manual/ISA links verified to resolve in both the rendered doc site and the Gitcode repository file view - [x] Repo-relative source links left intact where the site rewrite is build-time only Closes [#409](https://gitcode.com/cann/pto-isa/issues/409) See merge request: cann/pto-isa!1090 | 1 个月前 | |
Refactor the readme and update the implementation status of the instructions Co-authored-by: SherwinBai<baixiaorui1@h-partners.com> # message auto-generated for no-merge-commit merge: !754 merge feature/refactor_readme_clean into master Refactor the readme and update the implementation status of the instructions Created-by: SherwinBai Commit-by: SherwinBai Merged-by: cann-robot Description: ## 描述 关键修改: - 重构 README.md / README_zh.md,优化整体结构、导航信息和项目介绍 - 更新 CONTRIBUTING.md / CONTRIBUTING_zh.md 增加提交前本地检查pre-commit工具使用说明 - 门户README中文档构建流程下沉到 docs/mkdocs/README*.md - 同步并完善 include/README.md / include/README_zh.md 中的 PTO 指令实现状态表 - 对照 docs/isa/ 及其子目录补充缺失指令项,并调整状态说明位置与描述 - 同步更新多篇 ISA 文档、相关链接及部分配图内容 影响范围: - 仅涉及文档更新 - 不涉及功能逻辑和运行时行为变更 ## 类型标签 - [ ] 文档更新 See merge request: cann/pto-isa!754 | 3 个月前 | |
Refactor the readme and update the implementation status of the instructions Co-authored-by: SherwinBai<baixiaorui1@h-partners.com> # message auto-generated for no-merge-commit merge: !754 merge feature/refactor_readme_clean into master Refactor the readme and update the implementation status of the instructions Created-by: SherwinBai Commit-by: SherwinBai Merged-by: cann-robot Description: ## 描述 关键修改: - 重构 README.md / README_zh.md,优化整体结构、导航信息和项目介绍 - 更新 CONTRIBUTING.md / CONTRIBUTING_zh.md 增加提交前本地检查pre-commit工具使用说明 - 门户README中文档构建流程下沉到 docs/mkdocs/README*.md - 同步并完善 include/README.md / include/README_zh.md 中的 PTO 指令实现状态表 - 对照 docs/isa/ 及其子目录补充缺失指令项,并调整状态说明位置与描述 - 同步更新多篇 ISA 文档、相关链接及部分配图内容 影响范围: - 仅涉及文档更新 - 不涉及功能逻辑和运行时行为变更 ## 类型标签 - [ ] 文档更新 See merge request: cann/pto-isa!754 | 3 个月前 | |
build: upgrade json third-party from v3.11.3 to v3.12.0 Co-authored-by: zoujiangjiang<zoujiangjiang@h-partners.com> # message auto-generated for no-merge-commit merge: !1308 merge upgrade-json-3.11.3-to-3.12.0 into master build: upgrade json third-party from v3.11.3 to v3.12.0 Created-by: zoujiangjiang Commit-by: zoujiangjiang Merged-by: cann-robot Description: ## 关联 Issue Closes #482 ## 变更内容 将 cmake/third_party/json.cmake 中 nlohmann/json 第三方依赖的下载版本从 v3.11.3 升级到 v3.12.0。 ## 变更范围 仅修改下载 URL 中的版本号,单行改动: - v3.11.3/include.zip -> v3.12.0/include.zip json 为 header-only 依赖,URL 模板与旧版一致,无接口签名/构建逻辑变更。 ## 校验 - 已确认 v3.12.0/include.zip 下载地址有效(ZIP 文件,PK 魔数校验通过)。 See merge request: cann/pto-isa!1308 | 28 天前 | |
Repo-wide pre-commit: strip trailing whitespace and normalize EOF newlines Co-authored-by: zhywang<wangzhiyong74@huawei.com> # message auto-generated for no-merge-commit merge: !1320 merge master into master Repo-wide pre-commit: strip trailing whitespace and normalize EOF newlines Created-by: zhhywang Commit-by: zhywang Merged-by: cann-robot Description: Created-by: zhhywang Commit-by: zhhywang Merged-by: cann-robot Description: 全仓跑 trailing-whitespace + end-of-file-fixer:剥离行尾空白、补缺失末行换行、删多余尾随空行;零逻辑/语义变更,覆盖 tests/docs/include/kernels/demos 及 .py/.md/.sh/.js。 ## 描述 全仓 pre-commit 自动修复扫描,**仅做空白与行尾归一,零逻辑变更**: - **行尾空白**:剥离行末多余空格/制表符(主体;.cpp/.hpp/.h/.md/.py/.sh/.js 全覆盖)。 - **文件尾换行**:补缺失末行换行(多处 \ No newline at end of file)、删多余尾随空行,统一单换行结尾。 git diff -w 仅余 250 文件(皆为 EOF 换行/空行修复,-w 不抑制空行变更),其余 ~903 文件纯行尾空白;逐类抽样(.cpp/.hpp/.py/.md/setup.py/SKILL.md)均为空白归一,无 token 变化。 ## 关联的Issue ## 测试 - **空白归一收敛**:git diff -w --stat = 250 文件 +46/−365;抽样 .cpp 文件 -w diff 为空(纯行尾空白)。 - **无逻辑变更**:无标识符 rename、无代码增删,仅空白/换行。 - ⚠️ 未做编译验证(本机无 CANN/CPU-sim 工具链);空白不改语义,建议可编译环境跑一次 build 复核。 - **改动量**:1153 文件,+15054 / −15373(.cpp 634 / .md 298 / .hpp 175 / .py 18 / .sh 13 / .h 12 / .js 3)。 ## 文档更新 无文档内容改动;.md 仅为行尾空白/EOF 换行归一。 ## 类型标签 - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:全仓 pre-commit 空白归一——trailing-whitespace + end-of-file-fixer,清理行尾空白、统一末行换行;零逻辑变更。 See merge request: cann/pto-isa!1320 | 27 天前 | |
build: upgrade json third-party from v3.11.3 to v3.12.0 Co-authored-by: zoujiangjiang<zoujiangjiang@h-partners.com> # message auto-generated for no-merge-commit merge: !1308 merge upgrade-json-3.11.3-to-3.12.0 into master build: upgrade json third-party from v3.11.3 to v3.12.0 Created-by: zoujiangjiang Commit-by: zoujiangjiang Merged-by: cann-robot Description: ## 关联 Issue Closes #482 ## 变更内容 将 cmake/third_party/json.cmake 中 nlohmann/json 第三方依赖的下载版本从 v3.11.3 升级到 v3.12.0。 ## 变更范围 仅修改下载 URL 中的版本号,单行改动: - v3.11.3/include.zip -> v3.12.0/include.zip json 为 header-only 依赖,URL 模板与旧版一致,无接口签名/构建逻辑变更。 ## 校验 - 已确认 v3.12.0/include.zip 下载地址有效(ZIP 文件,PK 魔数校验通过)。 See merge request: cann/pto-isa!1308 | 28 天前 | |
build: upgrade json third-party from v3.11.3 to v3.12.0 Co-authored-by: zoujiangjiang<zoujiangjiang@h-partners.com> # message auto-generated for no-merge-commit merge: !1308 merge upgrade-json-3.11.3-to-3.12.0 into master build: upgrade json third-party from v3.11.3 to v3.12.0 Created-by: zoujiangjiang Commit-by: zoujiangjiang Merged-by: cann-robot Description: ## 关联 Issue Closes #482 ## 变更内容 将 cmake/third_party/json.cmake 中 nlohmann/json 第三方依赖的下载版本从 v3.11.3 升级到 v3.12.0。 ## 变更范围 仅修改下载 URL 中的版本号,单行改动: - v3.11.3/include.zip -> v3.12.0/include.zip json 为 header-only 依赖,URL 模板与旧版一致,无接口签名/构建逻辑变更。 ## 校验 - 已确认 v3.12.0/include.zip 下载地址有效(ZIP 文件,PK 魔数校验通过)。 See merge request: cann/pto-isa!1308 | 28 天前 | |
feat: support rpm/deb packaging, fix package name, deps, path.cfg Co-authored-by: zoujiangjiang<zoujiangjiang@h-partners.com> # message auto-generated for no-merge-commit merge: !1357 merge codex/rpm-deb-packaging into master feat: support rpm/deb packaging, fix package name, deps, path.cfg Created-by: zoujiangjiang Commit-by: zoujiangjiang Merged-by: cann-robot Description: ## 描述 参考 ge PR #3508 和 metadef PR #382,为 pto-isa 增加多类型打包能力(rpm/deb/all),修复 path.cfg 不正交问题,并修复包名重复和依赖格式问题。所有改动压缩为单个 commit。 ## 变更类型 - [x] ✨ 新功能 (--pkg-type=rpm/deb/all) - [x] 🐛 Bug 修复 (path.cfg 不正交 / 包名重复 / 依赖格式错误 / postinst 硬编码架构路径) ## 改动清单 1. **升级 cann-cmake tag master-017 → master-042**:新版 set_cann_cpack_config 支持 PACKAGE_TYPE 参数,可切换 CPACK_GENERATOR 为 RPM/DEB/External;未传时回退 External run 包,向后兼容。同时引入 pre_package.cmake / gen_postinst_prerm.py / post_package.cmake 全套 RPM/DEB 支撑。 2. **build.sh 新增 --pkg-type=<run|rpm|deb|all> 选项**:check_pkg_type() 校验非法值(非 run/rpm/deb/all 报错退出 1)。all 模式经 cann-cmake 一次性产出 run+rpm+deb 三包。build_package() 透传 -D PACKAGE_TYPE 给 cmake。 3. **cmake/package.cmake 适配**: - set_cann_cpack_config 传 PACKAGE_TYPE - 移除 NO_COMPONENT_INSTALL 并给所有 install() 加 COMPONENT pto_isa(修复 cann-cmake 在 RPM 模式下组件路径不匹配导致 filelist 生成失败) - 参考 metadef PR #382 删除 path.cfg 的 install 与 EngineeringFiles block 引用,解决多包重复打包 path.cfg 的正交问题 - **修复包名重复 cann-pto-isa-pto-isa**:CPACK_RPM/DEB_COMPONENT_INSTALL=ON 时 CPack 会把组件名追加到包名后,原组件名 pto-isa(连字符)无法构造合法的大写 CMake 变量名(CPackDeb 只认大写形式),导致 deb 包名仍重复。将组件名改为 pto_isa(下划线),并显式设置 CPACK_RPM_PTO_ISA_PACKAGE_NAME / CPACK_DEBIAN_PTO_ISA_PACKAGE_NAME / *_FILE_NAME,使 rpm/deb 包名均为 cann-pto-isa,文件名统一 cann-pto-isa_9.1.0_linux-aarch64.* 4. **version.cmake 修复依赖格式**:set_cann_run_dependencies 的版本条件加 >= 运算符。原写法 "CUR_MAJOR_MINOR_VER"(纯版本号无运算符)经 cann-cmake convert_dependencies_to_package_formats 生成 "pkg 9.1"(无运算符),被 RPM 拆成 "pkg" + "9.1" 两条独立 Requires(9.1 作为不存在的包名导致默认安装报依赖失败)。改为 ">= CUR_MAJOR_MINOR_VER" 后生成 "pkg >= 9.1" / "pkg (>= 9.1)",格式正确,无幽灵 9.1 依赖。 5. **CMakeLists.txt**:新增 PACKAGE_TYPE 默认值 run(CACHE)。 6. **scripts/package/pto_isa/rpm_deb/custom_postinst.sh**:对齐 makeself run 包 root 安装的 IS_FOR_ALL=y 权限模式,使安装后的头文件对所有用户可读(BUILTIN_PERM=555、CUSTOM_PERM=755、ONLYREAD_PERM=444)。架构子目录(aarch64-linux / x86_64-linux)用 uname -m 动态获取 + *-linux 通配兜底,不再硬编码——postinst 跨架构可移植,且所有 chmod/find 加 || true 容错,架构目录不匹配时 postinst 不会在 set -e 下退出非 0(黄区报错根因修复)。不生成 cann_uninstall.sh 和 ascend_install.info:rpm/deb 用包管理器卸载,包数据库和符号链接已由 cann-cmake 生成的 postinst 主体处理。 注意:该脚本被 cann-cmake 内联进 RPM %post 段,RPM spec 宏会扫描百分号,故整个文件不得出现任何字面百分号。 ## 如何测试(root 真实安装验证) 构建: - ./build.sh --pkg → cann-pto-isa_9.1.0_linux-aarch64.run - ./build.sh --pkg --pkg-type=rpm → cann-pto-isa_9.1.0_linux-aarch64.rpm - ./build.sh --pkg --pkg-type=deb → cann-pto-isa_9.1.0_linux-aarch64.deb - ./build.sh --pkg --pkg-type=all → 一次出 run+rpm+deb 三包 - ./build.sh --pkg --pkg-type=foo → exit 1 包名/依赖: - rpm Name = cann-pto-isa(无重复) - deb Package = cann-pto-isa(无重复) - rpm Requires = runtime >= 9.1, opbase >= 9.1, ...(格式正确,无幽灵 9.1) - deb Depends = runtime (>= 9.1), opbase (>= 9.1), ...(格式正确) root 真实安装对比(1212 aarch64 机器,因缺 cann-9.1.0 子包 rpm/dpkg 用 --nodeps / --force-depends 跳依赖): - run 599 条,rpm/deb 597 条(少的 2 条是故意排除的 cann_uninstall.sh 和 ascend_install.info) - 权限:rpm/deb 597 条与 run 包 root 安装完全一致(0 差异) - rpm vs deb:597 条完全一致(0 差异) - postinst 在架构目录改名(模拟不匹配)下仍 exit 0,不会导致 dpkg 报 post-installation script returned error exit status 1 ## 已知问题(非本 PR 范围,属 cann-cmake master-042 上游) 1. cann-cmake 生成的 postinst 在 sh 下有 [: Illegal number: 警告(用 == 比较字符串)。上游问题。 2. 权限对齐目录列表需手动维护:custom_postinst.sh 里 755 目录列表(common/cpu/npu/a2a3/a5)是手列的,include/pto/ 下新增子目录需同步更新。属折中方案的脆弱性。 ## 核对清单 - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测(含 root 真实安装/卸载测试 + 三包权限逐条对比) - [x] 我已更新了相关的文档(AGENTS.md) - [x] 我在标题中使用了合适的类型标签(feat:) - [x] 我已经详细阅读了贡献指南 See merge request: cann/pto-isa!1357 | 19 天前 | |
lint+license: reformat with ruff/clang-format and normalize CANN OSL v2.0 headers Co-authored-by: zhywang<wangzhiyong74@huawei.com> # message auto-generated for no-merge-commit merge: !1333 merge master into master lint+license: reformat with ruff/clang-format and normalize CANN OSL v2.0 headers Created-by: zhhywang Commit-by: zhywang Merged-by: cann-robot Description: Created-by: zhywang Commit-by: zhywang Merged-by: cann-robot Description: 全仓 pre-commit 扫描——ruff format/black 与 clang-format 重排代码格式(零逻辑变更),并将源文件 License 头统一归一到 CANN Open Software License v2.0 全文(补缺失头、V1.0 升 V2.0、订正 "under the terms and conditions" 措辞),另补 .gitignore 忽略项。 ## 描述 63 文件 +1753/−1082,两类自动修复,**核心无逻辑/语义变更**: - **License 头归一(→ CANN OSL v2.0 全文)**: - 补缺失头: pyproject.toml、kernels/manual/a2a3/dispatch_mega_combine/main.cpp 等新增标准版权块。 - 升级旧头:run.sh 等 "a part of the CANN Open Software / Version 1.0" 短头 → v2.0 全文。 - 订正措辞:under terms and conditions of → under the terms and conditions of(21 处)。 - **代码格式化(零逻辑)**: - Python(54 文件,ruff format/black):多行函数调用折叠为单行、容器/字符串换行重排(docs/tools、kernels/tests 脚本为主)。 - C++(4 .cpp + 1 .hpp,clang-format):引用符号 &/* 贴类型、空体函数合并、长参数换行。 - **配置**:.gitignore 增 oat_reports/、log/;setup.py 补空行。 抽样 docs/tools/normalize_isa_docs.py、TPairReduceSum.hpp、tests/.../gen_data.py 均为格式/license 文本变更,无标识符 rename、无代码增删。 ## 关联的Issue ## 测试 - **格式化零逻辑**:Python 仅换行重排、C++ 仅 & 贴类型与换行;无语句增删、无标识符变化。 - **License 合规**:新增/升级头文本与仓内既有 v2.0 头一致;OAT 扫描头数应上升。 - ⚠️ 未做编译/单测验证(本机无 CANN/CPU-sim 工具链);格式化不改语义,建议可编译环境跑一次 build + 测试复核。 - **改动量**:63 文件 +1753/−1082(.py 54 / .cpp 4 / .sh 2 / .hpp 1 / .toml 1 / .gitignore 1)。 ## 文档更新 无文档内容改动;仅 License 头文本归一。 ## 类型标签 - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [x] 其他,请描述:全仓 pre-commit 清理——代码格式化(ruff format + clang-format)与 CANN OSL v2.0 License 头归一,零逻辑变更。 See merge request: cann/pto-isa!1333 | 27 天前 | |
lint+license: reformat with ruff/clang-format and normalize CANN OSL v2.0 headers Co-authored-by: zhywang<wangzhiyong74@huawei.com> # message auto-generated for no-merge-commit merge: !1333 merge master into master lint+license: reformat with ruff/clang-format and normalize CANN OSL v2.0 headers Created-by: zhhywang Commit-by: zhywang Merged-by: cann-robot Description: Created-by: zhywang Commit-by: zhywang Merged-by: cann-robot Description: 全仓 pre-commit 扫描——ruff format/black 与 clang-format 重排代码格式(零逻辑变更),并将源文件 License 头统一归一到 CANN Open Software License v2.0 全文(补缺失头、V1.0 升 V2.0、订正 "under the terms and conditions" 措辞),另补 .gitignore 忽略项。 ## 描述 63 文件 +1753/−1082,两类自动修复,**核心无逻辑/语义变更**: - **License 头归一(→ CANN OSL v2.0 全文)**: - 补缺失头: pyproject.toml、kernels/manual/a2a3/dispatch_mega_combine/main.cpp 等新增标准版权块。 - 升级旧头:run.sh 等 "a part of the CANN Open Software / Version 1.0" 短头 → v2.0 全文。 - 订正措辞:under terms and conditions of → under the terms and conditions of(21 处)。 - **代码格式化(零逻辑)**: - Python(54 文件,ruff format/black):多行函数调用折叠为单行、容器/字符串换行重排(docs/tools、kernels/tests 脚本为主)。 - C++(4 .cpp + 1 .hpp,clang-format):引用符号 &/* 贴类型、空体函数合并、长参数换行。 - **配置**:.gitignore 增 oat_reports/、log/;setup.py 补空行。 抽样 docs/tools/normalize_isa_docs.py、TPairReduceSum.hpp、tests/.../gen_data.py 均为格式/license 文本变更,无标识符 rename、无代码增删。 ## 关联的Issue ## 测试 - **格式化零逻辑**:Python 仅换行重排、C++ 仅 & 贴类型与换行;无语句增删、无标识符变化。 - **License 合规**:新增/升级头文本与仓内既有 v2.0 头一致;OAT 扫描头数应上升。 - ⚠️ 未做编译/单测验证(本机无 CANN/CPU-sim 工具链);格式化不改语义,建议可编译环境跑一次 build + 测试复核。 - **改动量**:63 文件 +1753/−1082(.py 54 / .cpp 4 / .sh 2 / .hpp 1 / .toml 1 / .gitignore 1)。 ## 文档更新 无文档内容改动;仅 License 头文本归一。 ## 类型标签 - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [x] 其他,请描述:全仓 pre-commit 清理——代码格式化(ruff format + clang-format)与 CANN OSL v2.0 License 头归一,零逻辑变更。 See merge request: cann/pto-isa!1333 | 27 天前 | |
typo-fix + eof: correct misspellings/rename identifiers (codespell/typos) and fix missing EOF newlines Co-authored-by: zhywang<wangzhiyong74@huawei.com> # message auto-generated for no-merge-commit merge: !1337 merge master into master typo-fix + eof: correct misspellings/rename identifiers (codespell/typos) and fix missing EOF newlines Created-by: zhhywang Commit-by: zhywang Merged-by: cann-robot Description: Created-by: zhywang Commit-by: zhywang Merged-by: cann-robot Description: 全仓拼写清理 + EOF 换行归一——新增 typos.toml(typos 工具配置)扫描源码拼写并据此修正字符串/注释/文档拼写,将拼错的内部标识符(命名空间、include guard、函数/变量名)一并改名;codespell -L 白名单扩展领域词;含文件名修正及少量 ruff 无用 import 清理。另补 41 个文件缺失的末行换行(end-of-file-fixer)。compatiable 作为外部 CANN-cmake 依赖文件名保留并加白名单。 ## 描述 158 文件 +323/−310,拼写归一,**含标识符 rename(非纯格式化)**: - **配置**:新增 typos.toml(领域词/短标识符白名单:nd/cann/subtile/fo/adn/eles/ands/tbe/typ/pn/binar/alog/mis/vitaliy/compatiable、SUBTILE/SUBTILES);.pre-commit-config.yaml 仅扩展 codespell -L 白名单(+fo/adn/eles/binar/mis/compatiable),--skip *.py/*.cpp/*.hpp/*.c/*.h 不变(源码拼写由 typos 工具负责)。 - **标识符 rename**(内部符号,同文件/编译单元内调用点同步更新): - 命名空间 TMatmulInternel→TMatmulInternal、TCvtInternel→TCvtInternal - include guard EXTENTION_CSRC_UTILS_H→EXTENSION_*、ELEMENT_TILE_SCLAR_OP_HPP→...SCALAR... - 函数 ReachExhaused/WriteExhaused→...Exhausted、complate_s32/s16_data→complete_* - 变量 vaild/Vaild→valid/Valid(77 处,主体)、fpAddres→fpAddress、enbleCountMode→enableCountMode、NeetCntDstIdx→NeedCntDstIdx、paramter→parameter - **字符串/注释/文档拼写**:convertion→conversion、Unsupport→Unsupported、ony→only、Undelying→Underlying、Indicies→Indices、differnent→different、Iteraions→Iterations、Simpify→Simplify、addressess→addresses、particulary→particularly、seperate→separate、accross→across(.md 中英双语同步)。 - **文件名修正**:图 permuate_all2all_count.png→permute_all2all_count.png。 - **EOF 换行归一(end-of-file-fixer)**:41 个文件补缺失末行 \n——本 PR 涉及的 ElementOp.h、tcmp(s)/gen_data.py、kirinDev0000 5 个 main.cpp(10)+ 全仓其余 kirinDev0000 testcases 与 tinterleave(31);多尾随换行 0。 - **compatiable**:外部依赖 version_compatiable.inc 路径改名已撤回,改为白名单(须与依赖方拼写一致)。 - **ruff**:删少量无用 import(shutil、Tuple)。 ## 关联的Issue ## 测试 - **标识符一致性**:各 rename 均在所在文件内同步更新定义与调用点,行为不变。 - **白名单收敛**:typos.toml/codespell -L 已收录全部领域词与外部依赖名,避免误报。 - **EOF 验证**:全仓复扫缺/多末行换行均 0;pre-commit run end-of-file-fixer --all-files Passed(CI 等价)。 - ⚠️ 含标识符 rename(非纯格式化),本机无 CANN/CPU-sim 工具链未做编译/单测;建议可编译环境跑一次 build + 测试复核(重点确认 namespace/guard/valid 系列无外部引用残留)。 - **改动量**:158 文件 +323/−310(.cpp 77 / .hpp 34 / .py 24 / .md 9 / .h 7 / .sh 4 / .yaml 1 / .toml 1 / .png 1)。 ## 文档更新 .md 仅修正拼写(中英双语),无内容/结构改动。 ## 类型标签 - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [x] 其他,请描述:全仓拼写清理(codespell/typos 修正拼写、rename 拼错标识符、新增 typos.toml)+ EOF 末行换行归一(end-of-file-fixer,41 文件);外部依赖名 compatiable 加白名单保留。 See merge request: cann/pto-isa!1337 | 26 天前 | |
cmake中的组件名(component)从pto_isa修改为pto-isa Co-authored-by: Feiteng Zheng<zhengfeiteng1@h-partners.com> # message auto-generated for no-merge-commit merge: !1440 merge 20260807-support-superbuild into master cmake中的组件名(component)从pto_isa修改为pto-isa Created-by: zhengfeiteng Commit-by: Feiteng Zheng Merged-by: cann-robot Description: ## 描述 cmake中的组件名(component)从pto_isa修改为pto-isa。 - cmake/package.cmake中CMAKE_SOURCE_DIR修改为CMAKE_CURRENT_SOURCE_DIR,适配多仓联编场景。 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 对比修改前后pto-isa包二进制,一致。 ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:重构 See merge request: cann/pto-isa!1440 | 5 天前 |
PTO Tile Library
PTO(Parallel Tile Operation)是昇腾 CANN 定义的一套面向 tile 编程的虚拟 ISA。本仓库提供 PTO Tile 指令的实现、示例、测试与文档,帮助开发者在不同昇腾代际之间更平滑地迁移和优化算子。
📰 新闻
- 🎉 2025-12-27:PTO Tile Library 正式开源发布。
- ✨ 2026-01-30:新增合轴类指令、MX 指令。
- 🚀 2026-02-28:新增卷积类指令、量化类指令、核间通信类指令。
- 🔥 2026-03-30:支持昇腾 A5 芯片,新增异步通信指令、CostModel 性能仿真。
- 🛠️ 2026-04-02:本地工程链路进一步完善,补充了 pre-commit 检查、文档构建校验与 CPU-SIM 验证能力。
🎯 项目定位
PTO ISA 基于昇腾底层硬件与软件抽象,定义 90+ 条标准 tile 指令,用更高层的 tile 编程模型桥接不同代际之间的实现差异。它的目标不是隐藏底层能力,而是在提升抽象层级的同时保留性能调优空间。
- 统一跨代 tile 抽象:降低不同 Ascend 代际之间的迁移成本。
- 兼顾可移植性与性能:在固定 tile shape 下保证正确工作,同时保留 tile size、tile shape、指令顺序等调优能力。
- 面向框架、算子与工具链:可作为上层框架、算子实现和编译工具链的共同接口。
- 支持持续扩展:当前已定义 90+ 条标准操作,并持续补充实现与生态集成。
除计算与数据搬运指令外,PTO ISA 还提供了面向 NPU 间数据传输与同步的通信扩展指令集,覆盖点对点通信、信号同步和集合通信三类能力。
这些通信原语延续了与计算指令一致的 tile 级抽象和跨平台设计,并可驱动昇腾上的多种数据搬移硬件引擎,帮助用户构建计算与通信深度融合的 kernel。通信 ISA 入口见 docs/isa/comm/README_zh.md。
目前,PTO 指令已集成到以下框架中:
- PyPTO
- TileLang Ascend
- 更多语言与前端持续完善中
✨ 核心特性
- 统一的 Tile ISA 抽象:用标准 PTO 指令描述 tile 级计算与数据流。
- 跨代迁移与性能调优兼顾:既提升可移植性,也保留足够的底层控制能力。
- Auto / Manual 双模式开发路径:先快速验证逻辑,再逐步深入优化实现。当前 Auto Mode 主要可用于 CPU 仿真。
- CPU Simulator 支持:支持在 CPU 上进行功能验证与开发调试。
- 覆盖关键编程要素:支持 tile shape、tile mask、事件同步、固定功能单元与流水线建模。
- 文档、测试、示例齐全:提供 ISA 文档、开发文档、测试脚本和性能案例。
👥 适用人群
PTO Tile Lib 主要面向以下开发者:
- 直接对接昇腾硬件的框架或编译器后端开发者
- 需要跨平台迁移与复用实现的高性能算子开发者
- 需要显式控制 tile、buffer 与 pipeline 的性能优化工程师
🚀 快速开始
环境准备
- CPU 路径:需要 Python、CMake 和支持 C++20 的编译器,适合跨平台快速验证。
- NPU 路径:需要 Linux 环境与 Ascend CANN toolkit,适合在昇腾硬件或模拟器上运行。
- 更详细的环境部署说明请参见:快速开始指南
编译与运行
# CPU Simulator(建议第一步)
python3 tests/run_cpu.py --clean --verbose
# 运行 GEMM demo
python3 tests/run_cpu.py --demo gemm --verbose
# 运行 Flash Attention demo
python3 tests/run_cpu.py --demo flash_attn --verbose
# 运行单个 ST 用例
python3 tests/script/run_st.py -r sim -v a3 -t tadd -g TADDTest.case_float_64x64_64x64
# 一键构建并运行推荐测试
./build.sh --run_all --a3 --sim
# 在代码根目录下打 whl 包,产物位于 dist/ 目录
python3 -m build --wheel
推荐样例
- Auto Mode Add 示例:适合第一次了解 PTO 指令组织方式
- GEMM 性能示例:适合理解 tile 级算子优化
- Flash Attention 示例:适合理解复杂算子与性能调优
推荐上手路径
- 从简单示例开始,理解 PTO 指令如何组织 tile 级计算与数据搬运。
- 在 CPU 仿真中验证功能与正确性,建立对指令语义和结果的直观认知。
- 将代码移植到昇腾硬件上验证正确性并采集性能数据。参见 msprof 工具
- 定位性能瓶颈(CUBE Bound / MTE Bound / Vector Bound),开始优化与调参。参见 性能优化
本仓库也展示了标准 tile 操作如何通过模板参数映射到不同流水线实现:
- Tile 编程模型:理解静态 tile shape、动态 tile mask 与数据组织方式
- 事件与同步:理解 set/wait flag 与流水线同步
- 通用约定:理解 PTO 编程中的通用规则与约束
- PTO 指令列表:查看 PTO ISA 已定义的标准操作
🗂️ 文档导航
ISA 与编程模型
- ISA 总览:PTO ISA 文档入口与阅读导航
- PTO 指令列表:按指令分类查看 PTO 标准操作
- Tile 编程模型:理解 tile 的形状、mask 与编程模型
- 事件与同步:理解事件记录、等待与同步方式
- 通用约定:查看命名、约束与通用规则
开发与优化
📊 示例与性能参考
GEMM
- 参考实现:
kernels/manual/a2a3/gemm_performance/ - 详细分析与调参说明:高性能 GEMM 算子示例
Flash Attention
- 算子实现与调优说明:A2/A3 版本,A5 版本
- A5 构建说明(A5 性能数据待补充):Flash Attention Performance Kernel (A5)
- S0:query 序列长度(Q/O 的行数)
- S1:key/value 序列长度(K/V 的行数)
Ascend 910B2 多核对比,基线为 torch_npu:
| 序列长度 | PTO 时间 (us) | torch_npu 时间 (us) | PTO TFLOPS | torch_npu TFLOPS | PTO 加速比 |
|---|---|---|---|---|---|
| 1024 | 20.960 | 58.461 | 25.61 | 9.18 | 2.79x |
| 2048 | 32.461 | 70.801 | 66.16 | 30.33 | 2.18x |
| 4096 | 88.902 | 118.302 | 96.62 | 72.61 | 1.33x |
| 8192 | 292.626 | 353.147 | 117.42 | 97.30 | 1.21x |
| 16384 | 909.058 | 1118.462 | 151.19 | 122.88 | 1.23x |
| 32768 | 3262.645 | 3646.173 | 168.50 | 150.78 | 1.12x |

通信指令带宽
- 参考实现:
kernels/manual/a2a3/tget_bandwidth/ - 详细分析与构建运行说明:TGET / TGET_ASYNC 带宽对比示例
该示例在 Ascend A2/A3 上测量点对点远程读带宽,对比 TGET(同步,经 UB 中转)与 TGET_ASYNC(异步,经 DMA 引擎直接传输)的表现。
GEMM AllReduce 通算融合
- 参考实现:
kernels/manual/a2a3/gemm_ar/ - 详细分析与调参说明:高性能 GEMM AllReduce 融合算子示例
该示例展示了如何在同一个算子流水线中融合 PTO 通信原语与计算 kernel,实现 GEMM 与 AllReduce 的重叠执行。
🖥️ 平台支持
- Ascend A2(Ascend 910B)
- Ascend A3(Ascend 910C)
- Ascend A5(Ascend 950)
- CPU(x86_64 / AArch64)
更多细节请参考 include/README_zh.md。
🛣️ 路线图
未来计划发布的特性:
| 功能 | 描述 | 范围 | 进度 / 完成时间 |
|---|---|---|---|
| PTO Auto Mode | BiSheng 编译器支持:自动分配 tile buffer 并插入同步。 | 编译器 / 工具链 | 持续演进 |
| PTO Tile Fusion | BiSheng 编译器支持:自动融合 tile 操作。 | 编译器 / 工具链 | 持续演进 |
| PTO-AS | PTO ISA 的字节码(Byte Code)支持。 | 编译器 / 工具链 | 持续演进 |
| 卷积扩展 | PTO ISA 对卷积 kernel 的支持。 | ISA 扩展 | 持续演进 |
| 集合通信扩展 | 新增支持 Ccu 及 Roce 异步通信指令,新增 TPREFECTH(AIV 直驱)通信指令。 | 通信 ISA 扩展 | 2026 Q2 |
| 系统调度扩展 | PTO ISA 对 SPMD/MPMD 编程的调度支持。 | ISA 扩展 | 规划中 |
| 微指令 | 支持用户通过微指令表达高性能算子,同时提供基础的高性能微指令库。 | ISA 扩展 / 算子开发 | 2026 Q2 |
| 基础指令 | 进一步优化 A5 指令性能,新增 Pooling 相关基础指令,并增强卷积、量化、Fixpipe 类指令能力。 | ISA 扩展 | 2026 Q2 |
| CostModel | 支持 A5 指令的 CostModel 性能仿真。 | 工具链 / 性能建模 | 2026 Q2 |
| CPU-SIM | CPU-SIM 随指令增强同步构建。 | CPU 仿真 | 2026 Q2 |
🗃️ 目录结构
关键目录如下:
├── include/ # PTO 对外头文件与接口
│ └── pto/ # 公共类型、ISA 接口、CPU/NPU 实现
├── kernels/ # kernel 与算子实现
│ ├── manual/ # 手工优化实现与性能示例
│ └── custom/ # 自定义算子示例
├── docs/ # ISA、编程模型、快速开始与文档站点源文件
│ ├── isa/ # 指令参考与分类索引
│ ├── coding/ # 开发与性能优化文档
│ ├── assembly/ # PTO-AS 汇编语法与规范
│ └── mkdocs/ # MkDocs 文档构建配置与源文件
├── demos/ # Auto Mode、baseline 与 torch_jit 示例
├── tests/ # CPU / NPU 测试、脚本与测试入口
│ ├── cpu/ # CPU 仿真测试
│ ├── npu/ # 按 SoC 拆分的 NPU 测试
│ └── script/ # 测试构建与运行脚本
├── scripts/ # 构建、安装与发布脚本
├── cmake/ # CMake 公共配置与打包逻辑
├── build.sh # 一键构建与运行入口脚本
└── CMakeLists.txt # 顶层 CMake 配置
ℹ️ 相关信息
- 贡献指南:参与项目开发与提交流程
- 安全与漏洞披露:安全问题反馈流程
- 版本说明:版本更新与发布记录
- 许可证:CANN Open Software License Agreement Version 2.0
- PyPTO:PTO 生态中的上层编程框架
- PTOAS:面向 PTO 工作流的汇编器与编译后端
- pto-dsl:面向 PTO 的 Python 前端与 JIT 工作流探索
- FAQ:常见问题与解决方案
📬 联系我们
- 问题反馈:通过仓库 Issues 提交问题
- 功能建议:通过仓库 Issues 或讨论区反馈需求
- 贡献代码:通过 Pull Request 参与项目贡献