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 <thread>
11 : #include <map>
12 : #include "aicpu_engine.h"
13 : #include "ascend_hal.h"
14 : #include "aicpusd_threads_process.h"
15 : #include "aicpusd_info.h"
16 : #include "aicpusd_worker.h"
17 : #include "aicpusd_cust_so_manager.h"
18 :
19 : using namespace AicpuSchedule;
20 :
21 : namespace {
22 : // just for auto init instance of AicpuCustSoManager, variable is unused
23 : auto g_custSoMgrInitRet __attribute__((unused)) =
24 : AicpuSchedule::AicpuCustSoManager::GetInstance().InitAicpuCustSoManager(aicpu::AicpuRunMode::THREAD_MODE,
25 : SCHED_MODE_INTERRUPT);
26 : }
27 :
28 1 : ComputeProcess::ComputeProcess() {}
29 :
30 1 : void ComputeProcess::UpdateProfilingMode(ProfilingMode mode) const {}
31 :
32 1 : void ComputeProcess::UpdateProfilingModelMode(const bool mode) const {}
33 :
34 1 : ComputeProcess& ComputeProcess::GetInstance()
35 : {
36 1 : static ComputeProcess instance;
37 1 : return instance;
38 : }
39 :
40 1 : int32_t ComputeProcess::Start(const std::vector<uint32_t> &deviceVec,
41 : const pid_t hostPid,
42 : const std::string &pidSign,
43 : const uint32_t profilingMode,
44 : const uint32_t vfId,
45 : const aicpu::AicpuRunMode runMode)
46 : {
47 1 : return 0;
48 : }
49 :
50 1 : void ComputeProcess::Stop()
51 : {
52 1 : return;
53 : }
54 :
55 1 : bool ComputeProcess::DoSplitKernelTask(const AICPUSharderTaskInfo &taskInfo)
56 : {
57 : (void)taskInfo;
58 1 : return true;
59 : }
60 :
61 1 : bool ComputeProcess::DoRandomKernelTask() {return true;}
62 :
63 1 : uint32_t ComputeProcess::SubmitRandomKernelTask(const aicpu::Closure &task)
64 : {
65 : (void)task;
66 1 : return 0U;
67 : }
68 1 : uint32_t ComputeProcess::SubmitSplitKernelTask(const AICPUSharderTaskInfo &taskInfo,
69 : const std::queue<aicpu::Closure> &taskQueue)
70 : {
71 : (void)taskInfo;
72 : (void)taskQueue;
73 1 : return 0U;
74 : }
75 1 : uint32_t ComputeProcess::SubmitBatchSplitKernelEventOneByOne(const AICPUSharderTaskInfo &taskInfo) const
76 : {
77 : (void)taskInfo;
78 1 : return 0U;
79 : }
80 1 : uint32_t ComputeProcess::SubmitBatchSplitKernelEventDc(const AICPUSharderTaskInfo &taskInfo)
81 : {
82 : (void)taskInfo;
83 1 : return 0U;
84 : }
85 1 : uint32_t ComputeProcess::SubmitOneSplitKernelEvent(const AICPUSharderTaskInfo &taskInfo) const
86 : {
87 : (void)taskInfo;
88 1 : return 0U;
89 : }
90 1 : bool ComputeProcess::GetAndDoSplitKernelTask() {return true;}
91 :
92 1 : drvError_t halQueueSubscribe(unsigned int devid, unsigned int qid, unsigned int groupId, int type)
93 : {
94 1 : return DRV_ERROR_NONE;
95 : }
96 :
97 1 : drvError_t halQueueUnsubscribe(unsigned int devid, unsigned int qid)
98 : {
99 1 : return DRV_ERROR_NONE;
100 : }
101 :
102 0 : int SetQueueWorkMode(unsigned int devid, unsigned int qid, int mode)
103 : {
104 0 : return DRV_ERROR_NONE;
105 : }
106 :
107 1 : drvError_t halQueueSubF2NFEvent(unsigned int devid, unsigned int qid, unsigned int groupid)
108 : {
109 1 : return DRV_ERROR_NONE;
110 : }
111 :
112 1 : drvError_t halQueueSet(unsigned int devId, QueueSetCmdType cmd, QueueSetInputPara *input)
113 : {
114 1 : return DRV_ERROR_NONE;
115 : }
116 :
117 1 : drvError_t halQueueUnsubF2NFEvent(unsigned int devid, unsigned int qid)
118 : {
119 1 : return DRV_ERROR_NONE;
120 : }
121 :
122 1 : drvError_t halQueueDeQueue(unsigned int devId, unsigned int qid, void **mbug)
123 : {
124 1 : return DRV_ERROR_NONE;
125 : }
126 :
127 1 : drvError_t halQueueEnQueue(unsigned int devId, unsigned int qid, void *mbuf)
128 : {
129 1 : return DRV_ERROR_NONE;
130 : }
131 :
132 1 : int halMbufGetBuffAddr(Mbuf *mbuf, void **buf)
133 : {
134 1 : return DRV_ERROR_NONE;
135 : }
136 :
137 1 : int halMbufSetDataLen (Mbuf *mbuf, uint64_t len)
138 : {
139 1 : return DRV_ERROR_NONE;
140 : }
141 :
142 1 : int halMbufGetDataLen(Mbuf *mbuf, uint64_t *len)
143 : {
144 1 : return DRV_ERROR_NONE;
145 : }
146 :
147 1 : int halMbufAllocEx(uint64_t size, unsigned int align, unsigned long flag, int grp_id, Mbuf **mbuf)
148 : {
149 1 : return DRV_ERROR_NONE;
150 : }
151 :
152 1 : int halMbufFree(Mbuf *mbuf)
153 : {
154 1 : return DRV_ERROR_NONE;
155 : }
156 :
157 1 : int halMbufGetPrivInfo (Mbuf *mbuf, void **priv, unsigned int *size)
158 : {
159 1 : return DRV_ERROR_NONE;
160 : }
161 :
162 1 : drvError_t halQueueInit(unsigned int devid)
163 : {
164 1 : return DRV_ERROR_NONE;
165 : }
166 :
167 0 : int buff_get_phy_addr (void *buf, unsigned long long *phyAddr)
168 : {
169 0 : return 0;
170 : }
171 :
172 1 : drvError_t drvHdcGetCapacity(struct drvHdcCapacity *capacity)
173 : {
174 1 : return DRV_ERROR_NONE;
175 : }
176 :
177 1 : int halMbufChainGetMbuf(Mbuf *mbufChainHead, unsigned int index, Mbuf **mbuf)
178 : {
179 1 : return DRV_ERROR_NONE;
180 : }
181 :
182 1 : int halMbufChainGetMbufNum(Mbuf *mbufChainHead, unsigned int *num)
183 : {
184 1 : return DRV_ERROR_NONE;
185 : }
186 :
187 1 : int halMbufChainAppend(Mbuf *mbufChainHead, Mbuf *mbuf)
188 : {
189 1 : return DRV_ERROR_NONE;
190 : }
191 :
192 :
193 1 : int halTsDevRecord(unsigned int devId, unsigned int tsId, unsigned int record_type, unsigned int record_Id)
194 : {
195 1 : return 0;
196 : }
197 :
198 1 : drvError_t drvBindHostPid(struct drvBindHostpidInfo info)
199 : {
200 1 : return DRV_ERROR_NONE;
201 : }
202 :
203 : namespace AicpuSchedule {
204 1 : ThreadPool &ThreadPool::Instance()
205 : {
206 1 : static ThreadPool threadPool;
207 1 : return threadPool;
208 : }
209 :
210 1 : void ThreadPool::WaitForStop()
211 : {
212 1 : return;
213 : }
214 :
215 2 : ThreadPool::ThreadPool() : semInitedNum_(0) {}
216 :
217 2 : ThreadPool::~ThreadPool() {}
218 : }
219 :
220 1 : int halGetDeviceVfMax(unsigned int devId, unsigned int *vf_max_num)
221 : {
222 : (void)devId;
223 : (void)vf_max_num;
224 1 : return DRV_ERROR_NONE;
225 : }
226 :
227 1 : int halGetDeviceVfList(unsigned int devId, unsigned int *vf_list, unsigned int list_len, unsigned int *vf_num)
228 : {
229 : (void)devId;
230 : (void)vf_list;
231 : (void)list_len;
232 : (void)vf_num;
233 1 : return DRV_ERROR_NONE;
234 : }
|