Closed
fix(mul_no_nan): 补齐推导校验并修正测试参考 #6971
raoliang_sacAdd on 9 days agoClosed at 7 days ago
fix(mul_no_nan): 补齐推导校验并修正测试参考 #6971
Closed
raoliang_sacAdd on 9 days agoClosed at 7 days ago
raoliang_sacCollaborators
9 days ago

描述

MulNoNan的Host推导会接受rank9及相同的非法dtype;测试参考还有两处缺口:用NumPy承担最终舍入,以及TF CPU参考无法处理一类合法六维广播。

  • InferShape先独立校验两个输入的rank上限,再复用原广播推导;InferDataType在op_graph校验FLOAT16/FLOAT/INT32/BF16合法域及同类型关系。标量、动态shape/rank和空Tensor语义保留。
  • 新增参数校验使用现有正式诊断宏,补充负向UT。
  • 参考结果通过Torch转换回物理dtype;原有TF TestSpec的golden改用FP64数学参考。TF CPU六维广播异常已用96元素的小用例复现,INT32也不属于TF原生MulNoNan输入域,采用组合参考的原因写在源码注释中。
  • GE示例增加--device-id=N,保留默认设备及单用例选择;新增一个8条小shape的ST CSV。

关联的Issue

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

测试

  • 950 Kernel:19条非空用例dyn/cst/bin通过,覆盖4种dtype、广播、特殊值、rank8和尾块;另6条次正规缩放binary用例及3条缩小六维广播的三种编译路径通过。
  • 950 GE:31/31通过,含4种dtype的标量、双方空及空/非空广播。主线包的代表性空Tensor/标量用例也已通过,因此保留原GE空Tensor实现。
  • 最终注册回调17/17符合预期,7条新增/关联负向诊断核对参数字段和单次首报;Host 28条、Graph 6条UT通过ASan,未启用泄漏检测。
  • CPU golden组件7项通过,含冻结TTK的E2E golden分派及物理dtype转换;此项不等同TensorFlow NPU E2E验证。
  • 最终C++样例27/27通过,列表+设备、单例+设备及两类非法参数均验证;A3存量包4种dtype的GE用例通过。
  • 标准预编译包构建/安装、安装内容核对、最终GE冒烟及pre-commit通过,构建并行度4。

直接Kernel的0D在线编译仍会在CANN代码生成的无初值reduce()处失败,已单独定位;本PR不宣称修复该编译器问题。GE和发布binary的标量路径已通过。

本轮评审澄清仅修改约束说明和TF测试注释。golden的Python AST与修改前一致,推导、Tiling、Kernel、CSV和示例未改;pre-commit、文档渲染/链接及示例源码哈希核对通过。回查A3原CANN 9.2.0参数校验源码,输入和原始shape的默认rank上限均为8;此项为源码核查,本轮未新增上板测试。

本地CI(2026-11-02):受测提交6f1e0471275f6f1f7d08232dd823636b4a1a5279,基线为本次从主仓拉取的master c47568d3b5d22b1570bfbaad40dc63681ff5ca30。已先squash为单提交并核对原基点下完整binary diff及Git tree不变,再rebase;range-diff一致、无冲突。统一入口/workspace/CI-skills/ci_local_check.sh通过,覆盖ascend950、ascend910b的定向编包与相关UT,完整pre-commit、隔离OAT、链接/SKIP契约和golden语法检查均通过。950的Host UT 28条、Graph UT 6条,A2的Host UT 13条、Graph UT 6条实际执行通过;GEIR示例syntax-only和package/Host UT的GE依赖检查通过。使用任务内CANN 9.3.0 C25B114,构建并行度4;本次未新增TTK/NPU ST,也不将本地通过表述为线上通过。

文档更新

产品差异移入已有约束列表,调用表只补充必要的设备选择参数。保留A2/A3支持:主线canndev配置中的dtype范围与本次校验一致,A3已实测;A2仅核查源码。不因内部TF插件和TestSpec存在而增加用户接口声明。

按评审意见澄清原有8维上限的通用适用范围,明确动态rank在运行时也须满足上限;将TF TestSpec的三种浮点类型与Kernel/GEIR原有的INT32支持区分开。仅修正这两处说明,产品支持和执行逻辑均未改变。

类型标签


本PR的全部8个变更文件已完整cherry-pick到PR !6947,统一评审合入。原提交6f1e0471275f6f1f7d08232dd823636b4a1a5279保留追溯;组合提交为af1eeea72c5c773ed3fb136d9ea75d3228b9d90d。本PR作为被替代的独立PR关闭,内容尚未据此视为已合入master,合入及线上CI状态以!6947为准。

likedislike
The current Pull Request has been closed by raoliang_sac.
Rraoliang_sacCollaborators
9 days ago Created pull request, commit c40c6988
Rraoliang_sacCollaborators
9 days ago Modify description of pull request
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

⚠️ 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: 宋恺, 冯彤, zhangzijie, xuejinghui, andong_hw) ❌ (0/1)(You can also ask: 杨露, 陈娇, 杜慧萍, 冯英, 蔡雯雯)
repo-cann/ops-math ❌ (0/2)(You can also ask: jiangjiawei, yue-ma, zhangzijie, 汤平川, clinglai0517) ❌ (0/1)(You can also ask: jiangjiawei, jia0liang, andong_hw, 顾宝成, xuejinghui)

💡 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
9 days ago Set yue-ma,zhou-qilong,gitee-duhuiping,wangrui_,rxtfeng,loov1,zhangzijie,jia0liang,zl_hw,songkai111,gitcode-chenjiao,chenxingyu18,pingchuantang,llimwang,gubaocheng,andong_hw,fengying555682,xuejinghui,onanfield,zhanw_coding,clinglai0517,caiwenwen,yanglu-1 as approver
CANN-robotCANN-robotCollaborators
9 days ago Set yue-ma,zhou-qilong,gitee-duhuiping,wangrui_,rxtfeng,loov1,zhangzijie,jia0liang,zl_hw,songkai111,gitcode-chenjiao,chenxingyu18,pingchuantang,llimwang,gubaocheng,andong_hw,fengying555682,xuejinghui,onanfield,zhanw_coding,clinglai0517,caiwenwen,yanglu-1 as approver
fanzhaoyun0018 days agoStart code review1
math/mul_no_nan/op_host/mul_no_nan_infershape.cpp
@@ -27,0 +29,4 @@
29+ const auto* shape = context->GetInputShape(i);
30+ OP_CHECK_NULL_WITH_CONTEXT(context, shape);
31+ OP_CHECK_IF(
32+ shape->GetDimNum() > MAX_INPUT_RANK,
fanzhaoyun0018 days agoComments:

[Major] rank≤8 校验对所有产品无条件生效,与 README 的 950 专属描述及“动态 rank”约束矛盾

新增的 InferShape 对 x1、x2 统一用 shape->GetDimNum() > 8 直接判失败,未做任何产品/SOC 区分。但 README 改动后仍把“维度数不超过 8”放在 <term>Ascend 950PR&950DT系列产品</term> 的产品差异条目下(L73-75),且原约束 L72 明确写“支持任意 NumPy 广播形态(含…跨 rank broadcast),支持动态 shape 与动态 rank”,暗示更高 rank 是合法的。
这样在非 950 产品上会把原本可接受的 rank>8 输入判为失败,属于行为回归且文档与代码不一致。建议:按 SOC 条件化该校验(仅 950 生效),或将该限制明确为全局限制并同步修正 README 的产品差异与“动态 rank”描述。

likedislike
fanzhaoyun0018 days agoStart code review1
math/mul_no_nan/op_graph/mul_no_nan_graph_infer.cpp
@@ -18,8 +18,16 @@ ge::graphStatus InferDataType4MulNoNan(gert::InferDataTypeContext* context)
1818 return ge::GRAPH_FAILED;
1919 }
2020 const auto dtype = context->GetInputDataType(0);
21+ OP_CHECK_IF(dtype != ge::DT_FLOAT16 && dtype != ge::DT_FLOAT && dtype != ge::DT_INT32 && dtype != ge::DT_BF16,
fanzhaoyun0018 days agoComments:

[Major] InferDataType 白名单新增 int32,但与“仅支持三种浮点类型”的说明及缺失的 kernel/tiling 适配不一致

新的 dtype 白名单显式放行 DT_INT32,同时新增的 ST CSV 也加入了 int32 用例(mnn_int32_broadcast / mnn_int32_wrap)。但 golden.py 的注释(L129-130)仍称“本算子只暴露该交集中的三种浮点类型”,README 约束亦未体现 int32;并且本 patch 未见 op def/proto、tiling、kernel 的 int32 适配。
若 kernel/tiling 实际未支持 int32,则 InferDataType 放行与 ST 用例会驱动不支持的输入,导致上板运行失败或精度用例误判。建议:确认 op def 与 kernel/tiling 已具备 int32 能力并补齐相应改动;否则移除此白名单中的 DT_INT32 及对应 ST 用例,并统一 README/golden 注释。

likedislike
Rraoliang_sacCollaborators
7 days ago Pre merge succeeded (commit_id: ff0a315bc596dfd4a3c780e5c39f9e85f8b7ed0c)
11 event messages are collapsed here。 See more
CANN-robotCANN-robotCollaborators
7 days ago Removed label: stat/needs-squash
CANN-robot
CANN-robotCollaborators
7 days ago Comments:

Notification

This pull request has been changed(code update) or closed, so removes the following label(s): stat/needs-squash.

likedislike
CANN-robotCANN-robotCollaborators
7 days ago Added label: cann-cla/yes
13 event messages are collapsed here。 See more
CANN-robotCANN-robotCollaborators
7 days ago Removed label: stat/needs-squash
CANN-robot
CANN-robotCollaborators
7 days ago Comments:

Notification

This pull request has been changed(code update) or closed, so removes the following label(s): stat/needs-squash.

likedislike
CANN-robotCANN-robotCollaborators
7 days ago Added label: cann-cla/yes
raoliang_sacCollaborators
7 days ago Comments:

compile

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

您好,PR已满足合入指标,请尽快联系Committer进行合入。如暂时不需要合入,请在PR标题前加[WIP]

likedislike
Rraoliang_sacCollaborators
7 days ago Close pull request
Rraoliang_sacCollaborators
7 days ago Modify description of pull request