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_v2.h"
14 : #include "rma_type.h"
15 : #include "serializable.h"
16 :
17 : namespace Hccl {
18 :
19 : class BaseLocalNotify {
20 : public:
21 184 : BaseLocalNotify(const RmaType& type, bool devUsed) : type(type)
22 : {
23 334 : HCCL_INFO("[BaseLocalNotify] init type[%d] devUsed[%d]", type, devUsed);
24 184 : notify = std::make_unique<RtsNotify>(devUsed);
25 184 : }
26 :
27 184 : 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 { return type; }
36 :
37 57 : std::vector<char> GetUniqueId() const { return notify->GetUniqueId(); }
38 :
39 0 : virtual std::unique_ptr<Serializable> GetExchangeDto()
40 : {
41 0 : MACRO_THROW(NotSupportException, StringFormat("not support."));
42 : }
43 :
44 245 : RtsNotify* GetNotify() const { return notify.get(); }
45 :
46 : protected:
47 : RmaType type;
48 :
49 : private:
50 : std::unique_ptr<RtsNotify> notify;
51 : };
52 : } // namespace Hccl
53 : #endif // !HCCLV2_LOCAL_NOTIFY_H
|