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_IPC_NOTIFY_DTO_H
12 : #define HCCLV2_EXCHANGE_IPC_NOTIFY_DTO_H
13 :
14 : #include <string>
15 : #include "serializable.h"
16 : #include "binary_stream.h"
17 : #include "string_util.h"
18 : #include "types.h"
19 : #include "binary_stream.h"
20 : #include "orion_adapter_rts.h"
21 : namespace Hccl {
22 :
23 : class ExchangeIpcNotifyDto : public Serializable { // Ipc Notify 需要交换的DTO
24 : public:
25 0 : ExchangeIpcNotifyDto() {}
26 :
27 0 : ExchangeIpcNotifyDto(u64 handleAddr, u32 id, u32 pid, u32 devPhyId, bool devUsed)
28 0 : : handleAddr(handleAddr),
29 0 : id(id),
30 0 : pid(pid),
31 0 : devPhyId(devPhyId),
32 0 : devUsed(devUsed)
33 0 : {}
34 :
35 0 : void Serialize(Hccl::BinaryStream& stream) override
36 : {
37 0 : stream << handleAddr << id << pid << devPhyId << devUsed << name;
38 0 : }
39 :
40 0 : void Deserialize(Hccl::BinaryStream& stream) override
41 : {
42 0 : stream >> handleAddr >> id >> pid >> devPhyId >> devUsed >> name;
43 0 : }
44 :
45 0 : std::string Describe() const override
46 : {
47 0 : std::string strName(name, name + RTS_IPC_MEM_NAME_LEN);
48 : return StringFormat(
49 0 : "ExchangeIpcNotifyDto[handleAddr=0x%llx, id=%u, pid=%u, devPhyId=%u, devUsed=%d, name=%s]", handleAddr, id,
50 0 : pid, devPhyId, devUsed, strName.c_str());
51 0 : }
52 :
53 : u64 handleAddr{0}; // 两rank处于相同Server, 相同进程下, 携带指针 RtNotify 的值
54 : u32 id{0};
55 : u32 pid{0};
56 : u32 devPhyId{0};
57 : bool devUsed{false};
58 : char_t name[RTS_IPC_MEM_NAME_LEN]{0};
59 : };
60 :
61 : } // namespace Hccl
62 :
63 : #endif
|