Pull Request已成功合入, 合并人@CANN-robot
(感谢 wangweidong 的贡献)变更摘要
该 PR 将原 PR #4843 的 AcosGrad、AsinGrad arch35 tiling/kernel 实现与 def 驱动 dtype 的修复 rebase 到最新 master 后重新提交,并新增对 acos_grad_tiling_arch35.cpp 超长 tiling 函数的整改。核心变化是:两个算子的 TilingKey 不再编码 dtype,只编码 BUFFER_MODE(0=单 buffer、1=双 buffer),实际 dtype 由 def.cpp 的 DataType 列表驱动、经构建系统注入的 DTYPE_Y 宏在 kernel 内直接使用;同时将 CalcTilingParams 中的多核分块计算抽取为独立的 CalcBlockParams 函数,在不修改 tiling 常量、计算公式、分支和 TilingData 字段的前提下把函数收敛到 50 行以内。
主要改动
-
TilingKey只编码BUFFER_MODE:在acos_grad_tiling_key.h与asin_grad_tiling_key.h中,ASCENDC_TPL_ARGS_DECL移除D_T数据类型模板参数,仅保留ASCENDC_TPL_UINT_DECL(BUFFER_MODE, 8, ASCENDC_TPL_UI_LIST, 0, 1),对应ASCENDC_TPL_SEL也只保留BUFFER_MODE的 0/1 选择,TilingKey 不再重复编码 dtype。 -
kernel 改由
DTYPE_Y驱动 dtype:在acos_grad_apt.cpp与asin_grad.cpp中,kernel 模板参数由D_T(或D_T, BUFFER_MODE)简化为仅BUFFER_MODE,算子类型统一改为直接使用构建系统注入的DTYPE_Y宏,dtype 由 def.cpp 驱动、与 TilingKey 解耦。 -
tiling 层按 buffer 模式设置 TilingKey:在
acos_grad_tiling_arch35.cpp与asin_grad_tiling_arch35.cpp中,ASCENDC_TPL_SEL_PARAM由传入dType(及useDoubleBuffer)改为只传useDoubleBuffer;其中 AcosGrad 以totalLength > 1024UL决定是否启用双 buffer,空 tensor 分支也统一走useDoubleBuffer = 0。 -
整改 AcosGrad 超长 tiling 函数:在
acos_grad_tiling_arch35.cpp中将CalcTilingParams内多核分块计算(coreNum/blockFormer/blockNum推导)抽取为新的CalcBlockParams函数(约 24 行),CalcTilingParams收敛至约 46 行,且不改变 tiling 常量、计算公式、分支与TilingData字段。 -
UT 预期随 TilingKey 语义更新:在
test_acos_grad_tiling_arch35.cpp中,各用例的expectTilingKey由按 dtype 区分(FP32=0、FP16=1、BF16=27)改为按 buffer 模式区分——大 shape(如 8192、416910 等,totalLength>1024)统一为 1,小 shape(7、17)与空 tensor 统一为 0。


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 |
|---|---|---|
| repo-cann/ops-math | ✅ 周奇龙, jia0liang (2/2) | ✅ 周奇龙, jia0liang (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)


compile


描述
基于原 PR #4843 的实际 head,rebase 到最新 master 后重新提交。保留原 PR 对 AcosGrad、AsinGrad arch35 tiling/kernel 源码和 def 驱动 dtype 的修复,并整改 AcosGrad tiling 超长函数。
新增整改:
原 PR 主要改动:
关联的Issue
https://gitcode.com/cann/ops-math/issues/2735
测试
文档更新
无。
类型标签
AI/Agent生成声明