Merged
build-in bmm streamk模板切换blaze #7731
pzyy00Add on Jul 20
build-in bmm streamk模板切换blaze #7731
Merged
pzyy00Add on Jul 20
pzyy00
pzyy00Collaborators
Jul 20

描述

build-in bmm streamk模板切换blaze,tilingkey变更,切换至blaze框架接口

关联的Issue

https://gitcode.com/cann/ops-nn/issues/4582

测试

本地目标泛化用例精度通过,性能符合预期

文档更新

不涉及

类型标签

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for pzyy00's contribution.)
pzyy00pzyy00Collaborators
Jul 20 Created pull request, commit 1ffefd3b
atomgit-bot
atomgit-bot
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)。
likedislike
Incorrect?
atomgit-bot
atomgit-bot
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

⛔ 需要修改

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
Jul 20 Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
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 /approve or /lgtm
  • Commenting /approve implies 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. 👍

likedislike
236 messages are collapsed here。 See more
林旭林旭Collaborators
Oct 12 Associated issue: [Requirement|需求建议]: Matmul Q3 功能支持规划
CANN-robotCANN-robotCollaborators
Oct 12 Removed label: ci-pipeline-passed
CANN-robot
CANN-robotCollaborators
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.

likedislike
林旭林旭Collaborators
Oct 12 Deleted associated issue: [Requirement|需求建议]: Matmul Q3 功能支持规划
林旭林旭Collaborators
Oct 12 Associated issue: [Requirement|需求建议]: Matmul Q3 功能支持规划