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 0 : {
26 0 : }
27 :
28 0 : ExchangeIpcNotifyDto(u64 handleAddr, u32 id, u32 pid, u32 devPhyId, bool devUsed)
29 0 : : handleAddr(handleAddr), id(id), pid(pid), devPhyId(devPhyId), devUsed(devUsed)
30 : {
31 0 : }
32 :
33 0 : void Serialize(Hccl::BinaryStream &stream) override
34 : {
35 0 : stream << handleAddr << id << pid << devPhyId << devUsed << name;
36 0 : }
37 :
38 0 : void Deserialize(Hccl::BinaryStream &stream) override
39 : {
40 0 : stream >> handleAddr >> id >> pid >> devPhyId >> devUsed >> name;
41 0 : }
42 :
43 0 : std::string Describe() const override
44 : {
45 0 : std::string strName(name, name + RTS_IPC_MEM_NAME_LEN);
46 : return StringFormat("ExchangeIpcNotifyDto[handleAddr=0x%llx, id=%u, pid=%u, devPhyId=%u, devUsed=%d, name=%s]",
47 0 : handleAddr, id, pid, devPhyId, devUsed, strName.c_str());
48 0 : }
49 :
50 : u64 handleAddr{0}; // 两rank处于相同Server, 相同进程下, 携带指针 RtNotify 的值
51 : u32 id{0};
52 : u32 pid{0};
53 : u32 devPhyId{0};
54 : bool devUsed{false};
55 : char_t name[RTS_IPC_MEM_NAME_LEN]{0};
56 : };
57 :
58 : } // namespace Hccl
59 :
60 : #endif
|