LCOV - code coverage report
Current view: top level - legacy/ascend910/framework/communicator - hccl_comm.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 54.0 % 744 402
Test Date: 2026-08-04 10:52:23 Functions: 58.2 % 134 78

            Line data    Source code
       1              : /**
       2              :  * Copyright (c) 2025 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 <atomic>
      12              : #include <algorithm>
      13              : #include <arpa/inet.h>
      14              : #include <fstream>
      15              : #include <fcntl.h>
      16              : #include <unistd.h>
      17              : #include <hccl/hccl_types.h>
      18              : #include "hccl_communicator.h"
      19              : #include "hccl_comm_pub.h"
      20              : #include "coll_alg_utils.h"
      21              : #include "env_config.h"
      22              : #include "comm_configer.h"
      23              : #include "hccl_group_utils.h"
      24              : #include "hccl_dispatcher_ctx.h"
      25              : 
      26              : namespace hccl {
      27              : RankTable_t g_hcclDefaultRankTable;
      28              : 
      29          603 : hcclComm::hcclComm(u64 inCCLbufferSize, u64 outCCLbufferSize, std::string identifier, std::string cclBuffName)
      30          604 :     : barrierSendBuf(nullptr), barrierRecvBuf(nullptr),
      31          604 :       inCCLbufferSize_(inCCLbufferSize), outCCLbufferSize_(outCCLbufferSize),
      32          604 :       deviceType_(DevType::DEV_TYPE_COUNT), isFirstBarrier_(true), identifier_(identifier), cclBuffName_(cclBuffName), isHeterogComm_(false),
      33         1207 :       isResetDevice_(false), isSpecialType_(false), communicator_(nullptr)
      34              : {
      35          604 :     indirectInCCLbuffer_ = DeviceMem();
      36          603 :     indirectOutCCLbuffer_ = DeviceMem();
      37          603 :     barrierInMemory_ = DeviceMem();
      38          602 :     barrierOutMemory_ = DeviceMem();
      39          603 :     planner = std::make_shared<hcclKernelPlanner>();
      40          602 : }
      41              : 
      42         1805 : hcclComm::~hcclComm()
      43              : {
      44          601 :     RealeaseBarrierMemory();
      45          603 :     (void)UnRegistTaskAbortHandler();
      46          604 :     BinaryUnLoad();
      47          604 :     communicator_ = nullptr;
      48          604 : }
      49              : 
      50            0 : HcclResult hcclComm::ReleaseSubComms() const
      51              : {
      52            0 :     CHK_SMART_PTR_NULL(communicator_);
      53              : 
      54            0 :     CHK_RET(communicator_->ReleaseCommInfos());
      55              : 
      56            0 :     return HCCL_SUCCESS;
      57              : }
      58              : 
      59            0 : void hcclComm::ReleaseCommCCLbuffer() const
      60              : {
      61            0 :     if (!communicator_) {
      62            0 :         return;
      63              :     }
      64            0 :     communicator_->ReleaseCommCCLbuffer();
      65              : }
      66              : 
      67          601 : void hcclComm::RealeaseBarrierMemory()
      68              : {
      69          601 :     barrierInMemory_.free();
      70          603 :     barrierOutMemory_.free();
      71          602 : }
      72              : 
      73          235 : HcclResult hcclComm::RealeaseShareCCLbuffer()
      74              : {
      75          235 :     CHK_RET(ShareCCLbufferMgr::GetInstance().FreeShareCCLbuffer(cclBuffName_));
      76          235 :     return HCCL_SUCCESS;
      77              : }
      78              : 
      79          408 : void hcclComm::UpdateIsHaveCpuRank(const RankTable_t &rankTable)
      80              : {
      81         1579 :     for (u32 i = 0; i < rankTable.rankList.size(); i++) {
      82              :         // 同一server的标识IP 是一样的,所以可以以此推算出平均dev个数
      83         1171 :         if (rankTable.rankList[i].deviceInfo.devicePhyId == HOST_DEVICE_ID) {
      84            0 :             isHaveCpuRank_ = true;
      85              :         }
      86              :     }
      87          409 : }
      88              : 
      89            2 : void hcclComm::UpdateIsHaveCpuRank(const std::vector<RankInfo> &rankList)
      90              : {
      91            2 :     for (u32 i = 0; i < rankList.size(); i++) {
      92              :         // 同一server的标识IP 是一样的,所以可以以此推算出平均dev个数
      93            0 :         if (rankList[i].devicePhyId == HOST_DEVICE_ID) {
      94            0 :             isHaveCpuRank_ = true;
      95              :         }
      96              :     }
      97            2 : }
      98              : 
      99          408 : HcclResult hcclComm::init(HcclCommParams &params, const CommConfig &commConfig, const RankTable_t &rankTable)
     100              : {
     101          408 :     UpdateIsHaveCpuRank(rankTable);
     102          409 :     isHeterogComm_ = params.isHeterogComm;
     103              : 
     104          409 :     HCCL_INFO("hcclComm init workmode [%d]", params.commWorkMode);
     105          409 :     if (params.commWorkMode == WorkMode::HCCL_MODE_AI_CPU) {
     106            0 :         isSpecialType_ = true;
     107              :     }
     108          409 :     CHK_RET(InitImpl(params.deviceType, commConfig));
     109              : 
     110              :     /* 强行将最后一个字符置0, 确保其可以做字符串操作 */
     111          409 :     params.id.internal[HCCL_ROOT_INFO_BYTES - 1] = '\0';
     112              : 
     113              :     /* 入参判断 */
     114          409 :     if (params.rank >= params.totalRanks) {
     115            2 :         HCCL_ERROR("[HcclComm][Init]errNo[0x%016llx] rank[%u] out of range[0, %u]", HCCL_ERROR_CODE(HCCL_E_PARA),
     116              :             params.rank, params.totalRanks - 1);
     117            2 :         return HCCL_E_PARA;
     118              :     }
     119          407 :     params.identifier = identifier_;
     120          407 :     params.cclBuffName = cclBuffName_;
     121              : 
     122              :     /* 设置commConfig单例 */
     123          407 :     HcclResult ret = CommConfiger::GetInstance().SetCommConfig(commConfig, identifier_);
     124          407 :     CHK_PRT_RET(ret != HCCL_SUCCESS,
     125              :         HCCL_ERROR("[hcclComm][init]errNo[0x%016llx] set commConfiger failed.",
     126              :         HCCL_ERROR_CODE(ret)), HCCL_E_PARA);
     127              : 
     128          407 :     CHK_RET(communicator_->AtomicInitSet());                  /* 初始化竞争, 只允许被初始化一次 */
     129          407 :     ret = communicator_->Init(params, rankTable);  /* 初始化实例, 失败则重新开放初始化竞争 */
     130          407 :     if (ret != HCCL_SUCCESS) {
     131            4 :         HCCL_ERROR("[HcclComm][Init]errNo[0x%016llx] hccl initialize failed", HCCL_ERROR_CODE(ret));
     132            4 :         communicator_->AtomicInitClear();
     133            4 :         return ret;
     134              :     }
     135          403 :     CHK_RET(ShareCCLbufferMgr::GetInstance().RecordShareCCLbuffer(cclBuffName_));
     136          403 :     if (params.totalRanks != 1 ) {
     137          206 :         CHK_RET(communicator_->InitCCLbuffer(inCCLbufferSize_, outCCLbufferSize_));
     138              :     }
     139              : 
     140          403 :     HCCL_USER_CRITICAL_LOG("hcclCommInitInfo:commId[%s], rank[%u], totalRanks[%u], serverId[%s], deviceType[%d]," \
     141              :         "logicDevId[%d], identifier[%s]", params.id.internal, params.rank, params.totalRanks, params.serverId.c_str(),
     142              :         params.deviceType, params.logicDevId, params.identifier.c_str());
     143              : 
     144          403 :     InitIndependentOp();
     145              : 
     146          403 :     return HCCL_SUCCESS;
     147              : }
     148              : 
     149            2 : HcclResult hcclComm::init(HcclCommParams &params, const CommConfig &commConfig, const std::vector<RankInfo> &rankList,
     150              :                           WorldGroupInfo &groupCommonData)
     151              : {
     152            2 :     UpdateIsHaveCpuRank(rankList);
     153              :     /* 强行将最后一个字符置0, 确保其可以做字符串操作 */
     154            2 :     params.id.internal[HCCL_ROOT_INFO_BYTES - 1] = '\0';
     155              : 
     156            2 :     HCCL_USER_CRITICAL_LOG("rootInfo[%s], rank[%u], totalRanks[%u], chip[%d], logicDevId[%d]", params.id.internal,
     157              :         params.rank, params.totalRanks, params.deviceType, params.logicDevId);
     158              : 
     159            2 :     HCCL_INFO("rootInfo init group workmode[%d]", params.commWorkMode);
     160            2 :     if (params.commWorkMode == WorkMode::HCCL_MODE_AI_CPU) {
     161            0 :         isSpecialType_ = true;
     162              :     }
     163            2 :     CHK_RET(InitImpl(params.deviceType, commConfig));
     164              : 
     165              :     /* 入参判断 */
     166            2 :     if (params.rank >= params.totalRanks) {
     167            1 :         HCCL_ERROR("[HcclComm][Init]errNo[0x%016llx] rank[%u] out of range[0, %u]", HCCL_ERROR_CODE(HCCL_E_PARA),
     168              :             params.rank, params.totalRanks - 1);
     169            1 :         return HCCL_E_PARA;
     170              :     }
     171              : 
     172            1 :     params.identifier = identifier_;
     173              : 
     174              :     /* 设置commConfig单例 */
     175            1 :     HcclResult ret = CommConfiger::GetInstance().SetCommConfig(commConfig, identifier_);
     176            1 :     CHK_PRT_RET(ret != HCCL_SUCCESS,
     177              :         HCCL_ERROR("[hcclComm][init]errNo[0x%016llx] set commConfiger failed.",
     178              :         HCCL_ERROR_CODE(ret)), HCCL_E_PARA);
     179              : 
     180            1 :     CHK_RET(communicator_->CheckDeviceType(params.deviceType));                /* 芯片类型检查 */
     181            0 :     CHK_RET(communicator_->AtomicInitSet());                                 /* 初始化竞争, 只允许被初始化一次 */
     182            0 :     ret = communicator_->Init(params, rankList, groupCommonData); /* 初始化实例, 失败则重新开放初始化竞争 */
     183            0 :     if (ret != HCCL_SUCCESS) {
     184            0 :         communicator_->AtomicInitClear();
     185            0 :         HCCL_ERROR("[HcclComm][Init]errNo[0x%016llx] hccl initialize failed", HCCL_ERROR_CODE(ret));
     186            0 :         return ret;
     187              :     }
     188            0 :     return ret;
     189              : }
     190              : 
     191          234 : HcclResult hcclComm::SetQpQosAttr(u32 trafficClass, u32 serviceLevel)
     192              : {
     193              :     // 校验config中TC的合法性
     194          234 :     if (trafficClass == HCCL_COMM_TRAFFIC_CLASS_CONFIG_NOT_SET && serviceLevel == HCCL_COMM_SERVICE_LEVEL_CONFIG_NOT_SET) {
     195          234 :         HCCL_INFO("[SetQpQosAttr]The TC and SL do not use the config configuration. " \
     196              :             "It will use environment variables to configure. TC[%u], SL[%u]",
     197              :             EnvConfig::GetExternalInputRdmaTrafficClass(), EnvConfig::GetExternalInputRdmaServerLevel());
     198          234 :         return HCCL_SUCCESS;
     199            0 :     } else if (trafficClass != HCCL_COMM_TRAFFIC_CLASS_CONFIG_NOT_SET && serviceLevel == HCCL_COMM_SERVICE_LEVEL_CONFIG_NOT_SET) {
     200            0 :         serviceLevel = EnvConfig::GetExternalInputRdmaServerLevel();
     201            0 :         HCCL_INFO("[SetQpQosAttr]The SL is not configured. It will use the environment value[%u]", serviceLevel);
     202            0 :     } else if (trafficClass == HCCL_COMM_TRAFFIC_CLASS_CONFIG_NOT_SET && serviceLevel != HCCL_COMM_SERVICE_LEVEL_CONFIG_NOT_SET) {
     203            0 :         trafficClass = EnvConfig::GetExternalInputRdmaTrafficClass();
     204            0 :         HCCL_INFO("[SetQpQosAttr]The TC is not configured. It will use the environment value[%u]", trafficClass);
     205              :     }
     206              : 
     207              :     // 若转换出错或者设置的RDMATrafficClass不在有效范围内,则报错
     208            0 :     if (trafficClass > EnvConfig::HCCL_RDMA_TC_MAX) {
     209            0 :         HCCL_ERROR("[SetQpQosAttr]rdmaTrafficClass is invalid. except:[%u, %u], actual:[%u]",
     210              :             EnvConfig::HCCL_RDMA_TC_MIN, EnvConfig::HCCL_RDMA_TC_MAX, trafficClass);
     211            0 :         return HCCL_E_PARA;
     212              :     }
     213              :     // 若设置的RDMATrafficClass不是4的整数倍,则报错
     214            0 :     if (trafficClass % EnvConfig::HCCL_RDMA_TC_BASE != 0) {
     215            0 :         HCCL_ERROR("[SetQpQosAttr]rdmaTrafficClass[%u] is not a multiple of [%u]",
     216              :             trafficClass, EnvConfig::HCCL_RDMA_TC_BASE);
     217            0 :         return HCCL_E_PARA;
     218              :     }
     219              : 
     220              :     // 校验config中SL是否合法
     221            0 :     if (serviceLevel > EnvConfig::HCCL_RDMA_SL_MAX) {
     222            0 :         HCCL_ERROR("[SetQpQosAttr]rdmaServiceLevel is invalid. except:[%u, %u], actual:[%u]",
     223              :             EnvConfig::HCCL_RDMA_SL_MIN, EnvConfig::HCCL_RDMA_SL_MAX, serviceLevel);
     224            0 :         return HCCL_E_PARA;
     225              :     }
     226              : 
     227            0 :     HCCL_INFO("[SetQpQosAttr] rdmaTrafficClass[%u], rdmaServiceLevel[%u]", trafficClass, serviceLevel);
     228            0 :     communicator_->SetQpQosAttr(trafficClass, serviceLevel);
     229              : 
     230            0 :     return HCCL_SUCCESS;
     231              : }
     232              : 
     233            0 : HcclResult hcclComm::CreateGroup(const std::string &group, const u32 &groupRank, const u32 &userRank,
     234              :                                  const std::vector<u32> &groupRanks, std::shared_ptr<hcclComm> &groupComm)
     235              : {
     236              :     // 增加输出日志关键字
     237            0 :     HCCL_INFO("HCCL_KEY_INFO: group[%s], groupRank[%u], userRank[%u], groupComm[%p]", group.c_str(),
     238              :         groupRank, userRank, groupComm.get());
     239              : 
     240              :     // 入参有消息校验
     241            0 :     if (group.length() == 0) {
     242            0 :         HCCL_ERROR("[Create][Group]errNo[0x%016llx] group name length is 0", HCCL_ERROR_CODE(HCCL_E_PARA));
     243            0 :         return HCCL_E_PARA;
     244              :     }
     245              : 
     246            0 :     if (groupRank >= groupRanks.size()) {
     247            0 :         HCCL_ERROR("[Create][Group]errNo[0x%016llx] group rank[%u] out of range [0,%llu])",
     248              :             HCCL_ERROR_CODE(HCCL_E_PARA), groupRank, groupRanks.size() - 1);
     249            0 :         return HCCL_E_PARA;
     250              :     }
     251              : 
     252              :     HcclRootInfo id;
     253            0 :     CHK_RET(GetUniqueId(&id));
     254              : 
     255            0 :     HcclCommParams params;
     256            0 :     params.rank = groupRank;
     257            0 :     params.userRank = userRank;
     258            0 :     params.totalRanks = groupRanks.size();
     259            0 :     params.isHeterogComm = isHeterogComm_;
     260            0 :     s32 iret = snprintf_s(params.id.internal, HCCL_ROOT_INFO_BYTES, HCCL_ROOT_INFO_BYTES - 1, "%s%s%s",
     261              :                           id.internal, "-", group.c_str());
     262              : 
     263            0 :     CHK_PRT_RET((iret == -1), HCCL_ERROR("[Create][Group]errNo[0x%016llx] get group unique id failed",
     264              :         HCCL_ERROR_CODE(HCCL_E_INTERNAL)), HCCL_E_INTERNAL);
     265              : 
     266            0 :     WorldGroupInfo groupCommonData;
     267              : 
     268            0 :     CHK_RET(communicator_->GetGroupCommonData(groupCommonData));
     269            0 :     params.logicDevId = groupCommonData.deviceLogicId;
     270            0 :     params.profilingInitiated = groupCommonData.profilingInitiated;
     271            0 :     params.deviceType = deviceType_;
     272            0 :     params.hcomGroupNicInit = communicator_->GetNicInitialized();
     273            0 :     std::vector<RankInfo> rankList;
     274              : 
     275            0 :     CHK_RET(communicator_->GetGroupRanksInfo(groupRanks, rankList));
     276              : 
     277            0 :     groupComm.reset(new (std::nothrow) hccl::hcclComm(0, 0, group));
     278            0 :     CHK_SMART_PTR_NULL(groupComm);
     279            0 :     CommConfig commConfig(group);
     280            0 :     CHK_RET(groupComm->init(params, commConfig, rankList, groupCommonData));
     281              : 
     282            0 :     return HCCL_SUCCESS;
     283            0 : }
     284              : 
     285            0 : HcclResult hcclComm::DestroyGroup(const std::string &group) const
     286              : {
     287              :     /* 增加输出日志关键字 */
     288            0 :     HCCL_DEBUG("start destroy group: group[%s]", group.c_str());
     289            0 :     return HCCL_SUCCESS;
     290              : }
     291              : 
     292           80 : HcclResult hcclComm::GetAlgType(AlgType &algType, HcclCMDType opType)
     293              : {
     294              :     /* 增加输出日志关键字 */
     295           80 :     HCCL_DEBUG("algType[%s]", AlgTypeToStr(algType).c_str());
     296           80 :     return communicator_->GetAlgType(algType, opType);
     297              : }
     298              : 
     299           29 : void hcclComm::PrintSubmittedOpCnt(const std::string &tag, HcclResult ret)
     300              : {
     301           29 :     u32 index = 0;
     302           29 :     ProfilerBase::GetSubmittedOpCnt(index);
     303           29 :     HCCL_ERROR("[HcclComm][%s]errNo[0x%016llx] index[%u]", tag.c_str(), ret, index);
     304           29 : }
     305              : 
     306            2 : HcclResult hcclComm::AllGather(const std::string &tag, void *inputPtr, void *outputPtr, u64 inputCount,
     307              :                                HcclDataType dataType, HcclRtStream stream, HcomCollOpInfo *opInfo)
     308              : {
     309              :     /* 增加输出日志关键字 */
     310            2 :     HCCL_INFO("HCCL_KEY_INFO: tag[%s], count[%llu], data_type[%s]", tag.c_str(), inputCount,
     311              :         GetDataTypeEnumStr(dataType).c_str());
     312              : 
     313              :     /* * 入参检查 */
     314            2 :     CHK_PTR_NULL(inputPtr);
     315            2 :     CHK_PTR_NULL(outputPtr);
     316            2 :     CHK_PTR_NULL(stream);
     317              : 
     318            2 :     CHK_PRT_RET(tag.empty(), HCCL_ERROR("[HcclComm][AllGather]errNo[0x%016llx] AllGather tag length is 0",
     319              :         HCCL_ERROR_CODE(HCCL_E_PARA)), HCCL_E_PARA);
     320              : 
     321            2 :     CHK_RET(communicator_->CheckCount(inputCount));
     322            2 :     CHK_RET(communicator_->CheckDataType(dataType, false));
     323            2 :     HcclResult ret = communicator_->AllGather(tag, inputPtr, outputPtr, inputCount, dataType, stream, opInfo);
     324            2 :     if (ret != HCCL_SUCCESS) {
     325            1 :         PrintSubmittedOpCnt(tag, ret);
     326            1 :         return ret;
     327              :     }
     328              : 
     329            1 :     return HCCL_SUCCESS;
     330              : }
     331              : 
     332            0 : HcclResult hcclComm::AllGatherV(const std::string &tag, const void *sendBuf, u64 sendCount, const void *recvBuf,
     333              :     const void *recvCounts, const void *rdispls, HcclDataType dataType, HcclRtStream stream)
     334              : {
     335              :     /* 增加输出日志关键字 */
     336            0 :     HCCL_INFO("HCCL_KEY_INFO: tag[%s], count[%llu], data_type[%s]", tag.c_str(), sendCount,
     337              :         GetDataTypeEnumStr(dataType).c_str());
     338              : 
     339              :     /* * 入参检查 */
     340            0 :     CHK_PTR_NULL(stream);
     341            0 :     CHK_PTR_NULL(sendBuf);
     342            0 :     CHK_PTR_NULL(recvBuf);
     343            0 :     CHK_PTR_NULL(recvCounts);
     344            0 :     CHK_PTR_NULL(rdispls);
     345              : 
     346            0 :     CHK_PRT_RET(tag.empty(), HCCL_ERROR("[HcclComm][AllGatherV]errNo[0x%016llx] AllGather tag length is 0",
     347              :         HCCL_ERROR_CODE(HCCL_E_PARA)), HCCL_E_PARA);
     348              : 
     349            0 :     CHK_RET(communicator_->CheckDataType(dataType, false));
     350            0 :     HcclResult ret = communicator_->AllGatherV(tag, sendBuf, sendCount, recvBuf, recvCounts, rdispls, dataType, stream);
     351            0 :     if (ret != HCCL_SUCCESS) {
     352            0 :         PrintSubmittedOpCnt(tag, ret);
     353            0 :         return ret;
     354              :     }
     355              : 
     356            0 :     return HCCL_SUCCESS;
     357              : }
     358              : 
     359           23 : HcclResult hcclComm::AllGatherOutPlace(const std::string &tag, void *inputPtr, void *outputPtr, u64 inputCount,
     360              :     HcclDataType dataType, HcclRtStream stream)
     361              : {
     362              :     /* 增加输出日志关键字 */
     363           23 :     HCCL_INFO("HCCL_KEY_INFO: tag[%s], input_ptr[%p], output_ptr[%p], count[%llu], data_type[%s]",
     364              :         tag.c_str(), inputPtr, outputPtr, inputCount, GetDataTypeEnumStr(dataType).c_str());
     365              : 
     366              :     /* * 入参检查 */
     367           23 :     CHK_RET(communicator_->CheckDataType(dataType, false));
     368           23 :     HcclResult ret = communicator_->AllGatherOutPlace(tag, inputPtr, outputPtr, inputCount, dataType, stream);
     369           23 :     if (ret != HCCL_SUCCESS) {
     370            0 :         PrintSubmittedOpCnt(tag, ret);
     371            0 :         return ret;
     372              :     }
     373              : 
     374           23 :     return HCCL_SUCCESS;
     375              : }
     376              : 
     377           23 : HcclResult hcclComm::AllGatherVOutPlace(const std::string &tag, void *inputPtr, void *outputPtr,
     378              :     u64 inputCount, const void *outputCounts, const void *outputDispls, HcclDataType dataType, HcclRtStream stream)
     379              : {
     380              :     /* 增加输出日志关键字 */
     381           23 :     HCCL_INFO("HCCL_KEY_INFO: tag[%s], input_ptr[%p], output_ptr[%p], counts[%llu], data_type[%d]",
     382              :         tag.c_str(), inputPtr, outputPtr, outputCounts, dataType);
     383              : 
     384              :     /* * 入参检查 */
     385           23 :     CHK_RET(communicator_->CheckDataType(dataType, false));
     386           23 :     CHK_RET(communicator_->AllGatherVOutPlace(tag, inputPtr, outputPtr, inputCount, outputCounts, outputDispls,
     387              :         dataType, stream));
     388              : 
     389           23 :     return HCCL_SUCCESS;
     390              : }
     391              : 
     392           24 : HcclResult hcclComm::AlltoAllV(const void *sendBuf, const void *sendCounts, const void *sdispls, HcclDataType sendType,
     393              :                                const void *recvBuf, const void *recvCounts, const void *rdispls, HcclDataType recvType,
     394              :                                rtStream_t stream, const std::string &tag)
     395              : {
     396              :     /* * 入参检查 */
     397           24 :     CHK_PTR_NULL(stream);
     398           24 :     CHK_PTR_NULL(sendCounts);
     399           24 :     CHK_PTR_NULL(sdispls);
     400           24 :     CHK_PTR_NULL(recvCounts);
     401           24 :     CHK_PTR_NULL(rdispls);
     402              : 
     403           24 :     CHK_PRT_RET(tag.empty(), HCCL_ERROR("[HcclComm][AlltoAllV]errNo[0x%016llx] AllToAllV tag length is 0",
     404              :         HCCL_ERROR_CODE(HCCL_E_PARA)), HCCL_E_PARA);
     405              : 
     406           24 :     CHK_RET(communicator_->CheckDataType(sendType, false));
     407              : 
     408           24 :     CHK_RET(communicator_->CheckDataType(recvType, false));
     409              : 
     410           24 :     HcclResult ret = communicator_->AlltoAllV(sendBuf, sendCounts, sdispls, sendType, recvBuf, recvCounts, rdispls, recvType,
     411              :         stream, tag);
     412           24 :     if (ret != HCCL_SUCCESS) {
     413            0 :         PrintSubmittedOpCnt(tag, ret);
     414            0 :         return ret;
     415              :     }
     416              : 
     417           24 :     return HCCL_SUCCESS;
     418              : }
     419              : 
     420            1 : HcclResult hcclComm::AlltoAllVOutPlace(const void *sendBuf, const void *sendCounts, const void *sdispls,
     421              :     HcclDataType sendType, const void *recvBuf, const void *recvCounts, const void *rdispls, HcclDataType recvType,
     422              :     rtStream_t stream, const std::string &tag)
     423              : {
     424              :     /* * 入参检查 */
     425            1 :     CHK_RET(communicator_->CheckDataType(sendType, false));
     426            1 :     CHK_RET(communicator_->CheckDataType(recvType, false));
     427              : 
     428            1 :     HcclResult ret = communicator_->AlltoAllVOutPlace(
     429              :         sendBuf, sendCounts, sdispls, sendType, recvBuf, recvCounts, rdispls, recvType, stream, tag);
     430            1 :     if (ret != HCCL_SUCCESS) {
     431            0 :         PrintSubmittedOpCnt(tag, ret);
     432            0 :         return ret;
     433              :     }
     434              : 
     435            1 :     return HCCL_SUCCESS;
     436              : }
     437              : 
     438            0 : HcclResult hcclComm::AlltoAllVC(const void *sendBuf, const void *sendCountMatrix, HcclDataType sendType,
     439              :                                 const void *recvBuf, HcclDataType recvType, rtStream_t stream, const std::string &tag)
     440              : {
     441              :     /* * 入参检查 */
     442            0 :     CHK_PTR_NULL(stream);
     443            0 :     CHK_PTR_NULL(sendCountMatrix);
     444              : 
     445            0 :     CHK_PRT_RET(tag.empty(), HCCL_ERROR("[HcclComm][AlltoAllVC]errNo[0x%016llx] AllToAllVC tag length is 0",
     446              :         HCCL_ERROR_CODE(HCCL_E_PARA)), HCCL_E_PARA);
     447              : 
     448            0 :     CHK_RET(communicator_->CheckDataType(sendType, false));
     449              : 
     450            0 :     CHK_RET(communicator_->CheckDataType(recvType, false));
     451              : 
     452            0 :     HcclResult ret = communicator_->AlltoAllVC(sendBuf, sendCountMatrix, sendType, recvBuf, recvType, stream, tag);
     453            0 :     if (ret != HCCL_SUCCESS) {
     454            0 :         PrintSubmittedOpCnt(tag, ret);
     455            0 :         return ret;
     456              :     }
     457              : 
     458            0 :     return HCCL_SUCCESS;
     459              : }
     460              : 
     461            0 : HcclResult hcclComm::AlltoAllVCOutPlace(const void *sendBuf, const void *sendCountMatrix, HcclDataType sendType,
     462              :     const void *recvBuf, HcclDataType recvType, rtStream_t stream, const std::string &tag)
     463              : {
     464              :     /* * 入参检查 */
     465            0 :     CHK_RET(communicator_->CheckDataType(sendType, false));
     466            0 :     CHK_RET(communicator_->CheckDataType(recvType, false));
     467              : 
     468            0 :     HcclResult ret = communicator_->AlltoAllVCOutPlace(sendBuf, sendCountMatrix, sendType, recvBuf, recvType, stream, tag);
     469            0 :     if (ret != HCCL_SUCCESS) {
     470            0 :         PrintSubmittedOpCnt(tag, ret);
     471            0 :         return ret;
     472              :     }
     473              : 
     474            0 :     return HCCL_SUCCESS;
     475              : }
     476              : 
     477           23 : HcclResult hcclComm::AlltoAll(const void *sendBuf, u64 sendCount, HcclDataType sendType, const void *recvBuf,
     478              :     u64 recvCount, HcclDataType recvType, rtStream_t stream, const std::string &tag)
     479              : {
     480              :     /* * 入参检查 */
     481           23 :     CHK_PTR_NULL(communicator_);
     482              : 
     483           23 :     CHK_PRT_RET(tag.empty(), HCCL_ERROR("[HcclComm][AlltoAll]errNo[0x%016llx] AllToAll tag length is 0",
     484              :         HCCL_ERROR_CODE(HCCL_E_PARA)), HCCL_E_PARA);
     485              : 
     486           23 :     CHK_RET(communicator_->CheckDataType(sendType, false));
     487              : 
     488           23 :     HcclResult ret = communicator_->AlltoAll(sendBuf, sendCount, sendType, recvBuf, recvCount, recvType, stream, tag);
     489           23 :     if (ret != HCCL_SUCCESS) {
     490            0 :         PrintSubmittedOpCnt(tag, ret);
     491            0 :         return ret;
     492              :     }
     493              : 
     494           23 :     return HCCL_SUCCESS;
     495              : }
     496              : 
     497            3 : HcclResult hcclComm::Broadcast(const std::string &tag, void *ptr, u64 count, HcclDataType dataType, u32 root,
     498              :                                HcclRtStream stream)
     499              : {
     500              :     /* 增加输出日志关键字 */
     501            3 :     HCCL_INFO("HCCL_KEY_INFO:tag[%s], ptr[%p], count[%llu], data_type[%s], root[%u]",
     502              :                tag.c_str(), ptr, count, GetDataTypeEnumStr(dataType).c_str(), root);
     503              : 
     504              :     /* * 入参检查 */
     505            3 :     CHK_PTR_NULL(stream);
     506            3 :     CHK_PTR_NULL(ptr);
     507              : 
     508            3 :     if (tag.empty()) {
     509            0 :         HCCL_ERROR("[HcclComm][Broadcast]errNo[0x%016llx] broadcast tag length is 0",
     510              :             HCCL_ERROR_CODE(HCCL_E_PARA));
     511            0 :         return HCCL_E_PARA;
     512              :     }
     513              : 
     514              :     /* * 初始化检查 */
     515            3 :     CHK_SMART_PTR_NULL(communicator_);
     516            3 :     CHK_RET(communicator_->CheckCount(count));
     517            3 :     CHK_RET(communicator_->CheckDataType(dataType, false));
     518            3 :     CHK_RET(communicator_->CheckUserRank(root));
     519            3 :     HcclResult ret = communicator_->Broadcast(tag, ptr, count, dataType, root, stream);
     520            3 :     if (ret != HCCL_SUCCESS) {
     521            1 :         PrintSubmittedOpCnt(tag, ret);
     522            1 :         return ret;
     523              :     }
     524              : 
     525            2 :     return HCCL_SUCCESS;
     526              : }
     527              : 
     528           23 : HcclResult hcclComm::BroadcastOutPlace(const std::string &tag, void *ptr, u64 count, HcclDataType dataType, u32 root,
     529              :     HcclRtStream stream)
     530              : {
     531              :     /* 增加输出日志关键字 */
     532           23 :     HCCL_INFO("HCCL_KEY_INFO:tag[%s], ptr[%p], count[%llu], data_type[%s], root[%u]", tag.c_str(), ptr, count,
     533              :         GetDataTypeEnumStr(dataType).c_str(), root);
     534              : 
     535              :     /* * 入参检查 */
     536           23 :     CHK_RET(communicator_->CheckDataType(dataType, false));
     537           23 :     CHK_RET(communicator_->CheckUserRank(root));
     538           23 :     HcclResult ret = communicator_->BroadcastOutPlace(tag, ptr, count, dataType, root, stream);
     539           23 :     if (ret != HCCL_SUCCESS) {
     540            0 :         PrintSubmittedOpCnt(tag, ret);
     541            0 :         return ret;
     542              :     }
     543              : 
     544           23 :     return HCCL_SUCCESS;
     545              : }
     546              : 
     547           24 : HcclResult hcclComm::ScatterOutPlace(const std::string &tag, void *inputPtr, void *outputPtr, u64 recvCount,
     548              :     HcclDataType dataType, u32 root, HcclRtStream stream)
     549              : {
     550              :     /* 增加输出日志关键字 */
     551           24 :     HCCL_INFO("HCCL_KEY_INFO: tag[%s], input_ptr[%p], output_ptr[%p], recvCount[%llu], data_type[%s], root[%u]",
     552              :         tag.c_str(), inputPtr, outputPtr, recvCount, GetDataTypeEnumStr(dataType).c_str(), root);
     553              : 
     554           24 :     if (tag.empty()) {
     555            0 :         HCCL_ERROR("[HcclComm][Scatter]errNo[0x%016llx] scatter tag length is 0",
     556              :             HCCL_ERROR_CODE(HCCL_E_PARA));
     557            0 :         return HCCL_E_PARA;
     558              :     }
     559              : 
     560           24 :     CHK_RET(communicator_->CheckCount(recvCount));
     561           24 :     CHK_RET(communicator_->CheckDataType(dataType, false));
     562           24 :     CHK_RET(communicator_->CheckUserRank(root));
     563           24 :     HcclResult ret = communicator_->ScatterOutPlace(tag, inputPtr, outputPtr, recvCount, dataType, root, stream);
     564           24 :     if (ret != HCCL_SUCCESS) {
     565            0 :         PrintSubmittedOpCnt(tag, ret);
     566            0 :         return ret;
     567              :     }
     568              : 
     569           24 :     return HCCL_SUCCESS;
     570              : }
     571              : 
     572           10 : HcclResult hcclComm::ReduceScatter(const std::string &tag, void *inputPtr, void *outputPtr, u64 count,
     573              :                                    HcclDataType dataType, HcclReduceOp op, HcclRtStream stream)
     574              : {
     575              :     /* 增加输出日志关键字 */
     576           10 :     HCCL_INFO("HCCL_KEY_INFO: tag[%s], input_ptr[%p], output_ptr[%p], count[%llu], data_type[%s], "
     577              :                "op[%s]", tag.c_str(), inputPtr, outputPtr, count, GetDataTypeEnumStr(dataType).c_str(),
     578              :                GetReduceOpEnumStr(op).c_str());
     579              : 
     580              :     /* * 入参检查 */
     581           18 :     CHK_PTR_NULL(stream);
     582           18 :     CHK_PTR_NULL(inputPtr);
     583           18 :     CHK_PTR_NULL(outputPtr);
     584              : 
     585           18 :     if (tag.empty()) {
     586            0 :         HCCL_ERROR("[HcclComm][ReduceScatter]errNo[0x%016llx] reduceScatter tag length is"\
     587              :             "0", HCCL_ERROR_CODE(HCCL_E_PARA));
     588            0 :         return HCCL_E_PARA;
     589              :     }
     590              : 
     591           19 :     CHK_RET(communicator_->CheckCount(count));
     592           16 :     CHK_RET(communicator_->CheckDataType(dataType, true));
     593           15 :     CHK_RET(communicator_->CheckReduceDataType(dataType, op));
     594           12 :     CHK_RET(communicator_->CheckReductionOp(op));
     595           11 :     HcclResult ret = communicator_->ReduceScatter(tag, inputPtr, outputPtr, count, dataType, op, stream);
     596           16 :     if (ret != HCCL_SUCCESS) {
     597            9 :         PrintSubmittedOpCnt(tag, ret);
     598            9 :         return ret;
     599              :     }
     600              : 
     601            7 :     return HCCL_SUCCESS;
     602              : }
     603              : 
     604           27 : HcclResult hcclComm::ReduceScatterOutPlace(const std::string &tag, void *inputPtr, void *outputPtr, u64 count,
     605              :     HcclDataType dataType, HcclReduceOp op, HcclRtStream stream)
     606              : {
     607              :     /* 增加输出日志关键字 */
     608           27 :     HCCL_INFO("HCCL_KEY_INFO: tag[%s], input_ptr[%p], output_ptr[%p], count[%llu], data_type[%s], op[%s]",
     609              :         tag.c_str(), inputPtr, outputPtr, count, GetDataTypeEnumStr(dataType).c_str(), GetReduceOpEnumStr(op).c_str());
     610              : 
     611              :     /* * 入参检查 */
     612           34 :     CHK_RET(communicator_->CheckDataType(dataType, true));
     613           32 :     CHK_RET(communicator_->CheckReduceDataType(dataType, op));
     614           29 :     HcclResult ret = communicator_->ReduceScatterOutPlace(tag, inputPtr, outputPtr, count, dataType, op, stream);
     615           35 :     if (ret != HCCL_SUCCESS) {
     616            8 :         PrintSubmittedOpCnt(tag, ret);
     617            8 :         return ret;
     618              :     }
     619              : 
     620           27 :     return HCCL_SUCCESS;
     621              : }
     622              : 
     623            0 : HcclResult hcclComm::ReduceScatterV(const std::string &tag, void *inputPtr,
     624              :     const void *inputCounts, const void *inputDispls, void *outputPtr, u64 outputCount,
     625              :     HcclDataType dataType, HcclReduceOp op, HcclRtStream stream)
     626              : {
     627              :     /* 增加输出日志关键字 */
     628            0 :     HCCL_INFO("HCCL_KEY_INFO: tag[%s], input_ptr[%p], output_ptr[%p], " \
     629              :         "input_counts[%p], input_displs[%p], output_count[%llu], data_type[%s], op[%s]",
     630              :         tag.c_str(), inputPtr, outputPtr, inputCounts, inputDispls, outputCount,
     631              :         GetDataTypeEnumStr(dataType).c_str(), GetReduceOpEnumStr(op).c_str());
     632              : 
     633              :     /* * 入参检查 */
     634            0 :     CHK_PTR_NULL(stream);
     635            0 :     CHK_PTR_NULL(inputPtr);
     636            0 :     CHK_PTR_NULL(outputPtr);
     637              : 
     638            0 :     if (tag.empty()) {
     639            0 :         HCCL_ERROR("[HcclComm][ReduceScatterV]errNo[0x%016llx] reduceScatterV tag length is"\
     640              :             "0", HCCL_ERROR_CODE(HCCL_E_PARA));
     641            0 :         return HCCL_E_PARA;
     642              :     }
     643              : 
     644              :     // ReduceScatterV只支持inlinereduce,因此不支持int64类型
     645            0 :     if(dataType == HCCL_DATA_TYPE_INT64) {
     646            0 :         HCCL_ERROR("[Check][DataType]errNo[0x%016llx] data type[%s] not supported.",
     647              :             HCCL_ERROR_CODE(HCCL_E_NOT_SUPPORT), GetDataTypeEnumStr(dataType).c_str());
     648            0 :         return HCCL_E_NOT_SUPPORT;
     649              :     }
     650              : 
     651            0 :     CHK_RET(communicator_->CheckDataType(dataType, true));
     652            0 :     CHK_RET(communicator_->CheckReduceDataType(dataType, op));
     653            0 :     CHK_RET(communicator_->CheckReductionOp(op));
     654            0 :     HcclResult ret = communicator_->ReduceScatterV(tag, inputPtr, inputCounts, inputDispls,
     655              :                         outputPtr, outputCount, dataType, op, stream);
     656            0 :     if (ret != HCCL_SUCCESS) {
     657            0 :         PrintSubmittedOpCnt(tag, ret);
     658            0 :         return ret;
     659              :     }
     660              : 
     661            0 :     return HCCL_SUCCESS;
     662              : }
     663              : 
     664           23 : HcclResult hcclComm::ReduceScatterVOutPlace(const std::string &tag, void *inputPtr, void *outputPtr,
     665              :     const void *inputCounts, const void *inputDispls, u64 outputCount,
     666              :     HcclDataType dataType, HcclReduceOp op, HcclRtStream stream)
     667              : {
     668              :     /* 增加输出日志关键字 */
     669           23 :     HCCL_INFO("HCCL_KEY_INFO: tag[%s], input_ptr[%p], output_ptr[%p], " \
     670              :         "input_counts[%llu], input_displs[%llu], output_count[%llu], data_type[%s], op[%s]",
     671              :         tag.c_str(), inputPtr, outputPtr, inputCounts, inputDispls, outputCount,
     672              :         GetDataTypeEnumStr(dataType).c_str(), GetReduceOpEnumStr(op).c_str());
     673              : 
     674              :     /* * 入参检查 */
     675           23 :     CHK_RET(communicator_->CheckDataType(dataType, true));
     676           23 :     CHK_RET(communicator_->CheckReduceDataType(dataType, op));
     677           23 :     HcclResult ret = communicator_->ReduceScatterVOutPlace(tag, inputPtr, outputPtr,
     678              :                         inputCounts, inputDispls, outputCount, dataType, op, stream);
     679           23 :     if (ret != HCCL_SUCCESS) {
     680            0 :         PrintSubmittedOpCnt(tag, ret);
     681            0 :         return ret;
     682              :     }
     683              : 
     684           23 :     return HCCL_SUCCESS;
     685              : }
     686              : 
     687            5 : HcclResult hcclComm::Reduce(const std::string &tag, void *inputPtr, void *outputPtr, u64 count,
     688              :                             HcclDataType dataType, HcclReduceOp op, u32 root, HcclRtStream stream)
     689              : {
     690              :     /* 增加输出日志关键字 */
     691            5 :     HCCL_INFO("HCCL_KEY_INFO: tag[%s], input_ptr[%p], output_ptr[%p], count[%llu], data_type[%s], op[%s], root[%u]",\
     692              :                tag.c_str(), inputPtr, outputPtr, count, GetDataTypeEnumStr(dataType).c_str(),
     693              :                GetReduceOpEnumStr(op).c_str(), root);
     694              : 
     695              :     /* * 入参检查 */
     696            5 :     CHK_PTR_NULL(stream);
     697            5 :     CHK_PTR_NULL(inputPtr);
     698            5 :     CHK_PTR_NULL(outputPtr);
     699              : 
     700            5 :     if (tag.empty()) {
     701            0 :         HCCL_ERROR("[HcclComm][Reduce]errNo[0x%016llx] reduce tag length is 0",
     702              :             HCCL_ERROR_CODE(HCCL_E_PARA));
     703            0 :         return HCCL_E_PARA;
     704              :     }
     705              : 
     706            5 :     CHK_RET(communicator_->CheckCount(count));
     707            5 :     CHK_RET(communicator_->CheckDataType(dataType, true));
     708            5 :     CHK_RET(communicator_->CheckReduceDataType(dataType, op));
     709            5 :     CHK_RET(communicator_->CheckReductionOp(op));
     710            5 :     CHK_RET(communicator_->CheckUserRank(root));
     711            5 :     HcclResult ret = communicator_->Reduce(tag, inputPtr, outputPtr, count, dataType, op, root, stream);
     712            5 :     if (ret != HCCL_SUCCESS) {
     713            0 :         PrintSubmittedOpCnt(tag, ret);
     714            0 :         return ret;
     715              :     }
     716              : 
     717            5 :     return HCCL_SUCCESS;
     718              : }
     719              : 
     720           27 : HcclResult hcclComm::ReduceOutPlace(const std::string &tag, void *inputPtr, void *outputPtr, u64 count,
     721              :     HcclDataType dataType, HcclReduceOp op, u32 root, HcclRtStream stream)
     722              : {
     723              :     /* 增加输出日志关键字 */
     724           27 :     HCCL_INFO("HCCL_KEY_INFO: tag[%s], input_ptr[%p], output_ptr[%p], count[%llu], data_type[%s], op[%s], root[%u]",
     725              :         tag.c_str(), inputPtr, outputPtr, count, GetDataTypeEnumStr(dataType).c_str(), GetReduceOpEnumStr(op).c_str(),
     726              :         root);
     727              : 
     728              :     /* * 入参检查 */
     729           27 :     CHK_RET(communicator_->CheckDataType(dataType, true));
     730           26 :     CHK_RET(communicator_->CheckReduceDataType(dataType, op));
     731           26 :     CHK_RET(communicator_->CheckUserRank(root));
     732           25 :     HcclResult ret = communicator_->ReduceOutPlace(tag, inputPtr, outputPtr, count, dataType, op, root, stream);
     733           27 :     if (ret != HCCL_SUCCESS) {
     734            4 :         PrintSubmittedOpCnt(tag, ret);
     735            4 :         return ret;
     736              :     }
     737              : 
     738           23 :     return HCCL_SUCCESS;
     739              : }
     740              : 
     741           23 : HcclResult hcclComm::BatchSendRecv(const std::string &tag, struct HcclSendRecvItemDef* sendRecvItemsPtr,
     742              :     u32 itemNum, rtStream_t stream)
     743              : {
     744           23 :     HcclResult ret = communicator_->BatchSendRecv(tag, sendRecvItemsPtr, itemNum, stream);
     745           23 :     if (ret != HCCL_SUCCESS) {
     746            0 :         PrintSubmittedOpCnt(tag, ret);
     747            0 :         return ret;
     748              :     }
     749              : 
     750           23 :     return HCCL_SUCCESS;
     751              : }
     752              : 
     753            0 : HcclResult hcclComm::send(const std::string &tag, void *inputPtr, u64 count, HcclDataType dataType,
     754              :                           u32 destRank, rtStream_t stream, u32 srTag, u32 localGroupRank)
     755              : {
     756              :     /* 增加输出日志关键字 */
     757            0 :     HCCL_INFO("HCCL_KEY_INFO: tag[%s], input_ptr[%p], count[%llu], data_type[%s], destRank[%u]",
     758              :         tag.c_str(), inputPtr, count, GetDataTypeEnumStr(dataType).c_str(), destRank);
     759              : 
     760              :     /* 入参检查 */
     761            0 :     CHK_PTR_NULL(inputPtr);
     762              : 
     763            0 :     if (tag.empty()) {
     764            0 :         HCCL_ERROR("[HcclComm][Send]errNo[0x%016llx] send tag length is 0",
     765              :             HCCL_ERROR_CODE(HCCL_E_PARA));
     766            0 :         return HCCL_E_PARA;
     767              :     }
     768              : 
     769            0 :     CHK_RET(communicator_->CheckCount(count));
     770            0 :     CHK_RET(communicator_->CheckDataType(dataType, false));
     771            0 :     CHK_RET(communicator_->CheckUserRank(destRank));
     772            0 :     HcclResult ret = communicator_->Send(tag, inputPtr, count, dataType, destRank, stream, srTag, localGroupRank);
     773            0 :     if (ret != HCCL_SUCCESS) {
     774            0 :         PrintSubmittedOpCnt(tag, ret);
     775            0 :         return ret;
     776              :     }
     777              : 
     778            0 :     return HCCL_SUCCESS;
     779              : }
     780              : 
     781           25 : HcclResult hcclComm::SendOutPlace(const std::string &tag, void *inputPtr, u64 count, HcclDataType dataType,
     782              :     u32 destRank, rtStream_t stream)
     783              : {
     784              :     /* 增加输出日志关键字 */
     785           25 :     HCCL_INFO("HCCL_KEY_INFO: tag[%s], input_ptr[%p], count[%llu], data_type[%s], destRank[%u],",
     786              :         tag.c_str(), inputPtr, count, GetDataTypeEnumStr(dataType).c_str(), destRank);
     787              : 
     788              :     /* 入参检查 */
     789           25 :     CHK_RET(communicator_->CheckDataType(dataType, false));
     790           25 :     CHK_RET(communicator_->CheckUserRank(destRank));
     791           24 :     HcclResult ret = communicator_->SendOutPlace(tag, inputPtr, count, dataType, destRank, stream);
     792           24 :     if (ret != HCCL_SUCCESS) {
     793            1 :         PrintSubmittedOpCnt(tag, ret);
     794            1 :         return ret;
     795              :     }
     796              : 
     797           23 :     return HCCL_SUCCESS;
     798              : }
     799              : 
     800           25 : HcclResult hcclComm::ReceiveOutPlace(const std::string &tag, void *outputPtr, u64 count, HcclDataType dataType,
     801              :     u32 srcRank, rtStream_t stream)
     802              : {
     803              :     /* 增加输出日志关键字 */
     804           25 :     HCCL_INFO("HCCL_KEY_INFO: tag[%s], output_ptr[%p], count[%llu], data_type[%s], srcRank[%u]",
     805              :         tag.c_str(), outputPtr, count, GetDataTypeEnumStr(dataType).c_str(), srcRank);
     806              : 
     807              :     /* * 入参检查 */
     808           25 :     CHK_RET(communicator_->CheckDataType(dataType, false));
     809           25 :     CHK_RET(communicator_->CheckUserRank(srcRank));
     810           24 :     HcclResult ret = communicator_->ReceiveOutPlace(tag, outputPtr, count, dataType, srcRank, stream);
     811           24 :     if (ret != HCCL_SUCCESS) {
     812            1 :         PrintSubmittedOpCnt(tag, ret);
     813            1 :         return ret;
     814              :     }
     815              : 
     816           23 :     return HCCL_SUCCESS;
     817              : }
     818              : 
     819            0 : HcclResult hcclComm::receive(const std::string &tag, void *outputPtr, u64 count, HcclDataType dataType,
     820              :                              u32 srcRank, rtStream_t stream, u32 srTag, u32 localGroupRank)
     821              : {
     822              :     /* 增加输出日志关键字 */
     823            0 :     HCCL_INFO("HCCL_KEY_INFO: tag[%s], output_ptr[%p], count[%llu], data_type[%s], srcRank[%u]",
     824              :                tag.c_str(), outputPtr, count, GetDataTypeEnumStr(dataType).c_str(), srcRank);
     825              : 
     826              :     /* * 入参检查 */
     827            0 :     CHK_PTR_NULL(outputPtr);
     828              : 
     829            0 :     CHK_PRT_RET(tag.empty(), HCCL_ERROR("[HcclComm][Receive]errNo[0x%016llx] receive tag length is 0",
     830              :         HCCL_ERROR_CODE(HCCL_E_PARA)), HCCL_E_PARA);
     831              : 
     832            0 :     CHK_RET(communicator_->CheckCount(count));
     833            0 :     CHK_RET(communicator_->CheckDataType(dataType, false));
     834            0 :     CHK_RET(communicator_->CheckUserRank(srcRank));
     835            0 :     HcclResult ret = communicator_->Receive(tag, outputPtr, count, dataType, srcRank, stream, srTag, localGroupRank);
     836            0 :     if (ret != HCCL_SUCCESS) {
     837            0 :         PrintSubmittedOpCnt(tag, ret);
     838            0 :         return ret;
     839              :     }
     840              : 
     841            0 :     return HCCL_SUCCESS;
     842              : }
     843              : 
     844              : // 目前支持按tag对资源释放、解绑定
     845           16 : HcclResult hcclComm::ClearOpResource(const std::string &tag)
     846              : {
     847           16 :     CHK_RET(communicator_->ClearOpResource(tag));
     848              : 
     849           16 :     return HCCL_SUCCESS;
     850              : }
     851              : 
     852            0 : HcclResult hcclComm::SetClearAivSyncBuf(bool aivClearEnable)
     853              : {
     854            0 :     CHK_RET(communicator_->SetClearAivSyncBuf(aivClearEnable));
     855              : 
     856            0 :     return HCCL_SUCCESS;
     857              : }
     858              : 
     859          291 : HcclResult hcclComm::GetUniqueId(HcclRootInfo *uniqueId)
     860              : {
     861          291 :     CHK_PTR_NULL(uniqueId);
     862              : 
     863          291 :     std::string uniqueIdGot = HcclCommunicator::GetUniqueId();
     864          291 :     s32 ret = snprintf_s(uniqueId->internal, HCCL_ROOT_INFO_BYTES, HCCL_ROOT_INFO_BYTES - 1,
     865              :                          "%s%s", "hccl-", uniqueIdGot.c_str());
     866          291 :     CHK_PRT_RET((ret == -1), HCCL_ERROR("[Get][UniqueId]errNo[0x%016llx] get unique id failed,uniqueId[%p]",
     867              :         HCCL_ERROR_CODE(ret), uniqueId), HCCL_E_MEMORY);
     868              : 
     869          291 :     return HCCL_SUCCESS;
     870          291 : }
     871              : 
     872            1 : HcclResult hcclComm::CreateCommCCLbuffer() const
     873              : {
     874            1 :     CHK_RET(communicator_->CreateCommCCLbuffer());
     875              : 
     876            1 :     return HCCL_SUCCESS;
     877              : }
     878              : 
     879            0 : HcclResult hcclComm::CreateIndirectCCLbuf()
     880              : {
     881            0 :     CHK_RET(DeviceMem::alloc(indirectInCCLbuffer_, sizeof(uintptr_t), true));
     882            0 :     CHK_RET(DeviceMem::alloc(indirectOutCCLbuffer_, sizeof(uintptr_t), true));
     883              : 
     884            0 :     return HCCL_SUCCESS;
     885              : }
     886              : 
     887            0 : void hcclComm::ReleaseIndirectCCLbuf()
     888              : {
     889            0 :     indirectInCCLbuffer_.free();
     890            0 :     indirectOutCCLbuffer_.free();
     891            0 : }
     892              : 
     893            0 : HcclResult hcclComm::GetIndirectInCCLbuf(void* &ptr, u64 &size)
     894              : {
     895            0 :     ptr = indirectInCCLbuffer_.ptr();
     896            0 :     size = sizeof(uintptr_t);
     897            0 :     return HCCL_SUCCESS;
     898              : }
     899              : 
     900            0 : HcclResult hcclComm::GetIndirectOutCCLbuf(void* &ptr, u64 &size)
     901              : {
     902            0 :     ptr = indirectOutCCLbuffer_.ptr();
     903            0 :     size = sizeof(uintptr_t);
     904            0 :     return HCCL_SUCCESS;
     905              : }
     906         1826 : std::string hcclComm::GetIdentifier()
     907              : {
     908         1826 :     return identifier_;
     909              : }
     910              : 
     911            2 : std::string hcclComm::GetCCLbufferName()
     912              : {
     913            2 :     return cclBuffName_;
     914              : }
     915              : 
     916            1 : HcclResult hcclComm::CommCheckErrorCqe(HcclResult &result)
     917              : {
     918            1 :     CHK_RET(communicator_->GetCqeError(result));
     919              : 
     920            1 :     return HCCL_SUCCESS;
     921              : }
     922              : 
     923            0 : HcclResult hcclComm::CommCheckOpInconsistentError(HcclResult &result)
     924              : {
     925            0 :     CHK_RET(communicator_->GetOpInconsistentError(result));
     926              :  
     927            0 :     return HCCL_SUCCESS;
     928              : }
     929              : 
     930          410 : HcclResult hcclComm::InitImpl(DevType deviceType, const CommConfig &commConfig)
     931              : {
     932          410 :     HCCL_INFO("InitImpl Implementation isHeterogComm_[%d] isHaveCpuRank_[%d] deviceType[%d] isSpecialType_[%d]",
     933              :         isHeterogComm_,
     934              :         isHaveCpuRank_,
     935              :         deviceType,
     936              :         isSpecialType_);
     937              : 
     938          411 :     communicator_.reset(new (std::nothrow) HcclCommunicator(commConfig));
     939          411 :     CHK_SMART_PTR_NULL(communicator_);
     940          411 :     deviceType_ = deviceType;
     941          411 :     CHK_RET(RegistTaskAbortHandler());
     942              : 
     943          411 :     return HCCL_SUCCESS;
     944              : }
     945              : 
     946            0 : HcclResult hcclComm::CreateBarrierMemory()
     947              : {
     948            0 :     if (isFirstBarrier_) {
     949              :         // 申请device内存
     950            0 :         CHK_RET(DeviceMem::alloc(barrierInMemory_, HCCL_BARRIER_DEFAULT_COUNT * sizeof(float)));
     951            0 :         CHK_RET(DeviceMem::alloc(barrierOutMemory_, HCCL_BARRIER_DEFAULT_COUNT * sizeof(float)));
     952              : 
     953            0 :         barrierSendBuf = static_cast<void *>(barrierInMemory_.ptr());
     954            0 :         barrierRecvBuf = static_cast<void *>(barrierOutMemory_.ptr());
     955              : 
     956              :         // device内存清0
     957              :         // 申请host内存,并将初始值设置为0
     958            0 :         HostMem barrierHostMem = HostMem::alloc(HCCL_BARRIER_DEFAULT_COUNT * sizeof(float));
     959            0 :         CHK_SMART_PTR_NULL(barrierHostMem);
     960            0 :         s32 sRet = memset_s(barrierHostMem.ptr(), barrierHostMem.size(), 0, barrierHostMem.size());
     961            0 :         CHK_PRT_RET(sRet != EOK, HCCL_ERROR("[Create][BarrierMemory]mem set failed.errorno[%d]", sRet), HCCL_E_MEMORY);
     962              : 
     963            0 :         CHK_RET(hrtMemSyncCopy(barrierSendBuf, barrierInMemory_.size(), barrierHostMem.ptr(), barrierHostMem.size(),
     964              :             HcclRtMemcpyKind::HCCL_RT_MEMCPY_KIND_HOST_TO_DEVICE));
     965              : 
     966            0 :         CHK_RET(hrtMemSyncCopy(barrierRecvBuf, barrierOutMemory_.size(), barrierHostMem.ptr(), barrierHostMem.size(),
     967              :             HcclRtMemcpyKind::HCCL_RT_MEMCPY_KIND_HOST_TO_DEVICE));
     968              : 
     969            0 :         isFirstBarrier_ = false;
     970            0 :     }
     971            0 :     return HCCL_SUCCESS;
     972              : }
     973              : 
     974            0 : HcclResult hcclComm::GetInCCLbuffer(void* &buffer, u64 &size)
     975              : {
     976            0 :     CHK_RET(communicator_->GetInCCLbuffer(buffer, size));
     977              : 
     978            0 :     return HCCL_SUCCESS;
     979              : }
     980            0 : HcclResult hcclComm::GetOutCCLbuffer(void* &buffer, u64 &size)
     981              : {
     982            0 :     CHK_RET(communicator_->GetOutCCLbuffer(buffer, size));
     983              : 
     984            0 :     return HCCL_SUCCESS;
     985              : }
     986              : 
     987          346 : HcclResult hcclComm::GetUserRank(u32 &userRank)
     988              : {
     989          346 :     userRank = communicator_->GetUserRank();
     990              : 
     991          346 :     return HCCL_SUCCESS;
     992              : }
     993              : 
     994           71 : HcclResult hcclComm::GetGroupRank(u32 &userRank)
     995              : {
     996           71 :     userRank = communicator_->GetGroupRank();
     997              : 
     998           71 :     return HCCL_SUCCESS;
     999              : }
    1000              : 
    1001          330 : HcclResult hcclComm::GetRankSize(u32 &rankSize)
    1002              : {
    1003          330 :     rankSize = communicator_->GetRankSize();
    1004              : 
    1005          330 :     return HCCL_SUCCESS;
    1006              : }
    1007              : 
    1008            0 : HcclResult hcclComm::HcclSelectAlg(HcclCMDType opType, u64 count, void* counts, HcclDataType dataType,
    1009              :     HcclReduceOp op, int32_t aivCoreLimit, bool &ifAiv, std::string &algName)
    1010              : {
    1011            0 :     return communicator_->HcclSelectAlg(opType, count, counts, dataType, op, aivCoreLimit, ifAiv, algName);
    1012              : }
    1013              : 
    1014            0 : HcclResult hcclComm::HcclCalcNumBlocks(HcclCMDType opType, u64 count, void* counts, HcclDataType dataType, int32_t aivCoreLimit,
    1015              :         std::string &algName, u32 &numBlocks)
    1016              : {
    1017            0 :     return communicator_->HcclCalcNumBlocks(opType, count, counts, dataType, aivCoreLimit, algName, numBlocks);
    1018              : }
    1019              : 
    1020            0 : HcclResult hcclComm::HcclGetAlgExecParam(const std::string &tag, u64 count, void *inputPtr, void *outputPtr,
    1021              :     HcclCMDType opType, bool clearEnable, HcclDataType dataType, HcclReduceOp op,
    1022              :     void *&commContext, u64 &len, u32 aivCoreLimit)
    1023              : {
    1024            0 :     return communicator_->HcclGetAlgExecParam(tag, opType,  count, inputPtr, outputPtr, clearEnable, dataType, op,
    1025            0 :         commContext, len, aivCoreLimit);
    1026              : }
    1027              : 
    1028            1 : HcclResult hcclComm::SetAicpuCommEngine(bool isAicpuCommEngine)
    1029              : {
    1030            1 :     return communicator_->SetAicpuCommEngine(isAicpuCommEngine);
    1031              : }
    1032              : 
    1033          155 : HcclResult hcclComm::GetWorkspaceSubStreamNum(u64 count, HcclDataType dataType, HcclReduceOp op, const std::string &algName,
    1034              :          u64 &streamNum, u64 dataSize, bool ifAiv, HcclCMDType optype) const
    1035              : {
    1036          155 :     return communicator_->GetWorkspaceSubStreamNum(count, dataType, op, algName, streamNum, dataSize, ifAiv, optype);
    1037              : }
    1038           91 : HcclResult hcclComm::GetWorkspaceMemSize(const std::string &opType, u64 count, HcclDataType dataType,
    1039              :     u32 &rankSize, u64 &size)
    1040              : {
    1041           91 :     return communicator_->GetWorkspaceMemSize(opType, count, dataType, rankSize, size, deviceType_);
    1042              : }
    1043              : 
    1044            0 : HcclResult hcclComm::GetAllReduceScratchSize(const u64 count, const HcclDataType dataType, u64 &scratchSize) const
    1045              : {
    1046            0 :     return communicator_->GetAllReduceScratchSize(count, dataType, scratchSize);
    1047              : }
    1048              : 
    1049              : // 设定 workspace 资源
    1050          155 : HcclResult hcclComm::SetWorkspaceResource(const std::string &tag, void *memPtr, u64 maxSize,
    1051              :                                           std::vector<rtStream_t> &stream)
    1052              : {
    1053          155 :     return communicator_->SetWorkspaceResource(tag, memPtr, maxSize, stream);
    1054              : }
    1055              : 
    1056           95 : HcclResult hcclComm::CreateOpBasedResources(const HcclCMDType &opType, const std::string &tag,
    1057              :     const HcomCollOpInfo &opInfo)
    1058              : {
    1059           95 :     return communicator_->CreateOpBasedResources(opType, tag, opInfo);
    1060              : }
    1061              : 
    1062            0 : HcclResult hcclComm::GetDeviceNumPerAggregation(u32 &deviceNumPerAggregation)
    1063              : {
    1064            0 :     return communicator_->GetDeviceNumPerAggregation(deviceNumPerAggregation);
    1065              : }
    1066              : 
    1067            0 : HcclResult hcclComm::GetBandWidthPerNPU(u32 level, float &bandWidth)
    1068              : {
    1069            0 :     return communicator_->GetBandWidthPerNPU(level, bandWidth);
    1070              : }
    1071              : 
    1072            0 : HcclResult hcclComm::GetAlltoAllStagedWorkSpaceMemSize(u64 *sendCounts, u64 *sdispls, HcclDataType sendType,
    1073              :     u64 *recvCounts, u64 *rdispls, HcclDataType recvType, u64 &memSize) const
    1074              : {
    1075            0 :     CHK_RET(communicator_->GetAlltoAllStagedWorkSpaceMemSize(
    1076              :         sendCounts, sdispls, sendType, recvCounts, rdispls, recvType, memSize));
    1077            0 :     return HCCL_SUCCESS;
    1078              : }
    1079              : 
    1080            0 : HcclResult hcclComm::GetAlltoAllStagedWorkSpaceMemSize(std::vector<SendRecvInfo> &allMeshAggregationSendRecvInfo,
    1081              :     u64 &memSize) const
    1082              : {
    1083            0 :     CHK_RET(communicator_->GetAlltoAllStagedWorkSpaceMemSize(allMeshAggregationSendRecvInfo, memSize));
    1084            0 :     return HCCL_SUCCESS;
    1085              : }
    1086              : 
    1087           92 : HcclResult hcclComm::SetGlobalWorkSpace(std::vector<void *> &globalWorkSpaceAddr)
    1088              : {
    1089           92 :     CHK_RET(communicator_->SetGlobalWorkSpace(globalWorkSpaceAddr));
    1090              : 
    1091           92 :     return HCCL_SUCCESS;
    1092              : }
    1093              : 
    1094            0 : HcclResult hcclComm::SetAttachedStream(u32 graphId, const std::vector<rtStream_t> &streams)
    1095              : {
    1096            0 :     CHK_RET(communicator_->SetAttachedStream(graphId, streams));
    1097            0 :     return HCCL_SUCCESS;
    1098              : }
    1099              : 
    1100            0 : HcclResult hcclComm::GetandClearOverFlowTasks(std::vector<HcclDumpInfo> &hcclDumpInfo)
    1101              : {
    1102            0 :     CHK_RET(communicator_->GetandClearOverFlowTasks(hcclDumpInfo));
    1103              : 
    1104            0 :     return HCCL_SUCCESS;
    1105              : }
    1106              : 
    1107              : 
    1108            0 : HcclResult hcclComm::SetCommDispatcherCtx()
    1109              : {
    1110            0 :     DispatcherCtxPtr dispatherCtx = GetDispatcherCtx(identifier_.c_str());
    1111            0 :     CHK_PTR_NULL(dispatherCtx);
    1112            0 :     HCCL_INFO("[%s] dispatherCtx = [%p]", __func__, dispatherCtx);
    1113            0 :     CHK_RET(SetDispatcherCtx(dispatherCtx));
    1114            0 :     return HCCL_SUCCESS;
    1115              : }
    1116              : 
    1117            0 : HcclResult hcclComm::ReleaseCommDispatcherCtx()
    1118              : {
    1119            0 :     return HCCL_SUCCESS;
    1120              : }
    1121              : 
    1122            0 : HcclResult hcclComm::SupportDeterministicOptim(bool &isDeterministicOptim)
    1123              : {
    1124            0 :     CHK_RET(communicator_->SupportDeterministicOptim(isDeterministicOptim));
    1125              : 
    1126            0 :     return HCCL_SUCCESS;
    1127              : }
    1128              : 
    1129            0 : HcclResult hcclComm::GetHccsLinkNum(u32 &numHccsLink)
    1130              : {
    1131            0 :     return communicator_->GetHccsLinkNum(numHccsLink);
    1132              : }
    1133              : 
    1134          235 : HcclResult hcclComm::GetDeviceId(s32 &deviceId)
    1135              : {
    1136          235 :     CHK_SMART_PTR_NULL(communicator_);
    1137          234 :     CHK_RET(communicator_->GetDeviceId(deviceId));
    1138              : 
    1139          234 :     return HCCL_SUCCESS;
    1140              : }
    1141              : 
    1142            0 : HcclResult hcclComm::GetDevType(DevType &devType)
    1143              : {
    1144            0 :     devType = deviceType_;
    1145            0 :     return HCCL_SUCCESS;
    1146              : }
    1147              : 
    1148            0 : HcclResult hcclComm::IsStandardCard(bool &isStandardCard)
    1149              : {
    1150            0 :     isStandardCard = communicator_->IsStandardCard();
    1151              : 
    1152            0 :     return HCCL_SUCCESS;
    1153              : }
    1154              : 
    1155            0 : HcclResult hcclComm::Is310PDuoCard(bool &is310PDuoCard)
    1156              : {
    1157            0 :     is310PDuoCard = communicator_->Is310PDuoCard();
    1158            0 :     return HCCL_SUCCESS;
    1159              : }
    1160              : 
    1161          234 : bool hcclComm::IsNeedResetDevice()
    1162              : {
    1163          234 :     return isResetDevice_;
    1164              : }
    1165              : 
    1166            0 : HcclResult hcclComm::ResetDeviceEnable()
    1167              : {
    1168            0 :     isResetDevice_ = true;
    1169            0 :     return HCCL_SUCCESS;
    1170              : }
    1171              : 
    1172          633 : HcclResult hcclComm::SaveTraceInfo(std::string &logInfo)
    1173              : {
    1174          633 :     CHK_PRT(communicator_->SaveTraceInfo(logInfo));
    1175              : 
    1176          633 :     return HCCL_SUCCESS;
    1177              : }
    1178              : 
    1179            1 : bool hcclComm::GetCommResource(const std::string &tag, void **commContext)
    1180              : {
    1181              :     /* 增加输出日志关键字 */
    1182            1 :     HCCL_INFO("HCCL_KEY_INFO: GetCommResource commContext[%p]", commContext);
    1183              : 
    1184            1 :     return (communicator_->GetCommResource(tag, commContext));
    1185              : }
    1186              : 
    1187            7 : bool hcclComm::GetCommResource(void *&commContext)
    1188              : {
    1189            7 :     HCCL_INFO("HCCL_KEY_INFO: GetCommResource commContext[%p]", commContext);
    1190            7 :     return communicator_->GetCommResource(commContext);
    1191              : }
    1192              : 
    1193          235 : HcclResult hcclComm::SetStopFlag(bool value)
    1194              : {
    1195          235 :     if (communicator_ != nullptr) {
    1196          234 :         return communicator_->SetStopFlag(value);
    1197              :     }
    1198            1 :     return HCCL_SUCCESS;
    1199              : }
    1200              : 
    1201          540 : HcclResult hcclComm::SetState(HcclCommState state)
    1202              : {
    1203          540 :     if (communicator_ != nullptr) {
    1204          540 :         return communicator_->SetState(state);
    1205              :     }
    1206            0 :     return HCCL_SUCCESS;
    1207              : }
    1208              : 
    1209          505 : HcclCommState hcclComm::GetState()
    1210              : {
    1211          505 :     if (communicator_ != nullptr) {
    1212          504 :         return communicator_->GetState();
    1213              :     }
    1214            1 :     return HcclCommState::IDLE;
    1215              : }
    1216              : 
    1217            1 : HcclResult hcclComm::AllocComResourceByTiling(const std::string &algConfig, void *param)
    1218              : {
    1219            1 :     HCCL_INFO("HCCL_KEY_INFO: AllocComResourceByTiling algConfig[%s].", algConfig.c_str());
    1220            1 :     return communicator_->AllocComResourceByTiling(algConfig, param);
    1221              : }
    1222              : 
    1223            1 : HcclResult hcclComm::CreateCommResource(const std::string &tag, rtStream_t aiCpuStream, bool isOpbaseMode,
    1224              :         void **commContext, const std::string &algConfig)
    1225              : {
    1226              :     /* 增加输出日志关键字 */
    1227            1 :     HCCL_INFO("HCCL_KEY_INFO: CreateCommResource commContext[%p], isOpbaseMode[%u], algConfig[%s].",
    1228              :         commContext, isOpbaseMode, algConfig.c_str());
    1229              : 
    1230            1 :     CHK_RET(communicator_->CreateCommResource(tag, aiCpuStream, isOpbaseMode, commContext, algConfig));
    1231              : 
    1232            1 :     return HCCL_SUCCESS;
    1233              : }
    1234              : 
    1235            0 : HcclResult hcclComm::GetAicpuOpStreamNotify(HcclRtStream *opStream, u8 aicpuNotifyNum, void** aicpuNotify)
    1236              : {
    1237              :     /* 增加输出日志关键字 */
    1238            0 :     HCCL_INFO("HCCL_KEY_INFO: GetAicpuOpStreamNotify commContext[%p]", opStream);
    1239              : 
    1240            0 :     CHK_RET(communicator_->GetAicpuOpStreamNotify(opStream, aicpuNotifyNum, aicpuNotify));
    1241              : 
    1242            0 :     return HCCL_SUCCESS;
    1243              : }
    1244              : 
    1245            2 : HcclResult hcclComm::Mc2AiCpuStreamAllocAndGet(u32 streamMode, rtStream_t &aiCpuStream)
    1246              : {
    1247              :     /* 增加输出日志关键字 */
    1248            2 :     HCCL_INFO("HCCL_KEY_INFO: Mc2AiCpuStreamAllocAndGet streamMode[%u]", streamMode);
    1249              : 
    1250            2 :     CHK_RET(communicator_->Mc2AiCpuStreamAllocAndGet(streamMode, aiCpuStream));
    1251            2 :     CHK_PTR_NULL(aiCpuStream);
    1252              : 
    1253            2 :     return HCCL_SUCCESS;
    1254              : }
    1255              : 
    1256            0 : HcclResult hcclComm::GetTopoDesc(HcclTopoDescs *topoDescs, uint32_t topoSize)
    1257              : {
    1258            0 :     HCCL_INFO("HCCL_KEY_INFO: GetTopoDesc topoDescs[%p] topoSize[%u]", topoDescs, topoSize);
    1259              : 
    1260            0 :     CHK_RET(communicator_->GetTopoDesc(topoDescs, topoSize));
    1261              : 
    1262            0 :     return HCCL_SUCCESS;
    1263              : }
    1264              : 
    1265            0 : HcclResult hcclComm::GetCommUserMemSize(uint64_t &size)
    1266              : {
    1267            0 :     HcclResult ret = communicator_->GetCommUserMemSize(size);
    1268            0 :     CHK_PRT_RET(ret != HCCL_SUCCESS, HCCL_INFO("[%s]call trace: hcclRet -> %d", __func__, ret), ret);
    1269            0 :     return HCCL_SUCCESS;
    1270              : }
    1271          234 : HcclResult hcclComm::SetDeterministicConfig(const u8 deterministic)
    1272              : {
    1273          234 :     CHK_RET(communicator_->SetDeterministicConfig(deterministic));
    1274          234 :     return HCCL_SUCCESS;
    1275              : }
    1276              : 
    1277          234 : HcclResult hcclComm::SetAivModeConfig(const bool aivMode)
    1278              : {
    1279          234 :     CHK_RET(communicator_->SetAivModeConfig(aivMode));
    1280          234 :     return HCCL_SUCCESS;
    1281              : }
    1282              : 
    1283          234 : HcclResult hcclComm::SetOnlyAivModeConfig(const bool isOnlyAiv)
    1284              : {
    1285          234 :     CHK_RET(communicator_->SetOnlyAivModeConfig(isOnlyAiv));
    1286          234 :     return HCCL_SUCCESS;
    1287              : }
    1288              : 
    1289            0 : HcclResult hcclComm::GetOnlyAivModeConfig(bool &isOnlyAiv)
    1290              : {
    1291            0 :     isOnlyAiv = communicator_->GetConfigIsOnlyAivMode();
    1292            0 :     return HCCL_SUCCESS;
    1293              : }
    1294              : 
    1295          234 : HcclResult hcclComm::SetAicpuUnfoldConfig(const bool aicpuUnfold)
    1296              : {
    1297          234 :     CHK_RET(communicator_->SetAicpuUnfoldConfig(aicpuUnfold));
    1298          234 :     return HCCL_SUCCESS;
    1299              : }
    1300              : 
    1301          234 : HcclResult hcclComm::SetExecTimeOutConfig(const s32 execTimeOut)
    1302              : {
    1303          234 :     CHK_RET(communicator_->SetExecTimeOutConfig(execTimeOut));
    1304          234 :     return HCCL_SUCCESS;
    1305              : }
    1306              : 
    1307          234 : HcclResult hcclComm::SetAlgoConfig(const std::map<HcclCMDType, std::vector<HcclAlgoType>>& algoMap)
    1308              : {
    1309          234 :     CHK_RET(communicator_->SetAlgoConfig(algoMap));
    1310          234 :     return HCCL_SUCCESS;
    1311              : }
    1312              : 
    1313            0 : u64 hcclComm::GetConfigInCCLbufferSize()
    1314              : {
    1315            0 :     return inCCLbufferSize_;
    1316              : }
    1317              : 
    1318            0 : u64 hcclComm::GetConfigOutCCLbufferSize()
    1319              : {
    1320            0 :     return outCCLbufferSize_;
    1321              : }
    1322              : 
    1323            0 : u32 hcclComm::GetRankTableCrc()
    1324              : {
    1325            0 :     return communicator_->GetRankTableCrc();
    1326              : }
    1327              : 
    1328            0 : u32 hcclComm::GetServerNum()
    1329              : {
    1330            0 :     return communicator_->GetServerNum();
    1331              : }
    1332              : 
    1333            1 : u32 hcclComm::GetModuleNum()
    1334              : {
    1335            1 :     return communicator_->GetModuleNum();
    1336              : }
    1337              : 
    1338            0 : u32 hcclComm::GetRealUserRank() const
    1339              : {
    1340            0 :     return communicator_->GetRealUserRank();
    1341              : }
    1342              : 
    1343            1 : HcclResult hcclComm::GetCommParams(HcclCommParams &params)
    1344              : {
    1345            1 :     CHK_RET(communicator_->GetCommParams(params));
    1346            1 :     params.deviceType = deviceType_;
    1347            1 :     params.isHeterogComm = isHeterogComm_;
    1348            1 :     params.identifier = identifier_;
    1349            1 :     return HCCL_SUCCESS;
    1350              : }
    1351              : 
    1352            1 : HcclResult hcclComm::GetCommRankTable(RankTable_t &rankTable)
    1353              : {
    1354            1 :     CHK_RET(communicator_->GetCommRankTable(rankTable));
    1355            1 :     return HCCL_SUCCESS;
    1356              : }
    1357              : 
    1358            1 : HcclResult hcclComm::Suspend()
    1359              : {
    1360            1 :     CHK_RET(communicator_->Suspend());
    1361            1 :     return HCCL_SUCCESS;
    1362              : }
    1363              : 
    1364            0 : HcclResult hcclComm::InitZeroCopyMemoryAgent()
    1365              : {
    1366            0 :     CHK_SMART_PTR_NULL(communicator_);
    1367            0 :     CHK_RET(communicator_->InitZeroCopyMemoryAgent());
    1368            0 :     return HCCL_SUCCESS;
    1369              : }
    1370              : 
    1371          235 : HcclResult hcclComm::DeinitZeroCopyMemoryAgent()
    1372              : {
    1373          235 :     CHK_SMART_PTR_NULL(communicator_);
    1374          234 :     CHK_RET(communicator_->DeinitZeroCopyMemoryAgent());
    1375          234 :     return HCCL_SUCCESS;
    1376              : }
    1377              : 
    1378            1 : HcclResult hcclComm::SetMemoryRange(void *baseVirPtr, size_t size, size_t alignment, uint64_t flags)
    1379              : {
    1380            1 :     CHK_SMART_PTR_NULL(communicator_);
    1381            1 :     CHK_RET(communicator_->SetMemoryRange(baseVirPtr, size, alignment, flags));
    1382            1 :     return HCCL_SUCCESS;
    1383              : }
    1384              : 
    1385            1 : HcclResult hcclComm::UnsetMemoryRange(void *baseVirPtr)
    1386              : {
    1387            1 :     CHK_SMART_PTR_NULL(communicator_);
    1388            1 :     CHK_RET(communicator_->UnsetMemoryRange(baseVirPtr));
    1389            1 :     return HCCL_SUCCESS;
    1390              : }
    1391              : 
    1392            1 : HcclResult hcclComm::ActivateCommMemory(void *virPtr, size_t size, size_t offset, void* handle, uint64_t flags)
    1393              : {
    1394            1 :     CHK_SMART_PTR_NULL(communicator_);
    1395            1 :     CHK_RET(communicator_->ActivateCommMemory(virPtr, size, offset, handle, flags));
    1396            1 :     return HCCL_SUCCESS;
    1397              : }
    1398              : 
    1399            1 : HcclResult hcclComm::DeactivateCommMemory(void *virPtr)
    1400              : {
    1401            1 :     CHK_SMART_PTR_NULL(communicator_);
    1402            1 :     CHK_RET(communicator_->DeactivateCommMemory(virPtr));
    1403            1 :     return HCCL_SUCCESS;
    1404              : }
    1405              : 
    1406           13 : HcclResult hcclComm::GetNumBlocks(u32& numBlocks)
    1407              : {
    1408           13 :     return communicator_->GetNumBlocks(numBlocks);
    1409              : }
    1410              : 
    1411          302 : HcclResult hcclComm::SetAivCoreLimit(u32 aivCoreLimit)
    1412              : {
    1413          302 :     CHK_SMART_PTR_NULL(communicator_);
    1414          302 :     return communicator_->SetAivCoreLimit(aivCoreLimit);
    1415              : }
    1416              : 
    1417            1 : HcclResult hcclComm::SwitchNic(uint32_t nRanks, uint32_t *ranks, bool *useBackup)
    1418              : {
    1419            1 :     CHK_SMART_PTR_NULL(communicator_);
    1420            1 :     CHK_RET(communicator_->SwitchNic(nRanks, ranks, useBackup));
    1421            1 :     return HCCL_SUCCESS;
    1422              : }
    1423          234 : HcclResult hcclComm::InitHccpChannel()
    1424              : {
    1425              :     /* 增加输出日志关键字 */
    1426          234 :     HCCL_INFO("NslbDp try to init hccp ");
    1427          234 :     return communicator_->InitHccpChannel();
    1428              : }
    1429              : 
    1430          403 : std::vector<RankInfo> hcclComm::GetRankLists()
    1431              : {
    1432          403 :     return communicator_->GetRankLists();
    1433              : }
    1434              : 
    1435            0 : HcclResult hcclComm::GetLocalCCLBuf(void **addr, uint64_t *size)
    1436              : {
    1437            0 :     CHK_SMART_PTR_NULL(communicator_);
    1438            0 :     CHK_RET(communicator_->GetLocalCCLBuf(addr, size));
    1439            0 :     return HCCL_SUCCESS;
    1440              : }
    1441              : 
    1442            6 : HcclResult hcclComm::GetRemoteCCLBuf(uint32_t remoteRank, void **addr, uint64_t *size)
    1443              : {
    1444            6 :     CHK_SMART_PTR_NULL(communicator_);
    1445            6 :     CHK_RET(communicator_->GetRemoteCCLBuf(remoteRank, addr, size));
    1446            4 :     return HCCL_SUCCESS;
    1447              : }
    1448              :  
    1449            0 : HcclResult hcclComm::SetGroupMode(bool isGroup){
    1450            0 :     isGroupMode_ = isGroup;
    1451            0 :     CHK_SMART_PTR_NULL(communicator_);
    1452            0 :     CHK_RET(communicator_->SetGroupMode(isGroup));
    1453            0 :     return HCCL_SUCCESS;
    1454              : }
    1455              :  
    1456            0 : bool hcclComm::GetGroupMode(){
    1457            0 :     return isGroupMode_;
    1458              : }
    1459              : 
    1460            0 : HcclResult hcclComm::GetKFCWorkSpace(void **addr, uint64_t *size)
    1461              : {
    1462            0 :     CHK_SMART_PTR_NULL(communicator_);
    1463            0 :     CHK_RET(communicator_->GetKFCWorkSpace(addr, size));
    1464            0 :     return HCCL_SUCCESS;
    1465              : }
    1466              : 
    1467           92 : bool hcclComm::IsCommunicatorV2()
    1468              : {
    1469           92 :     if (devType_ == DevType::DEV_TYPE_950 || devType_ == DevType::DEV_TYPE_960) {
    1470           72 :         return true;
    1471              :     }
    1472           20 :     return false;
    1473              : }
    1474              : 
    1475            0 : HcclResult hcclComm::SetHcclQos(u32 hcclQos)
    1476              : {
    1477              :     // 校验config中QoS的合法性
    1478            0 :     if (hcclQos == HCCL_COMM_QOS_CONFIG_NOT_SET) {
    1479            0 :         HCCL_INFO("[SetHcclQos]The QoS do not use the config configuration. "
    1480              :                   "It will use environment variables to configure. QoS[%u]", EnvConfig::HCCL_QOS_DEFAULT);
    1481            0 :         hcclQos_ = EnvConfig::HCCL_QOS_DEFAULT;
    1482            0 :         communicator_->SetHcclQos(EnvConfig::HCCL_QOS_DEFAULT);
    1483            0 :         return HCCL_SUCCESS;
    1484              :     }
    1485              : 
    1486              :     // 若设置的hcclQos不在有效范围内,则使用默认值
    1487            0 :     if (hcclQos > EnvConfig::HCCL_QOS_MAX) {
    1488            0 :         HCCL_INFO("[SetHcclQos]hcclQos is invalid, expect[%u, %u], actual[%u]. "
    1489              :                   "It will use the default value. QoS[%u]", EnvConfig::HCCL_QOS_MIN, EnvConfig::HCCL_QOS_MAX, hcclQos,
    1490              :                    EnvConfig::HCCL_QOS_DEFAULT);
    1491            0 :         hcclQos_ = EnvConfig::HCCL_QOS_DEFAULT;
    1492            0 :         communicator_->SetHcclQos(EnvConfig::HCCL_QOS_DEFAULT);
    1493            0 :         return HCCL_SUCCESS;
    1494              :     }
    1495              : 
    1496            0 :     HCCL_INFO("[SetHcclQos] hcclQos[%u]", hcclQos);
    1497            0 :     hcclQos_ = hcclQos;
    1498            0 :     communicator_->SetHcclQos(hcclQos);
    1499              : 
    1500            0 :     return HCCL_SUCCESS;
    1501              : }
    1502              : 
    1503            0 : u32 hcclComm::GetHcclQos()
    1504              : {
    1505            0 :     return hcclQos_;
    1506              : }
    1507              : 
    1508            0 : HcclResult hcclComm::RegisterWindow(void* ptr, size_t size, HcclCommSymWindow *winHandle)
    1509              : {
    1510            0 :     CHK_SMART_PTR_NULL(communicator_);
    1511            0 :     CHK_RET(communicator_->RegisterWindow(ptr, size, winHandle));
    1512            0 :     return HCCL_SUCCESS;
    1513              : }
    1514              : 
    1515            0 : HcclResult hcclComm::DeregisterWindow(HcclCommSymWindow winHandle)
    1516              : {
    1517            0 :     CHK_SMART_PTR_NULL(communicator_);
    1518            0 :     CHK_RET(communicator_->DeregisterWindow(winHandle));
    1519            0 :     return HCCL_SUCCESS;
    1520              : }
    1521              : 
    1522            0 : HcclResult hcclComm::GetCommSymWin(void* ptr, size_t size, HcclCommSymWindow *winHandle, size_t *offset)
    1523              : {
    1524            0 :     CHK_SMART_PTR_NULL(communicator_);
    1525            0 :     CHK_RET(communicator_->GetCommSymWin(ptr, size, winHandle, offset));
    1526            0 :     return HCCL_SUCCESS;
    1527              : }
    1528              : 
    1529            1 : aclrtBinHandle hcclComm::GetBinHandle()
    1530              : {
    1531            1 :     return binHandle_;
    1532              : }
    1533              : 
    1534              : }  // namespace hccl
        

Generated by: LCOV version 2.0-1