已合并
feat: Add ACLGraph update plans #38049
feat: Add ACLGraph update plans #38049
已合并
luochao60创建于 6月10日
luochao60成员
6月10日

【合入来源】

(如有)请关联需求文档/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成员
6月10日 创建了 pull request,commit fe103b8a
Lluochao60成员
6月10日 关联了issue:[Feature]: Add ACLGraph update plans
ascend-robot
ascend-robot成员
6月10日 评论:

Ascend docs pipeline is running...

likedislike
ascend-robotascend-robot成员
6月10日 添加了label:docs-ci-pipeline-running
Lluochao60成员
6月10日 update merge request[project id: 7404318, iid: 38049, commit_id: d3dfca3fad356a2fb2f566a72b575e900c689597] virtual merging success
此处折叠了343条消息 查看更多
ascend-robotascend-robot成员
6月18日 添加了label:ci-pipeline-passed
ascend-robot
ascend-robot成员
6月18日 评论:
流水线 PR-pipeline_pytorch#33047 (重试第1次)已完成
阶段 任务名 状态 详情
编译构建 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月18日 合入了pull request
ascend-robot
ascend-robot成员
6月18日 评论:

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月18日 评论:
流水线 pytorch_gitcode_PR_multiVersion#10921 [ commitID:3358cad6 ] 运行失败
likedislike