Closed
[Bug-Report|缺陷反馈]: matmul fusion pass 平台判断读取 soc_info.arch_type 在真机 Ascend950 上获取不到导致融合门控失效 #8308
zhangquanxinAdd on  16 days agoClosed at  13 days ago
zhangquanxin
zhangquanxinCollaborators
16 days ago Create

Describe the current behavior / 问题描述

matmul 域图融合 pass 的平台门控(IsNpuArch3510Series 及 flat_quant/rotate_quant infershape、anti_quant、batch_matmul_to_transpose_batch_matmul 等同类判断)通过 fe::PlatformInfo 的 soc_info.arch_type 字段判断当前 NPU arch。线上真机 Ascend950 环境的 ini 配置不包含 arch_type 字段,GetPlatformInfoWithOutSocVersion 返回的 arch_type 不可靠,导致 3510 系列平台被误判为不支持:

  • FusedMatMul 直接融合路径/PostCube 派发被误判不走(isDav3510=false)
  • flat_quant/rotate_quant 的 hif4/mxfp4/mxfp8 等 3510 专属 dtype 的 infershape/infershape 支持判断失效
  • anti_quant/transpose_batch_mat_mul 融合 pass 平台门控失效

仓内注释亦佐证该字段真机不可靠(fused_mat_mul_fusion_pass.cpp: the Ascend950 ini has no arch_type at all, which blocked the real 950 device)。

Environment Information / 环境信息

  • 昇腾硬件型号:Ascend950
  • CANN 版本:9.3.0

Steps to reproduce the issue / 重现步骤

  1. 在真机 Ascend950 环境部署包含 matmul 融合 pass 的算子库(libopgraph_nn.so)
  2. 构造含 MatMul+Relu(或其他可融合 pattern)的图并执行
  3. 观察融合结果:IsNpuArch3510Series() 返回 false,FusedMatMul 融合不生效

Describe the expected behavior / 预期结果

真机 Ascend950 应被正确识别为 DAV_3510 系列(兼容 DAV_9201/DAV_9202),融合 pass 与 infershape 平台门控正常生效。

问题代码(修复前):
platformInfo.soc_info.arch_type == static_cast<int32_t>(Ops::Base::DAV_3510) (matmul/common/op_graph/fusion_pass/matmul_fusion_utils_pass.cpp:126 及 4 处同类判断点)
真机上该字段拿不到,比较恒为 false。

Special notes for this issue/备注

修复方案:平台判断改用运行时 API aclplatformGetDeviceInfo(ACL_PLATFORM_NPU_ARCH, buf) 获取 NPU arch 字符串("3510"/"9201"/"9202"),经 std::atoi 转换后与 arch 常量比较,不再依赖 fe::PlatformInfo 的 arch_type 字段。配套 UT stub 桥接(tests/ut/acl_platform_stub.cpp)保持单测可 mock。修复 MR 见关联 PR。

likedislike
zhangquanxinzhangquanxinCollaborators
16 days ago Added label: bug-report
yuning_chenyuning_chenCollaborators
16 days ago Assign zhangquanxin as responsible person
CANN-robotCANN-robotCollaborators
13 days ago Close issue
CANN-robotCANN-robotCollaborators
13 days ago changed custom state from 进行中 to 已完成
CANN-robotCANN-robotCollaborators
13 days ago Added label: resolved