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