Closed
[Bug-Report|缺陷反馈]: heaviside算子tiling缺少入参/dtype校验与溢出防护,静态检查发现问题 #8397
tan_xinAdd on  12 days agoClosed at  12 days ago
tan_xin
tan_xinCollaborators
12 days ago Create

Describe the current behavior / 问题描述 (Mandatory / 必填)

heaviside 算子存在多处静态检查发现的问题:

  1. tiling 侧未校验 inputDesc/valuesDesc/shape/PlatformInfo/workspace/RawTilingData 空指针。
  2. 未校验 values 与 input 的 dtype 一致(values 支持与 input broadcast,但 dtype 必须一致)。
  3. CeilA2B 中 (a+b-1)/b 在 a 接近 INT64_MAX 时可能产生有符号溢出。
  4. GetShapeSize 返回 INT64_MIN 无效哨兵值未做防护;coreNum 为 0 场景未校验。
  5. 示例测试异常分支未释放 aclTensor / device 内存。
  6. 多个文件缺少文件末尾换行、存在行尾空格、存在未使用 import 等规范问题。

Environment Information / 环境信息 (Mandatory / 必填)

  • 昇腾硬件型号:ascend910b / ascend910_93 / ascend950 / ascend350 / kirinx90 / kirin9030(以 heaviside_def.cpp 注册为准)
  • CANN 版本:CANN 社区版
  • Python 版本:用于 UT 数据生成脚本(gen_data.py / compare_data.py)

Steps to reproduce the issue / 重现步骤 (Mandatory / 必填)

  1. 构造 values 与 input dtype 不一致的用例,观察 tiling 是否报错。
  2. 构造极端大 shape(接近 INT64_MAX)触发 CeilA2B 计算。
  3. 构造 tiling context 空指针(input desc / shape / platform / workspace)场景。
  4. 运行 pre-commit / 静态检查扫描文件末尾换行与行尾空格及未使用 import。

Describe the expected behavior / 预期结果 (Mandatory / 必填)

  1. values 与 input dtype 不一致时返回 GRAPH_FAILED。
  2. CeilA2B 不产生有符号溢出,结果正确。
  3. 空指针场景安全返回 GRAPH_FAILED 并打印错误日志。
  4. 文件末尾换行、无行尾空格、无未使用 import 等静态检查通过。

静态检查工具(如 pre-commit)报告:missing newline at end of file、trailing whitespace、unused import 等提示;tiling/示例在高风险输入下缺少错误返回。

Special notes for this issue/备注 (Optional / 选填)

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

likedislike
tan_xintan_xinCollaborators
12 days ago Added label: bug-report
tan_xin
tan_xinCollaborators
12 days ago Comments:

/assign @tan_xin

likedislike
CANN-robotCANN-robotCollaborators
12 days ago Assign tan_xin as responsible person
CANN-robotCANN-robotCollaborators
12 days ago Close issue
CANN-robotCANN-robotCollaborators
12 days ago changed custom state from 待办的 to 已完成
CANN-robotCANN-robotCollaborators
12 days ago Added label: resolved