TorchAir 支持用户基于PyTorch框架和torch_npu插件在昇腾NPU上使用图模式进行推理。
| Files | Last commit | Last update |
|---|---|---|
chore: 移除 superpowers skill 配置及 AGENTS.md 相关引用(#801) Co-authored-by: stevenaw0<huangguijun@huawei.com> # message auto-generated for no-merge-commit merge: !3724 merge chore/remove-superpowers-skill into master chore: 移除 superpowers skill 配置及 AGENTS.md 相关引用(#801) Created-by: stevenaw0 Commit-by: stevenaw0 Merged-by: ascend-robot Description: # Pull Request ## 描述 移除仓库中第三方 superpowers skill/插件的启用配置,并同步改写 AGENTS.md 中引用 superpowers 的段落。 具体变更: - .claude/settings.json:删除 enabledPlugins 中的 superpowers@claude-plugins-official 条目 - .opencode/opencode.json:删除 plugin 中的 superpowers@git+https://github.com/obra/superpowers.git 条目 - AGENTS.md:"设计文档输出规范"章节去掉 superpowers brainstorming skill 表述,改为通用表述(仍必须先读取 docs/zh/contributions/design_document_template.md 并按模板输出) 变更原因: 1. superpowers 插件需从 github.com 拉取,离线/内网环境下 opencode 启动会失败或长时间等待 2. 插件注入的 brainstorming 等流程与仓库自有设计文档规范冲突,AGENTS.md 需额外声明兜底规则 3. 第三方插件随仓库配置分发但未登记在开源软件清单中,存在合规风险 4. 仓库已有等价能力(设计文档模板 + 自建 skill),无需保留外部插件 ## 变更类型 请选择本次引入的变更类型: <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [ ] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [x] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 ## 关联的Issue https://gitcode.com/Ascend/torchair/issues/801 ## 如何测试 描述测试此变更的步骤和前提条件: 1. python3 -c "import json; json.load(open('.claude/settings.json')); json.load(open('.opencode/opencode.json'))",JSON 解析通过 2. grep -ri superpower .claude/settings.json .opencode/opencode.json AGENTS.md,无残留引用 3. git diff --name-only HEAD~1 | xargs pre-commit run --files,全部 Passed(gitleaks-offline-scan 因本地缺少 ./gitleaks 二进制无法执行,属环境限制;本变更为纯删除配置行与文档改写,未引入任何凭据) 4. 启动 AI 编码助手不再拉取 superpowers 插件,仓库自有 skill 与设计文档模板流程不受影响 ## 核对清单 <!-- [x] 表示选中 --> - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 本次变更仅涉及 AI 编码助手配置文件与贡献者指引文档,不涉及任何运行时代码、构建脚本和测试用例。 设计文档输出规范保持不变:仍必须读取仓库设计文档模板并覆盖模板中的每个章节。 See merge request: Ascend/torchair!3724 | 1 month ago | |
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 | 3 months ago | |
ci: .修复pre-commit任务名称,解决例外备案指标问题 Co-authored-by: wujinyuan1<wujinyuan1@huawei.com> # message auto-generated for no-merge-commit merge: !3949 merge master into master ci: .修复pre-commit任务名称,解决例外备案指标问题 Created-by: wujinyuan1 Commit-by: wujinyuan1 Merged-by: ascend-robot Description: <!-- 感谢您的合入申请! --> ### 当前PR是否有AI参与: [x] 否 ### PR功能描述 / 为什么需要这个合入**: 修复pre-commit任务名称,解决例外备案指标问题 https://gitcode.com/Ascend/torchair/issues/936 ### 该PR关联的issue *(格式为fixes #<issue号>, 或者resolves #<issue号>)*: fixes # https://gitcode.com/Ascend/torchair/issues/936 ### 希望检视人员了解: See merge request: Ascend/torchair!3949 | 2 days ago | |
chore: 移除 superpowers skill 配置及 AGENTS.md 相关引用(#801) Co-authored-by: stevenaw0<huangguijun@huawei.com> # message auto-generated for no-merge-commit merge: !3724 merge chore/remove-superpowers-skill into master chore: 移除 superpowers skill 配置及 AGENTS.md 相关引用(#801) Created-by: stevenaw0 Commit-by: stevenaw0 Merged-by: ascend-robot Description: # Pull Request ## 描述 移除仓库中第三方 superpowers skill/插件的启用配置,并同步改写 AGENTS.md 中引用 superpowers 的段落。 具体变更: - .claude/settings.json:删除 enabledPlugins 中的 superpowers@claude-plugins-official 条目 - .opencode/opencode.json:删除 plugin 中的 superpowers@git+https://github.com/obra/superpowers.git 条目 - AGENTS.md:"设计文档输出规范"章节去掉 superpowers brainstorming skill 表述,改为通用表述(仍必须先读取 docs/zh/contributions/design_document_template.md 并按模板输出) 变更原因: 1. superpowers 插件需从 github.com 拉取,离线/内网环境下 opencode 启动会失败或长时间等待 2. 插件注入的 brainstorming 等流程与仓库自有设计文档规范冲突,AGENTS.md 需额外声明兜底规则 3. 第三方插件随仓库配置分发但未登记在开源软件清单中,存在合规风险 4. 仓库已有等价能力(设计文档模板 + 自建 skill),无需保留外部插件 ## 变更类型 请选择本次引入的变更类型: <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [ ] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [x] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 ## 关联的Issue https://gitcode.com/Ascend/torchair/issues/801 ## 如何测试 描述测试此变更的步骤和前提条件: 1. python3 -c "import json; json.load(open('.claude/settings.json')); json.load(open('.opencode/opencode.json'))",JSON 解析通过 2. grep -ri superpower .claude/settings.json .opencode/opencode.json AGENTS.md,无残留引用 3. git diff --name-only HEAD~1 | xargs pre-commit run --files,全部 Passed(gitleaks-offline-scan 因本地缺少 ./gitleaks 二进制无法执行,属环境限制;本变更为纯删除配置行与文档改写,未引入任何凭据) 4. 启动 AI 编码助手不再拉取 superpowers 插件,仓库自有 skill 与设计文档模板流程不受影响 ## 核对清单 <!-- [x] 表示选中 --> - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 本次变更仅涉及 AI 编码助手配置文件与贡献者指引文档,不涉及任何运行时代码、构建脚本和测试用例。 设计文档输出规范保持不变:仍必须读取仓库设计文档模板并覆盖模板中的每个章节。 See merge request: Ascend/torchair!3724 | 1 month ago | |
[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 | 3 months ago | |
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 | 6 months ago | |
| 2 days ago | ||
[Bugfix] Support explicit Gloo groups for static kernel compilation Co-authored-by: ganon0327<zhoujialong4@huawei.com> # message auto-generated for no-merge-commit merge: !3946 merge fix/static-kernel-explicit-group-env into master [Bugfix] Support explicit Gloo groups for static kernel compilation Created-by: ganon0327 Commit-by: ganon0327 Merged-by: ascend-robot Description: ### PR功能描述 / 为什么需要这个合入 只有子域 A 的成员进入静态编译时,按整机创建辅助 Gloo 组会超时,并可能使后建子域 B 的组编号不一致。新增 static_kernel_compile_group 配置,复用调用方已创建的节点内 Gloo 组。组大小、根 rank、JSON 汇总、广播和同步均使用指定组,显式路径不依赖 LOCAL_WORLD_SIZE。 安装进程区分自有目录与当前使用目录,接收其他组的安装路径后,退出时只清理自有目录。显式组提交完整 JSON 集合,通过已有 run 包缓存复用产物。文档补充 HCCL 业务组与 Gloo 辅助组的配置示例。 ### 该PR关联的issue 暂未关联。 ### 希望检视人员了解 - 显式 Gloo 组由调用方管理生命周期。组成员须恰好覆盖本节点本轮编译参与者,并能访问 JSON 及安装路径。 - 在原有 hcom_static_kernel_test.py 中增加正向用例 test_static_kernel_explicit_subgroups,验证 A=[1] 完成静态编译后晚建 B=[0,1],B AllReduce 与真实编译推理均正常,并断言共生成两份 run 包。 - 已在 CANN 9.3.0、两个 Gloo 进程共享一张 910B3 的环境运行该用例,约 52 秒通过。 - 测试命令:python npugraph_ex/tests/smoke/hcom_static_kernel_test.py HcomStaticKernelTest.test_static_kernel_explicit_subgroups -v - 完整 pre-commit 检查通过。多卡 HCCL 已验证。 See merge request: Ascend/torchair!3946 | 2 days ago | |
| 2 days ago | ||
开启indirect后多单轴reduce融合与gather水平融合 Co-authored-by: mulong933<chenlong254@huawei.com> # message auto-generated for no-merge-commit merge: !3959 merge feat/gather-mul-reduce-fusion into master 开启indirect后多单轴reduce融合与gather水平融合 Created-by: mulong933 Commit-by: mulong933 Merged-by: ascend-robot Description: <!-- 感谢您的合入申请! --> ### 当前PR是否有AI参与: [x] 否 [ ] 是 __1. AI Agent 平台: __2. AI 模型: __3. Prompt上下文 : ### PR功能描述 / 为什么需要这个合入**: ### 该PR关联的issue *(格式为fixes #<issue号>, 或者resolves #<issue号>)*: fixes # fix[#944](https://gitcode.com/Ascend/torchair/issues/944) ### 希望检视人员了解: See merge request: Ascend/torchair!3959 | 16 hours ago | |
| 2 days ago | ||
[Bugfix] Support explicit Gloo groups for static kernel compilation Co-authored-by: ganon0327<zhoujialong4@huawei.com> # message auto-generated for no-merge-commit merge: !3946 merge fix/static-kernel-explicit-group-env into master [Bugfix] Support explicit Gloo groups for static kernel compilation Created-by: ganon0327 Commit-by: ganon0327 Merged-by: ascend-robot Description: ### PR功能描述 / 为什么需要这个合入 只有子域 A 的成员进入静态编译时,按整机创建辅助 Gloo 组会超时,并可能使后建子域 B 的组编号不一致。新增 static_kernel_compile_group 配置,复用调用方已创建的节点内 Gloo 组。组大小、根 rank、JSON 汇总、广播和同步均使用指定组,显式路径不依赖 LOCAL_WORLD_SIZE。 安装进程区分自有目录与当前使用目录,接收其他组的安装路径后,退出时只清理自有目录。显式组提交完整 JSON 集合,通过已有 run 包缓存复用产物。文档补充 HCCL 业务组与 Gloo 辅助组的配置示例。 ### 该PR关联的issue 暂未关联。 ### 希望检视人员了解 - 显式 Gloo 组由调用方管理生命周期。组成员须恰好覆盖本节点本轮编译参与者,并能访问 JSON 及安装路径。 - 在原有 hcom_static_kernel_test.py 中增加正向用例 test_static_kernel_explicit_subgroups,验证 A=[1] 完成静态编译后晚建 B=[0,1],B AllReduce 与真实编译推理均正常,并断言共生成两份 run 包。 - 已在 CANN 9.3.0、两个 Gloo 进程共享一张 910B3 的环境运行该用例,约 52 秒通过。 - 测试命令:python npugraph_ex/tests/smoke/hcom_static_kernel_test.py HcomStaticKernelTest.test_static_kernel_explicit_subgroups -v - 完整 pre-commit 检查通过。多卡 HCCL 已验证。 See merge request: Ascend/torchair!3946 | 2 days ago | |
放开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 | 3 months ago | |
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 | 11 months ago | |
fix(torchair): operator.getitem 保持 python原生执行路径,修复 torch2.15 下 converter 拒收报错 Co-authored-by: weixin_44016285<chenlinhao5@huawei.com> # message auto-generated for no-merge-commit merge: !3933 merge fix/torch215-getitem-eager-path into master fix(torchair): operator.getitem 保持 python原生执行路径,修复 torch2.15 下 converter 拒收报错 Created-by: weixin_44016285 Commit-by: weixin_44016285 Merged-by: ascend-robot Description: <!-- 感谢您的合入申请! --> ### 当前PR是否有AI参与: [x] 否 [ ] 是 __1. AI Agent 平台: __2. AI 模型: __3. Prompt上下文 : ### PR功能描述 / 为什么需要这个合入**: torch 2.15 起 operator.getitem 被注册为 polyfill 并从 trace_rules._builtin_function_ids 移除,_wrap 门控翻转后 getitem 节点落入 converter 分发,因非 OpOverload 被拒收: 普通构图报 "Failed to auto-generated converter ... not an instance of OpOverload", record_ascend_ir 模式经 mock 路径报 "ge_outputs must be list or a tuple."。 新增 _is_direct_eval_builtin():将 operator.getitem 显式纳入 python原生执行 路径 (对多输出算子的 ValuePack 列表取下标,不产生 GE 节点)。版本比较使用 packaging.version, 不能用字符串比较("2.9" >= "2.15" 按字符串为 True)。torch 2.13/2.15 双版本回归通过。 ### 该PR关联的issue *(格式为fixes #<issue号>, 或者resolves #<issue号>)*: fixes [#933](https://gitcode.com/Ascend/torchair/issues/933) ### 希望检视人员了解: See merge request: Ascend/torchair!3933 | 3 days ago | |
| 2 days ago | ||
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 | 3 months ago | |
[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 | 7 months ago | |
[fix] skip external graph memory bases for autofuse Co-authored-by: ChengLyric<licheng236@huawei.com> # message auto-generated for no-merge-commit merge: !3671 merge fix/autofuse-skip-external-memory-base into master [fix] skip external graph memory bases for autofuse Created-by: LyriCheng Commit-by: ChengLyric Merged-by: ascend-robot Description: [fix] skip external graph memory bases for autofuse See merge request: Ascend/torchair!3671 | 1 month ago | |
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 | 6 months ago | |
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 | 2 months ago | |
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 | 3 months ago | |
放开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 | 3 months ago | |
chore: 移除 superpowers skill 配置及 AGENTS.md 相关引用(#801) Co-authored-by: stevenaw0<huangguijun@huawei.com> # message auto-generated for no-merge-commit merge: !3724 merge chore/remove-superpowers-skill into master chore: 移除 superpowers skill 配置及 AGENTS.md 相关引用(#801) Created-by: stevenaw0 Commit-by: stevenaw0 Merged-by: ascend-robot Description: # Pull Request ## 描述 移除仓库中第三方 superpowers skill/插件的启用配置,并同步改写 AGENTS.md 中引用 superpowers 的段落。 具体变更: - .claude/settings.json:删除 enabledPlugins 中的 superpowers@claude-plugins-official 条目 - .opencode/opencode.json:删除 plugin 中的 superpowers@git+https://github.com/obra/superpowers.git 条目 - AGENTS.md:"设计文档输出规范"章节去掉 superpowers brainstorming skill 表述,改为通用表述(仍必须先读取 docs/zh/contributions/design_document_template.md 并按模板输出) 变更原因: 1. superpowers 插件需从 github.com 拉取,离线/内网环境下 opencode 启动会失败或长时间等待 2. 插件注入的 brainstorming 等流程与仓库自有设计文档规范冲突,AGENTS.md 需额外声明兜底规则 3. 第三方插件随仓库配置分发但未登记在开源软件清单中,存在合规风险 4. 仓库已有等价能力(设计文档模板 + 自建 skill),无需保留外部插件 ## 变更类型 请选择本次引入的变更类型: <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [ ] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [x] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 ## 关联的Issue https://gitcode.com/Ascend/torchair/issues/801 ## 如何测试 描述测试此变更的步骤和前提条件: 1. python3 -c "import json; json.load(open('.claude/settings.json')); json.load(open('.opencode/opencode.json'))",JSON 解析通过 2. grep -ri superpower .claude/settings.json .opencode/opencode.json AGENTS.md,无残留引用 3. git diff --name-only HEAD~1 | xargs pre-commit run --files,全部 Passed(gitleaks-offline-scan 因本地缺少 ./gitleaks 二进制无法执行,属环境限制;本变更为纯删除配置行与文档改写,未引入任何凭据) 4. 启动 AI 编码助手不再拉取 superpowers 插件,仓库自有 skill 与设计文档模板流程不受影响 ## 核对清单 <!-- [x] 表示选中 --> - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 本次变更仅涉及 AI 编码助手配置文件与贡献者指引文档,不涉及任何运行时代码、构建脚本和测试用例。 设计文档输出规范保持不变:仍必须读取仓库设计文档模板并覆盖模板中的每个章节。 See merge request: Ascend/torchair!3724 | 1 month ago | |
fix: 根据 PyTorch 版本选择 C++ 编译标准 (#757) Co-authored-by: stevenaw0<huangguijun@huawei.com> # message auto-generated for no-merge-commit merge: !3669 merge fix/issue-757-cxx-standard into master fix: 根据 PyTorch 版本选择 C++ 编译标准 (#757) Created-by: stevenaw0 Commit-by: stevenaw0 Merged-by: ascend-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 根据当前 PyTorch 版本选择 TorchAir 的 C++ 编译标准:PyTorch < 2.13 使用 C++17,PyTorch >= 2.13 使用 C++20。同步覆盖 CMake 构建、TorchAir 自定义算子编译和 Inductor wrapper 运行时编译路径。 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> https://gitcode.com/Ascend/torchair/issues/757 ## 测试 <!--描述进行了哪些测试来验证你的改动。--> 1. 在 torch-npu-build-2.13.0-py311 环境确认 PyTorch 2.13.0+cpu 选择 c++20。 2. 验证 PyTorch 2.12.0 选择 c++17。 3. 使用 PyTorch 2.13 配置并完成完整 torchair CMake 编译。 4. Python 文件通过 py_compile,git diff --check 通过。 ## 类型标签 <!-- [x] 表示选中 --> - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: Ascend/torchair!3669 | 1 month ago | |
docs: 新增源码编译安装指南并注册到导航菜单(ttfhw社区整改) Co-authored-by: guanlongfeng<guanlongfeng1@huawei.com> # message auto-generated for no-merge-commit merge: !3873 merge update_doc into master docs: 新增源码编译安装指南并注册到导航菜单(ttfhw社区整改) Created-by: glf2016 Commit-by: guanlongfeng Merged-by: ascend-robot Description: <!-- 感谢您的合入申请! --> ### 当前PR是否有AI参与: [x] 否 [ ] 是 __1. AI Agent 平台: __2. AI 模型: __3. Prompt上下文 : ### PR功能描述 / 为什么需要这个合入**: ### 该PR关联的issue *(格式为fixes #<issue号>, 或者resolves #<issue号>)*: fixes # ### 希望检视人员了解: See merge request: Ascend/torchair!3873 | 14 days ago | |
| 2 days ago | ||
fix(docs): 修复 master 分支的代码示例错误、冗余代码及属性名错误 Co-authored-by: yvaniii<yuanqiangjian1@huawei.com> # message auto-generated for no-merge-commit merge: !3735 merge yvan/fix-master-docs into master fix(docs): 修复 master 分支的代码示例错误、冗余代码及属性名错误 Created-by: yvaniii Commit-by: yvaniii Merged-by: ascend-robot Description: 修复 master 分支的代码示例错误、冗余代码及属性名错误 See merge request: Ascend/torchair!3735 | 1 month ago | |
| 2 days ago | ||
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 | 6 months ago | |
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 | 2 months ago | |
| 2 days ago | ||
| 2 days ago | ||
torch air framework supported now | 3 years ago | |
| 2 days ago | ||
fix(docs): 修复 master 分支的代码示例错误、冗余代码及属性名错误 Co-authored-by: yvaniii<yuanqiangjian1@huawei.com> # message auto-generated for no-merge-commit merge: !3735 merge yvan/fix-master-docs into master fix(docs): 修复 master 分支的代码示例错误、冗余代码及属性名错误 Created-by: yvaniii Commit-by: yvaniii Merged-by: ascend-robot Description: 修复 master 分支的代码示例错误、冗余代码及属性名错误 See merge request: Ascend/torchair!3735 | 1 month ago | |
| 2 days ago | ||
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 | 4 months ago | |
docs: build.sh 支持 -s 只运行指定单个ST用例并更新UT示例(ttfhw社区整改,耗时30min以内) Co-authored-by: glf2016<13739288457@163.com> # message auto-generated for no-merge-commit merge: !3899 merge readme_v2 into master docs: build.sh 支持 -s 只运行指定单个ST用例并更新UT示例(ttfhw社区整改,耗时30min以内) Created-by: glf2016 Commit-by: glf2016 Merged-by: ascend-robot Description: build.sh: -s 支持追加用例名(仅运行指定ST用例),仅构建所需产物后在 tests/st 执行;run_test 增加 TORCH_DEVICE_BACKEND_AUTOLOAD=0;usage 更新。README: UT验证步骤2 示例改为 bash build.sh -s torchair_aclgraph_st。 See merge request: Ascend/torchair!3899 | 10 days ago | |
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 | 6 months ago | |
add release/ut/st ci build and coverage generate | 3 years ago | |
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 | 6 months ago | |
fixbug: issue#560、issue#562 Co-authored-by: PiyZZ<ling15255468810@gmail.com> # message auto-generated for no-merge-commit merge: !3325 merge master into master fixbug: issue#560、issue#562 Created-by: PiyZZ Commit-by: PiyZZ Merged-by: ascend-robot Description: fixbug: issue#560 (configure.py 使用已移除的 distutils.sysconfig,在 Python 3.12 上配置阶段崩溃) fixbug: issue#562 (configure 脚本中 config_file 变量未用 $ 引用,缓存跳过机制失效) See merge request: Ascend/torchair!3325 | 2 months ago | |
fixbug: issue#560、issue#562 Co-authored-by: PiyZZ<ling15255468810@gmail.com> # message auto-generated for no-merge-commit merge: !3325 merge master into master fixbug: issue#560、issue#562 Created-by: PiyZZ Commit-by: PiyZZ Merged-by: ascend-robot Description: fixbug: issue#560 (configure.py 使用已移除的 distutils.sysconfig,在 Python 3.12 上配置阶段崩溃) fixbug: issue#562 (configure 脚本中 config_file 变量未用 $ 引用,缓存跳过机制失效) See merge request: Ascend/torchair!3325 | 2 months ago | |
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 | 7 months ago | |
| 2 days ago |
Introduction
English | 简体中文
This project develops an extension library named TorchAir (Torch Ascend Intermediate Representation), which enables you to run inference in graph mode on Ascend NPUs based on the PyTorch framework and the TorchNPU plugin. TorchAir inherits from the Dynamo mode of the PyTorch framework, converts PyTorch FX graphs into GE computing graphs, and provides the capability to compile and execute GE computing graphs on Ascend NPUs.
- To learn how to use TorchAir, visit the TorchAir graph mode user guide first for more information about TorchAir.
- If you plan to contribute code to TorchAir, refer to this README.
Installation and Uninstallation
Using existing operators: Prepare the driver, firmware, CANN, PyTorch, and TorchNPU according to the TorchNPU installation guide. After the installation, verify the NPU environment by following the TorchNPU quick start.
Building from source: For more installation, compilation, and uninstallation instructions, refer to Building from Source.
Post-Installation Verification
Run the following Python script to check whether TorchAir has been installed successfully (set the CANN environment variables first in an NPU environment).
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)
If no NPU environment is available, specify the Ascend SDK path during configuration and run source tools/env.sh to set LD_LIBRARY_PATH (including the stub .so files and SDK libraries), so that you can perform minimal debugging on the local CPU.
UT Verification
After the installation, run UT tests in the source root directory to further verify that the TorchAir functions properly.
-
Run ST tests.
System tests are Python scripts in the
tests/st/directory, such astorchair_st.pyandtorchair_aclgraph_st.py. Taketorchair_eager_st.pyas an example. To run only this test case, run the following command:bash build.sh -s torchair_eager_st.pyThe preceding single-test-case method is recommended for verification. A full
bash build.sh -uorbash build.sh -srun takes a long time, depends on a complete UT/ST test environment, and is susceptible to the runtime environment. Therefore, it is not a recommended verification entry point.
Features
The commonly used TorchAir features are as follows. For the complete feature introduction, visit docs for detailed tutorials.
| Feature | Description |
|---|---|
| Logging | Logging |
| Graph dump | Graph dump |
| Dynamo export | Exports graphs in AIR format |
| Data dump | Dumps precision data |
| Graph fusion | Allows you to disable or enable some fusion operators as needed |
| Experimental performance improvement | Experimental features. Different features apply to specific scenarios. See the references for details. |
| Converter extension | Allows you to extend the converters that are missing for your model |
| Supported aten API list | List of supported aten APIs |
Version Compatibility
TorchAir must be used with specific versions of PyTorch, TorchNPU, CANN, and Python. For recommended version combinations and version compatibility details (including the TorchNPU installation package version and the PyTorch and Python version compatibility table), refer to Version Compatibility.
Supported Models
- Ascend 950PR&950DT products
- Atlas A3 products
- Atlas A2 products
Contributing
If you plan to contribute to TorchAir, refer to CONTRIBUTING.
Contact Us

Security Statement
For the TorchAir security statement, refer to the SECURITY_README file.
License
The TorchAir plugin uses the BSD license. For details, see the LICENSE file.
Disclaimer
To TorchAir Users
- The models provided by TorchAir are for your non-commercial purposes only.
- For each model, the TorchAir platform only suggests datasets that you can use for training. Huawei does not provide any datasets. If you use these datasets for training, strictly comply with the license of the corresponding dataset. Huawei shall not be liable for any infringement disputes arising from your use of the datasets.
- If you find any issues (including but not limited to functional and compliance issues) while using TorchAir models, submit an issue on GitCode. We will review and resolve the issues promptly.
To Dataset Owners
If you do not want your dataset to be mentioned in the models in TorchAir, or you want to update the description of your dataset in the TorchAir models, submit an issue on GitCode. We will delete or update the description of your dataset as requested in your issue. Thank you sincerely for your understanding of and contribution to TorchAir.