LCOV - code coverage report
Current view: top level - base_comm/resources/endpoint_pairs/channels/aicpu - aicpu_ts_urma_channel.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 28.2 % 234 66
Test Date: 2026-08-25 19:18:03 Functions: 33.3 % 27 9

            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 "aicpu_ts_urma_channel.h"
      12              : #include "endpoint.h"
      13              : #include "orion_adpt_utils.h"
      14              : #include "hcomm_c_adpt.h"
      15              : #include "config_log.h"
      16              : #include "hcomm_res_mgr.h"
      17              : #include "endpoint.h"
      18              : 
      19              : // Orion
      20              : #include "adapter_rts_common.h"
      21              : #include "topo_common_types.h"
      22              : #include "virtual_topo.h"
      23              : #include "aicpu_res_package_helper.h"
      24              : #include "makebufs_helper.h"
      25              : 
      26              : namespace hcomm {
      27              : constexpr uint16_t DEFAULT_LISTENING_PORT = 60001;
      28              : 
      29           10 : AicpuTsUrmaChannel::AicpuTsUrmaChannel(EndpointHandle endpointHandle, const HcommChannelDesc& channelDesc)
      30           10 :     : endpointHandle_(endpointHandle),
      31           10 :       channelDesc_(channelDesc)
      32           10 : {}
      33              : 
      34           11 : AicpuTsUrmaChannel::~AicpuTsUrmaChannel()
      35              : {
      36           10 :     if (channelDesc_.socket == nullptr && socket_ != nullptr) {
      37            0 :         SocketMgr::GetInstance(devicePhyId_).PutSocket(socketConfig_, socket_);
      38            0 :         socket_ = nullptr;
      39              :     }
      40           11 : }
      41              : 
      42            3 : HcclResult AicpuTsUrmaChannel::ParseInputParam()
      43              : {
      44              :     // 1. 从 endpointHandle_,获得 localEp_ 和 rdmaHandle_
      45              :     // TODO: 使用 HcommEndpointGet
      46            3 :     Endpoint* localEpPtr = reinterpret_cast<Endpoint*>(endpointHandle_);
      47            3 :     CHK_PTR_NULL(localEpPtr);
      48            3 :     localEp_ = localEpPtr->GetEndpointDesc();
      49            3 :     rdmaHandle_ = localEpPtr->GetRdmaHandle();
      50              : 
      51            3 :     HCCL_INFO("[AicpuTsUrmaChannel][%s] localProtocol[%d]", __func__, localEp_.protocol);
      52              : 
      53              :     // 2. 从 channelDesc_,获得 remoteEp_, socket_ 和 notifyNum
      54            3 :     remoteEp_ = channelDesc_.remoteEndpoint;
      55            3 :     socket_ = reinterpret_cast<Hccl::Socket*>(channelDesc_.socket);
      56            3 :     notifyNum_ = channelDesc_.notifyNum;
      57            3 :     commonRes_.bufferVec.clear();
      58              : 
      59            3 :     if (channelDesc_.exchangeAllMems) {
      60              :         // 3. Get memHandles from endpoint
      61            2 :         HCCL_INFO("[AicpuTsUrmaChannel][%s] exchangeAllMems == True. Get memHandles from endpoint.", __func__);
      62            2 :         std::shared_ptr<Hccl::LocalUbRmaBuffer>* memHandles = nullptr;
      63            2 :         uint32_t memHandleNum = 0;
      64            3 :         CHK_RET(static_cast<HcclResult>(
      65              :             HcommMemGetAllMemHandles(endpointHandle_, reinterpret_cast<void**>(&memHandles), &memHandleNum)));
      66            2 :         HCCL_INFO("[AicpuTsUrmaChannel][%s] Got memHandleNum[%u].", __func__, memHandleNum);
      67            3 :         for (uint32_t i = 0; i < memHandleNum; ++i) {
      68            2 :             std::shared_ptr<Hccl::LocalUbRmaBuffer>& localUbRmaBuffer = memHandles[i];
      69            2 :             CHK_SMART_PTR_NULL(localUbRmaBuffer);
      70            1 :             Hccl::Buffer* buf = localUbRmaBuffer->GetBuf();
      71            1 :             CHK_PTR_NULL(buf);
      72            1 :             HCCL_INFO(
      73              :                 "[AicpuTsUrmaChannel][%s] Got memHandle No.%u: addr[0x%llx], size[0x%llx], type[%d], memInfo[%s].",
      74              :                 __func__, i, static_cast<unsigned long long>(localUbRmaBuffer->GetAddr()),
      75              :                 static_cast<unsigned long long>(localUbRmaBuffer->GetSize()), static_cast<int>(buf->GetMemType()),
      76              :                 buf->GetMemInfo().c_str());
      77            1 :             commonRes_.bufferVec.push_back(localUbRmaBuffer.get());
      78              :         }
      79              :     } else {
      80              :         // 3. 从 channelDesc 的 memHandle,获得 bufs_
      81            1 :         HCCL_INFO("[AicpuTsUrmaChannel][%s] exchangeAllMems == false. Get memHandles from channelDesc.", __func__);
      82            1 :         CHK_RET(MakeRmaBufferVecFromMemHandles(
      83              :             channelDesc_.memHandles, channelDesc_.memHandleNum, commonRes_.bufferVec, "AicpuTsUrmaChannel"));
      84              :     }
      85              : 
      86            2 :     return HCCL_SUCCESS;
      87              : }
      88              : 
      89            0 : HcclResult AicpuTsUrmaChannel::BuildAttr()
      90              : {
      91            0 :     attr_.devicePhyId = localEp_.loc.device.devPhyId;
      92            0 :     attr_.opMode = Hccl::OpMode::OPBASE;
      93            0 :     return HCCL_SUCCESS;
      94              : }
      95              : 
      96            0 : HcclResult AicpuTsUrmaChannel::BuildConnection()
      97              : {
      98            0 :     UbConnBuildContext ctx;
      99            0 :     CHK_RET(PrepareUbConnBuildContext(localEp_, remoteEp_, channelDesc_, ctx));
     100              : 
     101            0 :     Hccl::OpMode opMode = Hccl::OpMode::OPBASE;
     102            0 :     bool devUsed = true; // aicpu 为 true
     103              :     // UB_CTP → HCOMM_TA_CTP_UB_TIMEOUT,UB_TP → HCOMM_TA_RTP_UB_TIMEOUT
     104            0 :     u8 taTimeOut = 0;
     105            0 :     uint32_t taTimeOutValue = 0;
     106            0 :     if (ctx.protocol == Hccl::LinkProtocol::UB_CTP) {
     107            0 :         CHK_RET(hcomm::HcommResMgr::GetInstance().GetConfigMgr().GetRdmaConfig().GetTaCtpUbTimeOut(taTimeOutValue));
     108              :     } else {
     109            0 :         CHK_RET(hcomm::HcommResMgr::GetInstance().GetConfigMgr().GetRdmaConfig().GetTaRtpUbTimeOut(taTimeOutValue));
     110              :     }
     111            0 :     taTimeOut = static_cast<u8>(taTimeOutValue);
     112            0 :     std::unique_ptr<Hccl::DevUbConnection> ubConn = nullptr;
     113            0 :     switch (ctx.protocol) {
     114            0 :         case Hccl::LinkProtocol::UB_TP:
     115            0 :             EXCEPTION_CATCH(
     116              :                 ubConn = std::make_unique<Hccl::DevUbTpConnection>(
     117              :                     rdmaHandle_, ctx.locAddr, ctx.rmtAddr, opMode, devUsed, Hccl::HrtUbJfcMode::STARS_POLL,
     118              :                     Hccl::IpAddress(), Hccl::IpAddress(), ctx.qosPre, taTimeOut, COMM_ENGINE_AICPU_TS, ctx.sqDepth),
     119              :                 return HCCL_E_PTR);
     120            0 :             break;
     121            0 :         case Hccl::LinkProtocol::UB_CTP:
     122            0 :             EXCEPTION_CATCH(
     123              :                 ubConn = std::make_unique<Hccl::DevUbCtpConnection>(
     124              :                     rdmaHandle_, ctx.locAddr, ctx.rmtAddr, opMode, devUsed, Hccl::HrtUbJfcMode::STARS_POLL,
     125              :                     Hccl::IpAddress(), Hccl::IpAddress(), ctx.qosPre, taTimeOut, COMM_ENGINE_AICPU_TS, ctx.sqDepth),
     126              :                 return HCCL_E_PTR);
     127            0 :             break;
     128            0 :         default:
     129            0 :             HCCL_ERROR("%s No LinkProtocol to match", __func__);
     130            0 :             break;
     131              :     }
     132            0 :     CHK_SMART_PTR_NULL(ubConn);
     133              : 
     134            0 :     if (devBaseAttr_.maxReadSize == 0 || devBaseAttr_.maxWriteSize == 0) {
     135            0 :         HCCL_ERROR(
     136              :             "%s maxReadSize[%u] or maxWriteSize[%u] must not be zero", __func__, devBaseAttr_.maxReadSize,
     137              :             devBaseAttr_.maxWriteSize);
     138            0 :         return HCCL_E_PARA;
     139              :     }
     140            0 :     ubConn->SetMaxReadSize(devBaseAttr_.maxReadSize);
     141            0 :     ubConn->SetMaxWriteSize(devBaseAttr_.maxWriteSize);
     142            0 :     HCCL_INFO("%s maxReadSize[%u], maxWriteSize[%u]", __func__, devBaseAttr_.maxReadSize, devBaseAttr_.maxWriteSize);
     143              : 
     144            0 :     commonRes_.connVec.clear();
     145            0 :     commonRes_.connVec.emplace_back(ubConn.get());
     146            0 :     connections_.clear();
     147            0 :     connections_.push_back(std::move(ubConn));
     148            0 :     return HCCL_SUCCESS;
     149            0 : }
     150              : 
     151            0 : HcclResult AicpuTsUrmaChannel::BuildNotify()
     152              : {
     153            0 :     localNotifies_.clear();
     154            0 :     commonRes_.notifyVec.clear();
     155            0 :     bool devUsed = true;
     156            0 :     for (uint32_t i = 0; i < notifyNum_; ++i) {
     157            0 :         std::unique_ptr<Hccl::UbLocalNotify> notifyPtr = nullptr;
     158            0 :         EXCEPTION_CATCH(notifyPtr = std::make_unique<Hccl::UbLocalNotify>(rdmaHandle_, devUsed), return HCCL_E_PTR);
     159            0 :         commonRes_.notifyVec.push_back(notifyPtr.get());
     160            0 :         localNotifies_.push_back(std::move(notifyPtr));
     161            0 :     }
     162            0 :     return HCCL_SUCCESS;
     163              : }
     164              : 
     165            0 : HcclResult AicpuTsUrmaChannel::BuildUbMemTransport()
     166              : {
     167            0 :     Hccl::BaseMemTransport::LocCntNotifyRes locCntNotifyRes{};
     168            0 :     locCntNotifyRes.vec.clear();
     169            0 :     locCntNotifyRes.desc.clear();
     170            0 :     const Hccl::Socket& socket = *socket_;
     171              : 
     172            0 :     Hccl::LinkData linkData = BuildDefaultLinkData();
     173            0 :     CHK_RET(EndpointDescPairToLinkData(localEp_, remoteEp_, linkData));
     174              : 
     175            0 :     bool isRecvFirst = socket.GetRole() == Hccl::SocketRole::CLIENT ? true : false;
     176              : 
     177              :     // make_unique / make_shared / release 包一层抛异常的宏
     178            0 :     EXCEPTION_CATCH(
     179              :         memTransport_ = std::make_unique<Hccl::UbMemTransport>(
     180              :             commonRes_, attr_, linkData, socket, rdmaHandle_, locCntNotifyRes, isRecvFirst),
     181              :         return HCCL_E_PTR);
     182            0 :     return HCCL_SUCCESS;
     183            0 : }
     184              : 
     185            0 : HcclResult AicpuTsUrmaChannel::BuildSocket()
     186              : {
     187            0 :     if (socket_ != nullptr) {
     188            0 :         return HCCL_SUCCESS;
     189              :     }
     190            0 :     HCCL_INFO("[AicpuTsUrmaChannel][%s] socket ptr is NULL, rebuildSocket", __func__);
     191            0 :     Hccl::IpAddress ipaddr{};
     192            0 :     CHK_RET(CommAddrToIpAddress(localEp_.commAddr, ipaddr));
     193            0 :     Hccl::DevNetPortType type = Hccl::DevNetPortType(Hccl::ConnectProtoType::UB);
     194            0 :     Hccl::PortData localPort = Hccl::PortData(static_cast<Hccl::RankId>(localEp_.loc.device.devPhyId), type, 0, ipaddr);
     195            0 :     if (channelDesc_.role == HCOMM_SOCKET_ROLE_RESERVED) {
     196              :         Hccl::SocketHandle socketHandle
     197            0 :             = Hccl::SocketHandleManager::GetInstance().Create(localEp_.loc.device.devPhyId, localPort);
     198            0 :         EXCEPTION_CATCH(
     199              :             serverSocket_ = std::make_unique<Hccl::Socket>(
     200              :                 socketHandle, ipaddr, DEFAULT_LISTENING_PORT, ipaddr, "server", Hccl::SocketRole::SERVER,
     201              :                 Hccl::NicType::DEVICE_NIC_TYPE),
     202              :             return HCCL_E_PARA);
     203            0 :         HCCL_INFO("[AicpuTsUrmaChannel][%s] listen_socket_info[%s]", __func__, serverSocket_->Describe().c_str());
     204            0 :         EXCEPTION_CATCH(serverSocket_->Listen(), return HCCL_E_INTERNAL);
     205            0 :         Hccl::LinkData linkData = BuildDefaultLinkData();
     206            0 :         CHK_RET(EndpointDescPairToLinkData(localEp_, remoteEp_, linkData));
     207            0 :         HCCL_INFO("[AicpuTsUrmaChannel][%s] built linkData: %s", __func__, linkData.Describe().c_str());
     208              :         std::string socketTag
     209            0 :             = (channelDesc_.channelName != nullptr) ? std::string(channelDesc_.channelName) : "AUTOMATIC_SOCKET_TAG";
     210            0 :         bool noRankId = true;
     211            0 :         Hccl::SocketConfig socketConfig = Hccl::SocketConfig(linkData, socketTag, noRankId);
     212            0 :         CHK_RET(SocketMgr::GetInstance(devicePhyId_).GetSocket(socketConfig, socket_));
     213            0 :         socketConfigHolder_ = std::make_unique<Hccl::SocketConfig>(socketConfig);
     214            0 :         socketConfig_ = socketConfigHolder_.get();
     215            0 :     } else {
     216            0 :         uint16_t port = channelDesc_.port;
     217            0 :         if (port == 0) {
     218            0 :             port = DEFAULT_LISTENING_PORT;
     219            0 :             HCCL_INFO("[AicpuTsUrmaChannel::%s] channelDesc port is 0, use default port [%u]", __func__, port);
     220              :         }
     221            0 :         Hccl::LinkData linkData = BuildDefaultLinkData();
     222            0 :         CHK_RET(EndpointDescPairToLinkData(localEp_, remoteEp_, linkData));
     223            0 :         HCCL_INFO("[AicpuTsUrmaChannel][%s] built linkData: %s", __func__, linkData.Describe().c_str());
     224              :         std::string socketTag
     225            0 :             = (channelDesc_.channelName != nullptr) ? std::string(channelDesc_.channelName) : "AUTOMATIC_SOCKET_TAG";
     226            0 :         bool isServer = (channelDesc_.role == HCOMM_SOCKET_ROLE_SERVER);
     227            0 :         Hccl::SocketConfig socketConfig = Hccl::SocketConfig(linkData, port, socketTag, isServer);
     228            0 :         CHK_RET(SocketMgr::GetInstance(devicePhyId_).GetSocket(socketConfig, socket_));
     229            0 :         socketConfigHolder_ = std::make_unique<Hccl::SocketConfig>(socketConfig);
     230            0 :         socketConfig_ = socketConfigHolder_.get();
     231            0 :     }
     232            0 :     return HCCL_SUCCESS;
     233              : }
     234              : 
     235            0 : HcclResult AicpuTsUrmaChannel::Init()
     236              : {
     237              :     /*
     238              :         Argue result: make_unique 配合一场捕获的宏 EXCEPTION CATCH
     239              :         Attention: const 和引用
     240              :     */
     241              :     // TODO: 处理抛异常
     242              :     s32 devLogicId;
     243            0 :     CHK_RET(ParseInputParam());
     244            0 :     CHK_RET(hrtGetDevice(&devLogicId));
     245            0 :     CHK_RET(hrtGetDevicePhyIdByIndex(static_cast<u32>(devLogicId), devicePhyId_));
     246            0 :     CHK_RET(StartListen());
     247            0 :     CHK_RET(BuildSocket());
     248            0 :     CHK_RET(BuildAttr());
     249              :     /*
     250              :         HccpRaGetDevBaseAttr
     251              :         获取urma read/write 单个wr的最大传输数据大小
     252              :         调用前,rdmaHandle_要在ParseInputParam中被赋值好,之后BuildConnection会使用获取的属性
     253              :     */
     254            0 :     CHK_RET(HccpRaGetDevBaseAttr(rdmaHandle_, &devBaseAttr_));
     255            0 :     CHK_RET(BuildConnection());
     256            0 :     CHK_RET(BuildNotify());
     257            0 :     CHK_RET(BuildUbMemTransport());
     258              : 
     259            0 :     return HCCL_SUCCESS;
     260              : }
     261              : 
     262            0 : HcclResult AicpuTsUrmaChannel::GetNotifyNum(uint32_t* notifyNum) const
     263              : {
     264            0 :     *notifyNum = this->notifyNum_;
     265            0 :     return HCCL_SUCCESS;
     266              : }
     267              : 
     268            0 : HcclResult AicpuTsUrmaChannel::GetRemoteMems(uint32_t* memNum, CommMem** remoteMem, char*** memInfos)
     269              : {
     270            0 :     return memTransport_->GetRemoteMems(memNum, remoteMem, memInfos);
     271              : }
     272              : 
     273            2 : ChannelStatus AicpuTsUrmaChannel::GetStatus()
     274              : {
     275            2 :     ChannelStatus out = Channel::TransportStatusToChannelStatus(memTransport_->GetStatus());
     276              : 
     277            2 :     if (isFirstPrintChannelInfo_ && out == ChannelStatus::READY) {
     278            2 :         std::string channelInfo = "create channel info:channel handle[";
     279            2 :         channelInfo.append(std::to_string(reinterpret_cast<uint64_t>(this)));
     280            2 :         channelInfo.append("] ");
     281            2 :         HcclResult ret = memTransport_->Describe(channelInfo);
     282            2 :         if (ret != HCCL_SUCCESS) {
     283            1 :             HCCL_ERROR("[AicpuTsUrmaChannel][%s] Describe channel info failed, ret=%d", __func__, ret);
     284            1 :             out = ChannelStatus::FAILED;
     285              :         } else {
     286            1 :             channelInfo.append(" TA[RM]"); // 目前TA只支持RM
     287            1 :             HCCL_CONFIG_DEBUG(hccl::HCCL_RES, "%s", channelInfo.c_str());
     288              :         }
     289            2 :         isFirstPrintChannelInfo_ = false;
     290            2 :     }
     291            2 :     return out;
     292              : }
     293              : 
     294            0 : HcclResult SetModuleDataName(Hccl::ModuleData& module, const std::string& name)
     295              : {
     296            0 :     int ret = strcpy_s(module.name, sizeof(module.name), name.c_str());
     297            0 :     if (ret != 0) {
     298            0 :         HCCL_ERROR("[SetModuleDataName] strcpy_s name %s failed", name.c_str());
     299            0 :         return HCCL_E_INTERNAL;
     300              :     }
     301              : 
     302            0 :     return HCCL_SUCCESS;
     303              : }
     304              : 
     305            0 : HcclResult AicpuTsUrmaChannel::PackOpData(std::vector<char>& data)
     306              : {
     307            0 :     std::vector<Hccl::ModuleData> dataVec;
     308            0 :     dataVec.resize(Hccl::AicpuResMgrType::__COUNT__);
     309              : 
     310            0 :     Hccl::AicpuResMgrType resType = Hccl::AicpuResMgrType::STREAM;
     311            0 :     CHK_RET(SetModuleDataName(dataVec[resType], "UbMemTransport"));
     312              : 
     313            0 :     std::vector<char> result;
     314            0 :     Hccl::BinaryStream binaryStream;
     315            0 :     binaryStream << memTransport_->GetUniqueIdV2();
     316              : 
     317            0 :     binaryStream.Dump(result);
     318              : 
     319            0 :     dataVec[resType].data = result;
     320              : 
     321              :     Hccl::AicpuResPackageHelper helper;
     322            0 :     data = helper.GetPackedData(dataVec);
     323              : 
     324            0 :     return HCCL_SUCCESS;
     325            0 : }
     326              : 
     327            0 : HcclResult AicpuTsUrmaChannel::H2DResPack(std::vector<char>& buffer)
     328              : {
     329            0 :     CHK_RET(PackOpData(buffer));
     330            0 :     HCCL_INFO(
     331              :         "[AicpuTsUrmaChannel][%s] Pack Buffer data[%p], Pack Buffer size[%zu].", __func__, buffer.data(),
     332              :         buffer.size());
     333            0 :     return HCCL_SUCCESS;
     334              : }
     335              : 
     336            1 : HcclResult AicpuTsUrmaChannel::Clean()
     337              : {
     338            1 :     memTransport_.reset();
     339            1 :     return HCCL_SUCCESS;
     340              : }
     341              : 
     342            1 : HcclResult AicpuTsUrmaChannel::Resume()
     343              : {
     344            1 :     BuildSocket();
     345            1 :     BuildConnection();
     346            1 :     BuildUbMemTransport();
     347            1 :     return HCCL_SUCCESS;
     348              : }
     349              : 
     350            2 : HcclResult AicpuTsUrmaChannel::UpdateMemInfo(HcommMemHandle* memHandles, uint32_t memHandleNum)
     351              : {
     352            2 :     std::vector<Hccl::LocalRmaBuffer*> bufferVecTemp;
     353            2 :     CHK_RET(MakeRmaBufferVecFromMemHandles(memHandles, memHandleNum, bufferVecTemp, "AicpuTsUrmaChannel"));
     354            1 :     CHK_RET(memTransport_->UpdateMemInfo(bufferVecTemp));
     355            1 :     commonRes_.bufferVec.insert(commonRes_.bufferVec.end(), bufferVecTemp.begin(), bufferVecTemp.end());
     356            1 :     return HCCL_SUCCESS;
     357            2 : }
     358              : 
     359              : // 返回当前 channel 类型,供上层区分不同 channel 的能力和行为
     360            0 : HcommChannelKind AicpuTsUrmaChannel::GetChannelKind() const { return HcommChannelKind::AICPU_TS_URMA; }
     361              : 
     362            0 : HcclResult AicpuTsUrmaChannel::NotifyRecord([[maybe_unused]] const uint32_t remoteNotifyIdx)
     363              : {
     364            0 :     HCCL_INFO("[AicpuTsUrmaChannel::%s] not supported yet.", __func__);
     365            0 :     return HCCL_E_NOT_SUPPORT;
     366              : }
     367              : 
     368              : HcclResult
     369            0 : AicpuTsUrmaChannel::NotifyWait([[maybe_unused]] const uint32_t localNotifyIdx, [[maybe_unused]] const uint32_t timeout)
     370              : {
     371            0 :     HCCL_INFO("[AicpuTsUrmaChannel::%s] not supported yet.", __func__);
     372            0 :     return HCCL_E_NOT_SUPPORT;
     373              : }
     374              : 
     375            0 : HcclResult AicpuTsUrmaChannel::WriteWithNotify(
     376              :     [[maybe_unused]] void* dst, [[maybe_unused]] const void* src, [[maybe_unused]] const uint64_t len,
     377              :     [[maybe_unused]] uint32_t remoteNotifyIdx)
     378              : {
     379            0 :     HCCL_INFO("[AicpuTsUrmaChannel::%s] not supported yet.", __func__);
     380            0 :     return HCCL_E_NOT_SUPPORT;
     381              : }
     382              : 
     383              : HcclResult
     384            0 : AicpuTsUrmaChannel::Write([[maybe_unused]] void* dst, [[maybe_unused]] const void* src, [[maybe_unused]] uint64_t len)
     385              : {
     386            0 :     HCCL_INFO("[AicpuTsUrmaChannel::%s] not supported yet.", __func__);
     387            0 :     return HCCL_E_NOT_SUPPORT;
     388              : }
     389              : 
     390              : HcclResult
     391            0 : AicpuTsUrmaChannel::Read([[maybe_unused]] void* dst, [[maybe_unused]] const void* src, [[maybe_unused]] uint64_t len)
     392              : {
     393            0 :     HCCL_INFO("[AicpuTsUrmaChannel::%s] not supported yet.", __func__);
     394            0 :     return HCCL_E_NOT_SUPPORT;
     395              : }
     396              : 
     397            0 : HcclResult AicpuTsUrmaChannel::ChannelFence()
     398              : {
     399            0 :     HCCL_INFO("[AicpuTsUrmaChannel::%s] not supported yet.", __func__);
     400            0 :     return HCCL_E_NOT_SUPPORT;
     401              : }
     402              : 
     403            1 : HcclResult AicpuTsUrmaChannel::StartListen()
     404              : {
     405            1 :     if (channelDesc_.role != HCOMM_SOCKET_ROLE_SERVER) {
     406            1 :         return HCCL_SUCCESS;
     407              :     }
     408              : 
     409            0 :     uint16_t port = channelDesc_.port;
     410            0 :     HCCL_INFO(
     411              :         "[AicpuTsUrmaChannel::%s] Start. EndpointHandle[0x%llx], port[%u]", __func__,
     412              :         reinterpret_cast<uint64_t>(endpointHandle_), port);
     413            0 :     if (port == 0) {
     414            0 :         port = DEFAULT_LISTENING_PORT;
     415            0 :         HCCL_INFO("[AicpuTsUrmaChannel::%s] channelDesc port is 0, use default port [%u]", __func__, port);
     416              :     }
     417            0 :     CHK_RET(static_cast<HcclResult>(HcommEndpointStartListen(endpointHandle_, port, nullptr)));
     418            0 :     HCCL_INFO("[AicpuTsUrmaChannel::%s] SUCCESS. port[%u].", __func__, port);
     419            0 :     return HCCL_SUCCESS;
     420              : }
     421              : 
     422              : } // namespace hcomm
        

Generated by: LCOV version 2.0-1