已合并
mmv3 support 8d input #8785
yuning_chen创建于 8月17日
mmv3 support 8d input #8785
已合并
yuning_chen创建于 8月17日
yuning_chen
yuning_chen成员
8月17日

描述

aclnnmatmul接口支持八维输入

关联的Issue

关联Issue #4067

测试

文档更新

更新了aclnn文档

类型标签

AI/Agent生成声明

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 yuning_chen 的贡献)
yuning_chenyuning_chen成员
8月17日 创建了 pull request,commit 676b420c
atomgit-bot
atomgit-bot
8月17日 评论:

变更摘要

该 PR 将 batch_mat_mul_v3(mmv3)对输入维度的支持从 6 维扩展到 8 维,即 batch 维度从最多 4 维扩展到 6 维。改动主要在 tiling 阶段引入统一的 GetBatchAxisFromEnd 维度解析方式,扩展 BatchShapeInfo、MultiBatchInfo 等数据结构,并在 kernel 侧为新增的 batch 维度补充循环与偏移计算;同时将 host 端 API 的维度上限提升到 8,并新增 rank 7/8 场景的单元测试。

主要改动

  • Tiling 层 batch 信息扩展到 rank 7/8:在 batch_mat_mul_v3_base_tiling.h 中为 BatchShapeInfo 新增 batchA4/batchA5、batchB4/batchB5、batchC4/batchC5 字段及 IsEqualBatch() 方法;在 batch_mat_mul_v3_base_tiling.cpp 中通过模板函数 GetBatchAxisFromEnd 统一计算各 batch 维,并将其纳入广播校验、MergeBatchAndMAxis 清零逻辑、bias batch 校验和合法性检查。
  • Tiling 数据结构新增维度字段:MultiBatchInfo 增加 aBatchDim4/aBatchDim5、bBatchDim4/bBatchDim5、cBatchDim4/cBatchDim5,并在 SetBatchDimInfo 与 CalcBatchDimAll 中写入和参与 batch 总量计算。
  • Kernel 循环与偏移计算扩展至 6 个 batch 维:batch_mat_mul_v3.h 在 BatchMatMulUnalignedKernel 中新增最外层 i5/i6 循环;batch_mat_mul_v3_com_base_block.h 的 InitBatchCount 与 CalcGMOffset 相应扩展 batchC5/batchC6 及 A/B 侧索引计算;batch_mat_mul_v3_com_base_block_struct.h 补充 batchA5/batchA6、batchB5/batchB6、batchC5/batchC6 参数。
  • Host 端 API 维度上限提升:batch_matmul_util.cpp 中 GetBatchDim 返回 6 个 batch 维度,CheckAscendCScenario 对 rank 7/8 直接命中 v3 场景,GetOutputSize 的 maxDim/maxBatchDim 分别调整为 8/6;aclnn_matmul.cpp 的 MAX_SUPPORT_MATMUL_DIMS_NUMS 由 6 改为 8。
  • 补充 rank 7/8 测试用例:test_aclnn_matmul.cpp 新增 8D/8D、8D/2D、2D/8D、7D/7D 及 8D/6D 广播等 bmm 测试。
likedislike
不准确?
atomgit-bot
atomgit-bot
8月17日 评论:

代码审查

✅ 未发现问题

likedislike
不准确?
CANN-robotCANN-robot成员
8月17日 添加了label:stat/needs-squash
CANN-robotCANN-robot成员
8月17日 添加了label:cann-cla/yes
此处折叠了152条消息 查看更多
CANN-robotCANN-robot成员
9月1日 添加了label:lgtm
CANN-robot
CANN-robot成员
9月1日 评论:

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
林鹏翔林鹏翔成员
9月1日 解决了最后一个问题
CANN-robotCANN-robot成员
9月1日 合入了pull request
CANN-robot
CANN-robot成员
9月1日 评论:

Pull Request 已合并或已关闭。

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

likedislike