LCOV - code coverage report
Current view: top level - legacy/ascend950/unified_platform/resource/buffer - exchange_ub_buffer_dto.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 27 27
Test Date: 2026-08-17 10:19:35 Functions: 100.0 % 6 6

            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              : #ifndef HCCLV2_EXCHANGE_UB_BUFFER_DTO_H
      11              : #define HCCLV2_EXCHANGE_UB_BUFFER_DTO_H
      12              : #include <map>
      13              : #include <string>
      14              : #include "serializable.h"
      15              : #include "orion_adapter_hccp.h"
      16              : #include "hccl_one_sided_data.h"
      17              : namespace Hccl {
      18              : 
      19              : class ExchangeUbBufferDto : public Serializable { // UB RMA Buffer / Notify /CntNotify 需要交换的DTO
      20              : public:
      21           13 :     ExchangeUbBufferDto() {}
      22              : 
      23            4 :     ExchangeUbBufferDto(u64 addr, u64 size, u32 tokenValue, u32 tokenId, u32 keySize, u32 notifyId)
      24            8 :         : addr(addr),
      25            4 :           size(size),
      26            4 :           tokenValue(tokenValue),
      27            4 :           tokenId(tokenId),
      28            4 :           keySize(keySize),
      29            4 :           notifyId(notifyId)
      30            4 :     {}
      31              : 
      32           14 :     ExchangeUbBufferDto(
      33              :         u64 addr, u64 size, HcclMemType memType, const char* memInfo, u32 tokenValue, u32 tokenId, u32 keySize)
      34           28 :         : addr(addr),
      35           14 :           size(size),
      36           14 :           memType(memType),
      37           14 :           memInfo(memInfo),
      38           14 :           tokenValue(tokenValue),
      39           14 :           tokenId(tokenId),
      40           14 :           keySize(keySize)
      41           14 :     {}
      42              : 
      43           17 :     void Serialize(Hccl::BinaryStream& stream) override
      44              :     {
      45           17 :         stream << addr << size << memType << memInfo << tokenValue << tokenId << keySize << key << segVa << notifyId;
      46           17 :     }
      47              : 
      48           11 :     void Deserialize(Hccl::BinaryStream& stream) override
      49              :     {
      50           11 :         stream >> addr >> size >> memType >> memInfo >> tokenValue >> tokenId >> keySize >> key >> segVa >> notifyId;
      51           11 :     }
      52              : 
      53           19 :     std::string Describe() const override
      54              :     {
      55              :         return StringFormat(
      56           19 :             "ExchangeUbBufferDto[addr=0x%llx, size=0x%llx keySize=%u memInfo %s, notifyId=%u]", addr, size, keySize,
      57           19 :             memInfo.c_str(), notifyId);
      58              :     }
      59              : 
      60              :     u64 addr{0};
      61              :     u64 size{0};
      62              :     HcclMemType memType{HcclMemType::HCCL_MEM_TYPE_DEVICE};
      63              :     std::string memInfo;
      64              :     u8 key[HRT_UB_MEM_KEY_MAX_LEN]{0};
      65              :     u32 tokenValue{0};
      66              :     u32 tokenId{0};
      67              :     u32 keySize{0};
      68              :     u64 segVa{0};
      69              :     u32 notifyId{UINT32_MAX};
      70              : };
      71              : 
      72              : } // namespace Hccl
      73              : 
      74              : #endif
        

Generated by: LCOV version 2.0-1