TorchAir 支持用户基于PyTorch框架和torch_npu插件在昇腾NPU上使用图模式进行推理。
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 20 天前 | ||
ttfhw-解决关联issue Co-authored-by: guanlongfeng<guanlongfeng1@huawei.com> # message auto-generated for no-merge-commit merge: !3483 merge ttfhw_v2 into master ttfhw-解决关联issue Created-by: glf2016 Commit-by: guanlongfeng Merged-by: ascend-robot Description: Description: 网站:https://gitcode.com/TTFHVV/ttfhw-skills ttfhw-verify-baseos torchair 让大模型来搭建 环境,并执行ut、st验证 See merge request: Ascend/torchair!3483 | 16 天前 | |
rename .gitee to .gitcode Co-authored-by: stevenaw0<huangguijun@huawei.com> # message auto-generated for no-merge-commit merge: !3111 merge master into master rename .gitee to .gitcode Created-by: stevenaw0 Commit-by: stevenaw0 Merged-by: ascend-robot Description: rename .gitee to .gitcode See merge request: Ascend/torchair!3111 | 2 个月前 | |
docs: 修复claude启动时远端skill下载失败问题 Co-authored-by: stevenaw0<huangguijun@huawei.com> # message auto-generated for no-merge-commit merge: !3109 merge plugin into master docs: 修复claude启动时远端skill下载失败问题 Created-by: stevenaw0 Commit-by: stevenaw0 Merged-by: ascend-robot Description: ## 变更内容 1. **新增 AGENTS.md**:中文项目指引文档,包含项目概述、构建命令、测试方法、架构说明、核心 API 等 2. **新增 .claude/CLAUDE.md**:指向 AGENTS.md 的引导文件 3. **下载远端skill的脚本增加可执行权限**:修复claude启动时自动下载失败问题: 4. **.claude/settings.json增加舱内曾删改查权限** ## Checklist - [x] 代码已通过本地测试 - [x] 提交信息符合规范 - [x] 无敏感信息泄露 See merge request: Ascend/torchair!3109 | 2 个月前 | |
[Bugfix] support CANN version with beta string Co-authored-by: ganon0327<zhoujialong4@huawei.com> # message auto-generated for no-merge-commit merge: !3493 merge cann_version into master [Bugfix] support CANN version with beta string Created-by: ganon0327 Commit-by: ganon0327 Merged-by: ascend-robot Description: Bugfix: support CANN version with beta string like 9.2.0.beta1 See merge request: Ascend/torchair!3493 | 15 天前 | |
pre-commit by rule=trailing-whitespace Co-authored-by: guanlongfeng<guanlongfeng1@huawei.com> # message auto-generated for no-merge-commit merge: !2931 merge clean_code into master pre-commit by rule=trailing-whitespace Created-by: glf2016 Commit-by: guanlongfeng Merged-by: ascend-robot Description: pre-commit-clean-code-rule=trailing-whitespace See merge request: Ascend/torchair!2931 | 3 个月前 | |
ttfhw-解决关联issue Co-authored-by: guanlongfeng<guanlongfeng1@huawei.com> # message auto-generated for no-merge-commit merge: !3483 merge ttfhw_v2 into master ttfhw-解决关联issue Created-by: glf2016 Commit-by: guanlongfeng Merged-by: ascend-robot Description: Description: 网站:https://gitcode.com/TTFHVV/ttfhw-skills ttfhw-verify-baseos torchair 让大模型来搭建 环境,并执行ut、st验证 See merge request: Ascend/torchair!3483 | 16 天前 | |
| 23 小时前 | ||
fix: correct mixed Chinese/English punctuation in documentation Co-authored-by: tmj1128<tanmengjie2@huawei.com> # message auto-generated for no-merge-commit merge: !3570 merge fix/master-punctuation-mixed into master fix: correct mixed Chinese/English punctuation in documentation Created-by: tmj1128 Commit-by: tmj1128 Merged-by: ascend-robot Description: ## 问题描述 文档中存在中英文标点符号混用问题。 ## 修改内容 ### 1. examples/_kernel_extension_aclgraph/torch_library/README.md - 英文逗号 , -> 中文顿号 、(2 处,用于中文语境下的枚举) - 英文逗号 , -> 中文逗号 ,(1 处,用于中文句子中的分隔) ### 2. npugraph_ex/design_principles.md - 英文逗号 , -> 中文逗号 ,(2 处,用于代码引用与中文文档之间的分隔) ## 修改统计 - 修改文件数:2 - 涉及提交数:1 See merge request: Ascend/torchair!3570 | 1 天前 | |
修复prof开关写死问题 Co-authored-by: chenweiheng<chenweiheng1@hisilicon.com> # message auto-generated for no-merge-commit merge: !3583 merge master into master 修复prof开关写死问题 Created-by: chenweiheng Commit-by: chenweiheng Merged-by: ascend-robot Description: 修复prof开关写死问题 See merge request: Ascend/torchair!3583 | 1 小时前 | |
(master)torch npu is renamed to TorchNPU Co-authored-by: lyz0328<liyanzhen@huawei.com> # message auto-generated for no-merge-commit merge: !3359 merge master into master (master)torch npu is renamed to TorchNPU Created-by: lyz0328 Commit-by: lyz0328 Merged-by: ascend-robot Description: (master)torch npu is renamed to TorchNPU See merge request: Ascend/torchair!3359 | 1 个月前 | |
fix: correct mixed Chinese/English punctuation in documentation Co-authored-by: tmj1128<tanmengjie2@huawei.com> # message auto-generated for no-merge-commit merge: !3570 merge fix/master-punctuation-mixed into master fix: correct mixed Chinese/English punctuation in documentation Created-by: tmj1128 Commit-by: tmj1128 Merged-by: ascend-robot Description: ## 问题描述 文档中存在中英文标点符号混用问题。 ## 修改内容 ### 1. examples/_kernel_extension_aclgraph/torch_library/README.md - 英文逗号 , -> 中文顿号 、(2 处,用于中文语境下的枚举) - 英文逗号 , -> 中文逗号 ,(1 处,用于中文句子中的分隔) ### 2. npugraph_ex/design_principles.md - 英文逗号 , -> 中文逗号 ,(2 处,用于代码引用与中文文档之间的分隔) ## 修改统计 - 修改文件数:2 - 涉及提交数:1 See merge request: Ascend/torchair!3570 | 1 天前 | |
放开pylint规则,并修复现存的pylint问题 Co-authored-by: 冯振强<fengzhenqiang@huawei.com> # message auto-generated for no-merge-commit merge: !3417 merge pre_commit_test into master 放开pylint规则,并修复现存的pylint问题 Created-by: feng_zhenqiang Commit-by: 冯振强 Merged-by: ascend-robot Description: | 工具 | 错误码 | 问题描述 | 处理数量 | 处理方式 | 验证结果 | | --- | --- | --- | ---: | --- | --- | | Pylint | C0412 | 导入未按包分组。 | 9 | 回退 import 分组调整,在触发的 import 代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | C0412 局部屏蔽后定向验证通过,退出码 0 | | Pylint | C2801 | 直接调用双下划线方法。 | 2 | 在对应 __setattr__ 调用代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | C2801 局部屏蔽后定向验证通过,退出码 0 | | Pylint | E0402 | 相对导入层级越过包顶层。 | 18 | 尽量替换为绝对导入,保留函数内延迟导入语义;未新增屏蔽配置 | E0402 定向验证通过,退出码 0 | | Pylint | E0710 | raise 的对象不是异常。 | 1 | 按要求将 raise out 改为 return out,保持 converter 返回语义 | E0710 定向验证通过,退出码 0 | | Pylint | R0402 | 可将模块导入改成显式成员导入。 | 6 | 将对应导入改为 from module import name 形式;setup 文件保留 C0412 局部屏蔽 | R0402 定向验证通过,退出码 0;setup 文件 C0412 复查通过 | | Pylint | R1711 | 函数末尾存在无实际作用的 return。 | 105 | 删除函数末尾无效 return / return None,必要处改为 pass | --enable=R1711 全量验证通过 | | Pylint | W0102 | 函数参数使用可变默认值。 | 2117 | 在 1842 个唯一触发代码行添加行级 dangerous-default-value 屏蔽;未在配置或文件顶部全局屏蔽 | 15 个普通文件 Pylint 验证通过,自动生成文件静态校验通过 | | Pylint | W0401 | 使用星号导入,导入名称集合无法被静态明确。 | 936 | 在 942 处星号导入代码行添加行级 wildcard-import,unused-wildcard-import 屏蔽;未在配置中全局屏蔽 | 代表性文件 Pylint 验证通过,937 个文件、942 处 import * 行静态校验通过 | | Pylint | W0404 | 同一名称被重复导入。 | 4 | 在对应 import 代码处添加 reimported 局部屏蔽,保留导入语义 | W0404 定向验证通过,退出码 0 | | Pylint | W0406 | 模块导入了自身。 | 4 | 对包初始化入口的副作用导入添加行级 import-self 屏蔽,保留初始化语义 | W0406 定向验证通过,退出码 0 | | Pylint | W0614 | 星号导入带来了未被使用的名称。 | 936 | 在 942 处星号导入代码行添加行级 wildcard-import,unused-wildcard-import 屏蔽;未在配置中全局屏蔽 | 代表性文件 Pylint 验证通过,937 个文件、942 处 import * 行静态校验通过 | | Pylint | W1203 | 日志使用了 f-string。 | 279 | 在对应日志调用代码处添加 # pylint: disable=logging-fstring-interpolation,保留原 f-string 日志写法 | pylint --disable=all --enable=W1203 定向验证通过 | | Pylint | W1201 | 日志在调用前就完成了字符串求值。 | 1 | 在对应 logger.info 调用处添加 # pylint: disable=logging-not-lazy,保留原日志拼接写法 | pylint --disable=all --enable=W1201 定向验证通过 | | Pylint | W1401 | 字符串中包含异常反斜杠转义。 | 15 | 将 ASCII 图中的反斜杠改为 \,保留示意图语义 | pylint --disable=all --enable=W1401 定向验证通过(3 个文件) | | Pylint | W2301 | 省略号占位写法没有必要。 | 4 | 在抽象方法中改为 pass,保留抽象接口语义 | pylint --disable=all --enable=W2301,W3301 定向验证通过 | | Pylint | W3301 | 嵌套 min 可简化。 | 1 | 将嵌套 min 改为单层 min(...) 写法,保持边界截断语义 | pylint --disable=all --enable=W2301,W3301 定向验证通过 | | Pylint | W0105 | 出现独立字符串语句。 | 28 | 在对应代码处将独立字符串改为注释,保留原说明内容 | pylint --disable=all --enable=W0105 定向验证通过(24 个文件) | | Pylint | E0611 | 动态扩展、编译产物或运行时模块成员无法被静态导入分析识别。 | 15 | 在对应代码处添加 pylint 局部屏蔽;本次未新增全局屏蔽配置 | 20 个涉及文件定向验证通过,51 个屏蔽位置静态校验通过 | | Pylint | E1101 | 动态属性或运行时注入成员无法被 Pylint 静态识别。 | 3 | 在对应代码处添加 pylint 局部屏蔽;本次未新增全局屏蔽配置 | 20 个涉及文件定向验证通过,51 个屏蔽位置静态校验通过 | | Pylint | E1102 | 动态可调用对象被 Pylint 判断为不可调用。 | 4 | 在对应代码处添加 pylint 局部屏蔽;本次未新增全局屏蔽配置 | 20 个涉及文件定向验证通过,51 个屏蔽位置静态校验通过 | | Pylint | E1121 | 动态接口调用参数数量与 Pylint 推断签名不一致。 | 7 | 在对应代码处添加 pylint 局部屏蔽;本次未新增全局屏蔽配置 | 20 个涉及文件定向验证通过,51 个屏蔽位置静态校验通过 | | Pylint | E1123 | 动态接口调用使用了 Pylint 推断签名未声明的关键字参数。 | 1 | 在对应代码处添加 pylint 局部屏蔽;本次未新增全局屏蔽配置 | 20 个涉及文件定向验证通过,51 个屏蔽位置静态校验通过 | | Pylint | E1125 | 动态接口调用缺少 Pylint 推断签名要求的关键字参数。 | 5 | 在对应代码处添加 pylint 局部屏蔽;本次未新增全局屏蔽配置 | 20 个涉及文件定向验证通过,51 个屏蔽位置静态校验通过 | | Pylint | R0401 | 模块之间存在循环导入关系。 | 12 | 在对应文件顶部添加 pylint 文件级屏蔽;诊断落在模块入口,放在 shebang 后顶部屏蔽;本次未新增全局屏蔽配置 | 20 个涉及文件定向验证通过,51 个屏蔽位置静态校验通过 | | Pylint | R0801 | 多个文件存在重复代码片段。 | 516 | 在对应代码处添加 pylint 局部屏蔽;诊断落在模块入口,放在 shebang 后顶部屏蔽;本次未新增全局屏蔽配置 | 20 个涉及文件定向验证通过,51 个屏蔽位置静态校验通过 | | Pylint | W0236 | 子类覆盖父类成员时方法和属性形态不一致。 | 6 | 在对应代码处添加 pylint 局部屏蔽;本次未新增全局屏蔽配置 | 20 个涉及文件定向验证通过,51 个屏蔽位置静态校验通过 | | Pylint | W1116 | isinstance() 第二个参数由动态对象提供,Pylint 无法确认其为类型。 | 2 | 在对应代码处添加 pylint 局部屏蔽;本次未新增全局屏蔽配置 | 20 个涉及文件定向验证通过,51 个屏蔽位置静态校验通过 | | Pylint | W4901 | 使用了 Pylint 标记为废弃的模块。 | 4 | 在对应代码处添加 pylint 局部屏蔽;本次未新增全局屏蔽配置 | 20 个涉及文件定向验证通过,51 个屏蔽位置静态校验通过 | | Pylint | E0102 | 同名函数或方法重复定义。 | 13 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | E0203 | 成员在定义前被访问。 | 2 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | E0602 | 引用了未定义变量或名称。 | 6 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | E0606 | 变量可能在赋值前被使用。 | 9 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | R0124 | 条件在和自身比较。 | 1 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | R0205 | 继承 object 没有实际意义。 | 3 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | R0916 | 布尔条件过于复杂。 | 7 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | R1701 | 多个 isinstance 可合并。 | 4 | 使用元组合并类型判断,保持原判断语义 | R1701 定向验证通过,退出码 0 | | Pylint | R1702 | 嵌套层级过深。 | 8 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | R1704 | 局部变量重用了参数名。 | 7 | 在对应代码处添加 pylint 局部屏蔽;自动生成文件按当前源码 AST 定位;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | R1710 | 不同分支返回值不一致。 | 14 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | R1714 | 等值判断链可改成成员判断。 | 87 | 在 85 条当前诊断对应代码处添加 pylint 局部屏蔽;2 条旧基线诊断对应文件已不存在;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | R1716 | 多个比较可合并为链式比较。 | 3 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | R1719 | if 表达式可以进一步简化。 | 10 | 将布尔三元表达式改为直接条件判断或 not 表达式 | R1719 定向验证通过,退出码 0 | | Pylint | R1721 | 推导式外层包装多余。 | 36 | 将不必要的推导式改为 list(...)、range(...) 或 dict(...) 标准构造 | R1721 定向验证通过,退出码 0 | | Pylint | R1724 | continue 后存在冗余 else。 | 1 | 删除 continue 后的 else 并顺延后续分支 | R1724/R1728/R1729/R1730/R1733/R1736 定向验证通过,退出码 0 | | Pylint | R1728 | 可用生成器替代临时列表。 | 3 | 将 max([...])、tuple([...]) 改为生成器表达式 | R1724/R1728/R1729/R1730/R1733/R1736 定向验证通过,退出码 0 | | Pylint | R1729 | all() 中不需要构造临时列表。 | 21 | 去掉 all([...]) 外层列表,改为生成器表达式 | R1724/R1728/R1729/R1730/R1733/R1736 定向验证通过,退出码 0 | | Pylint | R1730 | 手写条件可用 min() 表达。 | 1 | 将条件赋值改为 axis = min(axis, -1) | R1724/R1728/R1729/R1730/R1733/R1736 定向验证通过,退出码 0 | | Pylint | R1733 | 遍历字典时又通过 key 取值。 | 8 | 改为直接遍历字典 values 并使用当前 value | R1724/R1728/R1729/R1730/R1733/R1736 定向验证通过,退出码 0 | | Pylint | R1736 | 遍历列表时又通过 index 取当前列表元素。 | 4 | 使用 enumerate 得到的元素替代同列表索引访问 | R1724/R1728/R1729/R1730/R1733/R1736 定向验证通过,退出码 0 | | Pylint | R1725 | super() 还在使用显式参数形式。 | 28 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0106 | 表达式求值后没有被使用。 | 2 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0108 | lambda 可以直接用普通函数替代。 | 2 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0122 | 使用了 exec。 | 6 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0123 | 使用了 eval。 | 7 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0127 | 变量被自赋值。 | 1 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0133 | 单独写了异常对象但没有抛出。 | 1 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0201 | 属性在 __init__ 之外定义。 | 2 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0211 | @staticmethod 仍接收实例或类参数。 | 1 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0221 | 重写方法参数与父类不一致。 | 1 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0231 | 子类初始化未调用父类 __init__。 | 2 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0246 | 重写方法只是原样委托给父类。 | 2 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0511 | 代码中保留了 FIXME/TODO 标记。 | 1 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0602 | 使用了 global,但未形成有效全局赋值。 | 8 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0621 | 局部名称遮蔽了外层作用域变量。 | 20 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0622 | 覆盖了 Python 内置名称。 | 259 | 在对应代码处添加 pylint 局部屏蔽;自动生成文件按当前源码 AST 定位;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0631 | 循环变量在循环外被引用。 | 1 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0632 | 解包数量与数据结构不匹配。 | 9 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0640 | 闭包捕获了循环变量。 | 5 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W1508 | 环境变量默认值类型不合适。 | 3 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | See merge request: Ascend/torchair!3417 | 29 天前 | |
support hif8 for graph Co-authored-by: huangfei<huangfei32@huawei.com> # message auto-generated for no-merge-commit merge: !2145 merge master into master [Feature] [Feature] support hif8 for graph Created-by: dddxhh Commit-by: huangfei Merged-by: ascend-robot Description: <!-- 请根据您的Pull Request类型,保留以下相应的一个模板部分,并删除其他无关部分 --> <!-- 请根据您的Pull Request类型,在Pull request标题中标记[Feature]\[Bugfix]\[Refactor] --> <!-------------------- 新功能模板 BEGIN --------------------> ### **【新功能提交】** **功能描述** support hif8 for graph **相关Issue** <!-- 如有关联的Issue,请在此处填写,例如: [Fixes issue xxx](链接) --> **Checklist** - [x] 符合编程规范&&代码红线 - [x] 具备UT测试用例看护&&测试用例为有效用例(若无测试用例看护请说明原因) - [ ] 是否涉及对外接口变更 - [ ] 是否涉及官网文档修改 <!-------------------- 新功能模板 END --------------------> See merge request: Ascend/torchair!2145 | 8 个月前 | |
更新自定义算子python callback生成的python代码的格式 Co-authored-by: Chang-an-HW<machangan@huawei.com> # message auto-generated for no-merge-commit merge: !3554 merge feature/custom-op-py-schema-bound-execute into master 更新自定义算子python callback生成的python代码的格式 Created-by: Chang-an-HW Commit-by: Chang-an-HW Merged-by: ascend-robot Description: 更新自定义算子python callback生成的python代码的格式 See merge request: Ascend/torchair!3554 | 3 天前 | |
更新自定义算子python callback生成的python代码的格式 Co-authored-by: Chang-an-HW<machangan@huawei.com> # message auto-generated for no-merge-commit merge: !3554 merge feature/custom-op-py-schema-bound-execute into master 更新自定义算子python callback生成的python代码的格式 Created-by: Chang-an-HW Commit-by: Chang-an-HW Merged-by: ascend-robot Description: 更新自定义算子python callback生成的python代码的格式 See merge request: Ascend/torchair!3554 | 3 天前 | |
delete quant_all_reduce & quant_reduce_scatter Co-authored-by: yifux<xiongyifu1@huawei.com> # message auto-generated for no-merge-commit merge: !3377 merge pr_del into master delete quant_all_reduce & quant_reduce_scatter Created-by: xiongyifu Commit-by: yifux Merged-by: ascend-robot Description: delete quant_all_reduce & quant_reduce_scatter See merge request: Ascend/torchair!3377 | 1 个月前 | |
[feature]npugraph_ex support dead lock check Co-authored-by: chenweiheng<chenweiheng1@hisilicon.com> # message auto-generated for no-merge-commit merge: !2782 merge master into master [feature]npugraph_ex support dead lock check Created-by: chenweiheng Commit-by: chenweiheng Merged-by: ascend-robot Description: [feature]npugraph_ex support dead lock check See merge request: Ascend/torchair!2782 | 4 个月前 | |
[Bugfix] support CANN version with beta string Co-authored-by: ganon0327<zhoujialong4@huawei.com> # message auto-generated for no-merge-commit merge: !3493 merge cann_version into master [Bugfix] support CANN version with beta string Created-by: ganon0327 Commit-by: ganon0327 Merged-by: ascend-robot Description: Bugfix: support CANN version with beta string like 9.2.0.beta1 See merge request: Ascend/torchair!3493 | 15 天前 | |
pre-commit by rule=trailing-whitespace Co-authored-by: guanlongfeng<guanlongfeng1@huawei.com> # message auto-generated for no-merge-commit merge: !2931 merge clean_code into master pre-commit by rule=trailing-whitespace Created-by: glf2016 Commit-by: guanlongfeng Merged-by: ascend-robot Description: pre-commit-clean-code-rule=trailing-whitespace See merge request: Ascend/torchair!2931 | 3 个月前 | |
fix: 同一输出被多路view场景下transpose拆分单独kernel报错 Co-authored-by: fu-hao-huawei<fuhao16@huawei.com> # message auto-generated for no-merge-commit merge: !3521 merge load_trans_view into master fix: 同一输出被多路view场景下transpose拆分单独kernel报错 Created-by: fu-hao-huawei Commit-by: fu-hao-huawei Merged-by: ascend-robot Description: ## PR 描述 修复 load-transpose 拆分在「同一物理 buffer 被多路不同 view 读取」场景下的保护性报错。此前当同一输入 buffer 被以不同转置视图多次 load 时, _load_contiguous 会直接抛 load-transpose split unsupported: ... different view,导致模型编译失败。 ## 主要改动 ### inductor_npu_ext/npu.py 1. **按 view 分配独立 transpose slot** - 新增 _assign_transpose_slot():为每个不同 view 各分一个独立 slot(首个 view 沿用物理名,额外 view 用合成名 name__lt{k} 并注册轻量 buffer);同一 view 二次 load 复用同一 slot / 转置 kernel。 - 新增 _loader_slots_by_name、_registered_slot_buffers、_raw_slots、_name_used_raw 等字段管理 slot 生命周期。 2. **转置 view + 连续 view 混读支持** - 物理槽已被转置占用时,连续读(road 为空)单独开一个「原始 slot」直传物理 buffer(不经转置 kernel),从而转置 view 与连续 view 可同时读同一物理 buffer。 - 连续读先占物理槽时,后续转置 view 改走合成 slot,避免转置结果覆盖原始数据(顺序耦合)。 3. **codegen 适配** - _emit_fused_layout_checks:跳过合成 slot 的布局检查(调用点名字不是真实变量)。 - _rewrite_call_args:合成 slot 的 call_arg 改写为物理 buffer 名(转置 slot → transpose(physical, syms...);原始 slot → 直接传物理名)。 - NPUScheduling._get_transpose_map:mapping key 用 slot 调用点名,value 记物理名;原始 slot 以 tname=None 标识。 ### tests/smoke/load_transpose_test.py - 原 test_c3_same_buffer_twice_guard(断言报错)替换为 test_c3_same_buffer_two_slice_views(2D 最小多 view,数值对齐)。 - 新增 test_c4_transpose_buffer_multi_view_rope:RoPE/concat 模式 4D 多 view 场景,断言编译通过 + 数值对齐 + >=2 处转置调用点。 - 新增 test_c5_transpose_and_contiguous_mixed:转置 + 连续混读数值正确性保证。 ## Checklist - [x] 代码已自测 - [x] 新增 / 更新冒烟用例覆盖多 view、RoPE 多 view、转置+连续混读场景 - [x] 同一 view 二次 load 复用同一 slot(无多余转置 kernel) - [x] 向后兼容:单 view 场景与现状逐字节一致 See merge request: Ascend/torchair!3521 | 11 天前 | |
update submodiles Co-authored-by: guanlongfeng<guanlongfeng1@huawei.com> # message auto-generated for no-merge-commit merge: !3375 merge update_submodel_url into master update submodiles Created-by: glf2016 Commit-by: guanlongfeng Merged-by: ascend-robot Description: 社区要求三方库链接切换使用问题的gitcode网站 See merge request: Ascend/torchair!3375 | 1 个月前 | |
放开pylint规则,并修复现存的pylint问题 Co-authored-by: 冯振强<fengzhenqiang@huawei.com> # message auto-generated for no-merge-commit merge: !3417 merge pre_commit_test into master 放开pylint规则,并修复现存的pylint问题 Created-by: feng_zhenqiang Commit-by: 冯振强 Merged-by: ascend-robot Description: | 工具 | 错误码 | 问题描述 | 处理数量 | 处理方式 | 验证结果 | | --- | --- | --- | ---: | --- | --- | | Pylint | C0412 | 导入未按包分组。 | 9 | 回退 import 分组调整,在触发的 import 代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | C0412 局部屏蔽后定向验证通过,退出码 0 | | Pylint | C2801 | 直接调用双下划线方法。 | 2 | 在对应 __setattr__ 调用代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | C2801 局部屏蔽后定向验证通过,退出码 0 | | Pylint | E0402 | 相对导入层级越过包顶层。 | 18 | 尽量替换为绝对导入,保留函数内延迟导入语义;未新增屏蔽配置 | E0402 定向验证通过,退出码 0 | | Pylint | E0710 | raise 的对象不是异常。 | 1 | 按要求将 raise out 改为 return out,保持 converter 返回语义 | E0710 定向验证通过,退出码 0 | | Pylint | R0402 | 可将模块导入改成显式成员导入。 | 6 | 将对应导入改为 from module import name 形式;setup 文件保留 C0412 局部屏蔽 | R0402 定向验证通过,退出码 0;setup 文件 C0412 复查通过 | | Pylint | R1711 | 函数末尾存在无实际作用的 return。 | 105 | 删除函数末尾无效 return / return None,必要处改为 pass | --enable=R1711 全量验证通过 | | Pylint | W0102 | 函数参数使用可变默认值。 | 2117 | 在 1842 个唯一触发代码行添加行级 dangerous-default-value 屏蔽;未在配置或文件顶部全局屏蔽 | 15 个普通文件 Pylint 验证通过,自动生成文件静态校验通过 | | Pylint | W0401 | 使用星号导入,导入名称集合无法被静态明确。 | 936 | 在 942 处星号导入代码行添加行级 wildcard-import,unused-wildcard-import 屏蔽;未在配置中全局屏蔽 | 代表性文件 Pylint 验证通过,937 个文件、942 处 import * 行静态校验通过 | | Pylint | W0404 | 同一名称被重复导入。 | 4 | 在对应 import 代码处添加 reimported 局部屏蔽,保留导入语义 | W0404 定向验证通过,退出码 0 | | Pylint | W0406 | 模块导入了自身。 | 4 | 对包初始化入口的副作用导入添加行级 import-self 屏蔽,保留初始化语义 | W0406 定向验证通过,退出码 0 | | Pylint | W0614 | 星号导入带来了未被使用的名称。 | 936 | 在 942 处星号导入代码行添加行级 wildcard-import,unused-wildcard-import 屏蔽;未在配置中全局屏蔽 | 代表性文件 Pylint 验证通过,937 个文件、942 处 import * 行静态校验通过 | | Pylint | W1203 | 日志使用了 f-string。 | 279 | 在对应日志调用代码处添加 # pylint: disable=logging-fstring-interpolation,保留原 f-string 日志写法 | pylint --disable=all --enable=W1203 定向验证通过 | | Pylint | W1201 | 日志在调用前就完成了字符串求值。 | 1 | 在对应 logger.info 调用处添加 # pylint: disable=logging-not-lazy,保留原日志拼接写法 | pylint --disable=all --enable=W1201 定向验证通过 | | Pylint | W1401 | 字符串中包含异常反斜杠转义。 | 15 | 将 ASCII 图中的反斜杠改为 \,保留示意图语义 | pylint --disable=all --enable=W1401 定向验证通过(3 个文件) | | Pylint | W2301 | 省略号占位写法没有必要。 | 4 | 在抽象方法中改为 pass,保留抽象接口语义 | pylint --disable=all --enable=W2301,W3301 定向验证通过 | | Pylint | W3301 | 嵌套 min 可简化。 | 1 | 将嵌套 min 改为单层 min(...) 写法,保持边界截断语义 | pylint --disable=all --enable=W2301,W3301 定向验证通过 | | Pylint | W0105 | 出现独立字符串语句。 | 28 | 在对应代码处将独立字符串改为注释,保留原说明内容 | pylint --disable=all --enable=W0105 定向验证通过(24 个文件) | | Pylint | E0611 | 动态扩展、编译产物或运行时模块成员无法被静态导入分析识别。 | 15 | 在对应代码处添加 pylint 局部屏蔽;本次未新增全局屏蔽配置 | 20 个涉及文件定向验证通过,51 个屏蔽位置静态校验通过 | | Pylint | E1101 | 动态属性或运行时注入成员无法被 Pylint 静态识别。 | 3 | 在对应代码处添加 pylint 局部屏蔽;本次未新增全局屏蔽配置 | 20 个涉及文件定向验证通过,51 个屏蔽位置静态校验通过 | | Pylint | E1102 | 动态可调用对象被 Pylint 判断为不可调用。 | 4 | 在对应代码处添加 pylint 局部屏蔽;本次未新增全局屏蔽配置 | 20 个涉及文件定向验证通过,51 个屏蔽位置静态校验通过 | | Pylint | E1121 | 动态接口调用参数数量与 Pylint 推断签名不一致。 | 7 | 在对应代码处添加 pylint 局部屏蔽;本次未新增全局屏蔽配置 | 20 个涉及文件定向验证通过,51 个屏蔽位置静态校验通过 | | Pylint | E1123 | 动态接口调用使用了 Pylint 推断签名未声明的关键字参数。 | 1 | 在对应代码处添加 pylint 局部屏蔽;本次未新增全局屏蔽配置 | 20 个涉及文件定向验证通过,51 个屏蔽位置静态校验通过 | | Pylint | E1125 | 动态接口调用缺少 Pylint 推断签名要求的关键字参数。 | 5 | 在对应代码处添加 pylint 局部屏蔽;本次未新增全局屏蔽配置 | 20 个涉及文件定向验证通过,51 个屏蔽位置静态校验通过 | | Pylint | R0401 | 模块之间存在循环导入关系。 | 12 | 在对应文件顶部添加 pylint 文件级屏蔽;诊断落在模块入口,放在 shebang 后顶部屏蔽;本次未新增全局屏蔽配置 | 20 个涉及文件定向验证通过,51 个屏蔽位置静态校验通过 | | Pylint | R0801 | 多个文件存在重复代码片段。 | 516 | 在对应代码处添加 pylint 局部屏蔽;诊断落在模块入口,放在 shebang 后顶部屏蔽;本次未新增全局屏蔽配置 | 20 个涉及文件定向验证通过,51 个屏蔽位置静态校验通过 | | Pylint | W0236 | 子类覆盖父类成员时方法和属性形态不一致。 | 6 | 在对应代码处添加 pylint 局部屏蔽;本次未新增全局屏蔽配置 | 20 个涉及文件定向验证通过,51 个屏蔽位置静态校验通过 | | Pylint | W1116 | isinstance() 第二个参数由动态对象提供,Pylint 无法确认其为类型。 | 2 | 在对应代码处添加 pylint 局部屏蔽;本次未新增全局屏蔽配置 | 20 个涉及文件定向验证通过,51 个屏蔽位置静态校验通过 | | Pylint | W4901 | 使用了 Pylint 标记为废弃的模块。 | 4 | 在对应代码处添加 pylint 局部屏蔽;本次未新增全局屏蔽配置 | 20 个涉及文件定向验证通过,51 个屏蔽位置静态校验通过 | | Pylint | E0102 | 同名函数或方法重复定义。 | 13 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | E0203 | 成员在定义前被访问。 | 2 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | E0602 | 引用了未定义变量或名称。 | 6 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | E0606 | 变量可能在赋值前被使用。 | 9 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | R0124 | 条件在和自身比较。 | 1 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | R0205 | 继承 object 没有实际意义。 | 3 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | R0916 | 布尔条件过于复杂。 | 7 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | R1701 | 多个 isinstance 可合并。 | 4 | 使用元组合并类型判断,保持原判断语义 | R1701 定向验证通过,退出码 0 | | Pylint | R1702 | 嵌套层级过深。 | 8 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | R1704 | 局部变量重用了参数名。 | 7 | 在对应代码处添加 pylint 局部屏蔽;自动生成文件按当前源码 AST 定位;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | R1710 | 不同分支返回值不一致。 | 14 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | R1714 | 等值判断链可改成成员判断。 | 87 | 在 85 条当前诊断对应代码处添加 pylint 局部屏蔽;2 条旧基线诊断对应文件已不存在;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | R1716 | 多个比较可合并为链式比较。 | 3 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | R1719 | if 表达式可以进一步简化。 | 10 | 将布尔三元表达式改为直接条件判断或 not 表达式 | R1719 定向验证通过,退出码 0 | | Pylint | R1721 | 推导式外层包装多余。 | 36 | 将不必要的推导式改为 list(...)、range(...) 或 dict(...) 标准构造 | R1721 定向验证通过,退出码 0 | | Pylint | R1724 | continue 后存在冗余 else。 | 1 | 删除 continue 后的 else 并顺延后续分支 | R1724/R1728/R1729/R1730/R1733/R1736 定向验证通过,退出码 0 | | Pylint | R1728 | 可用生成器替代临时列表。 | 3 | 将 max([...])、tuple([...]) 改为生成器表达式 | R1724/R1728/R1729/R1730/R1733/R1736 定向验证通过,退出码 0 | | Pylint | R1729 | all() 中不需要构造临时列表。 | 21 | 去掉 all([...]) 外层列表,改为生成器表达式 | R1724/R1728/R1729/R1730/R1733/R1736 定向验证通过,退出码 0 | | Pylint | R1730 | 手写条件可用 min() 表达。 | 1 | 将条件赋值改为 axis = min(axis, -1) | R1724/R1728/R1729/R1730/R1733/R1736 定向验证通过,退出码 0 | | Pylint | R1733 | 遍历字典时又通过 key 取值。 | 8 | 改为直接遍历字典 values 并使用当前 value | R1724/R1728/R1729/R1730/R1733/R1736 定向验证通过,退出码 0 | | Pylint | R1736 | 遍历列表时又通过 index 取当前列表元素。 | 4 | 使用 enumerate 得到的元素替代同列表索引访问 | R1724/R1728/R1729/R1730/R1733/R1736 定向验证通过,退出码 0 | | Pylint | R1725 | super() 还在使用显式参数形式。 | 28 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0106 | 表达式求值后没有被使用。 | 2 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0108 | lambda 可以直接用普通函数替代。 | 2 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0122 | 使用了 exec。 | 6 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0123 | 使用了 eval。 | 7 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0127 | 变量被自赋值。 | 1 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0133 | 单独写了异常对象但没有抛出。 | 1 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0201 | 属性在 __init__ 之外定义。 | 2 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0211 | @staticmethod 仍接收实例或类参数。 | 1 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0221 | 重写方法参数与父类不一致。 | 1 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0231 | 子类初始化未调用父类 __init__。 | 2 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0246 | 重写方法只是原样委托给父类。 | 2 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0511 | 代码中保留了 FIXME/TODO 标记。 | 1 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0602 | 使用了 global,但未形成有效全局赋值。 | 8 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0621 | 局部名称遮蔽了外层作用域变量。 | 20 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0622 | 覆盖了 Python 内置名称。 | 259 | 在对应代码处添加 pylint 局部屏蔽;自动生成文件按当前源码 AST 定位;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0631 | 循环变量在循环外被引用。 | 1 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0632 | 解包数量与数据结构不匹配。 | 9 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W0640 | 闭包捕获了循环变量。 | 5 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | | Pylint | W1508 | 环境变量默认值类型不合适。 | 3 | 在对应代码处添加 pylint 局部屏蔽;未新增全局屏蔽配置 | 186 个非生成涉及文件定向验证通过,513 个屏蔽位置静态校验通过 | See merge request: Ascend/torchair!3417 | 29 天前 | |
docs: add design document template guidance Co-authored-by: stevenaw0<huangguijun@huawei.com> # message auto-generated for no-merge-commit merge: !3449 merge docs/design-doc-template into master docs: add design document template guidance Created-by: stevenaw0 Commit-by: stevenaw0 Merged-by: ascend-robot Description: ## 变更描述 - 新增设计文档模板 docs/zh/design/design_document_template.md。 - 在 AGENTS.md 中要求所有设计文档/spec/设计方案输出先读取并完整遵循该模板。 ## 测试 - [x] git diff --check - [x] 已确认模板路径与 AGENTS.md 引用一致 - [ ] 未运行代码测试(仅文档和规则变更) See merge request: Ascend/torchair!3449 | 26 天前 | |
build: 升级C++编译标准至c++20 Co-authored-by: chenhaozhe<chenhaozhe1@huawei.com> # message auto-generated for no-merge-commit merge: !3478 merge cpp20 into master build: 升级C++编译标准至c++20 Created-by: c_34 Commit-by: chenhaozhe Merged-by: ascend-robot Description: ### 背景 新版 PyTorch 头文件强制要求 C++20,torchair 仍以 C++17 编译时,构建 torch_npu 目标报错: ATen/ATen.h:5: #error C++20 or later compatible compiler is required to use ATen. torch/all.h:5: #error C++20 or later compatible compiler is required to use PyTorch. torch_npu_stub.cpp 经 GetCANNInfo.h 引入 torch 头,因编译标准为 C++17 触发上述 #error。 [2026/07/30 20:12:06.576 GMT+08:00] [ 56%] Built target _abi_compat_ge_apis [2026/07/30 20:12:06.576 GMT+08:00] [ 57%] Building CXX object torchair/CMakeFiles/_torchair.dir/cann_ir_ability/cann_ir_ability.cpp.o [2026/07/30 20:12:06.576 GMT+08:00] [ 61%] Building CXX object torchair/CMakeFiles/_torchair.dir/concrete_graph/export.cpp.o [2026/07/30 20:12:06.576 GMT+08:00] [ 61%] Building CXX object torchair/CMakeFiles/_torchair.dir/concrete_graph/executor.cpp.o [2026/07/30 20:12:06.576 GMT+08:00] [ 63%] Building CXX object torchair/CMakeFiles/_torchair.dir/concrete_graph/concrete_graph.cpp.o [2026/07/30 20:12:06.576 GMT+08:00] [ 64%] Building CXX object torchair/CMakeFiles/_torchair.dir/concrete_graph/hdc_channel.cpp.o [2026/07/30 20:12:06.576 GMT+08:00] [ 64%] Building CXX object torchair/CMakeFiles/_torchair.dir/concrete_graph/logger.cpp.o [2026/07/30 20:12:06.576 GMT+08:00] [ 66%] Building CXX object torchair/CMakeFiles/_torchair.dir/concrete_graph/npu_aoe.cpp.o [2026/07/30 20:12:06.576 GMT+08:00] In file included from /opt/_internal/cpython-3.10.20/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/torch.h:4, [2026/07/30 20:12:06.576 GMT+08:00] from /workspace/CODE/third_party/torchair/torchair/torchair/include/executor.h:10, [2026/07/30 20:12:06.576 GMT+08:00] from /workspace/CODE/third_party/torchair/torchair/torchair/concrete_graph/executor.cpp:1: [2026/07/30 20:12:06.576 GMT+08:00] /opt/_internal/cpython-3.10.20/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/all.h:5:2: error: #error C++20 or later compatible compiler is required to use PyTorch. [2026/07/30 20:12:06.576 GMT+08:00] 5 | #error C++20 or later compatible compiler is required to use PyTorch. [2026/07/30 20:12:06.576 GMT+08:00] | ^~~~~ [2026/07/30 20:12:06.577 GMT+08:00] In file included from /opt/_internal/cpython-3.10.20/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/torch.h:4, [2026/07/30 20:12:06.577 GMT+08:00] from /workspace/CODE/third_party/torchair/torchair/torchair/include/executor.h:10, [2026/07/30 20:12:06.577 GMT+08:00] from /workspace/CODE/third_party/torchair/torchair/torchair/include/concrete_graph.h:8, [2026/07/30 20:12:06.577 GMT+08:00] from /workspace/CODE/third_party/torchair/torchair/torchair/concrete_graph/concrete_graph.cpp:3: [2026/07/30 20:12:06.577 GMT+08:00] /opt/_internal/cpython-3.10.20/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/all.h:5:2: error: #error C++20 or later compatible compiler is required to use PyTorch. [2026/07/30 20:12:06.577 GMT+08:00] 5 | #error C++20 or later compatible compiler is required to use PyTorch. [2026/07/30 20:12:06.577 GMT+08:00] | ^~~~~ [2026/07/30 20:12:06.577 GMT+08:00] In file included from /opt/_internal/cpython-3.10.20/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/torch.h:4, [2026/07/30 20:12:06.577 GMT+08:00] from /workspace/CODE/third_party/torchair/torchair/torchair/include/executor.h:10, [2026/07/30 20:12:06.577 GMT+08:00] from /workspace/CODE/third_party/torchair/torchair/torchair/include/concrete_graph.h:8, [2026/07/30 20:12:06.577 GMT+08:00] from /workspace/CODE/third_party/torchair/torchair/torchair/concrete_graph/export.cpp:4: [2026/07/30 20:12:06.577 GMT+08:00] /opt/_internal/cpython-3.10.20/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/all.h:5:2: error: #error C++20 or later compatible compiler is required to use PyTorch. [2026/07/30 20:12:06.577 GMT+08:00] 5 | #error C++20 or later compatible compiler is required to use PyTorch. [2026/07/30 20:12:06.577 GMT+08:00] | ^~~~~ [2026/07/30 20:12:06.577 GMT+08:00] [ 67%] Building CXX object torchair/CMakeFiles/_torchair.dir/concrete_graph/session.cpp.o [2026/07/30 20:12:06.577 GMT+08:00] In file included from /opt/_internal/cpython-3.10.20/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/types.h:4, [2026/07/30 20:12:06.577 GMT+08:00] from /opt/_internal/cpython-3.10.20/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:5, [2026/07/30 20:12:06.577 GMT+08:00] from /opt/_internal/cpython-3.10.20/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:4, [2026/07/30 20:12:06.577 GMT+08:00] from /opt/_internal/cpython-3.10.20/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:5, [2026/07/30 20:12:06.577 GMT+08:00] from /opt/_internal/cpython-3.10.20/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:4, [2026/07/30 20:12:06.577 GMT+08:00] from /opt/_internal/cpython-3.10.20/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data.h:4, [2026/07/30 20:12:06.577 GMT+08:00] from /opt/_internal/cpython-3.10.20/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/all.h:10: [2026/07/30 20:12:06.577 GMT+08:00] /opt/_internal/cpython-3.10.20/lib/python3.10/site-packages/torch/include/ATen/ATen.h:5:2: error: #error C++20 or later compatible compiler is required to use ATen. [2026/07/30 20:12:06.577 GMT+08:00] 5 | #error C++20 or later compatible compiler is required to use ATen. ### 改动 - CMake 构建:CMAKE_CXX_STANDARD 17 → 20(CMakeLists.txt、tests/CMakeLists.txt),torch_npu_local_stub 等 stub 目标随之以 C++20 编译。 - 运行时 g++ 编译:-std=c++17 → -std=c++20(custom_op_compiler.py、inductor_npu_ext compiler/revert_ascir、示例 setup.py)。 - 测试:torchair_customop_compiler_st.py 断言同步更新为 -std=c++20。 See merge request: Ascend/torchair!3478 | 19 天前 | |
| 23 小时前 | ||
pre-commit by rule=trailing-whitespace Co-authored-by: guanlongfeng<guanlongfeng1@huawei.com> # message auto-generated for no-merge-commit merge: !2931 merge clean_code into master pre-commit by rule=trailing-whitespace Created-by: glf2016 Commit-by: guanlongfeng Merged-by: ascend-robot Description: pre-commit-clean-code-rule=trailing-whitespace See merge request: Ascend/torchair!2931 | 3 个月前 | |
Add yurongkun to the repository approvers and reviewers Co-authored-by: dingdairong<dingdairong@huawei.com> # message auto-generated for no-merge-commit merge: !3533 merge chore/add-committer into master Add yurongkun to the repository approvers and reviewers Created-by: dingdairong Commit-by: dingdairong Merged-by: ascend-robot Description: - Add yurongkun to approvers - Add yurongkun to reviewers See merge request: Ascend/torchair!3533 | 8 天前 | |
ttfhw-解决关联issue Co-authored-by: guanlongfeng<guanlongfeng1@huawei.com> # message auto-generated for no-merge-commit merge: !3483 merge ttfhw_v2 into master ttfhw-解决关联issue Created-by: glf2016 Commit-by: guanlongfeng Merged-by: ascend-robot Description: Description: 网站:https://gitcode.com/TTFHVV/ttfhw-skills ttfhw-verify-baseos torchair 让大模型来搭建 环境,并执行ut、st验证 See merge request: Ascend/torchair!3483 | 16 天前 | |
torch air framework supported now | 3 年前 | |
(master)torch npu is renamed to TorchNPU Co-authored-by: lyz0328<liyanzhen@huawei.com> # message auto-generated for no-merge-commit merge: !3359 merge master into master (master)torch npu is renamed to TorchNPU Created-by: lyz0328 Commit-by: lyz0328 Merged-by: ascend-robot Description: (master)torch npu is renamed to TorchNPU See merge request: Ascend/torchair!3359 | 1 个月前 | |
clean code Co-authored-by: guanlongfeng<guanlongfeng1@huawei.com> # message auto-generated for no-merge-commit merge: !3171 merge clean_code_clang-format into master clean code Created-by: glf2016 Commit-by: guanlongfeng Merged-by: ascend-robot Description: clean_code_clang-format c++ clean code See merge request: Ascend/torchair!3171 | 2 个月前 | |
更新readme文件,方便ai进行读取并部署环境 Co-authored-by: guanlongfeng<guanlongfeng1@huawei.com> # message auto-generated for no-merge-commit merge: !3467 merge master into master 更新readme文件,方便ai进行读取并部署环境 Created-by: glf2016 Commit-by: guanlongfeng Merged-by: ascend-robot Description: 更新readme文件,方便ai进行读取并部署环境 See merge request: Ascend/torchair!3467 | 22 天前 | |
optimize torchair and pta ci time Co-authored-by: guanlongfeng<guanlongfeng1@huawei.com> # message auto-generated for no-merge-commit merge: !2987 merge ci_times into master optimize torchair and pta ci time Created-by: glf2016 Commit-by: guanlongfeng Merged-by: ascend-robot Description: optimize torchair and pta ci time See merge request: Ascend/torchair!2987 | 3 个月前 | |
add release/ut/st ci build and coverage generate | 3 年前 | |
pre-commit by rule=trailing-whitespace Co-authored-by: guanlongfeng<guanlongfeng1@huawei.com> # message auto-generated for no-merge-commit merge: !2931 merge clean_code into master pre-commit by rule=trailing-whitespace Created-by: glf2016 Commit-by: guanlongfeng Merged-by: ascend-robot Description: pre-commit-clean-code-rule=trailing-whitespace See merge request: Ascend/torchair!2931 | 3 个月前 | |
optimize torchair and pta ci time Co-authored-by: guanlongfeng<guanlongfeng1@huawei.com> # message auto-generated for no-merge-commit merge: !2987 merge ci_times into master optimize torchair and pta ci time Created-by: glf2016 Commit-by: guanlongfeng Merged-by: ascend-robot Description: optimize torchair and pta ci time See merge request: Ascend/torchair!2987 | 3 个月前 | |
| 1 个月前 | ||
fix docs bug Co-authored-by: hulida<hulida@huawei.com> Co-authored-by: fu-hao-huawei<fuhao16@huawei.com> Co-authored-by: chenweiheng<chenweiheng1@hisilicon.com> Co-authored-by: SunYaping<sunyaping4@huawei.com> Co-authored-by: Achilles_d<duanchengyuan@huawei.com> Co-authored-by: zhukkk<zhuke11@huawei.com> Co-authored-by: tangjie66<tangjie66@huawei.com> # message auto-generated for no-merge-commit merge: !2811 merge ass into master fix docs bug Created-by: Sunyp01 Commit-by: Sunyp01;Achilles_d;fu-hao-huawei;chenweiheng;hulida;tangjie66;zhukkk;SunYaping Merged-by: ascend-robot Description: fix doc bug See merge request: Ascend/torchair!2811 | 4 个月前 |
简介
本项目开发了名为TorchAir(Torch Ascend Intermediate Representation)的扩展库,支持用户基于PyTorch框架和TorchNPU插件在昇腾NPU上使用图模式进行推理。 TorchAir继承自PyTorch框架Dynamo模式,将PyTorch的FX图转换为GE计算图,并提供了GE计算图在昇腾NPU的编译与执行的能力。
- 如果您想了解如何使用TorchAir,可以优先通过访问TorchAir图模式使用指南,了解关于TorchAir的更多信息。
- 如果您计划为TorchAir贡献代码,请参考README内容。
安装与卸载
1.安装
- 安装依赖
在安装TorchAir之前,请参考版本配套表和支持型号说明,确保您的硬件能够使用TorchAir,并安装最新昇腾软件栈。 建议:执行ut和简单用例请使用docker/Dockerfile中推荐的版本。
- 编译准备
克隆TorchAir代码仓
git clone https://gitcode.com/ascend/torchair.git
下载依赖三方库
cd torchair
git submodule update --init --recursive
配置编译环境,执行配置命令
配置只需要进行一次,用于获取pytorch的编译选项(如当前的torch是否开启ABI)及Ascend sdk的安装路径(如果需要在本地CPU上进行调试)。
cd ./torchair
bash ./configure
默认情况下,执行上述命会弹出如下的交互式会话窗口
您的会话可能有所不同。
Please specify the location of python with available torch 2.1.x installed. [Default is /usr/bin/python3]
(You can make this quiet by set env [TARGET_PYTHON_PATH]):
此时,要求您输入安装了 Torch 2.1 版本的python解释器路径,如果默认路径是正确的,直接回车,否则请输入正确的 python 解释器路径。
您可以通过设置
TARGET_PYTHON_PATH环境变量,来抑制交互式窗口弹出,但是要确保路径是有效的,否则,仍然会要求您输入正确的 python 解释器路径。
键入后,会耗费几秒钟以确保您的输入是有效的,接着,会弹出下面的交互式窗口
Specify the location of ascend sdk for debug on localhost or leave empty.
(You can make this quiet by set env [ASCEND_SDK_PATH]):
如果您不需要在本地CPU模拟执行,可以直接回车跳过。否则,需要输入昇腾处理器开发套件的安装路径(默认安装路径通常为/usr/local/Ascend/ascend-toolkit/latest/)。
您可以通过设置
ASCEND_SDK_PATH环境变量指定 Ascend CANN SDK 目录,你后续需要执行UT或者简单用例则需要提前设置,仅编译构建可设置NO_ASCEND_SDK环境变量指定不需要 SDK 来抑制交互式窗口弹出。
键入后,等待配置完成。
- 编译
执行以下命令,编译生成TorchAir安装包:
mkdir build
cd build
cmake ..
make torchair -j8
- 安装
编译完成后,会在build/dist/dist/目录下生成名为torchair-{version}-py3-none-any.whl的安装包文件。
您可以直接使用pip安装该安装包,或者使用make命令安装至您configure时指定的python环境中。
make install_torchair
2.卸载
torchair的卸载只需要执行命令:
pip3 uninstall torchair
如需要保存卸载日志,可在pip3 uninstall命令后面加上参数--log <PATH>,并对您指定的目录<PATH>做好权限管控。
快速上手
本的调试(最小CPU调试):
1、在执行./configure设置ASCEND_SDK_PATH如(ASCEND_SDK_PATH=xx/Ascend/ascend-toolkit/latest/)。
2、执行环境设置
source tools/env.sh
npu设备调试:
1、安装torch_npu
torch_npu版本可以根据环境要求安装,请参照[版本配套表]。
pip3 install numpy
pip3 install pyyaml
pip3 install setuptools
pip3 install torch_npu==2.12 # 通过pip安装torch_npu时会自动安装依赖的torch版本
如果安装了真实torch_npu,需要把torch_npu的stubs模块链接环境去除,否则无法正常使用。 如LD_LIBRARY_PATH中去除/workspace/build/stubs设置,如果没有设置请忽略。
2、安装CANN主线版本
npu调试依赖CANN主线版本。如果您是外部用户,可以联系对应的支撑团队获取安装包。
执行前,需要执行 CANN 安装目录下的 set_env.sh 设置 CANN 相关环境变量
例如CANN安装路径为
/usr/local/Ascend/cann,则执行:
source /usr/local/Ascend/cann/set_env.sh
执行以下python脚本快速验证TorchAir基本功能
import torch
import torchair
config = torchair.CompilerConfig()
npu_backend = torchair.get_npu_backend(compiler_config=config)
class Model(torch.nn.Module):
def __init__(self):
super().__init__()
def forward(self, x, y):
return torch.add(x, y)
model = Model()
model = torch.compile(model, backend=npu_backend, dynamic=False)
x = torch.randn(2, 2)
y = torch.randn(2, 2)
model(x, y)
特性介绍
TorchAir常用特性如下,全量特性介绍请访问docs获取详细教程。
| 特性功能 | 功能介绍 |
|---|---|
| 日志功能 | 日志功能 |
| graph dump功能 | 图dump功能 |
| dynamo export功能 | air格式图导出功能 |
| data dump功能 | 精度数据dump功能 |
| graph fusion功能 | 用户自定义关闭/开启部分融合算子功能 |
| experimental性能提升功能 | 试验性质功能,不同功能适用于特定场景,详见参考资料 |
| converter功能拓展 | 用户自行扩展模型中缺失的converter功能 |
| 支持的aten API清单 | 支持的aten API清单 |
版本配套表
本项目与PyTorch、TorchNPU、CANN以及Python的版本匹配详情如下:
| TorchAir版本 | PyTorch版本 | TorchNPU版本 | CANN版本 | Python版本 |
|---|---|---|---|---|
| master(主线) | 2.7.1 + | 在研版本 | 在研版本 | Python3.10.x |
| v26.1.0 | 2.7.1 + | v26.1.0 | 9.1.0 | Python3.10.x / Python3.11.x |
| v26.0.0 | 2.7.1 + | v26.0.0 | 9.0.0 | Python3.10.x / Python3.11.x |
| 7.3.0 | 2.6.0 / 2.7.1 / 2.8.0 | 7.3.0 | 8.5.0 | Python3.9.x / Python3.10.x / Python3.11.x |
| 7.3.0 | 2.9.0 | 7.3.0 | 8.5.0 | Python3.9.x / Python3.10.x / Python3.11.x / Python3.12.x |
| 7.2.0 | 2.1.0 | 7.2.0 | 8.3.RC1 | Python3.8.x / Python3.9.x / Python3.10.x / Python3.11.x |
| 7.2.0 | 2.6.0 / 2.7.1 / 2.8.0 | 7.2.0 | 8.3.RC1 | Python3.9.x / Python3.10.x / Python3.11.x |
| 7.1.0 | 2.1.0 | 7.1.0 | 8.2.RC1 | Python3.8.x / Python3.9.x / Python3.10.x / Python3.11.x |
| 7.1.0 | 2.5.1 / 2.6.0 | 7.1.0 | 8.2.RC1 | Python3.9.x / Python3.10.x / Python3.11.x |
| 7.0.0 | 2.1.0 / 2.3.1 / 2.4.0 | 7.0.0 | 8.1.RC1 | Python3.8.x / Python3.9.x / Python3.10.x / Python3.11.x |
| 7.0.0 | 2.5.1 | 7.0.0 | 8.1.RC1 | Python3.9.x / Python3.10.x / Python3.11.x |
torch_npu的版本选择请参照[版本配套表],下载地址:TorchNPUReleases。
支持的型号
- Ascend 950PR/Ascend 950DT
- Atlas A3 训练系列产品/Atlas A3 推理系列产品
- Atlas A2 训练系列产品/Atlas A2 推理系列产品
贡献
如果您计划为TorchAir做出贡献,请参考CONTRIBUTING。
联系我们

安全声明
TorchAir安全声明参考SECURITY_README文件。
许可证
TorchAir插件使用BSD许可证。详见LICENSE文件。
免责声明
致TorchAir使用者
- TorchAir提供的模型仅供您用于非商业目的。
- 对于各模型,TorchAir平台仅提示性地向您建议可用于训练的数据集,华为不提供任何数据集,如您使用这些数据集进行训练,请您特别注意应遵守对应数据集的License,如您因使用数据集而产生侵权纠纷,华为不承担任何责任。
- 如您在使用TorchAir模型过程中,发现任何问题(包括但不限于功能问题、合规问题),请在GitCode提交issue,我们将及时审视并解决。
致数据集所有者
如果您不希望您的数据集在TorchAir中的模型被提及,或希望更新TorchAir中的模型关于您的数据集的描述,请在GitCode提交issue,我们将根据您的issue要求删除或更新您的数据集描述。衷心感谢您对TorchAir的理解和贡献。