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 <list>
11 : #include "profiling_adp.h"
12 : #include "aicpu_engine.h"
13 : #include "ascend_hal.h"
14 : #include "task_queue.h"
15 : #include "dump_task.h"
16 : #include "aicpusd_status.h"
17 : #include "aicpu_async_event.h"
18 : #include "aicpusd_mpi_mgr.h"
19 : #include "aicpusd_task_queue.h"
20 : #include "aicpusd_queue_event_process.h"
21 : #include "aicpusd_context.h"
22 : #include "tdt/status.h"
23 : #include "tsd.h"
24 : #include "common/type_def.h"
25 :
26 : namespace aicpu {
27 : #ifdef __cplusplus
28 : extern "C" {
29 : #endif
30 :
31 1 : bool IsProfOpen()
32 : {
33 1 : return false;
34 : }
35 :
36 1 : bool IsModelProfOpen()
37 : {
38 1 : return false;
39 : }
40 :
41 1 : void UpdateMode(bool mode)
42 : {
43 : (void)mode;
44 1 : }
45 1 : void UpdateModelMode(const bool mode)
46 : {
47 : (void)mode;
48 1 : }
49 :
50 1 : uint64_t GetSystemTick()
51 : {
52 1 : return 0;
53 : }
54 :
55 1 : uint64_t GetSystemTickFreq()
56 : {
57 1 : return 0;
58 : }
59 :
60 1 : void SendToProfiling(const std::string &sendData, const std::string &mark)
61 : {
62 : UNUSED(sendData);
63 : UNUSED(mark);
64 1 : }
65 :
66 1 : int32_t SetProfHandle(std::shared_ptr<ProfMessage> prof)
67 : {
68 : UNUSED(prof);
69 1 : return 0;
70 : }
71 :
72 1 : uint64_t NowMicros()
73 : {
74 1 : return 1;
75 : }
76 :
77 1 : void ReleaseProfiling()
78 : {
79 1 : }
80 :
81 1 : void InitProfiling(const uint32_t deviceId, const pid_t hostPid, const uint32_t channelId)
82 : {
83 : UNUSED(deviceId);
84 : UNUSED(hostPid);
85 : UNUSED(channelId);
86 1 : }
87 :
88 0 : void InitProfilingDataInfo(const uint32_t deviceId, const pid_t hostPid, const uint32_t channelId)
89 : {
90 : UNUSED(deviceId);
91 : UNUSED(hostPid);
92 : UNUSED(channelId);
93 0 : }
94 :
95 0 : void SetProfilingFlagForKFC(const uint32_t flag)
96 : {
97 : UNUSED(flag);
98 0 : }
99 0 : void LoadProfilingLib()
100 : {
101 0 : }
102 : #ifdef __cplusplus
103 : }
104 : #endif
105 :
106 1 : ProfMessage::ProfMessage(const char* tag) : tag_(tag)
107 : {
108 1 : }
109 :
110 1 : ProfMessage::~ProfMessage()
111 : {
112 1 : }
113 :
114 1 : int32_t ProfModelMessage::ReportProfModelMessage()
115 : {
116 1 : return 0;
117 : }
118 :
119 1 : int32_t SetMsprofReporterCallback(MsprofReporterCallback reportCallback)
120 : {
121 : UNUSED(reportCallback);
122 1 : return 0;
123 : }
124 : } // namespace aicpu
125 :
126 1 : int32_t aeCallInterface(const void * const addr)
127 : {
128 : UNUSED(addr);
129 1 : return AE_STATUS_SUCCESS;
130 : }
131 :
132 1 : aeStatus_t aeBatchLoadKernelSo(const uint32_t kernelType,
133 : const uint32_t loadSoNum,
134 : const char * const * const soNames)
135 : {
136 : UNUSED(kernelType);
137 : UNUSED(loadSoNum);
138 : UNUSED(soNames);
139 1 : return AE_STATUS_SUCCESS;
140 : }
141 :
142 1 : aeStatus_t aeCloseSo(uint32_t kernelType, const char *soName)
143 : {
144 : UNUSED(kernelType);
145 : UNUSED(soName);
146 1 : return AE_STATUS_SUCCESS;
147 : }
148 :
149 1 : drvError_t drvHdcGetCapacity(struct drvHdcCapacity *capacity)
150 : {
151 : UNUSED(capacity);
152 1 : return DRV_ERROR_NONE;
153 : }
154 :
155 1 : int32_t TsdDestroy(const uint32_t deviceId, const TsdWaitType waitType, const uint32_t hostPid, const uint32_t vfId)
156 : {
157 : UNUSED(deviceId);
158 : UNUSED(waitType);
159 : UNUSED(hostPid);
160 : UNUSED(vfId);
161 1 : return 0;
162 : }
163 :
164 1 : int32_t StartupResponse(const uint32_t deviceId, const TsdWaitType waitType,
165 : const uint32_t hostPid, const uint32_t vfId)
166 : {
167 : UNUSED(deviceId);
168 : UNUSED(waitType);
169 : UNUSED(hostPid);
170 : UNUSED(vfId);
171 1 : return 0;
172 : }
173 :
174 1 : int32_t WaitForShutDown(const uint32_t deviceId)
175 : {
176 : UNUSED(deviceId);
177 1 : return 0;
178 : }
179 :
180 1 : int32_t StopWaitForCustAicpu()
181 : {
182 1 : return 0;
183 : }
184 :
185 : namespace AicpuSchedule {
186 1 : StatusCode GetAicpuDeployContext(DeployContext &deployContext)
187 : {
188 1 : deployContext = DeployContext::HOST;
189 1 : return AICPU_SCHEDULE_OK;
190 : }
191 :
192 8 : OpDumpTaskManager &OpDumpTaskManager::GetInstance()
193 : {
194 8 : static OpDumpTaskManager instance;
195 8 : return instance;
196 : }
197 :
198 1 : void OpDumpTaskManager::ClearResource()
199 : {
200 1 : }
201 :
202 1 : int32_t OpDumpTaskManager::DumpOpInfo(TaskInfoExt &dumpTaskInfo,
203 : const uint32_t streamId, const uint32_t taskId,
204 : const uint32_t contextId, const uint32_t threadId)
205 : {
206 : UNUSED(dumpTaskInfo);
207 : UNUSED(streamId);
208 : UNUSED(taskId);
209 : UNUSED(contextId);
210 : UNUSED(threadId);
211 1 : return AICPU_SCHEDULE_OK;
212 : }
213 2 : int32_t OpDumpTaskManager::DumpOpInfo(const uint32_t streamId, const uint32_t taskId,
214 : const uint32_t streamId1, const uint32_t taskId1)
215 : {
216 : UNUSED(streamId);
217 : UNUSED(taskId);
218 : UNUSED(streamId1);
219 : UNUSED(taskId1);
220 2 : return AICPU_SCHEDULE_OK;
221 : }
222 :
223 :
224 1 : int32_t OpDumpTaskManager::DumpOpInfo(TaskInfoExt &dumpTaskInfo,
225 : const DumpFileName &dumpFileName)
226 : {
227 : UNUSED(dumpTaskInfo);
228 : UNUSED(dumpFileName);
229 1 : return AICPU_SCHEDULE_OK;
230 : }
231 :
232 1 : int32_t OpDumpTaskManager::DumpOpInfoForUnknowShape(const uint64_t opMappingInfoAddr,
233 : const uint64_t opMappingInfoLen) const
234 : {
235 : UNUSED(opMappingInfoAddr);
236 : UNUSED(opMappingInfoLen);
237 1 : return AICPU_SCHEDULE_OK;
238 : }
239 :
240 0 : int32_t OpDumpTaskManager::LoadOpMappingInfo(const char_t * const infoAddr, const uint32_t len,
241 : AicpuSqeAdapter &aicpuSqeAdapter)
242 : {
243 : UNUSED(infoAddr);
244 : UNUSED(len);
245 : UNUSED(aicpuSqeAdapter);
246 0 : return AICPU_SCHEDULE_OK;
247 : }
248 2 : int32_t OpDumpTaskManager::LoadOpMappingInfo(const char_t * const infoAddr, const uint32_t len)
249 : {
250 : UNUSED(infoAddr);
251 : UNUSED(len);
252 2 : return AICPU_SCHEDULE_OK;
253 : }
254 :
255 4 : DumpSessionManager &DumpSessionManager::GetInstance()
256 : {
257 4 : static DumpSessionManager instance;
258 4 : return instance;
259 : }
260 :
261 1 : IDE_SESSION DumpSessionManager::GetSession(int32_t hostPid, uint32_t deviceId)
262 : {
263 : UNUSED(hostPid);
264 : UNUSED(deviceId);
265 1 : sessionsMap_.clear();
266 1 : return nullptr;
267 : }
268 :
269 1 : IDE_SESSION DumpSessionManager::ReacquireSession(int32_t hostPid, uint32_t deviceId)
270 : {
271 : UNUSED(hostPid);
272 : UNUSED(deviceId);
273 1 : sessionsMap_.clear();
274 1 : return nullptr;
275 : }
276 :
277 1 : void DumpSessionManager::CloseAllSessions()
278 : {
279 1 : sessionsMap_.clear();
280 1 : return;
281 : }
282 :
283 1 : IDE_SESSION DumpSessionManager::CreateIdeDumpSession(int32_t hostPid, uint32_t deviceId) const
284 : {
285 : UNUSED(hostPid);
286 : UNUSED(deviceId);
287 1 : return nullptr;
288 : }
289 :
290 1 : int32_t AicpuQueueEventProcess::ProcessQsMsg(const event_info &event)
291 : {
292 : UNUSED(event);
293 1 : return AICPU_SCHEDULE_OK;
294 : }
295 :
296 1 : int32_t AicpuQueueEventProcess::ProcessDrvMsg(const event_info &event)
297 : {
298 : UNUSED(event);
299 1 : return AICPU_SCHEDULE_OK;
300 : }
301 :
302 1 : int32_t AicpuQueueEventProcess::ProcessProxyMsg(const event_info &event)
303 : {
304 : UNUSED(event);
305 1 : return AICPU_SCHEDULE_OK;
306 : }
307 :
308 3 : AicpuQueueEventProcess &AicpuQueueEventProcess::GetInstance()
309 : {
310 3 : static AicpuQueueEventProcess instance;
311 3 : return instance;
312 : }
313 :
314 : namespace mpi {
315 4 : MpiDvppStatisticManager &MpiDvppStatisticManager::Instance()
316 : {
317 4 : static MpiDvppStatisticManager statisticManagerInstance;
318 4 : return statisticManagerInstance;
319 : }
320 :
321 1 : MpiDvppStatisticManager::~MpiDvppStatisticManager()
322 : {
323 1 : }
324 :
325 1 : int32_t MpiDvppStatisticManager::PrintStatisticInfo() const
326 : {
327 1 : return AicpuSchedule::AICPU_SCHEDULE_OK;
328 : }
329 :
330 1 : void MpiDvppStatisticManager::Record()
331 : {
332 1 : }
333 :
334 1 : void MpiDvppStatisticManager::InitMpiDvpp()
335 : {
336 1 : }
337 :
338 1 : void MpiDvppStatisticManager::OnPulse(const MpiDvppTimePoint &nowTimePoint)
339 : {
340 : UNUSED(nowTimePoint);
341 1 : }
342 : } // namepsace mpi
343 :
344 1 : bool TaskQueue::Enqueue(const aicpu::Closure &closure)
345 : {
346 : UNUSED(closure);
347 1 : return true;
348 : }
349 :
350 1 : bool TaskQueue::Dequeue(aicpu::Closure &closure)
351 : {
352 : UNUSED(closure);
353 1 : return true;
354 : }
355 :
356 1 : void TaskQueue::Clear()
357 : {
358 1 : }
359 :
360 3 : std::string TaskQueue::DebugString() {return "";}
361 :
362 1 : bool TaskMap::BatchAddTask(const AICPUSharderTaskInfo &taskInfo,
363 : const std::queue<aicpu::Closure> &queue)
364 : {
365 : UNUSED(taskInfo);
366 : UNUSED(queue);
367 1 : return true;
368 : }
369 :
370 1 : bool TaskMap::PopTask(const AICPUSharderTaskInfo &taskInfo, aicpu::Closure &closure)
371 : {
372 : UNUSED(taskInfo);
373 : UNUSED(closure);
374 1 : return true;
375 : }
376 :
377 1 : void TaskMap::Clear() {}
378 :
379 3 : std::string TaskMap::DebugString() {return "";}
380 :
381 : } // namespace AicpuSchedule
382 :
383 : namespace aicpu {
384 1 : AsyncEventManager::AsyncEventManager() {}
385 :
386 1 : AsyncEventManager::~AsyncEventManager() {}
387 :
388 7 : AsyncEventManager &AsyncEventManager::GetInstance()
389 : {
390 7 : static AsyncEventManager asyncEventManager;
391 7 : return asyncEventManager;
392 : }
393 :
394 1 : void AsyncEventManager::Register(const NotifyFunc ¬ify)
395 : {
396 : UNUSED(notify);
397 1 : return;
398 : }
399 :
400 1 : void AsyncEventManager::NotifyWait(void *notifyParam, const uint32_t paramLen)
401 : {
402 : UNUSED(notifyParam);
403 : UNUSED(paramLen);
404 1 : return;
405 : }
406 :
407 1 : bool AsyncEventManager::RegEventCb(const uint32_t eventId, const uint32_t subEventId,
408 : const EventProcessCallBack &cb, const int32_t times)
409 : {
410 : UNUSED(eventId);
411 : UNUSED(subEventId);
412 : UNUSED(cb);
413 : UNUSED(times);
414 1 : return true;
415 : }
416 :
417 1 : void AsyncEventManager::ProcessEvent(const uint32_t eventId, const uint32_t subEventId, void *param)
418 : {
419 : UNUSED(eventId);
420 : UNUSED(subEventId);
421 : UNUSED(param);
422 1 : return;
423 : }
424 :
425 1 : bool AsyncEventManager::RegOpEventCb(const uint32_t eventId, const uint32_t subEventId, const EventProcessCallBack &cb)
426 : const {
427 : UNUSED(eventId);
428 : UNUSED(subEventId);
429 : UNUSED(cb);
430 1 : return true;
431 : }
432 :
433 1 : void AsyncEventManager::UnregOpEventCb(const uint32_t eventId, const uint32_t subEventId) const
434 : {
435 : UNUSED(eventId);
436 : UNUSED(subEventId);
437 1 : }
438 :
439 1 : void AsyncEventManager::ProcessOpEvent(const uint32_t eventId, const uint32_t subEventId, void * const param) const
440 : {
441 : UNUSED(eventId);
442 : UNUSED(subEventId);
443 : UNUSED(param);
444 1 : }
445 : } // namespace aicpu
446 :
447 : namespace DataPreprocess {
448 1 : TaskQueueMgr& TaskQueueMgr::GetInstance()
449 : {
450 1 : static TaskQueueMgr instance;
451 1 : return instance;
452 : }
453 :
454 3 : TaskQueueMgr::TaskQueueMgr() {}
455 3 : TaskQueueMgr::~TaskQueueMgr() {}
456 1 : void TaskQueueMgr::OnPreprocessEvent(uint32_t eventId)
457 : {
458 : UNUSED(eventId);
459 1 : }
460 : } // namespace DataPreprocess
461 :
462 : namespace tdt {
463 1 : int32_t TDTServerInit(const uint32_t deviceID, const std::list<uint32_t>& bindCoreList)
464 : {
465 : UNUSED(deviceID);
466 : UNUSED(bindCoreList);
467 1 : return 0;
468 : }
469 :
470 1 : int32_t TDTServerStop()
471 : {
472 1 : return 0;
473 : }
474 :
475 759 : StatusFactory* StatusFactory::GetInstance()
476 : {
477 759 : static StatusFactory instance;
478 759 : return &instance;
479 : }
480 :
481 757 : void StatusFactory::RegisterErrorNo(const uint32_t err, const std::string& desc)
482 : {
483 : UNUSED(err);
484 : UNUSED(desc);
485 757 : }
486 :
487 1 : std::string StatusFactory::GetErrDesc(const uint32_t err)
488 : {
489 : UNUSED(err);
490 2 : return "";
491 : }
492 :
493 1 : std::string StatusFactory::GetErrCodeDesc(uint32_t errCode)
494 : {
495 : UNUSED(errCode);
496 2 : return "";
497 : }
498 :
499 1 : StatusFactory::StatusFactory() {}
500 : } // namespace tdt
501 :
502 1 : int halTsDevRecord(unsigned int devId, unsigned int tsId, unsigned int record_type, unsigned int record_Id)
503 : {
504 : (void)devId;
505 : (void)tsId;
506 : (void)record_type;
507 : (void)record_Id;
508 1 : return 0;
509 : }
510 :
511 : #ifdef __cplusplus
512 : extern "C" {
513 : #endif
514 :
515 1 : int32_t CreateOrFindCustPid(const uint32_t deviceId, const uint32_t loadLibNum,
516 : const char * const loadLibName[], const uint32_t hostPid, const uint32_t vfId, const char *groupNameList,
517 : const uint32_t groupNameNum, int32_t *custProcPid, bool *firstStart)
518 : {
519 : UNUSED(deviceId);
520 : UNUSED(loadLibNum);
521 : UNUSED(loadLibName);
522 : UNUSED(vfId);
523 : UNUSED(groupNameList);
524 : UNUSED(hostPid);
525 : UNUSED(groupNameNum);
526 : UNUSED(firstStart);
527 : UNUSED(custProcPid);
528 1 : return 0;
529 : }
530 :
531 1 : int tsDevSendMsgAsync(unsigned int devId, unsigned int tsId, char *msg, unsigned int msgLen,
532 : unsigned int handleId)
533 : {
534 : UNUSED(devId);
535 : UNUSED(tsId);
536 : UNUSED(msg);
537 : UNUSED(handleId);
538 : UNUSED(msgLen);
539 1 : return 0;
540 : }
541 :
542 :
543 0 : int32_t SendUpdateProfilingRspToTsd(const uint32_t deviceId, const uint32_t waitType,
544 : const uint32_t hostPid, const uint32_t vfId)
545 : {
546 : UNUSED(deviceId);
547 : UNUSED(waitType);
548 : UNUSED(hostPid);
549 : UNUSED(vfId);
550 0 : return 0;
551 : }
552 1 : int32_t SetSubProcScheduleMode(const uint32_t deviceId, const uint32_t waitType,
553 : const uint32_t hostPid, const uint32_t vfId,
554 : const struct SubProcScheduleModeInfo *scheInfo)
555 : {
556 : UNUSED(deviceId);
557 : UNUSED(waitType);
558 : UNUSED(hostPid);
559 : UNUSED(vfId);
560 : UNUSED(scheInfo);
561 1 : return 0;
562 : }
563 : #ifdef __cplusplus
564 : }
565 : #endif
566 :
|