Merged
fix(xlogy): Tiling入口补输入dtype一致性校验与rank上界校验 #7110
fix(xlogy): Tiling入口补输入dtype一致性校验与rank上界校验 #7110
Merged
zhaoxinmengAdd on 9 days ago
zhaoxinmengCollaborators
9 days ago

描述

为 Xlogy 算子 Tiling 入口补充两道参数校验(静态扫描 CODE.04/1 与 GEIR.07/1 的 tiling 侧整改),并补齐 Tiling UT,共 2 个文件(+204 行):

  • 输入dtype一致性校验:GetShapeInfo 补 x1/x2 dtype 一致性校验,不一致返回 GRAPH_FAILED(OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON,对齐 add_v2 同款写法),兑现 DESIGN.md 承诺与 README 约束
  • rank上界校验:rank>8 返回 GRAPH_FAILED(kMaxRank 常量,OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON),消除 delta = R - rank_ 为负时 max_bro_shape 等以负下标写 TilingData、split.axis 错位的静态隐患
  • 新增 Tiling UT:tests/ut/op_host/arch35/test_xlogy_tiling_arch35.cpp 8 个用例(dtype 混合拒绝×2、rank 越界拒绝×2、正常成功×3、不支持 dtype 拒绝×1),填补该算子无 tiling UT 的空白

关联的Issue

#4549

测试

  • Tiling UT:13/13 全 PASS(新增 8 个 + infershape 回归 5 个)
  • TTK GEIR 通路实测(Ascend 950PR):
    • 默认模式(const + JIT编译):rank>8 被 APT 编译层 RANK_LIMIT=8 拦截(E80012)
    • -b release -d true(binary复用,ge.jit_compile=0):APT 拦截被绕过,rank=9 直达 Tiling,由本次新增校验拦截(EZ0012: input rank must be within [0, 8])——证明该校验为 binary 复用模式下的实际必需防线
  • L0 功能精度用例 49/49 全 PASS(新校验不影响正常输入)
  • 完整构建 0 error,本地 pre-commit 全过(clang-format/OAT)

文档更新

无(纯代码与 UT)

类型标签

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for zhaoxinmeng's contribution.)
ZzhaoxinmengCollaborators
9 days ago Created pull request, commit 6d9e4a4d
ZzhaoxinmengCollaborators
9 days ago Associated issue: [Documentation|文档反馈]: Xlogy算子README调用说明缺失与aclnn接口文档dtype声明/公式语义/样例健壮性问题
atomgit-bot
atomgit-bot
9 days ago Comments:

变更摘要

本 PR 针对 xlogy 算子 Tiling 入口(XlogyTiling::GetShapeInfo)补充两道参数校验,属于静态扫描 GEIR.07/1 与 CODE.04/1 的代码侧整改,仅改动 math/xlogy/op_host/arch35/xlogy_tiling_arch35.cpp 一个文件。变更在读取输入描述后新增输入 dtype 一致性校验,并在计算广播后 rank_ 后新增 rank 上界校验,使不满足约束的输入在 tiling 阶段即返回 GRAPH_FAILED,与 README/DESIGN.md 中“x1 与 x2 数据类型必须相同”的约束以及 8 维模板支持范围保持一致。

主要改动

  • 新增最大 rank 常量: 定义 kMaxRank = 8,作为 RANK_8D 模板支持的最大 rank 上界,供校验逻辑引用。
  • 输入 dtype 一致性校验: 在 GetShapeInfo 中获取第 1 个输入描述并做空指针校验,比较 x1 与 x2 的 GetDataType(),不一致时通过 OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON 输出两者实际 dtype 并返回 GRAPH_FAILED。
  • rank 上界校验: 在 PadAndSqueeze 计算得到 max_bro_shape_ 与 rank_ 之后判断 rank_ > kMaxRank,超限时通过 OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON 报出实际 rank 与 [0, 8] 约束并返回 GRAPH_FAILED,避免后续以负下标写入 TilingData。

🧩 本次 Review 已使用自定义 Skill:

likedislike
Incorrect?
atomgit-bot
atomgit-bot
9 days ago Comments:

代码审查

✅ 未发现问题


🧩 本次 Review 已使用自定义 Skill:

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
9 days ago Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
9 days ago Comments:

Thanks for your pull-request.
The full list of commands accepted by me can be found at here.
You can get sig-info at here.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.


PR Approval Progress

✅ Congratulations! All modules have met the lgtm and approve requirements.

Module Approval Details

module lgtm status approve status
repo-cann/ops-math ✅ xuejinghui, 顾宝成 (2/2) ✅ 顾宝成, xuejinghui (2/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

zhaoxinmeng, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
CANN-robotCANN-robotCollaborators
9 days ago Set yue-ma,zhou-qilong,wangrui_,rxtfeng,loov1,zhangzijie,jia0liang,zl_hw,songkai111,chenxingyu18,pingchuantang,llimwang,gubaocheng,andong_hw,xuejinghui,onanfield,zhanw_coding,jiangjiawei,clinglai0517 as approver
8 event messages are collapsed here。 See more
ZzhaoxinmengCollaborators
8 days ago Modify description of pull request
zhaoxinmengCollaborators
8 days ago Comments:

compile

likedislike
ZzhaoxinmengCollaborators
8 days ago Pre merge succeeded (commit_id: a5e8b080972964ab0c9f2ea468eb1613bcde5963)
CANN-robot
CANN-robotCollaborators
8 days ago Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
8 days ago Added label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
8 days ago Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
8 days ago Added label: ci-pipeline-failed
CANN-robot
CANN-robotCollaborators
8 days ago Comments:

流水线分析报告 — ops-math run#6778

流水线: https://gitcode.com/CANN/ops-math/actions/runs/191a7eb85ed6411baa95c24da50677ea | PR#7110 | 2026-11-05 16:56:56 ~ 2026-11-05 17:04:08 | 失败 Job 1 个

定界结论: 代码问题 / 代码检查错误(clang-format + OAT 许可证头)
  • 失败类型: 代码问题
  • 根因: CodeCheck_precommit 中两项 pre-commit 检查不通过
    1. clang-format: 2 个文件被格式化工具判定需改动
    2. OAT Compliance Check: 1 个文件 License Header 不合规
  • 处置建议: 通知 PR 提交者本地修复后重新推送,参考 本地执行 pre-commit 指导
  • 排除项: 其余 pre-commit 钩子(trim trailing whitespace、fix end of files、check yaml、large files、merge conflicts、private key、codespell)均 Passed/Skipped;无平台/环境类错误

失败根因分析

根因 #1: 代码问题 / 代码检查错误 — clang-format 格式不符
  • 判据: pre-commit hook clang-format Failed,files were modified by this hook
  • 定位步骤: 3_precommit.log
  • 影响 Job: CodeCheck_precommit
  • 根因证据(日志原文):
clang-format.............................................................Failed
- hook id: clang-format
- files were modified by this hook

Formatting [1/2] math/xlogy/op_host/arch35/xlogy_tiling_arch35.cpp
Formatting [2/2] math/xlogy/tests/ut/op_host/arch35/test_xlogy_tiling_arch35.cpp
  • 修复: pre-commit run clang-format --files math/xlogy/op_host/arch35/xlogy_tiling_arch35.cpp math/xlogy/tests/ut/op_host/arch35/test_xlogy_tiling_arch35.cpp,提交格式化结果
根因 #2: 代码问题 / 代码检查错误 — OAT License Header Invalid
  • 判据: pre-commit hook oat-check exit code 1,License Header Invalid Total Count: 1
  • 定位步骤: 3_precommit.log
  • 影响 Job: CodeCheck_precommit
  • 根因证据(日志原文):
OAT Compliance Check.....................................................Failed
- hook id: oat-check
- exit code: 1

[OAT] Found 1 compliance issue(s):
  - Invalid File Type:       0
  - License Header Invalid:  1
Name:	License Header Invalid	Content:	InvalidLicense	Line:	0	Project:	ops-math	File:	math/xlogy/tests/ut/op_host/arch35/test_xlogy_tiling_arch35.cpp
  • 修复: 为 math/xlogy/tests/ut/op_host/arch35/test_xlogy_tiling_arch35.cpp 补齐社区规范的 License Header,本地执行 pre-commit run oat-check 验证通过后提交
结构化定界摘要
[{"repo": "ops-math", "run_number": 6778, "Failed_Type": "代码问题", "Failed_Sub_Type": "代码检查错误", "Failed_Reason": "clang-format 检查不通过,xlogy_tiling_arch35.cpp 与 test_xlogy_tiling_arch35.cpp 需格式化", "evidence": "clang-format.............................................................Failed / - files were modified by this hook / Formatting [1/2] math/xlogy/op_host/arch35/xlogy_tiling_arch35.cpp", "suggestion": "本地执行 pre-commit run clang-format 并提交格式化结果", "jobs": "CodeCheck_precommit"},
{"repo": "ops-math", "run_number": 6778, "Failed_Type": "代码问题", "Failed_Sub_Type": "代码检查错误", "Failed_Reason": "OAT 检查发现 test_xlogy_tiling_arch35.cpp License Header Invalid", "evidence": "OAT Compliance Check.....Failed / License Header Invalid Total Count: 1 / File: math/xlogy/tests/ut/op_host/arch35/test_xlogy_tiling_arch35.cpp", "suggestion": "补齐该文件 License Header,本地执行 pre-commit run oat-check 验证", "jobs": "CodeCheck_precommit"}]

由门禁失败定界分析自动生成 | repo: ops-math | run: 191a7eb85ed6411baa95c24da50677ea | PR#7110

likedislike
ZzhaoxinmengCollaborators
8 days ago Pre merge succeeded (commit_id: a9c2c0e3d5aafbe5671bed4cfa279c9bd8d42b9f)
ZzhaoxinmengCollaborators
8 days ago Force-pushed 1 commits:c37a391b-fix(xlogy): Tiling入口补输入dtype一致性校验与rank上界校验
ZzhaoxinmengCollaborators
8 days ago Pre merge succeeded (commit_id: 8287b6d0ff846f0670b31c95889f6cd4d34aaec7)
CANN-robotCANN-robotCollaborators
8 days ago Removed label: cann-cla/yes
CANN-robotCANN-robotCollaborators
8 days ago Added label: cann-cla/yes
zhaoxinmengCollaborators
8 days ago Comments:

compile

likedislike
ZzhaoxinmengCollaborators
8 days ago Pre merge succeeded (commit_id: 3471a37922fddadbbba6da9ad4c937d74a3d6381)
CANN-robot
CANN-robotCollaborators
8 days ago Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
8 days ago Removed label: ci-pipeline-failed
CANN-robotCANN-robotCollaborators
8 days ago Added label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
8 days ago Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
8 days ago Added label: ci-pipeline-passed
ZzhaoxinmengCollaborators
8 days ago Modify description of pull request
xuejinghuiCollaborators
8 days ago Comments:

/approve

likedislike
CANN-robotCANN-robotCollaborators
8 days ago Added label: approved
gubaochengCollaborators
8 days ago Comments:

/lgtm
/approve
by agent

likedislike
CANN-robotCANN-robotCollaborators
8 days ago Added label: lgtm
CANN-robotCANN-robotCollaborators
8 days ago Closed associated issue
CANN-robotCANN-robotCollaborators
8 days ago Merged pull request