LCOV - code coverage report
Current view: top level - legacy/ascend910/platform/inc - private_types.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 12 12
Test Date: 2026-08-04 10:52:23 Functions: 100.0 % 3 3

            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 PRIVATE_TYPES_H
      12              : #define PRIVATE_TYPES_H
      13              : #include "hccl_common.h"
      14              : #include "transport_heterog_def.h"
      15              : #include "adapter_hccp.h"
      16              : using HcclRtPointAttr = void *; // 获取指针属性,主要是页表大小
      17              : using BinHandle = void *;
      18              : constexpr u32 NOTIFY_INFO_LENGTH = 256;
      19              : 
      20              : constexpr u32 HETEROG_RANK_TABLE_MAX_LEN = 10240; // ranktable max len 10 * 1024 = 10KB
      21              : namespace hccl {
      22              : 
      23              : using MemMsg = struct TagMemMsg {
      24              :     void *addr;
      25              :     u64 len;
      26              :     MemType memType;
      27              :     s32 mrRegFlag;
      28              :     u64 offset;
      29              :     u32 rkey;
      30              :     u32 lkey;
      31              :     u32 notifyId;
      32              : 
      33         4503 :     TagMemMsg() : addr(nullptr), len(0), memType(MemType::MEM_TYPE_RESERVED),
      34         4503 :         mrRegFlag(0), offset(0), rkey(0), lkey(0), notifyId(INVALID_UINT) {}
      35              : };
      36              : 
      37              : struct TransportResourceInfo {
      38              :     static constexpr s32 QP_FLAG_RC = 0;
      39              :     static constexpr s32 NORMAL_QP_MODE = 0;
      40              :     static constexpr s32 DEFAULT_DEVICE_LOGIC_ID = 0;
      41              :     static constexpr s32 DEFAULT_LKEY_VALUE = 0;
      42              :     static constexpr s32 DEFAULT_BATCH_NUM = 128;
      43              : 
      44              :     const std::unique_ptr<MrManager> &mrManager;
      45              :     const std::unique_ptr<LocklessRingMemoryAllocate<HcclMessageInfo>> &pMsgInfosMem;
      46              :     const std::unique_ptr<LocklessRingMemoryAllocate<HcclRequestInfo>> &pReqInfosMem;
      47              :     const std::unique_ptr<HeterogMemBlocksManager> &memBlocksManager;
      48              :     const std::unique_ptr<LocklessRingMemoryAllocate<RecvWrInfo>> &pRecvWrInfosMem;
      49              :     SrqInfo tagSrqInfo;
      50              :     SrqInfo dataSrqInfo;
      51              :     s32 flag;
      52              :     u32 lkey;
      53              :     s32 qpMode;
      54              :     s32 deviceLogicId;
      55              :     bool isHdcMode;
      56              :     u32 memBlockNum;
      57              :     bool remoteIsHdc;
      58              :     bool isESMode;
      59              :     bool isGlobalMrmanagerInit;
      60              :     u32 hdcHostWqeBatchNum;
      61              :     bool isRawConn{false};
      62              :     TransportResourceInfo() = delete;
      63            2 :     TransportResourceInfo(const std::unique_ptr<MrManager> &mrManager,
      64              :         const std::unique_ptr<LocklessRingMemoryAllocate<HcclMessageInfo>> &pMsgInfosMem,
      65              :         const std::unique_ptr<LocklessRingMemoryAllocate<HcclRequestInfo>> &pReqInfosMem,
      66              :         const std::unique_ptr<HeterogMemBlocksManager> &memBlocksManager,
      67              :         const std::unique_ptr<LocklessRingMemoryAllocate<RecvWrInfo>> &pRecvWrInfosMem)
      68            2 :         : mrManager(mrManager), pMsgInfosMem(pMsgInfosMem), pReqInfosMem(pReqInfosMem),
      69            2 :         memBlocksManager(memBlocksManager), pRecvWrInfosMem(pRecvWrInfosMem), tagSrqInfo(SrqInfo()),
      70            2 :         dataSrqInfo(SrqInfo()), flag(QP_FLAG_RC), lkey(0), qpMode(NORMAL_QP_MODE),
      71            2 :         deviceLogicId(DEFAULT_DEVICE_LOGIC_ID), isHdcMode(false), memBlockNum(MEM_BLOCK_NUM),
      72            2 :         remoteIsHdc(false), isESMode(false), isGlobalMrmanagerInit(false), hdcHostWqeBatchNum(DEFAULT_BATCH_NUM)
      73            2 :     {}
      74              :     TransportResourceInfo(const struct TransportResourceInfo &that)
      75              :         : mrManager(that.mrManager), pMsgInfosMem(that.pMsgInfosMem),
      76              :         pReqInfosMem(that.pReqInfosMem), memBlocksManager(that.memBlocksManager), pRecvWrInfosMem(that.pRecvWrInfosMem)
      77              :     {
      78              :         tagSrqInfo = (that.tagSrqInfo);
      79              :         dataSrqInfo = (that.dataSrqInfo);
      80              :         flag = (that.flag);
      81              :         lkey = (that.lkey);
      82              :         qpMode = (that.qpMode);
      83              :         deviceLogicId = (that.deviceLogicId);
      84              :         isHdcMode = (that.isHdcMode);
      85              :         memBlockNum = (that.memBlockNum);
      86              :         remoteIsHdc = false;
      87              :         isESMode = (that.isESMode);
      88              :         isGlobalMrmanagerInit = (that.isGlobalMrmanagerInit);
      89              :         hdcHostWqeBatchNum = (that.hdcHostWqeBatchNum);
      90              :         isRawConn = (that.isRawConn);
      91              :     }
      92              : };
      93              : // 全局工作空间类型
      94              : enum class GlobalWorkSpaceType {
      95              :     OVERFLOW_DETECT_MODE = 0,
      96              : };
      97              : 
      98            1 : template <typename T> inline std::vector<u8> CustomTypeToVectorByte(T &data)
      99              : {
     100            1 :     std::vector<u8> v((reinterpret_cast<u8 *>(&data)), (reinterpret_cast<u8 *>(&data) + sizeof(T)));
     101            1 :     return v;
     102              : }
     103              : }  // namespace hccl
     104              : 
     105              : #endif /* PRIVATE_TYPES_H */
        

Generated by: LCOV version 2.0-1