Closed
【问题】GetVRegSize接口兜底在5162A上回落256U与实际宽度偏差8倍 #550
wuxueningAdd on  Oct 22Closed at  Oct 23
wuxuening
wuxueningCollaborators
Oct 22 Create

问题背景

PR !1056 为 GetVRegSize 增加了接口判零兜底:GetVecRegLen() 返回 0 时回落 256U。但在 5162A 上,若接口获取失败,回落值 256U 与该架构 kernel 侧实际向量寄存器宽度(VECTOR_REG_WIDTH = 32B)偏差 8 倍 —— host 侧 tiling 与 kernel 侧常量严重不一致,算子静默产出错误结果(比显式失败更难定位)。

问题内容

GetVRegSize 的取值依赖 GetVecRegLen() 接口返回,但部分 membase 芯片无法通过该接口获取到值,并产生 error 报错:

platform do not support get vector_reg_width size !

修复方案

改为运行时按 GetCurNpuArch() 架构隔离取值,摆脱接口依赖:

  • DAV_5162:固定返回 32U(对齐 kernel 侧 VECTOR_REG_WIDTH)
  • 其余架构:返回 256U

DAV_5162 使用仓内 op_const_def.h 的 static_cast 常量(不依赖 CANN NpuArch 枚举成员,旧版 CANN 兼容)。

验收标准

  • 5162A 上 host 侧 GetVRegSize 恒为 32,与 kernel 侧一致(接口可用与否不影响);
  • 其余架构恒为 256,行为与历史默认一致;
  • 旧版 CANN(9.1.0/9.2.0-beta.2 兼容性看护)编译通过。
likedislike
wuxueningwuxueningCollaborators
Oct 22 Associated pull request
wuxueningwuxueningCollaborators
Oct 22 Modify description of issue
ren-botao
ren-botaoCollaborators
Oct 22 Comments:

/assign @wuxuening

likedislike
CANN-robotCANN-robotCollaborators
Oct 22 Assign wuxuening as responsible person
CANN-robotCANN-robotCollaborators
Oct 23 Close issue
CANN-robotCANN-robotCollaborators
Oct 23 Added label: resolved