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-07-28 12:11:00 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 GetLocalAndRemoteSeg(urma_opcode_t opcode, void *dst, const void *src, uint64_t len, u64 &localSeg, u64 &remoteSeg);
      60              : 
      61              : private:
      62              :     // --------------------- 入参 ---------------------
      63              :     EndpointHandle                                              endpointHandle_;
      64              :     HcommChannelDesc                                            channelDesc_;
      65              : 
      66              :     // --------------------- 转换参数 ---------------------
      67              :     EndpointDesc                                                localEp_{};
      68              :     EndpointDesc                                                remoteEp_{};
      69              : 
      70              :     // --------------------- 具体成员 ---------------------
      71              :     Hccl::Socket*                                               socket_{nullptr};
      72              :     const Hccl::SocketConfig*                                   socketConfig_{nullptr};
      73              :     RdmaHandle                                                  rdmaHandle_{nullptr};
      74              :     std::unique_ptr<Hccl::UbMemTransport>                       memTransport_{nullptr};
      75              :     Hccl::BaseMemTransport::Attribution                         attr_{};
      76              :     Hccl::BaseMemTransport::CommonLocRes                        commonRes_{};
      77              :     std::vector<std::unique_ptr<Hccl::HostUbConnection>>        connections_{};
      78              :     std::unique_ptr<Hccl::Socket>                               serverSocket_{nullptr};
      79              : 
      80              :     urma_jfc_t jfc_{};
      81              :     urma_jetty_t jetty_{};
      82              :     urma_target_jetty_t tjetty_{};
      83              :     uint32_t wqeNum_{0};
      84              :     bool fenceFlag_{false};
      85              : 
      86              :     std::mutex jfcMutex_;
      87              :     std::mutex fenceMutex_;
      88              :     bool Onetime_{false};
      89              :     DevBaseAttr devBaseAttr_{};
      90              :     uint32_t devicePhyId_{};
      91              : };
      92              : 
      93              : } // namespace hcomm
      94              : 
      95              : #endif // HOST_CPU_URMA_CHANNEL_H
        

Generated by: LCOV version 2.0-1