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_LOCAL_NOTIFY_H
11 : #define HCCLV2_LOCAL_NOTIFY_H
12 :
13 : #include "rts_notify.h"
14 : #include "rma_type.h"
15 : #include "serializable.h"
16 :
17 : namespace Hccl {
18 :
19 : class BaseLocalNotify {
20 : public:
21 177 : BaseLocalNotify(const RmaType &type, bool devUsed) : type(type)
22 : {
23 313 : HCCL_INFO("[BaseLocalNotify] init type[%d] devUsed[%d]", type, devUsed);
24 177 : notify = std::make_unique<RtsNotify>(devUsed);
25 177 : }
26 :
27 177 : virtual ~BaseLocalNotify() = default;
28 :
29 : virtual string Describe() const = 0;
30 :
31 : virtual void Wait(const Stream &stream, u32 timeout) const = 0;
32 :
33 : virtual void Post(const Stream &stream) const = 0;
34 :
35 : const RmaType &GetType() const
36 : {
37 : return type;
38 : }
39 :
40 53 : std::vector<char> GetUniqueId() const
41 : {
42 53 : return notify->GetUniqueId();
43 : }
44 :
45 0 : virtual std::unique_ptr<Serializable> GetExchangeDto()
46 : {
47 0 : MACRO_THROW(NotSupportException, StringFormat("not support."));
48 : }
49 :
50 221 : RtsNotify* GetNotify() const
51 : {
52 221 : return notify.get();
53 : }
54 :
55 : protected:
56 : RmaType type;
57 :
58 : private:
59 : std::unique_ptr<RtsNotify> notify;
60 : };
61 : } // namespace Hccl
62 : #endif // !HCCLV2_LOCAL_NOTIFY_H
|