LCOV - code coverage report
Current view: top level - legacy/ascend910/platform/resource/transport/host - transport_ibverbs_pub.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 11.1 % 36 4
Test Date: 2026-08-18 17:47:01 Functions: 28.6 % 7 2

            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 LINK_IBV_EXP_PUB_H
      12              : #define LINK_IBV_EXP_PUB_H
      13              : 
      14              : #include <functional>
      15              : #include <mutex>
      16              : 
      17              : #include "../host/transport_net_pub.h"
      18              : #include "network/hccp_common.h"
      19              : #include "workflow_pub.h"
      20              : #include "private_types.h"
      21              : #include "adapter_hccp.h"
      22              : #include "universal_concurrent_map.h"
      23              : 
      24            0 : inline void CopyAiWQInfo(struct HcclAiRMAWQ& dest, const struct AiDataPlaneWq& source, DBMode dbMode, u32 sl)
      25              : {
      26            0 :     dest.wqn = source.wqn;
      27            0 :     dest.bufAddr = source.bufAddr;
      28            0 :     dest.wqeSize = source.wqebbSize;
      29            0 :     dest.depth = source.depth;
      30            0 :     dest.headAddr = source.headAddr;
      31            0 :     dest.tailAddr = source.tailAddr;
      32            0 :     dest.dbMode = dbMode;
      33            0 :     if (dbMode == DBMode::SW_DB) {
      34            0 :         dest.dbAddr = source.swdbAddr;
      35            0 :     } else if (dbMode == DBMode::HW_DB) {
      36            0 :         dest.dbAddr = source.dbReg;
      37              :     }
      38            0 :     dest.sl = sl;
      39            0 :     HCCL_INFO(
      40              :         "CopyAiWQInfo: wqn[%u] bufAddr[%p] wqeSize[%u] depth[%u] headAddr[%p] tailAddr[%p] dbMode[%u]", dest.wqn,
      41              :         dest.bufAddr, dest.wqeSize, dest.depth, dest.headAddr, dest.tailAddr, dest.dbMode);
      42            0 :     return;
      43              : }
      44              : 
      45            0 : inline void CopyAiCQInfo(struct HcclAiRMACQ& dest, const AiDataPlaneCq& source, DBMode dbMode)
      46              : {
      47            0 :     dest.cqn = source.cqn;
      48            0 :     dest.bufAddr = source.bufAddr;
      49            0 :     dest.cqeSize = source.cqeSize;
      50            0 :     dest.depth = source.depth;
      51            0 :     dest.headAddr = source.headAddr;
      52            0 :     dest.tailAddr = source.tailAddr;
      53            0 :     dest.dbMode = dbMode;
      54            0 :     if (dbMode == DBMode::SW_DB) {
      55            0 :         dest.dbAddr = source.swdbAddr;
      56            0 :     } else if (dbMode == DBMode::HW_DB) {
      57            0 :         dest.dbAddr = source.dbReg;
      58              :     }
      59              : 
      60            0 :     HCCL_INFO(
      61              :         "CopyAiCQInfo: cqn[%u] bufAddr[%p] cqeSize[%u] depth[%u] headAddr[%p] tailAddr[%p] dbMode[%u]", dest.cqn,
      62              :         dest.bufAddr, dest.cqeSize, dest.depth, dest.headAddr, dest.tailAddr, dest.dbMode);
      63            0 :     return;
      64              : }
      65              : namespace hccl {
      66              : // WQE payload类型, 区分 notify 模式与数据类型模式
      67              : enum class WqeType {
      68              :     WQE_TYPE_DATA,             // 发送数据类型的WQE
      69              :     WQE_TYPE_DATA_NOTIFY,      // 发送数据同步 Notify 的WQE
      70              :     WQE_TYPE_ACK_NOTIFY,       // 发送信息同步 Notify 的WQE
      71              :     WQE_TYPE_DATA_ACK_NOTIFY,  // 发送数据接收确认 Notify 的WQE
      72              :     WQE_TYPE_DATA_WITH_NOTIFY, // 带有Notify信息的数据WQE
      73              :     WQE_TYPE_DATA_WITH_REDUCE, // 带有Reduce信息的数据WQE
      74              :     WQE_TYPE_READ_DATA,        // 读数据类型的WQE
      75              :     WQE_TYPE_RESEERVED
      76              : };
      77              : 
      78              : using WqeInfo = struct TagWqeInfo {
      79              :     struct SendWrlistDataExt wqeData {};
      80              :     u64 wqeType;
      81              :     u64 wqeDataOffset;
      82              :     u32 notifyId;
      83            1 :     TagWqeInfo() : wqeType(static_cast<u64>(WqeType::WQE_TYPE_DATA)), wqeDataOffset(0), notifyId(INVALID_UINT)
      84              :     {
      85            1 :         wqeData = {};
      86            1 :     }
      87              : };
      88              : 
      89              : struct CombineQpHandle {
      90              :     QpHandle qpHandle = nullptr;
      91              :     u32 preWrOpcode = INVALID_UINT; // 记录这个qp内最后一次下发的wr的opcode
      92            0 :     CombineQpHandle() {};
      93            0 :     CombineQpHandle(QpHandle& qpHandle) : qpHandle(qpHandle) {};
      94              : };
      95              : 
      96              : struct CombineQpInfo {
      97              :     struct AiQpInfo aiQpInfo {};
      98              :     u32 preWrOpcode = INVALID_UINT; // 记录这个qp内最后一次下发的wr的opcode
      99           28 :     CombineQpInfo() {};
     100            0 :     CombineQpInfo(struct AiQpInfo& aiQpInfo) : aiQpInfo(aiQpInfo) {};
     101              : };
     102              : 
     103              : namespace {
     104              :     constexpr u32 WAIT_US_COUNT = 1000;
     105              :     constexpr s32 REG_VALID = 1;
     106              :     // QP flag
     107              :     constexpr s32 QP_FLAG_RC = 0; // flag: 0 = RC, 1= UD,其它预留
     108              :     // QP mode
     109              :     constexpr s32 NORMAL_QP_MODE = 0;      // 普通的QP模式,但时不用
     110              :     constexpr s32 OFFLINE_QP_MODE = 1;     // 下沉模式的QP
     111              :     constexpr s32 OPBASE_QP_MODE = 2;      // 单算子模式的QP
     112              :     constexpr s32 OFFLINE_QP_MODE_EXT = 3; // 下沉模式(910B/910_93)QP
     113              :     constexpr s32 OPBASE_QP_MODE_EXT = 4;  // 单算子模式(910B/910_93)的QP
     114              : 
     115              :     // RDMA op type
     116              :     constexpr s32 RDMA_OP_WRITE = 0;
     117              :     constexpr s32 RDMA_OP_READ = 4;
     118              :     constexpr u32 RDMA_SEND_WRLIST_MAX_COUNT = 10;
     119              :     // RDMA multi QP
     120              :     constexpr u32 RDMA_ADDR_ALIGNMENT = 128;
     121              :     constexpr u32 RDMA_INVALID_QP_INDEX = 0xFFFF;
     122              : 
     123              :     // RDMA Write With Reduce DataType and OpType
     124              :     // reduceType: 0x0:int8 0x1:int16 0x2:int32 0x6:fp16 0x7:fp32 0x8:bf16
     125              :     enum class RdmaReduceDataType : uint8_t {
     126              :         RDMA_REDUCE_DATA_INT8 = 0,
     127              :         RDMA_REDUCE_DATA_INT16 = 1,
     128              :         RDMA_REDUCE_DATA_INT32 = 2,
     129              :         RDMA_REDUCE_DATA_FP16 = 6,
     130              :         RDMA_REDUCE_DATA_FP32 = 7,
     131              :         RDMA_REDUCE_DATA_BF16 = 8,
     132              :         RDMA_REDUCE_DATA_INVALID = 255
     133              :     };
     134              :     // reduce_op: 0x0:max 0x1:min 0x2:sum
     135              :     enum class RdmaReduceOpType : uint8_t {
     136              :         RDMA_REDUCE_OP_MAX = 0,
     137              :         RDMA_REDUCE_OP_MIN = 1,
     138              :         RDMA_REDUCE_OP_SUM = 2,
     139              :         RDMA_REDUCE_OP_INVALID = 255
     140              :     };
     141              : 
     142              :     constexpr uint8_t RDMA_REDUCE_DATA_TYPE_TABLE[HCCL_DATA_TYPE_RESERVED]
     143              :         = {static_cast<uint8_t>(RdmaReduceDataType::RDMA_REDUCE_DATA_INT8),
     144              :            static_cast<uint8_t>(RdmaReduceDataType::RDMA_REDUCE_DATA_INT16),
     145              :            static_cast<uint8_t>(RdmaReduceDataType::RDMA_REDUCE_DATA_INT32),
     146              :            static_cast<uint8_t>(RdmaReduceDataType::RDMA_REDUCE_DATA_FP16),
     147              :            static_cast<uint8_t>(RdmaReduceDataType::RDMA_REDUCE_DATA_FP32),
     148              :            static_cast<uint8_t>(RdmaReduceDataType::RDMA_REDUCE_DATA_INVALID),
     149              :            static_cast<uint8_t>(RdmaReduceDataType::RDMA_REDUCE_DATA_INVALID),
     150              :            static_cast<uint8_t>(RdmaReduceDataType::RDMA_REDUCE_DATA_INVALID),
     151              :            static_cast<uint8_t>(RdmaReduceDataType::RDMA_REDUCE_DATA_INVALID),
     152              :            static_cast<uint8_t>(RdmaReduceDataType::RDMA_REDUCE_DATA_INVALID),
     153              :            static_cast<uint8_t>(RdmaReduceDataType::RDMA_REDUCE_DATA_INVALID),
     154              :            static_cast<uint8_t>(RdmaReduceDataType::RDMA_REDUCE_DATA_BF16)};
     155              :     constexpr uint8_t RDMA_REDUCE_OP_TYPE_TABLE[HCCL_REDUCE_RESERVED]
     156              :         = {static_cast<uint8_t>(RdmaReduceOpType::RDMA_REDUCE_OP_SUM),
     157              :            static_cast<uint8_t>(RdmaReduceOpType::RDMA_REDUCE_OP_INVALID),
     158              :            static_cast<uint8_t>(RdmaReduceOpType::RDMA_REDUCE_OP_MAX),
     159              :            static_cast<uint8_t>(RdmaReduceOpType::RDMA_REDUCE_OP_MIN)};
     160              : } // namespace
     161              : 
     162              : class TransportIbverbs : public TransportNet {
     163              : public:
     164              :     explicit TransportIbverbs(
     165              :         DispatcherPub* dispatcher, const std::unique_ptr<NotifyPool>& notifyPool, MachinePara& machinePara,
     166              :         std::chrono::milliseconds timeout);
     167              :     ~TransportIbverbs() override;
     168              : 
     169              :     HcclResult Init() override;
     170              : 
     171              :     HcclResult DeInit() override;
     172              : 
     173              :     HcclResult Stop() override;
     174              : 
     175              :     HcclResult Resume() override;
     176              : 
     177              :     HcclResult TxAsync(UserMemType dstMemType, u64 dstOffset, const void* src, u64 len, Stream& stream) override;
     178              :     HcclResult TxAsync(std::vector<TxMemoryInfo>& txMems, Stream& stream) override;
     179              : 
     180              :     HcclResult RxAsync(UserMemType srcMemType, u64 srcOffset, void* dst, u64 len, Stream& stream) override;
     181              :     HcclResult RxAsync(std::vector<RxMemoryInfo>& rxMems, Stream& stream) override;
     182              : 
     183              :     HcclResult DataReceivedAck(Stream& stream) override;
     184              : 
     185              :     HcclResult TxAck(Stream& stream) override;
     186              :     HcclResult RxAck(Stream& stream) override;
     187              : 
     188              :     HcclResult TxDataSignal(Stream& stream) override;
     189              :     HcclResult RxDataSignal(Stream& stream) override;
     190              : 
     191              :     HcclResult TxWaitDone(Stream& stream) override;
     192              :     HcclResult TxWithReduce(
     193              :         UserMemType dstMemType, u64 dstOffset, const void* src, u64 len, const HcclDataType datatype,
     194              :         HcclReduceOp redOp, Stream& stream) override;
     195              :     HcclResult TxWithReduce(
     196              :         const std::vector<TxMemoryInfo>& txWithReduceMems, const HcclDataType datatype, HcclReduceOp redOp,
     197              :         Stream& stream) override;
     198              :     bool IsSupportTransportWithReduce() override;
     199              :     HcclResult GetIndOpRemoteMemDetails(MemDetails** remoteMem, uint32_t* memNum, HcclMemType memType) override;
     200              :     HcclResult GetIndOpRemoteMem(HcclMem** remoteMem, uint32_t* memNum) override;
     201              :     HcclResult GetRemoteMem(UserMemType memType, void** remotePtr) override;
     202              :     HcclResult GetRemoteMemSize(UserMemType memType, u64& size) override;
     203              : 
     204              :     HcclResult TxPrepare(Stream& stream) override;
     205              :     HcclResult RxPrepare(Stream& stream) override;
     206              : 
     207              :     HcclResult TxData(UserMemType dstMemType, u64 dstOffset, const void* src, u64 len, Stream& stream) override;
     208              :     HcclResult RxData(UserMemType srcMemType, u64 srcOffset, void* dst, u64 len, Stream& stream) override;
     209              : 
     210              :     HcclResult TxDone(Stream& stream) override;
     211              :     HcclResult RxDone(Stream& stream) override;
     212              : 
     213              :     HcclResult WriteAsync(struct Transport::Buffer& remoteBuf, struct Transport::Buffer& localBuf, Stream& stream);
     214              :     HcclResult WriteSync(struct Transport::Buffer& remoteBuf, struct Transport::Buffer& localBuf, Stream& stream);
     215              : 
     216              :     HcclResult WriteReduceAsync(
     217              :         struct Transport::Buffer& remoteBuf, struct Transport::Buffer& localBuf, const HcclDataType datatype,
     218              :         HcclReduceOp redOp, Stream& stream);
     219              : 
     220              :     HcclResult ReadAsync(struct Transport::Buffer& localBuf, struct Transport::Buffer& remoteBuf, Stream& stream);
     221              :     HcclResult ReadSync(struct Transport::Buffer& localBuf, struct Transport::Buffer& remoteBuf, Stream& stream);
     222              : 
     223              :     HcclResult PostReady(Stream& stream);
     224              :     HcclResult WaitReady(Stream& stream);
     225              : 
     226              :     HcclResult PostFin(Stream& stream);
     227              :     HcclResult WaitFin(Stream& stream);
     228              : 
     229              :     HcclResult PostFinAck(Stream& stream);
     230              :     HcclResult WaitFinAck(Stream& stream);
     231              : 
     232              :     HcclResult Post(u32 notifyIdx, Stream& stream) override;
     233              :     HcclResult Wait(u32 notifyIdx, Stream& stream, const u32 timeOut = NOTIFY_INVALID_WAIT_TIME) override;
     234              : 
     235              :     static HcclResult GetTransportErrorCqe(
     236              :         const HcclNetDevCtx netDevCtx, std::vector<std::pair<TransportBase*, CqeInfo>>& infos, u32& num);
     237              :     HcclIpAddress& GetRemoteIp();
     238              :     HcclResult GetTransportId(u32& id) override;
     239              : 
     240              :     HcclResult Fence() override;
     241              :     HcclResult ExchangeCapabilityHybrid();
     242              :     HcclResult GetDrainRemSrcMem(void*& remoteAddr, uint32_t& remoteKey, uint32_t& size) override;
     243              :     HcclResult Drain(Stream& stream) override;
     244              : 
     245              : protected:
     246              :     HcclResult GetRemoteAddr(MemType memType, u8*& exchangeDataPtr, u64& exchangeDataBlankSize);
     247              :     HcclResult GetIndOpRemoteAddr(u8*& exchangeDataPtr, u64& exchangeDataBlankSize);
     248              :     HcclResult GetRemoteNotifyAddr(u8*& exchangeDataPtr, u64& exchangeDataBlankSize, MemMsg& memMsg);
     249              :     HcclResult FillExchangeDataTotalSize() override;
     250              :     HcclResult ConstructExchangeForSend() override;
     251              :     HcclResult ParseReceivedExchangeData() override;
     252              : 
     253              :     HcclResult DestroyQP(QpHandle& qpHandle);
     254              :     HcclResult DestroyQP();
     255              :     HcclResult DeRegMR();
     256              :     void DeRegMRForQPhandles(MemMsg& memMsg);
     257              :     HcclResult DeRegOneMR(QpHandle& qpHandle, MemMsg& memMsg);
     258              :     // 初始化
     259              :     HcclResult GetNotifySize();
     260              :     s32 GetQpMode();
     261              :     bool UseMultiQp();
     262              :     HcclResult CreateQp();                                      // 创建QP
     263              :     HcclResult CreateSingleQp(s32 qpMode);                      // 两个rank之间仅创建一个QP
     264              :     HcclResult CreateMultiQp(s32 qpMode, u32 qpsPerConnection); // 两个rank之间创建多QP
     265              :     HcclResult ConnectSingleQp(std::function<bool()> needStop = []() {
     266              :         return false;
     267              :     });
     268              :     HcclResult ConnectMultiQp(
     269              :         u32 qpsPerConnection, std::function<bool()> needStop = []() {
     270              :             return false;
     271              :         });
     272              :     HcclResult ConnectQp();
     273              :     HcclResult InitQpConnect();
     274              :     HcclResult GetQpAttr();
     275              :     std::vector<u32> RdmaLengthSplit(u32 length, u32 splitNum);
     276              : 
     277              :     HcclResult TxSendDataAndNotifyWithMultiQP(
     278              :         std::vector<WqeInfo>& wqeInfoVec, u32 acturalMultiQpNum, Stream& stream, bool useOneDoorbell = false);
     279              : 
     280              :     HcclResult GetWqeDataOffsetAndNotifyId(WqeType wqeType, u64& wqeDataOffset, u32& notifyId);
     281              : 
     282              :     HcclResult SendWqeList(QpHandle qpHandle, u32 wqeNum, struct SendWrlistDataExt* wqelist, struct SendWrRsp* opRsp);
     283              :     bool IsSupportRdmaNotify();
     284              :     bool IsTemplateMode();
     285              :     void DestroySignal();
     286              :     HcclResult IsUseQpCreateWithAttrs(bool& isUseQpCreateWithAttrs, s32 qpMode);
     287              :     HcclResult GetNicHandle();
     288              :     u32 GetQpsPerConnection();
     289              :     virtual HcclResult
     290              :     TxSendWqe(void* dstMemPtr, const void* srcMemPtr, u64 srcMemSize, Stream& stream, WqeType wqeType);
     291              :     virtual HcclResult TxSendNotifyWqe(MemMsg& memMsg, const void* srcMemPtr, u64 srcMemSize, Stream& stream);
     292              :     virtual HcclResult RegUserMem(MemType memType, u8*& exchangeDataPtr, u64& exchangeDataBlankSize);
     293              :     virtual HcclResult RegCustomUserMem(u8*& exchangeDataPtr, u64& exchangeDataBlankSize);
     294              :     virtual HcclResult
     295              :     RegCustomUserMemWithMsg(void* addr, u64 size, MemMsg& memMsg, u8*& exchangeDataPtr, u64& exchangeDataBlankSize);
     296              :     HcclResult CreateNotifyBuffer(
     297              :         std::shared_ptr<LocalIpcNotify>& localNotify, MemType notifyType, u8*& exchangeDataPtr,
     298              :         u64& exchangeDataBlankSize, NotifyLoadType notifyLoadType = NotifyLoadType::HOST_NOTIFY);
     299              :     HcclResult CreateNotifyVectorBuffer(
     300              :         std::vector<std::shared_ptr<LocalIpcNotify>>& notifyVector, u8*& exchangeDataPtr, u64& exchangeDataBlankSize);
     301              :     HcclResult CreateNotifyValueBuffer();
     302              :     HcclResult CreateOneQp(
     303              :         s32 qpMode, u32 qpsPerConnection, QpHandle& qpHandle, AiQpInfo& aiQpInfo, bool useAicpu = false,
     304              :         u32 udpSport = 0);
     305              :     HcclResult AddWqeList(
     306              :         void* dstMemPtr, const void* srcMemPtr, u64 srcMemSize, WqeType wqeType, WrAuxInfo& aux,
     307              :         std::vector<WqeInfo>& wqeInfoVec);
     308              :     virtual HcclResult GetMemInfo(UserMemType memType, void** dstMemPtr, u64* dstMemSize);
     309              :     virtual HcclResult TxPayLoad(
     310              :         UserMemType dstMemType, u64 dstOffset, const void* src, u64 len, WqeType wqeType, WrAuxInfo& aux,
     311              :         std::vector<WqeInfo>& wqeInfoVec);
     312              :     virtual HcclResult
     313              :     TxSendDataAndNotifyWithSingleQP(std::vector<WqeInfo>& wqeInfoVec, Stream& stream, bool useOneDoorbell = false);
     314              :     virtual HcclResult
     315              :     TxSendDataAndNotify(std::vector<WqeInfo>& wqeInfoVec, Stream& stream, bool useOneDoorbell = false);
     316              :     virtual HcclResult TxWqeList(
     317              :         std::vector<WqeInfo>& wqeInfoVec, Stream& stream, std::vector<struct SendWrRsp>& opRspVec,
     318              :         u32 multiQpIndex = RDMA_INVALID_QP_INDEX);
     319              :     virtual HcclResult RdmaSendAsync(
     320              :         std::vector<WqeInfo>& wqeInfoVec, Stream& stream, bool useOneDoorbell = false,
     321              :         u32 multiQpIndex = RDMA_INVALID_QP_INDEX);
     322              :     HcclResult RdmaSendAsyncHostNIC(std::vector<WqeInfo>& wqeInfoVec, Stream& stream);
     323              :     virtual HcclResult
     324              :     RdmaSendAsync(struct SendWr& wr, Stream& stream, WqeType wqeType, u64 notifyOffset, u32 notifyId);
     325              :     HcclResult RdmaSendAsyncHostNIC(struct SendWrlistDataExt& wr, Stream& stream, WqeType wqeType, u64 notifyOffset);
     326              : 
     327              :     HcclResult GetLocalNotify(std::vector<HcclSignalInfo>& localNotify) override;
     328              :     HcclResult GetLocalRdmaNotify(std::vector<HcclSignalInfo>& rdmaNotify) override;
     329              :     HcclResult
     330              :     GetDrainLocalDataNotify(void*& localAddr, uint32_t& lkey, HcclSignalInfo& dataNotify) override; // 仅获取dataNotify
     331              :     HcclResult GetRemoteRdmaNotifyAddrKey(std::vector<AddrKey>& rdmaNotifyAddr) override;
     332              :     HcclResult GetLocalNotifyValueAddrKey(std::vector<AddrKey>& notifyValue) override;
     333              :     HcclResult GetRemoteMemKey(UserMemType memType, uint32_t* remoteMemKey) override;
     334              :     HcclResult GetLocalMemDetails(UserMemType memType, MemDetails& memDetails) override;
     335              :     HcclResult GetAiQpInfo(std::vector<HcclQpInfoV2>& aiQpInfo) override;
     336              :     HcclResult GetAiRMAQueueInfo(std::vector<HcclAiRMAQueueInfo>& aiRMAQueueInfo) override;
     337              :     HcclResult ConstructPayLoadWqe(
     338              :         void* dstMemPtr, const void* src, u64 len, WqeType wqeType, WrAuxInfo& aux, std::vector<WqeInfo>& wqeInfoVec,
     339              :         u32 txSendDataTimes);
     340              :     u32 GetActualQpNum(u32 maxLength);
     341              :     HcclResult WriteCommon(
     342              :         const void* remoteAddr, const void* localAddr, u64 length, Stream& stream, WqeType wqeType,
     343              :         struct WrAuxInfo& aux);
     344              : 
     345              :     virtual void ModifyAtomicWriteAfterReduce(u32& preWrOpcode, u64 wqeType, u32& opcode, u32& immData);
     346              : 
     347              :     static std::array<DeviceMem, MAX_MODULE_DEVICE_NUM> notifyValueMem_;
     348              :     static std::array<std::mutex, MAX_MODULE_DEVICE_NUM> notifyValueMutex_;
     349              :     const u64 notifyValueSize_{LARGE_PAGE_MEMORY_MIN_SIZE};            // 避免申请小页内存。最小2*1024*1024
     350              :     static std::array<Referenced, MAX_MODULE_DEVICE_NUM> instanceRef_; // 实例计数,用于释放静态资源
     351              : 
     352              :     bool isHybridMode_ = false; // 是否为混合模式:hostNic -- DeviceNic
     353              :     std::vector<CombineQpHandle> combineQpHandles_;
     354              :     std::vector<CombineQpHandle> multiCombineQpHandles_;
     355              : 
     356              :     CombineQpInfo combineAiQpInfo_{};
     357              :     std::vector<CombineQpInfo> combineAiQpInfos_;
     358              :     u32 qpsPerConnection_;
     359              :     u32 notifySize_;
     360              : 
     361              :     std::shared_ptr<LocalIpcNotify> ackNotify_;
     362              :     std::shared_ptr<LocalIpcNotify> dataAckNotify_;
     363              : 
     364              :     s32 access_;
     365              : 
     366              :     std::array<MemMsg, static_cast<u32>(MemType::MEM_TYPE_RESERVED)> memMsg_;
     367              :     std::array<MemMsg, static_cast<u32>(MemType::MEM_TYPE_RESERVED)> remoteMemMsg_;
     368              : 
     369              :     std::vector<MemMsg> userDeviceMemMsg_;
     370              :     std::vector<MemMsg> userHostMemMsg_;
     371              : 
     372              :     std::vector<MemMsg> remoteUserDeviceMemMsg_;
     373              :     std::vector<MemMsg> remoteUserHostMemMsg_;
     374              :     std::unique_ptr<HcclMem[]> remoteMemsPtr_;
     375              :     u32 remoteMemsNum_;
     376              :     std::mutex remoteMemsMutex_;
     377              : 
     378              :     MemMsg remoteDataNotifyMsg_;
     379              :     std::shared_ptr<LocalIpcNotify> dataNotify_;
     380              : 
     381              :     std::vector<std::shared_ptr<LocalIpcNotify>> multiQpDataNotify_;
     382              :     std::vector<MemMsg> multiQpDataNotifyMemMsg_;
     383              :     std::vector<MemMsg> multiQpDataNotifyRemoteMemMsg_;
     384              : 
     385              :     std::vector<MemMsg> userRemoteNotifyMsg_;
     386              : 
     387              :     std::vector<std::vector<MemMsg>> userMultiQpRemoteNotifyMsg_;
     388              :     std::vector<std::vector<std::shared_ptr<LocalIpcNotify>>> userMultiQpLocalNotify_;
     389              : 
     390              :     HcclWorkflowMode workFlowMode_; // 工作模式
     391              :     u32 sqeCounter_;
     392              :     u32 currentQP_;
     393              : 
     394              :     std::vector<MrHandle> mrHandles_;
     395              :     RdmaHandle nicRdmaHandle_{nullptr};
     396              :     bool fence_{false};
     397              : 
     398              :     DevType localDeviceType{DevType::DEV_TYPE_COUNT};
     399              : 
     400              :     QPMode qpMode_{QPMode::INVALID}; // 是否为普通QP模式
     401              : 
     402              : private:
     403              :     static void ProcessCqeInfo(
     404              :         const s32 deviceId, const struct CqeErrInfo* infolist, const u32 cqeNum,
     405              :         std::vector<std::pair<TransportBase*, CqeInfo>>& infos);
     406              :     // bit[63:32] devicePhyId, bit[31:0] qpn
     407              :     static UniversalConcurrentMap<u64, TransportIbverbs*> g_qpn2IbversLinkMap_;
     408              :     static bool g_flag;
     409              :     static bool g_isSupCqeErrInfoListConfig;
     410              :     static u32 cqeErrQpn_;
     411              :     bool isCapture_{false};
     412              : };
     413              : } // namespace hccl
     414              : 
     415              : #endif /* LINK_IBV_EXP_PUB_H */
        

Generated by: LCOV version 2.0-1