Closed
[Bug-Report|缺陷反馈]: Xlog1py 算子缺少 dtype/rank/广播校验、ascend950 binary 配置 bin_filename 错误,存在越界写与结果错误风险 #4565
renshuojianAdd on 5 days agoClosed at 4 days ago
5 days ago Assign rsj007 as responsible person
4 days ago Close issue
4 days ago Added label: resolved
一、问题描述 (必填)
算子:
Xlog1py(math/xlog1py,arch35 / ascend950)问题概述:算子在 tiling、InferShape/InferDataType 三个环节缺失必要的入参校验,同时 ascend950 的 binary 配置与 kernel 产物命名不匹配,并存在 fp32 路径输出尾部未初始化的问题。具体如下:
tiling 阶段缺少 rank 上限校验(高危)
Xlog1pyTiling::RunTiling()中按rank_ <= 4 ? 4 : 8选择DoTilingAndSet<4>/DoTilingAndSet<8>,但未限制 rank 上限。当输入 rank > 8 时,delta = R - rank_为负,tiling->max_bro_shape[d + delta]、tiling->input_shapes[i][d + delta]等写入下标为负或越界,直接踩踏 tiling data(UB 内存),可导致 tiling 阶段崩溃或下游结果异常。dtype 校验缺失
InferDataTypeForXlog1py仅把input[0]的 dtype 原样透传给输出,未校验 dtype 是否属于{DT_FLOAT, DT_FLOAT16, DT_BF16},也未校验 x、y、z 之间 dtype 是否一致。GetShapeInfo()仅读取input[0]的 dtype 决定dtype_size_/phys_nodes_,未校验input[1]与输出 dtype。广播兼容性未校验
PadAndSqueeze()对每个维度直接取 max,非广播兼容的 shape(如[2,3]与[2,4])不会报错,会按错误的 max 形状继续执行,产生错误结果。FLOAT32 kernel 输出缓冲区未初始化
ProcessFP32()在调用CallXlog1pyVF前未初始化输出 UB(B_Z)。当count不是 VL 整数倍时,尾部的 lane 残留上一次迭代的脏数据,存在计算结果不确定 / 精度不达标的风险。ascend950 binary 配置 bin_filename 错误
op_host/config/ascend950/xlog1py_binary.json中 float16/float32/bfloat16 三条配置的bin_filename使用了语义化名称(Xlog1py_FLOAT16/Xlog1py_FLOAT32/Xlog1py_BF16),未使用 kernel 编译产物的哈希命名(如Xlog1py_c602838c14701b23ff1861c82ff8afc9),导致 ascend950 上 kernel bin 匹配/加载失败。文档维度说明错误
docs/aclnnXlog1py.md/aclnnXlog1py_en.md中输出 z 的维度写为1-8,与实现及约束说明(0 维标量/空 Tensor 场景支持 0-8 维)不一致。二、环境信息 (可选)
950
三、重现步骤 (可选)
Xlog1py的 ops-math 算子包,在 ascend950 上通过 aclnn 接口aclnnXlog1py调用。[1,2,3,4,5,6,7,8,9];[2,3]、y 为[2,4];[1,1,1000];四、预期结果 (可选)
GRAPH_FAILED,aclnn 返回ACLNN_ERR_PARAM_INVALID(161002),不得发生越界写。{FLOAT, FLOAT16, BF16}或 x/y/z dtype 不一致时,应在 tiling/InferDataType 阶段明确报错。💡 备注(选填)