Merged
feat(ccu): add declaration of ccu res apis #3538
feat(ccu): add declaration of ccu res apis #3538
Merged
p_chAdd on Jul 8
p_ch
p_ch
Jul 8

描述

新增已完成接口评审并定稿的 CCU 资源管理 API 声明、对外类型、打包安装规则和阶段性桩实现。
本 PR 固定 ABI,并为后续实现 PR 建立编译链路;参数签名不再调整。
后续实现 PR 预计于 730 合入。

# 0、CCU资源类型

放置目录:hcomm/include/ccu/ccu_res_defs.h

typedef uint64_t HcommCcuResDescHandle;

typedef enum {
    HCOMM_CCU_RES_TYPE_INVALID = -1,
    HCOMM_CCU_RES_TYPE_LOOP = 0,
    HCOMM_CCU_RES_TYPE_CCU_BUF = 1,
    HCOMM_CCU_RES_TYPE_VARIABLE = 2,
    HCOMM_CCU_RES_TYPE_ADDRESS = 3,
    HCOMM_CCU_RES_TYPE_EVENT = 4,
    HCOMM_CCU_RES_TYPE_CCU_THREAD = 5,
    HCOMM_CCU_RES_TYPE_INSTRUCTION = 6
} HcommCcuResType;

# 1、CCU资源描述符

放置目录:hcomm/include/ccu/ccu_res.h

创建(线程需要指定device id):
CcuResult HcommCcuInsResDescCreate(uint32_t dieId, HcommCcuResDescHandle *resDesc)

销毁(线程需要指定device id):
CcuResult HcommCcuInsResDescDestroy(HcommCcuResDescHandle resDesc)

查询CCU资源描述符对应的ioDie Id:
CcuResult HcommCcuInsResDescQueryDieId(HcommCcuResDescHandle resDesc, uint32_t *dieId)

按资源类型设置:
CcuResult HcommCcuInsResDescSetNum(HcommCcuResDescHandle resDesc, HcommCcuResType resType, uint32_t resNum)

按资源类型查询:
CcuResult HcommCcuInsResDescQueryNum(HcommCcuResDescHandle resDesc, HcommCcuResType resType, uint32_t *resNum)

# 2、CCU实例

放置目录:hcomm/include/ccu/ccu_res.h

创建CCU实例:
CcuResult HcommCcuInsCreate(const HcommCcuResDescHandle *resDescs, uint32_t resDescNum, CcuInsHandle *ccuInsHandle)

使用所有资源创建CCU实例:
CcuResult HcommCcuInsCreateDefault(const uint32_t *dieIds, uint32_t dieNum, CcuInsHandle *ccuInsHandle)

销毁:
CcuResult HcommCcuInsDestroy(CcuInsHandle ccuInsHandle)

基于DieId查询CCU实例占用资源:
CcuResult HcommCcuInsQueryResDesc(CcuInsHandle ccuInsHandle, HcommCcuResDescHandle resDesc)


# 3、查询资源规格与资源诉求

放置目录:hcomm/include/ccu/ccu_res.h

基于DieId查询剩余资源(查询最大连续资源):
CcuResult HcommCcuQueryRemainResDesc(HcommCcuResDescHandle resDesc)

查询CCU Kernel资源诉求:
CcuResult HcommCcuKernelQueryResReq(const void *kernelFunc, const void **kernelArgs, uint32_t argNum, HcommCcuResDescHandle resDesc)

# 4、将CCU实例绑定给通信域:

放置目录:hcomm/include/hccl/hccl_ccu_res.h
HcclResult HcclCommAssignCcuIns(HcclComm comm, CcuInsHandle insHandle)

变更类型

请选择本次引入的变更类型:

关联的Issue

测试

  • 头文件 C/C++ 编译验证;
  • 动态库符号及安装包检查;
  • 桩接口返回码和无副作用 UT;
  • Legacy 调用点迁移回归;
  • API check / compile / codecheck 结果。

补充的UT用例:

所有的新增空实现接口均添加了最简 UT 以保证覆盖率。后续实际开发 PR 将会替换成功能验证 UT。

文档更新

合入检查

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for p_ch's contribution.)
CANN-robotCANN-robotCollaborators
Jul 8 Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
Jul 8 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


PR Approval Progress

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

Module Approval Details

module lgtm status approve status
CMakeLists.txt ✅ laodazhao1, yanzhenghang (2/2) ✅ yanzhenghang (1/1)
include ✅ yanzhenghang, laodazhao1 (2/2) ✅ yanzhenghang (1/1)
scripts ✅ yanzhenghang, laodazhao1 (2/2) ✅ yanzhenghang (1/1)
src/base_comm ✅ Innoecho, laodazhao1 (2/2) ✅ Innoecho (1/1)
src/coll_communicator_mgr ✅ dingweiqin_57, laodazhao1 (2/2) ✅ dingweiqin_57 (1/1)
test ✅ Innoecho, dingweiqin_57, laodazhao1 (3/2) ✅ Innoecho, dingweiqin_57 (2/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
CANN-robotCANN-robotCollaborators
Jul 8 Set leabclove,chengym,ccl_ligang,yanzhenghang,yanyefeng,chenhao_,dingweiqin_57,songmingyang,wenxuemin,yangxiaoyuan,laodazhao1,chenke2026,zhongqin2020,Innoecho,chenyia,temper7620,zhangxp1030,lilin_137,lilianlin_hw,ouyangxizi as approver
CANN-robotCANN-robotCollaborators
Jul 8 Set yanzhenghang,yanyefeng,wenxuemin as approver
p_chp_ch
Jul 8 Pushed 1 commits:aff24f1a-fix(ccu): rename existing HcommCcuInsCreate to HcommCcuInsCreateLegacy
84 messages are collapsed here。 See more
CANN-robot
CANN-robotCollaborators
Jul 21 Comments:

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

任务名称状态日志下载链接
SCA ✅ SUCCESS >>>>>
antipoison ✅ SUCCESS >>>>>
Check_Pr ✅ SUCCESS >>>>>
Compile_Ascend_X86 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM ✅ SUCCESS >>>>> >>>>>
pre_comment ✅ SUCCESS >>>>>
Compile_Ascend_X86_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_ubuntu24 ✅ SUCCESS >>>>> >>>>>
StaticCheck_codespell ✅ SUCCESS
StaticCheck_link_validity ✅ SUCCESS
StaticCheck_resource_existence ✅ SUCCESS
StaticCheck_tag_closed ✅ SUCCESS
StaticCheck_markdownlint ✅ SUCCESS
ST_Test ✅ SUCCESS
API_Check ⚠️ WARNING >>>>>
codecheck ✅ SUCCESS >>>>>
codecheck_style ✅ SUCCESS >>>>>
UT_Test ✅ SUCCESS >>>>>
precommit ⚠️ WARNING >>>>> >>>>>
PreSmoke_A900_npupool ✅ SUCCESS >>>>>
PreSmoke_A3_npupool ✅ SUCCESS >>>>>

[2026-07-21 14:22:04]    CI执行结束

likedislike
CANN-robotCANN-robotCollaborators
Jul 21 Added label: api-check-failed
CANN-robotCANN-robotCollaborators
Jul 21 Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Jul 21 Added label: ci-pipeline-passed
CANN-robotCANN-robotCollaborators
Jul 21 Merged pull request