Pull Request已成功合入, 合并人@ascend-robot
(感谢 hw-zhoutianyang 的贡献)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
/approveor/lgtm- Commenting
/approveimplies 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. 👍


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 .


问题/功能描述
本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张量两种调用方式,内核内部通过向量化加载和掩码处理优化了内存访问和计算性能。


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.


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


合入背景
Fixes #576
修改内容
Deepseek V3.2性能优化
使用triton rope融合算子替换torch_npu的rope、slice、cat算子
资料变更
不涉及
接口变更
不涉及
测试结果
GPQA精度OK:

CheckList