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