LCOV - code coverage report
Current view: top level - legacy/ascend950/framework/resource_manager/buffer - local_rma_buf_manager.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 1 1
Test Date: 2026-08-29 17:38:31 Functions: 100.0 % 1 1

            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 HCCLV2_LOCAL_RMA_BUFFER_MANAGER_H
      12              : #define HCCLV2_LOCAL_RMA_BUFFER_MANAGER_H
      13              : 
      14              : #include <string>
      15              : #include <memory>
      16              : #include <unordered_map>
      17              : #include <vector>
      18              : #include "virtual_topo.h"
      19              : #include "dev_buffer.h"
      20              : #include "local_rma_buffer.h"
      21              : #include "buffer_type.h"
      22              : 
      23              : namespace Hccl {
      24              : // Keep fake registration isolated from the real CCL buffer registered under commId.
      25            4 : inline string GetAivUrmaBufferTag(const string& commId) { return commId + "_aiv_urma"; }
      26              : 
      27              : class CommunicatorImpl;
      28              : class LocalRmaBufManager {
      29              : public:
      30              :     explicit LocalRmaBufManager(const CommunicatorImpl& communicator);
      31              : 
      32              :     ~LocalRmaBufManager();
      33              : 
      34              :     LocalRmaBuffer*
      35              :     Reg(const string& opTag, BufferType bufferType, std::shared_ptr<Buffer> buffer, const PortData& portData,
      36              :         LinkProtocol linkProtocol);
      37              : 
      38              :     HcclResult Dereg(const string& opTag);
      39              : 
      40              :     LocalRmaBuffer* Get(const string& opTag, const PortData& portData, BufferType bufferType);
      41              : 
      42              :     LocalRmaBuffer* Get(const PortData& portData);
      43              : 
      44              :     void Destroy();
      45              : 
      46              : private:
      47              :     CommunicatorImpl* comm;
      48              : 
      49              :     bool IsExist(const string& opTag, const PortData& portData, BufferType bufferType);
      50              : 
      51              :     unordered_map<
      52              :         string,
      53              :         unordered_map<
      54              :             PortData, unordered_map<BufferType, unique_ptr<LocalRmaBuffer>, EnumClassHash>, hash<Hccl::PortData>>>
      55              :         bufs;
      56              : 
      57              :     unordered_map<PortData, unique_ptr<LocalRmaBuffer>, hash<Hccl::PortData>> ccuBufs;
      58              : };
      59              : 
      60              : } // namespace Hccl
      61              : #endif
        

Generated by: LCOV version 2.0-1