已开启
fix: validate MatmulAbftVerify inputs and Crypto example #129
fix: validate MatmulAbftVerify inputs and Crypto example #129
已开启
jiyg创建于 9月30日
jiyg
jiyg
9月30日

描述

修复 MatmulAbftVerify 对输出/权重 shape、dtype 组合及 eMax 的输入校验,并修正文档约束;修正 Crypto 示例 API 名称、host buffer 长度检查及 IV 长度。Kernel 数学实现未修改。

关联的Issue

  • Fixes #56
  • Fixes #57
  • Fixes #58

测试

  • A3 / CANN 9.0:bash build.sh -u --ops=matmul_abft_verify -j8,Host 单测 23/23 通过,ACLNN 空指针测试 5/5 通过。
  • A3:bash build.sh --soc=ascend910_93 --ops=matmul_abft_verify,crypto -j8,二进制构建成功。
  • A3:Crypto 文档 C++ 示例通过 g++ -std=c++17 -fsyntax-only。
  • 未执行 ACLNN 端到端设备调用与量化性能基准;Crypto 示例依赖运行时 KMS/key 环境。当前验证不能作为端到端运行或性能无回退的实测结论。

文档更新

更新 MatmulAbftVerify 中英文 API 文档和 Crypto C++ 示例。

类型标签

likedislike
合并受阻
jiygjiyg
9月30日 创建了 pull request,commit 469ea109
jiygjiyg
9月30日 关联了issue:[Bug-Report|缺陷反馈]: MatmulAbftVerify 未校验 B/C/weight 的输入类型与 shape 合同,[Bug-Report|缺陷反馈]: MatmulAbftVerify 接受负 eMax,与文档参数校验约定不符,[Documentation|文档反馈]: Crypto 文档原型名称错误且示例 IV 缓冲区长度不足
atomgit-bot
atomgit-bot
9月30日 评论:

变更摘要

本次变更聚焦于修复 MatmulAbftVerify 算子对输入输出 shape、dtype 组合及 e_max 属性的校验逻辑,并补齐相应文档约束;同时调整了测试执行框架的返回码判定,使非 GRAPH_SUCCESS 的期望结果都能提前返回。Kernel 数学实现未改动。

主要改动

  • InferShape 增加 C 与 checksum_weight 校验: 在 matmul_abft_verify_infershape.cpp 中新增 IsShapeDimCompatible 辅助函数,并对输入 2(C)的 rank-2 及 [A.M, B.N] 维度、输入 3(checksum_weight)的一维 [B.N] 维度进行校验,不匹配时返回 GRAPH_PARAM_INVALID。
  • Tiling 增加 shape 与 dtype 校验: 在 matmul_abft_verify_tiling.cpp 中取用 C、checksum_weight 的 shape,校验其维度与 [A.M, B.N]、[B.N] 一致;同时新增各输入的 Desc 空指针检查,并约束 A/B/checksum_weight 类型一致、C 必须为 DT_FLOAT,A 仅支持 DT_FLOAT16/DT_BF16/DT_FLOAT。
  • e_max 属性取值校验: Tiling 中对 e_max 增加有限且非负的校验(std::isfinite(eMax) && eMax >= 0.0f),负数或非有限值返回 GRAPH_PARAM_INVALID。
  • 测试用例扩展: 新增 Infershape 与 Tiling 单测,覆盖 C/checksum_weight shape 不匹配、权重非一维、dtype 组合不符、C 非 FLOAT32、e_max 为负/非有限以及 e_max 为 0 被接受等场景,断言对应的 GRAPH_PARAM_INVALID 结果。
  • 测试框架返回码判定修正: tests/ut/common/tiling_case_executor.cpp 中将提前返回条件由 expectResult == ge::GRAPH_FAILED 改为 expectResult != ge::GRAPH_SUCCESS,使期望为 GRAPH_PARAM_INVALID 等结果时同样跳过后续校验。
likedislike
不准确?
atomgit-bot
atomgit-bot
9月30日 评论:

代码审查

✅ 未发现问题

likedislike
不准确?
CANN-robot
CANN-robot成员
9月30日 评论:

Hi @gcw_WJCkAUuk, welcome to submitting your first PR to ops-ras!

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
此处折叠了203条消息 查看更多
CANN-robot
CANN-robot成员
18 小时前 评论:

流水线任务触发成功
任务链接 [5e2be3b605724c8e914ffc8e3827d59e][流水线指导]

任务名称状态日志下载链接
codecheck ✅ SUCCESS >>>>>
SCA ✅ SUCCESS >>>>>
antipoison ✅ SUCCESS >>>>>
codecheck_Pr ✅ SUCCESS
codecheck_codestyle ✅ SUCCESS >>>>>
codecheck_precommit ✅ SUCCESS >>>>>

[2026-11-04 17:59:29]    CI执行结束

likedislike
CANN-robotCANN-robot成员
18 小时前 添加了label:api-check-pass
CANN-robotCANN-robot成员
18 小时前 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
18 小时前 添加了label:ci-pipeline-passed
jiyg
jiyg
18 小时前 评论:

@yu-xinjie62 @loov1 @zhou-qilong 您好,!129 已更新到当前 head 551f9ae73f961f9f32b8b84127bc4dc7c7153e35,根据 #56/#57 反馈补充 compRow 实际输出 shape/长度校验、长度不足 UT,并完善 eMax 有限且非负的检查;同时拆分长函数并修复格式检查问题。

该 head 的 GitCode /compile 已结束:Compile 各目标、Host UT/API_Check 成功;CodeCheck、CodeStyle、SCA、antipoison、codecheck_Pr、precommit 均成功;PreSmoke A2 成功。git diff --check 通过。本机 macOS 未安装 CANN/Bisheng,因此没有声称完成本地 C++ 构建或设备回归。上述结果不等于修复后 910B3+CANN 9.2 的完整 ACLNN/HCCL 端到端验收;若该项是合入门禁,请提供对应验收入口/环境。

请评审最新增量,并按 ops-ras 模块流程补齐 2 个 LGTM 和 1 个 approve;也请确认是否仍要求修复后设备端到端验收。

likedislike