Compare commits

...
72 Commits
Author SHA1 Message Date
pta-robot b71ce635a5 Update op_plugin commit id
Co-authored-by: pta-robot<pta_robot@163.com>



# message auto-generated for no-merge-commit merge:
!47709 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

Update op_plugin commit id

Created-by: pta-robot
Commit-by: pta-robot
Merged-by: ascend-robot
Description: Commited by @pta-robot at 2026-10-10 22:02:01.

See merge request: Ascend/pytorch!47709
2026-10-10 23:28:45 +08:00
pta-robot cf81f52835 Update op_plugin commit id
Co-authored-by: pta-robot<pta_robot@163.com>



# message auto-generated for no-merge-commit merge:
!47694 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

Update op_plugin commit id

Created-by: pta-robot
Commit-by: pta-robot
Merged-by: ascend-robot
Description: Commited by @pta-robot at 2026-10-10 18:02:53.

See merge request: Ascend/pytorch!47694
2026-10-10 18:45:56 +08:00
lyx324521 04937a1321 测试环境排查修改& skills问题修改
Co-authored-by: lyx324521<liuyaxiong6@h-partners.com>



# message auto-generated for no-merge-commit merge:
!47621 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

测试环境排查修改& skills问题修改

Created-by: lyx324521
Commit-by: lyx324521
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**如有社区issue,请关联issue链接**</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [ ] 需求
- [ ] 问题单
- [ ] issue/工单https://gitcode.com/Ascend/pytorch/issues/3327
- [ ] 重构优化
- [ ] 资料更新

# 【修改方案】
测试环境排查修改
skills问题修改(快速入门)

# 【资料变更】
涉及

# 【接口变更】
不涉及

# 【功能验证】
> 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\
> 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [ ] 代码注释完备,正确记录错误日志
- [ ] 代码实现进行了返回值、空指针等校验
- [ ] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [ ] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!47621
2026-10-10 09:51:41 +08:00
pta-robot 9e96ee2b96 Update op_plugin commit id
Co-authored-by: pta-robot<pta_robot@163.com>



# message auto-generated for no-merge-commit merge:
!47633 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

Update op_plugin commit id

Created-by: pta-robot
Commit-by: pta-robot
Merged-by: ascend-robot
Description: Commited by @pta-robot at 2026-10-09 18:02:52.

See merge request: Ascend/pytorch!47633
2026-10-09 18:48:40 +08:00
wzyly 6c200c4385 modify document
Co-authored-by: m0_68000167<wangzhiyuan86@h-partners.com>



# message auto-generated for no-merge-commit merge:
!47615 merge cherry-pick-mr-47614-1791533569596-auto into v2.14.0-26.2.0

modify document

Created-by: wzyly
Commit-by: m0_68000167
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**如有社区issue,请关联issue链接**</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [ ] 需求
- [ ] 问题单
- [x] issue/工单https://gitcode.com/Ascend/op-plugin/issues/320
- [ ] 重构优化
- [x] 资料更新

# 【修改方案】
测试环境检视问题修改

# 【资料变更】
涉及

# 【接口变更】
不涉及

# 【功能验证】
> 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\
> 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [x] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!47615
2026-10-09 17:10:54 +08:00
SoraAzzz a08322736f [sync] PR-46807: Use controlled profiler warnings for unsupported features
Co-authored-by: xieanran<694099604@qq.com>



# message auto-generated for no-merge-commit merge:
!47439 merge sync-pr46807-master-to-v2.14.0-26.2.0 into v2.14.0-26.2.0

[sync] PR-46807: Use controlled profiler warnings for unsupported features

Created-by: ascend-ds-bot
Commit-by: xieanran
Merged-by: ascend-robot
Description: 
### 1. Origin pull request:
https://gitcode.com/Ascend/pytorch/merge_requests/46807

### 2. Original pull request related issue(s):
https://gitcode.com/Ascend/pytorch/issues/5088

### 3. Original pull request related commit(s):
| Sha | Datetime | Message |
|---|---|---|
|[4b1371bb](https://gitcode.com/Ascend/pytorch/commit/4b1371bbcd598f88a1a0f576d8e88fdc57852982)|2026-09-22 16:43:29 +0800 CST|log macro rectification<br>|


See merge request: Ascend/pytorch!47439
2026-10-09 15:35:59 +08:00
wzyly 68da6d881b modify document
Co-authored-by: m0_68000167<wangzhiyuan86@h-partners.com>



# message auto-generated for no-merge-commit merge:
!47565 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

modify document

Created-by: wzyly
Commit-by: m0_68000167
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**如有社区issue,请关联issue链接**</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [ ] 需求
- [ ] 问题单
- [x] issue/工单https://gitcode.com/Ascend/op-plugin/issues/320
- [ ] 重构优化
- [x] 资料更新

# 【修改方案】
测试环境检视问题修改

# 【资料变更】
涉及

# 【接口变更】
不涉及

# 【功能验证】
> 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\
> 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [x] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!47565
2026-10-09 09:56:49 +08:00
zwj223 e2c4074afe modify document
Co-authored-by: zwj223<zhangwenjing55@h-partners.com>



# message auto-generated for no-merge-commit merge:
!47315 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

modify document

Created-by: zwj223
Commit-by: zwj223
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**如有社区issue,请关联issue链接**</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>
[#5091](https://gitcode.com/Ascend/pytorch/issues/5091) 
- [ ] 需求
- [ ] 问题单
- [ ] issue/工单
- [ ] 重构优化
- [x] 资料更新

# 【修改方案】
根据HC大会的最新产品中英文命名,更新文档中的产品名
# 【资料变更】
修改所有涉及产品名称的文档
# 【接口变更】
不涉及
# 【功能验证】
不涉及
# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [x] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!47315
2026-10-09 09:47:31 +08:00
lyx324521 05b21ffb1e 更新26.2.0版本说明
Co-authored-by: lyx324521<liuyaxiong6@h-partners.com>



# message auto-generated for no-merge-commit merge:
!47564 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

更新26.2.0版本说明

Created-by: lyx324521
Commit-by: lyx324521
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**如有社区issue,请关联issue链接**</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [ ] 需求
- [ ] 问题单
- [x] issue/工单https://gitcode.com/Ascend/pytorch/issues/3327
- [ ] 重构优化
- [x] 资料更新

# 【修改方案】
更新版本说明
# 【资料变更】
涉及

# 【接口变更】
不涉及

# 【功能验证】
> 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\
> 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [x] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!47564
2026-10-09 09:44:13 +08:00
lyx324521 2b46cc4b7d 链接修改
Co-authored-by: lyx324521<liuyaxiong6@h-partners.com>



# message auto-generated for no-merge-commit merge:
!47566 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

链接修改

Created-by: lyx324521
Commit-by: lyx324521
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**如有社区issue,请关联issue链接**</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [ ] 需求
- [ ] 问题单
- [x] issue/工单https://gitcode.com/Ascend/pytorch/issues/3327
- [ ] 重构优化
- [x] 资料更新

# 【修改方案】
链接修改

# 【资料变更】
涉及

# 【接口变更】
不涉及

# 【功能验证】
> 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\
> 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [x] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!47566
2026-10-09 09:43:49 +08:00
chenrayray ef3ba21e0c docs: [v2.14.0-26.2.0] 补齐原生 API 硬件说明的 NPU 标签
Co-authored-by: Xinrui Chen<chenxinrui11@huawei.com>



# message auto-generated for no-merge-commit merge:
!47560 merge codex/fix-native-api-npu-tags-214-262 into v2.14.0-26.2.0

docs: [v2.14.0-26.2.0] 补齐原生 API 硬件说明的 NPU 标签

Created-by: chenrayray
Commit-by: Xinrui Chen
Merged-by: ascend-robot
Description: # 【合入来源】

- [x] issue/工单
- [x] 资料更新

关联 Issue:https://gitcode.com/Ascend/pytorch/issues/5276

# 【修改方案】

补齐 `v2.14.0-26.2.0` 原生 API 文档中 41 行硬件专属说明的 NPU 标签,并将确定性计算文档的两个标签范围扩展至完整硬件专属 API 表格,确保按硬件筛选时说明随对应产品显示。

1. 为遗漏的 A2、A3、950DT 产品支持条目分别补充 `910b`、`A3`、`950` 标签,新增 ID 避开文档已有 ID。
2. 为所有版本目录中的 MemPool 950DT 分配器限制补充 `950` 标签;将 Adam 的限制改为“<term>Atlas A2训练系列产品</term>和<term>Atlas A3训练系列产品</term>暂不支持将`fused`设置为`True`。”,使用 `910b,A3` 标签,使 A2/A3 筛选时显示不支持提示,950DT(A5)筛选时不显示此提示。
3. 将 private_apis.md 的全部表格转换为 37 个独立 API 条目,按原生 API 文档形式展示产品支持情况、限制与说明及 NPU 形式名称。分别以独立行标签包裹 A2、A3、950DT 支持条目,保留原表中 18 个 API 暂不支持 950DT 的信息;全部 NPU 起止标签独占一行。
4. 将确定性计算文档的结束标签移动至对应表格之后,覆盖表题、表头及全部 API 行。

# 【资料变更】

修改 `docs/zh/api/native_api/` 下 19 个 Markdown 文件,补齐硬件条件注释并将私有 API 表格转换为逐项文档形式,沿用目标分支现有硬件标识。

# 【接口变更】

不涉及。

# 【功能验证】

- 全量扫描 468 个文档,显式硬件说明未覆盖数为 0。
- 标签起止配对、文档内 ID 唯一性检查通过。
- 私有 API 文档的 37 个条目与基线表格逐项比对,API 名称、NPU 形式名称、产品支持情况、数据类型及版本限制均保留;除 Adam fused 限制按硬件筛选语境改写外,其他修改文件去除 NPU 注释后原文保持一致。
- 全量检查所有 NPU 起止标签均独占一行,配对完整、ID 唯一,硬件说明均被标签覆盖;私有 API 文档无残留表格或行内标签,确定性计算标签覆盖完整对应表格。
- 两个分支各 7 个 PyTorch 版本目录的 Adam fused 提示经筛选验证:910b、A3 可见,950 不可见。
- `git diff --check` 通过。
- 文档变更未运行 NPU UT 或完整文档站点构建;远端 CI 待运行确认。

# 【CheckList】

- [x] 代码注释完备,正确记录错误日志(不涉及运行时代码)
- [x] 代码实现进行了返回值、空指针等校验(不涉及运行时代码)
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [ ] PR持续集成流水线(CI)执行通过,代码检查无异常(待CI)


See merge request: Ascend/pytorch!47560
2026-10-09 09:39:33 +08:00
pta-robot 421abca74b Update torchair commit id
Co-authored-by: pta-robot<pta_robot@163.com>



# message auto-generated for no-merge-commit merge:
!47526 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

Update torchair commit id

Created-by: pta-robot
Commit-by: pta-robot
Merged-by: ascend-robot
Description: Commited by @pta-robot at 2026-09-30 22:03:56.

See merge request: Ascend/pytorch!47526
2026-10-09 09:04:58 +08:00
pta-robot c2d98049fa Update op_plugin commit id
Co-authored-by: pta-robot<pta_robot@163.com>



# message auto-generated for no-merge-commit merge:
!47578 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

Update op_plugin commit id

Created-by: pta-robot
Commit-by: pta-robot
Merged-by: ascend-robot
Description: Commited by @pta-robot at 2026-10-08 17:32:37.

See merge request: Ascend/pytorch!47578
2026-10-08 18:48:45 +08:00
wzyly a4c9be2840 modify document
Co-authored-by: m0_68000167<wangzhiyuan86@h-partners.com>



# message auto-generated for no-merge-commit merge:
!47548 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

modify document

Created-by: wzyly
Commit-by: m0_68000167
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**如有社区issue,请关联issue链接**</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [ ] 需求
- [ ] 问题单
- [x] issue/工单https://gitcode.com/Ascend/op-plugin/issues/320
- [ ] 重构优化
- [x] 资料更新

# 【修改方案】
资料链接修改

# 【资料变更】
涉及

# 【接口变更】
不涉及

# 【功能验证】
> 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\
> 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [x] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!47548
2026-10-08 14:27:53 +08:00
wuyouqi1 d5c7565ec5 fix: cut patch_getenv overhead from 3x to ~1x and gate it by TORCH_NPU_LOGS
Co-authored-by: wuyouqi1<wuyouqi1@h-partners.com>



# message auto-generated for no-merge-commit merge:
!47495 merge personal/fix-patch-getenv-3x-overhead-v2.14.0-26.2.0 into v2.14.0-26.2.0

fix: cut patch_getenv overhead from 3x to ~1x and gate it by TORCH_NPU_LOGS

Created-by: wuyouqi1
Commit-by: wuyouqi1
Merged-by: ascend-robot
Description: # 【合入来源】> **如有社区issue,请关联issue链接**\
> **请勿携带内部流程信息(需求链接、问题单、内部issue等)**


- [ ] 需求
- [ ] 问题单
- [x] issue/工单
- [ ] 重构优化
- [ ] 资料更新


关联issue:https://gitcode.com/Ascend/pytorch/issues/5090(Fixes #5090)


# 【修改方案】


`torch_npu/utils/patch_getenv.py` 使全进程 `os.getenv`/`os.environ.get` 开销达
~3.3x。根因:保存的原生 `os.getenv` 调用时重新解析 `environ.get`,再次进入被
patch 的实例属性(嵌套);且 `key in os.environ` 预检查本身即一次完整查找——
一次调用共 3 次真实查找。


修复:


1. 两个 patch 点共用一个 `_patched_getenv`,直读 `os.environ[key]`
   (KeyError 即未命中):恰好 1 次真实查找,构造上无嵌套
2. 仅当日志可观测时安装:`TORCH_NPU_LOGS`/`TORCH_LOGS` 已设置,或 import 时
   `torch_npu.env` logger 已可见 INFO。patch_getenv 早于
   `_add_logging_module()` 配置 logger,import 时 `isEnabledFor` 不可信,故按
   原始环境变量门控(与 ACL log 门禁做法一致);钩子为私有
   `_install()`,不进入公开 API 兼容性检查
3. UT:`test/utils/test_patch_getenv.py` 6 用例(门控/包装语义/单次查找计数);
   `test_torch_npu_init.py` 快照断言按门控分支


# 【资料变更】


不涉及


# 【接口变更】


不涉及。`os.getenv`/`os.environ.get` 返回值行为完全不变(含 bytes key 抛
TypeError 对齐),仅日志按需安装;默认配置不安装(原生直通)。


# 【功能验证】


| 场景 | 真实查找/次 | 耗时(py3.14) |
|---|---|---|
| native | 1 | 597 ns (1.00x) |
| 修复前 | 3 | 1974 ns (3.31x) |
| 修复后(已安装) | 1 | 626 ns (1.05x) |
| 修复后(默认不装) | 1 | 1.00x |


(py3.11 修复前 3.39x;纯 CPython 复现,与硬件/CANN 无关)


语义回归(命中/未命中/default/空串/kwargs/bytes key)、门控矩阵(默认不装,
`TORCH_NPU_LOGS`/`TORCH_LOGS`/预先配置 INFO 均安装)、端到端日志去重:全部
PASS。`test_api_compatibility` 复检通过(公开 callable 为空)。


本地 whl 实测(conda wyq_py10,torch_npu 2.7.1 whl):`test_patch_getenv.py`
6 用例全过;`test_torch_npu_init.py` 16 用例全过(test_14 按 #5230 skip)。


**test_14 临时 skip**:`test_torch_npu_init.py::test_14_dtensor_strategies_are_
registered_without_dynamo` 在 v2.7.1 HEAD 上确定性失败,与本 MR 无关——
!44496 的 flex_attention 补丁在 import 时经
`from torch.nn.attention import flex_attention` 拉入 `torch._dynamo`
(torch 2.7.x),破坏 #2788 的延迟导入契约。详见
https://gitcode.com/Ascend/pytorch/issues/5230,待修复后恢复用例。


# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]


- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等(fix)
- [x] PR持续集成流水线(CI)执行通过,代码检查无异常(个人分支暂未触发 CI,合入前补充)


See merge request: Ascend/pytorch!47495
2026-10-08 11:45:35 +08:00
pta-robot a29f62a964 Update op_plugin commit id
Co-authored-by: pta-robot<pta_robot@163.com>



# message auto-generated for no-merge-commit merge:
!47512 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

Update op_plugin commit id

Created-by: pta-robot
Commit-by: pta-robot
Merged-by: ascend-robot
Description: Commited by @pta-robot at 2026-09-30 18:03:41.

See merge request: Ascend/pytorch!47512
2026-10-08 09:30:49 +08:00
Jessedhd e29a6e39ad fix: prioritize explicit jit compile mode
Co-authored-by: Jessedhd<denghaodong3@huawei.com>



# message auto-generated for no-merge-commit merge:
!47435 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

fix: prioritize explicit jit compile mode

Created-by: Jessedhd
Commit-by: Jessedhd
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**https://gitcode.com/Ascend/pytorch/issues/5251**</font>> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [ ] 需求
- [x] 问题单
- [ ] issue/工单
- [ ] 重构优化
- [ ] 资料更新

# 【修改方案】
>1.修改module.cpp中THNPModule_is_jit_compile_false_wrap对jit_compile模式的判定逻辑,优先使用jitCompile判定,然后再使用jitCompileInit判定。符合代码设置的优先级关系,避免原方案在jitCompile为enable时直接通过判定jitCompileInit的状态决定返回值

# 【资料变更】
> 不涉及

# 【接口变更】
>不涉及

# 【功能验证】
> 初始化 JIT 为关闭后显式开启 JIT,验证显式配置优先,is_jit_compile_false() 返回 False

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [x] PR持续集成流水线(CI)执行通过,代码检查无异常

See merge request: Ascend/pytorch!47435
2026-09-30 19:57:17 +08:00
wuyouqi1 af2c3f818c fix(asd): 修正 matmul_checksum UT SupportedDevices 设备名(Ascend910C → Ascend910_93)
Co-authored-by: wuyouqi1<wuyouqi1@h-partners.com>



# message auto-generated for no-merge-commit merge:
!47472 merge personal/fix-checksum-ut-soc-v2.14.0-26.2.0 into v2.14.0-26.2.0

fix(asd): 修正 matmul_checksum UT SupportedDevices 设备名(Ascend910C → Ascend910_93)

Created-by: wuyouqi1
Commit-by: wuyouqi1
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**如有社区issue,请关联issue链接**</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [ ] 需求
- [ ] 问题单
- [ ] issue/工单
- [x] 重构优化
- [ ] 资料更新

# 【修改方案】
> 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\
> 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容)

1. `test/npu/test_matmul_checksum.py` 中 4 个 abft 用例的 `@SupportedDevices(['Ascend910B', 'Ascend910C'])` 修正为 `@SupportedDevices(['Ascend910B', 'Ascend910_93'])`。
2. 原因:torch_npu SoC 名称表中不存在 `Ascend910C`(A3 实际设备名为 `Ascend910_93xx`,`get_device_name` 返回,`SupportedDevices` 匹配名为 `Ascend910_93`),原写法导致 A3 机器上 4 个 abft 用例被误 skip(skip 理由为"设备不在支持列表",而非算子不可用)。
3. 与 op-plugin 仓 `_npu_matmul_abft_verify` 算子 UT 的设备门控写法保持一致。

# 【资料变更】
> 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写"不涉及"

不涉及

# 【接口变更】
> 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写"不涉及"

不涉及

# 【功能验证】
> 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\
> 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图

- 纯 UT 门控修正,不改变任何运行时行为。
- A2(Ascend910B)实测:`python test/npu/test_matmul_checksum.py -v` → 11/11 通过(行为不变)。
- A3(Ascend910_93):修复前 4 个 abft 用例因设备名不匹配被误 skip;修复后不再被设备门控拦截,按算子可用性探测正常判定(与 A2 行为一致)。

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [x] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!47472
2026-09-30 16:40:57 +08:00
qq_45774794 6005359aa8 community_follow
Co-authored-by: qq_45774794<hetiancheng1@huawei.com>



# message auto-generated for no-merge-commit merge:
!46908 merge shangfen_community_check_2.14 into v2.14.0-26.2.0

community_follow

Created-by: qq_45774794
Commit-by: qq_45774794
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**如有社区issue,请关联issue链接**</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [x] 需求
- [ ] 问题单
- [ ] issue/工单
- [ ] 重构优化
- [ ] 资料更新

# 【修改方案】
> 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\
> 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容)
社区演进,继承新接口和方法。本 PR 合并两个 2.14 社区特性跟随项:

社区演进,继承新接口和方法。本 PR 合并两个 2.14 社区特性跟随项:

## 一、pytorch/pytorch#188548:PyProcessGroup 补充 all_gather_single / reduce_scatter_single override(零适配,补测试锁定)

PyTorch 2.14(pytorch/pytorch#188548,对应 issue pytorch/pytorch#188542)为PyProcessGroup(pybind11 trampoline)补充 `all_gather_single`、`reduce_scatter_single`两个 C++ override。修复前,纯 Python 自定义 ProcessGroup(继承 torch.distributed.ProcessGroup的,如 Torchcomms)上由 C++内核发起的这些 collective(如 `torch.ops._c10d_functional.all_gather_into_tensor_out`)会穿透 trampoline 落到基类实现、因无 C++后端,导致getbackend()返回为空 报错;修复后正确路由到 Python override。

torch_npu 适配结论为**零适配**:改动仅在上游 C++ 头文件(PyProcessGroup.hpp),torch_npu 构建时使用所装 torch 的头文件,升级 torch 即自动获得;torch_npu 的 HCCL ProcessGroup 为 C++ 原生实现,不走 trampoline;无 Python API 签名变化。

新增 `test/distributed/test_pypg_npu.py`,将"零适配"结论固化为回归测试:

1. `test_all_gather_single_trampoline_npu`(torch>=2.14 版本门控):
   注册纯 Python 假 PG 后,在 NPU tensor 上通过`torch.ops._c10d_functional.all_gather_into_tensor_out`(CompositeExplicitAutograd
   设备无关 op,必然走 `group->all_gather_single` 虚函数)重放与上游测试完全相同的调用链,断言调用路由到 Python override(指纹登记)且结果正确,验证上游修复在
   torch_npu 环境生效。torch<2.14 无此桥,用例按版本跳过。
2. `test_reduce_scatter_single_npu`(全版本):
   Python 同名方法直接调用的 sanity 检查(不经 trampoline),验证假实现本身正确。

## 二、pytorch/pytorch#189353:object collectives 支持 weights_only(适配 + 补测试)

PyTorch 2.14(pytorch/pytorch#189353)为 object collectives(all_gather_object、gather_object、send_object_list、recv_object_list、broadcast_object_list、scatter_object_list)新增`weights_only` 参数(默认 False 向后兼容;True 时序列化走 `torch.save` / 反序列化走`torch.load(weights_only=True)` 安全模式)。

torch_npu 同步适配(当前 master 需同时兼容 torch 2.13 / 2.14,按`torch_npu._compat` 惯例做版本门控,以 `CURRENT_VERSION >= (2, 14)` 判定):

1. `torch_npu/distributed/distributed_c10d.py`:
      `_gather_object`(被 alias 为 `dist.gather_object`,是 torch_npu 唯一自定义实现的object collective)与上游签名对齐并适配:
   - 新增 `weights_only=False` 参数:torch >= 2.14 透传给上游`_object_to_tensor` / `_tensor_to_object` 的第 4 个参数,使 NPU 上`dist.gather_object(...,weights_only=True)` 可用;torch < 2.14 上游这两个函数无第 4 个参数,走原 3 参调用;显式传 `weights_only=True` 时直接`raise RuntimeError`,绝不静默降级到非安全的 pickle 反序列化路径;
   - 补充上游 pytorch#140827(RFC 0042)自 torch 2.6 起已有的 `group_dst` 参数(PTA 重写自 2024-12 引入后长期未同步):`dst` 为全局进程组视角、`group_dst`为 group 内视角,两者互斥(同时给出 raise ValueError);入口处将 `group_dst`规范化为全局 rank(`get_global_rank`),适配 PTA `_gather` 的全局视角约定;`dst` 默认值由 0 改为 None(两者均 None 时等价默认 dst=0,行为不变);
   - 修复子组 rootRank 转换(实测必现 bug):在引入 `group_dst` 参数后存在的隐性问题:PTA `_gather` 的 HCCL use_compatible_impl=true的 分支原将全局 `dst` 原样填入 `opts.rootRank` 直传ProcessGroupHCCL::gather(C++ assertRootRank 按**组内视角**校验 root ∈[0, size_))。HCCL用的是组内编号(从0开始),而此时传入的是全局编号(不一定从0开始)。在以往的默认组下全局等于组内侥幸正确,如果遇到子组不是从0开始的必崩,比如`new_group([2,3])`时,传入全局编号2将会导致HCCL找不到对应编号报错。添加`opts.rootRank = get_group_rank(group, dst)`保证传入HCCL的是组内编号。

其余 5 个 collectives 直接使用上游实现,升级后自动获得该能力,无需改动。

2. `test/distributed/test_c10d_object_collectives.py`:
    - 模块级新增 `_WEIGHTS_ONLY_PARAMS = [True, False] if CURRENT_VERSION >= (2, 14) else [False]`:torch 2.14 生成 True/False 两个变体,torch 2.13 只生成 False 变体;
     - 3 个现有用例(all_gather_object / broadcast_object_list / scatter_object_list)增加 `@parametrize("weights_only", _WEIGHTS_ONLY_PARAMS)` 覆盖,调用处按版本分支:2.14 透传 `weights_only` kwarg,2.13 完全不传(上游 2.13 签名无此参数,即使 False 变体传该 kwarg 也会 TypeError);
     - 新增 `test_gather_object`,覆盖 torch_npu 自定义的 `_gather_object` 实现(调用处无需版本分支:`_gather_object` 为 torch_npu 自身实现,签名已含该参数,2.13 上传 `weights_only=False` 走老路径);
     - 新增 `test_gather_object_weights_only_rejects_unsafe_object`:验证 PTA 自己的`_gather_object` 在 weights_only=True 下同样拒绝不安全对象。gather_object 仅dst rank 反序列化、仅 dst rank 抛异常,故用例采用各 rank 自行捕获、collective 结束后再断言的写法,避免 assertRaises 导致非 dst rank 失败或 barrier 死锁。加 `@unittest.skipIf(CURRENT_VERSION < (2, 14))` 门控;
     - 新增 `test_gather_object_group_dst`(parametrize weights_only):默认组下group_dst=0 与 dst=0 等价;
     - 新增 `test_gather_object_subgroup`:子组 [2,3] 上 `group_dst=0`(组内视角的全局 rank 2),rank2 断言收 [2, 3],回归锁定子组 rootRank 转换修复;用例内显式 `use_compatible_impl(True)` 强制走真实 HCCL gather 路径(不开则走 allgather 替代路径,不涉及 rootRank,测不到该修复);
     - 新增 `test_gather_object_dst_and_group_dst_conflict`:dst 与 group_dst 同时给出,应在通信前于所有 rank 抛 ValueError;
     - 新增 `test_weights_only_rejects_unsafe_object`,验证 weights_only=True 拒绝不安全对象,加 `@unittest.skipIf(CURRENT_VERSION < (2, 14))` 门控;
     - 修复测试骨架 `with_comms` 包装器未透传 `*args, **kwargs` 的问题(支持带参测试方法)。
# 【资料变更】
> 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及”

不涉及

# 【接口变更】
> 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及”

  涉及:`dist.gather_object` 新增可选参数 `weights_only`(默认 False,向后兼容,#189353)和 `group_dst`(默认 None,与 `dst` 互斥,对齐上游 2.6+ 签名);`dst` 默认值由 0改为 None(语义等价)。

# 【功能验证】
> 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\
> 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图

一、#188548:
社区新增测试用例测试结果:
![image.png](https://raw.gitcode.com/user-images/assets/7404318/7352464c-5272-42df-8562-41e764cb4bd5/image.png 'image.png')
PTA新增测试用例测试结果:
torch2.13+torch_npu环境运行 test_pypg_npu.py,2 个用例全部通过(新增的测试用例2.13未涉及)
![image.png](https://raw.gitcode.com/user-images/assets/7404318/cc200e5c-f1ad-4982-9502-5f47e145e045/image.png 'image.png')
torch 2.14 + torch_npu 环境运行 test_pypg_npu.py,2 个用例全部通过
![image-14.png](https://raw.gitcode.com/user-images/assets/7404318/1fb4ef7a-971f-479b-afd0-36c86684938d/image-14.png 'image-14.png')

二、#189353:
社区修改后的测试用例:
![image.png](https://raw.gitcode.com/user-images/assets/7404318/a6b2bc70-aee8-458e-8bb3-dcd2645fd038/image.png 'image.png')
![image.png](https://raw.gitcode.com/user-images/assets/7404318/bbc9a038-cf7e-4cf9-8319-16c2316cc937/image.png 'image.png')
PTA修改后的测试用例:
torch2.13+torchnpu下运行 test_c10d_object_collectives.py,全量7 个用例通过(每个用例默认weights_only是false,新增的测试用例2.13未涉及)
![image.png](https://raw.gitcode.com/user-images/assets/7404318/dc34b488-cda8-49f7-8626-0421d37adeec/image.png 'image.png')
torch2.14+torchnpu下运行 test_c10d_object_collectives.py,全量14个用例通过:
![image.png](https://raw.gitcode.com/user-images/assets/7404318/082c8b6e-6974-4e3b-84f8-f0b675593239/image.png 'image.png')
# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [ ] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!46908
2026-09-30 15:39:40 +08:00
SorryNaCN e6d99a7cfb [feat] [v2.14.0-26.2.0] Update DVM r2.11
Co-authored-by: huangchengnuo<huangchengnuo1@huawei.com>



# message auto-generated for no-merge-commit merge:
!47454 merge feat/dvm-r211-v2140-2620-20260930 into v2.14.0-26.2.0

[feat] [v2.14.0-26.2.0] Update DVM r2.11

Created-by: SorryNaCN
Commit-by: huangchengnuo
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> (如有)请关联需求文档/issue链接

- [ ] 需求
- [ ] 问题单
- [x] issue/工单
- [x] 重构优化
- [ ] 资料更新

将 DVM r2.11 升级与融合配置同步至 `v2.14.0-26.2.0`。

来源:[MR !47318](https://gitcode.com/Ascend/pytorch/merge_requests/47318),提交 `ac077c0a1311ef4fb6e27ebd9e714949de74c104`。

Fixes https://gitcode.com/Ascend/pytorch/issues/5234

# 【修改方案】
> 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\
> 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容)

1. 升级 DVM 到 r2.11。
2. 支持 DVM cat 融合。
3. 支持 DVM 完整 View 融合。
4. 支持 DVM VF 融合。
5. 修复 bug 并重构部分代码,包含 BF16 concat、RMSNorm 分解和融合配置。

# 【资料变更】
> 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及”

不涉及。

# 【接口变更】
> 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及”

DVM 配置新增(在加载 DVM backend 前设置):

- `enable_decomp_list = []`、`disable_decomp_list = []`:接受算子重载或重载包,禁用优先;支持显式启用 RMSNorm backward 分解。
- `matmul_fusion_rule = None`:可设置 `(n, m, k)` 回调,对应 `(..., m, k) @ (..., k, n)`;仅显式返回 `False` 时否决矩阵乘融合,沿用已有类型、形状限制和 K=1 lowering 行为。

# 【功能验证】
> 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\
> 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图

本次商发分支移植验证:

- 13 个变更文件与对应来源提交逐一一致,DVM gitlink 为 `2b3f462f116e491574ccc49cda1ae1a01e58cfe6`;`third_party/dvm/CMakeLists.txt` 未修改。
- 所有变更 Python 文件的 `py_compile` 和 `git diff --check` 通过。
- 本次未构建商发分支 wheel,未运行 NPU 测试;CI 结果待确认。

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [ ] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!47454
2026-09-30 15:26:07 +08:00
pta-robot 706950a966 Update torchair commit id
Co-authored-by: pta-robot<pta_robot@163.com>



# message auto-generated for no-merge-commit merge:
!47416 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

Update torchair commit id

Created-by: pta-robot
Commit-by: pta-robot
Merged-by: ascend-robot
Description: Commited by @pta-robot at 2026-09-29 22:03:41.

See merge request: Ascend/pytorch!47416
2026-09-30 14:46:28 +08:00
thickhair 7c7bf9ce5c [fix]: 修复setuptools包兼容性问题
Co-authored-by: thickhair<zp2165064878@163.com>



# message auto-generated for no-merge-commit merge:
!47400 merge pyproject_v2.14-26.2.0 into v2.14.0-26.2.0

[fix]: 修复setuptools包兼容性问题

Created-by: thickhair
Commit-by: thickhair
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**如有社区issue,请关联issue链接**</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [ ] 需求
- [ ] 问题单
- [x] issue/工单
https://gitcode.com/Ascend/pytorch/issues/4371
- [ ] 重构优化
- [ ] 资料更新

# 【修改方案】
【根因】:pyproject.toml 里的 [project] 块是对齐上游 PyTorch的,参考没有配套的 [tool.setuptools.dynamic] 表导致的。而 setup.py 早已把所有元数据(version、description、long_description、license、classifiers、entry_points、install_requires)显式传给了 setup(),所以这个 dynamic 声明是多余的。

【修复】:删掉了整个 [project] 块(共 15 行),让构建回归纯 setup.py 驱动——这正是本仓库的实际情况,也彻底绕开了 PEP 621 对 version/dynamic 的校验,对任何 setuptools 版本都稳定。

# 【资料变更】
不涉及

# 【接口变更】
不涉及

# 【功能验证】
测试已验证

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [x] PR持续集成流水线(CI)执行通过,代码检查无异常

See merge request: Ascend/pytorch!47400
2026-09-30 11:35:48 +08:00
wzyly 885870a43a modify document
Co-authored-by: m0_68000167<wangzhiyuan86@h-partners.com>



# message auto-generated for no-merge-commit merge:
!47448 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

modify document

Created-by: wzyly
Commit-by: m0_68000167
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**如有社区issue,请关联issue链接**</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [ ] 需求
- [ ] 问题单
- [x] issue/工单https://gitcode.com/Ascend/op-plugin/issues/320
- [ ] 重构优化
- [x] 资料更新

# 【修改方案】
doc-tools问题扫描修改

# 【资料变更】
涉及

# 【接口变更】
不涉及

# 【功能验证】
> 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\
> 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [x] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!47448
2026-09-30 10:27:20 +08:00
pta-robot 24b5f9b84f Update op_plugin commit id
Co-authored-by: pta-robot<pta_robot@163.com>



# message auto-generated for no-merge-commit merge:
!47361 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

Update op_plugin commit id

Created-by: pta-robot
Commit-by: pta-robot
Merged-by: ascend-robot
Description: Commited by @pta-robot at 2026-09-29 18:02:48.

See merge request: Ascend/pytorch!47361
2026-09-29 18:55:51 +08:00
LucciC 7a8dd81a02 [sync] PR-47065: [inductor] warn mlir backend deprecation and drop torch_mlir install print
Co-authored-by: LucciC<cuiliangcheng2@hisilicon.com>



# message auto-generated for no-merge-commit merge:
!47224 merge sync-pr47065-master-mlir-backend-deprecate-warn-to-v2.14.0-26.2.0 into v2.14.0-26.2.0

[sync] PR-47065: [inductor] warn mlir backend deprecation and drop torch_mlir install print

Created-by: ascend-ds-bot
Commit-by: LucciC
Merged-by: ascend-robot
Description: 
### 1. Origin pull request:
https://gitcode.com/Ascend/pytorch/merge_requests/47065

### 2. Original pull request related issue(s):
https://gitcode.com/Ascend/pytorch/issues/5089

### 3. Original pull request related commit(s):
| Sha | Datetime | Message |
|---|---|---|
|[cf5ce1fd](https://gitcode.com/Ascend/pytorch/commit/cf5ce1fd9bb4392df5348eea9c81513589fbb5e1)|2026-09-24 16:40:19 +0800 CST|[inductor] warn mlir backend deprecation and drop torch_mlir install print<br><br>Selecting npu_backend=mlir now emits FutureWarning to switch backends.<br>Remove the import-time print in ascend_npu_ir utils so DVM/shared paths<br>are not spammed when torch_mlir is absent.<br><br>Related: Ascend/pytorch#5089<br>|


See merge request: Ascend/pytorch!47224
2026-09-29 17:31:18 +08:00
jiabiao_o 3d44b3807e [inductor][fix] preserve CANN compatibility for Fast Launch
Co-authored-by: erwin<j18636938310@163.com>



# message auto-generated for no-merge-commit merge:
!47341 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

[inductor][fix] preserve CANN compatibility for Fast Launch

Created-by: jiabiao_o
Commit-by: erwin
Merged-by: ascend-robot
Description: # 【合入来源】

- [ ] 需求
- [x] 问题单
- [x] issue/工单:待创建配套公开 Issue 后填写链接并勾选
- [ ] 重构优化
- [ ] 资料更新

# 【修改方案】
1. **在 `bindings.cpp` 内部复用动态加载机制。** 在 `torch_npu/_inductor/experimental/python_wrapper_fast_launch/csrc/bindings.cpp` 的匿名命名空间内定义函数指针解析、能力查询和 `AclrtLaunchKernelWithHostArgs` 启动封装。在同一编译单元内先通过 `TORCH_NPU_REGISTER_LIBRARY` 注册 `libascendcl`,再通过 `TORCH_NPU_LOAD_FUNC` 注册接口,避免依赖其他文件的静态初始化顺序。使用 `decltype` 获取官方函数指针类型,通过 `TORCH_NPU_GET_FUNC` 调用已有 `FunctionLoader` 按需解析接口,消除对该新接口的强动态符号依赖

# 【资料变更】
涉及。更新 `torch_npu/_inductor/docs/feature/planned_fast_launch/planned_fast_launch.md`,补充运行时接口要求,以及接口缺失时回退到原 Triton launcher、缓存不可用结果的行为。

# 【接口变更】
不涉及跨代码仓或客户面可见的接口变更。新增接口为 TorchNPU 内部 C++ 封装及能力查询,现有 Python 接口和环境变量保持不变。

# 【功能验证】
## 问题复现 cann=8.3.RC1
![image.png](https://raw.gitcode.com/user-images/assets/7404318/378b6e7c-e1c2-4c5d-99fd-557f04bb7bc7/image.png 'image.png')
![image.png](https://raw.gitcode.com/user-images/assets/7404318/f9155337-a89f-4810-a2b5-f1a24fdb1a64/image.png 'image.png')
## 问题修复 cann=8.3.RC1
![image.png](https://raw.gitcode.com/user-images/assets/7404318/2b0204a9-2a81-407b-ae70-b8d25926f9a4/image.png 'image.png')

# 【CheckList】

- [ ] 代码注释完备,正确记录错误日志
- [ ] 代码实现进行了返回值、空指针等校验
- [ ] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [ ] PR持续集成流水线(CI)执行通过,代码检查无异常

# 【issues】
https://gitcode.com/Ascend/pytorch/issues/5144


See merge request: Ascend/pytorch!47341
2026-09-29 16:47:12 +08:00
SCh_zx 32e41e6953 update build doc
Co-authored-by: SCh-zx<1325467101@qq.com>



# message auto-generated for no-merge-commit merge:
!47343 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

update build doc

Created-by: SCh_zx
Commit-by: SCh-zx
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**如有社区issue,请关联issue链接**</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [ ] 需求
- [ ] 问题单
- [x] issue/工单
- [ ] 重构优化
- [ ] 资料更新

# 【修改方案】
> 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\
> 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容)

更新源码编译安装的资料和对应dockerfile

# 【资料变更】
> 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及”

# 【接口变更】
> 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及”

# 【功能验证】
> 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\
> 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [ ] 代码注释完备,正确记录错误日志
- [ ] 代码实现进行了返回值、空指针等校验
- [ ] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [ ] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!47343
2026-09-29 16:35:27 +08:00
limuan f95281dd32 distributed: support A5 compatible gather/scatter (v2.14.0-26.2.0)
Co-authored-by: limuan<liyijie16@huawei.com>



# message auto-generated for no-merge-commit merge:
!46951 merge a5-compatible-gather-scatter-v2.14.0-26.2.0 into v2.14.0-26.2.0

distributed: support A5 compatible gather/scatter (v2.14.0-26.2.0)

Created-by: limuan
Commit-by: limuan
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】

- [ ] 需求
- [x] 问题单
- [ ] issue/工单
- [ ] 重构优化
- [ ] 资料更新

# 【修改方案】
gather scatter 之前因cann限制兼容模型屏蔽了A5,现在cann解除对应的限制,放开A5的屏蔽
reduce scatter 异常输入增加告警提示
- Warn when reduce_scatter input elements do not match world_size * output elements.
# 【资料变更】
不涉及

# 【接口变更】
不涉及

# 【功能验证】
scatter ,gather开启兼容模式进行测试通过
![image.png](https://raw.gitcode.com/user-images/assets/7404318/0cb966a3-3ea3-4643-b505-5d35025fc0f4/image.png 'image.png')
# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [ ] 代码注释完备,正确记录错误日志
- [ ] 代码实现进行了返回值、空指针等校验
- [ ] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [ ] PR持续集成流水线(CI)执行通过,代码检查无异常



See merge request: Ascend/pytorch!46951
2026-09-29 16:31:54 +08:00
cai-weiwei1989 d1e38dda26 docs:PyTorch Profiler文档问题修改
Co-authored-by: cai-weiwei1989<734267852@qq.com>



# message auto-generated for no-merge-commit merge:
!47306 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

docs:PyTorch Profiler文档问题修改

Created-by: cai-weiwei1989
Commit-by: cai-weiwei1989
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**如有社区issue,请关联issue链接**</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [ ] 需求
- [ ] 问题单
- [x] issue/工单
- [ ] 重构优化
- [x] 资料更新

# 【修改方案】
> 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\
> 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容)

# 【资料变更】
1、格式修改
2、补全docs/zh/figures/profiler/torch_npu-profiler-schedule.png图中的skip_first_wait

# 【接口变更】
> 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及”

# 【功能验证】
> 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\
> 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [ ] 代码注释完备,正确记录错误日志
- [ ] 代码实现进行了返回值、空指针等校验
- [ ] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [ ] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!47306
2026-09-29 15:21:26 +08:00
Jiayi_Meng a781609439 fix: support 3D y sharding for grouped matmul add
Co-authored-by: Jiayi_Meng<mengjiayi5@huawei.com>



# message auto-generated for no-merge-commit merge:
!46900 merge sync-pr46093-v2.14.0-26.2.0 into v2.14.0-26.2.0

fix: support 3D y sharding for grouped matmul add

Created-by: Jiayi_Meng
Commit-by: Jiayi_Meng
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">关联 issue:#4723</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [ ] 需求
- [ ] 问题单
- [ ] issue/工单
- [ ] 重构优化
- [ ] 资料更新
关联 issue:#4723
# 【修改原因】

npu_grouped_matmul_add_ 的 DTensor D 维分片策略将输入和输出 y 的分片维度固定为 Shard(1),仅适用于二维 y。

在 Ascend 950 的三维 y=[G, M, D] 场景下,D 维对应 dim 2,使用 Shard(2) 时无法匹配现有策略,导致 sharding propagation 失败。

# 【修改方案】

在 torch_npu/distributed/tensor/_math_ops.py 的 custom_grouped_matmul_add__strategy 中,将输入和输出 y 的 D 维分片统一改为 Shard(y.ndim - 1),兼容二维与三维 y。



# 【资料变更】
不涉及

# 【接口变更】
不涉及

# 【功能验证】

在A2/A5上验证通过

(base) [root@localhost dtensor]# source /usr/local/Ascend/ascend-toolkit/set_env.sh && \
cd /autotest/pytorch/torch_autotest/api/pytorch/dtensor && \
python3 -m unittest test_dtensor_torch_npu_npu_grouped_matmul_add_.py
I0909 16:08:37.091000 141927 site-packages/torch/testing/_internal/common_distributed.py:741] Started process 0 with pid 145188
I0909 16:08:37.092000 141927 site-packages/torch/testing/_internal/common_distributed.py:741] Started process 1 with pid 145189
I0909 16:08:37.093000 141927 site-packages/torch/testing/_internal/common_distributed.py:741] Started process 2 with pid 145191
I0909 16:08:37.094000 141927 site-packages/torch/testing/_internal/common_distributed.py:741] Started process 3 with pid 145195
.I0909 16:08:54.244000 141927 site-packages/torch/testing/_internal/common_distributed.py:741] Started process 0 with pid 154066
I0909 16:08:54.245000 141927 site-packages/torch/testing/_internal/common_distributed.py:741] Started process 1 with pid 154067
I0909 16:08:54.246000 141927 site-packages/torch/testing/_internal/common_distributed.py:741] Started process 2 with pid 154068
I0909 16:08:54.247000 141927 site-packages/torch/testing/_internal/common_distributed.py:741] Started process 3 with pid 154069
.
----------------------------------------------------------------------
Ran 2 tests in 39.118s

OK

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [ ] 代码注释完备,正确记录错误日志
- [ ] 代码实现进行了返回值、空指针等校验
- [ ] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [ ] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!46900
2026-09-29 14:29:38 +08:00
huangyunlong2022 ca30d4c270 [sync] PR-46919: add typedef for aclmdlRICondHandle,aclmdlRICondTaskParams
Co-authored-by: huangyunlong2022<huangyunlong4@h-partners.com>



# message auto-generated for no-merge-commit merge:
!47246 merge sync-pr46919-2.12h-to-v2.14.0-26.2.0 into v2.14.0-26.2.0

[sync] PR-46919: add typedef for aclmdlRICondHandle,aclmdlRICondTaskParams

Created-by: ascend-ds-bot
Commit-by: huangyunlong2022
Merged-by: ascend-robot
Description: 
### 1. Origin pull request:
https://gitcode.com/Ascend/pytorch/merge_requests/46919

### 2. Original pull request related issue(s):
https://gitcode.com/Ascend/pytorch/issues/5095

### 3. Original pull request related commit(s):
| Sha | Datetime | Message |
|---|---|---|
|[9936eda2](https://gitcode.com/Ascend/pytorch/commit/9936eda2ba03bf55b35578164f4eb4d52f2ddb5d)|2026-09-23 16:50:23 +0800 CST|add typedef for aclmdlRICondHandle,aclmdlRICondTaskParams<br>|


See merge request: Ascend/pytorch!47246
2026-09-29 09:53:16 +08:00
pta-robot f07659c33e Update torchair commit id
Co-authored-by: pta-robot<pta_robot@163.com>



# message auto-generated for no-merge-commit merge:
!47293 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

Update torchair commit id

Created-by: pta-robot
Commit-by: pta-robot
Merged-by: ascend-robot
Description: Commited by @pta-robot at 2026-09-28 22:06:50.

See merge request: Ascend/pytorch!47293
2026-09-29 09:07:23 +08:00
pta-robot c530712e88 Update op_plugin commit id
Co-authored-by: pta-robot<pta_robot@163.com>



# message auto-generated for no-merge-commit merge:
!47255 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

Update op_plugin commit id

Created-by: pta-robot
Commit-by: pta-robot
Merged-by: ascend-robot
Description: Commited by @pta-robot at 2026-09-28 18:11:33.

See merge request: Ascend/pytorch!47255
2026-09-28 19:08:12 +08:00
wzyly a7734be291 modify document
Co-authored-by: m0_68000167<wangzhiyuan86@h-partners.com>



# message auto-generated for no-merge-commit merge:
!47194 merge cherry-pick-mr-47193-1790563912594-auto into v2.14.0-26.2.0

modify document

Created-by: wzyly
Commit-by: m0_68000167
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**如有社区issue,请关联issue链接**</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [ ] 需求
- [ ] 问题单
- [x] issue/工单https://gitcode.com/Ascend/op-plugin/issues/320
- [ ] 重构优化
- [x] 资料更新

# 【修改方案】
产品名称改名

# 【资料变更】
涉及

# 【接口变更】
不涉及

# 【功能验证】
> 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\
> 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [x] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!47194
2026-09-28 14:53:13 +08:00
ascend-robot 14326b485d [Usage]profiler logs optimize
Co-authored-by: hehongzhe<935062458@qq.com>



# message auto-generated for no-merge-commit merge:
!47166 merge fixwarns14 into v2.14.0-26.2.0

[Usage]profiler logs optimize

Created-by: hhz0
Commit-by: hehongzhe
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**如有社区issue,请关联issue链接**</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [ ] 需求
- [ ] 问题单
- [x] issue/工单
https://gitcode.com/Ascend/pytorch/issues/5069
- [ ] 重构优化
- [ ] 资料更新

# 【修改方案】
> 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\
> 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容)

1、CANN 支持默认导出 DB 时保留 op_attr;不支持时维持原有校验行为,并补充对应测试。
2、将动态 JSON 配置中这三个字段的缺省值分别设为空列表和 False,并补充缺省值测试。
3、使用 aten::、npu::、atb:: 前缀元组,通过 startswith() 统一匹配。
4、将 StepInfoDbParser 的告警改为明确指出 DB 文件可能缺失或不可访问,或具体缺少哪个表。
5、重试失败记为 INFO,重试耗尽时记一次 ERROR 后抛出异常。
6、kernel events 缺失提示,说明 NPU profiling 数据可能未采集,并建议检查 CANN plog 日志。

# 【资料变更】
> 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及”

不涉及

# 【接口变更】
> 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及”

不涉及

# 【功能验证】
> 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\
> 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图

下面是修改前,上面是修改后

![image.png](https://raw.gitcode.com/user-images/assets/7404318/1842a522-1c2e-4f58-93e0-99a0fbe0bc75/image.png 'image.png')

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [x] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!47166
2026-09-28 09:43:44 +08:00
pta-robot 7a697ae1c1 Update op_plugin commit id
Co-authored-by: pta-robot<pta_robot@163.com>



# message auto-generated for no-merge-commit merge:
!47114 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

Update op_plugin commit id

Created-by: pta-robot
Commit-by: pta-robot
Merged-by: ascend-robot
Description: Commited by @pta-robot at 2026-09-24 22:04:14.

See merge request: Ascend/pytorch!47114
2026-09-24 22:46:47 +08:00
ffmh fc38cc9f89 [v2.14.0-26.2.0][fix] Fix IsBaseFormatType for base StorageImpl
Co-authored-by: ffmh<fengminghao2@huawei.com>



# message auto-generated for no-merge-commit merge:
!47006 merge v2.14.0-26.2.0_fix_is_base_format into v2.14.0-26.2.0

[v2.14.0-26.2.0][fix] Fix IsBaseFormatType for base StorageImpl

Created-by: ffmh
Commit-by: ffmh
Merged-by: ascend-robot
Description: # 【合入来源】

- [ ] 需求
- [x] 问题单
- [ ] issue/工单
- [ ] 重构优化
- [ ] 资料更新

# 【修改方案】

1. 在 `FormatHelper::IsBaseFormatType(const at::Tensor&)` 中识别 Tensor 底层 `StorageImpl` 的实际类型。
2. 当底层对象为基础 `c10::StorageImpl` 时,直接将其判定为基础格式,避免按 `NPUStorageImpl` 读取 `NPUStorageDesc`。
3. 对其他 `StorageImpl` 保留原有 NPU format 获取及基础格式判断逻辑。
4. 删除 `test/npu/test_serialization.py` 中 legacy serialization 对 NPU Tensor 必须抛出 `NPUStorageImpl` 异常的过期校验,使其继续执行保存、加载及结果校验。

# 【资料变更】

不涉及。

# 【接口变更】

不涉及。

# 【功能验证】
以下接口用例均验证通过:
torch.save(..., _use_new_zipfile_serialization=False )
broadcast_object_list
scatter_object_list
send_object_list
![image.png](https://raw.gitcode.com/user-images/assets/7404318/ca006335-79c5-4981-bac7-981bcb271a69/image.png 'image.png')

# 【CheckList】

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [x] PR持续集成流水线(CI)执行通过,代码检查无异常

# 【关联 Issue】

- [Issue #5094](https://gitcode.com/Ascend/pytorch/issues/5094)

See merge request: Ascend/pytorch!47006
2026-09-24 22:26:34 +08:00
culechan 9789bb3ca0 [fix] fix 924
Co-authored-by: chenshuai<chenshuai81@huawei.com>



# message auto-generated for no-merge-commit merge:
!47061 merge cherry-pick-mr-47060-1790237830954-auto into v2.14.0-26.2.0

[fix] fix 924

Created-by: culechan
Commit-by: chenshuai
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**如有社区issue,请关联issue链接**</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [ ] 需求
- [ ] 问题单
- [x] issue/工单
- [ ] 重构优化
- [ ] 资料更新

# 【修改方案】
老版本在下发deterministic_level的时候,会给HCCL也下发确定性配置,做新需求的时候漏了同时给HCCL下发了

# 【资料变更】
不涉及

# 【接口变更】
不涉及

# 【功能验证】
验证已PASS

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [x] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!47061
2026-09-24 20:32:09 +08:00
xiu_21 fd175b4c36 fix: restore TORCH_DEVICE_BACKEND_AUTOLOAD when import torch_npu
Co-authored-by: 21xiu<caixiuxiu1@huawei.com>



# message auto-generated for no-merge-commit merge:
!47098 merge cherry-pick-mr-47097-1790244287659-auto into v2.14.0-26.2.0

fix: restore TORCH_DEVICE_BACKEND_AUTOLOAD when import torch_npu

Created-by: xiu_21
Commit-by: 21xiu
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**如有社区issue,请关联issue链接**</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [ ] 需求
- [x] 问题单
- [x] issue/工单
- [ ] 重构优化
- [ ] 资料更新

## 【问题描述】

torch_npu 在 `import torch` 之前会临时将 `TORCH_DEVICE_BACKEND_AUTOLOAD` 置为 `"0"`,防止 torch 初始化末尾 autoload 反向导入尚未初始化完成的 torch_npu(循环导入)。原实现中,恢复该环境变量的动作完全依赖 torch 的 autoload 机制调用 `torch_npu:_autoload` entrypoint。

当用户代码 `import torch_npu` 早于 `import torch` 时:

1. torch_npu 将变量置 `"0"`,随后触发 `import torch`
2. torch 初始化末尾读到 `"0"`,跳过 `_import_device_backends()`(torch/__init__.py 末尾 `if _is_device_backend_autoload_enabled():`)
3. `torch_npu:_autoload` entrypoint 永远不会被调用,恢复逻辑失效
4. 后续 `import torch` 仅为 `sys.modules` 缓存命中,不再执行任何恢复逻辑

结果:临时值 `"0"` 泄漏整个进程生命周期;所有子进程(spawn/fork、DataLoader worker、torch.compile worker、torchrun 拉起的新进程)继承 `"0"`,子进程中 `import torch` 不再自动加载 npu backend,导致设备不可用等隐蔽故障。

## 【修改方案】

核心依据:该环境变量在每个进程内仅在 torch `__init__` 末尾被消费一次,之后对当前进程无任何作用,仅影响子进程继承。因此在 torch_npu 初始化完成后、进程内不再有消费点的任意时刻恢复,均不影响当前进程行为,仅修正子进程继承。

修改内容(torch_npu/__init__.py):

1. 在文件末尾(`_initialize()` 之后、`_autoload` 函数定义之后)显式调用一次 `_autoload()`,将变量恢复为 import 前的原始值(`ORG_AUTOLOAD` 已在文件头部保存)。
2. `_autoload()` 函数本身保持不动,仍作为 torch.backends entrypoint,覆盖 torch 先导入场景(autoload 路径)下的恢复;两处调用幂等,写入同一个值。
3. 临时 `"0"` 的存活窗口覆盖 torch_npu 整个初始化期;由于该变量在进程内仅在 torch `__init__` 末尾被消费一次,`_initialize()` 期间无人读取,该窗口内不会产生副作用。

涉及的组件交互:

- torch_npu/__init__.py(本仓):末尾显式调用 `_autoload()` 恢复环境变量
- torch/__init__.py(上游,不修改):`_is_device_backend_autoload_enabled()` / `_import_device_backends()` 读取该变量决定是否 autoload,本修改与其交互关系不变,仅保证变量在交互完成后不再泄漏
- 子进程(spawn/fork/DataLoader worker 等):由继承泄漏的 `"0"` 变为继承原始值,子进程 `import torch` 时 npu backend 自动加载恢复正常

## 【资料变更】

不涉及。

## 【接口变更】

不涉及。本次修改为进程内部环境变量生命周期修复:
- 不改变任何 Python API / C++ API 的签名、语义
- 不改变 `TORCH_DEVICE_BACKEND_AUTOLOAD` 对外的语义(默认启用 autoload,用户显式设置仍被完整尊重并传递给子进程)
- 唯一可观察差异为修复的预期行为本身:torch_npu 先导入时环境变量不再泄漏为 `"0"`

## 【功能验证】

已在仓库新增 UT 看护用例:`test/test_autoload.py` 中新增 `AutoloadEnvVarTest` 测试类(原有 `AutoloadTest` 保持不动),看护本次修复涉及的环境变量行为。

测试方法:由于 `sys.modules` 缓存的存在,导入顺序与起始环境变量只能在全新解释器中各验证一次,因此每个场景通过 `subprocess` 以全新解释器(临时脚本文件)执行受控的导入序列;该解释器再通过 `multiprocessing`(spawn/fork 两种 context)拉起两类子进程探针:环境探针(不导入 torch,仅回读继承的环境变量,隔离环境继承与 autoload 行为)与导入探针(校验子进程内 torch_npu 加载状态及重复导入安全性)。默认场景显式从子进程环境中剥离该变量以保证"默认情况"真实成立,显式设置场景在子进程启动前注入 `0`/`1`。临时脚本目录的创建与删除通过 contextmanager 的 try/finally 收敛在同一作用域内成对完成,确保测试异常退出时亦及时清理(满足 G.FIO.04 临时文件及时删除要求)。

覆盖场景(每个测试方法以 `subTest` 罗列四种导入顺序:仅 import torch / 仅 import torch_npu / 先 torch 后 torch_npu / 先 torch_npu 后 torch,每种顺序校验 6 项探针输出——主进程 2 项:环境变量、torch_npu 加载状态;mp 子进程 4 项:spawn/fork 各自的环境继承与导入行为):

1. 主进程环境变量:默认环境四种导入顺序均为 `'1'`——含原 bug 场景(torch_npu 先导入)不再泄漏 `'0'`;显式设 `0`/`1` 时均保持用户设置不被覆盖 —— PASS
2. autoload 生效性:仅 import torch 时,默认环境/显式 `'1'` 下 torch_npu 被自动加载,显式 `'0'` 下不加载 —— PASS
3. 子进程环境继承:mp spawn/fork 子进程继承的环境变量与主进程一致(默认 `'1'`,用户设置 `'0'`/`'1'` 时为设置值)—— PASS
4. spawn 子进程(全新解释器)导入行为:继承环境为 `'1'` 时 `import torch` 经 autoload 加载 torch_npu,后续显式 `import torch_npu` 为纯缓存命中(含模块对象身份校验),无重复初始化、无报错;继承 `'0'` 时不 autoload —— PASS
5. fork 子进程导入行为:torch_npu 加载状态与主进程一致(import 前后均与主进程相同,即继承 `sys.modules`、不重跑初始化),无报错 —— PASS

自验证结果:`python test/test_autoload.py AutoloadEnvVarTest`,3 个测试方法(共 12 种导入顺序场景)全部通过。
![image.png](https://raw.gitcode.com/user-images/assets/7404318/49a97109-cdd8-4750-aa79-154385ae677d/image.png 'image.png')

性能验证:新增仅为一次函数调用与单次 `os.environ` 赋值(实测约 2.2 µs),占 `import torch_npu` 总耗时(实测约 4 s)的 0.00004%,无感知。

影响面确认:该变量全环境仅 torch `__init__` 末尾一处消费;运行时设备操作、同进程重复导入等场景行为零变化;混合加速器环境下 spawn 子进程会按默认行为 autoload,若存在真实设备冲突将由 `_check_device_conflict` 在子进程报错,属设计内保护,用户可显式 `TORCH_DEVICE_BACKEND_AUTOLOAD=0` 规避。


# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [x] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!47098
2026-09-24 20:27:26 +08:00
pta-robot 95b25edaad Update op_plugin commit id
Co-authored-by: pta-robot<pta_robot@163.com>



# message auto-generated for no-merge-commit merge:
!47096 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

Update op_plugin commit id

Created-by: pta-robot
Commit-by: pta-robot
Merged-by: ascend-robot
Description: Commited by @pta-robot at 2026-09-24 18:03:44.

See merge request: Ascend/pytorch!47096
2026-09-24 19:08:32 +08:00
yule100 4e75fbac88 [fix] fix _dynamo lazy loading broken by _npu_attention module import
Co-authored-by: yule100<chenyukun11@h-partners.com>



# message auto-generated for no-merge-commit merge:
!46977 merge cp-fix-v2.14.0-26.2.0 into v2.14.0-26.2.0

[fix] fix _dynamo lazy loading broken by _npu_attention module import

Created-by: yule100
Commit-by: yule100
Merged-by: ascend-robot
Description: <!--PR描述模板更新日期:20260203
-->

# 【合入来源】

- [ ] 需求
- [ ] 问题单
- [x] issue/工单
- [ ] 重构优化
- [ ] 资料更新

https://gitcode.com/Ascend/pytorch/issues/5047

# 【修改方案】

修复 `_npu_attention.py` 中 `_get_strategy_context` 在模块加载时触发 `_sharding_rules` import,破坏 `torch_npu` 懒加载机制的问题。

将版本兼容逻辑从模块顶层 `try/except` 改为延迟执行+缓存的 `_get_strategy_context_compat()` 函数,仅在 CP dispatcher enable 时首次调用,避免模块加载时的 import 副作用。

# 【资料变更】
不涉及

# 【接口变更】
不涉及

# 【功能验证】
功能
test/distributed/tensor/test_context_parallel_attention.py 验证结果见门禁pass
test/dynamo/test_compile_trigger.py 验证修改后失败用例pass

精度
不涉及

内存
不涉及

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [x] PR持续集成流水线(CI)执行通过,代码检查无异常

See merge request: Ascend/pytorch!46977
2026-09-24 17:17:23 +08:00
Jiayi_Meng e73ef62199 [test] Verify NPU DTensor fixes for #179203 and #187933
Co-authored-by: Jiayi_Meng<mengjiayi5@huawei.com>



# message auto-generated for no-merge-commit merge:
!46904 merge sync-pr46841-v2.14.0-26.2.0 into v2.14.0-26.2.0

[test] Verify NPU DTensor fixes for #179203 and #187933

Created-by: Jiayi_Meng
Commit-by: Jiayi_Meng
Merged-by: ascend-robot
Description: 
关联 Issue:[Ascend/pytorch#3815](https://gitcode.com/Ascend/pytorch/issues/3815)

# 【合入来源】

- [x] 需求
  - 补充社区 PR #179203 和 #187933 对应的 NPU DTensor 回归测试。
- [x] 问题单
  - 关联 Issue:[Ascend/pytorch#3815](https://gitcode.com/Ascend/pytorch/issues/3815)
- [ ] 重构优化
- [ ] 资料更新

# 【修改方案】

- 在 `test/distributed/tensor/test_math_ops.py` 中:

  - 增加 `Partial` 和 `SupportedDevices` 导入。
  - 增加 `test_nll_loss_weighted_mean_with_even_target_counts`,覆盖输入分片、target/weight 副本场景下的加权 mean NLLLoss。
  - 增加 `test_foreach_max_sharded`,校验分片 DTensor 执行 `torch._foreach_max` 后的 `Partial("max")` placement 及完整结果。

- 在 `test/distributed/_tensor/test_init.py` 中:

  - 从 `torch.distributed.tensor` 导入 `linspace` 和 `logspace`。
  - 增加 `test_linspace` 和 `test_logspace`,覆盖 `Replicate()` / `Shard(0)`、默认及显式 dtype、`steps=0/1`、逆序区间、DTensor 标量 start/end 及非法非标量输入。
  - `linspace` 显式 dtype 保持 `torch.float64`。
  - `logspace` 显式 dtype 使用 `torch.float32`,适配 `aclnnLogSpace` 不支持 `float64` 的限制。

# 【资料变更】

不涉及。

# 【接口变更】

不涉及。本 PR 仅补充测试用例。

# 【功能验证】
![cdf6dc7570bec4d887fb8f307d0c6db4.png](https://raw.gitcode.com/user-images/assets/7404318/da8146d8-d876-4164-aa74-d2d3d0c08aa9/cdf6dc7570bec4d887fb8f307d0c6db4.png 'cdf6dc7570bec4d887fb8f307d0c6db4.png')
![0b4ef36fa30c09f95416e895e9d12b22.png](https://raw.gitcode.com/user-images/assets/7404318/c2163939-bde5-48a7-bdc8-9212520b6dc9/0b4ef36fa30c09f95416e895e9d12b22.png '0b4ef36fa30c09f95416e895e9d12b22.png')
![128751eae3a1f68e79dbdbff809b87bd.png](https://raw.gitcode.com/user-images/assets/7404318/a085af5a-55d7-42b5-807a-131164d09754/128751eae3a1f68e79dbdbff809b87bd.png '128751eae3a1f68e79dbdbff809b87bd.png')
![bb77b60a3b8ad79538c591677fe7ac75.png](https://raw.gitcode.com/user-images/assets/7404318/877c72be-436c-4ba0-a06e-c48adbe60ecd/bb77b60a3b8ad79538c591677fe7ac75.png 'bb77b60a3b8ad79538c591677fe7ac75.png')
![fe97ff798f9fa52f11a57670ae31cf7f.png](https://raw.gitcode.com/user-images/assets/7404318/c56c06c0-3428-44dd-a6b4-9364ebe9fb74/fe97ff798f9fa52f11a57670ae31cf7f.png 'fe97ff798f9fa52f11a57670ae31cf7f.png')
![d9a52dbb52682360ca05d6a3197aa601.png](https://raw.gitcode.com/user-images/assets/7404318/bed0c0df-71a2-4876-850f-fc76c3fbb823/d9a52dbb52682360ca05d6a3197aa601.png 'd9a52dbb52682360ca05d6a3197aa601.png')


# 【CheckList】

> PR 提交人对以下 CheckList 自检项进行全量自检,自检通过或不涉及,均修改 `[ ]` 为 `[x]`。

- [x] 改动仅涉及两个目标测试文件,未引入构建产物或无关文件。
- [x] 新增多卡测试复用现有 NPU DTensor / HCCL 测试框架。
- [x] PR 标题使用 `test` 类型标签。
- [x] 已关联 Issue:[Ascend/pytorch#5037](https://gitcode.com/Ascend/pytorch/issues/5037)。
- [x] 本地差异检查和目标测试验证通过。
- [ ] PR 持续集成流水线执行通过。


See merge request: Ascend/pytorch!46904
2026-09-24 17:13:56 +08:00
liuyutong_bury b2af9f029e fix(benchmark): restrict remote model code execution
Co-authored-by: liuyutong_bury<liuyutong25@huawei.com>



# message auto-generated for no-merge-commit merge:
!47034 merge codex/benchmark-remote-code-v2.14.0-26.2.0 into v2.14.0-26.2.0

fix(benchmark): restrict remote model code execution

Created-by: liuyutong_bury
Commit-by: liuyutong_bury
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**如有社区issue,请关联issue链接**</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [ ] 需求
- [ ] 问题单
- [x] issue/工单
- [ ] 重构优化
- [x] 资料更新

关联 Issue:Fixes #5082
https://gitcode.com/Ascend/pytorch/issues/5082

# 【修改方案】
1. 删除 Transformers 已原生支持模型的 `trust_remote_code=True`,避免默认执行模型仓自定义 Python 代码。
2. Baichuan2 保留架构所需能力,但改为默认关闭的 `--trust-remote-code` 显式开关;远程仓启用时必须通过 `--revision` 固定完整 commit hash,本地模型目录不强制 revision。
3. 删除 Mamba2 和 Qwen2VL 样例中的模型路径默认值,改为必填参数。
4. 更新 Baichuan2/GLM4 README,说明远程代码风险、可信来源要求以及原生 GLM4 模型要求。
5. 修复本次涉及文件的尾随空格和 EOF 换行问题。

# 【资料变更】
涉及。Baichuan2 README 新增远程代码执行风险声明与固定 revision 要求;GLM4 README 说明使用 Transformers 内置实现,不执行模型仓自定义代码。

# 【接口变更】
涉及命令行参数变更:

- Baichuan2 新增 `--trust-remote-code`,默认关闭。
- Baichuan2 新增 `--revision`;远程模型开启远程代码时必须提供完整的 40 位 commit hash。
- Mamba2 的 `--model_path` 和 Qwen2VL 的 `--model_name_or_path` 改为必填参数。

# 【功能验证】
- 商发分支中硬编码 `trust_remote_code=True` 和个人绝对路径扫描结果均为 0。
- 改动 Python 文件通过 `py_compile`,Baichuan2 启动脚本通过 `bash -n`。
- `git diff --check` 通过,每个目标分支相对 upstream 仅包含 1 个提交。
- 本次未重复执行模型运行自验,待 PR 流水线进一步验证。

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [ ] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!47034
2026-09-24 17:13:06 +08:00
wzyly ff057c00c4 modify document
Co-authored-by: m0_68000167<wangzhiyuan86@h-partners.com>



# message auto-generated for no-merge-commit merge:
!47041 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

modify document

Created-by: wzyly
Commit-by: m0_68000167
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**如有社区issue,请关联issue链接**</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [ ] 需求
- [ ] 问题单
- [x] issue/工单https://gitcode.com/Ascend/op-plugin/issues/320
- [ ] 重构优化
- [x] 资料更新

# 【修改方案】
资料目录整改

# 【资料变更】
涉及

# 【接口变更】
不涉及

# 【功能验证】
> 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\
> 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [x] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!47041
2026-09-24 16:38:59 +08:00
pta-robot 6885e5983d Update torchair commit id
Co-authored-by: pta-robot<pta_robot@163.com>



# message auto-generated for no-merge-commit merge:
!47012 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

Update torchair commit id

Created-by: pta-robot
Commit-by: pta-robot
Merged-by: ascend-robot
Description: Commited by @pta-robot at 2026-09-24 14:24:45.

See merge request: Ascend/pytorch!47012
2026-09-24 15:59:25 +08:00
lyx324521 e17249a87e 修改安装手册&硬件改名&硬件打标
Co-authored-by: lyx324521<liuyaxiong6@h-partners.com>



# message auto-generated for no-merge-commit merge:
!46918 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

修改安装手册&硬件改名&硬件打标

Created-by: lyx324521
Commit-by: lyx324521
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**如有社区issue,请关联issue链接**</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [ ] 需求
- [ ] 问题单
- [x] issue/工单https://gitcode.com/Ascend/pytorch/issues/3327
- [ ] 重构优化
- [x] 资料更新

# 【修改方案】
修改安装手册、硬件改名打标

# 【资料变更】
涉及

# 【接口变更】
不涉及

# 【功能验证】
> 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\
> 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [x] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!46918
2026-09-24 14:24:06 +08:00
pta-robot e279fbdfbf Update torchair commit id
Co-authored-by: pta-robot<pta_robot@163.com>



# message auto-generated for no-merge-commit merge:
!46933 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

Update torchair commit id

Created-by: pta-robot
Commit-by: pta-robot
Merged-by: ascend-robot
Description: Commited by @pta-robot at 2026-09-23 22:05:29.

See merge request: Ascend/pytorch!46933
2026-09-24 11:31:47 +08:00
chenrayray 335a6ac36c 【docs】【v2.14.0-26.2.0】删除未经测试验证的环境变量参考文档及上游对照条目
Co-authored-by: Xinrui Chen<chenxinrui11@huawei.com>



# message auto-generated for no-merge-commit merge:
!46903 merge codex/remove-unverified-env-docs-214-262 into v2.14.0-26.2.0

【docs】【v2.14.0-26.2.0】删除未经测试验证的环境变量参考文档及上游对照条目

Created-by: chenrayray
Commit-by: Xinrui Chen
Merged-by: ascend-robot
Description: # 【合入来源】

- [x] issue/工单
- [x] 资料更新

关联Issue:https://gitcode.com/Ascend/pytorch/issues/4691

对应master PR:https://gitcode.com/Ascend/pytorch/merge_requests/46876

目标分支:v2.14.0-26.2.0

# 【修改方案】

删除环境变量参考手册中尚未经过测试验证的配置条目,并同步维护导航和PyTorch上游对照表。

1. 核对指定的38项环境变量,删除v2.14.0-26.2.0中仍存在的32个变量详情页;另外6项此前已移除。
2. 同步清理总列表、总目录和分类目录中的对应条目,移除已为空的分布式启动分类与DDP/RPC分组,更新分类说明。
3. 删除PyTorch环境变量对照表中的对应条目,并移除介绍中的具体数量,避免后续维护时同步计数。

此前已移除的6项:FX_SUBGRAPH_DUMP_PATH、INDUCTOR_ASCEND_DEBUG、INDUCTOR_ASCEND_FX_GRAPH_CACHE、NPU_INDUCTOR_DYNAMIC_FX_PASS、PARALLEL_SCHEDULER_NODES_MIN、TORCHINDUCTOR_ENABLE_LAYERNORM_V4。

# 【资料变更】

仅涉及docs/zh/api/environment_variable下40个Markdown文件:删除32个变量详情页及1个空分类目录,更新7个列表、导航及上游对照文件。其他文档中的描述保持原样。

# 【接口变更】

不涉及运行时代码、API或环境变量行为变更。

# 【功能验证】

- 确认32个目标详情页已删除,其余6项在基线中已不存在。
- 核对总列表、目录及上游对照表,目标变量条目无残留。
- 确认其他文档与基线1cb2c693e8一致,包括中英文日志说明、编译指南及飞行记录器说明。
- 检查279处本地链接,无新增失效链接;1处基线已有失效链接所在文件未修改。
- git diff 1cb2c693e8 HEAD --check通过。
- 未运行NPU功能测试或完整文档站点构建;远端CI待运行。

# 【CheckList】

- [x] PR标题使用docs类型标签
- [x] 修改范围限定为环境变量参考文档、导航和上游对照表
- [x] 文档差异格式检查通过
- [ ] PR持续集成流水线(CI)执行通过(待CI)


See merge request: Ascend/pytorch!46903
2026-09-24 09:50:38 +08:00
pta-robot 81ce688148 Update op_plugin commit id
Co-authored-by: pta-robot<pta_robot@163.com>



# message auto-generated for no-merge-commit merge:
!46917 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

Update op_plugin commit id

Created-by: pta-robot
Commit-by: pta-robot
Merged-by: ascend-robot
Description: Commited by @pta-robot at 2026-09-23 18:05:39.

See merge request: Ascend/pytorch!46917
2026-09-23 18:50:32 +08:00
wzyly 020dcefad7 modify document
Co-authored-by: m0_68000167<wangzhiyuan86@h-partners.com>



# message auto-generated for no-merge-commit merge:
!46902 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

modify document

Created-by: wzyly
Commit-by: m0_68000167
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**如有社区issue,请关联issue链接**</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [ ] 需求
- [ ] 问题单
- [x] issue/工单https://gitcode.com/Ascend/op-plugin/issues/320
- [ ] 重构优化
- [x] 资料更新

# 【修改方案】
产品名称修改

# 【资料变更】
涉及

# 【接口变更】
不涉及

# 【功能验证】
> 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\
> 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [x] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!46902
2026-09-23 16:35:40 +08:00
pta-robot 1cb2c693e8 Update torchair commit id
Co-authored-by: pta-robot<pta_robot@163.com>



# message auto-generated for no-merge-commit merge:
!46858 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

Update torchair commit id

Created-by: pta-robot
Commit-by: pta-robot
Merged-by: ascend-robot
Description: Commited by @pta-robot at 2026-09-22 22:03:44.

See merge request: Ascend/pytorch!46858
2026-09-23 14:47:34 +08:00
efwfefe 38c4388030 [fix] 增加ops-tranformer校验
Co-authored-by: efwfefe<chenjunkun2@h-partners.com>



# message auto-generated for no-merge-commit merge:
!46804 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

[fix] 增加ops-tranformer校验

Created-by: efwfefe
Commit-by: efwfefe
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**如有社区issue,请关联issue链接**</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [ ] 需求
- [x] 问题单
- [ ] issue/工单
- [ ] 重构优化
- [ ] 资料更新

# 【修改方案】
当芯片版本为910或者310B的时候,split_pkg_supported停止传入ops_transformer参数

# 【资料变更】
不涉及

# 【接口变更】
不涉及

# 【功能验证】
测试已通过验证

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [x] PR持续集成流水线(CI)执行通过,代码检查无异常

See merge request: Ascend/pytorch!46804
2026-09-23 14:19:33 +08:00
chenrayray fcbc3b357e 【docs】【v2.14.0-26.2.0】完善快速入门迁移步骤与训练日志
Co-authored-by: Xinrui Chen<chenxinrui11@huawei.com>



# message auto-generated for no-merge-commit merge:
!46872 merge codex/quick-start-214-262 into v2.14.0-26.2.0

【docs】【v2.14.0-26.2.0】完善快速入门迁移步骤与训练日志

Created-by: chenrayray
Commit-by: Xinrui Chen
Merged-by: ascend-robot
Description: # 【合入来源】

- [x] issue/工单
- [x] 资料更新

关联Issue:https://gitcode.com/Ascend/pytorch/issues/5032

同步来源:[master PR #46810](https://gitcode.com/Ascend/pytorch/pull/46810)。目标分支:`v2.14.0-26.2.0`。包含后续NOTE提示框及CPU版torchvision安装提醒。

# 【修改方案】

快速入门示例缺少loss输出,GradScaler定义缺少新增标记,AMP循环分段修改容易漏改。本次让用户按明确步骤修改并观察训练进度。

1. 补齐scaler的diff新增标记,将AMP循环改为可直接替换的完整代码,并解释autocast和GradScaler的作用。
2. 每100个batch及每轮最后一个batch打印轮次、步数和loss;补充保存完成提示,检查点轮数引用epochs,移除无用导入及计时代码。
3. 明确导入位置、diff标记及自动迁移中cuda:0的含义,补充MNIST下载与离线准备说明。
4. 环境准备精简为安装链接和必要提示;保留目标版本的硬件适用说明、安装入口及进阶文档链接。
5. 增加示意日志、一轮训练体验建议和成功判断,区分训练流程跑通与模型效果评估。

# 【资料变更】

仅修改docs/zh/user_guide/quick_start.md。

# 【接口变更】

不涉及。

# 【功能验证】

- 原始脚本、自动迁移脚本及替换后的AMP脚本通过Python AST语法检查。
- 本地相对链接有效,scaler新增标记及硬件条件标记检查通过。
- git diff --check通过。
- 本次为文档变更,未新增UT;未执行NPU实机训练或文档站点构建。日志数值为示意。
- 远端CI结果待确认。

# 【CheckList】

- [x] 代码注释完备,正确记录错误日志(不涉及运行时代码)
- [x] 代码实现进行了返回值、空指针等校验(不涉及运行时代码)
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [ ] PR持续集成流水线(CI)执行通过,代码检查无异常(待CI)


See merge request: Ascend/pytorch!46872
2026-09-23 11:10:41 +08:00
pta-robot 0ccff69eb0 Update op_plugin commit id
Co-authored-by: pta-robot<pta_robot@163.com>



# message auto-generated for no-merge-commit merge:
!46867 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

Update op_plugin commit id

Created-by: pta-robot
Commit-by: pta-robot
Merged-by: ascend-robot
Description: Commited by @pta-robot at 2026-09-23 10:02:29.

See merge request: Ascend/pytorch!46867
2026-09-23 10:59:19 +08:00
yucaopanmu 2e19b0e31e [sync] PR-46827: [fix] 修复 aclnn_extension 门禁下 to_padded_tensor 注册符号缺失
Co-authored-by: yucaopanmu<yangpeng276@h-partners.com>



# message auto-generated for no-merge-commit merge:
!46836 merge sync-pr46827-fix/nested-to-padded-tensor-to-v2.14.0-26.2.0 into v2.14.0-26.2.0

[sync] PR-46827: [fix] 修复 aclnn_extension 门禁下 to_padded_tensor 注册符号缺失

Created-by: ascend-ds-bot
Commit-by: yucaopanmu
Merged-by: ascend-robot
Description: 
### 1. Origin pull request:
https://gitcode.com/Ascend/pytorch/merge_requests/46827

### 2. Original pull request related issue(s):
https://gitcode.com/Ascend/pytorch/issues/4861

### 3. Original pull request related commit(s):
| Sha | Datetime | Message |
|---|---|---|
|[e3d0386c](https://gitcode.com/Ascend/pytorch/commit/e3d0386c635af99224811dabbeaef522150b9659)|2026-09-22 19:07:57 +0800 CST|refactor: 抽取额外实现列表为独立函数并添加条件逻辑<br><br>将原本硬编码在特殊注册配置中的额外实现列表抽取为独立函数 _nestedtensor_extra_impls,新增了对 aclnn 扩展代码生成的判断,仅在非 aclnn 环境下添加 to_padded_tensor 的实现,提升代码可维护性。<br>|
|[8e57b0c1](https://gitcode.com/Ascend/pytorch/commit/8e57b0c1b2c6a04f020cd61c5d4db42703da8bc6)|2026-09-22 19:00:43 +0800 CST|style(torchnpugen): 统一gen_backend_stubs.py里的字符串引号风格<br><br>修正了to_padded_tensor注册行的引号混用问题,将双引号外层改为单引号保持代码风格一致<br>|
|[c5da100e](https://gitcode.com/Ascend/pytorch/commit/c5da100e21ed3fe56020df42937cb4a7b0092a21)|2026-09-22 18:59:52 +0800 CST|fix: add nested tensor register header for to_padded_tensor<br>|


See merge request: Ascend/pytorch!46836
2026-09-23 10:29:59 +08:00
limuan 3f926c3364 docs(distributed): backport HCCL communicator guides to v2.14.0-26.2.0
Co-authored-by: limuan<liyijie16@huawei.com>



# message auto-generated for no-merge-commit merge:
!46801 merge docs/hccl-guides-v2.14.0-26.2.0 into v2.14.0-26.2.0

docs(distributed): backport HCCL communicator guides to v2.14.0-26.2.0

Created-by: limuan
Commit-by: limuan
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
- [x] 需求
- [x] 问题单
- [ ] issue/工单
- [ ] 重构优化
- [ ] 资料更新

# 【修改方案】
pta pg_option中之前很多配置,未在文档中说明,现在列举pta 允许用户配置的变量,并于hccl的commconfig进行映射
1. 在`OptionsManager`中新增Scalable RootInfo配置读取:
   - `ROOTINFO_SCALABLE_ENABLE`控制功能是否开启;
   - `TORCH_HCCL_RANKS_PER_ROOT`配置每个Root管理的目标rank数,未配置时默认使用128。

2. 在`ProcessGroupHCCL::createHCCLCommOrigin`中增加路径选择:
   - 仅`HcclCommType::DEFAULT`、功能开关开启且当前通信域rank数大于`ranksPerRoot`时进入Scalable路径;
   - 使用当前ProcessGroup的`getSize()`计算规模,因此同时支持全局通信域和`new_group`非全局通信域;
   - P2P、开关关闭及小规模通信域继续使用原RootInfo创建流程;
   - 仅Atlas A2/A3支持该能力,其他SoC打印Warning并回退原流程。
   - 
3. PTA按照以下方式完成分组和RootInfo交换:
   - Root数量为`ceil(numRanks / ranksPerRoot)`;
   - 将当前通信域内的rank连续、均衡划分到各Root,组间rank数最多相差1;
   - 每个Root调用`HcclGetRootInfoScalable`生成RootInfo,并通过c10d Store分别发布;
   - 所有rank通过`Store::multiGet`获取按Root序号排列的完整RootInfo列表,同时校验数量、数据长度及PTA版本。

4. 在`HCCLComm`中新增`create_scalable_config`封装。所有rank携带当前通信域rank数、本地rank及RootInfo列表调用`HcclCommInitRootInfoScalable`,由HCCL完成分级建链;通信域的缓存、使用和销毁机制保持不变。

5. 在`HcclCompile`和`HCCLUtils`中增加两个HCCL新接口的动态加载与封装:
   - `HcclGetRootInfoScalable`
   - `HcclCommInitRootInfoScalable`
   当功能已开启但当前HCCL不包含对应符号时,返回明确的不支持错误。

6. 增加路径选择、分组布局、RootInfo生成/交换和通信域创建耗时日志,并补充均匀分组、非整除分组、集合通信、原路径回退、非法配置及通信域重复创建销毁等测试。

![image.png](https://raw.gitcode.com/user-images/assets/7404318/4c2a93a3-077c-4022-afeb-c8a5779b80fb/image.png 'image.png')

# 【资料变更】
本pr为资料pr

# 【接口变更】
不涉及

# 【功能验证】
资料修改,无功能验证

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [x] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!46801
2026-09-23 09:55:41 +08:00
wzyly 7b818d2b8e modify document
Co-authored-by: m0_68000167<wangzhiyuan86@h-partners.com>



# message auto-generated for no-merge-commit merge:
!46825 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

modify document

Created-by: wzyly
Commit-by: m0_68000167
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**如有社区issue,请关联issue链接**</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [ ] 需求
- [ ] 问题单
- [x] issue/工单https://gitcode.com/Ascend/op-plugin/issues/320
- [ ] 重构优化
- [x] 资料更新

# 【修改方案】
产品名称改名

# 【资料变更】
涉及

# 【接口变更】
不涉及

# 【功能验证】
> 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\
> 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [x] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!46825
2026-09-23 09:27:42 +08:00
pta-robot 35d38fad82 Update op_plugin commit id
Co-authored-by: pta-robot<pta_robot@163.com>



# message auto-generated for no-merge-commit merge:
!46860 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

Update op_plugin commit id

Created-by: pta-robot
Commit-by: pta-robot
Merged-by: ascend-robot
Description: Commited by @pta-robot at 2026-09-22 22:04:39.

See merge request: Ascend/pytorch!46860
2026-09-23 00:31:24 +08:00
pta-robot 74dacfa0b7 Update op_plugin commit id
Co-authored-by: pta-robot<pta_robot@163.com>



# message auto-generated for no-merge-commit merge:
!46661 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

Update op_plugin commit id

Created-by: pta-robot
Commit-by: pta-robot
Merged-by: ascend-robot
Description: Commited by @pta-robot at 2026-09-20 18:47:27.

See merge request: Ascend/pytorch!46661
2026-09-22 18:42:39 +08:00
pta-robot 4f7b7597c5 Update torchair commit id
Co-authored-by: pta-robot<pta_robot@163.com>



# message auto-generated for no-merge-commit merge:
!46663 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

Update torchair commit id

Created-by: pta-robot
Commit-by: pta-robot
Merged-by: ascend-robot
Description: Commited by @pta-robot at 2026-09-20 18:47:38.

See merge request: Ascend/pytorch!46663
2026-09-22 17:04:01 +08:00
wzyly 46efd02d93 modify document
Co-authored-by: m0_68000167<wangzhiyuan86@h-partners.com>



# message auto-generated for no-merge-commit merge:
!46802 merge cherry-pick-mr-46791-1790062653996-auto into v2.14.0-26.2.0

modify document

Created-by: wzyly
Commit-by: m0_68000167
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**如有社区issue,请关联issue链接**</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [ ] 需求
- [ ] 问题单
- [x] issue/工单https://gitcode.com/Ascend/op-plugin/issues/320
- [ ] 重构优化
- [x] 资料更新

# 【修改方案】
产品名称打标签

# 【资料变更】
涉及

# 【接口变更】
不涉及

# 【功能验证】
> 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\
> 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [x] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!46802
2026-09-22 16:12:04 +08:00
yucaopanmu 42aaf5cf30 [sync] PR-46265: fix: add nested tensor register header for to_padded_tensor
Co-authored-by: yucaopanmu<yangpeng276@h-partners.com>



# message auto-generated for no-merge-commit merge:
!46755 merge sync-pr46265-fix/nested-to-padded-tensor-to-v2.14.0-26.2.0 into v2.14.0-26.2.0

[sync] PR-46265: fix: add nested tensor register header for to_padded_tensor

Created-by: ascend-ds-bot
Commit-by: yucaopanmu
Merged-by: ascend-robot
Description: 
### 1. Origin pull request:
https://gitcode.com/Ascend/pytorch/merge_requests/46265

### 2. Original pull request related issue(s):
https://gitcode.com/Ascend/pytorch/issues/4861

### 3. Original pull request related commit(s):
| Sha | Datetime | Message |
|---|---|---|
|[be097c68](https://gitcode.com/Ascend/pytorch/commit/be097c68de671148cf65a7331822781ff0a19f9d)|2026-09-16 10:00:37 +0800 CST|style(torchnpugen): 统一gen_backend_stubs.py里的字符串引号风格<br><br>修正了to_padded_tensor注册行的引号混用问题,将双引号外层改为单引号保持代码风格一致<br>|
|[1a72a420](https://gitcode.com/Ascend/pytorch/commit/1a72a420b05dcb4d6cf19623382b26b4147077aa)|2026-09-14 12:53:48 +0800 CST|fix: add nested tensor register header for to_padded_tensor<br>|


See merge request: Ascend/pytorch!46755
2026-09-22 15:54:05 +08:00
culechan 60eea798d4 [fix] fix cache 921
Co-authored-by: chenshuai<chenshuai81@huawei.com>



# message auto-generated for no-merge-commit merge:
!46736 merge cherry-pick-mr-46726-1789981689430-auto into v2.14.0-26.2.0

[fix] fix cache 921

Created-by: culechan
Commit-by: chenshuai
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**如有社区issue,请关联issue链接**</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [ ] 需求
- [x] 问题单
- [ ] issue/工单
- [ ] 重构优化
- [ ] 资料更新

# 【修改方案】
原先的cache方案性能仍然不满足,context的查询接口仍然有部分性能损失,因此直接修改为全局的静态线程变量来记录缓存。底层aclnn框架为进程级变量,使用线程变量缓存看护也是安全的。

# 【资料变更】
不涉及

# 【接口变更】
不涉及

# 【功能验证】
性能优化到了可以接受的范围内
![img_v3_0215o_7a78bd7a-dc3e-4602-b9e1-65695848dbbg.jpg](https://raw.gitcode.com/user-images/assets/7404318/2a890f56-117a-45f6-85fa-7c0818a7503b/img_v3_0215o_7a78bd7a-dc3e-4602-b9e1-65695848dbbg.jpg 'img_v3_0215o_7a78bd7a-dc3e-4602-b9e1-65695848dbbg.jpg')

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [x] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!46736
2026-09-22 15:39:21 +08:00
wuyouqi1 c82ef1d83c [sync] PR-46582: [master] fix(core): guard get_npu_format against symbolic tensors to avoid segfault
Co-authored-by: wuyouqi1<wuyouqi1@h-partners.com>



# message auto-generated for no-merge-commit merge:
!46693 merge sync-pr46582-fix/fake-tensor-repr-segv-master-to-v2.14.0-26.2.0 into v2.14.0-26.2.0

[sync] PR-46582: [master] fix(core): guard get_npu_format against symbolic tensors to avoid segfault

Created-by: wuyouqi1
Commit-by: wuyouqi1
Merged-by: ascend-robot
Description: ### 1. Origin pull request:
https://gitcode.com/Ascend/pytorch/merge_requests/46582

### 2. Original pull request related issue(s):
https://gitcode.com/Ascend/pytorch/issues/4744

### 3. Original pull request related commit(s):
| Sha | Datetime | Message |
|---|---|---|
|[d700685e9e](https://gitcode.com/Ascend/pytorch/commit/d700685e9e4ab4cd138bb0fb355659b388c79d07)|2026-09-20&nbsp;16:41:48&nbsp;+0800|fix(core): guard get_npu_format against symbolic tensors to avoid segfault<br>|

### 4. Sync note:
Cherry-picked from `wuyouqi1/pytorch_260403` branch `sync-pr46582-fix/fake-tensor-repr-segv-master-to-v2.14.0-26.2.0` onto `v2.14.0-26.2.0` (branch-to-branch mapping to minimize cross-branch conflicts).
The source MR !46582 contained 2 commits (the guard fix + a clang-format style follow-up); both were cherry-picked.

### 5. Follow-up commit (repr patch guard):
| Sha | Datetime | Message |
|---|---|---|
|[e36ea08a](https://gitcode.com/wuyouqi1/pytorch_260403/commit/e36ea08aa88)|2026-09-22|fix(core): skip internal-format repr probe for symbolic tensors in npu_patches<br>|

On master the `Tensor.__repr__` internal-format patch lives in
`torch_npu/_init/patches/npu_patches.py` (`apply_npu_internal_format_repr_patch`),
not in `torch_npu/utils/tensor_methods.py` as on release branches, so the original
!46582 missed the Python-side guard. This MR additionally carries the follow-up
(same content submitted to master as !46788):

- `apply_npu_internal_format_repr_patch`: skip the `get_npu_format` probe for
  FakeTensor via the same `_is_symbolic_tensor` check as the release-branch fix
  (!46578 series); with the C++ guard in place the probe would only burn a
  raise/catch cycle per repr of a symbolic tensor
- `test/npu/test_tensor.py`: port `test_faketensor_repr` and
  `test_faketensor_repr_under_dispatch_logging` from the release-branch fix


See merge request: Ascend/pytorch!46693
2026-09-22 15:36:59 +08:00
SCh_zx 85bb659a1e update test_public_bindings.py
Co-authored-by: SCh_zx<1325467101@qq.com>



# message auto-generated for no-merge-commit merge:
!46794 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

update test_public_bindings.py

Created-by: SCh_zx
Commit-by: SCh_zx
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**如有社区issue,请关联issue链接**</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [ ] 需求
- [ ] 问题单
- [ ] issue/工单
- [ ] 重构优化
- [ ] 资料更新

# 【修改方案】
> 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\
> 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容)

维护2.14用例,更改导入路径

# 【资料变更】
> 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及”

# 【接口变更】
> 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及”

# 【功能验证】
> 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\
> 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [ ] 代码注释完备,正确记录错误日志
- [ ] 代码实现进行了返回值、空指针等校验
- [ ] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [ ] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!46794
2026-09-22 14:06:33 +08:00
chenrayray ee2b986f09 【docs】【v2.14.0-26.2.0】同步原生API版本文档及链接修正
Co-authored-by: Xinrui Chen<chenxinrui11@huawei.com>



# message auto-generated for no-merge-commit merge:
!46619 merge codex/native-api-v2.14.0-26.2.0 into v2.14.0-26.2.0

【docs】【v2.14.0-26.2.0】同步原生API版本文档及链接修正

Created-by: chenrayray
Commit-by: Xinrui Chen
Merged-by: ascend-robot
Description: # 【合入来源】

- [x] issue/工单
- [x] 资料更新

关联Issue:https://gitcode.com/Ascend/pytorch/issues/4880

# 【修改方案】

同步 master PR #46481 到 `v2.14.0-26.2.0`,补齐该分支缺失的PyTorch 2.9.0、2.10.0、2.14.0原生API支持清单,修正版本继承带来的过期接口和链接。

1. 新增196个文档文件:2.9.0、2.10.0分别继承2.7.1的66个文件,2.14.0继承2.13.0的64个文件,并将总目录按版本降序排列。保留API的产品支持字段与继承版本逐条比对,无意外变化。
2. 2.9.0、2.10.0各清理15个上游已移除的旧ONNX接口及成员;2.14.0清理`torch.qr`、`ShapeEnv.set_unbacked_var_to_val`和`Unflatten.NamedShape`。同步修正已有版本中已删除的相应历史条目。
3. 新增版本补充API废弃或参数变更说明,覆盖旧AMP、ONNX辅助接口、范数、上采样和profiler等;概述说明ONNX默认导出行为及2.14参数变更。
4. 全量修复原生API目录的失效页面、锚点和路径。对缺少上游文档的条目同时核对废弃状态:删除2.9/2.10各8个JitScalarType类及成员条目、各3个TorchScript辅助API,以及2.7.1已停止维护的移动端优化条目;恢复14处同版本有效API文档链接。按对应版本的官方站内搜索索引和API索引继续核查其余137处条目:133处下架(包括仅在示例代码中出现的7处graph.map_arg),4处DataPipe类型可在官方参数类型说明中找到并改链到对应内容。清单不再使用源码链接替代原生API文档;同步将2.13/2.14的14处profiler方法名称校正为实际文档中的公开类profile。Named Tensors中10处链接改为同版本named_tensor页面的命名张量说明及命名维度flatten用法,避免误指向普通Tensor文档。

版本差异依据:[PyTorch 2.9发布说明](https://github.com/pytorch/pytorch/releases/tag/v2.9.0)、[2.10发布说明](https://github.com/pytorch/pytorch/releases/tag/v2.10.0)、[2.14发布说明](https://github.com/pytorch/pytorch/releases/tag/v2.14.0),以及对应版本官方文档和源码。

# 【资料变更】

仅修改`docs/zh/api/native_api`下的Markdown文档,共221个文件:196个新增、25个修改。基于目标分支 `v2.14.0-26.2.0` 的 `a543561a2d`,以单个提交同步 master PR #46481;保留HCCL文档目录迁移后的14处链接修正及引用标题。

# 【接口变更】

不涉及运行时API或产品支持能力变更。文档清理反映上游版本变化及“对应版本文档可检索”的收录规则;因搜索不到而下架不等同于上游删除了实现。

# 【功能验证】

- 对三个新增版本逐条比较保留API的产品支持字段,未发现意外变化,未新增未经验证的API支持声明。
- 全量检查468个Markdown文件:24,290处外链引用,去重23,689个URL,涉及10,445个页面;HTTP状态、跳转和锚点检查无未解决问题。
- 2,262个本地链接的文件路径及标题锚点检查通过。
- PyTorch页面通过规范域名`docs.pytorch.org`检查;跟随HTTP和HTML跳转。检查新链接实际正文中的API命中,排除其他API的同名匹配。
- 逐条核对133处下架条目与最终处理清单一致,14处公开名称校正前后及所有保留条目的产品支持字段未变。221个文件逐一比对,与源PR的最终内容完全一致;MD028检查通过。
- `git diff upstream/v2.14.0-26.2.0 HEAD --check`通过。
- 本次为文档修改,未执行NPU运行测试或完整文档站点构建;远端CI待运行确认。外链结果反映本次检查时的状态。

# 【CheckList】

- [x] 代码注释完备,正确记录错误日志(不涉及运行时代码)
- [x] 代码实现进行了返回值、空指针等校验(不涉及运行时代码)
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [ ] PR持续集成流水线(CI)执行通过,代码检查无异常(待CI)

同步来源:https://gitcode.com/Ascend/pytorch/merge_requests/46481


See merge request: Ascend/pytorch!46619
2026-09-22 11:04:34 +08:00
cai-weiwei1989 52d10e927a docs:26.2.0分支文档链接处理
Co-authored-by: cai-weiwei1989<734267852@qq.com>



# message auto-generated for no-merge-commit merge:
!46670 merge v2.14.0-26.2.0 into v2.14.0-26.2.0

docs:26.2.0分支文档链接处理

Created-by: cai-weiwei1989
Commit-by: cai-weiwei1989
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**如有社区issue,请关联issue链接**</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [ ] 需求
- [ ] 问题单
- [ ] issue/工单
- [ ] 重构优化
- [x] 资料更新

# 【修改方案】
> 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\
> 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容)

# 【资料变更】
> 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及”
docs:26.2.0分支文档链接改为26.2.0链接
# 【接口变更】
> 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及”

# 【功能验证】
> 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\
> 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [ ] 代码注释完备,正确记录错误日志
- [ ] 代码实现进行了返回值、空指针等校验
- [ ] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [ ] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!46670
2026-09-22 09:45:38 +08:00
wuyouqi1 a662ac2123 [sync] PR-45502: test: un-skip test_single_reshape_copy_to_contiguous cases (issue 4356)
Co-authored-by: wuyouqi1<wuyouqi1@h-partners.com>



# message auto-generated for no-merge-commit merge:
!46699 merge sync-pr45502-narrow-aclnn-nc1hwc0-3d-fallback-to-v2.14.0-26.2.0 into v2.14.0-26.2.0

[sync] PR-45502: test: un-skip test_single_reshape_copy_to_contiguous cases (issue 4356)

Created-by: wuyouqi1
Commit-by: wuyouqi1
Merged-by: ascend-robot
Description: ### 1. Origin pull request:
https://gitcode.com/Ascend/pytorch/merge_requests/45502

### 2. Original pull request related issue(s):
https://gitcode.com/Ascend/pytorch/issues/4356

### 3. Original pull request related commit(s):
| Sha | Datetime | Message |
|---|---|---|
|[85d554a0a4](https://gitcode.com/Ascend/pytorch/commit/85d554a0a4ca8eb1e3dc46438af833a2824ce160)|2026-09-20&nbsp;17:15:55&nbsp;+0800|test: un-skip test_single_reshape_copy_to_contiguous cases (issue 4356)<br>|

### 4. Sync note:
Cherry-picked from `wuyouqi1/pytorch_260403` branch `sync-pr45502-narrow-aclnn-nc1hwc0-3d-fallback-to-v2.14.0-26.2.0` onto `v2.14.0-26.2.0` (branch-to-branch mapping to minimize cross-branch conflicts).
Uses the master version of the fix (drops the now-unused 'import unittest' for flake8).

See merge request: Ascend/pytorch!46699
2026-09-22 09:45:22 +08:00
m0_64341872 21a40c080e docs(zh): 使用requirements进行依赖构建
Co-authored-by: mhy<mahongyu7@huawei.com>



# message auto-generated for no-merge-commit merge:
!46720 merge req-docs-2.14 into v2.14.0-26.2.0

docs(zh): 使用requirements进行依赖构建

Created-by: m0_64341872
Commit-by: mhy
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**如有社区issue,请关联issue链接**</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [x] 需求
- [ ] 问题单
- [ ] issue/工单
- [ ] 重构优化
- [ ] 资料更新

# 【修改方案】
> 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\
> 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容)

简化"方式二:物理机及虚拟机场景"下的依赖安装步骤,统一改为执行 `pip3 install -r requirements.txt`,去掉原先按操作系统分类罗列的系统依赖命令(yum/apt-get)及 gcc/cmake 版本表格,与"方式一:容器场景"的描述方式保持一致。
补充非root用户执行 `pip3 install -r requirements.txt` 时需要加 `--user` 参数的说明,避免非root场景下因权限问题安装失败。
# 【资料变更】
> 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及”

删除环境依赖的零散三个依赖,换成使用requirements引导用户一次性安装全依赖
# 【接口变更】
> 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及”

不涉及
# 【功能验证】
> 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\
> 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [x] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!46720
2026-09-22 09:42:45 +08:00
ccyyccyyccyycc e926f0da93 [fix] distribute env docs fix
Co-authored-by: ccyyccyyccyycc<changqiaowei@huawei.com>



# message auto-generated for no-merge-commit merge:
!46625 merge fix/docs-distributed-env-v2.14.0-26.2.0 into v2.14.0-26.2.0

[fix] distribute env docs fix

Created-by: ccyyccyyccyycc
Commit-by: ccyyccyyccyycc
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
https://gitcode.com/Ascend/pytorch/issues/4691

- [ ] 需求
- [ ] 问题单
- [x] issue/工单
- [ ] 重构优化
- [ ] 资料更新

# 【修改方案】
修改资料

# 【资料变更】
修改资料review意见

# 【接口变更】
不涉及

# 【功能验证】
不涉及

# 【CheckList】

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [x] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!46625
2026-09-22 09:30:39 +08:00
wzyly d570819e92 modify document
Co-authored-by: m0_68000167<wangzhiyuan86@h-partners.com>



# message auto-generated for no-merge-commit merge:
!46689 merge cherry-pick-mr-46685-1789962868598-auto into v2.14.0-26.2.0

modify document

Created-by: wzyly
Commit-by: m0_68000167
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**如有社区issue,请关联issue链接**</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [ ] 需求
- [ ] 问题单
- [x] issue/工单https://gitcode.com/Ascend/op-plugin/issues/320
- [ ] 重构优化
- [x] 资料更新

# 【修改方案】
产品名称打标签

# 【资料变更】
涉及

# 【接口变更】
不涉及

# 【功能验证】
> 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\
> 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [x] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!46689
2026-09-21 17:19:28 +08:00
fft1374 a543561a2d update op+torchair submodule
Signed-off-by: fft1374 <liwen120@huawei.com>
2026-09-19 09:41:21 +08:00
750 changed files with 344438 additions and 44584 deletions
+2
View File
@@ -2,12 +2,14 @@
path = third_party/op-plugin
url = https://gitcode.com/ascend/op-plugin.git
ignore = dirty
branch = 26.2.0
[submodule "third_party/googletest"]
path = third_party/googletest
url = https://gitcode.com/GitHub_Trending/go/googletest.git
[submodule "third_party/torchair/torchair"]
path = third_party/torchair/torchair
url = https://gitcode.com/ascend/torchair.git
branch = 26.2.0
[submodule "third_party/Tensorpipe"]
path = third_party/Tensorpipe
url = https://gitcode.com/ascend/Tensorpipe.git
+1 -1
View File
@@ -95,7 +95,7 @@ pip install torch-npu==2.12.0
### From Source
For detailed steps on compiling TorchNPU, please refer to the [Source Installation Guide](./docs/zh/installation_guide/building_from_source.md).
For detailed steps on compiling TorchNPU, please refer to the [Source Installation Guide](./docs/zh/installation_guide/references/building_from_source.md).
## Quick Start
+1 -1
View File
@@ -95,7 +95,7 @@ pip install torch-npu==2.12.0
### 源码编译安装
编译TorchNPU的详细步骤请参见[源码安装](./docs/zh/installation_guide/building_from_source.md)。
编译TorchNPU的详细步骤请参见[源码安装](./docs/zh/installation_guide/references/building_from_source.md)。
## 快速开始
@@ -34,6 +34,10 @@ pip install -r ../utils/requirements.txt
python ../utils/download_hf.py --model baichuan-inc/Baichuan2-7B-Chat --save_path ./Baichuan2-7B-Chat
```
> [!WARNING]
> Baichuan2 依赖模型仓中的自定义 Python 代码。脚本默认不执行远程代码;仅在确认模型来源可信后使用 `--trust-remote-code`。
> 使用远程模型仓时必须同时通过 `--revision` 指定完整的 40 位 commit hash,避免已审核代码被后续更新替换。优先使用本地已校验的模型目录。
## 2. 数据获取
训练数据集来自 LlamaFactory 仓库示例数据:
@@ -20,4 +20,5 @@ python train_baichuan2_7B.py \
--use_lora \
--use_bf16 \
--gradient_checkpointing \
> logs/train_baichuan.log 2>&1
"$@" \
> logs/train_baichuan.log 2>&1
@@ -44,7 +44,8 @@ class Baichuan2Trainer:
self.tokenizer = AutoTokenizer.from_pretrained(
self.args.model_path,
trust_remote_code=True,
revision=self.args.revision,
trust_remote_code=self.args.trust_remote_code,
padding_side="right",
model_max_length=self.args.max_length,
)
@@ -54,7 +55,8 @@ class Baichuan2Trainer:
self.model = AutoModelForCausalLM.from_pretrained(
self.args.model_path,
trust_remote_code=True,
revision=self.args.revision,
trust_remote_code=self.args.trust_remote_code,
torch_dtype=torch.bfloat16 if self.args.use_bf16 else torch.float16,
use_cache=not self.args.gradient_checkpointing,
)
@@ -236,6 +238,10 @@ def build_argparser():
parser.add_argument("--mfusion", action="store_true",
help="Enable MFusion for graph fusion optimization")
parser.add_argument("--model_path", type=str, required=True)
parser.add_argument("--trust-remote-code", action="store_true",
help="Allow execution of custom code from the model repository")
parser.add_argument("--revision", type=str, default=None,
help="Full commit hash for a remote model repository")
parser.add_argument("--data_path", type=str, required=True)
parser.add_argument("--output_dir", type=str, default="./baichuan2-finetuned")
parser.add_argument("--num_epochs", type=int, default=3)
@@ -276,7 +282,17 @@ def build_argparser():
def main():
args = build_argparser().parse_args()
parser = build_argparser()
args = parser.parse_args()
if args.trust_remote_code and not os.path.isdir(args.model_path):
revision = args.revision or ""
is_commit_hash = len(revision) == 40 and all(
char in "0123456789abcdefABCDEF" for char in revision
)
if not is_commit_hash:
parser.error(
"--revision must be a full commit hash when enabling remote code"
)
detect_device_type()
os.environ['TORCHINDUCTOR_NPU_BACKEND'] = args.npu_backend
if args.npu_backend == "akg":
+3
View File
@@ -23,6 +23,9 @@
可在链接页面中 `Files and versions` 一栏直接下载。
> [!NOTE]
> 本脚本使用 Transformers 内置的 GLM4 实现,不执行模型仓自定义 Python 代码。请使用与 `transformers==4.57.1` 兼容的原生 GLM4 模型。
### 环境提示
本项目依赖已整理到 `requirements.txt`,可直接安装:
@@ -72,7 +72,6 @@ class GLM4Trainer:
self.args.model_path,
quantization_config=bnb_config if self.args.use_4bit else None,
torch_dtype=torch.bfloat16 if self.args.use_bf16 else torch.float16,
trust_remote_code=True,
)
logger.info("Moving model to %s...", self.args.device_type)
@@ -80,7 +79,6 @@ class GLM4Trainer:
self.tokenizer = AutoTokenizer.from_pretrained(
self.args.model_path,
trust_remote_code=True
)
if self.tokenizer.pad_token is None:
@@ -44,7 +44,6 @@ class GPT_OSS_20BTrainer:
self.model = AutoModelForCausalLM.from_pretrained(
self.args.model_path,
torch_dtype=torch.bfloat16 if self.args.use_bf16 else torch.float16,
trust_remote_code=True
)
logger.info("Moving model to %s...", self.args.device_type)
@@ -52,7 +51,6 @@ class GPT_OSS_20BTrainer:
self.tokenizer = AutoTokenizer.from_pretrained(
self.args.model_path,
trust_remote_code=True
)
if self.tokenizer.pad_token is None:
@@ -53,14 +53,12 @@ class LLama3Trainer:
self.args.model_path,
quantization_config=bnb_config if self.args.use_4bit else None,
torch_dtype=torch.bfloat16 if self.args.use_bf16 else torch.float32,
trust_remote_code=True
)
logger.info("Moving model to %s...", self.args.device_type)
self.model = self.model.to(self.args.device_type)
self.tokenizer = AutoTokenizer.from_pretrained(
self.args.model_path,
trust_remote_code=True
)
if self.tokenizer.pad_token is None:
@@ -58,7 +58,7 @@ def parse_args():
parser.add_argument(
"--model_path",
type=str,
default="/home/zhangyican/workspace/q4_data/Mamba-Codestral-7B-v0.1",
required=True,
help="Base model path",
)
parser.add_argument("--data_file", type=str, default="./c4_demo.jsonl", help="Training data file path")
@@ -105,7 +105,6 @@ def main():
print(f"Loading tokenizer from: {args.model_path}")
tokenizer = AutoTokenizer.from_pretrained(
args.model_path,
trust_remote_code=True,
use_fast=True
)
if tokenizer.pad_token is None:
@@ -115,7 +114,6 @@ def main():
base_model = AutoModelForCausalLM.from_pretrained(
args.model_path,
torch_dtype=torch.bfloat16, # Use bfloat16 precision
trust_remote_code=True,
use_cache=False, # Disable cache to save memory
)
@@ -62,8 +62,7 @@ def patch_remove_ops_from_generate_list(op_names=None):
def parse_args():
p = argparse.ArgumentParser(description="Qwen2-VL 2B Single GPU Training")
p.add_argument("--model_name_or_path", type=str,
default="/data/zyc/Qwen2-VL-2B-Instruct")
p.add_argument("--model_name_or_path", type=str, required=True)
p.add_argument("--use_lora", type=str2bool, default=False)
p.add_argument("--lora_r", type=int, default=64)
p.add_argument("--lora_alpha", type=int, default=16)
@@ -240,7 +239,6 @@ def main():
args.model_name_or_path,
min_pixels=args.min_pixels,
max_pixels=args.max_pixels,
trust_remote_code=True,
)
print(f"Processor loading time: {time.time() - t0:.2f}s")
print(f" min_pixels = {args.min_pixels}, max_pixels = {args.max_pixels}")
@@ -253,7 +251,6 @@ def main():
model = Qwen2VLForConditionalGeneration.from_pretrained(
args.model_name_or_path,
torch_dtype=torch.bfloat16,
trust_remote_code=True,
)
print(f"Model loading time: {time.time() - t0:.2f}s")
@@ -55,7 +55,6 @@ class Qwen3Trainer:
self.args.model_path,
quantization_config=bnb_config if self.args.use_4bit else None,
torch_dtype=torch.bfloat16 if self.args.use_bf16 else torch.float32,
trust_remote_code=True
)
logger.info("Moving model to %s...", self.args.device_type)
@@ -63,7 +62,6 @@ class Qwen3Trainer:
self.tokenizer = AutoTokenizer.from_pretrained(
self.args.model_path,
trust_remote_code=True
)
if self.tokenizer.pad_token is None:
@@ -18,8 +18,11 @@ export TORCH_NPUGRAPH_GC=1
## Usage Constraints
- The `TORCH_NPUGRAPH_GC` environment variable is read by the PyTorch module and can be configured as "0" or "1". For other values, behavior varies across different PyTorch versions and may change in the future. You are advised not to configure such values.
> For versions prior to PyTorch 2.7.1, setting a value other than "0" or "1" falls back to the default value "0".
> For PyTorch 2.7.1 and later versions, setting a value other than "0" or "1" falls back to the default value "1".
> [!NOTE]
>
> - For versions prior to PyTorch 2.7.1, setting a value other than "0" or "1" falls back to the default value "0".
> - For PyTorch 2.7.1 and later versions, setting a value other than "0" or "1" falls back to the default value "1".
- Setting TORCH\_NPUGRAPH\_GC to "1" causes a performance degradation during NPUGraph Capture.
@@ -1,6 +1,6 @@
# Build Acceleration
This document describes how to speed up TorchNPU source builds using Ninja, Mold, CCache, and target-specific builds. Prepare the build environment by following [Building from Source (Chinese)](../../../zh/installation_guide/building_from_source.md). Run the commands below from the TorchNPU source root.
This document describes how to speed up TorchNPU source builds using Ninja, Mold, CCache, and target-specific builds. Prepare the build environment by following [Building from Source (Chinese)](../../../en/installation_guide/compilation_installation_using_source_code.md). Run the commands below from the TorchNPU source root.
## Build with Ninja
@@ -1,4 +1,5 @@
# Building with Clang
To compile TorchNPU with Clang, you first need to install the CPU-only upstream torch package compiled with Clang. However, this package is not provided by the official PyTorch community, so you will need to build it yourself.
Before compiling, ensure that the compiler settings are correctly configured:
@@ -23,8 +24,13 @@ export USE_CUDNN=0
python setup.py build bdist_wheel 2>&1 | tee build.log
```
After building torch, install the compiled wheel located in the dist directory.
> [!NOTE]
>
> A known compilation issue exists when building PyTorch 2.12 with Clang 20. For details, see the related [issue](https://github.com/pytorch/pytorch/issues/185618) in the upstream community. Please modify the code as described in the [fix PR](https://github.com/pytorch/pytorch/pull/185785) before building.
## Building TorchNPU with Clang
After ensuring that the Clang‑compiled PyTorch is installed, navigate to the TorchNPU repository directory and begin compiling TorchNPU. The compilation process is the same as before; you only need to ensure that the compiler settings are correctly set.
After ensuring that the Clang‑compiled PyTorch is installed, navigate to the TorchNPU repository directory and begin compiling TorchNPU. The compilation process is the same as before; you only need to ensure that the compiler settings are correctly set.
@@ -32,40 +32,20 @@
- [MULTI_STREAM_MEMORY_REUSE](memory_management/MULTI_STREAM_MEMORY_REUSE.md)
- [TORCH_NPUGRAPH_GC](memory_management/TORCH_NPUGRAPH_GC.md)
- [NPU_SHMEM_SYMMETRIC_SIZE](memory_management/NPU_SHMEM_SYMMETRIC_SIZE.md)
- [分布式启动与建链](distributed_startup/_menu_distributed_startup.md)
- [TORCH_NPU_USE_PARALLEL_TCPSTORE](distributed_startup/TORCH_NPU_USE_PARALLEL_TCPSTORE.md)
- [TORCH_NPU_ELASTIC_USE_AGENT_STORE](distributed_startup/TORCH_NPU_ELASTIC_USE_AGENT_STORE.md)
- [ENABLE_TIERED_PARALLEL_TCPSTORE](distributed_startup/ENABLE_TIERED_PARALLEL_TCPSTORE.md)
- [PROXY_AGENT_PID_USE_LOCAL_SOCKET_PATH](distributed_startup/PROXY_AGENT_PID_USE_LOCAL_SOCKET_PATH.md)
- [分布式通信与诊断](collective_communication/_menu_collective_communication.md)
- [TORCH_HCCL_BLOCKING_WAIT](collective_communication/TORCH_HCCL_BLOCKING_WAIT.md)
- [TORCH_HCCL_ASYNC_ERROR_HANDLING](collective_communication/TORCH_HCCL_ASYNC_ERROR_HANDLING.md)
- [HCCL_EVENT_TIMEOUT](collective_communication/HCCL_EVENT_TIMEOUT.md)
- [P2P_HCCL_BUFFSIZE](collective_communication/P2P_HCCL_BUFFSIZE.md)
- [RANK_TABLE_FILE](collective_communication/RANK_TABLE_FILE.md)
- [ROOTINFO_SCALABLE_ENABLE](collective_communication/ROOTINFO_SCALABLE_ENABLE.md)
- [TORCH_HCCL_RANKS_PER_ROOT](collective_communication/TORCH_HCCL_RANKS_PER_ROOT.md)
- [(beta) TORCH_HCCL_ZERO_COPY](collective_communication/(beta)TORCH_HCCL_ZERO_COPY.md)
- [TORCH_HCCL_HIGH_PRIORITY](collective_communication/TORCH_HCCL_HIGH_PRIORITY.md)
- [TORCH_HCCL_DESYNC_DEBUG](collective_communication/TORCH_HCCL_DESYNC_DEBUG.md)
- [TORCH_HCCL_ENABLE_MONITORING](collective_communication/TORCH_HCCL_ENABLE_MONITORING.md)
- [TORCH_HCCL_HEARTBEAT_TIMEOUT_SEC](collective_communication/TORCH_HCCL_HEARTBEAT_TIMEOUT_SEC.md)
- [TORCH_HCCL_COORD_CHECK_MILSEC](collective_communication/TORCH_HCCL_COORD_CHECK_MILSEC.md)
- [TORCH_HCCL_TRACE_BUFFER_SIZE](collective_communication/TORCH_HCCL_TRACE_BUFFER_SIZE.md)
- [TORCH_HCCL_TRACE_CPP_STACK](collective_communication/TORCH_HCCL_TRACE_CPP_STACK.md)
- [TORCH_HCCL_DUMP_ON_TIMEOUT](collective_communication/TORCH_HCCL_DUMP_ON_TIMEOUT.md)
- [TORCH_HCCL_WAIT_TIMEOUT_DUMP_MILSEC](collective_communication/TORCH_HCCL_WAIT_TIMEOUT_DUMP_MILSEC.md)
- [TORCH_HCCL_DEBUG_INFO_PIPE_FILE](collective_communication/TORCH_HCCL_DEBUG_INFO_PIPE_FILE.md)
- [TORCH_HCCL_DEBUG_INFO_TEMP_FILE](collective_communication/TORCH_HCCL_DEBUG_INFO_TEMP_FILE.md)
- [TORCH_HCCL_STATUS_SAVE_ENABLE](collective_communication/TORCH_HCCL_STATUS_SAVE_ENABLE.md)
- [TORCH_HCCL_STATUS_SAVE_PATH](collective_communication/TORCH_HCCL_STATUS_SAVE_PATH.md)
- [TORCH_HCCL_STATUS_SAVE_INTERVAL](collective_communication/TORCH_HCCL_STATUS_SAVE_INTERVAL.md)
- [NSLB_CP](collective_communication/NSLB_CP.md)
- [NSLB_MAX_RECORD_NUM](collective_communication/NSLB_MAX_RECORD_NUM.md)
- [PERF_DUMP_CONFIG](collective_communication/PERF_DUMP_CONFIG.md)
- [PERF_DUMP_PATH](collective_communication/PERF_DUMP_PATH.md)
- [DDP_SET_LAST_BUCKET_CAP](collective_communication/DDP_SET_LAST_BUCKET_CAP.md)
- [TP_SOCKET_IFNAME](collective_communication/TP_SOCKET_IFNAME.md)
- [日志与告警](alarm_message_printing/_menu_alarm_message_printing.md)
- [TORCH_LOGS](alarm_message_printing/TORCH_LOGS.md)
- [TORCH_NPU_WARNING_DISABLE](alarm_message_printing/TORCH_NPU_WARNING_DISABLE.md)
- [TORCH_NPU_DISABLED_WARNING](alarm_message_printing/TORCH_NPU_DISABLED_WARNING.md)
- [TORCH_NPU_COMPACT_ERROR_OUTPUT](alarm_message_printing/TORCH_NPU_COMPACT_ERROR_OUTPUT.md)
@@ -84,18 +64,14 @@
- [图编译(torch.compile / Inductor)](inductor/_menu_inductor.md)
- [TORCHINDUCTOR_NPU_BACKEND](inductor/TORCHINDUCTOR_NPU_BACKEND.md)
- [TORCH_CACHING_PRECOMPILE](inductor/TORCH_CACHING_PRECOMPILE.md)
- [TORCHINDUCTOR_CACHE_DIR](inductor/TORCHINDUCTOR_CACHE_DIR.md)
- [TORCHINDUCTOR_COMPILE_THREADS](inductor/TORCHINDUCTOR_COMPILE_THREADS.md)
- [TORCHNPU_PRECOMPILE_THREADS](inductor/TORCHNPU_PRECOMPILE_THREADS.md)
- [INDUCTOR_DVM_ENABLE_MATMUL_FUSION](inductor/INDUCTOR_DVM_ENABLE_MATMUL_FUSION.md)
- [TORCHINDUCTOR_MAX_AUTOTUNE](inductor/TORCHINDUCTOR_MAX_AUTOTUNE.md)
- [TORCHINDUCTOR_MAX_AUTOTUNE_GEMM_BACKENDS](inductor/TORCHINDUCTOR_MAX_AUTOTUNE_GEMM_BACKENDS.md)
- [TORCHINDUCTOR_NPU_CATLASS_DIR](inductor/TORCHINDUCTOR_NPU_CATLASS_DIR.md)
- [TORCHINDUCTOR_CATLASS_ENABLED_OPS](inductor/TORCHINDUCTOR_CATLASS_ENABLED_OPS.md)
- [CATLASS_EPILOGUE_FUSION](inductor/CATLASS_EPILOGUE_FUSION.md)
- [TORCHINDUCTOR_PROFILE_WITH_DO_BENCH_USING_PROFILING](inductor/TORCHINDUCTOR_PROFILE_WITH_DO_BENCH_USING_PROFILING.md)
- [TORCHINDUCTOR_ENABLE_WELFORD](inductor/TORCHINDUCTOR_ENABLE_WELFORD.md)
- [TORCHINDUCTOR_ENABLE_FAST_GELU](inductor/TORCHINDUCTOR_ENABLE_FAST_GELU.md)
- [INDUCTOR_ASCEND_AGGRESSIVE_AUTOTUNE](inductor/INDUCTOR_ASCEND_AGGRESSIVE_AUTOTUNE.md)
- [INDUCTOR_ASCEND_SYMBOLIC_GROUP_AUTOTUNE](inductor/INDUCTOR_ASCEND_SYMBOLIC_GROUP_AUTOTUNE.md)
- [INDUCTOR_ASCEND_SYMBOLIC_GROUP_TEMPLATES](inductor/INDUCTOR_ASCEND_SYMBOLIC_GROUP_TEMPLATES.md)
@@ -103,10 +79,7 @@
- [INDUCTOR_ASCEND_COSTMODEL_RATIO](inductor/INDUCTOR_ASCEND_COSTMODEL_RATIO.md)
- [ENABLE_PARALLEL_SCHEDULER](inductor/ENABLE_PARALLEL_SCHEDULER.md)
- [SHUT_DOWN_FX_PASS_LIST](inductor/SHUT_DOWN_FX_PASS_LIST.md)
- [TORCH_COMPILE_DEBUG](inductor/TORCH_COMPILE_DEBUG.md)
- [(beta)INDUCTOR_ASCEND_CHECK_ACCURACY](inductor/INDUCTOR_ASCEND_CHECK_ACCURACY.md)
- [INDUCTOR_ASCEND_LOG_LEVEL](inductor/INDUCTOR_ASCEND_LOG_LEVEL.md)
- [TORCHINDUCTOR_WORKER_LOGPATH](inductor/TORCHINDUCTOR_WORKER_LOGPATH.md)
- [TORCHINDUCTOR_WORKER_SUPPRESS_LOGGING](inductor/TORCHINDUCTOR_WORKER_SUPPRESS_LOGGING.md)
- [附录](appendix/_menu_appendix.md)
- [在进行模型分布式训练时遇到报错“RuntimeError: The Inner Error ...”](appendix/runtimeerror_Inner_Error.md)
@@ -1,80 +0,0 @@
# TORCH\_LOGS
## 功能描述
通过此环境变量可控制TorchNPU各模块的日志输出级别,用于调试和排查`torch.compile`及其后端(Inductor、Dynamo等)的行为。设置后,`torch_npu`会将日志配置同步到C++层日志上下文。
- 默认值未配置:使用默认日志级别(WARNING)。
- 配置为`+模块名`:输出指定模块的DEBUG级别日志。
- 配置为`-模块名`:仅输出指定模块的ERROR级别日志。
- 配置为`模块名1,模块名2`:同时配置多个模块,输出INFO级别日志。
- 配置为`+模块名1,-模块名2`:混合配置,`+`/`-`前缀逐项生效,可对同一配置中的不同模块设置不同级别。
常用模块名及功能说明如下:
| 模块名 | 功能描述 |
|:---|:---|
| `dynamo` | 打印TorchDynamo图捕获与追踪日志 |
| `aot` | 打印AOTAutograd前反向图构建日志 |
| `inductor` | 打印Inductor编译日志 |
| `dynamic` | 打印动态shape(symbolic shapes)推导日志 |
| `fake_tensor` | 打印FakeTensor相关日志 |
| `autograd` | 打印autograd相关日志 |
| `distributed` | 打印分布式训练相关日志 |
| `c10d` | 打印ProcessGroup集合通信相关日志 |
| `ddp` | 打印DistributedDataParallel相关日志 |
| `fsdp` | 打印FSDP相关日志 |
| `graph` | 以表格形式打印Dynamo追踪得到的FX图 |
| `graph_code` | 以Python代码形式打印Dynamo追踪得到的FX图 |
| `aot_graphs` | 打印AOTAutograd分区后的前向/反向FX图 |
| `graph_breaks` | 打印Dynamo发生图中断(graph break)的位置及原因 |
| `recompiles` | 打印触发重新编译的原因 |
| `guards` | 打印每个已编译Dynamo帧的守卫(guards) |
| `output_code` | 打印Inductor生成的代码(Triton或C++) |
| `kernel_code` | 按kernel打印Inductor生成的代码 |
| `compiled_autograd` | 打印compiled autograd相关日志(含计算图) |
> [!NOTE]
>
> - 该环境变量需在导入`torch_npu`之前设置。
> - 环境变量设置`TORCH_LOGS`后,优先级高于`torch._logging.set_logs()`,API调用将不生效。
> - 完整可配置的模块名可通过`TORCH_LOGS="+help"`查看,不同PyTorch版本支持的模块可能存在差异。
该变量对应PyTorch的[TORCH_LOGS](https://docs.pytorch.org/docs/stable/logging.html),配置方式一致,完整组件与artifact列表请参考该文档。
## 配置示例
输出Inductor的DEBUG级别日志:
```bash
export TORCH_LOGS="+inductor"
```
仅输出指定模块的ERROR级别日志:
```bash
export TORCH_LOGS="-inductor"
```
同时配置多个模块:
```bash
export TORCH_LOGS="+inductor,+dynamo"
```
混合配置(不同模块不同级别,`+`/`-`可混用):
```bash
export TORCH_LOGS="+inductor,-dynamo"
```
## 使用约束
无
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
@@ -4,10 +4,10 @@
通过此环境变量可精简打印错误信息,开启后会将CANN内部调用栈、TorchNPU错误码等自定义报错信息转移到plog中,仅保留有效的错误说明,提高异常信息的可读性。plog的详细信息请参考[plog日志信息](../../../user_guide/troubleshooting/error_information_analysis_guide/error_information_classification/plog_log.md)。
- 配置为0时:正常进行ERROR打印。
- 配置为1时:启用精简ERROR打印。
- 配置为“0”时:正常进行ERROR打印。
- 配置为“1”时:启用精简ERROR打印。
此环境变量默认值为0。
此环境变量默认值为“0”。
## 配置示例
@@ -21,14 +21,22 @@ export TORCH_NPU_COMPACT_ERROR_OUTPUT=1
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="910b" id2 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id2 -->
<!-- npu="A3" id3 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id3 -->
<!-- npu="950" id4 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id4 -->
## 结果示例
- 设置为默认值0,正常进行ERROR打印时:
- 设置为默认值“0”,正常进行ERROR打印时:
```python
>>> torch_npu.npu.set_device(100)
@@ -37,9 +37,21 @@ unset TORCH_NPU_DISABLED_WARNING
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Atlas 800I A2 推理产品</term>
- <term>Atlas 推理系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="910b" id2 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id2 -->
<!-- npu="A3" id3 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id3 -->
<!-- npu="910b" id6 -->
- <term>Atlas 800I A2推理服务器</term>
<!-- end id6 -->
<!-- npu="310p" id4 -->
- <term>Atlas推理系列产品</term>
<!-- end id4 -->
<!-- npu="950" id5 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id5 -->
@@ -56,9 +56,21 @@ shmem模块仅在PyTorch 2.7.1及以上版本生效。
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Atlas 800I A2 推理产品</term>
- <term>Atlas 推理系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="910b" id2 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id2 -->
<!-- npu="A3" id3 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id3 -->
<!-- npu="910b" id6 -->
- <term>Atlas 800I A2推理服务器</term>
<!-- end id6 -->
<!-- npu="310p" id4 -->
- <term>Atlas推理系列产品</term>
<!-- end id4 -->
<!-- npu="950" id5 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id5 -->
@@ -49,9 +49,21 @@
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Atlas 800I A2 推理产品</term>
- <term>Atlas 推理系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="910b" id2 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id2 -->
<!-- npu="A3" id3 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id3 -->
<!-- npu="910b" id6 -->
- <term>Atlas 800I A2推理服务器</term>
<!-- end id6 -->
<!-- npu="310p" id4 -->
- <term>Atlas推理系列产品</term>
<!-- end id4 -->
<!-- npu="950" id5 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id5 -->
@@ -34,9 +34,21 @@ unset TORCH_NPU_WARNING_DISABLE
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Atlas 800I A2 推理产品</term>
- <term>Atlas 推理系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="910b" id2 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id2 -->
<!-- npu="A3" id3 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id3 -->
<!-- npu="910b" id6 -->
- <term>Atlas 800I A2推理服务器</term>
<!-- end id6 -->
<!-- npu="310p" id4 -->
- <term>Atlas推理系列产品</term>
<!-- end id4 -->
<!-- npu="950" id5 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id5 -->
@@ -1,8 +1,7 @@
# 日志与告警
配置PyTorch与TorchNPU通用日志、告警和错误输出;通信及图编译专用诊断配置保留在对应分类。
配置TorchNPU通用日志、告警和错误输出;通信及图编译专用诊断配置保留在对应分类。
- [TORCH_LOGS](TORCH_LOGS.md)
- [TORCH_NPU_WARNING_DISABLE](TORCH_NPU_WARNING_DISABLE.md)
- [TORCH_NPU_DISABLED_WARNING](TORCH_NPU_DISABLED_WARNING.md)
- [TORCH_NPU_COMPACT_ERROR_OUTPUT](TORCH_NPU_COMPACT_ERROR_OUTPUT.md)
@@ -1,27 +0,0 @@
# DDP\_SET\_LAST\_BUCKET\_CAP
## 功能描述
通过此环境变量可控制DDP(Distributed Data Parallel)的bucket重建顺序。当设为开启时,较小的`first bucket cap`会被分配到最后一个bucket,而不是第一个bucket。该环境变量默认未配置。
- 配置为“1”:启用,将较小的`first bucket cap`落到最后一个bucket。
- 其他值或未配置:不启用,保持默认的bucket顺序。
该变量沿用PyTorch的同名环境变量,配置方式一致。
## 配置示例
```bash
export DDP_SET_LAST_BUCKET_CAP=1
```
## 使用约束
无
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
@@ -26,7 +26,15 @@ export HCCL_EVENT_TIMEOUT=1800
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="910b" id2 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id2 -->
<!-- npu="A3" id3 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id3 -->
<!-- npu="950" id4 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id4 -->
@@ -1,36 +0,0 @@
# NSLB\_CP
## 功能描述
通过此环境变量可配置HCCL操作的NSLB(Non-Stop Load Balancing)采样记录目录路径。当设置为非空路径时,每个collective操作会记录操作类型、数据量和rank信息到该目录下的文件中。该环境变量默认未设置。
- 未配置时:关闭NSLB采样。
- 配置路径时:开启NSLB采样,记录文件创建在指定路径下。
> [!NOTE]
>
> - 此环境变量在`ProcessGroupHCCL.cpp`文件级全局初始化时读取,应在加载`torch_npu`扩展前设置。
> - NSLB采样依赖由`torchrun/elastic`启动器注入的`RANK`和`MASTER_ADDR`两个PyTorch的环境变量。`RANK`用于标记记录来源,`MASTER_ADDR`参与文件名构造。
> - 如果环境中存在`HCCL_ALGO`,新建记录文件时会写入一行`HCCL_ALGO=<value>`作为说明。
> - NSLB采样不读取Flight Recorder ring buffer,与FR dump是独立的采样路径。
> - 记录文件名格式为:`<master_addr>_<comm_name>_<rank>.log`。
> - 每个PG的最大采样记录数量由`NSLB_MAX_RECORD_NUM`控制。
该环境变量由TorchNPU提供,PyTorch没有直接对应的环境变量。
## 配置示例
```bash
export NSLB_CP=/data/nslb_records
```
## 使用约束
无
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
@@ -1,31 +0,0 @@
# NSLB\_MAX\_RECORD\_NUM
## 功能描述
通过此环境变量可控制每个PG的NSLB(Non-Stop Load Balancing)最大采样记录数量。
- 默认值:1000。
- 配置其他值时:以该值作为每个PG的采样上限,达到上限后会写入end文件并停止采样。
> [!NOTE]
>
> 仅当`NSLB_CP`设置为非空路径时,采样记录才会写入文件。
该环境变量由TorchNPU提供,PyTorch没有直接对应的环境变量。
## 配置示例
```bash
export NSLB_MAX_RECORD_NUM=5000
```
## 使用约束
无
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
@@ -2,10 +2,10 @@
## 功能描述
通过此环境变量可配置是否开启点对点通信(torch.distributed.isend、torch.distributed.irecv和torch.distributed.batch\_isend\_irecv),并使用独立通信域功能。
通过此环境变量可配置点对点通信(torch.distributed.isend、torch.distributed.irecv和torch.distributed.batch\_isend\_irecv)是否使用独立通信域,以及独立通信域的缓冲区大小。
- 配置为0时:关闭点对点通信,使用独立通信域功能。
- 配置大于等于1时:开启点对点通信,使用独立通信域功能,并且缓冲区大小为配置值。
- 配置为0时:不使用独立点对点通信域,点对点通信复用默认通信域。
- 配置大于等于1时:使用独立点对点通信域,缓冲区大小为配置值。
单位为MB,默认配置为20。
@@ -27,7 +27,15 @@ export P2P_HCCL_BUFFSIZE=20
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="910b" id2 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id2 -->
<!-- npu="A3" id3 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id3 -->
<!-- npu="950" id4 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id4 -->
@@ -1,27 +0,0 @@
# PERF\_DUMP\_CONFIG
## 功能描述
通过此环境变量可配置HCCL操作的性能数据记录功能。格式为分号分隔的`key:value`键值对。只有`enable:true`精确匹配时才会启用性能记录,该环境变量默认值未设置。
- 配置为`enable:true`:启用collective性能记录。
- 其他值或未配置:不启用collective性能记录。
该环境变量由TorchNPU提供,PyTorch没有直接对应的环境变量。
## 配置示例
```bash
export PERF_DUMP_CONFIG=enable:true
```
## 使用约束
配置为`PERF_DUMP_CONFIG=enable:true`后,若`PERF_DUMP_PATH`为空(默认即空)或不是可解析的real path,collective热路径会抛出错误,该路径必须能通过`realpath`解析。
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
@@ -1,31 +0,0 @@
# PERF\_DUMP\_PATH
## 功能描述
通过此环境变量可配置HCCL性能dump文件的输出目录路径。启用性能记录后,collective性能记录会输出到该目录下的`perf_pt_<pid>_<device>.log`文件中。
- 默认值为空:不输出性能dump文件。
- 配置为指定路径:性能记录输出到该目录下的`perf_pt_<pid>_<device>.log`文件。
> [!NOTE]
>
> `PERF_DUMP_PATH`必须能通过`realpath`解析,否则在`PERF_DUMP_CONFIG=enable:true`时collective热路径会抛出错误。
该环境变量由TorchNPU提供,PyTorch没有直接对应的环境变量。
## 配置示例
```bash
export PERF_DUMP_PATH=/data/perf_logs
```
## 使用约束
无
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
@@ -39,7 +39,15 @@ unset RANK_TABLE_FILE
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="910b" id2 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id2 -->
<!-- npu="A3" id3 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id3 -->
<!-- npu="950" id4 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id4 -->
@@ -0,0 +1,42 @@
# ROOTINFO\_SCALABLE\_ENABLE
## 功能描述
当使用HCCL作为通信后端且采用RootInfo方式建立通信域时,通过此环境变量可控制是否开启Scalable RootInfo分级建链。
- 配置为“0”(默认值):关闭Scalable RootInfo,使用原单RootInfo路径建立通信域。
- 配置为“1”:开启Scalable RootInfo。满足使用条件时,将当前通信域内的rank连续、均衡地划分到多个group,每个group选择一个root,通过分级方式建立通信域。
开启功能后,每个root期望管理的rank数量由`TORCH_HCCL_RANKS_PER_ROOT`配置。当前通信域的rank数量不大于该配置值时,仍使用原单RootInfo路径。
该功能需配套使用支持Scalable RootInfo接口的CANN/HCCL版本,详细使用方法请参见[Scalable RootInfo分级建链](../../../developer_notes/distributed/communication_strategy/scalable_rootinfo_link_setup.md)。
## 配置示例
开启Scalable RootInfo分级建链:
```bash
export ROOTINFO_SCALABLE_ENABLE=1
```
关闭Scalable RootInfo分级建链:
```bash
unset ROOTINFO_SCALABLE_ENABLE
```
## 使用约束
- 该环境变量仅作用于RootInfo建链路径,不改变rank table建链行为。
- 仅对DEFAULT类型的HCCL通信域生效,P2P通信域继续使用原RootInfo路径。
- HCCL通信域采用懒加载机制,首次执行需要通信域的集合通信操作时才会触发建链。
- 该环境变量在进程内首次读取后会被缓存,应在启动分布式worker前完成配置,不支持在同一进程内动态切换。
## 支持的型号
<!-- npu="910b" id1 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id1 -->
<!-- npu="A3" id2 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id2 -->
@@ -35,7 +35,15 @@ export HCCL_ASYNC_ERROR_HANDLING=1
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Atlas 推理系列产品</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="910b" id2 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id2 -->
<!-- npu="A3" id3 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id3 -->
<!-- npu="310p" id4 -->
- <term>Atlas推理系列产品</term>
<!-- end id4 -->
@@ -4,8 +4,8 @@
当使用HCCL作为通信后端时,通过此环境变量可控制`ProcessGroupHCCL`中`wait()`和`synchronize()`的同步模式(阻塞或非阻塞)。
- `0`(默认值):关闭阻塞等待。
- `1`:开启阻塞等待。
- 0(默认值):关闭阻塞等待。
- 1:开启阻塞等待。
> [!NOTE]
>
@@ -35,8 +35,18 @@ export HCCL_BLOCKING_WAIT=1
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Atlas 推理系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="910b" id2 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id2 -->
<!-- npu="A3" id3 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id3 -->
<!-- npu="310p" id4 -->
- <term>Atlas推理系列产品</term>
<!-- end id4 -->
<!-- npu="950" id5 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id5 -->
@@ -1,30 +0,0 @@
# TORCH\_HCCL\_COORD\_CHECK\_MILSEC
## 功能描述
当使用HCCL作为通信后端时,通过此环境变量可设置WatchDog线程中轮询检查Store dump signal的时间间隔。WatchDog线程会以此间隔检查其他rank通过Store发出的dump信号,用于跨rank协调的dump通知。
该环境变量的默认值为1000,单位为ms。
> [!NOTE]
>
> 减小此值可以更快响应dump信号,但会增加对Store的轮询频率。
该变量对应PyTorch的[`TORCH_NCCL_COORD_CHECK_MILSEC`](https://docs.pytorch.org/docs/2.14/torch_nccl_environment_variables.html)。配置方式一致,默认值均为1000。
## 配置示例
```bash
export TORCH_HCCL_COORD_CHECK_MILSEC=500
```
## 使用约束
此环境变量仅在`TORCH_HCCL_ENABLE_MONITORING=1`时生效。
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
@@ -1,42 +0,0 @@
# TORCH\_HCCL\_DEBUG\_INFO\_PIPE\_FILE
## 功能描述
当使用HCCL作为通信后端时,通过此环境变量可配置命名管道文件,用于外部触发Flight Recorder dump。该环境变量默认值为空。
- 配置为指定路径:在指定路径创建`<stem><rank>.pipe`命名管道文件。
- 未配置或默认配置:不创建管道文件。
向该管道文件写入任意内容,即可触发HCCL debug dump。
> [!NOTE]
>
> 管道文件通过`mkfifo`创建,`O_RDONLY | O_NONBLOCK`模式打开。
该变量对应PyTorch的`TORCH_NCCL_DEBUG_INFO_PIPE_FILE`。配置方式一致,默认值均为空。
## 配置示例
创建管道:
```bash
export TORCH_HCCL_DEBUG_INFO_PIPE_FILE=/tmp/hccl_debug_pipe
```
管道文件在被创建后,用户可通过`echo`等命令向管道写入数据触发dump:
```bash
echo "dump" > /tmp/hccl_debug_pipe_0.pipe
```
## 使用约束
- 此环境变量仅在`TORCH_HCCL_TRACE_BUFFER_SIZE > 0`时生效。
- 管道文件是在ProcessGroupHCCL构造时创建的,需在创建PG前设置环境变量。
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
@@ -1,32 +0,0 @@
# TORCH\_HCCL\_DEBUG\_INFO\_TEMP\_FILE
## 功能描述
当使用HCCL作为通信后端时,通过此环境变量可配置dump文件的转储路径及文件名前缀,每个rank对应一个文件,HCCL debug信息将输出到该文件。
- 默认值为`/tmp/hccl_trace_rank_`,最终文件名为`<前缀><rank序号>`。例如,默认配置下第0个rank的dump文件为`/tmp/hccl_trace_rank_0`。
- 配置指定路径前缀:以指定路径作为文件名前缀,dump文件输出到该前缀所在目录,文件名为`<前缀><rank序号>`。
该变量对应PyTorch的[`TORCH_FR_DUMP_TEMP_FILE`](https://docs.pytorch.org/tutorials/unstable/flight_recorder_tutorial.html#enabling-flight-recorder)。PyTorch同时兼容[`TORCH_NCCL_DEBUG_INFO_TEMP_FILE`](https://docs.pytorch.org/docs/2.14/torch_nccl_environment_variables.html)名称。
> [!NOTE]
>
> PyTorch默认为`$XDG_CACHE_HOME/torch/comm_lib_trace_rank_`,未设置`XDG_CACHE_HOME`时使用`$HOME/.cache/torch/comm_lib_trace_rank_`;TorchNPU默认为`/tmp/hccl_trace_rank_`。
## 配置示例
配置指定路径
```bash
export TORCH_HCCL_DEBUG_INFO_TEMP_FILE=/data/hccl_trace_rank_
```
## 使用约束
仅当`TORCH_HCCL_TRACE_BUFFER_SIZE > 0`且有dump触发时才会生成文件。
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
@@ -36,8 +36,18 @@ PyTorch版本为1.11.0时,此环境变量需要与[TORCH\_HCCL\_ASYNC\_ERROR\_
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Atlas 推理系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="910b" id2 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id2 -->
<!-- npu="A3" id3 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id3 -->
<!-- npu="310p" id4 -->
- <term>Atlas推理系列产品</term>
<!-- end id4 -->
<!-- npu="950" id5 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id5 -->
@@ -1,31 +0,0 @@
# TORCH\_HCCL\_DUMP\_ON\_TIMEOUT
## 功能描述
当使用HCCL作为通信后端时,通过此环境变量可控制发生HCCL超时或错误时是否自动触发Flight Recorder调试信息dump。
- 配置为“0”:超时或错误时不触发dump。
- 配置为“1”:超时或错误时触发本rank的dump,并通过Store协调其他rank同步dump。
该环境变量默认值配置为“0”。
该变量对应PyTorch的`TORCH_FR_DUMP_ON_TIMEOUT`(PyTorch 2.15版本及以上),PyTorch兼容历史版本变量[`TORCH_NCCL_DUMP_ON_TIMEOUT`](https://docs.pytorch.org/tutorials/unstable/flight_recorder_tutorial.html#enabling-flight-recorder)(PyTorch 2.14版本及以下),PyTorch默认开启。
## 配置示例
```bash
export TORCH_HCCL_DUMP_ON_TIMEOUT=1
```
## 使用约束
- 建议配合`TORCH_HCCL_TRACE_BUFFER_SIZE > 0`和`TORCH_HCCL_ENABLE_MONITORING=1`使用。
- dump文件路径由[TORCH_HCCL_DEBUG_INFO_TEMP_FILE](TORCH_HCCL_DEBUG_INFO_TEMP_FILE.md)控制,默认输出到`/tmp/hccl_trace_rank_<rank>`。
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
@@ -1,36 +0,0 @@
# TORCH\_HCCL\_ENABLE\_MONITORING
## 功能描述
当使用HCCL作为通信后端时,通过此环境变量可控制是否启动heartbeat monitor线程。该线程用于检测HCCL WatchDog线程是否卡死,并在WatchDog无心跳时自动dump调试信息并终止进程。
- 配置为“0”:不启动monitor线程。
- 配置为“1”:启动monitor线程,WatchDog失去响应将触发`TORCH_HCCL_DUMP_ON_TIMEOUT`逻辑并终止进程。
该环境变量默认值为“0”。
> [!NOTE]
>
> - 当前版本同时兼容旧名称`HCCL_ENABLE_MONITORING`。
> - WatchDog心跳超时时间由`TORCH_HCCL_HEARTBEAT_TIMEOUT_SEC`控制,默认600秒。
> - 建议开启此功能以预防训练任务因HCCL API无响应而长时间占用集群资源。
该变量对应PyTorch的[`TORCH_NCCL_ENABLE_MONITORING`](https://docs.pytorch.org/docs/2.14/torch_nccl_environment_variables.html),PyTorch默认开启。
## 配置示例
```bash
export TORCH_HCCL_ENABLE_MONITORING=1
```
## 使用约束
- 建议同时设置`TORCH_HCCL_TRACE_BUFFER_SIZE > 0`以便在无响应时dump有效的调试信息。
- Monitor线程在ProcessGroupHCCL构造时启动,需在创建PG前设置环境变量。
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
@@ -1,26 +0,0 @@
# TORCH\_HCCL\_HEARTBEAT\_TIMEOUT\_SEC
## 功能描述
在使用HCCL作为通信后端时,通过此环境变量可设置heartbeat monitor判定WatchDog无响应的超时时间。当WatchDog线程停止响应超过该时长时,monitor将判定其无响应,并触发dump及进程终止。
该环境变量默认值为600,单位为s。
该变量对应PyTorch的[`TORCH_NCCL_HEARTBEAT_TIMEOUT_SEC`](https://docs.pytorch.org/docs/2.14/torch_nccl_environment_variables.html),PyTorch默认值为480。
## 配置示例
```bash
export TORCH_HCCL_HEARTBEAT_TIMEOUT_SEC=300
```
## 使用约束
此环境变量仅在`TORCH_HCCL_ENABLE_MONITORING=1`时生效。
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
@@ -1,34 +0,0 @@
# TORCH\_HCCL\_HIGH\_PRIORITY
## 功能描述
当使用HCCL作为通信后端时,通过此环境变量可控制是否强制从高优先级NPU stream pool中获取通信流。
- 配置为“0”:不强制使用高优先级stream,PG option中的优先级设置可能生效。
- 配置为“1”:强制使用高优先级NPU stream pool中的通信流。
该环境变量默认值为“0”。
> [!NOTE]
>
> - 当前版本同时兼容旧名称`HCCL_HIGH_PRIORITY`。
> - 高优先级stream可能减少通信延迟,但可能影响计算与通信的并发调度。
该变量对应PyTorch的[`TORCH_NCCL_HIGH_PRIORITY`](https://docs.pytorch.org/docs/2.14/torch_nccl_environment_variables.html),配置方式一致,默认均关闭。
## 配置示例
```bash
export TORCH_HCCL_HIGH_PRIORITY=1
```
## 使用约束
无
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
@@ -0,0 +1,43 @@
# TORCH\_HCCL\_RANKS\_PER\_ROOT
## 功能描述
开启Scalable RootInfo分级建链后,通过此环境变量可配置每个root期望管理的最大rank数量,并据此计算当前通信域使用的root数量。
该环境变量默认值为“128”,取值范围为1~4294967295的十进制整数。
设当前ProcessGroup包含N个rank,本环境变量的取值为R:
- 当N小于等于R时:使用原单RootInfo路径。
- 当N大于R时:root数量K为`ceil(N / R)`。N个rank会被连续、均衡地划分到K个group,各group的rank数量最多相差1,每个group的首个`local rank`作为root。
## 配置示例
开启Scalable RootInfo,并将每个root期望管理的rank数量设置为128:
```bash
export ROOTINFO_SCALABLE_ENABLE=1
export TORCH_HCCL_RANKS_PER_ROOT=128
```
仅配置功能开关时,本环境变量使用默认值“128”:
```bash
export ROOTINFO_SCALABLE_ENABLE=1
unset TORCH_HCCL_RANKS_PER_ROOT
```
## 使用约束
- 仅在`ROOTINFO_SCALABLE_ENABLE=1`且设备支持Scalable RootInfo时参与通信域路径选择。
- 配置为空字符串、0、负数、非数字、包含多余字符或超过4294967295时,会返回参数错误。
- 环境变量应在启动分布式worker前完成配置,详细使用方法请参见[Scalable RootInfo分级建链](../../../developer_notes/distributed/communication_strategy/scalable_rootinfo_link_setup.md)。
## 支持的型号
<!-- npu="910b" id1 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id1 -->
<!-- npu="A3" id2 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id2 -->
@@ -29,7 +29,15 @@ export TORCH_HCCL_STATUS_SAVE_ENABLE=1
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="910b" id2 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id2 -->
<!-- npu="A3" id3 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id3 -->
<!-- npu="950" id4 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id4 -->
@@ -25,7 +25,15 @@ export TORCH_HCCL_STATUS_SAVE_INTERVAL=5
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="910b" id2 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id2 -->
<!-- npu="A3" id3 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id3 -->
<!-- npu="950" id4 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id4 -->
@@ -25,7 +25,15 @@ export TORCH_HCCL_STATUS_SAVE_PATH=/data/hccl_status
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="910b" id2 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id2 -->
<!-- npu="A3" id3 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id3 -->
<!-- npu="950" id4 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id4 -->
@@ -1,36 +0,0 @@
# TORCH\_HCCL\_TRACE\_BUFFER\_SIZE
## 功能描述
当使用HCCL作为通信后端时,通过此环境变量可配置HCCL Flight Recorder环形缓冲区中最大可记录的事件数。每个事件对应一次集合通信操作的开始或结束。
- 配置为“0”或负数时:关闭Flight Recorder记录功能,不记录任何事件,导出dump时也不包含trace内容。
- 配置为正整数时:开启Flight Recorder记录功能,缓冲区最多保存该数量的事件记录。
该环境变量默认值为“0”。
> [!NOTE]
>
> - 此环境变量在`HCCLTraceBuffer`单例首次构造时读取并缓存,运行中修改不会生效。
> - 此环境变量需在加载`torch_npu`扩展前设置,运行中修改无效。
> - 缓冲区大小直接影响内存占用,建议根据实际collective数量合理配置。
> - 开启记录后,HCCL watchDog线程会周期性处理缓冲区中的事件。
该变量对应PyTorch的`TORCH_FR_BUFFER_SIZE`,PyTorch同时兼容[`TORCH_NCCL_TRACE_BUFFER_SIZE`](https://docs.pytorch.org/tutorials/unstable/flight_recorder_tutorial.html#enabling-flight-recorder)名称,PyTorch默认值为2000。
## 配置示例
```bash
export TORCH_HCCL_TRACE_BUFFER_SIZE=2000
```
## 使用约束
仅当`TRACE_BUFFER_SIZE > 0`时,`TORCH_HCCL_DUMP_ON_TIMEOUT`等超时dump功能才会产生有效内容。
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
@@ -1,37 +0,0 @@
# TORCH\_HCCL\_TRACE\_CPP\_STACK
## 功能描述
当使用HCCL作为通信后端时,通过此环境变量可控制Flight Recorder在记录事件时是否同时采集C++调用栈。
- 配置为“0”:不采集C++调用栈,仅记录Python和TorchScript调用栈。
- 配置为“1”:采集C++调用栈,在事件记录时保存C++ instruction pointer,导出dump时可通过符号化转换为函数名和行号。
该环境变量默认值“0”。
该环境变量默认值“0”。
> [!NOTE]
>
> - 该环境变量需在加载`torch_npu`扩展前设置。
> - 此环境变量在`HCCLTraceBuffer`单例首次构造时读取并缓存,运行中修改不会生效。
> - 此环境变量控制的是**记录阶段**是否采集栈,不等同于dump阶段是否输出栈。如果记录时未采集,dump时无法还原C++栈。
> - 开启C++栈采集会略微增加记录阶段的性能开销。
该变量对应PyTorch的`TORCH_FR_CPP_STACK`,PyTorch同时兼容[`TORCH_NCCL_TRACE_CPP_STACK`](https://docs.pytorch.org/docs/2.14/torch_nccl_environment_variables.html)。配置方式一致,默认均关闭。
## 配置示例
```bash
export TORCH_HCCL_TRACE_CPP_STACK=1
```
## 使用约束
需同时设置`TORCH_HCCL_TRACE_BUFFER_SIZE > 0`,否则无事件可记录。
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
@@ -1,26 +0,0 @@
# TORCH\_HCCL\_WAIT\_TIMEOUT\_DUMP\_MILSEC
## 功能描述
当使用HCCL作为通信后端时,通过此环境变量可设置heartbeat monitor等待异步dump完成的最大时间。当发生超时触发dump时,monitor会等待其他rank的dump完成。超过此时间后,无论dump是否完成,monitor都会终止进程。
该环境变量的默认值为60000,单位为ms。
该变量对应PyTorch的`TORCH_FR_WAIT_TIMEOUT_DUMP_MILSEC`,PyTorch同时兼容[`TORCH_NCCL_WAIT_TIMEOUT_DUMP_MILSEC`](https://docs.pytorch.org/docs/2.14/torch_nccl_environment_variables.html),PyTorch默认值为15000。
## 配置示例
```bash
export TORCH_HCCL_WAIT_TIMEOUT_DUMP_MILSEC=30000
```
## 使用约束
此环境变量仅在`TORCH_HCCL_ENABLE_MONITORING=1`时生效。
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
@@ -1,31 +0,0 @@
# TP\_SOCKET\_IFNAME
## 功能描述
通过此环境变量可指定TensorPipe RPC传输层使用的网络接口名称。当节点有多个网络接口时,用于绑定特定的网卡。
- 未配置或默认配置:通过hostname解析IP地址。
- 配置指定接口名:绑定指定网卡,通过`lookupAddrForIface`查找该接口的IP地址。
> [!NOTE]
>
> 如果指定接口查找失败会回退到`127.0.0.1`。
该变量沿用PyTorch的同名环境变量,配置方式一致。
## 配置示例
```bash
export TP_SOCKET_IFNAME=eth0
```
## 使用约束
无
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
@@ -1,6 +1,6 @@
# 分布式通信与诊断
配置HCCL进程组、通信监控、性能采集以及DDP和RPC。
配置HCCL进程组、通信同步、超时诊断和状态采集。
## 通信执行与同步
@@ -9,33 +9,16 @@
- [HCCL_EVENT_TIMEOUT](HCCL_EVENT_TIMEOUT.md)
- [P2P_HCCL_BUFFSIZE](P2P_HCCL_BUFFSIZE.md)
- [RANK_TABLE_FILE](RANK_TABLE_FILE.md)
- [ROOTINFO_SCALABLE_ENABLE](ROOTINFO_SCALABLE_ENABLE.md)
- [TORCH_HCCL_RANKS_PER_ROOT](TORCH_HCCL_RANKS_PER_ROOT.md)
- [(beta)TORCH_HCCL_ZERO_COPY]((beta)TORCH_HCCL_ZERO_COPY.md)
- [TORCH_HCCL_HIGH_PRIORITY](TORCH_HCCL_HIGH_PRIORITY.md)
## 超时监控与故障记录
- [TORCH_HCCL_DESYNC_DEBUG](TORCH_HCCL_DESYNC_DEBUG.md)
- [TORCH_HCCL_ENABLE_MONITORING](TORCH_HCCL_ENABLE_MONITORING.md)
- [TORCH_HCCL_HEARTBEAT_TIMEOUT_SEC](TORCH_HCCL_HEARTBEAT_TIMEOUT_SEC.md)
- [TORCH_HCCL_COORD_CHECK_MILSEC](TORCH_HCCL_COORD_CHECK_MILSEC.md)
- [TORCH_HCCL_TRACE_BUFFER_SIZE](TORCH_HCCL_TRACE_BUFFER_SIZE.md)
- [TORCH_HCCL_TRACE_CPP_STACK](TORCH_HCCL_TRACE_CPP_STACK.md)
- [TORCH_HCCL_DUMP_ON_TIMEOUT](TORCH_HCCL_DUMP_ON_TIMEOUT.md)
- [TORCH_HCCL_WAIT_TIMEOUT_DUMP_MILSEC](TORCH_HCCL_WAIT_TIMEOUT_DUMP_MILSEC.md)
- [TORCH_HCCL_DEBUG_INFO_PIPE_FILE](TORCH_HCCL_DEBUG_INFO_PIPE_FILE.md)
- [TORCH_HCCL_DEBUG_INFO_TEMP_FILE](TORCH_HCCL_DEBUG_INFO_TEMP_FILE.md)
## 状态与性能采集
## 状态采集
- [TORCH_HCCL_STATUS_SAVE_ENABLE](TORCH_HCCL_STATUS_SAVE_ENABLE.md)
- [TORCH_HCCL_STATUS_SAVE_PATH](TORCH_HCCL_STATUS_SAVE_PATH.md)
- [TORCH_HCCL_STATUS_SAVE_INTERVAL](TORCH_HCCL_STATUS_SAVE_INTERVAL.md)
- [NSLB_CP](NSLB_CP.md)
- [NSLB_MAX_RECORD_NUM](NSLB_MAX_RECORD_NUM.md)
- [PERF_DUMP_CONFIG](PERF_DUMP_CONFIG.md)
- [PERF_DUMP_PATH](PERF_DUMP_PATH.md)
## DDP与RPC
- [DDP_SET_LAST_BUCKET_CAP](DDP_SET_LAST_BUCKET_CAP.md)
- [TP_SOCKET_IFNAME](TP_SOCKET_IFNAME.md)
@@ -5,7 +5,7 @@
## 功能描述
训练或在线推理场景下,可通过此环境变量开启集合通信片内零拷贝功能,减少通信算子在通信过程中片内拷贝次数,提升集合通信效率,降低通信耗时。同时在计算通信并行场景下,降低通信过程中对显存带宽的抢占。
训练或在线推理场景下,可通过此环境变量开启集合通信片内零拷贝功能,减少通信算子在通信过程中片内拷贝次数,提升集合通信效率,降低通信耗时。同时在计算通信并行场景下,减少通信过程中对显存带宽的抢占。
- 0:关闭集合通信零拷贝功能。
- 1:开启集合通信零拷贝功能。
@@ -31,4 +31,6 @@ export TORCH_HCCL_ZERO_COPY=1
## 支持的型号
<term>Atlas A3 训练系列产品</term>
<!-- npu="A3" id1 -->
<term>Atlas A3训练系列产品</term>
<!-- end id1 -->
@@ -31,7 +31,15 @@ export PYTORCH_HAL_BASED_NPU_CHECK=1
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="910b" id2 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id2 -->
<!-- npu="A3" id3 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id3 -->
<!-- npu="950" id4 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id4 -->
@@ -6,11 +6,11 @@
stream pool采用Round Robin策略。
- 配置为32时:stream pool有32条流。
- 配置为8时:stream pool有8条流。
- 配置为“32”时:stream pool有32条流。
- 配置为“8”时:stream pool有8条流。
- 配置为其他值时:打印Warning级别日志预警,并配置为默认值32。
此环境变量默认值为32。
此环境变量默认值为“32”。
## 配置示例
@@ -24,7 +24,15 @@ export STREAMS_PER_DEVICE=8
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="910b" id2 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id2 -->
<!-- npu="A3" id3 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id3 -->
<!-- npu="950" id4 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id4 -->
@@ -21,7 +21,15 @@ export TORCH_NPU_DEVICE_CAPABILITY=8.0
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="910b" id2 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id2 -->
<!-- npu="A3" id3 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id3 -->
<!-- npu="950" id4 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id4 -->
@@ -31,7 +31,15 @@ export TORCH_TRANSFER_TO_NPU=0
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="910b" id2 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id2 -->
<!-- npu="A3" id3 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id3 -->
<!-- npu="950" id4 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id4 -->
@@ -1,32 +0,0 @@
# ENABLE\_TIERED\_PARALLEL\_TCPSTORE
## 功能描述
通过此环境变量可控制ParallelStore是否启用分层建链(tiered)优化模式。分层建链将建链复杂度从O(n)降低到O(sqrt(n)),在大规模集群场景下显著提升建链性能。
- 配置为字符串`true`(不区分大小写):开启分层建链优化模式。
- 配置为其他值:关闭分层建链优化模式。
- 默认值:`torch_npu_run`命令行参数`--enable_tiered_parallel_tcpstore`的默认值,通常为“false”,即默认关闭分层建链。
> [!NOTE]
>
> 此环境变量在`torch_npu_run`的`_create_parallel_handler`中通过`setdefault`写入,通常由`torch_npu_run`的`--enable_tiered_parallel_tcpstore`参数控制,详细说明可参考[torch_npu_run使用指导](../../../developer_notes/distributed/torch_npu_run.md#使用指导)。
该环境变量由TorchNPU提供,PyTorch没有直接对应的环境变量。
## 配置示例
```bash
export ENABLE_TIERED_PARALLEL_TCPSTORE=true
```
## 使用约束
无
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
@@ -1,29 +0,0 @@
# PROXY\_AGENT\_PID\_USE\_LOCAL\_SOCKET\_PATH
## 功能描述
通过此环境变量可将agent进程的PID传递给ParallelStore,用于控制本地socket路径的生成。在`torch_npu_run`的`_create_parallel_handler`中,通过`setdefault`将当前进程PID写入此变量。
- 默认值“-1”:表示未设置,ParallelStore不启用基于agent PID的本地socket路径生成。
- 配置为指定PID:ParallelStore使用该PID生成agent本地socket路径,用于agent与worker之间的本地通信寻址。
该环境变量由TorchNPU提供,PyTorch没有直接对应的环境变量。
## 配置示例
通常无需手动配置,由`torch_npu_run`自动设置。
```bash
export PROXY_AGENT_PID_USE_LOCAL_SOCKET_PATH=12345
```
## 使用约束
无
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
@@ -1,32 +0,0 @@
# TORCH\_NPU\_ELASTIC\_USE\_AGENT\_STORE
## 功能描述
该环境变量用于控制是否复用Agent已启动的ParallelStore。启用后,所有Worker将连接至该ParallelStore,并通过`PrefixStore("/worker/attempt_<n>")`前缀实现重启隔离。
- 配置为字符串`True`(区分大小写):启用agent store模式。
- 配置为其他值:关闭agent store模式。
- 默认值为未配置:关闭agent store模式。
> [!NOTE]
>
> 当启用agent store时,需要同时设置`TORCHELASTIC_RESTART_COUNT`环境变量(由torchrun/elastic启动器注入),否则会抛出`KeyError`。使用`torch_npu_run`启动时,`_create_parallel_handler`中会通过`setdefault`默认写入`TORCH_NPU_ELASTIC_USE_AGENT_STORE=True`,通常无需手动配置此变量。
该变量对应PyTorch的[`TORCHELASTIC_USE_AGENT_STORE`](https://github.com/pytorch/pytorch/blob/main/torch/distributed/rendezvous.py?utm_source=chatgpt.com),配置方式一致。
## 配置示例
```bash
export TORCH_NPU_ELASTIC_USE_AGENT_STORE=True
```
## 使用约束
无
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
@@ -1,32 +0,0 @@
# TORCH\_NPU\_USE\_PARALLEL\_TCPSTORE
## 功能描述
通过此环境变量可控制是否将`env://` rendezvous URL改为`parallel://`,从而启用ParallelStore作为分布式存储后端,提升建链性能。
- 配置为字符串`True`(大小写敏感):启用ParallelStore,将`env://`改写为`parallel://<MASTER_ADDR>:<MASTER_PORT>`。
- 配置为其他值(包括`true`、`TRUE`):关闭ParallelStore。
- 默认值为`False`:关闭ParallelStore。
> [!NOTE]
>
> 此环境变量仅在`torch_npu`分布式初始化时通过`torch_npu.distributed`的`_trigger_rendezvous_decorator`读取。使用`torch_npu_run`启动时,默认会设置此环境变量,通常无需手动配置。启用后,`MASTER_ADDR`缺省值为`127.0.0.1`,`MASTER_PORT`缺省值为`29500`。
该环境变量由TorchNPU提供,PyTorch没有直接对应的环境变量。
## 配置示例
```bash
export TORCH_NPU_USE_PARALLEL_TCPSTORE=True
```
## 使用约束
无
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
@@ -1,8 +0,0 @@
# 分布式启动与建链
配置分布式启动器和ParallelStore;进程组运行时配置见分布式通信分类。
- [TORCH_NPU_USE_PARALLEL_TCPSTORE](TORCH_NPU_USE_PARALLEL_TCPSTORE.md)
- [TORCH_NPU_ELASTIC_USE_AGENT_STORE](TORCH_NPU_ELASTIC_USE_AGENT_STORE.md)
- [ENABLE_TIERED_PARALLEL_TCPSTORE](ENABLE_TIERED_PARALLEL_TCPSTORE.md)
- [PROXY_AGENT_PID_USE_LOCAL_SOCKET_PATH](PROXY_AGENT_PID_USE_LOCAL_SOCKET_PATH.md)
@@ -2,7 +2,7 @@
## 功能描述
通过此环境变量可控制是否开启TorchNPU的特征值检测功能。特征值检测功能具体参见《框架特性》中的“[特征值检测](../../../developer_notes/fault_diagnosis/feature_value_detection.md)”章节。
通过此环境变量可控制是否开启TorchNPU的特征值检测功能。特征值检测功能具体参见《开发指南》中的“[特征值检测](../../../developer_notes/fault_diagnosis/feature_value_detection.md)”章节。
该环境变量支持以下可选参数:
@@ -32,7 +32,15 @@ export NPU_ASD_CONFIG=enable:true,with_checksum:true,cooldown:5,strikes_num:3,st
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="910b" id2 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id2 -->
<!-- npu="A3" id3 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id3 -->
<!-- npu="950" id4 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id4 -->
@@ -25,8 +25,18 @@ export NPU_ASD_ENABLE=2
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Atlas 推理系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="910b" id2 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id2 -->
<!-- npu="A3" id3 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id3 -->
<!-- npu="310p" id4 -->
- <term>Atlas推理系列产品</term>
<!-- end id4 -->
<!-- npu="950" id5 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id5 -->
@@ -34,7 +34,15 @@ export NPU_ASD_SIGMA_THRESH=100000,5000
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Atlas 推理系列产品</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="910b" id2 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id2 -->
<!-- npu="A3" id3 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id3 -->
<!-- npu="310p" id4 -->
- <term>Atlas推理系列产品</term>
<!-- end id4 -->
@@ -34,7 +34,15 @@ export NPU_ASD_UPPER_THRESH=1000000,10000
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Atlas 推理系列产品</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="910b" id2 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id2 -->
<!-- npu="A3" id3 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id3 -->
<!-- npu="310p" id4 -->
- <term>Atlas推理系列产品</term>
<!-- end id4 -->
@@ -14,9 +14,8 @@
| [算子执行与兼容性](op_execution/_menu_op_execution.md) | 控制算子下发、同步执行、数值模式、溢出检测、实现切换及CPU回退行为。 |
| [单算子编译与缓存](op_compilation/_menu_op_compilation.md) | 配置单算子模式的编译缓存;torch.compile配置见图编译分类。 |
| [内存管理](memory_management/_menu_memory_management.md) | 配置缓存分配器、内存复用、OOM快照和对称内存。 |
| [分布式启动与建链](distributed_startup/_menu_distributed_startup.md) | 配置分布式启动器和ParallelStore;进程组运行时配置见分布式通信分类。 |
| [分布式通信与诊断](collective_communication/_menu_collective_communication.md) | 配置HCCL进程组、通信监控、性能采集以及DDP和RPC。 |
| [日志与告警](alarm_message_printing/_menu_alarm_message_printing.md) | 配置PyTorch与TorchNPU通用日志、告警和错误输出;通信及图编译专用诊断配置保留在对应分类。 |
| [分布式通信与诊断](collective_communication/_menu_collective_communication.md) | 配置HCCL进程组、通信同步、超时诊断和状态采集。 |
| [日志与告警](alarm_message_printing/_menu_alarm_message_printing.md) | 配置TorchNPU通用日志、告警和错误输出;通信及图编译专用诊断配置保留在对应分类。 |
| [特征值检测](eigenvalue_detection/_menu_eigenvalue_detection.md) | 配置特征值检测功能及其检测阈值。 |
| [性能优化与采集](performance_tuning/_menu_performance_tuning.md) | 配置CPU绑核、Eager算子融合和Profiler动态采集。 |
| [图编译(torch.compile / Inductor)](inductor/_menu_inductor.md) | 按编译流程查找后端选择、缓存、融合调优以及调试诊断配置。 |
@@ -41,7 +40,7 @@
| 环境变量名称 | 简介 |
| --- | --- |
|[INF_NAN_MODE_ENABLE](op_execution/INF_NAN_MODE_ENABLE.md)|通过此环境变量可控制AI处理器对输入数据为Inf/NaN的处理方式,即控制AI处理器使用饱和模式还是INF_NAN模式。|
|[INF_NAN_MODE_FORCE_DISABLE](op_execution/INF_NAN_MODE_FORCE_DISABLE.md)|<term>Atlas A2 训练系列产品</term>/<term>Atlas A3 训练系列产品</term>,通过此环境变量可强制关闭INF_NAN模式。|
|[INF_NAN_MODE_FORCE_DISABLE](op_execution/INF_NAN_MODE_FORCE_DISABLE.md)|<term>Atlas A2训练系列产品</term>/<term>Atlas A3训练系列产品</term>,通过此环境变量可强制关闭INF_NAN模式。|
|[FORCE_OVERFLOW_CHECK](op_execution/FORCE_OVERFLOW_CHECK.md)|通过此环境变量可在非饱和模式(INF_NAN模式)下开启溢出检测开关,用于Inf/NaN问题的异步定位。|
|[COMBINED_ENABLE](op_execution/COMBINED_ENABLE.md)|通过此环境变量可控制是否启用组合连续化优化,用于优化由多个view操作产生的非连续张量的连续化转换。|
|[ASCEND_LAUNCH_BLOCKING](op_execution/ASCEND_LAUNCH_BLOCKING.md)|通过此环境变量可控制算子执行时是否启用同步模式。|
@@ -59,10 +58,6 @@
| --- | --- |
|[ACL_OP_COMPILER_CACHE_DIR](op_compilation/ACL_OP_COMPILER_CACHE_DIR.md)|通过此环境变量可配置算子编译磁盘缓存的目录。|
|[ACL_OP_COMPILER_CACHE_MODE](op_compilation/ACL_OP_COMPILER_CACHE_MODE.md)|通过此环境变量可配置算子编译磁盘缓存模式。|
|[ACL_OP_INIT_MODE](op_compilation/ACL_OP_INIT_MODE.md)|通过此环境变量可配置算子编译的初始化模式。|
|[ACLNN_EXTENSION_SWITCH](op_compilation/ACLNN_EXTENSION_SWITCH.md)|通过此环境变量可控制op-plugin代码生成过程中是否启用ACLNN扩展代码路径。|
|[ACLNN_EXTENSION_PATH](op_compilation/ACLNN_EXTENSION_PATH.md)|通过此环境变量可指定ACLNN扩展代码的搜索路径,在op-plugin代码生成过程中生效。|
|[PYTORCH_CUSTOM_DERIVATIVES_PATH](op_compilation/PYTORCH_CUSTOM_DERIVATIVES_PATH.md)|通过此环境变量可指定自定义算子自动微分定义文件derivatives.yaml的路径,在op-plugin代码生成过程中生效。|
## 内存管理
@@ -79,20 +74,9 @@
|[TORCH_NPUGRAPH_GC](memory_management/TORCH_NPUGRAPH_GC.md)|通过此环境变量可控制图捕获模式(NPUGraph Capture)过程中是否主动触发Python GC(Garbage Collection)。|
|[NPU_SHMEM_SYMMETRIC_SIZE](memory_management/NPU_SHMEM_SYMMETRIC_SIZE.md)|通过此环境变量可配置NPU对称内存的堆大小,用于设备间直接内存访问。|
## 分布式启动与建链
配置分布式启动器和ParallelStore;进程组运行时配置见分布式通信分类。
| 环境变量名称 | 简介 |
| --- | --- |
|[TORCH_NPU_USE_PARALLEL_TCPSTORE](distributed_startup/TORCH_NPU_USE_PARALLEL_TCPSTORE.md)|通过此环境变量可控制是否启用ParallelStore作为分布式存储后端,提升建链性能。|
|[TORCH_NPU_ELASTIC_USE_AGENT_STORE](distributed_startup/TORCH_NPU_ELASTIC_USE_AGENT_STORE.md)|通过此环境变量可控制是否使用agent已启动的ParallelStore。|
|[ENABLE_TIERED_PARALLEL_TCPSTORE](distributed_startup/ENABLE_TIERED_PARALLEL_TCPSTORE.md)|通过此环境变量可控制ParallelStore是否启用分层建链优化模式。|
|[PROXY_AGENT_PID_USE_LOCAL_SOCKET_PATH](distributed_startup/PROXY_AGENT_PID_USE_LOCAL_SOCKET_PATH.md)|通过此环境变量可将agent PID传递给ParallelStore,用于本地socket路径生成。|
## 分布式通信与诊断
配置HCCL进程组、通信监控、性能采集以及DDP和RPC。
配置HCCL进程组、通信同步、超时诊断和状态采集。
### 通信执行与同步
@@ -103,50 +87,30 @@
|[HCCL_EVENT_TIMEOUT](collective_communication/HCCL_EVENT_TIMEOUT.md)|当使用HCCL作为通信后端时,通过此环境变量可设置等待event完成的超时时间。|
|[P2P_HCCL_BUFFSIZE](collective_communication/P2P_HCCL_BUFFSIZE.md)|通过此环境变量可配置是否开启点对点通信(`torch.distributed.isend`、`torch.distributed.irecv`和`torch.distributed.batch_isend_irecv`),并使用独立通信域功能。|
|[RANK_TABLE_FILE](collective_communication/RANK_TABLE_FILE.md)|通过此环境变量可配置RANK_TABLE_FILE文件的路径,用于集合通信域建链。|
|[(beta) TORCH_HCCL_ZERO_COPY](collective_communication/(beta)TORCH_HCCL_ZERO_COPY.md)|训练或在线推理场景下,可通过此环境变量开启集合通信片内零拷贝功能,减少通信算子在通信过程中片内拷贝次数,提升集合通信效率,降低通信耗时。同时在计算通信并行场景下,降低通信过程中对显存带宽的抢占。|
|[TORCH_HCCL_HIGH_PRIORITY](collective_communication/TORCH_HCCL_HIGH_PRIORITY.md)|当使用HCCL作为通信后端时,通过此环境变量可控制是否强制使用高优先级NPU stream。|
|[ROOTINFO_SCALABLE_ENABLE](collective_communication/ROOTINFO_SCALABLE_ENABLE.md)|通过此环境变量可控制是否开启Scalable RootInfo分级建链。|
|[TORCH_HCCL_RANKS_PER_ROOT](collective_communication/TORCH_HCCL_RANKS_PER_ROOT.md)|开启Scalable RootInfo后,通过此环境变量可配置每个root期望管理的rank数量。|
|[(beta)TORCH_HCCL_ZERO_COPY](collective_communication/(beta)TORCH_HCCL_ZERO_COPY.md)|训练或在线推理场景下,可通过此环境变量开启集合通信片内零拷贝功能,减少通信算子在通信过程中片内拷贝次数,提升集合通信效率,降低通信耗时。同时在计算通信并行场景下,降低通信过程中对显存带宽的抢占。|
### 超时监控与故障记录
| 环境变量名称 | 简介 |
| --- | --- |
|[TORCH_HCCL_DESYNC_DEBUG](collective_communication/TORCH_HCCL_DESYNC_DEBUG.md)|当使用HCCL作为通信后端时,通过此环境变量可控制是否进行通信超时分析。|
|[TORCH_HCCL_ENABLE_MONITORING](collective_communication/TORCH_HCCL_ENABLE_MONITORING.md)|当使用HCCL作为通信后端时,通过此环境变量可控制是否启动heartbeat monitor线程。|
|[TORCH_HCCL_HEARTBEAT_TIMEOUT_SEC](collective_communication/TORCH_HCCL_HEARTBEAT_TIMEOUT_SEC.md)|当使用HCCL作为通信后端时,通过此环境变量可设置heartbeat monitor判定WatchDog卡死的超时时间。|
|[TORCH_HCCL_COORD_CHECK_MILSEC](collective_communication/TORCH_HCCL_COORD_CHECK_MILSEC.md)|当使用HCCL作为通信后端时,通过此环境变量可设置WatchDog轮询检查Store dump signal的间隔时间。|
|[TORCH_HCCL_TRACE_BUFFER_SIZE](collective_communication/TORCH_HCCL_TRACE_BUFFER_SIZE.md)|当使用HCCL作为通信后端时,通过此环境变量可配置Flight Recorder环形缓冲区最大事件数,默认关闭。|
|[TORCH_HCCL_TRACE_CPP_STACK](collective_communication/TORCH_HCCL_TRACE_CPP_STACK.md)|当使用HCCL作为通信后端时,通过此环境变量可控制在记录事件时是否采集C++调用栈。|
|[TORCH_HCCL_DUMP_ON_TIMEOUT](collective_communication/TORCH_HCCL_DUMP_ON_TIMEOUT.md)|当使用HCCL作为通信后端时,通过此环境变量可控制超时或错误时是否自动触发Flight Recorder dump。|
|[TORCH_HCCL_WAIT_TIMEOUT_DUMP_MILSEC](collective_communication/TORCH_HCCL_WAIT_TIMEOUT_DUMP_MILSEC.md)|当使用HCCL作为通信后端时,通过此环境变量可设置monitor等待异步dump完成的最大时间。|
|[TORCH_HCCL_DEBUG_INFO_PIPE_FILE](collective_communication/TORCH_HCCL_DEBUG_INFO_PIPE_FILE.md)|当使用HCCL作为通信后端时,通过此环境变量可配置命名管道文件,用于外部触发Flight Recorder dump。|
|[TORCH_HCCL_DEBUG_INFO_TEMP_FILE](collective_communication/TORCH_HCCL_DEBUG_INFO_TEMP_FILE.md)|通过此环境变量可配置HCCL dump文件的名称前缀。|
### 状态与性能采集
### 状态采集
| 环境变量名称 | 简介 |
| --- | --- |
|[TORCH_HCCL_STATUS_SAVE_ENABLE](collective_communication/TORCH_HCCL_STATUS_SAVE_ENABLE.md)|通过此环境变量可控制HCCL进程组状态信息的周期性保存。|
|[TORCH_HCCL_STATUS_SAVE_PATH](collective_communication/TORCH_HCCL_STATUS_SAVE_PATH.md)|通过此环境变量可配置HCCL状态文件的保存目录。|
|[TORCH_HCCL_STATUS_SAVE_INTERVAL](collective_communication/TORCH_HCCL_STATUS_SAVE_INTERVAL.md)|通过此环境变量可配置HCCL状态保存的间隔时间。|
|[NSLB_CP](collective_communication/NSLB_CP.md)|通过此环境变量可配置HCCL NSLB采样记录的目录路径。|
|[NSLB_MAX_RECORD_NUM](collective_communication/NSLB_MAX_RECORD_NUM.md)|通过此环境变量可配置每个PG的最大NSLB采样记录数量。|
|[PERF_DUMP_CONFIG](collective_communication/PERF_DUMP_CONFIG.md)|通过此环境变量可配置HCCL操作的性能数据记录功能。|
|[PERF_DUMP_PATH](collective_communication/PERF_DUMP_PATH.md)|通过此环境变量可配置HCCL性能dump文件的输出目录。|
### DDP与RPC
| 环境变量名称 | 简介 |
| --- | --- |
|[DDP_SET_LAST_BUCKET_CAP](collective_communication/DDP_SET_LAST_BUCKET_CAP.md)|通过此环境变量可控制DDP的bucket重建顺序。|
|[TP_SOCKET_IFNAME](collective_communication/TP_SOCKET_IFNAME.md)|通过此环境变量可指定TensorPipe RPC传输层使用的网络接口名称。|
## 日志与告警
配置PyTorch与TorchNPU通用日志、告警和错误输出;通信及图编译专用诊断配置保留在对应分类。
配置TorchNPU通用日志、告警和错误输出;通信及图编译专用诊断配置保留在对应分类。
| 环境变量名称 | 简介 |
| --- | --- |
|[TORCH_LOGS](alarm_message_printing/TORCH_LOGS.md)|通过此环境变量可控制PyTorch各模块的日志输出级别,与PyTorch上游行为一致。|
|[TORCH_NPU_WARNING_DISABLE](alarm_message_printing/TORCH_NPU_WARNING_DISABLE.md)|通过此环境变量可配置是否打印TorchNPU的告警信息。|
|[TORCH_NPU_DISABLED_WARNING](alarm_message_printing/TORCH_NPU_DISABLED_WARNING.md)|该环境变量已废弃,建议使用TORCH_NPU_WARNING_DISABLE替代。用于配置是否打印TorchNPU的告警信息。|
|[TORCH_NPU_COMPACT_ERROR_OUTPUT](alarm_message_printing/TORCH_NPU_COMPACT_ERROR_OUTPUT.md)|通过此环境变量可精简打印错误信息,开启后会将CANN内部调用栈、TorchNPU错误码等自定义报错信息转移到plog中,仅保留有效的错误说明,提高异常信息的可读性。|
@@ -197,7 +161,6 @@
| 环境变量名称 | 简介 |
| --- | --- |
|[TORCH_CACHING_PRECOMPILE](inductor/TORCH_CACHING_PRECOMPILE.md)|通过此环境变量可开启自动缓存预编译实验性功能,自动保存和加载Dynamo编译缓存,加速后续编译过程,与PyTorch上游行为一致。|
|[TORCHINDUCTOR_CACHE_DIR](inductor/TORCHINDUCTOR_CACHE_DIR.md)|通过此环境变量可配置Inductor编译缓存的目录路径,与PyTorch上游行为一致。|
|[TORCHINDUCTOR_COMPILE_THREADS](inductor/TORCHINDUCTOR_COMPILE_THREADS.md)|通过此环境变量可配置并发编译的进程数量,与PyTorch上游行为一致。|
|[TORCHNPU_PRECOMPILE_THREADS](inductor/TORCHNPU_PRECOMPILE_THREADS.md)|通过此环境变量可配置torch_npu Inductor的预编译线程数。|
@@ -205,15 +168,12 @@
| 环境变量名称 | 简介 |
| --- | --- |
|[INDUCTOR_DVM_ENABLE_MATMUL_FUSION](inductor/INDUCTOR_DVM_ENABLE_MATMUL_FUSION.md)|通过此环境变量可开启DVM MatMul template融合,将矩阵乘算子融合为DVM template kernel。|
|[TORCHINDUCTOR_MAX_AUTOTUNE](inductor/TORCHINDUCTOR_MAX_AUTOTUNE.md)|通过此环境变量可控制是否开启max autotune功能,与PyTorch上游行为一致。|
|[TORCHINDUCTOR_MAX_AUTOTUNE_GEMM_BACKENDS](inductor/TORCHINDUCTOR_MAX_AUTOTUNE_GEMM_BACKENDS.md)|通过此环境变量可配置max autotune过程中矩阵乘算子参与调优的候选实现列表。|
|[TORCHINDUCTOR_NPU_CATLASS_DIR](inductor/TORCHINDUCTOR_NPU_CATLASS_DIR.md)|通过此环境变量可配置Catlass模板库的路径,与PyTorch上游的`TORCHINDUCTOR_CUTLASS_DIR`对应。|
|[TORCHINDUCTOR_CATLASS_ENABLED_OPS](inductor/TORCHINDUCTOR_CATLASS_ENABLED_OPS.md)|通过此环境变量可配置Catlass模板库支持的矩阵乘类型算子列表,与PyTorch上游的`TORCHINDUCTOR_CUTLASS_ENABLED_OPS`对应。|
|[CATLASS_EPILOGUE_FUSION](inductor/CATLASS_EPILOGUE_FUSION.md)|通过此环境变量可控制是否开启Catlass epilogue融合功能,与PyTorch上游的`CUTLASS_EPILOGUE_FUSION`对应。|
|[TORCHINDUCTOR_PROFILE_WITH_DO_BENCH_USING_PROFILING](inductor/TORCHINDUCTOR_PROFILE_WITH_DO_BENCH_USING_PROFILING.md)|通过此环境变量可控制autotune过程中是否使用profiling进行性能测量,与PyTorch上游行为一致。|
|[TORCHINDUCTOR_ENABLE_WELFORD](inductor/TORCHINDUCTOR_ENABLE_WELFORD.md)|通过此环境变量可控制是否启用Welford算法计算方差与均值类归约。|
|[TORCHINDUCTOR_ENABLE_FAST_GELU](inductor/TORCHINDUCTOR_ENABLE_FAST_GELU.md)|通过此环境变量可控制GELU激活函数是否使用tanh近似decomposition。|
|[INDUCTOR_ASCEND_AGGRESSIVE_AUTOTUNE](inductor/INDUCTOR_ASCEND_AGGRESSIVE_AUTOTUNE.md)|通过此环境变量可控制autotune过程中是否启用batch profiler进行批量性能测量。|
|[INDUCTOR_ASCEND_SYMBOLIC_GROUP_AUTOTUNE](inductor/INDUCTOR_ASCEND_SYMBOLIC_GROUP_AUTOTUNE.md)|通过此环境变量可控制是否启用动态shape分组autotune,按shape特征分组复用调优结果。|
|[INDUCTOR_ASCEND_SYMBOLIC_GROUP_TEMPLATES](inductor/INDUCTOR_ASCEND_SYMBOLIC_GROUP_TEMPLATES.md)|通过此环境变量可配置参与动态shape分组autotune的模板类型列表。|
@@ -231,8 +191,5 @@
| 环境变量名称 | 简介 |
| --- | --- |
|[TORCH_COMPILE_DEBUG](inductor/TORCH_COMPILE_DEBUG.md)|通过此环境变量可开启torch.compile的调试模式,导出FX图、codegen输出等调试信息。|
|[(beta)INDUCTOR_ASCEND_CHECK_ACCURACY](inductor/INDUCTOR_ASCEND_CHECK_ACCURACY.md)|INDUCTOR_ASCEND_CHECK_ACCURACY是TorchNPU提供的精度校验工具,在torch.compile图编译模式(Inductor)的Triton模式与DVM模式下自动检测融合算子的数值精度。|
|[INDUCTOR_ASCEND_LOG_LEVEL](inductor/INDUCTOR_ASCEND_LOG_LEVEL.md)|通过此环境变量可配置Inductor模块的日志级别。|
|[TORCHINDUCTOR_WORKER_LOGPATH](inductor/TORCHINDUCTOR_WORKER_LOGPATH.md)|通过此环境变量可指定Inductor worker子进程的日志路径,与PyTorch上游行为一致。|
|[TORCHINDUCTOR_WORKER_SUPPRESS_LOGGING](inductor/TORCHINDUCTOR_WORKER_SUPPRESS_LOGGING.md)|通过此环境变量可控制是否输出Inductor worker子进程的日志,与PyTorch上游行为一致。|
@@ -28,4 +28,6 @@ export CATLASS_EPILOGUE_FUSION=1
## 支持的型号
<term>Ascend 950DT</term>
<!-- npu="950" id1 -->
<term>Ascend 950DT系列产品</term>
<!-- end id1 -->
@@ -27,5 +27,9 @@ export ENABLE_PARALLEL_SCHEDULER=true
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="950" id2 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id2 -->
@@ -19,4 +19,6 @@ export INDUCTOR_ASCEND_AGGRESSIVE_AUTOTUNE=1
## 支持的型号
<term>Ascend 950DT</term>
<!-- npu="950" id1 -->
<term>Ascend 950DT系列产品</term>
<!-- end id1 -->
@@ -63,7 +63,15 @@ CHECK ACCURACY FAILED! Kernel: <kernel_name>, Output idx: <idx>, Mismatched: <m>
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="910b" id2 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id2 -->
<!-- npu="A3" id3 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id3 -->
<!-- npu="950" id4 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id4 -->
@@ -26,4 +26,6 @@ export INDUCTOR_ASCEND_COSTMODEL_RATIO=0.25
## 支持的型号
<term>Ascend 950DT</term>
<!-- npu="950" id1 -->
<term>Ascend 950DT系列产品</term>
<!-- end id1 -->
@@ -6,7 +6,7 @@
开启后,Inductor-Ascend会在Triton后端precompile之前,为每个候选config生成TTIR,并调用Triton-Ascend的CostModel后端预测耗时。预测结果用于重排并筛选候选config,减少后续编译和实测profiling的数量。
- 配置为“0”、“false”、“no”或“未配置”时: 关闭CostModel预筛选(默认值)。
- 配置为“0”、“false”、“no”或未配置时: 关闭CostModel预筛选(默认值)。
- 配置为“1”、“true”或“yes”时: 开启CostModel预筛选。
> [!NOTE]
@@ -27,4 +27,6 @@ export INDUCTOR_ASCEND_ENABLE_COSTMODEL=1
## 支持的型号
<term>Ascend 950DT</term>
<!-- npu="950" id1 -->
<term>Ascend 950DT系列产品</term>
<!-- end id1 -->
@@ -28,5 +28,9 @@ export INDUCTOR_ASCEND_LOG_LEVEL=DEBUG
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="950" id2 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id2 -->
@@ -23,4 +23,6 @@ export INDUCTOR_ASCEND_SYMBOLIC_GROUP_AUTOTUNE=1
## 支持的型号
<!-- npu="950" id1 -->
<term>Ascend 950PR&950DT系列产品</term>
<!-- end id1 -->
@@ -6,10 +6,10 @@
设置`INDUCTOR_ASCEND_SYMBOLIC_GROUP_AUTOTUNE=1`启用分组autotune后,仅列表中的模板kernel会走分组autotune流程,其余模板kernel仍走普通autotune流程,用于灰度控制参与分组调优的kernel范围。
- 未配置时:使用默认值“pointwise,reduction,persistent_reduction”,即三类模板kernel均参与分组autotune,相当于不限制范围。
- 配置为“pointwise”:逐元素类模板kernel参与分组autotune。
- 配置为“reduction”:归约类模板kernel参与分组autotune。
- 配置为“persistent_reduction”:persistent归约类模板kernel参与分组autotune。
- 未配置时:使用默认值`pointwise,reduction,persistent_reduction`,即三类模板kernel均参与分组autotune,相当于不限制范围。
- 配置为`pointwise`:逐元素类模板kernel参与分组autotune。
- 配置为`reduction`:归约类模板kernel参与分组autotune。
- 配置为`persistent_reduction`:persistent归约类模板kernel参与分组autotune。
## 配置示例
@@ -28,4 +28,6 @@ export INDUCTOR_ASCEND_SYMBOLIC_GROUP_TEMPLATES=pointwise
## 支持的型号
<!-- npu="950" id1 -->
<term>Ascend 950PR&950DT系列产品</term>
<!-- end id1 -->
@@ -1,32 +0,0 @@
# INDUCTOR\_DVM\_ENABLE\_MATMUL\_FUSION
## 功能描述
通过此环境变量可开启DVM MatMul template融合功能。开启后,Inductor在DVM模式(`TORCHINDUCTOR_NPU_BACKEND="dvm"`)下会将矩阵乘算子(`mm`、`bmm`、`addmm`、`baddbmm`)通过DVM template进行融合,生成高效的融合kernel,提升矩阵乘性能。
- 默认值为“0”:关闭DVM MatMul template融合。
- 配置为“1”:开启DVM MatMul template融合。
> [!NOTE]
>
> - 该环境变量需在导入`torch_npu`之前设置。
> - 开启后会注册DVM mm template lowering,将矩阵乘算子融合为DVM template kernel。
该环境变量由TorchNPU提供,PyTorch没有直接对应的环境变量。
## 配置示例
开启DVM MatMul template融合:
```bash
export INDUCTOR_DVM_ENABLE_MATMUL_FUSION=1
```
## 使用约束
仅在DVM模式(`TORCHINDUCTOR_NPU_BACKEND="dvm"`)下生效。
## 支持的型号
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
@@ -35,5 +35,9 @@ export SHUT_DOWN_FX_PASS_LIST="all"
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="950" id2 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id2 -->
@@ -1,34 +0,0 @@
# TORCHINDUCTOR\_CACHE\_DIR
## 功能描述
通过此环境变量可配置Inductor编译缓存的目录路径。设置后,Inductor会将编译生成的kernel缓存到指定目录,便于后续复用,加速后续编译过程。
- 默认值未配置:使用默认缓存目录(通常为系统临时目录下的`torchinductor_<username>`)。
- 配置为目录路径:将编译产物缓存到指定目录。
> [!NOTE]
>
> - 该环境变量需在导入`torch_npu`之前设置。
> - 需确保目标目录可写且有足够的磁盘空间。
> - 此环境变量在全部模式(`TORCHINDUCTOR_NPU_BACKEND="default"`/`"dvm"`/`"ascendc"`等)下均生效。
> - 设置独立的缓存目录便于多用户共享缓存或持久化缓存。
该变量对应PyTorch的[TORCHINDUCTOR_CACHE_DIR](https://docs.pytorch.org/tutorials/recipes/torch_compile_caching_configuration_tutorial.html),配置方式一致。
## 配置示例
```bash
export TORCHINDUCTOR_CACHE_DIR=/tmp/torchinductor_cache
```
## 使用约束
无
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
@@ -46,4 +46,6 @@ export TORCHINDUCTOR_CATLASS_ENABLED_OPS="ALL"
## 支持的型号
<term>Ascend 950DT</term>
<!-- npu="950" id1 -->
<term>Ascend 950DT系列产品</term>
<!-- end id1 -->
@@ -30,5 +30,9 @@ export TORCHINDUCTOR_COMPILE_THREADS=16
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="950" id2 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id2 -->
@@ -1,32 +0,0 @@
# TORCHINDUCTOR\_ENABLE\_FAST\_GELU
## 功能描述
通过此环境变量可控制GELU激活函数的decomposition实现。启用后,`aten.gelu`在图模式下降解为tanh近似公式(`0.5*x*(1+tanh(√(2/π)*(x+0.044715*x³)))`的sigmoid等价形式),用乘加与sigmoid替代`erf`算子,提升kernel执行性能。
- 默认值为“0”:使用默认decomposition(含`erf`)。
- 配置为“1”:GELU降解为tanh近似(fast gelu)实现。
> [!NOTE]
>
> - 该环境变量需在导入`torch_npu`之前设置。
> - tanh近似与`erf`精确实现存在数值差异,对精度敏感的训练任务建议先验证。
该环境变量由TorchNPU提供,PyTorch没有直接对应的环境变量。
## 配置示例
```bash
export TORCHINDUCTOR_ENABLE_FAST_GELU=1
```
## 使用约束
无
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
@@ -1,30 +0,0 @@
# TORCHINDUCTOR\_ENABLE\_WELFORD
## 功能描述
通过此环境变量可控制是否启用Welford算法计算方差与均值类归约。启用后,`torch.var_mean`、`torch.var`、`torch.std`等算子在Triton模式(`TORCHINDUCTOR_NPU_BACKEND="default"`)下使用Welford单遍算法lowering(SIMT Welford),将归约epilogue融合进Welford kernel,减少中间结果写回设备内存,提升数值稳定性与性能。
- 默认值为“0”:使用默认的两步方差(two-step variance)或逐项展开路径。
- 配置为“1”:启用Welford lowering。
> [!NOTE]
>
> - 该环境变量需在导入`torch_npu`之前设置。
> - 归约元素较少(小于`unroll_reductions_threshold`)时仍会走两步方差展开路径,不受此变量影响。
该环境变量由TorchNPU提供,PyTorch没有直接对应的环境变量。PyTorch的Inductor默认展开方差计算。
## 配置示例
```bash
export TORCHINDUCTOR_ENABLE_WELFORD=1
```
## 使用约束
仅在Triton模式(`TORCHINDUCTOR_NPU_BACKEND="default"`)下生效。
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Ascend 950DT</term>
@@ -29,5 +29,9 @@ export TORCHINDUCTOR_MAX_AUTOTUNE=1
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="950" id2 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id2 -->
@@ -45,4 +45,6 @@ export TORCHINDUCTOR_MAX_AUTOTUNE_GEMM_BACKENDS="TRITON"
## 支持的型号
<term>Ascend 950DT</term>
<!-- npu="950" id1 -->
<term>Ascend 950DT系列产品</term>
<!-- end id1 -->
@@ -41,7 +41,15 @@ export TORCHINDUCTOR_NPU_BACKEND="ascendc"
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="910b" id2 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id2 -->
<!-- npu="A3" id3 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id3 -->
<!-- npu="950" id4 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id4 -->
@@ -28,4 +28,6 @@ export TORCHINDUCTOR_NPU_CATLASS_DIR="/path/to/catlass/dir"
## 支持的型号
<term>Ascend 950DT</term>
<!-- npu="950" id1 -->
<term>Ascend 950DT系列产品</term>
<!-- end id1 -->
@@ -29,4 +29,6 @@ export TORCHINDUCTOR_PROFILE_WITH_DO_BENCH_USING_PROFILING=1
## 支持的型号
<term>Ascend 950DT</term>
<!-- npu="950" id1 -->
<term>Ascend 950DT系列产品</term>
<!-- end id1 -->
@@ -1,34 +0,0 @@
# TORCHINDUCTOR\_WORKER\_LOGPATH
## 功能描述
通过此环境变量可指定Inductor worker子进程的日志输出路径。Inductor在编译kernel时会使用子进程进行并行编译,此环境变量控制子进程日志文件的保存位置。
- 默认值未配置:不指定日志文件路径,worker子进程日志输出行为由`TORCHINDUCTOR_WORKER_SUPPRESS_LOGGING`决定。
- 配置为路径:worker子进程日志保存到指定位置。
> [!NOTE]
>
> - 该环境变量需在导入`torch_npu`之前设置。
> - 未配置日志路径时,若开启worker子进程日志输出(`TORCHINDUCTOR_WORKER_SUPPRESS_LOGGING=0`),子进程日志将继承主进程的标准输出与标准错误,直接打印到启动Python进程的终端。
> - 此环境变量在`config.debug`开启时,会被重定向到终端输出(便于实时观察编译日志)。
> - 需确保目标路径可写。
该变量对应PyTorch的[TORCHINDUCTOR_WORKER_LOGPATH](https://github.com/pytorch/pytorch/blob/main/torch/_inductor/config.py),配置方式一致。
## 配置示例
```bash
export TORCHINDUCTOR_WORKER_LOGPATH=/tmp/inductor_worker_logs
```
## 使用约束
无
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
@@ -1,36 +0,0 @@
# TORCHINDUCTOR\_WORKER\_SUPPRESS\_LOGGING
## 功能描述
通过此环境变量可控制是否输出Inductor worker子进程的日志。Inductor在编译kernel时会使用子进程进行并行编译,当日志输出关闭时,子进程日志将被重定向到/dev/null(即丢弃,不在终端显示)。
- 默认值为`True`:关闭worker子进程的日志输出,日志被重定向到/dev/null。
- 配置为“0”或空字符串:开启worker子进程的日志输出,日志正常打印。
- 配置为“1”或其他非“0”值:关闭worker子进程的日志输出。
> [!NOTE]
>
> - 该环境变量需在导入`torch_npu`之前设置。
> - 在`config.debug`开启时,若未显式设置此变量,将强制开启日志输出,便于调试。
> - 关闭worker子进程的日志输出可减少终端打印内容,但会丢失autotune过程中的调试信息。
该变量对应PyTorch的[TORCHINDUCTOR_WORKER_SUPPRESS_LOGGING](https://github.com/pytorch/pytorch/blob/main/torch/_inductor/config.py),配置方式一致。
## 配置示例
开启worker子进程的日志输出(调试时查看子进程输出):
```bash
export TORCHINDUCTOR_WORKER_SUPPRESS_LOGGING=0
```
## 使用约束
无
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
@@ -25,5 +25,9 @@ export TORCHNPU_PRECOMPILE_THREADS=16
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="950" id2 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id2 -->
@@ -37,7 +37,15 @@ export TORCH_CACHING_PRECOMPILE=1
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="910b" id2 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id2 -->
<!-- npu="A3" id3 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id3 -->
<!-- npu="950" id4 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id4 -->
@@ -1,33 +0,0 @@
# TORCH\_COMPILE\_DEBUG
## 功能描述
通过此环境变量可开启`torch.compile`的调试模式。开启后,系统会在编译过程中导出FX图、codegen输出等调试信息,便于开发者分析编译流程和定位问题。
- 默认值为“0”:不开启调试模式。
- 配置为“1”:开启调试模式,导出Dynamo输出图、codegen生成的kernel代码等。
> [!NOTE]
>
> - 该环境变量需在进程启动前配置,进程运行过程中修改不会生效。
> - 开启调试模式后,编译产物(FX图、output_code.py等)会保存到`torch_compile_debug/`目录下。
> - 调试模式会产生额外的I/O开销,建议仅在问题定位时使用。
该变量对应PyTorch的[TORCH_COMPILE_DEBUG](https://docs.pytorch.org/docs/stable/torch.compiler_troubleshooting_old.html),配置方式一致。
## 配置示例
```bash
export TORCH_COMPILE_DEBUG=1
```
## 使用约束
无
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
@@ -9,21 +9,17 @@
## 缓存与编译并发
- [TORCH_CACHING_PRECOMPILE](TORCH_CACHING_PRECOMPILE.md)
- [TORCHINDUCTOR_CACHE_DIR](TORCHINDUCTOR_CACHE_DIR.md)
- [TORCHINDUCTOR_COMPILE_THREADS](TORCHINDUCTOR_COMPILE_THREADS.md)
- [TORCHNPU_PRECOMPILE_THREADS](TORCHNPU_PRECOMPILE_THREADS.md)
## 算子融合与自动调优
- [INDUCTOR_DVM_ENABLE_MATMUL_FUSION](INDUCTOR_DVM_ENABLE_MATMUL_FUSION.md)
- [TORCHINDUCTOR_MAX_AUTOTUNE](TORCHINDUCTOR_MAX_AUTOTUNE.md)
- [TORCHINDUCTOR_MAX_AUTOTUNE_GEMM_BACKENDS](TORCHINDUCTOR_MAX_AUTOTUNE_GEMM_BACKENDS.md)
- [TORCHINDUCTOR_NPU_CATLASS_DIR](TORCHINDUCTOR_NPU_CATLASS_DIR.md)
- [TORCHINDUCTOR_CATLASS_ENABLED_OPS](TORCHINDUCTOR_CATLASS_ENABLED_OPS.md)
- [CATLASS_EPILOGUE_FUSION](CATLASS_EPILOGUE_FUSION.md)
- [TORCHINDUCTOR_PROFILE_WITH_DO_BENCH_USING_PROFILING](TORCHINDUCTOR_PROFILE_WITH_DO_BENCH_USING_PROFILING.md)
- [TORCHINDUCTOR_ENABLE_WELFORD](TORCHINDUCTOR_ENABLE_WELFORD.md)
- [TORCHINDUCTOR_ENABLE_FAST_GELU](TORCHINDUCTOR_ENABLE_FAST_GELU.md)
- [INDUCTOR_ASCEND_AGGRESSIVE_AUTOTUNE](INDUCTOR_ASCEND_AGGRESSIVE_AUTOTUNE.md)
- [INDUCTOR_ASCEND_SYMBOLIC_GROUP_AUTOTUNE](INDUCTOR_ASCEND_SYMBOLIC_GROUP_AUTOTUNE.md)
- [INDUCTOR_ASCEND_SYMBOLIC_GROUP_TEMPLATES](INDUCTOR_ASCEND_SYMBOLIC_GROUP_TEMPLATES.md)
@@ -37,10 +33,5 @@
## 调试、日志与精度检查
`TORCH_LOGS`可用于图编译日志调试,统一收录在[日志与告警](../alarm_message_printing/_menu_alarm_message_printing.md)分类。
- [TORCH_COMPILE_DEBUG](TORCH_COMPILE_DEBUG.md)
- [(beta)INDUCTOR_ASCEND_CHECK_ACCURACY](INDUCTOR_ASCEND_CHECK_ACCURACY.md)
- [INDUCTOR_ASCEND_LOG_LEVEL](INDUCTOR_ASCEND_LOG_LEVEL.md)
- [TORCHINDUCTOR_WORKER_LOGPATH](TORCHINDUCTOR_WORKER_LOGPATH.md)
- [TORCHINDUCTOR_WORKER_SUPPRESS_LOGGING](TORCHINDUCTOR_WORKER_SUPPRESS_LOGGING.md)
@@ -23,8 +23,18 @@ export MULTI_STREAM_MEMORY_REUSE=0
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Atlas 800I A2 推理产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="910b" id2 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id2 -->
<!-- npu="A3" id3 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id3 -->
<!-- npu="910b" id5 -->
- <term>Atlas 800I A2推理服务器</term>
<!-- end id5 -->
<!-- npu="950" id4 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id4 -->
@@ -33,7 +33,15 @@ export NPU_SHMEM_SYMMETRIC_SIZE=512M
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="910b" id2 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id2 -->
<!-- npu="A3" id3 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id3 -->
<!-- npu="950" id4 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id4 -->
@@ -8,7 +8,7 @@
- 配置为“1”,当发生内存不足报错时,将保存当前和历史内存使用信息,包含申请和释放的内存信息。
- 配置为“0”,关闭此功能,不保存内存数据。
此环境变量默认为0。
此环境变量默认为“0”。
## 配置示例
@@ -22,9 +22,21 @@ export OOM_SNAPSHOT_ENABLE=1
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Atlas 800I A2 推理产品</term>
- <term>Atlas 推理系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="910b" id2 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id2 -->
<!-- npu="A3" id3 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id3 -->
<!-- npu="910b" id6 -->
- <term>Atlas 800I A2推理服务器</term>
<!-- end id6 -->
<!-- npu="310p" id4 -->
- <term>Atlas推理系列产品</term>
<!-- end id4 -->
<!-- npu="950" id5 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id5 -->
@@ -21,9 +21,21 @@ export OOM_SNAPSHOT_PATH="/home/usr/"
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Atlas 800I A2 推理产品</term>
- <term>Atlas 推理系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="910b" id2 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id2 -->
<!-- npu="A3" id3 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id3 -->
<!-- npu="910b" id6 -->
- <term>Atlas 800I A2推理服务器</term>
<!-- end id6 -->
<!-- npu="310p" id4 -->
- <term>Atlas推理系列产品</term>
<!-- end id4 -->
<!-- npu="950" id5 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id5 -->
@@ -23,7 +23,15 @@ export PYTORCH_ALLOC_CONF=max_split_size_mb:512
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Atlas 推理系列产品</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="910b" id2 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id2 -->
<!-- npu="A3" id3 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id3 -->
<!-- npu="310p" id4 -->
- <term>Atlas推理系列产品</term>
<!-- end id4 -->
@@ -38,8 +38,18 @@ export PYTORCH_NO_NPU_MEMORY_CACHING=0
## 支持的型号
- <term>Atlas 训练系列产品</term>
- <term>Atlas A2 训练系列产品</term>
- <term>Atlas A3 训练系列产品</term>
- <term>Atlas 推理系列产品</term>
- <term>Ascend 950DT</term>
<!-- npu="910" id1 -->
- <term>Atlas训练系列产品</term>
<!-- end id1 -->
<!-- npu="910b" id2 -->
- <term>Atlas A2训练系列产品</term>
<!-- end id2 -->
<!-- npu="A3" id3 -->
- <term>Atlas A3训练系列产品</term>
<!-- end id3 -->
<!-- npu="310p" id4 -->
- <term>Atlas推理系列产品</term>
<!-- end id4 -->
<!-- npu="950" id5 -->
- <term>Ascend 950DT系列产品</term>
<!-- end id5 -->

Some files were not shown because too many files have changed in this diff Show More