LCOV - code coverage report
Current view: top level - legacy/ascend950/unified_platform/resource/buffer - local_rma_buffer.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 85.0 % 20 17
Test Date: 2026-07-28 12:11:00 Functions: 81.8 % 11 9

            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_H
      12              : #define HCCLV2_LOCAL_RMA_BUFFER_H
      13              : 
      14              : #include <string>
      15              : #include <memory>
      16              : #include <vector>
      17              : 
      18              : #include "buffer.h"
      19              : #include "rma_type.h"
      20              : 
      21              : #include "serializable.h"
      22              : #include "rma_buffer_lite.h"
      23              : 
      24              : namespace Hccl {
      25              : 
      26              : class LocalRmaBuffer {
      27              : public:
      28          819 :     LocalRmaBuffer(std::shared_ptr<Buffer> buf, RmaType type) : buf(buf), rmaType(type)
      29              :     {
      30          819 :     }
      31              : 
      32           13 :     LocalRmaBuffer(std::shared_ptr<Buffer> buf, RmaType type, bool isAlias) : buf(buf), rmaType(type), isAlias_(isAlias)
      33              :     {
      34           13 :     }
      35              : 
      36          830 :     virtual ~LocalRmaBuffer() = default;
      37              : 
      38              :     virtual std::string Describe() const = 0;
      39              : 
      40          252 :     Buffer *GetBuf() const
      41              :     {
      42          252 :         return buf.get();
      43              :     }
      44              : 
      45            2 :     RmaType GetRmaType() const // used for grant check
      46              :     {
      47            2 :         return rmaType;
      48              :     }
      49              : 
      50           38 :     bool IsAlias() const
      51              :     {
      52           38 :         return isAlias_;
      53              :     }
      54              : 
      55            8 :     u64 GetMemHandle() const
      56              :     {
      57            8 :         return memHandle;
      58              :     }
      59              : 
      60          135 :     size_t GetSize() const
      61              :     {
      62          135 :         return buf->GetSize();
      63              :     }
      64              :  
      65          137 :     uintptr_t GetAddr() const
      66              :     {
      67          137 :         return buf->GetAddr();
      68              :     }
      69              : 
      70            0 :     virtual std::unique_ptr<Serializable> GetExchangeDto()
      71              :     {
      72            0 :         HCCL_ERROR("this is base class, not support.");
      73            0 :         return nullptr;
      74              :     }
      75              : 
      76              : protected:
      77              :     std::shared_ptr<Buffer> buf;
      78              :     RmaType                 rmaType;
      79              :     u64                     memHandle{0};
      80              :     bool                    isAlias_{false};  // 区分该RmaBuffer对象是否为某一注册Buffer的子集
      81              : };
      82              : 
      83              : } // namespace Hccl
      84              : #endif
        

Generated by: LCOV version 2.0-1