已关闭
[Bug-Report|缺陷反馈]: add_layer_norm_quant regbase tiling 缺少 dtype 校验 #4172
rk创建于  7月20日关闭于  7月23日
rk成员
7月20日 创建

一、问题描述 / Describe the current behavior

add_layer_norm_quant 算子的 regbase tiling 路径(arch35)存在两类问题:

  1. 缺失 dtype 校验:DoTiling 流程未对输入 dtype 做前置校验,非法 dtype(如 int32)会绕过 tiling 阶段直达 kernel,可能导致未定义行为。
  2. 取值方式不规范:使用 GetInputTensor()->GetDataType() 获取 dtype,官方文档明确建议改用 GetInputDesc()->GetDataType()。

二、环境信息 / Environment

  • 硬件:Ascend 950
  • 算子路径:norm/add_layer_norm_quant/op_host/add_layer_norm_quant_tiling_arch35.cpp

三、重现步骤 / Steps to reproduce

  1. 构造 AddLayerNormQuant 算子调用,输入 x1 dtype 设为 DT_INT32(或 x1/x2 dtype 不一致)
  2. 走 regbase static quant tiling 路径
  3. 观察到 tiling 阶段不报错,非法 dtype 透传至 kernel

四、预期结果 / Describe the expected behavior

tiling 阶段应拦截非法 dtype 并返回 GRAPH_FAILED,给出明确的错误日志,不应让非法输入直达 kernel。

修复前:非法 dtype 无报错透传至 kernel。
修复后:tiling UT 验证非法 dtype 被拦截(EXPECT_EQ(tiling_func(...), ge::GRAPH_FAILED)),14 tests PASSED。

六、备注 / Special notes

修复 commit:见关联 PR
修复内容:

  • 新增 CheckInputDtype 校验主输入 dtype 支持性与一致性
  • 新增 CheckOptionalInputDtype 用 lambda 链式调用替代早返回
  • 改用 GetInputDesc + 判空
  • 补 3 条 tiling UT

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

likedislike
Rrk成员
7月20日 添加了label:bug-report
Rrk成员
7月20日 修改了issue 的描述
rk成员
7月20日 评论:

/assign

likedislike
CANN-robotCANN-robot成员
7月20日 将 wangpengbo26 设为负责人
Rrk成员
7月22日 修改标题为 “[Bug-Report|缺陷反馈]: add_layer_norm_quant regbase tiling 缺少 dtype 校验”,原标题为“[Bug-Report|缺陷反馈]: add_layer_norm_quant regbase tiling 缺少输入 dtype 校验且可选输入校验存在早返回隐患”
CANN-robotCANN-robot成员
7月23日 关闭了 issue
CANN-robotCANN-robot成员
7月23日 添加了label:resolved