LCOV - code coverage report
Current view: top level - base_comm/resources/endpoint_pairs/channels/aicpu - aicpu_ts_p2p_channel.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 2 0
Test Date: 2026-08-29 17:38:31 Functions: 0.0 % 2 0

            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              : #ifndef AICPU_TS_P2P_CHANNEL_H
      12              : #define AICPU_TS_P2P_CHANNEL_H
      13              : 
      14              : #include <cstdint>
      15              : #include <memory>
      16              : #include <string>
      17              : #include <vector>
      18              : 
      19              : #include "../channel.h"
      20              : #include "aicpu_ts_channel_helper.h"
      21              : #include "../../sockets/socket_mgr.h"
      22              : 
      23              : #include "../../../../../../legacy/ascend950/unified_platform/resource/socket/socket.h"
      24              : #include "../../../../../../src/legacy/ascend950/unified_platform/resource/buffer/local_ipc_rma_buffer_v2.h"
      25              : #include "p2p_transport.h"
      26              : #include "p2p_connection.h"
      27              : #include "ipc_local_notify.h"
      28              : #include "aicpu_res_package_helper.h"
      29              : 
      30              : namespace hcomm {
      31              : 
      32              : class AicpuTsP2pChannel : public Channel {
      33              : public:
      34              :     AicpuTsP2pChannel(EndpointHandle endpointHandle, const HcommChannelDesc& channelDesc);
      35              :     ~AicpuTsP2pChannel() override;
      36              : 
      37              :     HcclResult Init() override;
      38              :     HcclResult GetNotifyNum(uint32_t* notifyNum) const override;
      39              :     HcclResult GetRemoteMems(uint32_t* memNum, CommMem** remoteMem, char*** memInfos) override;
      40              :     ChannelStatus GetStatus() override;
      41              :     HcommChannelKind GetChannelKind() const override;
      42              :     HcclResult UpdateMemInfo(HcommMemHandle* memHandles, uint32_t memHandleNum) override;
      43            0 :     const HcommChannelDesc& GetChannelDesc() const override { return channelDesc_; }
      44              :     HcclResult H2DResPack(std::vector<char>& buffer);
      45              : 
      46              :     virtual HcclResult Clean() override;
      47              :     virtual HcclResult Resume() override;
      48              : 
      49              :     // 数据面接口
      50              :     HcclResult NotifyRecord(const uint32_t remoteNotifyIdx) override;
      51              :     HcclResult NotifyWait(const uint32_t localNotifyIdx, const uint32_t timeout) override;
      52              :     HcclResult WriteWithNotify(void* dst, const void* src, const uint64_t len, uint32_t remoteNotifyIdx) override;
      53              :     HcclResult Write(void* dst, const void* src, uint64_t len) override;
      54              :     HcclResult Read(void* dst, const void* src, uint64_t len) override;
      55              :     HcclResult ChannelFence() override;
      56              : 
      57            0 :     AicpuTsChannelHelper* GetAicpuTsHelper() override { return &aicpuTsHelper_; }
      58              : 
      59              : private:
      60              :     AicpuTsChannelHelper aicpuTsHelper_;
      61              :     HcclResult SetModuleDataName(Hccl::ModuleData& module, const std::string& name);
      62              :     HcclResult ParseInputParam();
      63              :     HcclResult BuildAttr();
      64              :     HcclResult BuildConnection();
      65              :     HcclResult BuildNotify();
      66              :     HcclResult BuildP2pMemTransport();
      67              :     HcclResult BuildSocket();
      68              : 
      69              :     HcclResult PackOpData(std::vector<char>& data);
      70              : 
      71              : private:
      72              :     EndpointHandle endpointHandle_;
      73              :     HcommChannelDesc channelDesc_;
      74              : 
      75              :     EndpointDesc localEp_{};
      76              :     EndpointDesc remoteEp_{};
      77              :     uint32_t notifyNum_{0};
      78              : 
      79              :     Hccl::Socket* socket_{nullptr};
      80              :     std::unique_ptr<Hccl::P2PTransport> memTransport_{nullptr};
      81              :     Hccl::BaseMemTransport::Attribution attr_{};
      82              :     Hccl::BaseMemTransport::CommonLocRes commonRes_{};
      83              :     std::vector<std::unique_ptr<Hccl::P2PConnection>> connections_{};
      84              :     std::vector<std::unique_ptr<Hccl::IpcLocalNotify>> localNotifies_{};
      85              :     std::unique_ptr<Hccl::Socket> serverSocket_;
      86              :     const Hccl::SocketConfig* socketConfig_{nullptr};
      87              :     uint32_t devicePhyId_{};
      88              : };
      89              : 
      90              : } // namespace hcomm
      91              : 
      92              : #endif // AICPU_TS_P2P_CHANNEL_H
        

Generated by: LCOV version 2.0-1