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(
25 : aicpu::AicpuRunMode::THREAD_MODE, SCHED_MODE_INTERRUPT);
26 : } // namespace
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(
41 : const std::vector<uint32_t>& deviceVec, const pid_t hostPid, const std::string& pidSign,
42 : const uint32_t profilingMode, const uint32_t vfId, const aicpu::AicpuRunMode runMode)
43 : {
44 1 : return 0;
45 : }
46 :
47 1 : void ComputeProcess::Stop() { return; }
48 :
49 1 : bool ComputeProcess::DoSplitKernelTask(const AICPUSharderTaskInfo& taskInfo)
50 : {
51 : (void)taskInfo;
52 1 : return true;
53 : }
54 :
55 1 : bool ComputeProcess::DoRandomKernelTask() { return true; }
56 :
57 1 : uint32_t ComputeProcess::SubmitRandomKernelTask(const aicpu::Closure& task)
58 : {
59 : (void)task;
60 1 : return 0U;
61 : }
62 1 : uint32_t ComputeProcess::SubmitSplitKernelTask(
63 : const AICPUSharderTaskInfo& taskInfo, const std::queue<aicpu::Closure>& taskQueue)
64 : {
65 : (void)taskInfo;
66 : (void)taskQueue;
67 1 : return 0U;
68 : }
69 1 : uint32_t ComputeProcess::SubmitBatchSplitKernelEventOneByOne(const AICPUSharderTaskInfo& taskInfo) const
70 : {
71 : (void)taskInfo;
72 1 : return 0U;
73 : }
74 1 : uint32_t ComputeProcess::SubmitBatchSplitKernelEventDc(const AICPUSharderTaskInfo& taskInfo)
75 : {
76 : (void)taskInfo;
77 1 : return 0U;
78 : }
79 1 : uint32_t ComputeProcess::SubmitOneSplitKernelEvent(const AICPUSharderTaskInfo& taskInfo) const
80 : {
81 : (void)taskInfo;
82 1 : return 0U;
83 : }
84 1 : bool ComputeProcess::GetAndDoSplitKernelTask() { return true; }
85 :
86 1 : drvError_t halQueueSubscribe(unsigned int devid, unsigned int qid, unsigned int groupId, int type)
87 : {
88 1 : return DRV_ERROR_NONE;
89 : }
90 :
91 1 : drvError_t halQueueUnsubscribe(unsigned int devid, unsigned int qid) { return DRV_ERROR_NONE; }
92 :
93 0 : int SetQueueWorkMode(unsigned int devid, unsigned int qid, int mode) { return DRV_ERROR_NONE; }
94 :
95 1 : drvError_t halQueueSubF2NFEvent(unsigned int devid, unsigned int qid, unsigned int groupid) { return DRV_ERROR_NONE; }
96 :
97 1 : drvError_t halQueueSet(unsigned int devId, QueueSetCmdType cmd, QueueSetInputPara* input) { return DRV_ERROR_NONE; }
98 :
99 1 : drvError_t halQueueUnsubF2NFEvent(unsigned int devid, unsigned int qid) { return DRV_ERROR_NONE; }
100 :
101 1 : drvError_t halQueueDeQueue(unsigned int devId, unsigned int qid, void** mbug) { return DRV_ERROR_NONE; }
102 :
103 1 : drvError_t halQueueEnQueue(unsigned int devId, unsigned int qid, void* mbuf) { return DRV_ERROR_NONE; }
104 :
105 1 : int halMbufGetBuffAddr(Mbuf* mbuf, void** buf) { return DRV_ERROR_NONE; }
106 :
107 1 : int halMbufSetDataLen(Mbuf* mbuf, uint64_t len) { return DRV_ERROR_NONE; }
108 :
109 1 : int halMbufGetDataLen(Mbuf* mbuf, uint64_t* len) { return DRV_ERROR_NONE; }
110 :
111 1 : int halMbufAllocEx(uint64_t size, unsigned int align, unsigned long flag, int grp_id, Mbuf** mbuf)
112 : {
113 1 : return DRV_ERROR_NONE;
114 : }
115 :
116 1 : int halMbufFree(Mbuf* mbuf) { return DRV_ERROR_NONE; }
117 :
118 1 : int halMbufGetPrivInfo(Mbuf* mbuf, void** priv, unsigned int* size) { return DRV_ERROR_NONE; }
119 :
120 1 : drvError_t halQueueInit(unsigned int devid) { return DRV_ERROR_NONE; }
121 :
122 0 : int buff_get_phy_addr(void* buf, unsigned long long* phyAddr) { return 0; }
123 :
124 1 : drvError_t drvHdcGetCapacity(struct drvHdcCapacity* capacity) { return DRV_ERROR_NONE; }
125 :
126 1 : int halMbufChainGetMbuf(Mbuf* mbufChainHead, unsigned int index, Mbuf** mbuf) { return DRV_ERROR_NONE; }
127 :
128 1 : int halMbufChainGetMbufNum(Mbuf* mbufChainHead, unsigned int* num) { return DRV_ERROR_NONE; }
129 :
130 1 : int halMbufChainAppend(Mbuf* mbufChainHead, Mbuf* mbuf) { return DRV_ERROR_NONE; }
131 :
132 1 : int halTsDevRecord(unsigned int devId, unsigned int tsId, unsigned int record_type, unsigned int record_Id)
133 : {
134 1 : return 0;
135 : }
136 :
137 1 : drvError_t drvBindHostPid(struct drvBindHostpidInfo info) { return DRV_ERROR_NONE; }
138 :
139 : namespace AicpuSchedule {
140 1 : ThreadPool& ThreadPool::Instance()
141 : {
142 1 : static ThreadPool threadPool;
143 1 : return threadPool;
144 : }
145 :
146 1 : void ThreadPool::WaitForStop() { return; }
147 :
148 2 : ThreadPool::ThreadPool() : semInitedNum_(0) {}
149 :
150 2 : ThreadPool::~ThreadPool() {}
151 : } // namespace AicpuSchedule
152 :
153 1 : int halGetDeviceVfMax(unsigned int devId, unsigned int* vf_max_num)
154 : {
155 : (void)devId;
156 : (void)vf_max_num;
157 1 : return DRV_ERROR_NONE;
158 : }
159 :
160 1 : int halGetDeviceVfList(unsigned int devId, unsigned int* vf_list, unsigned int list_len, unsigned int* vf_num)
161 : {
162 : (void)devId;
163 : (void)vf_list;
164 : (void)list_len;
165 : (void)vf_num;
166 1 : return DRV_ERROR_NONE;
167 : }
|