已合并
dsv32 use triton rope #694
hw-zhoutianyang创建于 3月27日
dsv32 use triton rope #694
已合并
hw-zhoutianyang创建于 3月27日
3月27日

合入背景

请描述为什么要做这个PR内的改动。
如涉及,请关联前序PR或同特性/需求下的其他PR。
如果是修复之前PR引入的问题,请关联引入问题的PR。
注意:Fixes #ISSUE ID会自动关闭issue,如问题部分解决请不要使用Fixes,可以用Fix part of #ISSUE ID替代.

Fixes #576

修改内容

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

Deepseek V3.2性能优化
使用triton rope融合算子替换torch_npu的rope、slice、cat算子

资料变更

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

不涉及

接口变更

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

不涉及

测试结果

请说明测试场景,测试方法以及测试结果。
测试用例设计时需考虑硬件、部署方式、功能、性能、精度、显存等维度。

GPQA精度OK:
image.png

CheckList

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

likedislike
Pull Request已成功合入, 合并人@ascend-robot
(感谢 hw-zhoutianyang 的贡献)
ascend-robot
ascend-robot成员
3月27日 评论:

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/MindIE-LLM 陈歆怡, earthmanylf (2/2) 陈歆怡 (1/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
ascend-robotascend-robot成员
3月27日 添加了label:ascend-cla/yes
ascend-robotascend-robot成员
3月27日 添加了label:needs-issue
ascend-robot
ascend-robot成员
3月27日 评论:

Linking Issue Notice

@hw-zhoutianyang , the pull request must be linked to at least one issue.
If an issue has already been linked, but the needs-issue label remains, you can remove the label by commenting /check-issue .

likedislike
ascend-robot
ascend-robot成员
3月27日 评论:

问题/功能描述

本PR旨在为稀疏注意力机制中的旋转位置编码(RoPE)计算引入Triton后端支持,以提升计算性能。主要解决了在特定硬件或环境下,当Triton可用时,能够使用更高效的Triton内核替代原有的torch_npu.npu_interleave_rope实现,从而优化注意力层的计算效率。为此,新增了一个支持单输入张量(SISO)的RoPE Triton内核实现,提供了更灵活、高效的RoPE前向传播函数。

修改方案描述

修改方案分为两部分。首先,在稀疏注意力后端实现中,对查询(q)和键(k)的RoPE计算逻辑进行了重构,通过检查HAS_TRITON标志,在Triton可用时调用新的rope_forward_triton_siso函数,否则回退到原有NPU实现。其次,新增了该Triton内核函数,它支持通过预计算的cos/sin缓存结合位置索引,或直接传入已按位置选取的cos/sin张量两种调用方式,内核内部通过向量化加载和掩码处理优化了内存访问和计算性能。

likedislike
此处折叠了121条消息 查看更多
ascend-robot
ascend-robot成员
5月15日 评论:

The MR can not be merged, because of CodeReview discussion not resolved

If you want to solve this problem, you can click here to do it in the FAQs.

likedislike
CXY-KatrinaCXY-Katrina成员
5月15日 解决了最后一个问题
ascend-robot
ascend-robot成员
5月15日 评论:

Review Guide

This pull-request passes review.
Committers who wrote a comment of /approve are: 陈歆怡.
Reviewers who wrote a comment of /lgtm are: 陈歆怡, earthmanylf.

likedislike
ascend-robotascend-robot成员
5月15日 关闭了关联的issue
ascend-robotascend-robot成员
5月15日 合入了pull request