Closed
fix: harden。Relu6Grad and SGD validation and test references #13276
raoliang_sacAdd on 21 days agoClosed at 18 days ago
fix: harden。Relu6Grad and SGD validation and test references #13276
Closed
raoliang_sacAdd on 21 days agoClosed at 18 days ago
raoliang_sac
raoliang_sacCollaborators
21 days ago

描述

依据Relu6Grad、SGD质量看板和主线实测加固两个算子。

  • Relu6Grad:InferShape补充两输入rank上限和已知维广播关系校验;InferDataType补充支持集合校验,并为类型不一致提供结构化诊断。
  • SGD:InferShape检查非空输入、learning_rate/momentum单元素约束及gradient/accum/stat同形状关系,保留动态维度和动态rank;InferDataType检查全部六输入类型一致性。Tiling在维度乘法前检查int64溢出,阻断已复现的超界元数据放行。
  • SGD golden按公式先合并Nesterov更新方向,再乘学习率,避免±Inf被展开式改成NaN;保留float64 CPU参考计算,同时注册SGD和sgd。
  • SGD示例保留主线的std::to_string节点名拼接修复,补充c_str接口兼容和DumpGraph返回检查;解决与主线同一位置的冲突。
  • 按仓内ST规则为两个算子各补一份CSV、各6个关键用例,覆盖FLOAT16、FLOAT、BFLOAT16及主要分支。最大Tensor分别33、3713个元素;每个算子仅一份同表头CSV,不依赖外部数据文件。

本PR未修改数值Kernel计算。公共DFX标量编译异常已反馈至asc-devkit Issue #1977,请相关维护人员确认处理,本PR不包含编译工具修改。

关联的Issue

https://gitcode.com/cann/ops-nn/issues/7871

测试

本次本地CI受测提交:734fc4a0f55ee67d657efc8ad79805e91783e37d;基于本轮从主仓fetch的master 38c4bfb26461bf4b4f012e47ff32b4f7f6b5cb01。原PR已为单提交,本轮保留备份后rebase,无冲突;最终相对该master为一个提交。Relu6Grad、SGD两个目录的文件内容与rebase前的264b14882d1de3b4f8f7e9d0273f420a90056372完全一致。

  • 本地CI使用指定统一入口/workspace/CI-skills/ci_local_check.sh,完整PR静态检查与定向检查均通过;仅选择relu6_grad、sgd,未运行全仓CI。
  • Ascend 950:定向pkg构建、Host UT 75项、Graph UT ASan 6项通过。
  • Ascend 910B(A2):定向pkg构建、Host UT 32项、Graph UT ASan 6项通过。两次ASan均确认实际编译和可执行文件已插桩,各实际执行6项、0跳过/禁用。
  • 全PR pre-commit、独立OAT、Markdown链接、示例SKIP退出约定、golden Python语法、Check_Example、SGD GEIR示例语法检查通过。该示例语法检查不代表本轮上板运行。
  • 两平台opkernel UT构建命令均成功;两个算子没有Kernel UT测例,不计为Kernel用例执行。
  • 本轮两个平台串行执行,构建有效并行度不超过8。本地CI没有新增NPU/TTK执行。

以下构建安装、上板和TTK验收在rebase前提交a560703f38fee6447367f8df9092d569bd9e5873完成;本轮未改变两个算子的文件内容,保留该次包哈希与原始验证记录,不将历史上板结果表述为本轮重新执行:

  • 使用任务内独立CANN 9.3.0(20261028_000328247),修改侧移除此前实验性DFX补丁,恢复原版编译工具;重新构建并安装两个算子的定向包。包SHA256:afdb7dea54dede9c1a7097f68ad9ea0c415ae4c828ac64dd793fb1004e5fa4c4。
  • Host UT 75项、Graph UT 6项,共81项通过;SGD golden的2个单测方法通过,包含6组非有限值子场景及有限值回归。
  • 仓内ST:Relu6Grad 6例、SGD 6例,静态源码、动态源码、release binary共36种配置全部通过,binary均匹配,精度和内存检查通过。保持cross_check L1,实际使用A100 Torch参考端。
  • 独立读取原始输出:Relu6Grad全部18种配置的213个元素符合选择/广播语义;SGD Nesterov/Inf三种配置及CPU golden的负Inf符号正确。
  • 冲突涉及的最终原文SGD示例重新编译并上板,动量0.9和0两条分支均通过,parameters、accum、stat全部360个值独立核对通过。该源文件与之前已验证版本逐字一致,保留了双方有效修复。
  • 新CSV通过字段、dtype、shape/广播、属性关系、用例数、最大元素数及可移植性检查;路径符合仓库ST自动发现规则。
  • 环境:Ascend950PR_9579,驱动25.7.rc1.10,TTK提交92496503b70e2e05892d15dd5b78d1f80eae77df;全部TTK显式--pc=1且串行执行,构建不超过8并行。

历史扩展验证还包括原失败用例、GEIR边界及受控拒绝等;这些记录保留原受测版本和环境,与本轮统一本地CI分开记录。此前30个0D标量用例、90种配置的通过结果使用了DFX候选处理,不代表原版CANN已解决该外部编译问题;该问题仍由Issue #1977跟踪,未通过缩窄算子文档能力来规避。

文档更新

  • Relu6Grad README清理不可用的DSL引用;参数表改为Markdown并逐单元格保留全部内容,整理产品表、调用表及列表空行。
  • SGD README在Ascend 950PR&950DT系列产品约束下补充ND连续布局责任,纠正输出必然与输入共享内存的过度承诺,明确读取图输出,并整理产品表格式。
  • 已按更新后的文档指引检查:完整产品支持、参数能力并集和逐产品约束保留;产品差异使用已有约束说明内的无序列表。没有新增源码范围声明、内部插件/UT用户入口或重复编译章节。

类型标签

AI/Agent生成声明

likedislike
The current Pull Request has been closed by raoliang_sac.
raoliang_sacraoliang_sacCollaborators
21 days ago Created pull request, commit 893f2fe3
raoliang_sacraoliang_sacCollaborators
21 days ago Modify description of pull request
CANN-robotCANN-robotCollaborators
21 days ago Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
21 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

⚠️ This PR does not yet meet the following requirements:lgtm (requires ≥ 2 person(s) per module)、approve (requires ≥ 1 person(s) per module)

Module Approval Details

module lgtm status approve status
*/*/README.md ❌ (0/2)(You can also ask: 胡碧霞, 於欣洁, 曾娟, 钱泽洪, 苏跃明) ❌ (0/1)(You can also ask: 陈娇, 杜慧萍, 冯英, 蔡雯雯, 杨露)
*/*/op_host/*_def.cpp ❌ (0/2)(You can also ask: 钱泽洪, 唐玮玮, 陈展熹, 汤平川, 上官秦南) ❌ (0/1)(You can also ask: 王永光, 汤磊)
activation ❌ (0/2)(You can also ask: 任如海, 黄迪, 陈兴宇, 查建青, 范其瑞) ❌ (0/1)(You can also ask: 杨东, 陈昊文, 汤平川, 任如海, 刘杰)
optim ❌ (0/2)(You can also ask: 杨阳, 陈风, 范其瑞, 陈展熹, 王星) ❌ (0/1)(You can also ask: 杨东, 苏跃明, 陈展熹, 上官秦南, 王星)

💡 Tip:

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

CLA Signature Pass

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

likedislike
CANN-robotCANN-robotCollaborators
21 days ago Set zengjuan,u010470851,chenfeng61,chaotang233,kevin_huang1234,crystalhu,yu-xinjie62,yangyang016,fanqirui,gitee-duhuiping,wangrui_,renruhai,su-yueming,zhajianqing123,tang-lei01,yourealize,chenqi317,wang-xing001,liubo75,tangweiwei2,gitcode-chenjiao,chenxingyu18,liujie12345678,east_yang,pingchuantang,Chen_HaoWen,qianzehong,wangyongguang,fengying555682,caiwenwen,yanglu-1 as approver
16 event messages are collapsed here。 See more
raoliang_sacraoliang_sacCollaborators
19 days ago Modify description of pull request
raoliang_sac
raoliang_sacCollaborators
19 days ago Comments:

compile

likedislike
raoliang_sacraoliang_sacCollaborators
19 days ago Pre merge succeeded (commit_id: 92498ba07cef593b223b69460da7e79590b5f50e)
CANN-robot
CANN-robotCollaborators
19 days ago Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
19 days ago Added label: ci-pipeline-running
6 event messages are collapsed here。 See more
CANN-robotCANN-robotCollaborators
19 days ago Removed label: ci-pipeline-passed
CANN-robot
CANN-robotCollaborators
19 days ago Comments:

Notification

This pull request has been changed(code update) or closed, so removes the following label(s): ci-pipeline-passed.

likedislike
CANN-robotCANN-robotCollaborators
19 days ago Added label: cann-cla/yes
raoliang_sacraoliang_sacCollaborators
19 days ago Modify description of pull request
raoliang_sac
raoliang_sacCollaborators
19 days ago Comments:

compile

likedislike
raoliang_sacraoliang_sacCollaborators
19 days ago Pre merge succeeded (commit_id: 90d968acc3dc523269a4838fb3ba6899bde5738b)
CANN-robot
CANN-robotCollaborators
19 days ago Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
19 days ago Added label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
19 days ago Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
19 days ago Added label: ci-pipeline-passed
raoliang_sacraoliang_sacCollaborators
18 days ago Change title to "fix: harden。Relu6Grad and SGD validation and test references", originally titled "fix: harden Relu6Grad and SGD validation and test references".
raoliang_sacraoliang_sacCollaborators
18 days ago Close pull request