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 3 : ExchangeRdmaBufferDto()
21 6 : {
22 3 : }
23 :
24 8 : ExchangeRdmaBufferDto(u64 addr, u64 size, u32 rkey, const char *memInfo)
25 16 : : addr(addr), size(size), rkey(rkey), memInfo(memInfo)
26 : {
27 8 : }
28 :
29 1 : void Serialize(Hccl::BinaryStream &stream) override
30 : {
31 1 : stream << addr << size << rkey << memInfo;
32 1 : }
33 :
34 0 : void Deserialize(Hccl::BinaryStream &stream) override
35 : {
36 0 : stream >> addr >> size >> rkey >> memInfo;
37 0 : }
38 :
39 0 : std::string Describe() const override
40 : {
41 0 : return StringFormat("ExchangeRdmaBufferDto[addr=0x%llx, size=0x%llx, memInfo=%s]", addr, size,
42 0 : memInfo.c_str());
43 : }
44 :
45 : u64 addr{0};
46 : u64 size{0};
47 : u32 rkey{0};
48 : std::string memInfo{""};
49 : };
50 :
51 : } // namespace Hccl
52 :
53 : #endif
|