已合并
feat: Add ACLGraph update plans #36821
feat: Add ACLGraph update plans #36821
已合并
luochao60创建于 5月26日
luochao60成员
5月26日

【合入来源】

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

【修改方案】

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

  1. 新增 torch_npu._inductor.aclgraph_update_plan 模块,在 Inductor codegen 阶段生成 ACLGraph update plan,并在运行期根据 callable 属性解析 new_inputs 到 FA 类算子 actual sequence 参数的映射。
  2. 在 NPU Python wrapper、MLIR/DVM wrapper、graph partition 子图 wrapper 中挂载 plan,支持 graph partition 开关下分别写入 callpartition_x 函数属性。
  3. _graph_tree record/replay 路径消费 update plan,record 后校验 plan 与真实 capture record 的顺序、算子名和可更新 key,replay 前解析为 CPU update input。
  4. 将 IFA/IFA v2/FA3 等 npugraph handler 的 actual sequence 更新点改为 UPDATE_SPECS 声明式描述,并由 base handler 统一更新 args/kwargs。
  5. 补充 plan 构建、plan 解析、handler 注册、wrapper emit、npugraphify callable 属性保持等单元测试,替换旧的集中测试文件。

【资料变更】

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

不涉及对外资料变更。

【接口变更】

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

不涉及客户面可见 API 变更;新增 torch_npu._inductor.aclgraph_update_plan 为内部编译与 ACLGraph 运行期协同模块。

【功能验证】

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

已补充并验证以下单测:

  1. test/npu/test_aclgraph_update_plan.py 覆盖 plan 构建、输入映射、常量解析、非法 plan 校验。
  2. test/npu/test_npugraph_handler.py 覆盖 IFA/IFA v2 handler 的 UPDATE_SPECS 注册。
  3. test/_inductor/test_aclgraph_update_plan_compile.py 覆盖 wrapper/graph partition emit、MLIR/DVM wrapper、npugraphify callable 属性保持等非设备单测。
  4. 多版本迁移后已在 v2.7.1、v2.9.0、v2.10.0、v2.11.0、v2.12.0、master 分支通过静态检查和不涉及设备的单测验证。

【CheckList】

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

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

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 adrian07110, chujinjin (2/2) adrian07110 (1/1)
test adrian07110, chujinjin (2/2) adrian07110 (1/1)
torch_npu/_inductor adrian07110, chujinjin (2/2) adrian07110 (1/1)
torch_npu/npu adrian07110, chujinjin (2/2) adrian07110 (1/1)
torch_npu/utils adrian07110, chujinjin (2/2) adrian07110 (1/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
ascend-robotascend-robot成员
5月26日 添加了label:ascend-cla/yes
ascend-robot
ascend-robot成员
5月26日 评论:

当前仓库存在以下 保护分支

Protected Branch Version Release
master
v2.11.0
v2.7.1
v2.9.0
v2.10.0
v2.12.0

评论 /sync <branch1> <branch2> ... 可将当前 PR 修改同步到其它分支(创建同步 PR):
a) 如果当前 PR 是 Open 状态,同步操作将延迟到 PR 被合并时执行
b) 如果当前 PR 已经 Merged,将立即执行同步操作

注意:

  1. /sync 命令可以指定同步到多个分支,仅最后一个 /sync 命令生效
  2. 如果创建的同步 PR 不正确,可通过向同步 PR 的源分支提交轻量级 PR 完善,或使用 /close 命令关闭
likedislike
此处折叠了569条消息 查看更多
Lluochao60成员
6月16日 修改了pull request 的描述
Lluochao60成员
6月16日 修改了pull request 的描述
ascend-robotascend-robot成员
6月16日 删除了label:ci-pipeline-passed
ascend-robot
ascend-robot成员
6月16日 评论:

The following label is not ready.

ci-pipeline-passed: The ci-pipeline-passed label is expired. Please compile again.

likedislike
ascend-robot
ascend-robot成员
6月16日 评论:

The following label is not ready.

ci-pipeline-passed: The ci-pipeline-passed label is expired. Please compile again.

likedislike