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 __COLL_COMM_AICPU_MGR_H__
12 : #define __COLL_COMM_AICPU_MGR_H__
13 :
14 : #include "coll_comm_aicpu.h"
15 :
16 : class CollCommAicpuMgr {
17 : public:
18 : HcclResult AcquireCollCommAicpu();
19 : HcclResult InitAicpuIndOp(CommAicpuParam *commAicpuParam);
20 : HcclResult InitThreads(ThreadMgrAicpuParam *param);
21 : HcclResult AllocChannelResource(HcclChannelUrmaRes *commParam);
22 : HcclResult UpdateChannelResource(HcclChannelUrmaRes *commParam);
23 : HcclResult NotifyFree(NotifyMgrAicpuParam *param);
24 : HcclResult NotifyAlloc(NotifyMgrAicpuParam *param);
25 :
26 : bool IsUsed();
27 : void SetUsed(bool used);
28 : void SetOldA5Comm(void *oldA5Comm);
29 9 : CollCommAicpu* GetCollCommAicpu() { return collCommAicpu_.get(); }
30 : private:
31 : void* oldA5Comm_{nullptr};
32 : std::unique_ptr<CollCommAicpu> collCommAicpu_{nullptr};
33 : std::shared_mutex isUsedMutex_;
34 : bool isUsed_{false};
35 : };
36 :
37 : #endif // __COLL_COMM_AICPU_MGR_H__
|