已合并
[feature]接入算子aclnnRingAttentionUpdateV2 #4946
[feature]接入算子aclnnRingAttentionUpdateV2 #4946
已合并
TrHan创建于 5月14日
TrHan
TrHan
5月14日

【合入来源】

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

#2029

【修改方案】

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

接入aclnnRingAttentionUpdateV2算子,算子说明文档
接入后提供接口:

【资料变更】

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

涉及,接口说明文档

【接口变更】

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

涉及,新增接口torch_npu.npu_ring_attention_update,接口说明文档

【功能验证】

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

用例覆盖

测试文件:

op-plugin/test/test_custom_ops/test_npu_ring_attention_update.py

覆盖的测试项:

TestCase Layout dtype 覆盖 校验内容
test_npu_ring_attention_update_sbh SBH float16, float32, bfloat16 attn_out, softmax_max, softmax_sum 与 Python golden 对比
test_npu_ring_attention_update_tnd TND float16, float32, bfloat16 attn_out, softmax_max, softmax_sum 与 Python golden 对比

Golden 逻辑:

softmax_max = max(prev_max, cur_max)
softmax_sum = prev_sum * exp(prev_max - softmax_max)
            + cur_sum * exp(cur_max - softmax_max)

attn_out = prev_attn * prev_factor + cur_attn * cur_factor

其中:

prev_factor = prev_scale * prev_sum / softmax_sum
cur_factor  = cur_scale  * cur_sum  / softmax_sum

执行结果

项目 数量
Passed 2
Failed 0
Error 0
Skipped 0

结果摘要:

..
----------------------------------------------------------------------
Ran 2 tests in 8.615s

OK

【CheckList】

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

likedislike
Pull Request已成功合入, 合并人@ascend-robot
(感谢 TrHan 的贡献)
TrHanTrHan
5月14日 创建了 pull request,commit 69b1abf0
ascend-robot
ascend-robot成员
5月14日 评论:

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)
repo-Ascend/op-plugin renyujin, chengpeng25 (2/2) renyujin (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies 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. 👍

likedislike
ascend-robotascend-robot成员
5月14日 添加了label:ascend-cla/yes
TrHanTrHan
5月14日 修改了pull request 的描述
此处折叠了114条消息 查看更多
TrHanTrHan
5月21日 修改了pull request 的描述
renyujin成员
5月21日 评论:

/lgtm
/approve

likedislike
ascend-robotascend-robot成员
5月21日 添加了label:approvedlgtm
ascend-robot
ascend-robot成员
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, chengpeng25, molly123321.

likedislike
ascend-robotascend-robot成员
5月21日 合入了pull request