Closed
[Requirement|需求建议]: posembedding模块5个RoPE算子适配ascend960dt #5821
AlfengYuanAdd on  Oct 8Closed at  Oct 8
AlfengYuan
AlfengYuanCollaborators
Oct 8 Create

Backgroud(背景信息)

Ascend960DT 与 Ascend950 同属 DAV(regbase,arch35)架构(NpuArch DAV_3510),现有 arch35 kernel 与 regbase tiling 可直接复用,attention 模块已有 compressor / mla_prolog / quant_flash_attn 等算子完成了 ascend960dt 适配。但 posembedding 模块以下 5 个算子尚未在算子定义中声明 ascend960dt 支持,960DT 环境无法调用:

  • apply_rotary_pos_emb
  • inplace_partial_rotary_mul
  • inplace_partial_rotary_mul_grad
  • rotary_position_embedding
  • rotary_position_embedding_grad

Benefit / Necessity (价值/作用)

  • 补齐 posembedding 模块(RoPE 类算子)在 960DT 上的芯片覆盖;
  • 全部为增量配置:复用 ascend950 的 OpAICoreConfig 与 arch35 kernel/tiling,不影响现有 ascend950 / ascend350 构建路径与运行行为;
  • 与仓内已适配算子(attention 模块)保持同一模式,后续算子适配可直接照搬。

Design(设计方案)

  1. 5 个 op_host/*_def.cpp:紧随 ascend950 增加 this->AICore().AddConfig("ascend960dt", <同950的regbase配置>);
  2. rotary_position_embedding(_grad)/op_host/CMakeLists.txt:仿 quant_flash_attn 先例增加 960dt 分支(仅设 *_apt_depends,不带 950 专属的 Ascend950PR_9599 / ENABLE_CV_COMM_VIA_SSBUF 编译选项);
  3. 5 个 op_host/config/ascend960dt/:从 ascend950 拷贝 *_binary.json 与 *_simplified_key.ini(已核实 950 与 350 的 json 内容一致、ini 仅含 default=0,芯片无关);
  4. tiling / kernel 零改动:IsRegbaseSocVersion(common/src/op_host/tiling_util.cpp)按 NpuArch ∈ {DAV_3510, DAV_5102} 判别,960DT 天然命中 arch35 regbase 路径,无需按 SoC 名单逐一枚举。

补充:仓库根 CMakeLists.txt 的 SOC_VERSION_LIST / ARCH_DIRECTORY_LIST 目前尚无 ascend960dt → arch35 映射(ASCEND_COMPUTE_UNIT=ascend960dt 本地构建会命中 "unsupported chip type" 空包分支)。该文件为全仓公共配置,算子适配 MR 不修改,建议由仓主在基础设施侧统一增加。

likedislike
AlfengYuanAlfengYuanCollaborators
Oct 8 Added label: requirement
AlfengYuanAlfengYuanCollaborators
Oct 8 Associated pull request
游震Collaborators
Oct 8 Comments:

/assign @alfengyuan

likedislike
CANN-robotCANN-robotCollaborators
Oct 8 Assign alfengyuan as responsible person
AlfengYuanAlfengYuanCollaborators
Oct 8 Modify description of issue
CANN-robotCANN-robotCollaborators
Oct 8 Close issue
CANN-robotCANN-robotCollaborators
Oct 8 Added label: resolved
AlfengYuanAlfengYuanCollaborators
Oct 8 Associated pull request
AlfengYuanAlfengYuanCollaborators
Oct 9 Associated pull request