LCOV - code coverage report
Current view: top level - legacy/ascend950/framework/communicator - hccl_communicator.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 74.5 % 267 199
Test Date: 2026-08-18 17:47:01 Functions: 77.0 % 87 67

            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 "hccl_communicator.h"
      12              : 
      13              : #include <memory>
      14              : #include <utility>
      15              : #include "communicator_impl.h"
      16              : #include "snap_shot_parse.h"
      17              : #include "task_abort_handler_v2.h"
      18              : #include "ccu_dev_mgr.h"
      19              : #include "communicator_callback.h"
      20              : #include "comm_manager.h"
      21              : #include "orion_adapter_rts.h"
      22              : 
      23              : namespace Hccl {
      24              : 
      25          253 : HcclCommunicator::HcclCommunicator(const CommParams& commParams) : commParams(std::move(commParams))
      26              : {
      27          253 :     pimpl = std::make_unique<CommunicatorImpl>();
      28          253 :     config.hcclBufferSize = 0;
      29          253 :     config.hcclDeterministic = 0;
      30          253 :     RegistTaskAbortHandler();
      31          253 : }
      32              : 
      33           20 : HcclCommunicator::HcclCommunicator(const CommParams& commParams, const HcclCommConfig* config)
      34           20 :     : commParams(std::move(commParams)),
      35           20 :       config(*config)
      36              : {
      37           20 :     pimpl = std::make_unique<CommunicatorImpl>();
      38           20 :     RegistTaskAbortHandler();
      39           20 : }
      40              : 
      41          273 : HcclCommunicator::~HcclCommunicator()
      42              : {
      43          273 :     DECTOR_TRY_CATCH("HcclCommunicator", {
      44              :         UnRegistTaskAbortHandler();
      45              :         u32 devLogicId = GetDeviceLogicId();
      46              :         pimpl = nullptr;
      47              :         CommManager::GetInstance(static_cast<s32>(devLogicId)).DeinitCcuDriver();
      48              :     });
      49          273 : }
      50              : 
      51           10 : HcclResult HcclCommunicator::Init(const std::string& ranktableM) { return pimpl->Init(commParams, ranktableM, config); }
      52              : 
      53            0 : HcclResult HcclCommunicator::Init(const RankTableInfo& ranktable) { return pimpl->Init(commParams, ranktable, config); }
      54              : 
      55            3 : HcclResult HcclCommunicator::CreateSubComm(
      56              :     const CommParams& subCommParams, const std::vector<u32>& rankIds, std::shared_ptr<HcclCommunicator>& subHcclComm)
      57              : {
      58            3 :     subHcclComm = std::make_shared<Hccl::HcclCommunicator>(subCommParams);
      59            3 :     return pimpl->CreateSubComm(subCommParams, rankIds, subHcclComm->GetCommImpl());
      60              : }
      61              : 
      62            3 : HcclResult HcclCommunicator::CreateSubComm(
      63              :     const CommParams& subCommParams, const std::vector<u32>& rankIds, std::shared_ptr<HcclCommunicator>& subHcclComm,
      64              :     HcclCommConfig& subConfig)
      65              : {
      66            3 :     subHcclComm = std::make_shared<Hccl::HcclCommunicator>(subCommParams);
      67            3 :     config.hcclBufferSize = 0;
      68            3 :     config.hcclDeterministic = 0;
      69            3 :     return pimpl->CreateSubComm(subCommParams, rankIds, subHcclComm->GetCommImpl(), subConfig);
      70              : }
      71              : 
      72           14 : CommunicatorImpl* HcclCommunicator::GetCommImpl() { return pimpl.get(); }
      73              : 
      74            0 : void HcclCommunicator::DeInit() const {}
      75              : 
      76            5 : HcclResult HcclCommunicator::LoadOpbasedCollOp(const CollOpParams& opParams, void* stream)
      77              : {
      78            5 :     return pimpl->LoadOpbasedCollOp(opParams, stream);
      79              : }
      80              : 
      81            0 : HcclResult HcclCommunicator::AllocCollOpResource(const CollOpParams& opParams, void** addr)
      82              : {
      83            0 :     return pimpl->AllocCollOpResource(opParams, addr);
      84              : }
      85              : 
      86            2 : HcclResult HcclCommunicator::CalcCollOffloadOpRes(
      87              :     const OpType opType, u64 dataSize, HcclDataType dataType, CollOffloadOpResReq& resReq)
      88              : {
      89            2 :     std::lock_guard<std::mutex> lock(serialMutex);
      90            2 :     auto ret = pimpl->CalcCollOffloadOpRes(opType, dataSize, dataType, resReq);
      91            2 :     return ret;
      92            2 : }
      93              : 
      94            3 : HcclResult HcclCommunicator::SetCollOffloadSlaveStreams(const std::string& opTag, std::vector<void*> slaveStreams)
      95              : {
      96            3 :     std::lock_guard<std::mutex> lock(serialMutex);
      97            3 :     auto ret = pimpl->SetCollOffloadSlaveStreams(opTag, slaveStreams);
      98            3 :     return ret;
      99            3 : }
     100              : 
     101              : HcclResult
     102            3 : HcclCommunicator::SetCollOffloadScratchBuf(const std::string& opTag, void* scratchMemPtr, u64 requiredScratchMemSize)
     103              : {
     104            3 :     std::lock_guard<std::mutex> lock(serialMutex);
     105            3 :     auto ret = pimpl->SetCollOffloadScratchBuf(opTag, scratchMemPtr, requiredScratchMemSize);
     106            3 :     return ret;
     107            3 : }
     108              : 
     109            1 : HcclResult HcclCommunicator::LoadOffloadCollOp(std::string& opTag, const CollOpParams& opParams, void* stream)
     110              : {
     111            1 :     std::lock_guard<std::mutex> lock(serialMutex);
     112            1 :     auto ret = pimpl->LoadOffloadCollOp(opTag, opParams, stream);
     113            1 :     return ret;
     114            1 : }
     115              : 
     116           78 : HcclResult HcclCommunicator::GetRankSize(uint32_t* rankSize)
     117              : {
     118           78 :     if (rankSize == nullptr) {
     119            0 :         HCCL_ERROR("Parameter rank size is nullptr.");
     120            0 :         return HcclResult::HCCL_E_PARA;
     121              :     }
     122              : 
     123           78 :     *rankSize = pimpl->GetRankSize();
     124              : 
     125           78 :     return HcclResult::HCCL_SUCCESS;
     126              : }
     127              : 
     128              : HcclResult
     129            0 : HcclCommunicator::HcclGetCclBuffer(uintptr_t& cclBufferAddr, size_t& cclBufferSize, HcclMemType& cclBufferMemType)
     130              : {
     131            0 :     auto commImpl = GetCommImpl();
     132            0 :     if (UNLIKELY(commImpl == nullptr)) {
     133            0 :         HCCL_ERROR("[HcclCommunicator][%s] commImpl is null.", __func__);
     134            0 :         return HcclResult::HCCL_E_PTR;
     135              :     }
     136              : 
     137              :     // GetCclBuffer接口不合理,应返回裸指针
     138              :     // 本次性能整改暂时最小化修改,避免重复分配内存和拷贝
     139            0 :     const auto& hcclBuffer = commImpl->GetCclBuffer();
     140            0 :     if (UNLIKELY(hcclBuffer == nullptr)) {
     141            0 :         cclBufferSize = 0;
     142            0 :         cclBufferAddr = 0;
     143            0 :         cclBufferMemType = HcclMemType::HCCL_MEM_TYPE_DEVICE;
     144            0 :         return HcclResult::HCCL_SUCCESS;
     145              :     }
     146              : 
     147            0 :     cclBufferSize = commImpl->GetBufferSize();
     148            0 :     cclBufferAddr = hcclBuffer->GetAddr();
     149            0 :     cclBufferMemType = hcclBuffer->GetMemType();
     150            0 :     return HCCL_SUCCESS;
     151              : }
     152              : 
     153              : // 后续会整改把cclbuffer等资源的申请放到collcomm中
     154            3 : HcclResult HcclCommunicator::GetCclBufferSharedPtr(std::shared_ptr<DevBuffer>& cclBuffer)
     155              : {
     156            3 :     auto commImpl = GetCommImpl();
     157            3 :     if (commImpl == nullptr) {
     158            3 :         HCCL_ERROR("[HcclCommunicator][%s] commImpl is null.", __func__);
     159            1 :         return HcclResult::HCCL_E_PTR;
     160              :     }
     161            2 :     cclBuffer = commImpl->GetCclBuffer();
     162            2 :     if (cclBuffer == nullptr) {
     163            3 :         HCCL_WARNING("[HcclCommunicator][%s] cclBuffer is nullptr, ranksize is %u.", __func__, commImpl->GetRankSize());
     164              :     }
     165            2 :     return HcclResult::HCCL_SUCCESS;
     166              : }
     167              : 
     168           65 : HcclResult HcclCommunicator::GetRankId(uint32_t& rankId)
     169              : {
     170           65 :     rankId = pimpl->GetMyRank();
     171           65 :     return HcclResult::HCCL_SUCCESS;
     172              : }
     173              : 
     174            1 : HcclResult HcclCommunicator::AllocCommResource(void* mc2Tiling, void** commContext)
     175              : {
     176            1 :     std::lock_guard<std::mutex> lock(serialMutex);
     177            1 :     auto ret = pimpl->AllocCommResource(mc2Tiling, commContext);
     178            1 :     return ret;
     179            1 : }
     180              : 
     181            0 : HcclResult HcclCommunicator::GetCcuTaskInfo(void* tilingData, void* ccuTaskGroup)
     182              : {
     183            0 :     return pimpl->GetCcuTaskInfo(tilingData, ccuTaskGroup);
     184              : }
     185              : 
     186            0 : u32 HcclCommunicator::GetCcuMc2ServerNum() { return pimpl->GetCcuMc2ServerNum(); }
     187              : 
     188          167 : const std::string& HcclCommunicator::GetId() const { return pimpl->GetId(); }
     189              : 
     190            2 : HcclResult HcclCommunicator::Suspend()
     191              : {
     192            2 :     std::lock_guard<std::mutex> lock(serialMutex);
     193            2 :     auto ret = pimpl->Suspend();
     194            2 :     return ret;
     195            2 : }
     196              : 
     197            1 : HcclResult HcclCommunicator::Clean()
     198              : {
     199            1 :     std::lock_guard<std::mutex> lock(serialMutex);
     200            1 :     auto ret = pimpl->Clean();
     201            1 :     return ret;
     202            1 : }
     203              : 
     204            4 : HcclResult HcclCommunicator::Resume()
     205              : {
     206            4 :     std::lock_guard<std::mutex> lock(serialMutex);
     207            4 :     auto ret = pimpl->Resume();
     208            4 :     return ret;
     209            4 : }
     210              : 
     211            6 : bool HcclCommunicator::IsWorldGroup() const { return pimpl->IsWorldGroup(); }
     212              : 
     213            0 : HcclResult HcclCcuTaskKillPreProcess(u32 deviceLogicId)
     214              : {
     215              :     // 有没有使能ccu都尝试执行
     216            0 :     return CcuSetTaskKill(deviceLogicId);
     217              : }
     218              : 
     219            0 : HcclResult HcclCcuTaskKillPostProcess(u32 deviceLogicId) { return CcuSetTaskKillDone(deviceLogicId); }
     220              : 
     221            2 : HcclResult HcclCcuResumePfeTableProcess([[maybe_unused]] u32 deviceLogicId)
     222              : {
     223              :     // 待修改
     224            2 :     return HcclResult::HCCL_SUCCESS;
     225              : }
     226              : 
     227            5 : HcclResult HcclCommunicator::GetSnapShotDynamicBuf(void* buf)
     228              : {
     229            5 :     std::lock_guard<std::mutex> lock(serialMutex);
     230            5 :     CHK_RET(pimpl->GetSnapShotDynamicBuf(*(static_cast<BinaryStream*>(buf))));
     231            5 :     return HcclResult::HCCL_SUCCESS;
     232            5 : }
     233              : 
     234            1 : HcclResult HcclCommunicator::RecoverComm(void* snapShotComm, u32 step, const char* changeInfo)
     235              : {
     236            1 :     std::lock_guard<std::mutex> lock(serialMutex);
     237            2 :     return pimpl->RecoverComm(*(static_cast<SnapShotComm*>(snapShotComm)), step, changeInfo);
     238            1 : }
     239              : 
     240              : HcclResult
     241            1 : HcclCommunicator::RecoverSubComm(const void* snapShotSubComm, std::shared_ptr<HcclCommunicator>& subComm, u32 step)
     242              : {
     243            1 :     const SnapShotSubComm* snapShotSubCommTemp = static_cast<const SnapShotSubComm*>(snapShotSubComm);
     244            1 :     std::lock_guard<std::mutex> lock(serialMutex);
     245            1 :     subComm = std::make_shared<Hccl::HcclCommunicator>(snapShotSubCommTemp->commParams);
     246            1 :     subComm->RegisterAcceStateCallBack(CommunicatorCallback());
     247            2 :     return pimpl->RecoverSubComm(*snapShotSubCommTemp, subComm->GetCommImpl(), step);
     248            1 : }
     249              : 
     250            5 : void* HcclCommunicator::GetStaticBinaryInfo()
     251              : {
     252            5 :     std::lock_guard<std::mutex> lock(serialMutex);
     253           10 :     return static_cast<void*>(&pimpl->GetStaticBinaryInfo());
     254            5 : }
     255              : 
     256            1 : bool HcclCommunicator::IsCommReady() { return pimpl->IsCommReady(); }
     257              : 
     258          272 : void HcclCommunicator::RegistTaskAbortHandler() { TaskAbortHandler::GetInstance().Register(this); }
     259              : 
     260          272 : void HcclCommunicator::UnRegistTaskAbortHandler() { TaskAbortHandler::GetInstance().UnRegister(this); }
     261              : 
     262            7 : HcclResult HcclCommunicator::GetOneSidedService(HcclOneSidedService** oneSidedService)
     263              : {
     264           21 :     HCCL_INFO("HcclCommunicator::GetOneSidedService begin");
     265            7 :     CHK_RET(pimpl->GetOneSidedService(oneSidedService));
     266           21 :     HCCL_INFO("HcclCommunicator::GetOneSidedService end");
     267            7 :     return HCCL_SUCCESS;
     268              : }
     269              : 
     270            0 : u32 HcclCommunicator::GetUsedChannelCount(u32 dieId) { return pimpl->GetUsedChannelCount(dieId); }
     271              : 
     272           13 : void HcclCommunicator::RegisterPrintChannelInfoCallback(std::function<void()> callback)
     273              : {
     274           13 :     pimpl->RegisterPrintChannelInfoCallback(callback);
     275           13 : }
     276              : 
     277            5 : CommStatus HcclCommunicator::GetCommStatus() const { return pimpl->GetCommStatus(); }
     278              : 
     279            5 : HcclResult HcclCommunicator::CreateCommCclBuf()
     280              : {
     281           15 :     HCCL_INFO("HcclCommunicator::CreateCommCclBuf start");
     282            5 :     return pimpl->CreateCommCclBuf();
     283              : }
     284              : 
     285            1 : HcclResult HcclCommunicator::GetInCclBuf(void*& commInputPtr, u64& commInputSize)
     286              : {
     287            1 :     return pimpl->GetInCclBuf(commInputPtr, commInputSize);
     288              : }
     289              : 
     290            1 : HcclResult HcclCommunicator::GetOutCclBuf(void*& commOutputPtr, u64& commOutputSize)
     291              : {
     292            1 :     return pimpl->GetOutCclBuf(commOutputPtr, commOutputSize);
     293              : }
     294              : 
     295            1 : HcclResult HcclCommunicator::GetLocalCclBuffer(void** addr, uint64_t* size)
     296              : {
     297            1 :     return pimpl->GetLocalCclBuffer(addr, size);
     298              : }
     299              : 
     300              : HcclResult
     301            5 : HcclCommunicator::GetDevMemWorkSpace(const std::string& memTag, uint64_t* size, void** addr, bool* newCreated)
     302              : {
     303            5 :     return pimpl->GetDevMemWorkSpace(memTag, size, addr, newCreated);
     304              : }
     305              : 
     306            0 : HcclResult HcclCommunicator::GetAicpuOpStreamNotify(rtStream_t* opStream, u8 aicpuNotifyNum, void** aicpuNotify)
     307              : {
     308            0 :     return pimpl->GetAicpuOpStreamNotify(opStream, aicpuNotifyNum, aicpuNotify);
     309              : }
     310              : 
     311            1 : HcclResult HcclCommunicator::GetIndirectInputCclBuf(void*& commIndirectInputPtr, u64& commIndirectInputSize)
     312              : {
     313            1 :     return pimpl->GetIndirectInCclBuf(commIndirectInputPtr, commIndirectInputSize);
     314              : }
     315              : 
     316            1 : HcclResult HcclCommunicator::GetIndirectOutputCclBuf(void*& commIndirectOutputPtr, u64& commIndirectOutputSize)
     317              : {
     318            1 :     return pimpl->GetIndirectOutCclBuf(commIndirectOutputPtr, commIndirectOutputSize);
     319              : }
     320              : 
     321           14 : HcclResult HcclCommunicator::SetAccelerator(HcclAccelerator hcclAccelerator, bool isCcuMsAvailable)
     322              : {
     323           14 :     CHK_RET(pimpl->SetAccelerator(hcclAccelerator, isCcuMsAvailable));
     324           14 :     return HcclResult::HCCL_SUCCESS;
     325              : }
     326              : 
     327            0 : HcclResult HcclCommunicator::SetAccelerator(int32_t accelerator, bool isCcuMsAvailable)
     328              : {
     329            0 :     if (accelerator < static_cast<int32_t>(HcclAccelerator::DEFAULT)
     330            0 :         || accelerator > static_cast<int32_t>(HcclAccelerator::AICPU)) {
     331            0 :         HCCL_ERROR(
     332              :             "[HcclCommunicator][SetAccelerator] Invalid accelerator value [%d], valid range is [0,7]", accelerator);
     333            0 :         return HCCL_E_NOT_SUPPORT;
     334              :     }
     335            0 :     HcclAccelerator hcclAccelerator = static_cast<HcclAccelerator::Value>(accelerator);
     336            0 :     CHK_RET(SetAccelerator(hcclAccelerator, isCcuMsAvailable));
     337            0 :     return HcclResult::HCCL_SUCCESS;
     338              : }
     339              : 
     340            0 : HcclResult HcclCommunicator::GetAccelerator(int32_t* accelerator) const
     341              : {
     342            0 :     CHK_RET(pimpl->GetAccelerator(accelerator));
     343            0 :     return HcclResult::HCCL_SUCCESS;
     344              : }
     345              : 
     346            1 : bool HcclCommunicator::IsUsingCcuMs() const
     347              : {
     348            1 :     return pimpl->IsCommUsingCcuMs(); // 通信域粒度
     349              : }
     350              : 
     351            1 : bool HcclCommunicator::IsUsingCcuSched() const
     352              : {
     353            1 :     return pimpl->IsCommUsingCcuSched(); // 通信域粒度
     354              : }
     355              : 
     356           17 : void HcclCommunicator::RegisterAcceStateCallBack(
     357              :     std::function<HcclResult(const std::string& commId, bool isUsingCcuMs, bool isUsingCcuSched)> callback)
     358              : {
     359           17 :     pimpl->RegisterAcceStateCallBack(callback);
     360           17 : }
     361              : 
     362            1 : HcclResult HcclCommunicator::CalcTaskNum(OpType opType, DataType dataType, u64 count, u32& taskNum)
     363              : {
     364            3 :     HCCL_INFO("HcclCommunicator::CalcTaskNum begin");
     365            1 :     return pimpl->CalcTaskNum(opType, dataType, count, taskNum);
     366              : }
     367              : 
     368            2 : HcclResult HcclCommunicator::GetTopoDesc(HcclTopoDescs* topoDescs, uint32_t topoSize)
     369              : {
     370            2 :     return pimpl->GetTopoDesc(topoDescs, topoSize);
     371              : }
     372              : 
     373            0 : HcclResult HcclCommunicator::GetDevType(DevType& devType)
     374              : {
     375            0 :     devType = pimpl->GetDevType();
     376            0 :     HCCL_INFO("HcclCommunicator::GetDevTyp, devtype is %s", devType.Describe().c_str());
     377            0 :     return HcclResult::HCCL_SUCCESS;
     378              : }
     379              : 
     380            1 : HcclResult HcclCommunicator::SetGlobalWorkSpace() const
     381              : {
     382            3 :     HCCL_WARNING("set global work space not support at A5");
     383            1 :     return HCCL_SUCCESS;
     384              : }
     385              : 
     386              : HcclResult
     387           57 : HcclCommunicator::ExecAlgSelect(const CollOpParams& opParams, int32_t aivCoreLimit, bool& ifAiv, std::string& algName)
     388              : {
     389           57 :     return pimpl->HcomSelectAlg(opParams, aivCoreLimit, ifAiv, algName);
     390              : }
     391              : 
     392            1 : HcclResult HcclCommunicator::GetRankGraphV2(void*& rankGraph)
     393              : {
     394            1 :     CHK_SMART_PTR_NULL(pimpl);
     395            1 :     shared_ptr<RankGraph> rankGraphShPtr = pimpl->GetRankGraph();
     396            1 :     CHK_SMART_PTR_NULL(rankGraphShPtr);
     397            1 :     rankGraph = static_cast<void*>(rankGraphShPtr.get());
     398            1 :     return HCCL_SUCCESS;
     399            1 : }
     400              : 
     401            2 : HcclResult HcclCommunicator::CreateBarrierMemory(void*& sendBuf, void*& recvBuf, uint64_t count)
     402              : {
     403            2 :     return pimpl->CreateBarrierMemory(sendBuf, recvBuf, count);
     404              : }
     405              : 
     406            1 : HcclResult HcclCommunicator::SetAivClearEnable(bool aivClearEnable)
     407              : {
     408            1 :     pimpl->SetAivClearEnable(aivClearEnable);
     409            1 :     return HCCL_SUCCESS;
     410              : }
     411              : 
     412            1 : HcclResult HcclCommunicator::SetAivCoreLimit(u32 newAivCoreLimit)
     413              : {
     414            1 :     pimpl->SetAivCoreLimit(newAivCoreLimit);
     415            1 :     return HCCL_SUCCESS;
     416              : }
     417              : 
     418            0 : HcclResult HcclCommunicator::GetNetLayers(uint32_t** netLayers, uint32_t* netLayerNum)
     419              : {
     420            0 :     return pimpl->GetNetLayers(netLayers, netLayerNum);
     421              : }
     422              : 
     423            0 : HcclResult HcclCommunicator::GetInstSizeByNetLayer(uint32_t netLayer, uint32_t* rankNum)
     424              : {
     425            0 :     return pimpl->GetInstSizeByNetLayer(netLayer, rankNum);
     426              : }
     427              : 
     428            0 : HcclResult HcclCommunicator::GetConfigInCCLbufferSize(uint64_t* cclBufSize)
     429              : {
     430            0 :     *cclBufSize = static_cast<uint64_t>(pimpl->GetBufferSize());
     431            0 :     return HCCL_SUCCESS;
     432              : }
     433            0 : HcclResult HcclCommunicator::GetKFCWorkSpace(const char* memTag, uint64_t* size, void** addr, bool* newCreated)
     434              : {
     435            0 :     HCCL_INFO("HcclCommunicator::GetKFCWorkSpace start");
     436            0 :     CHK_RET(pimpl->CreateWorkspaceBuf(memTag, size, newCreated));
     437            0 :     shared_ptr<DevBuffer> buff = pimpl->GetKFCWorkSpace(memTag);
     438            0 :     *addr = reinterpret_cast<void*>(buff.get()->GetAddr());
     439            0 :     if (*size != static_cast<uint64_t>(buff.get()->GetSize())) {
     440            0 :         HCCL_ERROR(
     441              :             "HcclCommunicator::GetKFCWorkSpace, The size of mem is non-consistent. [%u->%u]", *size,
     442              :             buff.get()->GetSize());
     443            0 :         return HCCL_E_PARA;
     444              :     }
     445            0 :     return HcclResult::HCCL_SUCCESS;
     446            0 : }
     447              : 
     448            2 : HcclResult HcclCommunicator::GetInstRanksByNetLayer(uint32_t netLayer, uint32_t** ranks, uint32_t* rankNum)
     449              : {
     450            2 :     return pimpl->GetInstRanksByNetLayer(netLayer, ranks, rankNum);
     451              : }
     452              : 
     453            2 : HcclResult HcclCommunicator::GetInstTopoTypeByNetLayer(uint32_t netLayer, uint32_t* topoType)
     454              : {
     455            2 :     return pimpl->GetInstTopoTypeByNetLayer(netLayer, topoType);
     456              : }
     457              : 
     458            4 : HcclResult HcclCommunicator::GetInstSizeListByNetLayer(uint32_t netLayer, uint32_t** instSizeList, uint32_t* listSize)
     459              : {
     460            4 :     return pimpl->GetInstSizeListByNetLayer(netLayer, instSizeList, listSize);
     461              : }
     462              : 
     463            2 : HcclResult HcclCommunicator::GetLinks(
     464              :     uint32_t netLayer, uint32_t srcRank, uint32_t dstRank, CommLink** linkList, uint32_t* listSize)
     465              : {
     466            2 :     return pimpl->GetLinks(netLayer, srcRank, dstRank, linkList, listSize);
     467              : }
     468              : 
     469            2 : HcclResult HcclCommunicator::GetTopoInstsByLayer(uint32_t netLayer, uint32_t** topoInsts, uint32_t* topoInstNum)
     470              : {
     471            2 :     return pimpl->GetTopoInstsByLayer(netLayer, topoInsts, topoInstNum);
     472              : }
     473              : 
     474            2 : HcclResult HcclCommunicator::GetTopoType(uint32_t netLayer, uint32_t topoInstId, CommTopo* topoType)
     475              : {
     476            2 :     return pimpl->GetTopoType(netLayer, topoInstId, topoType);
     477              : }
     478              : 
     479              : HcclResult
     480            2 : HcclCommunicator::GetRanksByTopoInst(uint32_t netLayer, uint32_t topoInstId, uint32_t** ranks, uint32_t* rankNum)
     481              : {
     482            2 :     return pimpl->GetRanksByTopoInst(netLayer, topoInstId, ranks, rankNum);
     483              : }
     484              : 
     485            1 : HcclResult HcclCommunicator::CalcNumBlocks(
     486              :     const CollOpParams& opParams, int32_t aivCoreLimit, std::string& algName, u32& numBlocks)
     487              : {
     488            1 :     return pimpl->CalcNumBlocks(opParams, aivCoreLimit, algName, numBlocks);
     489              : }
     490              : 
     491            1 : HcclResult HcclCommunicator::GetAlgExecParam(
     492              :     const CollOpParams& opParams, bool clearEnable, void*& commContext, u64& len, u32 aivCoreLimit)
     493              : {
     494            1 :     return pimpl->GetAlgExecParam(opParams, clearEnable, commContext, len, aivCoreLimit);
     495              : }
     496              : 
     497            1 : HcclResult HcclCommunicator::ClearOpResource(const std::string& opTag) { return pimpl->ClearOpResource(opTag); }
     498              : 
     499          284 : u32 HcclCommunicator::GetDeviceLogicId() const { return pimpl->GetDeviceLogicId(); }
     500              : 
     501            2 : HcclResult HcclCommunicator::GetEndpointNum(uint32_t layer, uint32_t topoInstId, uint32_t* num)
     502              : {
     503            2 :     return pimpl->GetEndpointNum(layer, topoInstId, num);
     504              : }
     505              : 
     506              : HcclResult
     507            3 : HcclCommunicator::GetEndpointDesc(uint32_t layer, uint32_t topoInstId, uint32_t* descNum, EndpointDesc* endpointDesc)
     508              : {
     509            3 :     return pimpl->GetEndpointDesc(layer, topoInstId, descNum, endpointDesc);
     510              : }
     511              : 
     512            1 : HcclResult HcclCommunicator::GetEndpointInfo(
     513              :     uint32_t rankId, const EndpointDesc* endpointDesc, EndpointAttr endpointAttr, uint32_t infoLen, void* info)
     514              : {
     515            1 :     return pimpl->GetEndpointInfo(rankId, endpointDesc, endpointAttr, infoLen, info);
     516              : }
     517              : 
     518           28 : Trace& HcclCommunicator::GetTrace() const { return pimpl->GetTrace(); }
     519              : 
     520            0 : u32 HcclCommunicator::GetRankInParentComm() { return pimpl->GetRankInParentComm(); }
     521              : 
     522            0 : HcclResult HcclCommunicator::Mc2AiCpuStreamAllocAndGetV2(rtStream_t* aiCpuStream)
     523              : {
     524            0 :     return pimpl->Mc2AiCpuStreamAllocAndGetV2(aiCpuStream);
     525              : }
     526              : 
     527            4 : HcclResult HcclCommunicator::GetStreamId(u32& streamId)
     528              : {
     529            4 :     streamId = pimpl->GetDpuStreamId();
     530            4 :     return HCCL_SUCCESS;
     531              : }
     532              : 
     533            0 : HcclResult HcclCommunicator::GetRankIpPortMap(RankIpPortMapPtr& rankIpPortMap)
     534              : {
     535            0 :     CHK_RET(pimpl->GetRankIpPortMap(rankIpPortMap));
     536            0 :     return HCCL_SUCCESS;
     537              : }
     538              : 
     539              : } // namespace Hccl
        

Generated by: LCOV version 2.0-1