LCOV - code coverage report
Current view: top level - base_comm/resources/endpoint_pairs/channels/aiv - aiv_urma_channel.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 1 0
Test Date: 2026-08-18 17:47:01 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              : 
      11              : #ifndef AIV_URMA_CHANNEL_H
      12              : #define AIV_URMA_CHANNEL_H
      13              : 
      14              : #include "../channel.h"
      15              : 
      16              : // Orion
      17              : #include "aiv_urma_transport.h"
      18              : #include "buffer_key.h"
      19              : #include "resource/notify/ub_local_notify.h"
      20              : #include "resource/socket/socket.h"
      21              : #include "socket_mgr.h"
      22              : #include "hcomm_adapter_hccp.h"
      23              : 
      24              : namespace hcomm {
      25              : 
      26              : struct UbConnBuildContext;
      27              : 
      28              : class AivUrmaChannel : public Channel {
      29              : public:
      30              :     AivUrmaChannel(EndpointHandle endpointHandle, const HcommChannelDesc& channelDesc);
      31              :     ~AivUrmaChannel() override;
      32              : 
      33              :     HcclResult Init() override;
      34              :     ChannelStatus GetStatus() override;
      35              : 
      36              :     HcclResult Clean() override;
      37              :     HcclResult Resume() override;
      38              :     virtual HcclResult GetNotifyNum(uint32_t* notifyNum) const override;
      39              :     HcclResult GetRemoteMems(uint32_t* memNum, CommMem** remoteMem, char*** memInfos) override;
      40            0 :     const HcommChannelDesc& GetChannelDesc() const override { return channelDesc_; }
      41              :     HcclResult BuildChannelEntityToDevice(void** devChannelPtr);
      42              :     HcclResult PreAllocChannelEntityToDevice(void** devChannelPtr);
      43              :     HcclResult FillChannelEntityToDevice();
      44              : 
      45              :     HcclResult NotifyRecord(const uint32_t remoteNotifyIdx) override;
      46              :     HcclResult NotifyWait(const uint32_t localNotifyIdx, const uint32_t timeout) override;
      47              :     HcclResult WriteWithNotify(void* dst, const void* src, const uint64_t len, uint32_t remoteNotifyIdx) override;
      48              :     HcclResult Write(void* dst, const void* src, uint64_t len) override;
      49              :     HcclResult Read(void* dst, const void* src, uint64_t len) override;
      50              :     HcclResult ChannelFence() override;
      51              : 
      52              : private:
      53              :     HcclResult ParseInputParam();
      54              :     HcclResult StartListen();
      55              :     HcclResult BuildSocket();
      56              :     HcclResult BuildAttr();
      57              :     HcclResult BuildConnection();
      58              :     HcclResult BuildAivUrmaTransport();
      59              :     void PutSocketIfNeeded();
      60              :     void ReleaseDeviceChannelEntity();
      61              : 
      62              :     HcclResult
      63              :     CreateUbConnectionByProtocol(const UbConnBuildContext& ctx, std::unique_ptr<Hccl::DevUbConnection>& ubConn);
      64              :     HcclResult AcquireSharedJettyInBuildConnection(const UbConnBuildContext& ctx, Hccl::DevUbConnection* connection);
      65              : 
      66              :     // --------------------- 转换参数 ---------------------
      67              :     EndpointDesc localEp_{};
      68              :     EndpointDesc remoteEp_{};
      69              :     uint32_t notifyNum_{0};
      70              : 
      71              :     // --------------------- 入参 ---------------------
      72              :     EndpointHandle endpointHandle_;
      73              :     CommEngine engine_{COMM_ENGINE_RESERVED};
      74              :     HcommChannelDesc channelDesc_;
      75              : 
      76              :     // --------------------- 具体成员 ---------------------
      77              :     Hccl::Socket* socket_{nullptr};
      78              :     std::unique_ptr<Hccl::AivUrmaTransport> transport_{nullptr};
      79              :     Hccl::BaseMemTransport::Attribution attr_{};
      80              :     Hccl::BaseMemTransport::CommonLocRes commonRes_{};
      81              :     std::vector<std::unique_ptr<Hccl::DevUbConnection>> connections_{};
      82              :     RdmaHandle rdmaHandle_{nullptr};
      83              :     void* devChannelEntity_{nullptr};
      84              :     void* devChannelEntitySlab_{nullptr};
      85              :     size_t devChannelEntitySlabSize_{0};
      86              :     std::vector<hccl::DeviceMem> deviceMemories_{};
      87              :     DevBaseAttr devBaseAttr_{};
      88              :     std::unique_ptr<Hccl::SocketConfig> socketConfigHolder_{nullptr};
      89              :     const Hccl::SocketConfig* socketConfig_{nullptr};
      90              :     uint32_t devicePhyId_{};
      91              : 
      92              :     // 共享 jetty 模式下从 Endpoint::SharedJettyCtx 取得的 PI/CI device 内存指针,
      93              :     // BuildChannelEntityToDevice 时绑给 transport,使同 endpoint 下多 channel 共用同一 PI/CI。
      94              :     void* sharedSqPiPtr_{nullptr};
      95              :     void* sharedSqCiPtr_{nullptr};
      96              :     void* sharedCqPiPtr_{nullptr};
      97              :     void* sharedCqCiPtr_{nullptr};
      98              : };
      99              : 
     100              : } // namespace hcomm
     101              : 
     102              : #endif // AIV_URMA_CHANNEL_H
        

Generated by: LCOV version 2.0-1