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