已合并
fix: defer ACLGraph update until after checkpoint #39072
fix: defer ACLGraph update until after checkpoint #39072
已合并
luochao60创建于 6月23日
luochao60成员
6月23日

【合入来源】

(如有)请关联需求文档/issue链接
关联 issue: #2469(https://gitcode.com/Ascend/pytorch/issues/2469)

【修改方案】

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

  1. 调整 torch_npu/npu/_graph_tree.py 中 ACLGraph update 的 record 流程:在 capture 前只解析 aclgraph_update_plan 得到 CPU update payload,不再通过 list(inputs) 持有 recording private-pool Tensor;capture 后完成输出记录和 checkpoint 相关流程,并在 ACLGraph update 前校验 graph dispatch records,避免 checkpoint 前引入 update_stream 相关 event。
  2. 保持 run 路径的执行语义:先根据 new_inputs resolve update payload,再更新 ACLGraph records,随后执行输入 copy 与 graph replay;update payload 为 CPU 侧参数,不依赖 replay 输入数据 copy 后的内容。
  3. 收敛 torch_npu/npu/_aclgraph_update_plan/resolver.py 内部接口:update_aclgraph_records_for_graph 只接收已解析的 cpu_update_input 和 graph,删除冗余的 prepare_aclgraph_update_input_for_graph / submit_aclgraph_update_input_for_graph 导出。

【资料变更】

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

不涉及

【接口变更】

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

不涉及客户面接口变更;仅调整 torch_npu.npu._aclgraph_update_plan 私有模块内部函数组织。

【功能验证】

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

已在各版本 fix 分支执行基础静态验证:

python -m py_compile torch_npu/npu/_aclgraph_update_plan/resolver.py torch_npu/npu/_aclgraph_update_plan/__init__.py torch_npu/npu/_graph_tree.py
git diff --check HEAD^ HEAD -- torch_npu/npu/_aclgraph_update_plan/resolver.py torch_npu/npu/_aclgraph_update_plan/__init__.py torch_npu/npu/_graph_tree.py
grep -R -n "prepare_aclgraph_update_input_for_graph\|submit_aclgraph_update_input_for_graph" torch_npu/npu/_aclgraph_update_plan torch_npu/npu/_graph_tree.py --exclude-dir=__pycache__

【CheckList】

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

likedislike
Pull Request已成功合入, 合并人@ascend-robot
(感谢 luochao60 的贡献)
Lluochao60成员
6月23日 创建了 pull request,commit 066ab8a2
ascend-robot
ascend-robot成员
6月23日 评论:

Ascend docs pipeline is running...

likedislike
ascend-robotascend-robot成员
6月23日 添加了label:docs-ci-pipeline-running
Lluochao60成员
6月23日 update merge request[project id: 7404318, iid: 39072, commit_id: 47f92efd02a0f9b8492e9b4ab40cfe75ac47cfac] virtual merging success
Lluochao60成员
6月23日 强制推送  84 个提交:066ab8a2-83 commits from branch v2.7.1a329845d-fix: defer ACLGraph update until after checkpoint
此处折叠了146条消息 查看更多
ascend-robotascend-robot成员
6月25日 添加了label:ci-pipeline-passed
ascend-robot
ascend-robot成员
6月25日 评论:
流水线 PR-pipeline_pytorch#39016 已完成
阶段 任务名 状态 详情
编译构建 Build_X86 >>>
Build_ARM >>>
Build_LibTorch_x86 >>>
Build_LibTorch_ARM >>>
Build_X86_torchair 🛑 >>>
Build_ARM_torchair 🛑 >>>
patch_test 🛑 >>>
恶意代码检查 Antipoison >>>
编码安全与规范检查 CodeCheck >>>
check_error >>>
CodeCheck_lintrunner >>>
开源片段检查 SCA >>>
开发者测试 UT_X86_Part_01 >>>
UT_X86_Part_02 >>>
UT_ARM_A3_Part_01 >>>
UT_ARM_A3_Part_02 >>>
UT_ARM_A2_Part_01 >>>
UT_ARM_A2_Part_02 >>>
UT_ARM_A2_Part_03 >>>
UT_inductor_Part_01 >>>
UT_inductor_Part_02 >>>
UT_inductor_Part_03 >>>
UT_inductor_Part_04 >>>
UT_DIST_ARM_Part_01 🛑 >>>
UT_DIST_ARM_Part_02 🛑 >>>
UT_DIST_ARM_Part_03 🛑 >>>
UT_DIST_ARM_Part_04 🛑 >>>
UT_ARM_A2_Select_Part_01 >>>
UT_ARM_A2_Select_Part_02 >>>
流水线 PR-pipeline_pytorch >>>
likedislike
ascend-robotascend-robot成员
6月25日 合入了pull request
ascend-robot
ascend-robot成员
6月25日 评论:

Pull Request 已合并或已关闭。

If you want to solve this problem, you can click here to do it in the FAQs.

likedislike
ascend-robot
ascend-robot成员
6月25日 评论:
流水线 pytorch_gitcode_PR_multiVersion#11309 [ commitID:5d5c8498 ] 已完成
likedislike