Merged
add all_gather_matmul_v3 operator #10643
add all_gather_matmul_v3 operator #10643
Merged
王亮培Add on Aug 26
王亮培
王亮培Collaborators
Aug 26

描述

新增allgathermatmulV3算子代码

关联的Issue

[Requirement|需求建议]: 新增allgathermmV3算子host侧工程 #4711

测试

文档更新

类型标签

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for 王亮培's contribution.)
王亮培王亮培Collaborators
Aug 26 Created pull request, commit be5e39fc
atomgit-bot
atomgit-bot
Aug 26 Comments:

变更摘要

本 PR 新增 AllGatherMatmulV3 算子(MX 量化 FP8/FP4,走 apace UDMA 通信路径),并打通从 aclnn API、算子定义(OpDef)、InferShape/InferDataType、host 侧 tiling 到 kernel 入口的完整链路,同时扩展了公共内核实现以支持 bias 输入与 FP4 场景,并补充了 op_api 与 host 侧单测。该算子面向 ascend950,通过 comm_mode=urma 通信,is_trans_b=true(x2 为 [N,K] 布局),输出 y=[rank_size*M, N] 与 gather_out=[rank_size*M, K]。

主要改动

  • 新增算子完整接入链路: 新增 aclnnAllGatherQuantMatmulV3GetWorkspaceSize/aclnnAllGatherQuantMatmulV3(含 dtype/format/attr/shape 校验、x2 转置视图恢复 TransX2Tensor)、AllGatherMatmulV3 的 OpDef 定义(context/x1/x2/bias/x1_scale/x2_scale 输入、y/gather_out/amax_out 输出及 group/hccl_buffer_size/rank_size 等属性)、InferShape/InferDataType(推导 y=[worldSize*M, N]、gather_out 与 x1 同 dtype)以及 host 侧 tiling(tensor/attr 校验、按 512 行拆分通信 tile、经 SWAT 引擎求 mm tile、设置 workspace)。
  • 公共内核新增 bias 支持: AllGatherMxMatmulUdmaImpl 的 Init/MatmulProcess 及 AllGatherQbmmMxKernel 增加 biasGM_/isBias 参数透传,AllGatherMxMatmulUdmaTilingData 新增 isBias 字段;bias 存在时 matmul 累加 bias,否则沿用空指针。
  • 新增 FP4(DT_FLOAT4_E2M1)支持: 在 aclnn、InferShape、tiling 三层校验 x1/x2 须同为 FP4、K 须为偶数,并将 dataBytesPerMRow_ 按 FP4(1 字节 2 元素)折算为 k/2,修正非切分轴 K 的通信行宽计算。
  • 扩展 tiling 基础设施: QuantMatmulTilingBase 新增 SetCoreLimit(限制计算核数、按 min(aicNum, aivNum) 校准)与 SetAdjustBasicBlockEnable 开关,QuantMatmulTilingSwat 据此在 tiling 中保证 usedCoreNum 不小于 rankSize 并设置排他调度,避免通信挂死。
  • 补充单元测试: 新增 op_api 侧 test_aclnn_all_gather_matmul_v3.cpp(覆盖空/超长 group 等异常入参)及 host 侧 infershape/dtype/tiling 测试框架与参数结构体,并同步更新 urma 冒烟用例以适配新增的 bias 入参。

主要改动

  • 新增算子完整接入链路: 新增 aclnnAllGatherQuantMatmulV3 系列 API、AllGatherMatmulV3 OpDef、InferShape/InferDataType、host 侧 tiling 及 kernel 入口,覆盖 aclnn_all_gather_matmul_v3.cpp、all_gather_matmul_v3_def.cpp、all_gather_matmul_v3_infershape.cpp、all_gather_matmul_v3_tiling.cpp、all_gather_matmul_v3_apt.cpp 等新增文件。
  • 公共内核新增 bias 支持: AllGatherMxMatmulUdmaImpl/AllGatherQbmmMxKernel 增加 biasGM/isBias 参数,AllGatherMxMatmulUdmaTilingData 新增 isBias 字段,tiling 侧据此置位并在 matmul 时累加 bias。
  • 新增 FP4 支持: aclnn/tiling/InferShape 校验 x1/x2 必须同为 DT_FLOAT4_E2M1 且 K 为偶数;dataBytesPerMRow_ 在 FP4 下按 k/2 折算,修正 nonSplitAxisSize 通信行宽。
  • 扩展 tiling 基础设施: QuantMatmulTilingBase 新增 SetCoreLimit 与 SetAdjustBasicBlockEnable,QuantMatmulTilingSwat 按核数限制计算 mm tile,并将 usedCoreNum 提升至不小于 rankSize 后设置排他调度。
  • 补充单元测试: 新增 op_api 与 host 侧 UT(含 AllGatherMatmulV3ApiUtParam、AllGatherMatmulV3TilingUtParam 等参数结构与用例),并更新 urma 冒烟用例适配新增 bias 入参。
likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
Aug 26 Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
Aug 26 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.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.


PR Approval Progress

✅ Congratulations! All modules have met the lgtm and approve requirements.

Module Approval Details

module lgtm status approve status
*/*/op_host/*_def.cpp ✅ 汤磊, 王永光 (2/2) ✅ 王永光 (1/1)
mc2 ✅ wang-minbo, chenjunjian11 (2/2) ✅ wang-minbo (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

wangliangpei, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
CANN-robotCANN-robotCollaborators
Aug 26 Set captainmiaow,monologue815,jiang-lirui,Allan_Yu,wang-minbo,tgwsakiko_,tang-lei01,liudan12,chenjunjian11,yangzeheng,liuboxi,luobaiqing,libohao6,mabing1118,wangyongguang,macech as approver
238 messages are collapsed here。 See more
tang-lei01
tang-lei01Collaborators
Aug 29 Comments:

/lgtm

likedislike
chenjianjun11
chenjianjun11Collaborators
Aug 29 Comments:

/lgtm

likedislike
CANN-robotCANN-robotCollaborators
Aug 29 Added label: lgtm
CANN-robotCANN-robotCollaborators
Aug 29 Closed associated issue
CANN-robotCANN-robotCollaborators
Aug 29 Merged pull request