已合并
[feature]分布式支持context parallel #35970
TrHan创建于 5月18日
[feature]分布式支持context parallel #35970
已合并
Pull Request已成功合入, 合并人@ascend-robot
(感谢 TrHan 的贡献)5月18日 关联了issue:[Feature]: Distributed Context Parallelism (CP) 功能支持
test/distributed/tensor/test_context_parallel_attention.py
@@ -0,0 +3,4 @@
3+import torch.nn.functional as F
4+import torch_npu
5+import torch_npu.distributed.tensor.experimental._context_parallel._attention # noqa: F401
6+from torch.distributed.tensor import DeviceMesh
7+from torch.distributed.tensor.debug import CommDebugMode
【openlibing.ci】识别到代码检查告警抑制注释,匹配工具:flake8,请Committer检视其合理性。


ascend-robot
5月18日 评论:
5月18日 评论:
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 |
|---|---|---|
| docs | ✅ renyujin, molly123321 (2/2) | ✅ renyujin (1/1) |
| test | ✅ renyujin, kisnwang, zhenyu10 (3/2) | ✅ renyujin (1/1) |
| torch_npu/distributed | ✅ kisnwang, zhenyu10, renyujin (3/2) | ✅ renyujin (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
TrHan, thanks for your pull request. All authors of the commits have signed the CLA. 👍


5月18日 添加了label:ascend-cla/yes
此处折叠了114条消息 查看更多
molly123321
5月21日 评论:
5月21日 评论:
/lgtm


5月21日 添加了label:approvedlgtm
ascend-robot
5月21日 评论:
5月21日 评论:
Review Guide
This pull-request passes review.
Committers who wrote a comment of /approve are: renyujin.
Reviewers who wrote a comment of /lgtm are: renyujin, molly123321, kisnwang, zhenyu10.


5月21日 合入了pull request
【合入来源】
#2029
【修改方案】
参考原生torch cp实现方案,注册shard seq dim的策略,通过monkey patch将sdpa+DTensor的dispatch换成cp的dispatch,从而触发ring attention流程
详细方案见issue
【资料变更】
涉及,docs/api/torch_npu_apis.md
【接口变更】
涉及新增接口,docs/api/torch_npu_apis.md
【功能验证】
围绕ring attention,对如下参数矩阵进行交叉验证


用例执行结果:
【CheckList】