已关闭
[Bug-Report|缺陷反馈]: resize_v2_grad系列算子tiling中format校验误用GetOriginFormat导致图优化后校验失败 #761
chenfeng创建于  3 天前关闭于  2 天前
chenfeng
chenfeng成员
3 天前 创建

一、Describe the current behavior / 问题描述

resize_nearest_neighbor_v2_grad、resize_bilinear_v2_grad、resize_bicubic_v2_grad 三个算子的 tiling 阶段在读取输入/输出 tensor 的 format 时,使用了 GetOriginFormat() 而非 GetFormat().GetStorageFormat()

图优化后,张量的 origin format 可能被改写为 ND(例如 5D 折叠为 4D 等场景),而运行时真实的 storage format 仍为 NCHW 或 NHWC。此时 tiling 中的 format 校验(CheckFormatValid / CheckInOutDtypeFormat)会拿到 ND,导致:

  • format 校验失败(ND 不在允许的 NCHW/NHWC 格式列表中),算子执行报错;或
  • tiling 逻辑按 ND 误解 NCHW/NHWC 形状的 H/W/C 轴,产生错误的 tilingKey / blockNum。

二、Environment / 环境信息

  • 硬件架构:arch35(Ascend950)
  • 算子路径:image/resize_nearest_neighbor_v2_grad、image/resize_bilinear_v2_grad、image/resize_bicubic_v2_grad
  • 涉及文件:各算子 op_host/arch35/ 下的 tiling 实现

三、Steps to reproduce the issue / 重现步骤

  1. 构造 resize_v2_grad 系列算子的输入,使张量经过图优化后 origin format 为 ND、storage format 为 NCHW 或 NHWC。
  2. 执行算子 tiling。
  3. 观察 tiling 阶段 format 校验结果。

四、Describe the expected behavior / 预期结果

tiling 阶段应使用运行时 storage format(GetFormat().GetStorageFormat())进行 format 校验,而非 origin format(GetOriginFormat())。当 origin format 为 ND 但 storage format 为 NCHW/NHWC 时,format 校验应正常通过,tilingKey / blockNum 应基于真实排布正确计算。

五、Related log / screenshot / 日志 / 截图

修复涉及 3 个算子共 8 处 format 读取:

算子 文件 修改处数
resize_nearest_neighbor_v2_grad resize_nearest_neighbor_v2_grad_tiling_base.cpp 2(grads + y)
resize_bilinear_v2_grad resize_bilinear_v2_grad_tiling_arch35.cpp 3(grads + original_image + y)
resize_bicubic_v2_grad resize_bicubic_v2_grad_base_tiling_arch35.cpp 3(grads + original_image + y)

统一改法:GetOriginFormat()GetFormat().GetStorageFormat()

六、Special notes for this issue/备注

修复同时扩展了 UT 框架(tiling_context_faker.h / tiling_case_executor.cpp)以支持构造 origin≠storage 的测试场景,并新增 5 个回归用例覆盖 NCHW 和 NHWC 两条分支。

关联 PR:https://gitcode.com/cann/ops-cv/pull/1304

likedislike
chenfengchenfeng成员
3 天前 添加了label:bug-report
liu-weiliu-wei成员
3 天前 将 chenfeng61 设为负责人
chenfeng
chenfeng成员
3 天前 评论:

/assign @chenfeng61

likedislike
CANN-robot
CANN-robot成员
3 天前 评论:

Notice

This issue is already assigned to chenfeng61. Please do not assign repeatedly.

likedislike
CANN-robotCANN-robot成员
2 天前 关闭了 issue
CANN-robotCANN-robot成员
2 天前 添加了label:resolved