已关闭
[Requirement|需求建议]: InplaceAddLayerNorm 算子新增 Ascend 950 支持 #4858
rk创建于  8月17日关闭于  8月21日
rk成员
8月17日 创建

背景(背景信息)

InplaceAddLayerNorm :需要在 950 平台上提供该算子支持,以满足 950 上 LayerNorm 类前向计算的需求。

信息来源

cann/ops-nn 仓库算子适配需求:将 InplaceAddLayerNorm 扩展到 Ascend 950 平台,并基于已存在的 AddLayerNorm 950 regbase 实现来落地,减少重复实现成本。

价值 / 作用

  • 补齐 InplaceAddLayerNorm 在 Ascend 950 上的支持矩阵,使上层模型可在 950 上使用该算子。
  • 复用 AddLayerNorm 的 regbase tiling 与 kernel 框架,避免为 inplace 版本单独维护一套 950 实现。
  • 950 路径额外支持空进空出,覆盖更多边界场景。

设计方案

  1. 算子定义:inplace_add_layer_norm_def.cpp 新增 OpAICoreConfig config_950,注册 ascend950,支持 fp16/bf16/fp32 多 dtype 组合,开启动态编译静态/动态 rank/动态 shape。
  2. tiling:InplaceAddLayerNorm 的 tiling 函数从 Tiling4AddLayerNorm 改为 TilingAddLayerNorm(regbase 路径),并新增 AddLayerNorm_8010/8011/8012/8200、InplaceAddLayerNorm_8000~8200 的 tiling data class 注册以覆盖 950 子型号。新增空张量场景处理(isReduceEmpty_)。
  3. kernel:新增 arch35/add_layer_norm.cpp、arch35/inplace_add_layer_norm.cpp 入口;新增 add_layer_norm_regbase_reduce_empty.h 处理空张量;BUFFER_NUM 默认改为双 buffer;VFCalcY 增加 x 输出参数支持 inplace 写出 x。
  4. 配置:新增 inplace_add_layer_norm_binary.json;从全局 ascendc_config.json 移除旧条目,改由各算子目录 CMakeLists.txt 声明 950 编译目标(选项 --cce-no-dcache-flush --cce-simd-vf-fusion=false)。
  5. 文档:README 中 950 标记 ×→√,并新增空进空出说明。

关联 PR:https://gitcode.com/cann/ops-nn/pull/8736

likedislike
Rrk成员
8月17日 添加了label:requirement
yuning_chenyuning_chen成员
8月17日 将 wangpengbo26 设为负责人
Rrk成员
8月18日 修改了issue 的描述
CANN-robotCANN-robot成员
8月21日 关闭了 issue
CANN-robotCANN-robot成员
8月21日 添加了label:resolved