已合并
A5 BlockSparseAttention FP8场景性能改进 #6620
tangkaidi创建于 6月9日
A5 BlockSparseAttention FP8场景性能改进 #6620
已合并
从已删除 :master合入到cann/ops-transformermaster
Pull Request已成功合入, 合并人@CANN-robot
(感谢 tangkaidi 的贡献)6月9日 添加了label:cann-cla/yes
CANN-robot
6月9日 评论:
6月9日 评论:
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 |
|---|---|---|
| attention | ✅ 黄俊健, shen_weiling (2/2) | ✅ 黄俊健 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
tangkaidi, thanks for your pull request. All authors of the commits have signed the CLA. 👍


6月9日 添加了label:ci-pipeline-running
CANN-robot
6月9日 评论:
6月9日 评论:
流水线任务触发成功
任务链接 [bc7cfac74a004155b591eba0c7bb7d0b][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_experimental | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_experimental | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Pre | ✅ SUCCESS | >>>>> | |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_experimental_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_experimental_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910b | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910c | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_experimental_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_experimental_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_experimental_950_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_experimental_950_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| UT_Test | ✅ SUCCESS | ||
| PreSmoke_A900 | ✅ SUCCESS | >>>>> | |
| API_Check | ✅ SUCCESS | >>>>> | |
| PreSmoke_ATK_Test_A2 | ✅ SUCCESS | >>>>> |
[2026-06-09 15:02:15] CI执行结束


CANN-robot
6月9日 评论:
6月9日 评论:
流水线任务触发成功
任务链接 [4957fc2bc6df466080b3b2a4d2d6d4cd][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_style | ✅ SUCCESS | >>>>> | |
| StaticCheck_codespell_check | ✅ SUCCESS | ||
| StaticCheck_link_validity_check | ✅ SUCCESS | ||
| StaticCheck_resource_existence_check | ✅ SUCCESS | ||
| StaticCheck_tag_closed_check | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| codecheck_checkpr | ✅ SUCCESS | ||
| codecheck_precommit | ⚠️ WARNING | >>>>> | >>>>> |
[2026-06-09 14:52:44] CI执行结束


6月9日 添加了label:api-check-pass
6月9日 删除了label:ci-pipeline-running
6月9日 添加了label:ci-pipeline-passed
attention/block_sparse_attention/op_kernel/attn_infra/epilogue/block/block_epilogue_online_softmax_arch35_reg_low_prec.hpp
@@ -705,3 +658,1 @@
705- Cast<float, ElementInput, castTraitOneUNKNOWN>(floatVreg1, expDstVreg0Fp8, pRegFp16All);
706- Cast<float, ElementInput, castTraitZeroUNKNOWN>(floatVreg2, expDstVreg1Fp8, pRegFp16All);
707- Cast<float, ElementInput, castTraitOneUNKNOWN>(floatVreg3, expDstVreg1Fp8, pRegFp16All);
658+ Cast<float, ElementInput, castTraitZeroUNKNOWN>(floatExpVreg0, expDstVreg0Fp8, pRegFp16All);
vf是否要考虑下划线代替驼峰


lccchh
6月9日 评论:
6月9日 评论:
合入前可以更新一下源端,避免落后过多提交


6月9日 删除了label:ci-pipeline-passed
CANN-robot
6月9日 评论:
6月9日 评论:
6月9日 删除了label:api-check-pass
6月9日 添加了label:ci-pipeline-running
CANN-robot
6月9日 评论:
6月9日 评论:
流水线任务触发成功
任务链接 [b2635730be89445f933489de79f84160][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_experimental | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_experimental | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Pre | ✅ SUCCESS | >>>>> | |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_experimental_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_experimental_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910b | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910c | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_experimental_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_experimental_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_experimental_950_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_experimental_950_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| UT_Test | ✅ SUCCESS | ||
| PreSmoke_A900 | ✅ SUCCESS | >>>>> | |
| API_Check | ✅ SUCCESS | >>>>> | |
| PreSmoke_ATK_Test_A2 | ✅ SUCCESS | >>>>> |
[2026-06-09 15:49:52] CI执行结束


CANN-robot
6月9日 评论:
6月9日 评论:
流水线任务触发成功
任务链接 [5f5bc5e157be4193ab4f2b8792c28cd9][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_style | ✅ SUCCESS | >>>>> | |
| StaticCheck_codespell_check | ✅ SUCCESS | ||
| StaticCheck_link_validity_check | ✅ SUCCESS | ||
| StaticCheck_resource_existence_check | ✅ SUCCESS | ||
| StaticCheck_tag_closed_check | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| codecheck_checkpr | ✅ SUCCESS | ||
| codecheck_precommit | ⚠️ WARNING | >>>>> | >>>>> |
[2026-06-09 15:37:43] CI执行结束


6月9日 添加了label:api-check-pass
6月9日 删除了label:ci-pipeline-running
6月9日 添加了label:ci-pipeline-passed
monologue815
6月9日 评论:
6月9日 评论:
/approve


6月9日 添加了label:approved
shen_weiling
6月9日 评论:
6月9日 评论:
/lgtm


6月9日 添加了label:lgtm
6月9日 关闭了关联的issue
6月9日 合入了pull request
描述
A5 BlockSparseAttention FP8场景性能改进。
修改点1:末尾阶段的O矩阵乘以FP8最大值的倒数,原本操作是单独再调用封装的方法,Load + Muls + Store,现在融合进rescale的方法内做,减少多余的Load + Store。
修改点2:P矩阵的量化过程指令过多,可以优化。
以双发射一阶段为例:
修改前:1次Muls + 2次DeInterleave + 3次Or + 6次Cast。
修改后:1次Muls + 1次DeInterleave + 1次Or + 4次Cast。
关联的Issue
[Requirement|需求建议]: A5 BlockSparseAttention FP8场景性能改进 #3007
测试
文档更新
类型标签