Closed
[Bug-Report|缺陷反馈]: kl_div_loss_grad arch35 tiling 缺失 self 与 out shape 一致性校验,shape 不一致时未被拦截 #7726
chenfengAdd on  23 days agoClosed at  18 days ago
chenfeng
chenfengCollaborators
23 days ago Create

Describe the current behavior / 问题描述

kl_div_loss_grad 算子存在以下缺陷:

接口文档(loss/kl_div_loss_grad/docs/aclnnKlDivBackward.md)错误码 161002(ACLNN_ERR_PARAM_INVALID)中已约定「self的shape与out的shape不相同」时报参数非法,aclnn 层已有该校验;但 arch35 tiling 入口(loss/kl_div_loss_grad/op_host/arch35/kl_div_loss_grad_tiling.cpp 的 DoOpTiling)此前未对 self 与 out 的 shape 一致性做校验,shape 不一致的输入未被拦截,直接进入后续 tiling 流程。

Environment Information / 环境信息

  • 代码仓内部缺陷:位于 op_host/arch35 tiling 实现
  • 昇腾硬件型号:arch35 架构(改动位于 op_host/arch35 目录)
  • CANN 版本 / Python 版本:不适用(源码级缺陷)

Steps to reproduce the issue / 重现步骤

  1. 构造 self 与 out shape 不一致的输入(如 self=(2,1)、out=(2,4))调用 kl_div_loss_grad 算子(aclnnKlDivBackward)触发 arch35 tiling。
  2. 观察 tiling 阶段未按接口文档报 ACLNN_ERR_PARAM_INVALID(161002),shape 不一致的输入未被拦截。

Describe the expected behavior / 预期结果

tiling 阶段校验 self 与 out 的 storage shape 一致;不一致时输出 ACLNN_ERR_PARAM_INVALID_SHAPE 错误日志("The shape of parameter self must be the same as the shape of parameter out")并返回 GRAPH_FAILED,与接口文档错误码 161002 的约定对齐。

无运行日志,缺陷由接口文档与 arch35 tiling 实现比对发现,修复见关联 PR 的 diff。

Special notes for this issue/备注

  • 修复同步补齐测试与文档:UT 新增正/负向 shape 校验用例(kl_div_loss_grad_self_y_shape_mismatch_failed / kl_div_loss_grad_self_y_shape_equal_success)并适配 12 个过时正向用例;ST csv 17 行 self≠out 过时用例对齐;README out 参数补充「shape与self相同」及约束说明。
  • 关联 PR:https://gitcode.com/cann/ops-nn/pull/13085
likedislike
chenfengchenfengCollaborators
23 days ago Added label: bug-report
chenfeng
chenfengCollaborators
23 days ago Comments:

/assign @chenfeng61

likedislike
CANN-robotCANN-robotCollaborators
23 days ago Assign chenfeng61 as responsible person
chenfengchenfengCollaborators
23 days ago Associated pull request
CANN-robotCANN-robotCollaborators
18 days ago Close issue
CANN-robotCANN-robotCollaborators
18 days ago Added label: resolved