已合并
legacy日落-给一些算子增加InferDataTpye和Tiling日志 #4712
pan xiong创建于 15 天前
legacy日落-给一些算子增加InferDataTpye和Tiling日志 #4712
已合并
pan xiong创建于 15 天前
pan xiong
pan xiong
15 天前

描述

legacy日落-给一些算子增加InferDataTpye、Infershape打印outputshape和Tiling日志

关联的Issue

https://gitcode.com/cann/ops-math/issues/2801

测试

二级冒烟、本地通路验证完毕

文档更新

暂无文档更新

类型标签

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 pan xiong 的贡献)
pan xiongpan xiong
15 天前 创建了 pull request,commit 525d2963
atomgit-bot
atomgit-bot
15 天前 评论:

变更摘要

本 PR 主要围绕 legacy 日落 阶段的剩余算子做收尾改造:为一批转换类与数学类算子补齐数据类型推导能力,并统一补充日志输出。改动以 op_host 下的 infershapearch35 tiling 实现为主,通过新增 InferDataType 函数并注册到 IMPL_OP_INFERSHAPE(...) 链式调用中,使算子输出数据类型与输入保持一致;同时为多个算子新增/扩展输出 shape 与 TilingData 字段日志,新增两个梯度算子的 shape 推导实现,整体属于算子泛化与可观测性增强。

主要改动

  • 补齐剩余算子的 InferDataType 注册:为 BatchToSpaceDiagFlatDiagV2SliceLastDimSliceWithAxesSpaceToBatchSpaceToBatchNDTileWithAxisXdivyXlog1pyXlogy 等算子新增 InferDataType4Xxx 函数,并通过 InferShape(...).InferDataType(...) 注册,使输出数据类型继承输入数据类型。

  • 新增两个梯度算子的 shape 推导实现:新增 circular_pad_grad_infershape.cpppad_v3_grad_replication_infershape.cpp,根据输入 x 的 shape 与 paddings 常量计算输出 shape(减去各维 padding),并处理未知 rank/未知 paddings、校验 paddings 元素个数及输出维度非负,同时注册 InferDataTypeInputsDataDependency({INPUT_IDX_PADDINGS})

  • 统一补充 tiling 入口日志:在 BatchToSpaceCircularPadGradDiagFlatDiagV2PadV3GradReplicationSliceLastDimSliceWithAxesSpaceToBatchSpaceToBatchNDTileWithAxisDataCompareXdivyXlog1pyXlogy 等算子的 arch35 tiling 函数入口统一新增 OP_LOGD(..., "Begin the tiling process for Arch35 architecture")

  • 扩展 TilingData 与输出 shape 的详细日志:新增 LogTilingData 辅助函数或内联 OP_LOGI,打印如 DataCompareDiagV2TileWithAxisSpaceToBatchNDPadV3GradReplication 等算子的完整 TilingData 字段,并在各 infershape 中调用 Ops::Base::ToString 打印输出 shape。

  • 引入 util/shape_util.h 并整理代码:多个 infershape 文件新增 #include "util/shape_util.h" 以支持 shape 打印,同时清理部分文件的行尾换行符与末尾换行问题(如 slice_last_dim_infershape.cppdiag_v2_infershape.cpp)。

likedislike
atomgit-bot
atomgit-bot
15 天前 评论:

代码审查

✅ 未发现问题

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

Hi @pan_xiong, welcome to submitting your first PR to ops-math!

PR Merge Steps

1. CLA Signing

If the current PR label includes cann-cla/yes, it means you have signed the CLA and can proceed to the next step. If the label includes cann-cla/no, please sign the CLA first. If you have any questions, please refer to the FAQ.

2. CI Check

Please comment /compile to trigger the CI pipeline check. If the CI run is successful, the PR will be tagged with ci-pipeline-passed and you can proceed to the next step. If the CI run fails, the PR will be tagged with ci-pipeline-failed, please check the CI logs to fix the issues in the PR. If you have any questions, please refer to the FAQ.

3. Code Review

After CI passes, please refer to the PR Approval Progress and proactively @ the committers in the table to review the code. After approval, committers will comment /lgtm and /approve. Once the lgtm and approved labels are successfully added, the PR will be merged automatically.

likedislike
CANN-robotCANN-robot成员
15 天前 添加了label:cann-cla/no
此处折叠了62条消息 查看更多
CANN-robotCANN-robot成员
5 天前 添加了label:approved
andong_hw成员
5 天前 评论:

/lgtm
/approve

likedislike
CANN-robotCANN-robot成员
5 天前 添加了label:lgtm
CANN-robotCANN-robot成员
5 天前 关闭了关联的issue
CANN-robotCANN-robot成员
5 天前 合入了pull request