已合并
[feature] aclgraph support PYTORCH_NO_NPU_MEMORY_CACHING=1 2.9.0 #35178
[feature] aclgraph support PYTORCH_NO_NPU_MEMORY_CACHING=1 2.9.0 #35178
已合并
yurongkun创建于 5月9日
yurongkun
yurongkun成员
5月9日

【合入来源】

如有社区issue,请关联issue链接
请勿携带内部流程信息(需求链接、问题单、内部issue等)

【修改方案】

aclgraph支持PYTORCH_NO_NPU_MEMORY_CACHING
1)裸调capture时,打开PYTORCH_NO_NPU_MEMORY_CACHING不会报错,正常运行。
2)如果当前内存池无其他图持有且图内对象无依赖内存池时,释放该内存池给驱动

【资料变更】

不涉及

【接口变更】

不涉及

【功能验证】

说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤
新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图
新增UT看护,并运行多种场景用例。无运行报错

【CheckList】

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

likedislike
Pull Request已成功合入, 合并人@ascend-robot
(感谢 yurongkun 的贡献)
yurongkunyurongkun成员
5月9日 创建了 pull request,commit 5b396175
openLiBingCI成员
5月9日 评论:

本PR中共发现代码检查告警抑制2处,请Committer检视合理性

本评论自动扫描PR中使用的开源代码检查工具(ruff、clang-tidy、CodeQL等)的屏蔽注释。
这些屏蔽注释会阻止开源代码检查工具对特定代码区域的检测,可能导致潜在问题被忽略。

点击下载完整报告

文件路径 行号 屏蔽类型 代码片段 工具名称
test/npu/test_no_npu_memory_caching.py 7 行级屏蔽 1: import gc
2: import os
5: os.environ["PYTORCH_NO_NPU_MEMORY_CACHING"] = "1"
7: import torch_npu # noqa: E402
8: from torch_npu.testing.testcase import run_tests, TestCase
10: import torch # noqa: E402
13: class TestNoNpuMemoryCaching(TestCase):
14: def test_aclgraph_capture_reset_releases_reserved(self):
15: # With PYTORCH_NO_NPU_MEMORY_CACHING=1, capture-time allocations must still go through
flake8
test/npu/test_no_npu_memory_caching.py 10 行级屏蔽 2: import os
5: os.environ["PYTORCH_NO_NPU_MEMORY_CACHING"] = "1"
7: import torch_npu # noqa: E402
8: from torch_npu.testing.testcase import run_tests, TestCase
10: import torch # noqa: E402
13: class TestNoNpuMemoryCaching(TestCase):
14: def test_aclgraph_capture_reset_releases_reserved(self):
15: # With PYTORCH_NO_NPU_MEMORY_CACHING=1, capture-time allocations must still go through
16: # caching semantics for address stability, but when the graph is reset/destroyed,
17: # the pool should release physical memory promptly.
flake8
likedislike
ascend-robot
ascend-robot成员
5月9日 评论:

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 XDaoHong, liangsongwei (2/2) XDaoHong (1/1)
test XDaoHong, liangsongwei (2/2) XDaoHong (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

yurongkun, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
ascend-robotascend-robot成员
5月9日 添加了label:ascend-cla/yes
此处折叠了88条消息 查看更多
yurongkunyurongkun成员
5月13日 关联了issue:[Feature]: aclgraph support PYTORCH_NO_NPU_MEMORY_CACHING
梁松伟
梁松伟成员
5月13日 评论:

/lgtm

likedislike
ascend-robotascend-robot成员
5月13日 添加了label:lgtm
ascend-robot
ascend-robot成员
5月13日 评论:

Review Guide

This pull-request passes review.
Committers who wrote a comment of /approve are: XDaoHong.
Reviewers who wrote a comment of /lgtm are: XDaoHong, liangsongwei.

likedislike
ascend-robotascend-robot成员
5月13日 合入了pull request