已合并
新增SIMT max、min接口 #3539
zhangshunwei2创建于 6月25日
新增SIMT max、min接口 #3539
已合并
zhangshunwei2创建于 6月25日
zhangshunwei2成员
6月25日

描述

混合编程和SIMT编程场景下,提供cmath_lib类接口max、min,用于补充基础比较能力声明

关联的Issue

测试

文档更新

接口声明文件:include/simt_api/math_functions.h

类型标签

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

CLA Signature Pass

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

likedislike
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
include/simt_api ✅ zhanghao_0689, wulinyu (2/2) ✅ zhanghao_0689 (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)
likedislike
gao_dafa成员
6月25日 评论:

zhangshunwei2,感谢您的提交,建议在完成PR充分自验证后,再触发线上构建任务。

若您的PR已具备检视条件,可根据下表的责任田,@对应的committer进行代码检视,我们会在第一时间对您的提交进行处理。

代码责任田:

module committer
adv_api chenyiyuan, wuyang_hw
basic_api chenyiyuan, wuyang_hw
c_api pangfd, yue_mo_du_qian
cmake xun_zhuge, DragonBornHD84
docs munanhw, ai_xin
examples changxianyu, bianque
simt_api wulinyu, zhanghao_0689
scripts xun_zhuge, kevin365
tools YANXI_ZHAO, XuebinYang, sjtulxh

💡 如您不确定可以@谁,可以直接@我或者ascend-c sig的maintainer,xun_zhuge和ascendhjh,我们会为您分配合适的committer进行代码检视。

再次感谢您参与CANN的社区贡献。

likedislike
zhangshunwei2成员
6月25日 评论:

/compile

likedislike
Zzhangshunwei2成员
6月25日 预合并成功(commit_id: ebca7b2d29c9e01de6bd1d1dab37e3a7996a9790)
CANN-robotCANN-robot成员
6月25日 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
6月25日 评论:

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

任务名称状态日志下载链接
SCA ✅ SUCCESS >>>>>
antipoison ✅ SUCCESS >>>>>
codecheck ✅ SUCCESS >>>>>
codecheck_Pr ✅ SUCCESS
pre_comment ✅ 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 ✅ SUCCESS >>>>>
codecheck_precommit ⚠️ WARNING >>>>> >>>>>

[2026-06-25 09:44:53]    CI执行结束

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

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

任务名称状态日志下载链接
Compile_Ascend_X86 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM ✅ SUCCESS >>>>> >>>>>
pre_comment ✅ SUCCESS >>>>>
PreSmoke_A900_npupool ✅ SUCCESS >>>>>

[2026-06-25 09:42:38]    CI执行结束

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

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

任务名称状态日志下载链接
pre_comment ✅ SUCCESS >>>>>
UT_Test_adv_test_one ✅ SUCCESS
UT_Test_adv_test_two ✅ SUCCESS
UT_Test_basic_test_one ✅ SUCCESS
UT_Test_basic_test_two ✅ SUCCESS
UT_Test_basic_test_three ✅ SUCCESS
UT_Test_basic_test_four ✅ SUCCESS
UT_Test_basic_test_five ✅ SUCCESS
UT_Test_arm ✅ SUCCESS
UT_Test_report ✅ SUCCESS >>>>>

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

likedislike
atomgit-bot
atomgit-bot
6月25日 评论:

变更摘要

本次变更在 include/simt_api/math_functions.h 头文件中新增了 SIMT 数学函数的 max/min 系列接口声明,涵盖多种整数类型的比较取最大值/最小值功能。新增声明主要分为两组:一组是带 __SIMT_DEVICE_FUNCTIONS_DECL__ 修饰的 llmax/ullmax/umax/llmin/ullmin/umin 内联函数声明(第238–248行);另一组是 max/min 的重载声明块(第254–338行),根据不同编译条件(__NPU_COMPILER_INTERNAL_PURE_SIMT__、__NPU_ARCH__、ASCENDC_CPU_DEBUG)分别提供 static __callee__ 或 static __SIMT_DEVICE_FUNCTIONS_DECL__ 修饰的声明,覆盖 long long、unsigned long long、unsigned int、long、int、short、char、unsigned long、unsigned short、unsigned char 等类型。

主要改动

  • 新增 llmax/ullmax/umax/llmin/ullmin/umin 内联声明:在头文件中添加了6个带 __SIMT_DEVICE_FUNCTIONS_DECL__ 修饰的整数取最大/最小值函数声明,作为对现有浮点 fmaxf/fminf 接口的补充。
  • 新增 max/min 多类型重载声明块:根据 __NPU_COMPILER_INTERNAL_PURE_SIMT__、__NPU_ARCH__ 和 ASCENDC_CPU_DEBUG 三个编译条件分支,分别为 3510 架构提供 static __callee__ 修饰的声明,为其他 SIMT 场景提供 static __SIMT_DEVICE_FUNCTIONS_DECL__ 修饰的声明。
  • 覆盖广泛的整数类型:max/min 重载覆盖了 char、short、int、long、long long 及其对应的 unsigned 变体,共10种整数类型。
likedislike
不准确?
CANN-robotCANN-robot成员
6月25日 添加了label:SC-SUCC
CANN-robotCANN-robot成员
6月25日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
6月25日 添加了label:ci-pipeline-passed
atomgit-bot
atomgit-bot
6月25日 评论:

代码审查

✅ 未发现问题

likedislike
不准确?
Zzhangshunwei2成员
6月26日 修改了pull request 的描述
Zzhangshunwei2成员
6月26日 修改了pull request 的描述
Zzhangshunwei2成员
6月26日 修改了pull request 的描述
Zzhangshunwei2成员
6月26日 修改了pull request 的描述
Zzhangshunwei2成员
6月26日 修改了pull request 的描述
wulinyu成员
6月26日 评论:

/lgtm

likedislike
zhangshunwei2成员
6月27日 评论:

/check-pr

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

The following labels are not ready.

lgtm: Please wait for reviewers to review the code.

approved: Please wait for committers to review the code.

likedislike
zhanghao_0689
zhanghao_0689成员
6月27日 评论:

/lgtm

/approve

likedislike
CANN-robotCANN-robot成员
6月27日 添加了label:lgtmapproved
CANN-robotCANN-robot成员
6月27日 合入了pull request