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 RTS_NOTIFY_H
12 : #define RTS_NOTIFY_H
13 :
14 : #include "notify_base.h"
15 :
16 : namespace hccl {
17 :
18 : class RtsNotify : public NotifyBase {
19 : public:
20 : explicit RtsNotify(NotifyType notifyType);
21 : RtsNotify(NotifyType notifyType, HcclNotifyInfo notifyInfo);
22 : RtsNotify(NotifyType notifyType, const HcclSignalInfo ¬ifyInfo);
23 : ~RtsNotify() override;
24 :
25 : HcclResult Alloc() override;
26 : HcclResult Destroy() override;
27 :
28 : HcclResult Open() override;
29 : HcclResult Close() override;
30 :
31 : HcclResult Wait(Stream& stream, HcclDispatcher dispatcher, s32 stage, u32 timeOut) override;
32 : HcclResult Post(Stream& stream, HcclDispatcher dispatcher, s32 stage) override;
33 :
34 : HcclResult Wait(Stream& stream, HcclDispatcher dispatcher, s32 stage, u32 timeOut,
35 : u32 userRank, u32 remoteUserRank) override;
36 : HcclResult Wait(Stream& stream, u32 timeOut) override;
37 : HcclResult Post(Stream& stream, HcclDispatcher dispatcher, s32 stage,
38 : u32 remoteUserRank) override;
39 : HcclResult Post(Stream& stream) override;
40 :
41 : HcclResult SetIpc() override;
42 : HcclResult Grant(s64 recvId) override;
43 :
44 8118 : HcclResult GetNotifyData(HcclSignalInfo ¬ifyInfo) override
45 : {
46 8118 : notifyInfo.resId = static_cast<u64>(id);
47 8118 : notifyInfo.addr = address;
48 8118 : notifyInfo.devId = devId;
49 8118 : notifyInfo.tsId = tsId;
50 8118 : notifyInfo.flag = flag;
51 8118 : HCCL_DEBUG("GetNotifyData resId[%lld], addr[%llu], devId[%u], tsId[%u]", notifyInfo.resId,
52 : notifyInfo.addr, notifyInfo.devId, notifyInfo.tsId);
53 8124 : return HCCL_SUCCESS;
54 : }
55 :
56 4353 : HcclResult SetNotifyData(const HcclSignalInfo ¬ifyInfo) override
57 : {
58 4353 : id = notifyInfo.resId;
59 4353 : address = notifyInfo.addr;
60 4353 : devId = notifyInfo.devId;
61 4353 : tsId = notifyInfo.tsId;
62 4353 : flag = notifyInfo.flag;
63 4353 : HCCL_DEBUG("SetNotifyData resId[%lld], addr[%llu], devId[%u], tsId[%u]", id, address, devId, tsId);
64 4353 : return HCCL_SUCCESS;
65 : }
66 :
67 11 : HcclResult GetNotifyOffset(u64 ¬ifyOffset) override
68 : {
69 11 : notifyOffset = notifyInfo_.ipcNotify.offset;
70 11 : return HCCL_SUCCESS;
71 : }
72 :
73 : HcclResult InitAndVerifySingleSignal();
74 : private:
75 : HcclResult UpdateNotifyInfo();
76 :
77 : bool isDestroyed{false};
78 : bool inchip{true};
79 : bool isLocal{true};
80 :
81 : u32 id{INVALID_UINT};
82 : u64 address{INVALID_U64};
83 : u32 size{INVALID_UINT};
84 : u32 devId{INVALID_UINT};
85 : u32 tsId{INVALID_UINT};
86 : u32 flag{INVALID_UINT};
87 : };
88 :
89 : }
90 :
91 : #endif // RTS_NOTIFY_H
|