LCOV - code coverage report
Current view: top level - legacy/ascend950/framework/communicator/hostdpu - flush_handle.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 2 2
Test Date: 2026-08-18 17:47:01 Functions: 100.0 % 2 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 HCCL_FLUSH_HANDLE_H
      12              : #define HCCL_FLUSH_HANDLE_H
      13              : 
      14              : #include <string>
      15              : 
      16              : #include "hccp_common.h"
      17              : #include "hccl_types.h"
      18              : #include "rdma_handle_manager.h"
      19              : 
      20              : namespace Hccl {
      21              : constexpr u64 FLUSH_BUFFER_SIZE = 8; // 每次读取8字节
      22              : class FlushHandle {
      23              : public:
      24              :     FlushHandle();
      25              :     ~FlushHandle();
      26              : 
      27              :     // 初始化 handle
      28              :     HcclResult Init(IpAddress ip, u32 devPhyId);
      29              : 
      30              :     // 销毁 handle
      31              :     HcclResult Destroy();
      32              : 
      33              :     // 成员变量
      34              :     MrInfoT loopBackQpMrRemoteInfo = {};
      35              :     MrInfoT loopBackQpMrLocalInfo = {};
      36              :     LoopbackQpPair loopBackQpParam = {};
      37              : 
      38            2 :     bool GetFlushOpcodeSupport() const { return flushOpcodeSupport_; }
      39              : 
      40            3 :     void SetFlushOpcodeSupport() { flushOpcodeSupport_ = true; }
      41              : 
      42              : private:
      43              :     bool flushOpcodeSupport_{false};
      44              :     bool flushIsInitialized{false};
      45              :     void* localMem{nullptr};
      46              :     void* deviceMem{nullptr};
      47              :     MrHandle localMrHandle{nullptr};
      48              :     MrHandle remoteMrHandle{nullptr};
      49              :     QpHandle qpHandle{nullptr};
      50              :     RdmaHandle rdmaHandle{nullptr};
      51              : 
      52              :     // 初始化方法
      53              :     HcclResult GetRdmaHandle(IpAddress ip, u32 devPhyId, void** rdmaHandle) const;
      54              :     HcclResult GetLbMax(int* lbMax) const;
      55              :     HcclResult AllocateDeviceMemory();
      56              :     HcclResult AllocateLocalMemory();
      57              :     HcclResult CreateLoopbackQp();
      58              :     HcclResult RegisterLocalMr();
      59              :     HcclResult RegisterRemoteMr();
      60              : 
      61              :     // 销毁方法
      62              :     HcclResult DeregisterMr(MrHandle& mrHandle, std::string logTag) const;
      63              :     HcclResult DestroyLoopbackQp();
      64              :     HcclResult FreeLocalMemory();
      65              :     HcclResult FreeDeviceMemory();
      66              : };
      67              : 
      68              : } // namespace Hccl
      69              : 
      70              : #endif
        

Generated by: LCOV version 2.0-1