已合并
debug exp=1 #3534
wym_666创建于 6月25日
debug exp=1 #3534
已合并
wym_666创建于 6月25日
wym_666
6月25日

描述

修正aclnnpow在处理exp=1时的策略为直接返回输入值

关联的Issue

#2060

测试

pta侧atk用例500条

文档更新

类型标签

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 wym_666 的贡献)
Wwym_666
6月25日 创建了 pull request,commit cb180f7c
CANN-robotCANN-robot成员
6月25日 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
6月25日 评论:

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


PR Approval Progress

Congratulations! All modules have met the lgtm and approve requirements.

Module Approval Details

module lgtm status approve status
math/pow 冯彤, 唐燕峰 (2/2) 唐燕峰, 冯彤 (2/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
wym_666
6月25日 评论:

compile

likedislike
Wwym_666
6月25日 update merge request[project id: 7649531, iid: 3534, commit_id: 490f2d926d160c2bc5e28fb4634f80c60e22ec16] virtual merging success
CANN-robotCANN-robot成员
6月25日 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
6月25日 评论:

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

任务名称状态日志下载链接
Compile_Ascend_X86 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_experimental ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_experimental ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_single ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_A5 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_A5 ✅ SUCCESS >>>>> >>>>>
pre_comment ✅ SUCCESS >>>>>
Compile_Ascend_X86_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_experimental_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_A5_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_harmony-infer ✅ SUCCESS >>>>>
Compile_Ascend_ARM_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_experimental_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_single_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_A5_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_910b ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_910c ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_950 ✅ SUCCESS >>>>> >>>>>
Compile_harmony-infer-chs-math ✅ SUCCESS >>>>>
UT_Test ✅ SUCCESS
UT_Test_experimental ✅ SUCCESS
UT_Test_kernel ✅ SUCCESS
PreSmoke_A900 ✅ SUCCESS >>>>>
API_Check ✅ SUCCESS >>>>>
PreSmoke_ATK_Test_A2 ❌ FAILED >>>>>
likedislike
CANN-robot
CANN-robot成员
6月25日 评论:

流水线任务触发成功
任务链接 [4e9b6136cfe04d37b1beb8c0b2338fbd][流水线指导]

任务名称状态日志下载链接
codecheck ✅ SUCCESS >>>>>
SCA ✅ SUCCESS >>>>>
antipoison ✅ SUCCESS >>>>>
codecheck_Pr ✅ SUCCESS
StaticCheck_codespell_check ✅ SUCCESS
StaticCheck_link_validity_check ✅ SUCCESS
StaticCheck_resource_existence_check ✅ SUCCESS
StaticCheck_tag_closed_check ✅ SUCCESS
StaticCheck_markdownlint ✅ SUCCESS
codecheck_codestyle ⚠️ WARNING >>>>>
codecheck_precommit ⚠️ WARNING >>>>> >>>>>

[2026-06-25 10:52:47]    CI执行结束

likedislike
CANN-robotCANN-robot成员
6月25日 添加了label:api-check-pass
CANN-robotCANN-robot成员
6月25日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
6月25日 添加了label:ci-pipeline-failed
atomgit-bot
atomgit-bot
6月25日 评论:

变更摘要

此 PR 修复了 aclnnPow 算子在 exp=1 时的处理策略:当指数为 1.0 时,幂运算结果恒等于输入本身(x¹ = x),因此无需执行实际的幂运算,直接返回输入张量即可。该改动在 aclnnPowTensorScalarGetWorkspaceSize 函数中新增了 canNoUseOp 标志及对应的短路分支,使得张量^标量(TensorScalar)路径在 exponent=1 时跳过 Pow 计算,避免不必要的算子调用。

主要改动

  • 新增 canNoUseOp 标志判断:在 aclnnPowTensorScalarGetWorkspaceSize 函数中新增 bool canNoUseOp = static_cast<float>(exponent->ToFloat()) == NOOP_EXP && !IsRegBase();,用于判定指数是否为 1.0(即常量 NOOP_EXP)。
  • 新增 exp=1 短路分支:在 CheckSupportPowscanUseSquare 分支之后,新增 else if (canNoUseOp) 分支,直接将 selfCast 作为计算结果返回,跳过后续 Pow 算子调用。
  • 适用范围:该优化仅在非 IsRegBase() 平台生效,与已有的 canUseSquare(exp=2)优化策略保持一致。
likedislike
atomgit-bot
atomgit-bot
6月25日 评论:

代码审查

✅ 未发现问题

likedislike
wym_666
6月25日 评论:

compile

likedislike
Wwym_666
6月25日 update merge request[project id: 7649531, iid: 3534, commit_id: a659c274bc4dc8ca10cf57775018c9b93ca6ce26] virtual merging success
CANN-robotCANN-robot成员
6月25日 删除了label:ci-pipeline-failedapi-check-pass
CANN-robotCANN-robot成员
6月25日 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
6月25日 评论:

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

任务名称状态日志下载链接
Compile_Ascend_X86 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_experimental ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_experimental ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_single ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_A5 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_A5 ✅ SUCCESS >>>>> >>>>>
pre_comment ✅ SUCCESS >>>>>
Compile_Ascend_X86_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_experimental_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_A5_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_harmony-infer ✅ SUCCESS >>>>>
Compile_Ascend_ARM_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_experimental_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_single_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_A5_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_910b ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_910c ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_950 ✅ SUCCESS >>>>> >>>>>
Compile_harmony-infer-chs-math ✅ SUCCESS >>>>>
UT_Test ✅ SUCCESS
UT_Test_experimental ✅ SUCCESS
UT_Test_kernel ✅ SUCCESS
PreSmoke_A900 ✅ SUCCESS >>>>>
API_Check ✅ SUCCESS >>>>>
PreSmoke_ATK_Test_A2 ✅ SUCCESS >>>>>

[2026-06-25 14:55:35]    CI执行结束

likedislike
CANN-robot
CANN-robot成员
6月25日 评论:

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

任务名称状态日志下载链接
codecheck ✅ SUCCESS >>>>>
SCA ✅ SUCCESS >>>>>
antipoison ✅ SUCCESS >>>>>
codecheck_Pr ✅ SUCCESS
StaticCheck_codespell_check ✅ SUCCESS
StaticCheck_link_validity_check ✅ SUCCESS
StaticCheck_resource_existence_check ✅ SUCCESS
StaticCheck_tag_closed_check ✅ SUCCESS
StaticCheck_markdownlint ✅ SUCCESS
codecheck_codestyle ⚠️ WARNING >>>>>
codecheck_precommit ⚠️ WARNING >>>>> >>>>>

[2026-06-25 14:51:11]    CI执行结束

likedislike
CANN-robotCANN-robot成员
6月25日 添加了label:api-check-pass
CANN-robotCANN-robot成员
6月25日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
6月25日 添加了label:ci-pipeline-passed
Wwym_666
6月26日 修改了pull request 的描述
rxtfeng成员
6月26日 评论:

/approve

likedislike
CANN-robotCANN-robot成员
6月26日 添加了label:approved
FelixTang7成员
6月26日 评论:

/lgtm
/approve

likedislike
CANN-robotCANN-robot成员
6月26日 添加了label:lgtm
CANN-robotCANN-robot成员
6月26日 关闭了关联的issue
CANN-robotCANN-robot成员
6月26日 合入了pull request