Closed
[Bug-Report|缺陷反馈]: 补充 InferDataType RT2.0 推导并新增 UT 看护 #4640
fitZepHYrAdd on  6 days agoClosed at  3 days ago
fitZepHYr
fitZepHYrCollaborators
6 days ago Create

一、问题描述 (必填)

CdistGrad 的 Host 侧仅注册了 InferShape,未注册 RT2.0 的 InferDataType,导致算子在 RT2.0 流程中无法自行推导输出 y 的数据类型。参考 math/abs/op_host/abs_infershape.cpp 中 InferDataType 的 RT2.0 内联注册写法,为 CdistGrad 补充输出 dtype 推导,并新增 UT 看护。

二、环境信息 (可选)

  • 昇腾硬件型号:Ascend 910B(UT 构建 --soc=ascend910b)
  • CANN版本:本次改动未涉及,PR 中未说明
  • 操作系统:本次改动未涉及,PR 中未说明
  • 其他相关软件版本:op_host UT(gtest)

三、重现步骤 (可选)

  1. 查看 math/cdist_grad/op_host/cdist_grad_infershape.cpp,注册链只有 IMPL_OP_INFERSHAPE(CdistGrad).InferShape(InferShape4CdistGrad);,没有 InferDataType。
  2. 在 RT2.0 流程中执行 CdistGrad,算子未注册 infer_datatype,输出 y 的 dtype 无法由算子注册信息推导。
  3. 构建并执行 op_host UT:bash build.sh -u --ophost --soc=ascend910b --ops=cdist_grad --gtest_filter='CdistGradInfershape.*',新增的 InferDataType 用例可在修复前复现该缺失。

四、预期结果 (可选)

  • CdistGrad 注册 InferDataType,输出 y 的 dtype 与输入 grad 保持一致(grad / x1 / x2 / cdist 要求同 dtype)。
  • 新增 4 例 InferDataType UT:float32、float16、bfloat16,以及输入 dtype 不一致时输出仍取 grad。
  • op_host UT 共 11/11 通过(7 例原 InferShape 用例 + 4 例新增 InferDataType 用例)。

💡 备注(选填)

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

likedislike
fitZepHYrfitZepHYrCollaborators
6 days ago Added label: bug-report
fitZepHYrfitZepHYrCollaborators
6 days ago Assign VoyageZhou as responsible person
fitZepHYrfitZepHYrCollaborators
6 days ago Modify description of issue
CANN-robotCANN-robotCollaborators
3 days ago Close issue
CANN-robotCANN-robotCollaborators
3 days ago changed custom state from 待办的 to 已完成
CANN-robotCANN-robotCollaborators
3 days ago Added label: resolved