Closed
refactor: finalize native inference migration after July quality fixes #12383
raoliang_sacAdd on 21 days agoClosed at 20 days ago
refactor: finalize native inference migration after July quality fixes #12383
Closed
raoliang_sacAdd on 21 days agoClosed at 20 days ago
raoliang_sacCollaborators
21 days ago

描述

本PR全部修改和提交历史已合并到https://gitcode.com/cann/ops-nn/pull/12376,统一提交`ee32add3c8cab98119bf26641a87b2e887686367`,完整文件树与本PR当前HEAD`c8a51b20e329c8c19234fdc42079d4858e1c7329`一致。按同仓修改统一交付的要求关闭本PR,不再单独合入。正式canndev配套包集成验证仍未完成,待办转由#12376及Issue #6956继续跟进。

以下保留本PR合并前的修改与验证记录,作为历史证据。

本PR接手完整推导注册迁移,基于July质量加固PR #12376的最终兼容版本叠加清理。当前与目标master比较会包含该前置PR的改动;前置合入后,本PR新增生产差异仅为移除Relu6Grad的V1兼容广播入口,保留op_graph中的V2 dtype推导。INTrainingReduceV2、L2Normalize的原生V1删除、L2Normalize图Verify、Relu6Grad dtype迁移及质量修复均由前置PR交付。

本PR尚不具备普通正式包集成验证结论,暂不能单独合入。 当前CANN包未包含canndev隔离时,去掉Relu6Grad兼容入口会使合法交叉广播失败;前置质量PR保留入口,避免该回归。L2Normalize的VERIFY_FUNC_REG继续保留,它负责原始声明校验,不是应删除的V1 InferShape。

关联的Issue

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

测试

2026-10-21文档精简提交c8a51b20e329c8c19234fdc42079d4858e1c7329:完成本次范围的README检查、链接/调用表渲染、diff及提交钩子检查;确认相对上一提交仅README变化,未重跑NPU、TTK或构建。此前设备验证仍归属原受测提交。

  • 当前分支:c8a51b20e329c8c19234fdc42079d4858e1c7329。其推导生产源码与已构建/验证候选6aa5e5a6c01128a2dd505734f0c218e5623ce411逐文件相同;承接前置PR新增的L2Normalize示例数值检查及独立CMake配置,未把前置普通环境结果冒充本分支结果。
  • July重新执行:NN四算子21条用例、静态/动态42次诊断执行通过(INTrainingReduceV2 6、L2Normalize 7、Relu6Grad 6、NormalizeBBox 2);另外MulNoNan 6条/12次由数学仓候选覆盖。L2两条空Tensor只计执行/shape覆盖。
  • 使用July独立CANN_Revise、TTK 92496503b70e2e05892d15dd5b78d1f80eae77df、本仓golden及校验哈希的冻结输入,--pc=1,Promote/stat_rel_err。诊断通过LD_PRELOAD抑制旧V1注册,V1进入数为0并记录所选回调来源;该诊断不等于正式canndev产品包集成验证,也不能仅凭环境变量推断旧V2注册全部被移除。
  • 普通环境探针:INTrainingReduceV2 ND通过;Relu6Grad合法交叉广播失败(E90003/Template constraint),所以前置质量版本继续保留兼容入口。
  • canndev正式configure在July复现缺少alog及opensdk内部依赖;未构建、安装正式隔离包,仍需无诊断屏蔽的正式集成验证。
  • 原接手提交3b973bc51a95e6d36b964656a28536b74957e079的217条NN Host/Graph UT、40条/80次另一TTK版本诊断及另一设备记录作为历史证据保留,未在当前提交重跑。INTrainingReduceV2的另一设备基线/修改版均在Tiling报芯片不支持,未关闭。
  • 未运行全量本地CI或性能测试。没有声明当前完整候选的GE示例已在无屏蔽环境通过。

文档更新

Relu6Grad、L2Normalize README删除多余的编译运行段落,保留原有调用表、示例和算子IR链接。示例源码、CMake配置及算子实现未变。

继承前置PR的产品差异及示例说明,仅将Relu6Grad实现表描述对齐最终V2入口。保留产品支持、dtype/format并集和有效说明。文档与示例新增项的普通环境验证归前置PR的受测提交。

类型标签

AI/Agent生成声明

likedislike
The current Pull Request has been closed by raoliang_sac.
Rraoliang_sacCollaborators
21 days ago Created pull request, commit 5412687d
atomgit-bot
atomgit-bot
21 days ago Comments:

变更摘要

本 PR 将 L2Normalize 算子的图推导从自定义 V1 注册迁移到 runtime 2.0。原因是该算子同时注册了 V1 与 V2 推导,Ascend 950 的 GE 图编译会优先调用 V1,导致仅有 V2 实现时无法保证图编译使用它。改动删除了 op_graph/l2_normalize_graph_infer.cpp 中的 V1 注册(COMMON_INFER_FUNC_REG)及 L2NormalizeGraphInferFunc 实现,把输出 shape 一致性、ND 格式检查迁移到 op_host/l2_normalize_infershape.cpp 的 V2 InferShape,把输出 dtype 一致性检查保留在 V2 InferDataType(InferDataTypeForL2Normalize)中,并补充了 UT 用例。

主要改动

  • 删除自定义 V1 注册与实现:l2_normalize_graph_infer.cpp 移除 COMMON_INFER_FUNC_REG(L2Normalize, ...) 及 L2NormalizeGraphInferFunc,不再占据同名 V1 槽位,避免与 canndev 内置 V1 推导的调度冲突。
  • V2 InferDataType 承接 dtype 一致性校验:InferDataTypeForL2Normalize 增加 nullptr 判空,并在声明输出 dtype 非 DT_UNDEFINED 且非 DT_MAX 时校验其与输入 dtype 一致,否则返回 GRAPH_FAILED,随后恒等设置 y.dtype = x.dtype。
  • V2 InferShape 新增 shape 与 format 校验:InferShape4L2Normalize 新增 DeclaredShapeCompatible(未知秩/未声明跳过,逐维比对已知维)与 IsSupportedFormat(仅 FORMAT_ND、FORMAT_RESERVED)两个辅助函数,对输入/输出 format 及声明输出 shape 与输入的一致性进行检查。
  • UT 覆盖迁移后的校验逻辑:新增 test_l2_normalize_graph_infer_pass.cpp 覆盖 dtype 透传、声明 dtype 冲突拒绝、空 context 拒绝;test_l2_normalize_infershape.cpp 扩展 RunInferShape 支持 format 参数并初始化输出 shape,新增声明 shape 冲突/兼容、未知秩与 ND format 拒绝等用例。

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

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

代码审查

✅ 未发现问题


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

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
21 days ago Added label: cann-cla/yes
Rraoliang_sacCollaborators
21 days ago Modify description of pull request
CANN-robot
CANN-robotCollaborators
21 days ago Comments:

CLA Signature Pass

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

likedislike
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_graph/*_proto.h ❌ (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: 陈兴宇, 王瑞, 陈昊文, 陈展熹, 任如海)
docs ❌ (0/2)(You can also ask: 冯英, 杨露, 范其瑞, 刘波, 曾娟) ❌ (0/1)(You can also ask: 陈娇, 杜慧萍, 冯英, 蔡雯雯, 杨露)
norm ❌ (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: 苏跃明, 王星, 汤平川, 钱泽洪, 陈展熹)
vfusion ❌ (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,chaotang233,kevin_huang1234,crystalhu,yangyang016,fanqirui,wangrui_,renruhai,su-yueming,zhajianqing123,yourealize,chenqi317,wang-xing001,liubo75,tangweiwei2,chenxingyu18,liujie12345678,pingchuantang,Chen_HaoWen,qianzehong as approver
17 event messages are collapsed here。 See more
CANN-robotCANN-robotCollaborators
21 days ago Set gitee-duhuiping,tang-lei01,gitcode-chenjiao,wangyongguang,fengying555682,caiwenwen,yanglu-1 as approver
ZhuXueDoc
21 days ago Comments:

🤖 AIDD 文档质量检测报告

PR #12383 的文档检测已全部完成。

📊 任务统计:共 5 个任务(✅ 5 完成 / ❌ 0 失败 / ⊘ 0 取消)
🐛 问题统计:共 134 个问题(致命 0 / 严重 1 / 一般 79 / 提示 54)

🔗 查看完整报告:点击进入平台报告
🔗 查看 PR 检测问题:点击查看问题列表

评论由 AIDD 自动生成,多次推送会增量更新本评论。

likedislike
Rraoliang_sacCollaborators
20 days ago Pre merge succeeded (commit_id: 2110afdfbf9c09aeeaf34485718e98d6d78ccc4e)
15 event messages are collapsed here。 See more
Rraoliang_sacCollaborators
20 days ago Modify description of pull request