Merged
feat(hypot): 新增Hypot算子Ascend C实现(A2/A3) #6683
baijinxiang_hwAdd on 15 days ago
feat(hypot): 新增Hypot算子Ascend C实现(A2/A3) #6683
Merged
baijinxiang_hwAdd on 15 days ago
baijinxiang_hwCollaborators
15 days ago

描述

新增 Hypot 算子(aclnnHypot),逐元素计算 sqrt(x1^2+x2^2)(二维欧几里得范数)。

  • 数值稳定:以较大量级为基准的稳定变形,平方不提前上溢/下溢(fp32 (1e30,1e30)→≈1.414e30 有限值)
  • 数据类型:FLOAT / FLOAT16 / BFLOAT16,9 种输入 dtype 组合经 Type Promotion 归并 3 档 computeType;FP16/BF16 升 FP32 计算后回转(fp32→bf16 用 CAST_RINT)
  • 特殊值语义:inf 优先于 NaN、NaN 传播、±inf→+inf、双零得 +0、输出恒非负
  • 场景:OneDim / MultiDimBroadcast × 3 dtype = 6 模板;多维广播按 scalar/NONE/ROW/COL/GENERIC 分模式向量化展开(紧凑连续布局)
  • 无 GM workspace(workspace=0),满足 >100M 元素峰值内存劣化 ≤5% 约束

关联的Issue

https://gitcode.com/cann/ops-math/pull/6683

测试

验证平台:Ascend910_9362 / NpuArch 2201(Atlas A3),CANN 9.1.0;pre-commit 12 项钩子全过。

验证项 方法 结果
精度(双标杆) ATK 三节点,498 用例 498/498 PASS
内存 ATK 直调 8 组(128M fp32/fp16/bf16 及广播/对照) 8/8 SUCCESS;128M fp32 峰值 Device 内存 1548 MB,workspace=0
性能 ATK pyaclnn + performance_device raw 498/498(100%,门禁 PASS),中位比值 1.19×,最大值 1.80×,全场景(多维交叉/单侧/大 shape/launch-bound 小 shape)零回归

文档更新

  • 新增 math/hypot/docs/aclnnHypot.md(aclnn 接口文档)

类型标签

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for baijinxiang_hw's contribution.)
Bbaijinxiang_hwCollaborators
15 days ago Created pull request, commit 036a927d
atomgit-bot
atomgit-bot
15 days ago Comments:

🤖 AI Code Review

⚠️ 审查未能完成

本次代码审查未能完成,可能是临时性故障。

你可以在评论区输入 /ai summary 重新发起审查。若多次失败,请联系管理员并附上下方追踪 ID。

追踪 ID: task-407907

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

🤖 AI Code Review

⚠️ 审查未能完成

本次代码审查未能完成,可能是临时性故障。

你可以在评论区输入 /ai review 重新发起审查。若多次失败,请联系管理员并附上下方追踪 ID。

追踪 ID: task-407908

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
15 days ago Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
15 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
*/*/README.md ✅ 杨露, 陈兴宇, jiangjiawei (3/2) ✅ 杨露 (1/1)
*/*/docs/acl*.md ✅ 杨露, 陈兴宇, jiangjiawei (3/2) ✅ 杨露 (1/1)
*/*/op_api/*.h ✅ 陈兴宇, jiangjiawei, 汤磊 (3/2) ✅ 汤磊 (1/1)
*/*/op_graph/*_proto.h ✅ 汤磊, 陈兴宇, jiangjiawei (3/2) ✅ 汤磊 (1/1)
*/*/op_host/*_def.cpp ✅ 汤磊, 陈兴宇, jiangjiawei (3/2) ✅ 汤磊 (1/1)
repo-cann/ops-math ✅ jiangjiawei, 陈兴宇 (2/2) ✅ jiangjiawei (1/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
243 messages are collapsed here。 See more
chenxingyu18Collaborators
1 day ago Comments:

/lgtm

likedislike
CANN-robotCANN-robotCollaborators
1 day ago Added label: lgtm
yanglu-1Collaborators
15 hours ago Comments:

/lgtm
/approve

likedislike
CANN-robotCANN-robotCollaborators
15 hours ago Added label: approved
CANN-robotCANN-robotCollaborators
15 hours ago Merged pull request