Closed
[Requirement|需求建议]: matmul 域 Ascend960DT/PR 算子 SocVersion→NpuArch 整改(DAV_9201/DAV_9202) #8613
zhangquanxinAdd on  10 days agoClosed at  5 days ago
zhangquanxin
zhangquanxinCollaborators
10 days ago Create

Backgroud(背景信息)

matmul 域面向 Ascend960DT/PR 的算子实现中,平台注册与判断大量使用 soc 字符串(ascend960dt/ascend960pr)与芯片名词(960DT/960PR 字眼),与仓内 Ascend950(DAV_3510)整改后的 arch 体系不一致:

  • def 注册使用 AddConfig("ascend960dt"/"ascend960pr"),未走 ArchConfigHelper::AddConfigByArch 的架构注册
  • tiling/infershape/fusion pass 的平台判断依赖 soc 名/arch_type(线上真机 Ascend950 ini 无 arch_type 的先例表明该方式不可靠,需 aclplatformGetDeviceInfo 运行时获取)
  • 枚举前缀混用(NpuArch::DAV_9201/9202 与 Ops::Base 不统一)
  • UT 的 mock、hardware_info JSON、case 名/变量名、注释与日志文案中大量使用 soc 名指代架构

需要将上述代码统一整改为 NpuArch 架构形态(DAV_9201 对应 ascend960dt,DAV_9202 对应 ascend960pr),对齐 950 整改模式。

Origin(信息来源)

华为昇腾 CANN ops-nn matmul 域算子维护团队(zhangquanxin)提出,对齐仓内 Ascend950 SocVersion→NpuArch 整改(已合入 6e399a027)的既有演进方向。

Benefit / Necessity (价值/作用)

  • 平台注册走 arch 枚举(AddConfigByArch(DAV_9201/DAV_9202)),一处架构映射多 soc 受益,后续新增兼容芯片无需逐算子改注册
  • 平台判断统一 aclplatformGetDeviceInfo 运行时获取,规避线上 ini 配置缺 arch_type 导致的融合/infershape 门控失效问题
  • 架构命名统一(Ops::Base:: 前缀、dav9201/dav9202 命名、注释/日志/UT 全链路一致),消除芯片型号硬编码
  • 覆盖 rotate_quant/flat_quant/mat_mul_v3/fused_mat_mul/quant_batch_matmul_v3/v4/inplace_add/weight_quant_batch_matmul_v2/transpose_quant_batch_mat_mul/matmul_emu_split_weight 等 24+ 算子

Design(设计方案)

  1. def 注册:AddConfig("ascend960dt"/"ascend960pr", cfg) → AddConfigByArch(this->AICore(), Ops::Base::DAV_9201/DAV_9202, cfg);紧邻 AddConfig("ascend350") 冗余删除(DAV_3510 已展开 950+350);补 op_const_def_nn.h/op_arch_helper.h include
  2. 平台判断:soc 名/arch_type 判断 → aclplatformGetDeviceInfo(ACL_PLATFORM_NPU_ARCH, buf, sizeof(buf)) + std::atoi(buf) 与 arch 常量数值比较
  3. 枚举前缀:NpuArch::DAV_9201/9202 → Ops::Base::DAV_9201/9202 全仓统一
  4. UT:test 名/变量名/INSTANTIATE 名 ascend960dt_→dav9201_;hardware_info JSON "socVersion": "Ascend960DT/PR"→"npuArch": "dav9201/dav9202"(配套 runner GetPlatFormInfosDavAware 补 9201/9202 分支);NpuArchManager mock
  5. 注释/日志文案中 960 字眼指代架构的清理(DAV_9201/DAV_9202 表述);数据类 soc 名保留(JSON 环境声明、桥接映射入参、examples 真机判断、CMakeLists/构建目录引用、文件名)
  6. 依赖:third_party/opbase bump 至 b603996f1390c8cac895b1afcb348f2f62cfe3da(含 DAV_9201/DAV_9202 与 soc 映射)

详见关联 PR。

likedislike
zhangquanxinzhangquanxinCollaborators
10 days ago Added label: requirement
yuning_chenyuning_chenCollaborators
10 days ago Assign zhangquanxin as responsible person
yuning_chen
yuning_chenCollaborators
5 days ago Comments:

收到需求建议,欢迎您参加 ops-nn sig 例会评审并申报相关议题,最近的例会议题申报及会议时间可见:https://etherpad-cann.meeting.osinfra.cn/p/sig-ops-nn

本条要点: Backgroud(背景信息)

likedislike
CANN-robotCANN-robotCollaborators
5 days ago Close issue
CANN-robotCANN-robotCollaborators
5 days ago changed custom state from 待办的 to 已完成
CANN-robotCANN-robotCollaborators
5 days ago Added label: resolved
zhangquanxinzhangquanxinCollaborators
4 days ago Associated pull request
马琦钧马琦钧Collaborators
4 days ago Associated pull request