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 : }
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 : }
39 :
40 : namespace {
41 : // current thread context
42 : thread_local aicpu::aicpuContext_t g_curCtx;
43 : }
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 : }
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 : {
74 3 : }
75 3 : EventWaitManager &EventWaitManager::NotifyWaitManager(const uint32_t waitIdCount)
76 : {
77 5 : static EventWaitManager notifyWaitInstance("Notify", waitIdCount);
78 3 : return notifyWaitInstance;
79 : }
80 :
81 3 : EventWaitManager &EventWaitManager::EndGraphWaitManager(const uint32_t waitIdCount)
82 : {
83 5 : static EventWaitManager endGraphWaitInstance("EndGraph", waitIdCount);
84 3 : return endGraphWaitInstance;
85 : }
86 :
87 3 : EventWaitManager &EventWaitManager::QueueNotEmptyWaitManager(const uint32_t waitIdCount)
88 : {
89 5 : static EventWaitManager queueNotEmptyWaitInstance("QueueNotEmpty", waitIdCount);
90 3 : return queueNotEmptyWaitInstance;
91 : }
92 :
93 3 : EventWaitManager &EventWaitManager::QueueNotFullWaitManager(const uint32_t waitIdCount)
94 : {
95 5 : static EventWaitManager queueNotFullWaitInstance("QueueNotFull", waitIdCount);
96 3 : return queueNotFullWaitInstance;
97 : }
98 :
99 3 : EventWaitManager &EventWaitManager::PrepareMemWaitManager(const uint32_t waitIdCount)
100 : {
101 5 : static EventWaitManager prepareMemWaitInstance("PrepareMem", waitIdCount);
102 3 : return prepareMemWaitInstance;
103 : }
104 :
105 3 : EventWaitManager &EventWaitManager::AnyQueNotEmptyWaitManager(const uint32_t waitIdCount)
106 : {
107 5 : static EventWaitManager anyQueNotEmptyWaitInstance("AnyQueNotEmpty", waitIdCount);
108 3 : return anyQueNotEmptyWaitInstance;
109 : }
110 :
111 3 : EventWaitManager &EventWaitManager::TableUnlockWaitManager(const uint32_t waitIdCount)
112 : {
113 5 : static EventWaitManager tableUnlockWaitInstance("TableUnlock", waitIdCount);
114 3 : return tableUnlockWaitInstance;
115 : }
116 : }
|