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 : #include "aicpusd_monitor.h"
11 : #include "aicpusd_status.h"
12 : #include "tdt/status.h"
13 : #include "aicpu_context.h"
14 : #include "aicpu_pulse.h"
15 : #include "aicpusd_resource_manager.h"
16 : #include "aicpusd_util.h"
17 : #include "aicpusd_meminfo_process.h"
18 : #include "aicpusd_drv_manager.h"
19 :
20 : namespace AicpuSchedule {
21 1 : AicpuMonitor::AicpuMonitor() {}
22 3 : AicpuMonitor& AicpuMonitor::GetInstance()
23 : {
24 3 : static AicpuMonitor instance;
25 3 : return instance;
26 : }
27 1 : AicpuMonitor::~AicpuMonitor() {}
28 3 : void AicpuMonitor::DisableModelTimeout() {}
29 : } // namespace AicpuSchedule
30 : namespace tdt {
31 756 : StatusFactory* StatusFactory::GetInstance()
32 : {
33 756 : static StatusFactory instance_;
34 756 : return &instance_;
35 : }
36 756 : void StatusFactory::RegisterErrorNo(const uint32_t err, const std::string& desc) {}
37 1 : StatusFactory::StatusFactory() {}
38 : } // namespace tdt
39 :
40 : namespace {
41 : // current thread context
42 : thread_local aicpu::aicpuContext_t g_curCtx;
43 : } // namespace
44 :
45 : namespace aicpu {
46 7 : __attribute__((visibility("default"))) status_t aicpuSetContext(aicpuContext_t* ctx)
47 : {
48 7 : aicpusd_info("Aicpu set ctx in stub func[%s].", __func__);
49 7 : g_curCtx = *ctx;
50 7 : return AICPU_ERROR_NONE;
51 : }
52 :
53 0 : __attribute__((visibility("default"))) status_t aicpuGetContext(aicpuContext_t* ctx)
54 : {
55 0 : aicpusd_info("Aicpu get ctx in stub func[%s].", __func__);
56 0 : *ctx = g_curCtx;
57 0 : return AICPU_ERROR_NONE;
58 : }
59 : } // namespace aicpu
60 :
61 : namespace AicpuSchedule {
62 3 : BufManager& BufManager::GetInstance()
63 : {
64 3 : static BufManager instance;
65 3 : return instance;
66 : }
67 3 : ModelStreamManager& ModelStreamManager::GetInstance()
68 : {
69 3 : static ModelStreamManager instance;
70 3 : return instance;
71 : }
72 3 : void BufManager::InitBufManager() {}
73 3 : EventWaitManager& EventWaitManager::NotifyWaitManager(const uint32_t waitIdCount)
74 : {
75 5 : static EventWaitManager notifyWaitInstance("Notify", waitIdCount);
76 3 : return notifyWaitInstance;
77 : }
78 :
79 3 : EventWaitManager& EventWaitManager::EndGraphWaitManager(const uint32_t waitIdCount)
80 : {
81 5 : static EventWaitManager endGraphWaitInstance("EndGraph", waitIdCount);
82 3 : return endGraphWaitInstance;
83 : }
84 :
85 3 : EventWaitManager& EventWaitManager::QueueNotEmptyWaitManager(const uint32_t waitIdCount)
86 : {
87 5 : static EventWaitManager queueNotEmptyWaitInstance("QueueNotEmpty", waitIdCount);
88 3 : return queueNotEmptyWaitInstance;
89 : }
90 :
91 3 : EventWaitManager& EventWaitManager::QueueNotFullWaitManager(const uint32_t waitIdCount)
92 : {
93 5 : static EventWaitManager queueNotFullWaitInstance("QueueNotFull", waitIdCount);
94 3 : return queueNotFullWaitInstance;
95 : }
96 :
97 3 : EventWaitManager& EventWaitManager::PrepareMemWaitManager(const uint32_t waitIdCount)
98 : {
99 5 : static EventWaitManager prepareMemWaitInstance("PrepareMem", waitIdCount);
100 3 : return prepareMemWaitInstance;
101 : }
102 :
103 3 : EventWaitManager& EventWaitManager::AnyQueNotEmptyWaitManager(const uint32_t waitIdCount)
104 : {
105 5 : static EventWaitManager anyQueNotEmptyWaitInstance("AnyQueNotEmpty", waitIdCount);
106 3 : return anyQueNotEmptyWaitInstance;
107 : }
108 :
109 3 : EventWaitManager& EventWaitManager::TableUnlockWaitManager(const uint32_t waitIdCount)
110 : {
111 5 : static EventWaitManager tableUnlockWaitInstance("TableUnlock", waitIdCount);
112 3 : return tableUnlockWaitInstance;
113 : }
114 : } // namespace AicpuSchedule
|