Merged
build-in bmm streamk模板切换blaze #7731
pzyy00Add on Jul 20
build-in bmm streamk模板切换blaze #7731
Merged
Merged frompzyy00/ops-nnbmm_sk_blazeintocann/ops-nnmaster
Pull Request has been successfully merged by CANN-robot.
(Thank you for pzyy00's contribution.)atomgit-bot
Jul 20 Comments:
Jul 20 Comments:
变更摘要
此 PR 主要将 BatchMatMulV3 的内置 StreamK 模板切换到 Blaze 框架接口,涉及 tiling key 策略变更及新增 Blaze 框架下 Tensor 级别 API 的 kernel 分发分支。同时解除了原 mat_mul_streamk.h 中对 batch > 1 的提前返回限制,使 StreamK 路径能支持批量计算。
主要改动
- Tiling Key 策略调整:在
batch_matmul_v3_basic_streamk_tiling.cpp的GetTilingKey()中新增 API 级别判断逻辑,根据isAvoidTensorApi、DAV_RESV架构及节点类型动态选择BASIC_LEVEL或TENSOR_LEVEL,替代原先固化的BASIC_LEVEL。 - 新增 Blaze 框架 kernel 分发分支:在
batch_mat_mul_v3.cpp中新增MAT_MUL_TENSOR_LEVEL+MAT_MUL_STREAM_K的模板分支,通过IS_BLAZE条件编译分别调用MatmulV3Advanced::MatMulStreamKKernel(Blaze 接口)或原有的MatMulStreamKActKernel,覆盖ON_THE_FLY和ND_FIXPIPE_1_2两种 L0C2Out 模式。 - Tiling Key 选择器扩展:在
batch_mat_mul_v3_tiling_key.h中新增一条ASCENDC_TPL_SEL模板选择条目,支持MAT_MUL_TENSOR_LEVEL+MAT_MUL_STREAM_K+ 多 L0C2Out 模式组合,映射到BatchMatMulV3BasicTilingData结构。 - 移除 batch 限制:在
mat_mul_streamk.h的MatMulStreamKKernel中删除了if (batch > 1) { return; }的提前退出逻辑,使内核可处理多 batch 场景。 - 三方库依赖更新:
ops-tensor.cmake中更新了OPTENSOR_TAG_ID到新 commit,并临时将仓库 URL 指向作者 fork(pzyy00/ops-tensor)。


Incorrect?
atomgit-bot
Jul 20 Comments:
Jul 20 Comments:
代码审查
审查总结
本次审查覆盖了全部 5 个变更文件:
| 文件 | 审查结果 |
|---|---|
cmake/third_party/ops-tensor.cmake |
发现 1 个 P0 问题:URL 指向个人 fork,合并将导致构建阻断 |
matmul/batch_mat_mul_v3/op_host/op_tiling/arch35/batch_matmul_v3_basic_streamk_tiling.cpp |
发现 1 个 P3 问题:冗余三元运算 |
matmul/batch_mat_mul_v3/op_kernel/arch35/batch_mat_mul_v3.cpp |
无问题 — 新增 TENSOR_LEVEL StreamK 分支逻辑正确,IS_BLAZE 切换与非 Blaze 回退路径完整 |
matmul/batch_mat_mul_v3/op_kernel/arch35/batch_mat_mul_v3_tiling_key.h |
无问题 — 新 TilingKey 组合追加在末尾,未修改历史字段顺序,参数与 kernel 分支一致 |
matmul/mat_mul_v3/op_kernel/arch35/mat_mul_streamk.h |
无问题 — 移除 batch > 1 提前返回是启用 batch StreamK 的必要变更,对单 MatMul 路径无影响(batch 默认 0) |
- P0 问题: 1 个
- P3 问题: 1 个
总体风险判断:P0 的 cmake URL 问题必须在合并前修复,否则将导致全量构建失败。其余代码逻辑正确,TilingKey 追加位置合规,kernel 分支匹配完整。
| 类型 | 数量 |
|---|---|
| 🔴 阻塞 | 2 |
| 🟡 建议 | 0 |
⛔ 需要修改


Incorrect?
Jul 20 Added label: cann-cla/yes
CANN-robot
Jul 20 Comments:
Jul 20 Comments:
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 |
|---|---|---|
| matmul | ✅ 商晓波, 林鹏翔 (2/2) | ✅ 商晓波 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
pzyy00, thanks for your pull request. All authors of the commits have signed the CLA. 👍


236 messages are collapsed here。 See more
Oct 12 Associated issue: [Requirement|需求建议]: Matmul Q3 功能支持规划
Oct 12 Removed label: ci-pipeline-passed
CANN-robot
Oct 12 Comments:
Oct 12 Comments:
The following label is not ready.
ci-pipeline-passed: The ci-pipeline-passed label is expired as added over 72 hours. Please use /compile to recompile.


Oct 12 Deleted associated issue: [Requirement|需求建议]: Matmul Q3 功能支持规划
Oct 12 Associated issue: [Requirement|需求建议]: Matmul Q3 功能支持规划
描述
build-in bmm streamk模板切换blaze,tilingkey变更,切换至blaze框架接口
关联的Issue
https://gitcode.com/cann/ops-nn/issues/4582
测试
本地目标泛化用例精度通过,性能符合预期
文档更新
不涉及
类型标签