LCOV - code coverage report
Current view: top level - base_comm/resources/endpoint_pairs/channels/host - host_cpu_urma_channel.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 1 0
Test Date: 2026-08-17 10:19:35 Functions: 0.0 % 1 0

            Line data    Source code
       1              : /**
       2              :  * Copyright (c) 2026 Huawei Technologies Co., Ltd.
       3              :  * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
       4              :  * CANN Open Software License Agreement Version 2.0 (the "License").
       5              :  * Please refer to the License for details. You may not use this file except in compliance with the License.
       6              :  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
       7              :  * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
       8              :  * See LICENSE in the root of the software repository for the full text of the License.
       9              :  */
      10              : #ifndef HOST_CPU_URMA_CHANNEL_H
      11              : #define HOST_CPU_URMA_CHANNEL_H
      12              : 
      13              : #include "../channel.h"
      14              : #include <mutex>
      15              : #include "urma_types.h"
      16              : 
      17              : // Orion
      18              : #include "../../../../../../src/legacy/ascend950/unified_platform/resource/socket/socket.h"
      19              : #include "../../sockets/socket_mgr.h"
      20              : #include "ub_mem_transport.h"
      21              : #include "host_ub_connection.h"
      22              : #include "ub_local_notify.h"
      23              : #include "aicpu_res_package_helper.h"
      24              : #include "hcomm_adapter_hccp.h"
      25              : 
      26              : namespace hcomm {
      27              : 
      28              : class HostCpuUrmaChannel : public Channel {
      29              : public:
      30              :     HostCpuUrmaChannel(EndpointHandle endpointHandle, const HcommChannelDesc& channelDesc);
      31              :     ~HostCpuUrmaChannel() override;
      32              : 
      33              :     HcclResult Init() override;
      34              :     HcclResult GetNotifyNum(uint32_t* notifyNum) const override;
      35              :     HcclResult GetRemoteMems(uint32_t* memNum, CommMem** remoteMem, char*** memInfos) override;
      36              :     ChannelStatus GetStatus() override;
      37            0 :     const HcommChannelDesc& GetChannelDesc() const override { return channelDesc_; }
      38              : 
      39              :     // 数据面接口
      40              :     HcclResult NotifyRecord(const uint32_t remoteNotifyIdx) override;
      41              :     HcclResult NotifyWait(const uint32_t localNotifyIdx, const uint32_t timeout) override;
      42              :     HcclResult WriteWithNotify(void* dst, const void* src, const uint64_t len, uint32_t remoteNotifyIdx) override;
      43              :     HcclResult Write(void* dst, const void* src, uint64_t len) override;
      44              :     HcclResult Read(void* dst, const void* src, uint64_t len) override;
      45              :     HcclResult ChannelFence() override;
      46              : 
      47              :     HcclResult Clean() override;
      48              :     HcclResult Resume() override;
      49              : 
      50              : private:
      51              :     HcclResult ParseInputParam();
      52              :     HcclResult StartListen();
      53              :     HcclResult BuildSocket();
      54              :     HcclResult BuildConnection();
      55              :     HcclResult BuildUbMemTransport();
      56              :     HcclResult GetLocSeg(const void* addr, const size_t size, u64* seg);
      57              :     HcclResult UrmaPostJettySendWr(urma_opcode_t opcode, void* dst, const void* src, uint64_t len);
      58              :     HcclResult GetSplitNum(uint64_t len, uint64_t maxJettyWrDataLen, uint64_t& splitNum);
      59              :     HcclResult
      60              :     GetLocalAndRemoteSeg(urma_opcode_t opcode, void* dst, const void* src, uint64_t len, u64& localSeg, u64& remoteSeg);
      61              : 
      62              : private:
      63              :     // --------------------- 入参 ---------------------
      64              :     EndpointHandle endpointHandle_;
      65              :     HcommChannelDesc channelDesc_;
      66              : 
      67              :     // --------------------- 转换参数 ---------------------
      68              :     EndpointDesc localEp_{};
      69              :     EndpointDesc remoteEp_{};
      70              : 
      71              :     // --------------------- 具体成员 ---------------------
      72              :     Hccl::Socket* socket_{nullptr};
      73              :     const Hccl::SocketConfig* socketConfig_{nullptr};
      74              :     RdmaHandle rdmaHandle_{nullptr};
      75              :     std::unique_ptr<Hccl::UbMemTransport> memTransport_{nullptr};
      76              :     Hccl::BaseMemTransport::Attribution attr_{};
      77              :     Hccl::BaseMemTransport::CommonLocRes commonRes_{};
      78              :     std::vector<std::unique_ptr<Hccl::HostUbConnection>> connections_{};
      79              :     std::unique_ptr<Hccl::Socket> serverSocket_{nullptr};
      80              : 
      81              :     urma_jfc_t jfc_{};
      82              :     urma_jetty_t jetty_{};
      83              :     urma_target_jetty_t tjetty_{};
      84              :     uint32_t wqeNum_{0};
      85              :     bool fenceFlag_{false};
      86              : 
      87              :     std::mutex jfcMutex_;
      88              :     std::mutex fenceMutex_;
      89              :     bool Onetime_{false};
      90              :     DevBaseAttr devBaseAttr_{};
      91              :     uint32_t devicePhyId_{};
      92              : };
      93              : 
      94              : } // namespace hcomm
      95              : 
      96              : #endif // HOST_CPU_URMA_CHANNEL_H
        

Generated by: LCOV version 2.0-1