| @@ -241,6 +241,7 @@ elseif(BUILD_OPEN_PROJECT) | |||
| 241 | include/ccu/ccu_primitives.hpp | 241 | include/ccu/ccu_primitives.hpp |
| 242 | include/ccu/ccu_remote_addr.hpp | 242 | include/ccu/ccu_remote_addr.hpp |
| 243 | include/ccu/ccu_res.h | 243 | include/ccu/ccu_res.h |
| 244 | + include/ccu/ccu_res_defs.h | ||
| 244 | include/ccu/ccu_types.h | 245 | include/ccu/ccu_types.h |
| 245 | include/ccu/ccu_utils.hpp | 246 | include/ccu/ccu_utils.hpp |
| 246 | include/ccu/ccu_variable.hpp | 247 | include/ccu/ccu_variable.hpp |
| @@ -11,12 +11,109 @@ | |||
| 11 | #ifndef CCU_RES_H | 11 | #ifndef CCU_RES_H |
| 12 | #define CCU_RES_H | 12 | #define CCU_RES_H |
| 13 | 13 | ||
| 14 | +#include "ccu_res_defs.h" | ||
| 14 | #include "ccu_types.h" | 15 | #include "ccu_types.h" |
| 15 | 16 | ||
| 16 | #ifdef __cplusplus | 17 | #ifdef __cplusplus |
| 17 | extern "C" { | 18 | extern "C" { |
| 18 | #endif // __cplusplus | 19 | #endif // __cplusplus |
| 19 | 20 | ||
| 21 | +/** | ||
| 22 | + * @brief 创建空白 CCU 资源描述符。 | ||
| 23 | + * @param[in] dieId CCU 资源描述符归属的 ioDie ID。 | ||
| 24 | + * @param[out] resDesc 创建成功后返回的资源描述符句柄,不可为 nullptr。 | ||
| 25 | + * @return CcuResult。 | ||
| 26 | + */ | ||
| 27 | +extern CcuResult HcommCcuInsResDescCreate(uint32_t dieId, HcommCcuResDescHandle *resDesc); | ||
| 28 | + | ||
| 29 | +/** | ||
| 30 | + * @brief 销毁 CCU 资源描述符。 | ||
| 31 | + * @param[in] resDesc 资源描述符句柄。 | ||
| 32 | + * @return CcuResult。 | ||
| 33 | + */ | ||
| 34 | +extern CcuResult HcommCcuInsResDescDestroy(HcommCcuResDescHandle resDesc); | ||
| 35 | + | ||
| 36 | +/** | ||
| 37 | + * @brief 查询 CCU 资源描述符归属的 ioDie ID。 | ||
| 38 | + * @param[in] resDesc 资源描述符句柄。 | ||
| 39 | + * @param[out] dieId 查询成功后返回 ioDie ID,不可为 nullptr。 | ||
| 40 | + * @return CcuResult。 | ||
| 41 | + */ | ||
| 42 | +extern CcuResult HcommCcuInsResDescQueryDieId(HcommCcuResDescHandle resDesc, uint32_t *dieId); | ||
| 43 | + | ||
| 44 | +/** | ||
| 45 | + * @brief 设置指定 CCU 资源描述符内指定资源类型的资源数量。 | ||
| 46 | + * @param[in] resDesc 资源描述符句柄。 | ||
| 47 | + * @param[in] resType 资源类型。 | ||
| 48 | + * @param[in] resNum 资源数量。 | ||
| 49 | + * @return CcuResult。 | ||
| 50 | + */ | ||
| 51 | +extern CcuResult HcommCcuInsResDescSetNum( | ||
| 52 | + HcommCcuResDescHandle resDesc, HcommCcuResType resType, uint32_t resNum); | ||
| 53 | + | ||
| 54 | +/** | ||
| 55 | + * @brief 查询指定 CCU 资源描述符内指定资源类型的资源数量。 | ||
| 56 | + * @param[in] resDesc 资源描述符句柄。 | ||
| 57 | + * @param[in] resType 资源类型。 | ||
| 58 | + * @param[out] resNum 查询成功后返回资源数量,不可为 nullptr。 | ||
| 59 | + * @return CcuResult。 | ||
| 60 | + */ | ||
| 61 | +extern CcuResult HcommCcuInsResDescQueryNum( | ||
| 62 | + HcommCcuResDescHandle resDesc, HcommCcuResType resType, uint32_t *resNum); | ||
| 63 | + | ||
| 64 | +/** | ||
| 65 | + * @brief 基于资源描述符创建 CCU 实例。 | ||
| 66 | + * @param[in] resDescs 资源描述符句柄数组。 | ||
| 67 | + * @param[in] resDescNum 资源描述符数量。 | ||
| 68 | + * @param[out] ccuInsHandle 创建成功后返回的 CCU 实例句柄,不可为 nullptr。 | ||
| 69 | + * @return CcuResult。 | ||
| 70 | + */ | ||
| 71 | +extern CcuResult HcommCcuInsCreate( | ||
🔴 [严重] [接口/ABI] include/ccu/ccu_res.h:71 — HcommCcuInsCreate / HcommCcuInsDestroy 符号复用但签名不兼容 旧 HcommCcuInsCreate(const void*, uint32_t, CcuInsHandle*) 被重命名为 HcommCcuInsCreateLegacy,而新 HcommCcuInsCreate(const HcommCcuResDescHandle*, uint32_t, CcuInsHandle*) 复用同一符号名但参数类型不同;HcommCcuInsDestroy 同理(旧 2 参 → 新 1 参)。 风险:任何已编译的二进制(含历史 HCCL/第三方)若通过 dlsym 或链接期解析到 HcommCcuInsCreate 符号并按旧签名传参,将发生静默参数错配 → 内存损坏或崩溃。AGENTS.md 第 3 节硬性要求 include/ 变更需向后兼容。 建议:既然旧 API 已改名为 Legacy,新 API 应使用全新名字(如 HcommCcuInsCreateV2 或 HcommCcuInsCreateFromDesc),彻底避免符号复用造成的 ABI 二义性。 ![]() ![]() | |||
| 72 | + const HcommCcuResDescHandle *resDescs, uint32_t resDescNum, CcuInsHandle *ccuInsHandle); | ||
| 73 | + | ||
| 74 | +/** | ||
| 75 | + * @brief 使用指定 ioDie 上的默认资源创建 CCU 实例。 | ||
| 76 | + * @param[in] dieIds ioDie ID 数组。 | ||
| 77 | + * @param[in] dieNum ioDie 数量。 | ||
| 78 | + * @param[out] ccuInsHandle 创建成功后返回的 CCU 实例句柄,不可为 nullptr。 | ||
| 79 | + * @return CcuResult。 | ||
| 80 | + */ | ||
| 81 | +extern CcuResult HcommCcuInsCreateDefault( | ||
| 82 | + const uint32_t *dieIds, uint32_t dieNum, CcuInsHandle *ccuInsHandle); | ||
| 83 | + | ||
| 84 | +/** | ||
| 85 | + * @brief 销毁 CCU 实例。 | ||
| 86 | + * @param[in] ccuInsHandle CCU 实例句柄。 | ||
| 87 | + * @return CcuResult。 | ||
| 88 | + */ | ||
| 89 | +extern CcuResult HcommCcuInsDestroy(CcuInsHandle ccuInsHandle); | ||
[MEDIUM] HcommCcuInsDestroy 句柄按值传入,销毁后调用方句柄悬垂无法失效 第 89 行:HcommCcuInsDestroy(CcuInsHandle ccuInsHandle)
作为新增对外 API,建议改为 ![]() ![]() | |||
| 90 | + | ||
| 91 | +/** | ||
| 92 | + * @brief 查询 CCU 实例在资源描述符所属 ioDie 上占用的资源。 | ||
| 93 | + * @param[in] ccuInsHandle CCU 实例句柄。 | ||
| 94 | + * @param[in,out] resDesc 调用方基于待查询 ioDie 创建的资源描述符句柄,查询成功后写入该 ioDie 上的占用资源数量。 | ||
| 95 | + * @return CcuResult。 | ||
| 96 | + */ | ||
| 97 | +extern CcuResult HcommCcuInsQueryResDesc(CcuInsHandle ccuInsHandle, HcommCcuResDescHandle resDesc); | ||
| 98 | + | ||
| 99 | +/** | ||
| 100 | + * @brief 查询资源描述符所属 ioDie 上的剩余 CCU 资源。 | ||
| 101 | + * @param[in,out] resDesc 调用方基于待查询 ioDie 创建的资源描述符句柄,查询成功后写入该 ioDie 上的剩余资源数量。 | ||
| 102 | + * @return CcuResult。 | ||
| 103 | + */ | ||
| 104 | +extern CcuResult HcommCcuQueryRemainResDesc(HcommCcuResDescHandle resDesc); | ||
| 105 | + | ||
| 106 | +/** | ||
| 107 | + * @brief 查询 CCU Kernel 的资源诉求。 | ||
| 108 | + * @param[in] kernelFunc CCU Kernel 函数指针,不可为 nullptr。 | ||
| 109 | + * @param[in] kernelArgs CCU Kernel 参数数组;argNum 为 0 时可为 nullptr。 | ||
| 110 | + * @param[in] argNum CCU Kernel 参数数量。 | ||
| 111 | + * @param[in,out] resDesc 调用方创建的资源描述符句柄,查询成功后写入资源诉求。 | ||
| 112 | + * @return CcuResult。 | ||
| 113 | + */ | ||
| 114 | +extern CcuResult HcommCcuKernelQueryResReq( | ||
| 115 | + const void *kernelFunc, const void **kernelArgs, uint32_t argNum, HcommCcuResDescHandle resDesc); | ||
[MEDIUM] HcommCcuKernelQueryResReq 用 const void * 承载函数指针,标准层面为 UB/实现定义 第 115 行:const void *kernelFunc
建议定义专用的函数指针 typedef(例如 ![]() ![]() | |||
| 116 | + | ||
| 20 | /** | 117 | /** |
| 21 | * @brief 查询/计算一段本端内存区域的 CCU 访问 token,供 host 端组装 LocalAddr/RemoteAddr 使用。 | 118 | * @brief 查询/计算一段本端内存区域的 CCU 访问 token,供 host 端组装 LocalAddr/RemoteAddr 使用。 |
| 22 | * @param[in] srcVa 内存区域起始虚地址(VA),必须为已注册的合法地址,不可为 0。 | 119 | * @param[in] srcVa 内存区域起始虚地址(VA),必须为已注册的合法地址,不可为 0。 |
| @@ -33,4 +130,4 @@ extern CcuResult HcommCcuGetMemToken(uint64_t srcVa, uint64_t size, uint64_t *to | |||
| 33 | } | 130 | } |
| 34 | #endif // __cplusplus | 131 | #endif // __cplusplus |
| 35 | 132 | ||
| 36 | -#endif // CCU_RES_H | 133 | +#endif // CCU_RES_H |
| @@ -0,0 +1,43 @@ | |||
| 1 | +/** | ||
| 2 | + * Copyright (c) 2026 Huawei Technologies Co., Ltd. | ||
| 3 | + * This program is free software, you can redistribute it and/or modify it under the terms and conditions of | ||
| 4 | + * CANN Open Software License Agreement Version 2.0 (the "License"). | ||
| 5 | + * Please refer to the License for details. You may not use this file except in compliance with the License. | ||
| 6 | + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | ||
| 7 | + * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | ||
| 8 | + * See LICENSE in the root of the software repository for the full text of the License. | ||
| 9 | + */ | ||
| 10 | + | ||
| 11 | +#ifndef CCU_RES_DEFS_H | ||
| 12 | +#define CCU_RES_DEFS_H | ||
| 13 | + | ||
| 14 | +#include <stdint.h> | ||
| 15 | + | ||
| 16 | +#ifdef __cplusplus | ||
| 17 | +extern "C" { | ||
| 18 | +#endif // __cplusplus | ||
| 19 | + | ||
| 20 | +/** | ||
| 21 | + * @brief CCU资源描述符句柄类型 | ||
| 22 | + */ | ||
| 23 | +typedef uint64_t HcommCcuResDescHandle; | ||
| 24 | + | ||
| 25 | +/** | ||
| 26 | + * @brief CCU资源类型枚举 | ||
| 27 | + */ | ||
| 28 | +typedef enum { | ||
| 29 | + HCOMM_CCU_RES_TYPE_INVALID = -1, ///< 无效资源类型 | ||
| 30 | + HCOMM_CCU_RES_TYPE_LOOP = 0, ///< Loop资源 | ||
| 31 | + HCOMM_CCU_RES_TYPE_CCU_BUF = 1, ///< CCU Buffer资源 | ||
| 32 | + HCOMM_CCU_RES_TYPE_VARIABLE = 2, ///< Variable资源 | ||
| 33 | + HCOMM_CCU_RES_TYPE_ADDRESS = 3, ///< Address资源 | ||
| 34 | + HCOMM_CCU_RES_TYPE_EVENT = 4, ///< Event资源 | ||
| 35 | + HCOMM_CCU_RES_TYPE_CCU_THREAD = 5, ///< CCU Thread资源 | ||
| 36 | + HCOMM_CCU_RES_TYPE_INSTRUCTION = 6 ///< Instruction资源 | ||
| 37 | +} HcommCcuResType; | ||
| 38 | + | ||
| 39 | +#ifdef __cplusplus | ||
| 40 | +} | ||
| 41 | +#endif // __cplusplus | ||
| 42 | + | ||
| 43 | +#endif // CCU_RES_DEFS_H | ||
| @@ -18,6 +18,26 @@ | |||
| 18 | extern "C" { | 18 | extern "C" { |
| 19 | #endif // __cplusplus | 19 | #endif // __cplusplus |
| 20 | 20 | ||
| 21 | +/** | ||
| 22 | + * @brief 将 CCU 实例绑定到指定 HCCL 通信域。 | ||
| 23 | + * @param[in] comm HCCL 通信域句柄,不可为 nullptr。 | ||
| 24 | + * @param[in] insHandle CCU 实例句柄。 | ||
| 25 | + * @return HcclResult。 | ||
| 26 | + * @note 一个通信域最多绑定一个 CCU 实例。重复绑定相同或不同实例均返回 HCCL_E_PARA,且不修改原绑定。 | ||
| 27 | + * @note 绑定成功后,实例所有权转移给通信域;调用方不得销毁该实例,也不得将同一实例绑定到其他通信域。 | ||
| 28 | + * 绑定失败时,实例所有权仍归调用方。 | ||
| 29 | + */ | ||
| 30 | +extern HcclResult HcclCommAssignCcuIns(HcclComm comm, CcuInsHandle insHandle); | ||
| 31 | + | ||
| 32 | +/** | ||
| 33 | + * @brief 查询指定 HCCL 通信域已绑定的 CCU 实例。 | ||
| 34 | + * @param[in] comm HCCL 通信域句柄,不可为 nullptr。 | ||
| 35 | + * @param[out] insHandles 查询成功后返回 CCU 实例句柄数组,不可为 nullptr。 | ||
| 36 | + * @param[out] insNum 查询成功后返回 CCU 实例数量,不可为 nullptr。 | ||
| 37 | + * @return HcclResult。 | ||
| 38 | + * @note 当前一个通信域最多返回一个 CCU 实例。查询成功时,insHandles[0] 为已绑定实例句柄,*insNum 为 1。 | ||
| 39 | + * 查询结果仅供借用,不转移实例所有权。 | ||
| 40 | + */ | ||
| 21 | extern HcclResult HcclCommQueryCcuIns(HcclComm comm, | 41 | extern HcclResult HcclCommQueryCcuIns(HcclComm comm, |
| 22 | CcuInsHandle *insHandles, uint32_t *insNum); | 42 | CcuInsHandle *insHandles, uint32_t *insNum); |
| 23 | 43 | ||
| @@ -25,4 +45,4 @@ extern HcclResult HcclCommQueryCcuIns(HcclComm comm, | |||
| 25 | } | 45 | } |
| 26 | #endif // __cplusplus | 46 | #endif // __cplusplus |
| 27 | 47 | ||
| 28 | -#endif // HCCL_CCU_RES_H | 48 | +#endif // HCCL_CCU_RES_H |
| @@ -64,6 +64,7 @@ | |||
| 64 | <file value="ccu_primitives.hpp"/> | 64 | <file value="ccu_primitives.hpp"/> |
| 65 | <file value="ccu_remote_addr.hpp"/> | 65 | <file value="ccu_remote_addr.hpp"/> |
| 66 | <file value="ccu_res.h"/> | 66 | <file value="ccu_res.h"/> |
| 67 | + <file value="ccu_res_defs.h"/> | ||
| 67 | <file value="ccu_types.h"/> | 68 | <file value="ccu_types.h"/> |
| 68 | <file value="ccu_utils.hpp"/> | 69 | <file value="ccu_utils.hpp"/> |
| 69 | <file value="ccu_variable.hpp"/> | 70 | <file value="ccu_variable.hpp"/> |
| @@ -11,6 +11,7 @@ | |||
| 11 | set(src_list | 11 | set(src_list |
| 12 | ccu_launch.cc | 12 | ccu_launch.cc |
| 13 | ccu_primitives_impl.cc | 13 | ccu_primitives_impl.cc |
| 14 | + ccu_res_c_adpt.cc | ||
| 14 | ) | 15 | ) |
| 15 | 16 | ||
| 16 | if(TARGET hcomm) | 17 | if(TARGET hcomm) |
| @@ -36,7 +36,7 @@ | |||
| 36 | #include "ccu_assist_v1.h" | 36 | #include "ccu_assist_v1.h" |
| 37 | 37 | ||
| 38 | 38 | ||
| 39 | -CcuResult HcommCcuInsCreate(const void *resDesc, uint32_t descNum, CcuInsHandle *insHandle) | 39 | +CcuResult HcommCcuInsCreateLegacy(const void *resDesc, uint32_t descNum, CcuInsHandle *insHandle) |
| 40 | { | 40 | { |
| 41 | CCU_CHK_PTR_NULL(resDesc); | 41 | CCU_CHK_PTR_NULL(resDesc); |
| 42 | CCU_CHK_PTR_NULL(insHandle); | 42 | CCU_CHK_PTR_NULL(insHandle); |
| @@ -58,14 +58,34 @@ CcuResult HcommCcuInsCreate(const void *resDesc, uint32_t descNum, CcuInsHandle | |||
| 58 | return CcuResult::CCU_SUCCESS; | 58 | return CcuResult::CCU_SUCCESS; |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | +CcuResult HcommCcuInsCreate(const HcommCcuResDescHandle *, uint32_t, CcuInsHandle *) | ||
按照文件划分,这个是否也需要移到ccu_res_c_adpt ![]() ![]() p_ch Jul 21 Comments: Jul 21 Comments: ![]() ![]() | |||
| 62 | +{ | ||
| 63 | + return CcuResult::CCU_E_NOT_SUPPORT; | ||
| 64 | +} | ||
| 65 | + | ||
| 66 | +CcuResult HcommCcuInsCreateDefault(const uint32_t *, uint32_t, CcuInsHandle *) | ||
| 67 | +{ | ||
| 68 | + return CcuResult::CCU_E_NOT_SUPPORT; | ||
| 69 | +} | ||
| 70 | + | ||
| 71 | +CcuResult HcommCcuInsDestroy(CcuInsHandle) | ||
| 72 | +{ | ||
| 73 | + return CcuResult::CCU_E_NOT_SUPPORT; | ||
| 74 | +} | ||
| 75 | + | ||
| 76 | +CcuResult HcommCcuInsQueryResDesc(CcuInsHandle, HcommCcuResDescHandle) | ||
| 77 | +{ | ||
| 78 | + return CcuResult::CCU_E_NOT_SUPPORT; | ||
| 79 | +} | ||
| 80 | + | ||
| 61 | /** | 81 | /** |
| 62 | * @brief 关闭CCU特性,解初始化CCU平台层 | 82 | * @brief 关闭CCU特性,解初始化CCU平台层 |
| 63 | * | 83 | * |
| 64 | - * @param deviceLogicId 设备逻辑ID | 84 | + * @param insHandle CCU实例句柄 |
| 65 | - * @return HcclResult 返回HcclResult类型的结果 | 85 | + * @param curDeviceLogicId 当前设备逻辑ID |
| 66 | - * @note 资源不足时返回HCCL_E_UNAVIL,其余非HCCL_SUCCESS结果属于错误 | 86 | + * @return CcuResult 执行结果状态码,CCU_SUCCESS表示成功,其他值表示失败 |
| 67 | */ | 87 | */ |
| 68 | -CcuResult HcommCcuInsDestroy(CcuInsHandle insHandle, int32_t curDeviceLogicId) | 88 | +CcuResult HcommCcuInsDestroyLegacy(CcuInsHandle insHandle, int32_t curDeviceLogicId) |
| 69 | { | 89 | { |
| 70 | // 获取当前线程的 DeviceId(线程变量) | 90 | // 获取当前线程的 DeviceId(线程变量) |
| 71 | const int32_t threadDevId = HcclGetThreadDeviceId(); | 91 | const int32_t threadDevId = HcclGetThreadDeviceId(); |
| @@ -376,4 +396,4 @@ CcuResult HcommCcuGetMemToken(uint64_t srcVa, uint64_t size, uint64_t *tokenInfo | |||
| 376 | *tokenInfo = hcomm::CcuRep::CcuCombineTokenInfo(info.tokenId, info.tokenValue, 1); | 396 | *tokenInfo = hcomm::CcuRep::CcuCombineTokenInfo(info.tokenId, info.tokenValue, 1); |
| 377 | 397 | ||
| 378 | return CcuResult::CCU_SUCCESS; | 398 | return CcuResult::CCU_SUCCESS; |
| 379 | -} | 399 | +} |
| @@ -0,0 +1,46 @@ | |||
| 1 | +/** | ||
| 2 | + * Copyright (c) 2026 Huawei Technologies Co., Ltd. | ||
| 3 | + * This program is free software, you can redistribute it and/or modify it under the terms and conditions of | ||
| 4 | + * CANN Open Software License Agreement Version 2.0 (the "License"). | ||
| 5 | + * Please refer to the License for details. You may not use this file except in compliance with the License. | ||
| 6 | + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | ||
| 7 | + * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | ||
| 8 | + * See LICENSE in the root of the software repository for the full text of the License. | ||
| 9 | + */ | ||
| 10 | + | ||
| 11 | +#include "ccu_res.h" | ||
| 12 | + | ||
| 13 | +CcuResult HcommCcuInsResDescCreate(uint32_t, HcommCcuResDescHandle *) | ||
| 14 | +{ | ||
| 15 | + return CcuResult::CCU_E_NOT_SUPPORT; | ||
| 16 | +} | ||
| 17 | + | ||
| 18 | +CcuResult HcommCcuInsResDescDestroy(HcommCcuResDescHandle) | ||
| 19 | +{ | ||
| 20 | + return CcuResult::CCU_E_NOT_SUPPORT; | ||
| 21 | +} | ||
| 22 | + | ||
| 23 | +CcuResult HcommCcuInsResDescQueryDieId(HcommCcuResDescHandle, uint32_t *) | ||
| 24 | +{ | ||
| 25 | + return CcuResult::CCU_E_NOT_SUPPORT; | ||
| 26 | +} | ||
| 27 | + | ||
| 28 | +CcuResult HcommCcuInsResDescSetNum(HcommCcuResDescHandle, HcommCcuResType, uint32_t) | ||
| 29 | +{ | ||
| 30 | + return CcuResult::CCU_E_NOT_SUPPORT; | ||
| 31 | +} | ||
| 32 | + | ||
| 33 | +CcuResult HcommCcuInsResDescQueryNum(HcommCcuResDescHandle, HcommCcuResType, uint32_t *) | ||
| 34 | +{ | ||
| 35 | + return CcuResult::CCU_E_NOT_SUPPORT; | ||
| 36 | +} | ||
| 37 | + | ||
| 38 | +CcuResult HcommCcuQueryRemainResDesc(HcommCcuResDescHandle) | ||
| 39 | +{ | ||
| 40 | + return CcuResult::CCU_E_NOT_SUPPORT; | ||
| 41 | +} | ||
| 42 | + | ||
| 43 | +CcuResult HcommCcuKernelQueryResReq(const void *, const void **, uint32_t, HcommCcuResDescHandle) | ||
| 44 | +{ | ||
| 45 | + return CcuResult::CCU_E_NOT_SUPPORT; | ||
| 46 | +} | ||
| @@ -32,28 +32,27 @@ struct CcuResDesc { | |||
| 32 | CcuInstanceType insType; | 32 | CcuInstanceType insType; |
| 33 | }; | 33 | }; |
| 34 | 34 | ||
| 35 | -//todo: 注释待修改 | ||
| 36 | /** | 35 | /** |
| 37 | * @brief 启用CCU特性,初始化CCU平台层 | 36 | * @brief 启用CCU特性,初始化CCU平台层 |
| 38 | * | 37 | * |
| 39 | - * @param deviceLogicId 设备逻辑ID | 38 | + * @param resDesc CCU资源描述 |
| 40 | - * @param ccuDrvHandle CCU驱动句柄 | 39 | + * @param descNum CCU资源描述数量 |
| 41 | - * @return HcclResult 返回HcclResult类型的结果 | 40 | + * @param insHandle CCU实例句柄 |
| 42 | - * @note 资源不足时返回HCCL_E_UNAVIL,其余非HCCL_SUCCESS结果属于错误 | 41 | + * @return CcuResult 执行结果状态码,CCU_SUCCESS表示成功,其他值表示失败 |
| 43 | */ | 42 | */ |
| 44 | -extern CcuResult HcommCcuInsCreate(const void *resDesc, uint32_t descNum, CcuInsHandle *insHandle); | 43 | +extern CcuResult HcommCcuInsCreateLegacy(const void *resDesc, uint32_t descNum, CcuInsHandle *insHandle); |
[LOW] HcommCcuInsCreateLegacy/InsDestroyLegacy 文档 @return HcclResult 与实际返回 CcuResult 不符 第 44 行:HcommCcuInsCreateLegacy(const void *resDesc
![]() ![]() | |||
| 45 | 44 | ||
| 46 | /** | 45 | /** |
| 47 | * @brief 关闭CCU特性,解初始化CCU平台层 | 46 | * @brief 关闭CCU特性,解初始化CCU平台层 |
| 48 | * | 47 | * |
| 49 | - * @param deviceLogicId 设备逻辑ID | 48 | + * @param insHandle CCU实例句柄 |
| 50 | - * @return HcclResult 返回HcclResult类型的结果 | 49 | + * @param curDeviceLogicId 当前设备逻辑ID |
| 51 | - * @note 资源不足时返回HCCL_E_UNAVIL,其余非HCCL_SUCCESS结果属于错误 | 50 | + * @return CcuResult 执行结果状态码,CCU_SUCCESS表示成功,其他值表示失败 |
| 52 | */ | 51 | */ |
| 53 | -extern CcuResult HcommCcuInsDestroy(CcuInsHandle insHandle, int32_t curDeviceLogicId); | 52 | +extern CcuResult HcommCcuInsDestroyLegacy(CcuInsHandle insHandle, int32_t curDeviceLogicId); |
| 54 | 53 | ||
| 55 | #ifdef __cplusplus | 54 | #ifdef __cplusplus |
| 56 | } | 55 | } |
| 57 | #endif // __cplusplus | 56 | #endif // __cplusplus |
| 58 | 57 | ||
| 59 | -#endif // CCU_PRIMITIVES_H | 58 | +#endif // CCU_PRIMITIVES_H |
| @@ -17,6 +17,11 @@ | |||
| 17 | /** | 17 | /** |
| 18 | * @note 职责:集合通信的通信域CCU管理的C接口的C到C++适配 | 18 | * @note 职责:集合通信的通信域CCU管理的C接口的C到C++适配 |
| 19 | */ | 19 | */ |
| 20 | +HcclResult HcclCommAssignCcuIns(HcclComm, CcuInsHandle) | ||
[MEDIUM] HcclCommAssignCcuIns 单实例绑定 vs HcclCommQueryCcuIns 多实例查询,语义不对称且缺约束说明 第 20 行:HcclCommAssignCcuIns(HcclComm, CcuInsHandle)
建议在头文件 doxygen 中补充语义约束(重复绑定/上限/错误码),或提供批量绑定接口与查询对称。 ![]() ![]() | |||
| 21 | +{ | ||
| 22 | + return HcclResult::HCCL_E_NOT_SUPPORT; | ||
| 23 | +} | ||
| 24 | + | ||
| 20 | HcclResult HcclCommQueryCcuIns(HcclComm comm, | 25 | HcclResult HcclCommQueryCcuIns(HcclComm comm, |
| 21 | CcuInsHandle *insHandles, uint32_t *insNum) | 26 | CcuInsHandle *insHandles, uint32_t *insNum) |
| 22 | { | 27 | { |
| @@ -59,4 +64,4 @@ HcclResult HcclCommQueryCcuIns(HcclComm comm, | |||
| 59 | 64 | ||
| 60 | EXCEPTION_HANDLE_END | 65 | EXCEPTION_HANDLE_END |
| 61 | return HcclResult::HCCL_SUCCESS; | 66 | return HcclResult::HCCL_SUCCESS; |
| 62 | -} | 67 | +} |
| @@ -108,7 +108,7 @@ MyRank::~MyRank() | |||
| 108 | rankPairMgr_ = nullptr; // 内部会销毁channel,可能需要返还endpoint与ccu资源 | 108 | rankPairMgr_ = nullptr; // 内部会销毁channel,可能需要返还endpoint与ccu资源 |
| 109 | endpointMgr_ = nullptr; // 内部会销毁endpoint,可能需要返回ccu资源 | 109 | endpointMgr_ = nullptr; // 内部会销毁endpoint,可能需要返回ccu资源 |
| 110 | if (ccuInsHandle_ != 0) { // 内部清理CCU资源,关闭CCU通道 | 110 | if (ccuInsHandle_ != 0) { // 内部清理CCU资源,关闭CCU通道 |
| 111 | - (void)HcommCcuInsDestroy(ccuInsHandle_, devLogicId_); | 111 | + (void)HcommCcuInsDestroyLegacy(ccuInsHandle_, devLogicId_); |
| 112 | ccuInsHandle_ = 0; | 112 | ccuInsHandle_ = 0; |
| 113 | } | 113 | } |
| 114 | 114 | ||
| @@ -163,7 +163,7 @@ HcclResult MyRank::TryInitCcuInstance() | |||
| 163 | resDesc.dieId = CCU_ALL_IODIE; | 163 | resDesc.dieId = CCU_ALL_IODIE; |
| 164 | resDesc.insType = ccuInsType; | 164 | resDesc.insType = ccuInsType; |
| 165 | constexpr uint32_t descNum = 1; | 165 | constexpr uint32_t descNum = 1; |
| 166 | - auto ccuInitRet = HcommCcuInsCreate(static_cast<void *>(&resDesc), | 166 | + auto ccuInitRet = HcommCcuInsCreateLegacy(static_cast<void *>(&resDesc), |
| 167 | descNum, &ccuInsHandle_); | 167 | descNum, &ccuInsHandle_); |
| 168 | // ccu驱动拉起失败,直接回退至aicpu ts | 168 | // ccu驱动拉起失败,直接回退至aicpu ts |
| 169 | if (ccuInitRet == CcuResult::CCU_E_DRV_BUSY) { | 169 | if (ccuInitRet == CcuResult::CCU_E_DRV_BUSY) { |
| @@ -65,7 +65,7 @@ protected: | |||
| 65 | MOCKER_CPP(&Hccl::SocketManager::GetConnectedSocket).stubs().with(mockcpp::any()).will(returnValue((Hccl::Socket*)0xab)); | 65 | MOCKER_CPP(&Hccl::SocketManager::GetConnectedSocket).stubs().with(mockcpp::any()).will(returnValue((Hccl::Socket*)0xab)); |
| 66 | MOCKER_CPP(&hccl::CommMems::GetTagMemoryHandles).stubs().with(mockcpp::any()).will(returnValue(HCCL_SUCCESS)); | 66 | MOCKER_CPP(&hccl::CommMems::GetTagMemoryHandles).stubs().with(mockcpp::any()).will(returnValue(HCCL_SUCCESS)); |
| 67 | MOCKER_CPP(&hcomm::EndpointMgr::RegisterMemory).stubs().with(mockcpp::any()).will(returnValue(HCCL_SUCCESS)); | 67 | MOCKER_CPP(&hcomm::EndpointMgr::RegisterMemory).stubs().with(mockcpp::any()).will(returnValue(HCCL_SUCCESS)); |
| 68 | - MOCKER(HcommCcuInsCreate).stubs().with(mockcpp::any()).will(returnValue(CcuResult::CCU_SUCCESS)); | 68 | + MOCKER(HcommCcuInsCreateLegacy).stubs().with(mockcpp::any()).will(returnValue(CcuResult::CCU_SUCCESS)); |
| 69 | MOCKER_CPP(&hccl::MyRank::TryInitCcuInstance).stubs().will(returnValue(HCCL_SUCCESS)); | 69 | MOCKER_CPP(&hccl::MyRank::TryInitCcuInstance).stubs().will(returnValue(HCCL_SUCCESS)); |
| 70 | } | 70 | } |
| 71 | 71 | ||
| @@ -241,7 +241,7 @@ TEST_F(MyRankTest, Ut_Init_When_Default_Mode_Expect_Set_By_Env) | |||
| 241 | TEST_F(MyRankTest, Ut_Init_When_Ccu_Driver_Fail_Expect_Fallback_Aicpu) | 241 | TEST_F(MyRankTest, Ut_Init_When_Ccu_Driver_Fail_Expect_Fallback_Aicpu) |
| 242 | { | 242 | { |
| 243 | setenv("HCCL_CCU_CUSTOM_OP_MODE", "1", 1); | 243 | setenv("HCCL_CCU_CUSTOM_OP_MODE", "1", 1); |
| 244 | - MOCKER(HcommCcuInsCreate).stubs().will(returnValue(CcuResult::CCU_E_DRV_BUSY)); | 244 | + MOCKER(HcommCcuInsCreateLegacy).stubs().will(returnValue(CcuResult::CCU_E_DRV_BUSY)); |
| 245 | 245 | ||
| 246 | aclrtBinHandle binHandle; | 246 | aclrtBinHandle binHandle; |
| 247 | CommConfig config; | 247 | CommConfig config; |
| @@ -263,7 +263,7 @@ TEST_F(MyRankTest, Ut_Init_When_Ccu_Driver_Fail_Expect_Fallback_Aicpu) | |||
| 263 | TEST_F(MyRankTest, Ut_Init_When_Ccu_Ms_Insufficient_Expect_Fallback_Sched) | 263 | TEST_F(MyRankTest, Ut_Init_When_Ccu_Ms_Insufficient_Expect_Fallback_Sched) |
| 264 | { | 264 | { |
| 265 | setenv("HCCL_CCU_CUSTOM_OP_MODE", "1", 1); | 265 | setenv("HCCL_CCU_CUSTOM_OP_MODE", "1", 1); |
| 266 | - MOCKER(HcommCcuInsCreate).stubs() | 266 | + MOCKER(HcommCcuInsCreateLegacy).stubs() |
| 267 | .will(returnValue(CcuResult::CCU_E_UNAVAIL)) | 267 | .will(returnValue(CcuResult::CCU_E_UNAVAIL)) |
| 268 | .then(returnValue(CcuResult::CCU_SUCCESS)); | 268 | .then(returnValue(CcuResult::CCU_SUCCESS)); |
| 269 | 269 | ||
| @@ -287,7 +287,7 @@ TEST_F(MyRankTest, Ut_Init_When_Ccu_Ms_Insufficient_Expect_Fallback_Sched) | |||
| 287 | TEST_F(MyRankTest, Ut_Init_When_Ccu_Ms_And_Sched_Insufficient_Expect_Fallback_Aicpu) | 287 | TEST_F(MyRankTest, Ut_Init_When_Ccu_Ms_And_Sched_Insufficient_Expect_Fallback_Aicpu) |
| 288 | { | 288 | { |
| 289 | setenv("HCCL_CCU_CUSTOM_OP_MODE", "1", 1); | 289 | setenv("HCCL_CCU_CUSTOM_OP_MODE", "1", 1); |
| 290 | - MOCKER(HcommCcuInsCreate).stubs().will(returnValue(CcuResult::CCU_E_UNAVAIL)); | 290 | + MOCKER(HcommCcuInsCreateLegacy).stubs().will(returnValue(CcuResult::CCU_E_UNAVAIL)); |
| 291 | 291 | ||
| 292 | aclrtBinHandle binHandle; | 292 | aclrtBinHandle binHandle; |
| 293 | CommConfig config; | 293 | CommConfig config; |
| @@ -309,7 +309,7 @@ TEST_F(MyRankTest, Ut_Init_When_Ccu_Ms_And_Sched_Insufficient_Expect_Fallback_Ai | |||
| 309 | TEST_F(MyRankTest, Ut_Init_When_Resource_Fail_Expect_Fail) | 309 | TEST_F(MyRankTest, Ut_Init_When_Resource_Fail_Expect_Fail) |
| 310 | { | 310 | { |
| 311 | setenv("HCCL_CCU_CUSTOM_OP_MODE", "1", 1); | 311 | setenv("HCCL_CCU_CUSTOM_OP_MODE", "1", 1); |
| 312 | - MOCKER(HcommCcuInsCreate).stubs().will(returnValue(CcuResult::CCU_E_PARA)); | 312 | + MOCKER(HcommCcuInsCreateLegacy).stubs().will(returnValue(CcuResult::CCU_E_PARA)); |
| 313 | 313 | ||
| 314 | aclrtBinHandle binHandle; | 314 | aclrtBinHandle binHandle; |
| 315 | CommConfig config; | 315 | CommConfig config; |
| @@ -13,6 +13,7 @@ set(src_to_test_list | |||
| 13 | hccl_api_base_test.cc | 13 | hccl_api_base_test.cc |
| 14 | ut_CcuComponent_test.cc | 14 | ut_CcuComponent_test.cc |
| 15 | ut_HcommCcuControlApi_test.cc | 15 | ut_HcommCcuControlApi_test.cc |
| 16 | + ut_hcomm_ccu_res_stub_api_test.cc | ||
| 16 | 17 | ||
| 17 | mocks/ccu_device_mock_utils.cc | 18 | mocks/ccu_device_mock_utils.cc |
| 18 | mocks/ccu_drv_handle_mock.cc | 19 | mocks/ccu_drv_handle_mock.cc |
| @@ -162,7 +162,7 @@ TEST_F(HcommCcuControlApiTest, testName) | |||
| 162 | resDesc.insType = CcuInstanceType::CCU_MS; \ | 162 | resDesc.insType = CcuInstanceType::CCU_MS; \ |
| 163 | constexpr uint32_t descNum = 1; \ | 163 | constexpr uint32_t descNum = 1; \ |
| 164 | CcuInsHandle insHandle{0}; \ | 164 | CcuInsHandle insHandle{0}; \ |
| 165 | - ccuRet = HcommCcuInsCreate(static_cast<void *>(&resDesc), descNum, &insHandle); \ | 165 | + ccuRet = HcommCcuInsCreateLegacy(static_cast<void *>(&resDesc), descNum, &insHandle); \ |
| 166 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); \ | 166 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); \ |
| 167 | \ | 167 | \ |
| 168 | ccuRet = HcommCcuKernelRegisterStart(insHandle); \ | 168 | ccuRet = HcommCcuKernelRegisterStart(insHandle); \ |
| @@ -185,7 +185,7 @@ TEST_F(HcommCcuControlApiTest, testName) | |||
| 185 | EXPECT_NE(ccuRet, CcuResult::CCU_SUCCESS); \ | 185 | EXPECT_NE(ccuRet, CcuResult::CCU_SUCCESS); \ |
| 186 | } \ | 186 | } \ |
| 187 | \ | 187 | \ |
| 188 | - ccuRet = HcommCcuInsDestroy(insHandle, fakeDeviceLogicId); \ | 188 | + ccuRet = HcommCcuInsDestroyLegacy(insHandle, fakeDeviceLogicId); \ |
| 189 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); \ | 189 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); \ |
| 190 | } | 190 | } |
| 191 | 191 | ||
| @@ -218,7 +218,7 @@ TEST_F(HcommCcuControlApiTest, Ut_LoopObjectApi_Expect_Success) | |||
| 218 | resDesc.insType = CcuInstanceType::CCU_MS; | 218 | resDesc.insType = CcuInstanceType::CCU_MS; |
| 219 | constexpr uint32_t descNum = 1; | 219 | constexpr uint32_t descNum = 1; |
| 220 | CcuInsHandle insHandle{0}; | 220 | CcuInsHandle insHandle{0}; |
| 221 | - ccuRet = HcommCcuInsCreate(static_cast<void *>(&resDesc), descNum, &insHandle); | 221 | + ccuRet = HcommCcuInsCreateLegacy(static_cast<void *>(&resDesc), descNum, &insHandle); |
| 222 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 222 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 223 | 223 | ||
| 224 | ccuRet = HcommCcuKernelRegisterStart(insHandle); | 224 | ccuRet = HcommCcuKernelRegisterStart(insHandle); |
| @@ -242,7 +242,7 @@ TEST_F(HcommCcuControlApiTest, Ut_LoopObjectApi_Expect_Success) | |||
| 242 | ccuRet = HcommCcuKernelRegisterEnd(insHandle); | 242 | ccuRet = HcommCcuKernelRegisterEnd(insHandle); |
| 243 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 243 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 244 | 244 | ||
| 245 | - ccuRet = HcommCcuInsDestroy(insHandle, fakeDeviceLogicId); | 245 | + ccuRet = HcommCcuInsDestroyLegacy(insHandle, fakeDeviceLogicId); |
| 246 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 246 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 247 | } | 247 | } |
| 248 | 248 | ||
| @@ -274,7 +274,7 @@ TEST_F(HcommCcuControlApiTest, Ut_HcommCcuKernelRegister_When_AllFine_Expect_Ret | |||
| 274 | resDesc.insType = MS_INS_TPYE; | 274 | resDesc.insType = MS_INS_TPYE; |
| 275 | constexpr uint32_t descNum = 1; | 275 | constexpr uint32_t descNum = 1; |
| 276 | CcuInsHandle insHandle{0}; | 276 | CcuInsHandle insHandle{0}; |
| 277 | - ccuRet = HcommCcuInsCreate(static_cast<void *>(&resDesc), descNum, &insHandle); | 277 | + ccuRet = HcommCcuInsCreateLegacy(static_cast<void *>(&resDesc), descNum, &insHandle); |
| 278 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 278 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 279 | 279 | ||
| 280 | // 建链流程打桩 | 280 | // 建链流程打桩 |
| @@ -326,7 +326,7 @@ TEST_F(HcommCcuControlApiTest, Ut_HcommCcuKernelRegister_When_AllFine_Expect_Ret | |||
| 326 | 326 | ||
| 327 | // 清理各种资源,析构有时序要求 | 327 | // 清理各种资源,析构有时序要求 |
| 328 | MockChannelDestory(handlePair); | 328 | MockChannelDestory(handlePair); |
| 329 | - ccuRet = HcommCcuInsDestroy(insHandle, fakeDeviceLogicId); | 329 | + ccuRet = HcommCcuInsDestroyLegacy(insHandle, fakeDeviceLogicId); |
| 330 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 330 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 331 | } | 331 | } |
| 332 | 332 | ||
| @@ -355,7 +355,7 @@ TEST_F(HcommCcuControlApiTest, Ut_HcommCcuKernelDoWhile_When_AllFine_Expect_Retu | |||
| 355 | resDesc.insType = MS_INS_TPYE; | 355 | resDesc.insType = MS_INS_TPYE; |
| 356 | constexpr uint32_t descNum = 1; | 356 | constexpr uint32_t descNum = 1; |
| 357 | CcuInsHandle insHandle{0}; | 357 | CcuInsHandle insHandle{0}; |
| 358 | - ccuRet = HcommCcuInsCreate(static_cast<void *>(&resDesc), descNum, &insHandle); | 358 | + ccuRet = HcommCcuInsCreateLegacy(static_cast<void *>(&resDesc), descNum, &insHandle); |
| 359 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 359 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 360 | 360 | ||
| 361 | constexpr auto commEngine = CommEngine::COMM_ENGINE_CCU; | 361 | constexpr auto commEngine = CommEngine::COMM_ENGINE_CCU; |
| @@ -387,7 +387,7 @@ TEST_F(HcommCcuControlApiTest, Ut_HcommCcuKernelDoWhile_When_AllFine_Expect_Retu | |||
| 387 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 387 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 388 | 388 | ||
| 389 | MockChannelDestory(handlePair); | 389 | MockChannelDestory(handlePair); |
| 390 | - ccuRet = HcommCcuInsDestroy(insHandle, fakeDeviceLogicId); | 390 | + ccuRet = HcommCcuInsDestroyLegacy(insHandle, fakeDeviceLogicId); |
| 391 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 391 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 392 | } | 392 | } |
| 393 | 393 | ||
| @@ -416,7 +416,7 @@ TEST_F(HcommCcuControlApiTest, Ut_HcommCcuKernelNestedIfOuterElse_When_AllFine_E | |||
| 416 | resDesc.insType = MS_INS_TPYE; | 416 | resDesc.insType = MS_INS_TPYE; |
| 417 | constexpr uint32_t descNum = 1; | 417 | constexpr uint32_t descNum = 1; |
| 418 | CcuInsHandle insHandle{0}; | 418 | CcuInsHandle insHandle{0}; |
| 419 | - ccuRet = HcommCcuInsCreate(static_cast<void *>(&resDesc), descNum, &insHandle); | 419 | + ccuRet = HcommCcuInsCreateLegacy(static_cast<void *>(&resDesc), descNum, &insHandle); |
| 420 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 420 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 421 | 421 | ||
| 422 | constexpr auto commEngine = CommEngine::COMM_ENGINE_CCU; | 422 | constexpr auto commEngine = CommEngine::COMM_ENGINE_CCU; |
| @@ -451,7 +451,7 @@ TEST_F(HcommCcuControlApiTest, Ut_HcommCcuKernelNestedIfOuterElse_When_AllFine_E | |||
| 451 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 451 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 452 | 452 | ||
| 453 | MockChannelDestory(handlePair); | 453 | MockChannelDestory(handlePair); |
| 454 | - ccuRet = HcommCcuInsDestroy(insHandle, fakeDeviceLogicId); | 454 | + ccuRet = HcommCcuInsDestroyLegacy(insHandle, fakeDeviceLogicId); |
| 455 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 455 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 456 | } | 456 | } |
| 457 | 457 | ||
| @@ -480,7 +480,7 @@ TEST_F(HcommCcuControlApiTest, Ut_HcommCcuKernelNestedIfInnerElse_When_AllFine_E | |||
| 480 | resDesc.insType = MS_INS_TPYE; | 480 | resDesc.insType = MS_INS_TPYE; |
| 481 | constexpr uint32_t descNum = 1; | 481 | constexpr uint32_t descNum = 1; |
| 482 | CcuInsHandle insHandle{0}; | 482 | CcuInsHandle insHandle{0}; |
| 483 | - ccuRet = HcommCcuInsCreate(static_cast<void *>(&resDesc), descNum, &insHandle); | 483 | + ccuRet = HcommCcuInsCreateLegacy(static_cast<void *>(&resDesc), descNum, &insHandle); |
| 484 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 484 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 485 | 485 | ||
| 486 | constexpr auto commEngine = CommEngine::COMM_ENGINE_CCU; | 486 | constexpr auto commEngine = CommEngine::COMM_ENGINE_CCU; |
| @@ -515,7 +515,7 @@ TEST_F(HcommCcuControlApiTest, Ut_HcommCcuKernelNestedIfInnerElse_When_AllFine_E | |||
| 515 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 515 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 516 | 516 | ||
| 517 | MockChannelDestory(handlePair); | 517 | MockChannelDestory(handlePair); |
| 518 | - ccuRet = HcommCcuInsDestroy(insHandle, fakeDeviceLogicId); | 518 | + ccuRet = HcommCcuInsDestroyLegacy(insHandle, fakeDeviceLogicId); |
| 519 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 519 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 520 | } | 520 | } |
| 521 | 521 | ||
| @@ -544,7 +544,7 @@ TEST_F(HcommCcuControlApiTest, Ut_HcommCcuKernelDoWhileUnified_When_AllFine_Expe | |||
| 544 | resDesc.insType = MS_INS_TPYE; | 544 | resDesc.insType = MS_INS_TPYE; |
| 545 | constexpr uint32_t descNum = 1; | 545 | constexpr uint32_t descNum = 1; |
| 546 | CcuInsHandle insHandle{0}; | 546 | CcuInsHandle insHandle{0}; |
| 547 | - ccuRet = HcommCcuInsCreate(static_cast<void *>(&resDesc), descNum, &insHandle); | 547 | + ccuRet = HcommCcuInsCreateLegacy(static_cast<void *>(&resDesc), descNum, &insHandle); |
| 548 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 548 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 549 | 549 | ||
| 550 | constexpr auto commEngine = CommEngine::COMM_ENGINE_CCU; | 550 | constexpr auto commEngine = CommEngine::COMM_ENGINE_CCU; |
| @@ -576,7 +576,7 @@ TEST_F(HcommCcuControlApiTest, Ut_HcommCcuKernelDoWhileUnified_When_AllFine_Expe | |||
| 576 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 576 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 577 | 577 | ||
| 578 | MockChannelDestory(handlePair); | 578 | MockChannelDestory(handlePair); |
| 579 | - ccuRet = HcommCcuInsDestroy(insHandle, fakeDeviceLogicId); | 579 | + ccuRet = HcommCcuInsDestroyLegacy(insHandle, fakeDeviceLogicId); |
| 580 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 580 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 581 | } | 581 | } |
| 582 | 582 | ||
| @@ -605,7 +605,7 @@ TEST_F(HcommCcuControlApiTest, Ut_HcommCcuKernelLoopAdd_When_AllFine_Expect_Retu | |||
| 605 | resDesc.insType = MS_INS_TPYE; | 605 | resDesc.insType = MS_INS_TPYE; |
| 606 | constexpr uint32_t descNum = 1; | 606 | constexpr uint32_t descNum = 1; |
| 607 | CcuInsHandle insHandle{0}; | 607 | CcuInsHandle insHandle{0}; |
| 608 | - ccuRet = HcommCcuInsCreate(static_cast<void *>(&resDesc), descNum, &insHandle); | 608 | + ccuRet = HcommCcuInsCreateLegacy(static_cast<void *>(&resDesc), descNum, &insHandle); |
| 609 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 609 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 610 | 610 | ||
| 611 | constexpr auto commEngine = CommEngine::COMM_ENGINE_CCU; | 611 | constexpr auto commEngine = CommEngine::COMM_ENGINE_CCU; |
| @@ -638,7 +638,7 @@ TEST_F(HcommCcuControlApiTest, Ut_HcommCcuKernelLoopAdd_When_AllFine_Expect_Retu | |||
| 638 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 638 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 639 | 639 | ||
| 640 | MockChannelDestory(handlePair); | 640 | MockChannelDestory(handlePair); |
| 641 | - ccuRet = HcommCcuInsDestroy(insHandle, fakeDeviceLogicId); | 641 | + ccuRet = HcommCcuInsDestroyLegacy(insHandle, fakeDeviceLogicId); |
| 642 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 642 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 643 | } | 643 | } |
| 644 | 644 | ||
| @@ -667,7 +667,7 @@ TEST_F(HcommCcuControlApiTest, Ut_HcommCcuKernelRemoteRead_When_AllFine_Expect_R | |||
| 667 | resDesc.insType = MS_INS_TPYE; | 667 | resDesc.insType = MS_INS_TPYE; |
| 668 | constexpr uint32_t descNum = 1; | 668 | constexpr uint32_t descNum = 1; |
| 669 | CcuInsHandle insHandle{0}; | 669 | CcuInsHandle insHandle{0}; |
| 670 | - ccuRet = HcommCcuInsCreate(static_cast<void *>(&resDesc), descNum, &insHandle); | 670 | + ccuRet = HcommCcuInsCreateLegacy(static_cast<void *>(&resDesc), descNum, &insHandle); |
| 671 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 671 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 672 | 672 | ||
| 673 | constexpr auto commEngine = CommEngine::COMM_ENGINE_CCU; | 673 | constexpr auto commEngine = CommEngine::COMM_ENGINE_CCU; |
| @@ -699,7 +699,7 @@ TEST_F(HcommCcuControlApiTest, Ut_HcommCcuKernelRemoteRead_When_AllFine_Expect_R | |||
| 699 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 699 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 700 | 700 | ||
| 701 | MockChannelDestory(handlePair); | 701 | MockChannelDestory(handlePair); |
| 702 | - ccuRet = HcommCcuInsDestroy(insHandle, fakeDeviceLogicId); | 702 | + ccuRet = HcommCcuInsDestroyLegacy(insHandle, fakeDeviceLogicId); |
| 703 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 703 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 704 | } | 704 | } |
| 705 | 705 | ||
| @@ -728,7 +728,7 @@ TEST_F(HcommCcuControlApiTest, Ut_HcommCcuKernelRemoteWrite_When_AllFine_Expect_ | |||
| 728 | resDesc.insType = MS_INS_TPYE; | 728 | resDesc.insType = MS_INS_TPYE; |
| 729 | constexpr uint32_t descNum = 1; | 729 | constexpr uint32_t descNum = 1; |
| 730 | CcuInsHandle insHandle{0}; | 730 | CcuInsHandle insHandle{0}; |
| 731 | - ccuRet = HcommCcuInsCreate(static_cast<void *>(&resDesc), descNum, &insHandle); | 731 | + ccuRet = HcommCcuInsCreateLegacy(static_cast<void *>(&resDesc), descNum, &insHandle); |
| 732 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 732 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 733 | 733 | ||
| 734 | constexpr auto commEngine = CommEngine::COMM_ENGINE_CCU; | 734 | constexpr auto commEngine = CommEngine::COMM_ENGINE_CCU; |
| @@ -760,7 +760,7 @@ TEST_F(HcommCcuControlApiTest, Ut_HcommCcuKernelRemoteWrite_When_AllFine_Expect_ | |||
| 760 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 760 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 761 | 761 | ||
| 762 | MockChannelDestory(handlePair); | 762 | MockChannelDestory(handlePair); |
| 763 | - ccuRet = HcommCcuInsDestroy(insHandle, fakeDeviceLogicId); | 763 | + ccuRet = HcommCcuInsDestroyLegacy(insHandle, fakeDeviceLogicId); |
| 764 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 764 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 765 | } | 765 | } |
| 766 | 766 | ||
| @@ -789,7 +789,7 @@ TEST_F(HcommCcuControlApiTest, Ut_HcommCcuKernelAlloc_When_AllFine_Expect_Return | |||
| 789 | resDesc.insType = MS_INS_TPYE; | 789 | resDesc.insType = MS_INS_TPYE; |
| 790 | constexpr uint32_t descNum = 1; | 790 | constexpr uint32_t descNum = 1; |
| 791 | CcuInsHandle insHandle{0}; | 791 | CcuInsHandle insHandle{0}; |
| 792 | - ccuRet = HcommCcuInsCreate(static_cast<void *>(&resDesc), descNum, &insHandle); | 792 | + ccuRet = HcommCcuInsCreateLegacy(static_cast<void *>(&resDesc), descNum, &insHandle); |
| 793 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 793 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 794 | 794 | ||
| 795 | constexpr auto commEngine = CommEngine::COMM_ENGINE_CCU; | 795 | constexpr auto commEngine = CommEngine::COMM_ENGINE_CCU; |
| @@ -821,7 +821,7 @@ TEST_F(HcommCcuControlApiTest, Ut_HcommCcuKernelAlloc_When_AllFine_Expect_Return | |||
| 821 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 821 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 822 | 822 | ||
| 823 | MockChannelDestory(handlePair); | 823 | MockChannelDestory(handlePair); |
| 824 | - ccuRet = HcommCcuInsDestroy(insHandle, fakeDeviceLogicId); | 824 | + ccuRet = HcommCcuInsDestroyLegacy(insHandle, fakeDeviceLogicId); |
| 825 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 825 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 826 | } | 826 | } |
| 827 | 827 | ||
| @@ -853,7 +853,7 @@ TEST_F(HcommCcuControlApiTest, Ut_HcommCcuKernelReduceScatterMesh1d_When_AllFine | |||
| 853 | resDesc.insType = MS_INS_TPYE; | 853 | resDesc.insType = MS_INS_TPYE; |
| 854 | constexpr uint32_t descNum = 1; | 854 | constexpr uint32_t descNum = 1; |
| 855 | CcuInsHandle insHandle{0}; | 855 | CcuInsHandle insHandle{0}; |
| 856 | - ccuRet = HcommCcuInsCreate(static_cast<void *>(&resDesc), descNum, &insHandle); | 856 | + ccuRet = HcommCcuInsCreateLegacy(static_cast<void *>(&resDesc), descNum, &insHandle); |
| 857 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 857 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 858 | 858 | ||
| 859 | // 建链流程打桩 | 859 | // 建链流程打桩 |
| @@ -908,7 +908,7 @@ TEST_F(HcommCcuControlApiTest, Ut_HcommCcuKernelReduceScatterMesh1d_When_AllFine | |||
| 908 | 908 | ||
| 909 | // 清理各种资源,析构有时序要求 | 909 | // 清理各种资源,析构有时序要求 |
| 910 | MockChannelDestory(handlePair); | 910 | MockChannelDestory(handlePair); |
| 911 | - ccuRet = HcommCcuInsDestroy(insHandle, fakeDeviceLogicId); | 911 | + ccuRet = HcommCcuInsDestroyLegacy(insHandle, fakeDeviceLogicId); |
| 912 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 912 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 913 | } | 913 | } |
| 914 | 914 | ||
| @@ -937,7 +937,7 @@ TEST_F(HcommCcuControlApiTest, Ut_HcommCcuKernelNestedInIfIf_When_AllFine_Expect | |||
| 937 | resDesc.insType = MS_INS_TPYE; | 937 | resDesc.insType = MS_INS_TPYE; |
| 938 | constexpr uint32_t descNum = 1; | 938 | constexpr uint32_t descNum = 1; |
| 939 | CcuInsHandle insHandle{0}; | 939 | CcuInsHandle insHandle{0}; |
| 940 | - ccuRet = HcommCcuInsCreate(static_cast<void *>(&resDesc), descNum, &insHandle); | 940 | + ccuRet = HcommCcuInsCreateLegacy(static_cast<void *>(&resDesc), descNum, &insHandle); |
| 941 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 941 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 942 | 942 | ||
| 943 | constexpr auto commEngine = CommEngine::COMM_ENGINE_CCU; | 943 | constexpr auto commEngine = CommEngine::COMM_ENGINE_CCU; |
| @@ -974,7 +974,7 @@ TEST_F(HcommCcuControlApiTest, Ut_HcommCcuKernelNestedInIfIf_When_AllFine_Expect | |||
| 974 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 974 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 975 | 975 | ||
| 976 | MockChannelDestory(handlePair); | 976 | MockChannelDestory(handlePair); |
| 977 | - ccuRet = HcommCcuInsDestroy(insHandle, fakeDeviceLogicId); | 977 | + ccuRet = HcommCcuInsDestroyLegacy(insHandle, fakeDeviceLogicId); |
| 978 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 978 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 979 | } | 979 | } |
| 980 | 980 | ||
| @@ -1003,7 +1003,7 @@ TEST_F(HcommCcuControlApiTest, Ut_HcommCcuKernelAllGatherMesh1dMem2Mem_When_AllF | |||
| 1003 | resDesc.insType = MS_INS_TPYE; | 1003 | resDesc.insType = MS_INS_TPYE; |
| 1004 | constexpr uint32_t descNum = 1; | 1004 | constexpr uint32_t descNum = 1; |
| 1005 | CcuInsHandle insHandle{0}; | 1005 | CcuInsHandle insHandle{0}; |
| 1006 | - ccuRet = HcommCcuInsCreate(static_cast<void *>(&resDesc), descNum, &insHandle); | 1006 | + ccuRet = HcommCcuInsCreateLegacy(static_cast<void *>(&resDesc), descNum, &insHandle); |
| 1007 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 1007 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 1008 | 1008 | ||
| 1009 | constexpr auto commEngine = CommEngine::COMM_ENGINE_CCU; | 1009 | constexpr auto commEngine = CommEngine::COMM_ENGINE_CCU; |
| @@ -1048,13 +1048,13 @@ TEST_F(HcommCcuControlApiTest, Ut_HcommCcuKernelAllGatherMesh1dMem2Mem_When_AllF | |||
| 1048 | fakeTaskArgs, fakeArgSize), CcuResult::CCU_SUCCESS); | 1048 | fakeTaskArgs, fakeArgSize), CcuResult::CCU_SUCCESS); |
| 1049 | 1049 | ||
| 1050 | MockChannelDestory(handlePair); | 1050 | MockChannelDestory(handlePair); |
| 1051 | - ccuRet = HcommCcuInsDestroy(insHandle, fakeDeviceLogicId); | 1051 | + ccuRet = HcommCcuInsDestroyLegacy(insHandle, fakeDeviceLogicId); |
| 1052 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 1052 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 1053 | } | 1053 | } |
| 1054 | 1054 | ||
| 1055 | -// HcommCcuInsDestroy 接口在线程 DeviceId 与要析构的目标 DeviceId 不同时, | 1055 | +// HcommCcuInsDestroyLegacy 接口在线程 DeviceId 与要析构的目标 DeviceId 不同时, |
| 1056 | // 内部正确切换 Device 完成销毁并恢复原 Device | 1056 | // 内部正确切换 Device 完成销毁并恢复原 Device |
| 1057 | -TEST_F(HcommCcuControlApiTest, Ut_HcommCcuInsDestroy_CrossDevice_Expect_Success) | 1057 | +TEST_F(HcommCcuControlApiTest, Ut_HcommCcuInsDestroyLegacy_CrossDevice_Expect_Success) |
| 1058 | { | 1058 | { |
| 1059 | CcuResult ccuRet = CcuResult::CCU_E_RESERVED; | 1059 | CcuResult ccuRet = CcuResult::CCU_E_RESERVED; |
| 1060 | constexpr int32_t curThreadDevId = 0; // 当前线程的 DeviceId | 1060 | constexpr int32_t curThreadDevId = 0; // 当前线程的 DeviceId |
| @@ -1079,7 +1079,7 @@ TEST_F(HcommCcuControlApiTest, Ut_HcommCcuInsDestroy_CrossDevice_Expect_Success) | |||
| 1079 | resDesc.insType = CcuInstanceType::CCU_MS; | 1079 | resDesc.insType = CcuInstanceType::CCU_MS; |
| 1080 | constexpr uint32_t descNum = 1; | 1080 | constexpr uint32_t descNum = 1; |
| 1081 | CcuInsHandle insHandle{0}; | 1081 | CcuInsHandle insHandle{0}; |
| 1082 | - ccuRet = HcommCcuInsCreate(static_cast<void *>(&resDesc), descNum, &insHandle); | 1082 | + ccuRet = HcommCcuInsCreateLegacy(static_cast<void *>(&resDesc), descNum, &insHandle); |
| 1083 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 1083 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 1084 | 1084 | ||
| 1085 | // isDiffDevId=true 场景 | 1085 | // isDiffDevId=true 场景 |
| @@ -1087,6 +1087,6 @@ TEST_F(HcommCcuControlApiTest, Ut_HcommCcuInsDestroy_CrossDevice_Expect_Success) | |||
| 1087 | MOCKER(hrtSetDevice).stubs().will(returnValue(HcclResult::HCCL_SUCCESS)); | 1087 | MOCKER(hrtSetDevice).stubs().will(returnValue(HcclResult::HCCL_SUCCESS)); |
| 1088 | 1088 | ||
| 1089 | // 销毁 CcuInstance | 1089 | // 销毁 CcuInstance |
| 1090 | - ccuRet = HcommCcuInsDestroy(insHandle, otherDevId); | 1090 | + ccuRet = HcommCcuInsDestroyLegacy(insHandle, otherDevId); |
| 1091 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); | 1091 | EXPECT_EQ(ccuRet, CcuResult::CCU_SUCCESS); |
| 1092 | } | 1092 | } |
| @@ -0,0 +1,105 @@ | |||
| 1 | +/** | ||
| 2 | + * Copyright (c) 2026 Huawei Technologies Co., Ltd. | ||
| 3 | + * This program is free software, you can redistribute it and/or modify it under the terms and conditions of | ||
| 4 | + * CANN Open Software License Agreement Version 2.0 (the "License"). | ||
| 5 | + * Please refer to the License for details. You may not use this file except in compliance with the License. | ||
| 6 | + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | ||
| 7 | + * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | ||
| 8 | + * See LICENSE in the root of the software repository for the full text of the License. | ||
| 9 | + */ | ||
| 10 | + | ||
| 11 | +#include <gtest/gtest.h> | ||
| 12 | + | ||
| 13 | +#include "ccu/ccu_res.h" | ||
| 14 | +#include "hccl/hccl_ccu_res.h" | ||
| 15 | + | ||
| 16 | +namespace { | ||
| 17 | +constexpr uint32_t DIE_ID = 0; | ||
| 18 | +constexpr uint32_t DESC_NUM = 1; | ||
| 19 | +constexpr uint32_t DIE_NUM = 1; | ||
| 20 | +constexpr uint32_t KERNEL_ARG_NUM = 1; | ||
| 21 | +constexpr uint32_t RES_NUM = 1; | ||
| 22 | +constexpr HcommCcuResDescHandle RES_DESC = 1; | ||
| 23 | +constexpr CcuInsHandle CCU_INS_HANDLE = 1; | ||
| 24 | +} // namespace | ||
| 25 | + | ||
| 26 | +TEST(HcommCcuResStubApiTest, Ut_HcommCcuInsResDescCreate_WhenCalled_ExpectNotSupport) | ||
| 27 | +{ | ||
| 28 | + HcommCcuResDescHandle resDesc = RES_DESC; | ||
| 29 | + | ||
| 30 | + EXPECT_EQ(HcommCcuInsResDescCreate(DIE_ID, &resDesc), CcuResult::CCU_E_NOT_SUPPORT); | ||
| 31 | +} | ||
| 32 | + | ||
| 33 | +TEST(HcommCcuResStubApiTest, Ut_HcommCcuInsResDescDestroy_WhenCalled_ExpectNotSupport) | ||
| 34 | +{ | ||
| 35 | + EXPECT_EQ(HcommCcuInsResDescDestroy(RES_DESC), CcuResult::CCU_E_NOT_SUPPORT); | ||
| 36 | +} | ||
| 37 | + | ||
| 38 | +TEST(HcommCcuResStubApiTest, Ut_HcommCcuInsResDescQueryDieId_WhenCalled_ExpectNotSupport) | ||
| 39 | +{ | ||
| 40 | + uint32_t dieId = DIE_ID; | ||
| 41 | + | ||
| 42 | + EXPECT_EQ(HcommCcuInsResDescQueryDieId(RES_DESC, &dieId), CcuResult::CCU_E_NOT_SUPPORT); | ||
| 43 | +} | ||
| 44 | + | ||
| 45 | +TEST(HcommCcuResStubApiTest, Ut_HcommCcuInsResDescSetNum_WhenCalled_ExpectNotSupport) | ||
| 46 | +{ | ||
| 47 | + EXPECT_EQ(HcommCcuInsResDescSetNum(RES_DESC, HCOMM_CCU_RES_TYPE_LOOP, RES_NUM), | ||
| 48 | + CcuResult::CCU_E_NOT_SUPPORT); | ||
| 49 | +} | ||
| 50 | + | ||
| 51 | +TEST(HcommCcuResStubApiTest, Ut_HcommCcuInsResDescQueryNum_WhenCalled_ExpectNotSupport) | ||
| 52 | +{ | ||
| 53 | + uint32_t resNum = RES_NUM; | ||
| 54 | + | ||
| 55 | + EXPECT_EQ(HcommCcuInsResDescQueryNum(RES_DESC, HCOMM_CCU_RES_TYPE_LOOP, &resNum), | ||
| 56 | + CcuResult::CCU_E_NOT_SUPPORT); | ||
| 57 | +} | ||
| 58 | + | ||
| 59 | +TEST(HcommCcuResStubApiTest, Ut_HcommCcuInsCreate_WhenCalled_ExpectNotSupport) | ||
| 60 | +{ | ||
| 61 | + HcommCcuResDescHandle resDescs[DESC_NUM] = {RES_DESC}; | ||
| 62 | + CcuInsHandle insHandle = CCU_INS_HANDLE; | ||
| 63 | + | ||
| 64 | + EXPECT_EQ(HcommCcuInsCreate(resDescs, DESC_NUM, &insHandle), CcuResult::CCU_E_NOT_SUPPORT); | ||
| 65 | +} | ||
| 66 | + | ||
| 67 | +TEST(HcommCcuResStubApiTest, Ut_HcommCcuInsCreateDefault_WhenCalled_ExpectNotSupport) | ||
| 68 | +{ | ||
| 69 | + uint32_t dieIds[DIE_NUM] = {DIE_ID}; | ||
| 70 | + CcuInsHandle insHandle = CCU_INS_HANDLE; | ||
| 71 | + | ||
| 72 | + EXPECT_EQ(HcommCcuInsCreateDefault(dieIds, DIE_NUM, &insHandle), CcuResult::CCU_E_NOT_SUPPORT); | ||
| 73 | +} | ||
| 74 | + | ||
| 75 | +TEST(HcommCcuResStubApiTest, Ut_HcommCcuInsDestroy_WhenCalled_ExpectNotSupport) | ||
| 76 | +{ | ||
| 77 | + EXPECT_EQ(HcommCcuInsDestroy(CCU_INS_HANDLE), CcuResult::CCU_E_NOT_SUPPORT); | ||
| 78 | +} | ||
| 79 | + | ||
| 80 | +TEST(HcommCcuResStubApiTest, Ut_HcommCcuInsQueryResDesc_WhenCalled_ExpectNotSupport) | ||
| 81 | +{ | ||
| 82 | + EXPECT_EQ(HcommCcuInsQueryResDesc(CCU_INS_HANDLE, RES_DESC), CcuResult::CCU_E_NOT_SUPPORT); | ||
| 83 | +} | ||
| 84 | + | ||
| 85 | +TEST(HcommCcuResStubApiTest, Ut_HcommCcuQueryRemainResDesc_WhenCalled_ExpectNotSupport) | ||
| 86 | +{ | ||
| 87 | + EXPECT_EQ(HcommCcuQueryRemainResDesc(RES_DESC), CcuResult::CCU_E_NOT_SUPPORT); | ||
| 88 | +} | ||
| 89 | + | ||
| 90 | +TEST(HcommCcuResStubApiTest, Ut_HcommCcuKernelQueryResReq_WhenCalled_ExpectNotSupport) | ||
| 91 | +{ | ||
| 92 | + uint32_t kernelFunc = 0; | ||
| 93 | + const void *kernelArgs[KERNEL_ARG_NUM] = {nullptr}; | ||
| 94 | + | ||
| 95 | + EXPECT_EQ(HcommCcuKernelQueryResReq(&kernelFunc, kernelArgs, KERNEL_ARG_NUM, RES_DESC), | ||
| 96 | + CcuResult::CCU_E_NOT_SUPPORT); | ||
| 97 | +} | ||
| 98 | + | ||
| 99 | +TEST(HcommCcuResStubApiTest, Ut_HcclCommAssignCcuIns_WhenCalled_ExpectNotSupport) | ||
| 100 | +{ | ||
| 101 | + uint32_t commStorage = 0; | ||
| 102 | + HcclComm comm = &commStorage; | ||
| 103 | + | ||
| 104 | + EXPECT_EQ(HcclCommAssignCcuIns(comm, CCU_INS_HANDLE), HcclResult::HCCL_E_NOT_SUPPORT); | ||
| 105 | +} | ||


有要求,代码仓md的接口资料和对外接口同时合入哈~