Closed
[Bug-Report|缺陷反馈]: TileWithAxis Tiling存在int64溢出与CeilDiv回绕,且标量输入超单缓冲容量时UB越界写 #3874
tan_xinAdd on  18 days agoClosed at  16 days ago
tan_xinCollaborators
18 days ago Create

一、问题描述 (必填)

TileWithAxis(Ascend950 AICore 实现)在极端 shape/属性下存在三类缺陷:

  1. Tiling 乘积链(outerDim/innerDim/rowLength/rowOutElements/totalOutElements)缺少 int64 溢出守卫,超大 shape 时乘积回绕导致错误分块;
  2. CeilDiv 在空张量(rowLength==0 / totalCount==0)场景存在除以 0 与负数回绕;
  3. 标量输入(rank=0)输出共 tiles 个元素,tiles 超过单缓冲容量(ubSize/2/dtypeSize)时发生 UB 越界写。

此外属性契约与 TBE/AICPU 基线不一致:axis 缺省 0(应为 1)、tiles 为可选(应为必选);且算子声明支持动态 shape 但缺少 InferShapeRange 输出范围推导。

二、环境信息 (可选)

• 昇腾硬件型号:Ascend950(DAV_3510)
• CANN版本: 9.0 系列
• 操作系统:Linux

三、重现步骤 (可选)

  1. 构造超大 shape(乘积接近 INT64_MAX)触发 Tiling 溢出回绕;
  2. 构造含 0 维的空张量触发 CeilDiv 除 0 / 负数回绕;
  3. rank=0 标量输入且 tiles 大于单缓冲可容纳元素数触发 UB 越界写。

四、预期结果 (可选)

  • 溢出/空张量场景返回 GRAPH_FAILED 或正确兜底分块,不产生错误 tiling;
  • 标量大 tiles 场景沿 tiles 维分块,无 UB 越界写;
  • axis 缺省 1、tiles 必选,与 TBE/AICPU 一致;
  • 动态 shape 下输出 range 可推导。

关联 PR:https://gitcode.com/cann/ops-math/pull/6647

likedislike
Ttan_xinCollaborators
18 days ago Added label: bug-report
tan_xinCollaborators
18 days ago Comments:

/assign @tan_xin

likedislike
CANN-robotCANN-robotCollaborators
18 days ago Assign tan_xin as responsible person
CANN-robotCANN-robotCollaborators
16 days ago Close issue
CANN-robotCANN-robotCollaborators
16 days ago Added label: resolved