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 : #include "notify_pool.h"
12 : #include "notify_pool_impl.h"
13 :
14 : namespace hccl {
15 547 : NotifyPool::NotifyPool() {}
16 :
17 547 : NotifyPool::~NotifyPool() { pimpl_ = nullptr; }
18 :
19 527 : HcclResult NotifyPool::Init(const s32 devicePhyId)
20 : {
21 527 : pimpl_.reset((new (std::nothrow) NotifyPoolImpl(devicePhyId)));
22 527 : CHK_SMART_PTR_NULL(pimpl_);
23 527 : return pimpl_->Init();
24 : }
25 :
26 0 : HcclResult NotifyPool::Destroy()
27 : {
28 0 : CHK_SMART_PTR_NULL(pimpl_);
29 0 : return pimpl_->Destroy();
30 : }
31 :
32 56 : HcclResult NotifyPool::RegisterOp(const std::string& tag)
33 : {
34 56 : CHK_SMART_PTR_NULL(pimpl_);
35 56 : return pimpl_->RegisterOp(tag);
36 : }
37 :
38 1 : HcclResult NotifyPool::UnregisterOp(const std::string& tag)
39 : {
40 1 : CHK_SMART_PTR_NULL(pimpl_);
41 1 : return pimpl_->UnregisterOp(tag);
42 : }
43 :
44 1 : HcclResult NotifyPool::Alloc(
45 : const std::string& tag, const RemoteRankInfo& info, std::shared_ptr<LocalIpcNotify>& localNotify,
46 : const NotifyLoadType type, u32 offsetAlignSize)
47 : {
48 1 : CHK_SMART_PTR_NULL(pimpl_);
49 1 : return pimpl_->Alloc(tag, info, type, localNotify, offsetAlignSize);
50 : }
51 :
52 0 : HcclResult NotifyPool::ResetNotify()
53 : {
54 0 : CHK_SMART_PTR_NULL(pimpl_);
55 0 : return pimpl_->ResetNotify();
56 : }
57 :
58 0 : HcclResult NotifyPool::ResetNotifyForDestRank(s64 destRank)
59 : {
60 0 : CHK_SMART_PTR_NULL(pimpl_);
61 0 : return pimpl_->ResetNotifyForDestRank(destRank);
62 : }
63 : } // namespace hccl
|