已开启
[CANNBOT]: AcosGrad、AsinGrad 算子共性问题修改 #4843
[CANNBOT]: AcosGrad、AsinGrad 算子共性问题修改 #4843
已开启
zhangjinyang创建于 8月19日
zhangjinyang
8月19日

描述

AcosGrad、AsinGrad 算子共性问题修改
AcosGrad 和 AsinGrad 两个算子缺少 arch35 子目录下的 tiling_key.h、tiling_data.h、kernel 头文件及源文件的最新版本,导致:

  1. 无法基于 def 驱动 dtype 模式编译(dtype 由 def.cpp 的 DataType 列表驱动,构建系统注入 DTYPE_Y 编译宏,tiling_key 不重复编码 dtype)
  2. AsinGrad tiling 函数缺少 ASCENDC_TPL_SEL_PARAM 调用,TilingKey 只编码 BUFFER_MODE
  3. 在 Ascend950 (arch35) 上无法正确构建算子二进制

本次改动补充了 arch35 子目录下的完整源码,采用 def 驱动 dtype 设计:

  • tiling_key.h 中移除 ASCENDC_TPL_DATATYPE_DECL,不再将 dtype 编码进 TilingKey
  • tiling 函数中使用 ASCENDC_TPL_SEL_PARAM(context, useDoubleBuffer) 仅编码 BUFFER_MODE
  • dtype 由 def.cpp 的 DataType 列表驱动,构建系统注入 DTYPE_Y 编译宏

改动后 AsinGrad 编译变体从 6 个(3 dtype × 2 buffer_mode)减少到 3 个(dtype 由 def 驱动),AcosGrad 同理。

关联的Issue

https://gitcode.com/cann/ops-math/issues/2735

文档更新

类型标签

likedislike
合并受阻
Zzhangjinyang
8月19日 创建了 pull request,commit c39caf1d
atomgit-bot
atomgit-bot
8月19日 评论:

变更摘要

本 PR 修复 AcosGradAsinGrad 两个算子在 arch35 架构下的共性问题,将 dtype 编码方式从 TilingKey 模板参数改为 def 驱动模式:dtype 由 def.cpp 的 DataType 列表驱动,构建系统注入 DTYPE_Y 编译宏,kernel 直接使用 DTYPE_Y 获取实际类型,TilingKey 不再重复编码 dtype。同时补齐了 arch35 子目录下缺失的 tiling_key.h 最新版本,并修复 AsinGrad tiling 函数缺少 ASCENDC_TPL_SEL_PARAM 调用的问题,使算子在 Ascend950 (arch35) 上能够正确构建。改动后两个算子的编译变体从 6 个(3 dtype × 2 buffer_mode)减少到 3 个(dtype 由 def 驱动)。

主要改动

  • tiling_key 移除 dtype 模板参数acos_grad_tiling_key.h 删除 ASCENDC_TPL_DATATYPE_DECL(D_T, ...) 及相关 ASCENDC_TPL_SEL 选择列表,asin_grad_tiling_key.h 同样移除 D_T 声明与三个 dtype 分支,仅保留 BUFFER_MODE 作为 TilingKey 编码项。
  • tiling 函数仅编码 BUFFER_MODEasin_grad_tiling_arch35.cppASCENDC_TPL_SEL_PARAM(context, dType, useDoubleBuffer) 改为 ASCENDC_TPL_SEL_PARAM(context, useDoubleBuffer)acos_grad_tiling_arch35.cpp 删除两处 ASCENDC_TPL_SEL_PARAM(context, dTypeX) 调用,TilingKey 不再编码 dtype。
  • kernel 改用 DTYPE_Yacos_grad_apt.cpp 移除模板参数 D_T,以 NsAcosGrad::KernelAcosGrad<DTYPE_Y> 实例化;asin_grad.cppAsinGrad<D_T, float, BUFFER_MODE> 改为 AsinGrad<DTYPE_Y, float, BUFFER_MODE>,实际类型由构建系统注入的 DTYPE_Y 宏提供。
likedislike
不准确?
atomgit-bot
atomgit-bot
8月19日 评论:

代码审查

✅ 未发现问题

likedislike
不准确?
CANN-robotCANN-robot成员
8月19日 添加了label:cann-cla/no
CANN-robot
CANN-robot成员
8月19日 评论:

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 周奇龙, andong_hw (2/2) 周奇龙, andong_hw (2/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
此处折叠了105条消息 查看更多
CANN-robotCANN-robot成员
19 天前 删除了label:ci-pipeline-failed
CANN-robotCANN-robot成员
19 天前 添加了label:ci-pipeline-running
CANN-robotCANN-robot成员
18 天前 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
18 天前 添加了label:ci-pipeline-failed
wangweidong
18 天前 评论:

已基于本 PR 实际 head rebase 到最新 master,并完成 math/acos_grad/op_host/arch35/acos_grad_tiling_arch35.cpp 超 50 行函数整改;替代 PR:#5268 https://gitcode.com/cann/ops-math/pull/5268

likedislike