已合并
Optimize the patch for DTensor #34610
yc_233创建于 4月28日
Optimize the patch for DTensor #34610
已合并
yc_233创建于 4月28日
yc_233成员
4月28日

【合入来源】

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

社区 issue:https://gitcode.com/Ascend/pytorch/issues/1786

【修改方案】

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

  1. 删除历史 DTensor 兼容 patch 文件:torch_npu/distributed/tensor/_dtensor_patch.py
  2. torch_npu/distributed/tensor/__init__.py 中移除 _dtensor_patch 导入,统一依赖上游原生 DTensor 能力。
  3. 新增单文件回归测试 test/distributed/tensor/test_dtensor_native_kwargs_strategy.py,重点验证:
    • OpSchema.kwargs_strategy(flat/pytree)解析
    • expand_to_full_mesh_op_strategyargs + kwargs 场景下的策略展开行为

【资料变更】

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

不涉及。

【接口变更】

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

不涉及。无新增客户可见接口,无跨仓接口协议变更。

【功能验证】

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

测试场景:

  1. 删除 _dtensor_patch 后,DTensor kwargs 策略仍能正常工作;
  2. expand_to_full_mesh_op_strategy 在含 kwargs 策略输入时展开正确;
  3. 关键路径行为与原功能预期一致。

测试方法:

  • 用例:test/distributed/tensor/test_dtensor_native_kwargs_strategy.py

覆盖点:

  • flat kwargs 场景
  • pytree kwargs 场景
  • 单输出 + args + kwargs 展开
  • 多输出索引 + kwargs 展开

UT看护:

  • 已新增回归用例,覆盖 patch 删除后的核心行为。

【CheckList】

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

likedislike
Pull Request已成功合入, 合并人@ascend-robot
(感谢 yc_233 的贡献)
Yyc_233成员
4月28日 创建了 pull request,commit f0bba071
yc_233成员
4月28日 评论:

compile

likedislike
ascend-robot
ascend-robot成员
4月28日 评论:

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
test wjlflyer, kisnwang (2/2) wjlflyer (1/1)
torch_npu/distributed wjlflyer, kisnwang (2/2) wjlflyer (1/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
ascend-robotascend-robot成员
4月28日 添加了label:ascend-cla/yes
此处折叠了42条消息 查看更多
wjlflyer成员
4月30日 评论:

/approve

likedislike
ascend-robotascend-robot成员
4月30日 添加了label:lgtm
ascend-robotascend-robot成员
4月30日 添加了label:approved
ascend-robot
ascend-robot成员
4月30日 评论:

Review Guide

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

likedislike
ascend-robotascend-robot成员
4月30日 合入了pull request