Merged
[fix] 删除constexpr中调用非constexpr的属性 #911
点月♡Add on Sep 22
[fix] 删除constexpr中调用非constexpr的属性 #911
Merged
Merged fromqq_45068396/opbasefix-contexpr-9.2.0intocann/opbase9.2.0
Pull Request has been successfully merged by CANN-robot.
(Thank you for 点月♡'s contribution.)Sep 22 Associated issue: [Bug-Report|缺陷反馈]: atvoss库中存在constexpr调用非constexpr的现象,需要整改
atomgit-bot
Sep 22 Comments:
Sep 22 Comments:
变更摘要
本 PR 针对 atvoss 库中 constexpr 函数调用非 constexpr 函数的问题进行整改。按照整改方案,constexpr 只能调用 constexpr/__callee__ 函数,因此将各调度基类中 GetScalar 模板函数的 constexpr 修饰去除,使其回归为普通的 __aicore__ inline 函数,从而不再以 constexpr 语义被调用,规避非法调用。改动覆盖 broadcast、elewise、reduce 等模块中同名模板方法,模式一致、范围明确。
主要改动
- 移除
GetScalar的constexpr修饰: 将各文件中__aicore__ inline constexpr ScalarType GetScalar()统一改为__aicore__ inline ScalarType GetScalar(),函数签名与返回类型保持不变,仅去掉constexpr限定。 - broadcast 模块批量调整: 涉及
broadcast_sch_base.h、broadcast_sch_one_dim.h、broadcast_sch_one_dim_advance.h以及noncontiguous下last_transpose、nlast_transpose、transpose等基类头文件中的同名模板方法。 - elewise 模块同步修改:
elewise_sch.h、elewise_sch_16b.h、elewise_sch_with_scalar.h中的GetScalar一并去掉constexpr。 - reduce 模块同步修改:
reduce_sch.h中GetScalar模板方法(模板参数为ScalarType、ScalarValue)同样移除constexpr修饰。 - 保持函数体与断言不变: 各处
GetScalar内部的static_assert校验逻辑未发生变化,仅调整函数限定符。


Incorrect?
atomgit-bot
Sep 22 Comments:
Sep 22 Comments:
Sep 22 Added label: stat/needs-squash
Sep 22 Added label: cann-cla/yes
CANN-robot
Sep 22 Comments:
Sep 22 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 |
|---|---|---|
| 9.2.0 | ✅ gcw_kUomxQ2l, 王瑞 (2/2) | ✅ gcw_kUomxQ2l (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
qq_45068396, thanks for your pull request. All authors of the commits have signed the CLA. 👍


Sep 22 Set pengjiahao96,zhou-qilong,wangrui_,rxtfeng,loov1,tang-lei01,TianXL,jia0liang,zl_hw,songkai111,jiangtao_rts,gitcode-chenjiao,hanxiaolong,pingchuantang,llimwang,gubaocheng,wangyongguang,gcw_kUomxQ2l,Andy-lb as approver
Sep 22 Set pengjiahao96,zhou-qilong,wangrui_,rxtfeng,loov1,tang-lei01,TianXL,jia0liang,zl_hw,songkai111,jiangtao_rts,gitcode-chenjiao,hanxiaolong,pingchuantang,llimwang,gubaocheng,wangyongguang,gcw_kUomxQ2l,Andy-lb as approver
Sep 22 Set TianXL,jiangtao_rts,gitcode-chenjiao,hanxiaolong,gcw_kUomxQ2l,Andy-lb as approver
Sep 22 Set TianXL,jiangtao_rts,gitcode-chenjiao,hanxiaolong,gcw_kUomxQ2l,Andy-lb as approver
点月♡
Sep 22 Comments:
Sep 22 Comments:
compile


Sep 22 Pre merge succeeded (commit_id: 3b067518f39a7e7b262b7d2107691d8ae43a34c6)
CANN-robot
Sep 22 Comments:
Sep 22 Comments:
| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


Sep 22 Added label: ci-pipeline-running
RuiWang_
Sep 22 Comments:
Sep 22 Comments:
/lgtm
/approve


Sep 22 Removed label: ci-pipeline-running
Sep 22 Added label: ci-pipeline-passed
wangyongguang
Sep 22 Comments:
Sep 22 Comments:
/approve


liulun0308
Sep 23 Comments:
Sep 23 Comments:
/approve


CANN-robot
Sep 23 Comments:
Sep 23 Comments:
Sep 23 Added label: lgtmapproved
Sep 23 Merged pull request
描述
问题描述:atvoss库中存在constexpr调用非constexpr的现象
规则描述:constexpr的只能调用constexpr/callee的函数
整改方案:给被(constexpr)调用的非constexpr函数加__callee__属性。constexpr的语义在A5及之后的版本上,改为了cpp中的constexpr和__callee__(__callee__的意思是 在device上可以被任何函数调用)
关联的Issue
https://gitcode.com/cann/opbase/issues/352
测试
文档更新
类型标签