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_RDMA_BUFFER_DTO_H
11 : #define HCCLV2_EXCHANGE_RDMA_BUFFER_DTO_H
12 : #include <map>
13 : #include <string>
14 : #include "serializable.h"
15 : #include "orion_adapter_hccp.h"
16 : namespace Hccl {
17 :
18 : class ExchangeRdmaBufferDto : public Serializable { // RDMA RMA Buffer / Notify 需要交换的DTO
19 : public:
20 9 : ExchangeRdmaBufferDto() {}
21 :
22 8 : ExchangeRdmaBufferDto(u64 addr, u64 size, u32 rkey, const char* memInfo)
23 16 : : addr(addr),
24 8 : size(size),
25 8 : rkey(rkey),
26 16 : memInfo(memInfo)
27 8 : {}
28 :
29 1 : void Serialize(Hccl::BinaryStream& stream) override { stream << addr << size << rkey << memInfo; }
30 :
31 0 : void Deserialize(Hccl::BinaryStream& stream) override { stream >> addr >> size >> rkey >> memInfo; }
32 :
33 0 : std::string Describe() const override
34 : {
35 0 : return StringFormat("ExchangeRdmaBufferDto[addr=0x%llx, size=0x%llx, memInfo=%s]", addr, size, memInfo.c_str());
36 : }
37 :
38 : u64 addr{0};
39 : u64 size{0};
40 : u32 rkey{0};
41 : std::string memInfo{""};
42 : };
43 :
44 : } // namespace Hccl
45 :
46 : #endif
|