已合并
[feat]: A5 only supports INF_NAN mode #35335
wanglijun55创建于 5月11日
[feat]: A5 only supports INF_NAN mode #35335
已合并
Pull Request已成功合入, 合并人@ascend-robot
(感谢 wanglijun55 的贡献)5月11日 创建了 pull request,commit 0d47d01d
ascend-robot
5月11日 评论:
5月11日 评论:
Thanks for your pull-request.
The full list of commands accepted by me can be found at here。
You can get sig-info at here
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-Ascend/pytorch | ✅ htchu, liangsongwei (2/2) | ✅ htchu (1/1) |
| test | ✅ liangsongwei, htchu (2/2) | ✅ htchu (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
wanglijun55, thanks for your pull request. All authors of the commits have signed the CLA. 👍


5月11日 添加了label:ascend-cla/yes
ascend-robot
5月11日 评论:
5月11日 评论:
当前仓库存在以下 保护分支 :
| Protected Branch | Version | Release |
|---|---|---|
| master | ||
| v2.11.0 | ||
| v2.10.0 | ||
| v2.7.1 | ||
| v2.9.0 | ||
| v2.12.0 |
评论 /sync <branch1> <branch2> ... 可将当前 PR 修改同步到其它分支(创建同步 PR):
a) 如果当前 PR 是 Open 状态,同步操作将延迟到 PR 被合并时执行
b) 如果当前 PR 已经 Merged,将立即执行同步操作
注意:
- /sync 命令可以指定同步到多个分支,仅最后一个 /sync 命令生效
- 如果创建的同步 PR 不正确,可通过向同步 PR 的源分支提交轻量级 PR 完善,或使用 /close 命令关闭


ascend-robot
5月11日 评论:
5月11日 评论:
Ascend docs pipeline is running...


此处折叠了42条消息 查看更多
5月14日 added a commit that referenced this pull request
- 79b6fd77 - [sync] PR-35335: [feat]: A5 only supports INF_NAN mode
Co-authored-by: weixin_47897441
Co-authored-by: wanglijun55
# message auto-generated for no-merge-commit merge:
!35528 merge sync-pr35335-v2.7.1-infnan-to-v2.9.0 into v2.9.0
[sync] PR-35335: [feat]: A5 only supports INF_NAN mode
Created-by: ascend-ds-bot
Commit-by: weixin_47897441;wanglijun55
Merged-by: ascend-robot
Description:
### 1. Origin pull request:
https://gitcode.com/Ascend/pytorch/merge_requests/35335
### 2. Original pull request related issue(s):
https://gitcode.com/Ascend/pytorch/issues/1918
### 3. Original pull request related commit(s):
| Sha | Datetime | Message |
|---|---|---|
|[92382e10](https://gitcode.com/Ascend/pytorch/commit/92382e10973ba5780721b079332366383ec841ff)|2026-05-12 21:49:33 +0800 CST|modify ut
| |[1352140c](https://gitcode.com/Ascend/pytorch/commit/1352140cad591b7fc472db91eb726d1b553bd65e)|2026-05-11 20:54:16 +0800 CST|fix(npu): Ascend950 only supports INF_NAN mode, bypass env var checks
Ascend950 does not support saturation mode. When users set
INF_NAN_MODE_ENABLE=0 or INF_NAN_MODE_FORCE_DISABLE=1 on Ascend950,
the code incorrectly falls into saturation mode path, causing
RuntimeError: SET StreamOverflowSwitch Failed.
Add early return in IsSupportInfNan() for Ascend950 to always return
true, making both env vars ineffective on this device.
Co-Authored-By: Claude Opus 4.7
| See merge request: Ascend/pytorch!35528- [#35335](https://gitcode.com/Ascend/pytorch/merge_requests/35335)
5月14日 added a commit that referenced this pull request
- 79b6fd77 - [sync] PR-35335: [feat]: A5 only supports INF_NAN mode
Co-authored-by: weixin_47897441
Co-authored-by: wanglijun55
# message auto-generated for no-merge-commit merge:
!35528 merge sync-pr35335-v2.7.1-infnan-to-v2.9.0 into v2.9.0
[sync] PR-35335: [feat]: A5 only supports INF_NAN mode
Created-by: ascend-ds-bot
Commit-by: weixin_47897441;wanglijun55
Merged-by: ascend-robot
Description:
### 1. Origin pull request:
https://gitcode.com/Ascend/pytorch/merge_requests/35335
### 2. Original pull request related issue(s):
https://gitcode.com/Ascend/pytorch/issues/1918
### 3. Original pull request related commit(s):
| Sha | Datetime | Message |
|---|---|---|
|[92382e10](https://gitcode.com/Ascend/pytorch/commit/92382e10973ba5780721b079332366383ec841ff)|2026-05-12 21:49:33 +0800 CST|modify ut
| |[1352140c](https://gitcode.com/Ascend/pytorch/commit/1352140cad591b7fc472db91eb726d1b553bd65e)|2026-05-11 20:54:16 +0800 CST|fix(npu): Ascend950 only supports INF_NAN mode, bypass env var checks
Ascend950 does not support saturation mode. When users set
INF_NAN_MODE_ENABLE=0 or INF_NAN_MODE_FORCE_DISABLE=1 on Ascend950,
the code incorrectly falls into saturation mode path, causing
RuntimeError: SET StreamOverflowSwitch Failed.
Add early return in IsSupportInfNan() for Ascend950 to always return
true, making both env vars ineffective on this device.
Co-Authored-By: Claude Opus 4.7
| See merge request: Ascend/pytorch!35528- [#35335](https://gitcode.com/Ascend/pytorch/merge_requests/35335)
5月14日 added a commit that referenced this pull request
- 8b09edf0 - [sync] PR-35335: [feat]: A5 only supports INF_NAN mode
Co-authored-by: weixin_47897441
Co-authored-by: wanglijun55
# message auto-generated for no-merge-commit merge:
!35527 merge sync-pr35335-v2.7.1-infnan-to-v2.10.0 into v2.10.0
[sync] PR-35335: [feat]: A5 only supports INF_NAN mode
Created-by: ascend-ds-bot
Commit-by: weixin_47897441;wanglijun55
Merged-by: ascend-robot
Description:
### 1. Origin pull request:
https://gitcode.com/Ascend/pytorch/merge_requests/35335
### 2. Original pull request related issue(s):
https://gitcode.com/Ascend/pytorch/issues/1918
### 3. Original pull request related commit(s):
| Sha | Datetime | Message |
|---|---|---|
|[92382e10](https://gitcode.com/Ascend/pytorch/commit/92382e10973ba5780721b079332366383ec841ff)|2026-05-12 21:49:33 +0800 CST|modify ut
| |[1352140c](https://gitcode.com/Ascend/pytorch/commit/1352140cad591b7fc472db91eb726d1b553bd65e)|2026-05-11 20:54:16 +0800 CST|fix(npu): Ascend950 only supports INF_NAN mode, bypass env var checks
Ascend950 does not support saturation mode. When users set
INF_NAN_MODE_ENABLE=0 or INF_NAN_MODE_FORCE_DISABLE=1 on Ascend950,
the code incorrectly falls into saturation mode path, causing
RuntimeError: SET StreamOverflowSwitch Failed.
Add early return in IsSupportInfNan() for Ascend950 to always return
true, making both env vars ineffective on this device.
Co-Authored-By: Claude Opus 4.7
| See merge request: Ascend/pytorch!35527- [#35335](https://gitcode.com/Ascend/pytorch/merge_requests/35335)
5月14日 added a commit that referenced this pull request
- 8b09edf0 - [sync] PR-35335: [feat]: A5 only supports INF_NAN mode
Co-authored-by: weixin_47897441
Co-authored-by: wanglijun55
# message auto-generated for no-merge-commit merge:
!35527 merge sync-pr35335-v2.7.1-infnan-to-v2.10.0 into v2.10.0
[sync] PR-35335: [feat]: A5 only supports INF_NAN mode
Created-by: ascend-ds-bot
Commit-by: weixin_47897441;wanglijun55
Merged-by: ascend-robot
Description:
### 1. Origin pull request:
https://gitcode.com/Ascend/pytorch/merge_requests/35335
### 2. Original pull request related issue(s):
https://gitcode.com/Ascend/pytorch/issues/1918
### 3. Original pull request related commit(s):
| Sha | Datetime | Message |
|---|---|---|
|[92382e10](https://gitcode.com/Ascend/pytorch/commit/92382e10973ba5780721b079332366383ec841ff)|2026-05-12 21:49:33 +0800 CST|modify ut
| |[1352140c](https://gitcode.com/Ascend/pytorch/commit/1352140cad591b7fc472db91eb726d1b553bd65e)|2026-05-11 20:54:16 +0800 CST|fix(npu): Ascend950 only supports INF_NAN mode, bypass env var checks
Ascend950 does not support saturation mode. When users set
INF_NAN_MODE_ENABLE=0 or INF_NAN_MODE_FORCE_DISABLE=1 on Ascend950,
the code incorrectly falls into saturation mode path, causing
RuntimeError: SET StreamOverflowSwitch Failed.
Add early return in IsSupportInfNan() for Ascend950 to always return
true, making both env vars ineffective on this device.
Co-Authored-By: Claude Opus 4.7
| See merge request: Ascend/pytorch!35527- [#35335](https://gitcode.com/Ascend/pytorch/merge_requests/35335)
5月14日 added a commit that referenced this pull request
- 0f80b4f2 - [sync] PR-35335: [feat]: A5 only supports INF_NAN mode
Co-authored-by: weixin_47897441
Co-authored-by: wanglijun55
# message auto-generated for no-merge-commit merge:
!35526 merge sync-pr35335-v2.7.1-infnan-to-v2.11.0 into v2.11.0
[sync] PR-35335: [feat]: A5 only supports INF_NAN mode
Created-by: ascend-ds-bot
Commit-by: weixin_47897441;wanglijun55
Merged-by: ascend-robot
Description:
### 1. Origin pull request:
https://gitcode.com/Ascend/pytorch/merge_requests/35335
### 2. Original pull request related issue(s):
https://gitcode.com/Ascend/pytorch/issues/1918
### 3. Original pull request related commit(s):
| Sha | Datetime | Message |
|---|---|---|
|[92382e10](https://gitcode.com/Ascend/pytorch/commit/92382e10973ba5780721b079332366383ec841ff)|2026-05-12 21:49:33 +0800 CST|modify ut
| |[1352140c](https://gitcode.com/Ascend/pytorch/commit/1352140cad591b7fc472db91eb726d1b553bd65e)|2026-05-11 20:54:16 +0800 CST|fix(npu): Ascend950 only supports INF_NAN mode, bypass env var checks
Ascend950 does not support saturation mode. When users set
INF_NAN_MODE_ENABLE=0 or INF_NAN_MODE_FORCE_DISABLE=1 on Ascend950,
the code incorrectly falls into saturation mode path, causing
RuntimeError: SET StreamOverflowSwitch Failed.
Add early return in IsSupportInfNan() for Ascend950 to always return
true, making both env vars ineffective on this device.
Co-Authored-By: Claude Opus 4.7
| See merge request: Ascend/pytorch!35526- [#35335](https://gitcode.com/Ascend/pytorch/merge_requests/35335)
5月14日 added a commit that referenced this pull request
- 0f80b4f2 - [sync] PR-35335: [feat]: A5 only supports INF_NAN mode
Co-authored-by: weixin_47897441
Co-authored-by: wanglijun55
# message auto-generated for no-merge-commit merge:
!35526 merge sync-pr35335-v2.7.1-infnan-to-v2.11.0 into v2.11.0
[sync] PR-35335: [feat]: A5 only supports INF_NAN mode
Created-by: ascend-ds-bot
Commit-by: weixin_47897441;wanglijun55
Merged-by: ascend-robot
Description:
### 1. Origin pull request:
https://gitcode.com/Ascend/pytorch/merge_requests/35335
### 2. Original pull request related issue(s):
https://gitcode.com/Ascend/pytorch/issues/1918
### 3. Original pull request related commit(s):
| Sha | Datetime | Message |
|---|---|---|
|[92382e10](https://gitcode.com/Ascend/pytorch/commit/92382e10973ba5780721b079332366383ec841ff)|2026-05-12 21:49:33 +0800 CST|modify ut
| |[1352140c](https://gitcode.com/Ascend/pytorch/commit/1352140cad591b7fc472db91eb726d1b553bd65e)|2026-05-11 20:54:16 +0800 CST|fix(npu): Ascend950 only supports INF_NAN mode, bypass env var checks
Ascend950 does not support saturation mode. When users set
INF_NAN_MODE_ENABLE=0 or INF_NAN_MODE_FORCE_DISABLE=1 on Ascend950,
the code incorrectly falls into saturation mode path, causing
RuntimeError: SET StreamOverflowSwitch Failed.
Add early return in IsSupportInfNan() for Ascend950 to always return
true, making both env vars ineffective on this device.
Co-Authored-By: Claude Opus 4.7
| See merge request: Ascend/pytorch!35526- [#35335](https://gitcode.com/Ascend/pytorch/merge_requests/35335)
5月14日 added a commit that referenced this pull request
- beed7e94 - [sync] PR-35335: [feat]: A5 only supports INF_NAN mode
Co-authored-by: weixin_47897441
Co-authored-by: wanglijun55
# message auto-generated for no-merge-commit merge:
!35525 merge sync-pr35335-v2.7.1-infnan-to-v2.12.0 into v2.12.0
[sync] PR-35335: [feat]: A5 only supports INF_NAN mode
Created-by: ascend-ds-bot
Commit-by: weixin_47897441;wanglijun55
Merged-by: ascend-robot
Description:
### 1. Origin pull request:
https://gitcode.com/Ascend/pytorch/merge_requests/35335
### 2. Original pull request related issue(s):
https://gitcode.com/Ascend/pytorch/issues/1918
### 3. Original pull request related commit(s):
| Sha | Datetime | Message |
|---|---|---|
|[92382e10](https://gitcode.com/Ascend/pytorch/commit/92382e10973ba5780721b079332366383ec841ff)|2026-05-12 21:49:33 +0800 CST|modify ut
| |[1352140c](https://gitcode.com/Ascend/pytorch/commit/1352140cad591b7fc472db91eb726d1b553bd65e)|2026-05-11 20:54:16 +0800 CST|fix(npu): Ascend950 only supports INF_NAN mode, bypass env var checks
Ascend950 does not support saturation mode. When users set
INF_NAN_MODE_ENABLE=0 or INF_NAN_MODE_FORCE_DISABLE=1 on Ascend950,
the code incorrectly falls into saturation mode path, causing
RuntimeError: SET StreamOverflowSwitch Failed.
Add early return in IsSupportInfNan() for Ascend950 to always return
true, making both env vars ineffective on this device.
Co-Authored-By: Claude Opus 4.7
| See merge request: Ascend/pytorch!35525- [#35335](https://gitcode.com/Ascend/pytorch/merge_requests/35335)
5月14日 added a commit that referenced this pull request
- beed7e94 - [sync] PR-35335: [feat]: A5 only supports INF_NAN mode
Co-authored-by: weixin_47897441
Co-authored-by: wanglijun55
# message auto-generated for no-merge-commit merge:
!35525 merge sync-pr35335-v2.7.1-infnan-to-v2.12.0 into v2.12.0
[sync] PR-35335: [feat]: A5 only supports INF_NAN mode
Created-by: ascend-ds-bot
Commit-by: weixin_47897441;wanglijun55
Merged-by: ascend-robot
Description:
### 1. Origin pull request:
https://gitcode.com/Ascend/pytorch/merge_requests/35335
### 2. Original pull request related issue(s):
https://gitcode.com/Ascend/pytorch/issues/1918
### 3. Original pull request related commit(s):
| Sha | Datetime | Message |
|---|---|---|
|[92382e10](https://gitcode.com/Ascend/pytorch/commit/92382e10973ba5780721b079332366383ec841ff)|2026-05-12 21:49:33 +0800 CST|modify ut
| |[1352140c](https://gitcode.com/Ascend/pytorch/commit/1352140cad591b7fc472db91eb726d1b553bd65e)|2026-05-11 20:54:16 +0800 CST|fix(npu): Ascend950 only supports INF_NAN mode, bypass env var checks
Ascend950 does not support saturation mode. When users set
INF_NAN_MODE_ENABLE=0 or INF_NAN_MODE_FORCE_DISABLE=1 on Ascend950,
the code incorrectly falls into saturation mode path, causing
RuntimeError: SET StreamOverflowSwitch Failed.
Add early return in IsSupportInfNan() for Ascend950 to always return
true, making both env vars ineffective on this device.
Co-Authored-By: Claude Opus 4.7
| See merge request: Ascend/pytorch!35525- [#35335](https://gitcode.com/Ascend/pytorch/merge_requests/35335)
5月14日 added a commit that referenced this pull request
- 20da0804 - [sync] PR-35335: [feat]: A5 only supports INF_NAN mode
Co-authored-by: weixin_47897441
Co-authored-by: wanglijun55
# message auto-generated for no-merge-commit merge:
!35524 merge sync-pr35335-v2.7.1-infnan-to-master into master
[sync] PR-35335: [feat]: A5 only supports INF_NAN mode
Created-by: ascend-ds-bot
Commit-by: weixin_47897441;wanglijun55
Merged-by: ascend-robot
Description:
### 1. Origin pull request:
https://gitcode.com/Ascend/pytorch/merge_requests/35335
### 2. Original pull request related issue(s):
https://gitcode.com/Ascend/pytorch/issues/1918
### 3. Original pull request related commit(s):
| Sha | Datetime | Message |
|---|---|---|
|[92382e10](https://gitcode.com/Ascend/pytorch/commit/92382e10973ba5780721b079332366383ec841ff)|2026-05-12 21:49:33 +0800 CST|modify ut
| |[1352140c](https://gitcode.com/Ascend/pytorch/commit/1352140cad591b7fc472db91eb726d1b553bd65e)|2026-05-11 20:54:16 +0800 CST|fix(npu): Ascend950 only supports INF_NAN mode, bypass env var checks
Ascend950 does not support saturation mode. When users set
INF_NAN_MODE_ENABLE=0 or INF_NAN_MODE_FORCE_DISABLE=1 on Ascend950,
the code incorrectly falls into saturation mode path, causing
RuntimeError: SET StreamOverflowSwitch Failed.
Add early return in IsSupportInfNan() for Ascend950 to always return
true, making both env vars ineffective on this device.
Co-Authored-By: Claude Opus 4.7
| See merge request: Ascend/pytorch!35524- [#35335](https://gitcode.com/Ascend/pytorch/merge_requests/35335)
5月14日 added a commit that referenced this pull request
- 20da0804 - [sync] PR-35335: [feat]: A5 only supports INF_NAN mode
Co-authored-by: weixin_47897441
Co-authored-by: wanglijun55
# message auto-generated for no-merge-commit merge:
!35524 merge sync-pr35335-v2.7.1-infnan-to-master into master
[sync] PR-35335: [feat]: A5 only supports INF_NAN mode
Created-by: ascend-ds-bot
Commit-by: weixin_47897441;wanglijun55
Merged-by: ascend-robot
Description:
### 1. Origin pull request:
https://gitcode.com/Ascend/pytorch/merge_requests/35335
### 2. Original pull request related issue(s):
https://gitcode.com/Ascend/pytorch/issues/1918
### 3. Original pull request related commit(s):
| Sha | Datetime | Message |
|---|---|---|
|[92382e10](https://gitcode.com/Ascend/pytorch/commit/92382e10973ba5780721b079332366383ec841ff)|2026-05-12 21:49:33 +0800 CST|modify ut
| |[1352140c](https://gitcode.com/Ascend/pytorch/commit/1352140cad591b7fc472db91eb726d1b553bd65e)|2026-05-11 20:54:16 +0800 CST|fix(npu): Ascend950 only supports INF_NAN mode, bypass env var checks
Ascend950 does not support saturation mode. When users set
INF_NAN_MODE_ENABLE=0 or INF_NAN_MODE_FORCE_DISABLE=1 on Ascend950,
the code incorrectly falls into saturation mode path, causing
RuntimeError: SET StreamOverflowSwitch Failed.
Add early return in IsSupportInfNan() for Ascend950 to always return
true, making both env vars ineffective on this device.
Co-Authored-By: Claude Opus 4.7
| See merge request: Ascend/pytorch!35524- [#35335](https://gitcode.com/Ascend/pytorch/merge_requests/35335)
【合入来源】
【修改方案】
A5上torch.utils.is_support_inf_nan()接口始终返回ture,INF_NAN_MODE_ENABLE和INF_NAN_MODE_FORCE_DISABLE两个环境变量配置不生效
【资料变更】
涉及资料更改,PR见https://gitcode.com/Ascend/pytorch/pull/35330
【接口变更】
涉及接口变更,torch.utils.is_support_inf_nan()接口在A5上始终返回ture,在其他型号上保持不变;
【功能验证】
UT测试ok
【CheckList】