LCOV - code coverage report
Current view: top level - base_comm/resources/endpoint_pairs/channels/aiv - aiv_ub_mem_channel.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 17.4 % 46 8
Test Date: 2026-08-18 17:47:01 Functions: 18.8 % 16 3

            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 "aiv_ub_mem_channel.h"
      12              : 
      13              : namespace hcomm {
      14              : 
      15            3 : AivUbMemChannel::AivUbMemChannel(EndpointHandle endpointHandle, const HcommChannelDesc& channelDesc)
      16            3 :     : endpointHandle_(endpointHandle),
      17            3 :       channelDesc_(channelDesc)
      18            3 : {}
      19              : 
      20            0 : HcclResult AivUbMemChannel::ParseInputParam()
      21              : {
      22            0 :     socket_ = reinterpret_cast<Hccl::Socket*>(channelDesc_.socket);
      23            0 :     return HCCL_SUCCESS;
      24              : }
      25              : 
      26            0 : HcclResult AivUbMemChannel::BuildTransport()
      27              : {
      28            0 :     EXCEPTION_CATCH(transport_ = std::make_unique<AivUbMemTransport>(socket_, channelDesc_), return HCCL_E_PTR);
      29            0 :     CHK_PTR_NULL(transport_);
      30            0 :     CHK_RET(transport_->Init());
      31            0 :     return HCCL_SUCCESS;
      32              : }
      33              : 
      34            0 : HcclResult AivUbMemChannel::Init()
      35              : {
      36              :     // TODO: 处理抛异常
      37            0 :     CHK_RET(ParseInputParam());
      38            0 :     CHK_RET(BuildTransport());
      39            0 :     return HCCL_SUCCESS;
      40              : }
      41              : 
      42            0 : ChannelStatus AivUbMemChannel::GetStatus() { return Channel::TransportStatusToChannelStatus(transport_->GetStatus()); }
      43              : 
      44            0 : HcclResult AivUbMemChannel::GetNotifyNum([[maybe_unused]] uint32_t* notifyNum) const
      45              : {
      46            0 :     HCCL_INFO("AivUbMemChannel GetNotifyNum is not supported.");
      47            0 :     return HCCL_SUCCESS;
      48              : }
      49              : 
      50            0 : HcclResult AivUbMemChannel::GetRemoteMems(uint32_t* memNum, CommMem** remoteMem, char*** memInfos)
      51              : {
      52            0 :     return transport_->GetRemoteMems(memNum, remoteMem, memInfos);
      53              : }
      54              : 
      55            0 : HcclResult AivUbMemChannel::UpdateMemInfo(HcommMemHandle* memHandles, uint32_t memHandleNum)
      56              : {
      57            0 :     return transport_->UpdateMemInfo(memHandles, memHandleNum);
      58              : }
      59              : 
      60            2 : HcclResult AivUbMemChannel::Clean()
      61              : {
      62              :     // 该模式当前不支持N秒快恢
      63            2 :     return HCCL_SUCCESS;
      64              : }
      65              : 
      66            2 : HcclResult AivUbMemChannel::Resume()
      67              : {
      68              :     // 该模式当前不支持N秒快恢
      69            2 :     return HCCL_SUCCESS;
      70              : }
      71              : 
      72            0 : HcclResult AivUbMemChannel::NotifyRecord([[maybe_unused]] const uint32_t remoteNotifyIdx)
      73              : {
      74            0 :     HCCL_INFO("[AivUbMemChannel::%s] not supported yet.", __func__);
      75            0 :     return HCCL_E_NOT_SUPPORT;
      76              : }
      77              : 
      78              : HcclResult
      79            0 : AivUbMemChannel::NotifyWait([[maybe_unused]] const uint32_t localNotifyIdx, [[maybe_unused]] const uint32_t timeout)
      80              : {
      81            0 :     HCCL_INFO("[AivUbMemChannel::%s] not supported yet.", __func__);
      82            0 :     return HCCL_E_NOT_SUPPORT;
      83              : }
      84              : 
      85            0 : HcclResult AivUbMemChannel::WriteWithNotify(
      86              :     [[maybe_unused]] void* dst, [[maybe_unused]] const void* src, [[maybe_unused]] const uint64_t len,
      87              :     [[maybe_unused]] uint32_t remoteNotifyIdx)
      88              : {
      89            0 :     HCCL_INFO("[AivUbMemChannel::%s] not supported yet.", __func__);
      90            0 :     return HCCL_E_NOT_SUPPORT;
      91              : }
      92              : 
      93              : HcclResult
      94            0 : AivUbMemChannel::Write([[maybe_unused]] void* dst, [[maybe_unused]] const void* src, [[maybe_unused]] uint64_t len)
      95              : {
      96            0 :     HCCL_INFO("[AivUbMemChannel::%s] not supported yet.", __func__);
      97            0 :     return HCCL_E_NOT_SUPPORT;
      98              : }
      99              : 
     100              : HcclResult
     101            0 : AivUbMemChannel::Read([[maybe_unused]] void* dst, [[maybe_unused]] const void* src, [[maybe_unused]] uint64_t len)
     102              : {
     103            0 :     HCCL_INFO("[AivUbMemChannel::%s] not supported yet.", __func__);
     104            0 :     return HCCL_E_NOT_SUPPORT;
     105              : }
     106              : 
     107            0 : HcclResult AivUbMemChannel::ChannelFence()
     108              : {
     109            0 :     HCCL_INFO("[AivUbMemChannel::%s] not supported yet.", __func__);
     110            0 :     return HCCL_E_NOT_SUPPORT;
     111              : }
     112              : } // namespace hcomm
        

Generated by: LCOV version 2.0-1