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_threads_process.h"
11 : #include <cstring>
12 : #include <unistd.h>
13 : #include <sys/types.h>
14 : #include <sys/syscall.h>
15 : #include "ascend_hal.h"
16 : #include "tdt_server.h"
17 : #include "task_queue.h"
18 : #include "profiling_adp.h"
19 : #include "aicpusd_util.h"
20 : #include "aicpusd_status.h"
21 : #include "aicpusd_common.h"
22 : #include "aicpusd_event_manager.h"
23 : #include "aicpusd_drv_manager.h"
24 : #include "aicpusd_interface_process.h"
25 : #include "aicpusd_drv_manager.h"
26 : #include "aicpusd_worker.h"
27 : #include "aicpu_context.h"
28 : #include "aicpusd_monitor.h"
29 : #include "aicpusd_msg_send.h"
30 : #include "aicpu_async_event.h"
31 : #include "aicpusd_hal_interface_ref.h"
32 : #include "aicpu_prof.h"
33 : #include "aicpu_engine.h"
34 : #include "aicpusd_message_queue.h"
35 : namespace {
36 : constexpr size_t FIRST_INDEX = 0UL;
37 : }
38 :
39 : namespace AicpuSchedule {
40 20 : ComputeProcess::ComputeProcess()
41 40 : : deviceVec_({}),
42 20 : hostDeviceId_(0U),
43 20 : hostPid_(-1),
44 40 : pidSign_(""),
45 20 : aicpuNum_(0U),
46 20 : profilingMode_(PROFILING_CLOSE),
47 20 : vfId_(0U),
48 20 : isStartTdtFlag_(false),
49 20 : runMode_(aicpu::AicpuRunMode::THREAD_MODE) {}
50 :
51 65 : ComputeProcess& ComputeProcess::GetInstance()
52 : {
53 65 : static ComputeProcess instance;
54 65 : return instance;
55 : }
56 :
57 10 : void ComputeProcess::LoadKernelSo()
58 : {
59 10 : if (runMode_ == aicpu::AicpuRunMode::PROCESS_PCIE_MODE) {
60 : try {
61 4 : aicpusd_run_info("Start to preload aicpu so.");
62 4 : const uint32_t loadSoCnt = 3U;
63 4 : const char_t *soNames[loadSoCnt] = {"libtf_kernels.so", "libaicpu_kernels.so", "libcpu_kernels.so"};
64 4 : (void)aeBatchLoadKernelSo(static_cast<uint32_t>(aicpu::KERNEL_TYPE_AICPU), loadSoCnt, &(soNames[0]));
65 4 : aicpusd_run_info("End to preload aicpu so.");
66 0 : } catch (...) {
67 : // do nothing
68 0 : }
69 : }
70 10 : }
71 :
72 12 : void ComputeProcess::LoadExtendKernelSo()
73 : {
74 12 : if (!FeatureCtrl::ShouldLoadExtendKernelSo()) {
75 1 : aicpusd_info("no need load extend kernels so");
76 1 : return;
77 : }
78 :
79 : // extend kernel so 走mc2流程,如果有就必须加载
80 : try {
81 11 : aicpusd_run_info("Start to preload extend kernel so.");
82 11 : const uint32_t loadSoCnt = 1U;
83 11 : const char_t *soNames[loadSoCnt] = {"libaicpu_extend_kernels.so"};
84 11 : (void)aeBatchLoadKernelSo(static_cast<uint32_t>(aicpu::KERNEL_TYPE_AICPU), loadSoCnt, &(soNames[0]));
85 11 : aicpusd_run_info("End to preload extend kernel so.");
86 0 : } catch (...) {
87 : // do nothing
88 0 : }
89 : }
90 :
91 14 : int32_t ComputeProcess::Start(const std::vector<uint32_t> &deviceVec,
92 : const pid_t hostPid,
93 : const std::string &pidSign,
94 : const uint32_t profilMode,
95 : const uint32_t vfId,
96 : const aicpu::AicpuRunMode runMode)
97 : {
98 14 : const AicpuSchedMode schedMode = FeatureCtrl::GetAicpuSchedMode();
99 14 : aicpusd_info("Aicpu scheduler start, hostpid[%d], profilingMode[%u], runMode[%u], vfId[%u], schedMode[%u]",
100 : hostPid, profilMode, runMode, vfId, schedMode);
101 14 : if (deviceVec.empty()) {
102 0 : aicpusd_err("device vector is empty.");
103 0 : return AICPU_SCHEDULE_ERROR_PARAMETER_NOT_VALID;
104 : }
105 14 : const AicpuSchedule::AicpuDrvManager &drvMgr = AicpuSchedule::AicpuDrvManager::GetInstance();
106 14 : deviceVec_ = deviceVec;
107 14 : aicpuNum_ = drvMgr.GetAicpuNum();
108 14 : hostPid_ = hostPid;
109 14 : pidSign_ = pidSign;
110 14 : runMode_ = runMode;
111 14 : vfId_ = vfId;
112 14 : aicpu::InitProfilingDataInfo(deviceVec_[FIRST_INDEX], hostPid, static_cast<uint32_t>(CHANNEL_AICPU));
113 14 : aicpu::LoadProfilingLib();
114 14 : if (profilMode != 0U) {
115 8 : aicpu::SetProfilingFlagForKFC(profilMode);
116 8 : aicpu::UpdateMode((profilMode & 1U) == PROFILING_OPEN);
117 : }
118 :
119 14 : int32_t ret = AICPU_SCHEDULE_OK;
120 14 : if (runMode_ == aicpu::AicpuRunMode::PROCESS_PCIE_MODE) {
121 8 : ret = MemorySvmDevice();
122 8 : if (ret != AICPU_SCHEDULE_OK) {
123 0 : aicpusd_err("Memory svm device failed.");
124 0 : return ret;
125 : }
126 : }
127 : // set aicpu runmode
128 14 : (void)aicpu::SetAicpuRunMode(runMode_);
129 : // set cust aicpu sd flag
130 14 : aicpu::SetCustAicpuSdFlag(false);
131 :
132 14 : if (schedMode == SCHED_MODE_MSGQ) {
133 11 : const uint32_t deviceId = deviceVec[0];
134 22 : ret = MessageQueue::GetInstance().InitMessageQueue(deviceId,
135 22 : AicpuDrvManager::GetInstance().GetAicpuPhysIndexs(deviceId));
136 11 : if (ret != AICPU_SCHEDULE_OK) {
137 1 : aicpusd_err("Init aicpu message queue failed, ret=%d", ret);
138 1 : return ret;
139 : }
140 : }
141 :
142 13 : ret = RegisterScheduleTask();
143 13 : if (ret != AICPU_SCHEDULE_OK) {
144 1 : aicpusd_err("Register aicpu nonblock task and async event manager task failed.");
145 1 : return ret;
146 : }
147 :
148 12 : ret = AicpuSchedule::ThreadPool::Instance().CreateWorker(schedMode);
149 12 : if (ret != AICPU_SCHEDULE_OK) {
150 0 : aicpusd_err("Drv create aicpu work tasks failed, ret[%d].", ret);
151 0 : return ret;
152 : }
153 12 : if (runMode_ == aicpu::AicpuRunMode::PROCESS_PCIE_MODE) {
154 6 : AicpuSchedule::ThreadPool::Instance().SetThreadSchedModeByTsd();
155 : }
156 :
157 12 : if (vfId > 0) {
158 : // start TDT Server thread
159 3 : ret = StartTdtServer();
160 3 : if (ret != AICPU_SCHEDULE_OK) {
161 1 : aicpusd_err("Start tdt server failed ret[%d].", ret);
162 1 : return ret;
163 : }
164 : }
165 :
166 11 : if (AicpuScheduleInterface::GetInstance().NeedLoadKernelSo()) {
167 9 : LoadKernelSo();
168 : }
169 :
170 11 : LoadExtendKernelSo();
171 11 : aicpusd_info("Aicpu scheduler start successfully, deviceId[%u], hostpid[%d], profilingMode[%u], runMode[%u]",
172 : deviceVec_[FIRST_INDEX], hostPid, profilMode, runMode_);
173 11 : return AICPU_SCHEDULE_OK;
174 : }
175 :
176 3 : void ComputeProcess::UpdateProfilingMode(const ProfilingMode mode) const
177 : {
178 3 : aicpu::UpdateMode(mode == PROFILING_OPEN);
179 3 : }
180 :
181 3 : void ComputeProcess::UpdateProfilingModelMode(const bool mode) const
182 : {
183 3 : aicpu::UpdateModelMode(mode);
184 3 : }
185 :
186 8 : void ComputeProcess::Stop()
187 : {
188 8 : splitKernelTask_.Clear();
189 8 : randomKernelTask_.Clear();
190 8 : StopTdtServer();
191 8 : aicpu::ReleaseProfiling();
192 8 : }
193 : #ifndef _AOSCORE_
194 7 : int32_t ComputeProcess::StartTdtServer()
195 : {
196 7 : if (runMode_ != aicpu::AicpuRunMode::PROCESS_PCIE_MODE) {
197 3 : return AICPU_SCHEDULE_OK;
198 : }
199 4 : aicpusd_info("Start tdt server, deviceId=%u.", deviceVec_[0]);
200 4 : uint32_t dcpuBase = 0U;
201 4 : uint32_t dcpuNumber = 0U;
202 4 : AicpuSchedule::AicpuDrvManager::GetInstance().GetDcpuRange(dcpuBase, dcpuNumber);
203 :
204 4 : const uint32_t aicpuNumber = AicpuSchedule::AicpuDrvManager::GetInstance().GetAicpuNumPerDevice();
205 :
206 : // Set TDT thread binding list
207 4 : std::list<uint32_t> tdtBindCoreList;
208 4 : if (dcpuNumber != 0U) {
209 2 : isStartTdtFlag_ = true;
210 4 : for (uint32_t i = 0U; i < dcpuNumber; ++i) {
211 2 : tdtBindCoreList.push_back(dcpuBase + i);
212 : }
213 : } else {
214 2 : const bool isFPGA = AicpuUtil::IsEnvValEqual(ENV_NAME_DATAMASTER_RUN_MODE, "1");
215 2 : aicpusd_info("Start tdt in mode %d", isFPGA);
216 :
217 2 : if ((isFPGA) && (aicpuNumber != 0U)) {
218 1 : isStartTdtFlag_ = true;
219 2 : for (uint32_t i = 0U; i < aicpuNumber; ++i) {
220 1 : tdtBindCoreList.push_back(AicpuSchedule::AicpuDrvManager::GetInstance().GetAicpuPhysIndex(i, 0U));
221 : }
222 1 : } else {
223 1 : isStartTdtFlag_ = false;
224 1 : aicpusd_info("Not need to start tdt server.");
225 1 : return AICPU_SCHEDULE_OK;
226 : }
227 : }
228 :
229 : // Start the TDT thread that binds the core
230 3 : const int32_t tdtInitRet = tdt::TDTServerInit(deviceVec_[FIRST_INDEX], tdtBindCoreList);
231 3 : if (tdtInitRet != 0) {
232 0 : aicpusd_err("TDT server init failed, deviceId[%u], dcpuBase[%u], dcpuNum[%u], ret[%d].",
233 : deviceVec_[FIRST_INDEX], dcpuBase, dcpuNumber, tdtInitRet);
234 0 : return tdtInitRet;
235 : }
236 3 : aicpusd_info("TDT Server init success.");
237 3 : return AICPU_SCHEDULE_OK;
238 4 : }
239 :
240 15 : void ComputeProcess::StopTdtServer() const
241 : {
242 15 : if (runMode_ != aicpu::AicpuRunMode::PROCESS_PCIE_MODE) {
243 7 : return;
244 : }
245 8 : if (!isStartTdtFlag_) {
246 3 : aicpusd_info("It don`t need to stop tdt server.");
247 3 : return;
248 : }
249 5 : aicpusd_info("Stop tdt server, deviceId=%u.", deviceVec_[0]);
250 :
251 5 : const int32_t tdtStopRet = tdt::TDTServerStop();
252 5 : if (tdtStopRet != 0) {
253 1 : aicpusd_err("TDT server stop failed, ret[%d].", tdtStopRet);
254 1 : return;
255 : }
256 4 : aicpusd_info("TDT Server stop success.");
257 : }
258 : #else
259 : int32_t ComputeProcess::StartTdtServer()
260 : {
261 : return AICPU_SCHEDULE_OK;
262 : }
263 :
264 : void ComputeProcess::StopTdtServer() const
265 : {
266 : return;
267 : }
268 : #endif
269 :
270 30 : int32_t ComputeProcess::RegisterScheduleTask()
271 : {
272 3 : const auto randomKernelScheduler = [this] (const aicpu::Closure &task) {
273 3 : return SubmitRandomKernelTask(task);
274 30 : };
275 40 : const auto splitKernelScheduler = [this] (const uint32_t parallelId, const int64_t shardNum,
276 : const std::queue<aicpu::Closure> &taskQueue) {
277 40 : const AICPUSharderTaskInfo taskInfo = {.parallelId=parallelId, .shardNum=shardNum};
278 81 : return SubmitSplitKernelTask(taskInfo, taskQueue);
279 30 : };
280 125 : const auto splitKernelGetProcesser = [this] () {
281 125 : return GetAndDoSplitKernelTask();
282 30 : };
283 :
284 30 : aicpu::SharderNonBlock::GetInstance().Register(aicpuNum_, randomKernelScheduler, splitKernelScheduler,
285 : splitKernelGetProcesser);
286 30 : if ((aicpuNum_ > 0U) && (aicpu::InitTaskMonitorContext(aicpuNum_) != aicpu::AICPU_ERROR_NONE)) {
287 1 : aicpusd_err("Init task monitor context failed");
288 1 : return AICPU_SCHEDULE_ERROR_INNER_ERROR;
289 : }
290 :
291 0 : const auto notifyWaitFunc = [](const void *const notifyParam, const uint32_t paramLen) {
292 0 : return AicpuSchedule::AicpuMsgSend::SendAicpuRecordMsg(notifyParam, paramLen);
293 : };
294 29 : aicpu::AsyncEventManager::GetInstance().Register(notifyWaitFunc);
295 29 : return AICPU_SCHEDULE_OK;
296 : }
297 :
298 3 : uint32_t ComputeProcess::SubmitRandomKernelTask(const aicpu::Closure &task)
299 : {
300 3 : if (!randomKernelTask_.Enqueue(task)) {
301 1 : aicpusd_err("Add random kernel task failed.");
302 1 : return AICPU_SCHEDULE_ERROR_INNER_ERROR;
303 : }
304 :
305 2 : AICPUSubEventInfo aicpuEventInfo = {};
306 2 : event_summary eventInfoSummary = {};
307 2 : eventInfoSummary.pid = getpid();
308 2 : eventInfoSummary.event_id = EVENT_RANDOM_KERNEL;
309 2 : eventInfoSummary.msg = PtrToPtr<AICPUSubEventInfo, char_t>(&aicpuEventInfo);
310 2 : eventInfoSummary.msg_len = static_cast<uint32_t>(sizeof(AICPUSubEventInfo));
311 :
312 2 : const int32_t drvRet = halEschedSubmitEvent(deviceVec_[FIRST_INDEX], &eventInfoSummary);
313 2 : if (drvRet != DRV_ERROR_NONE) {
314 1 : aicpusd_err("Submit random kernel event failed. ret=%d", drvRet);
315 1 : return AICPU_SCHEDULE_ERROR_DRV_ERR;
316 : }
317 :
318 1 : return AICPU_SCHEDULE_OK;
319 : }
320 :
321 40 : uint32_t ComputeProcess::SubmitSplitKernelTask(const AICPUSharderTaskInfo &taskInfo,
322 : const std::queue<aicpu::Closure> &taskQueue)
323 : {
324 40 : if (!splitKernelTask_.BatchAddTask(taskInfo, taskQueue)) {
325 1 : aicpusd_err("Add split kernel task to map failed, parallelId=%u", taskInfo.parallelId);
326 1 : return AICPU_SCHEDULE_ERROR_INNER_ERROR;
327 : }
328 :
329 40 : uint32_t ret = AICPU_SCHEDULE_OK;
330 40 : if (FeatureCtrl::ShouldSubmitTaskOneByOne()) {
331 2 : ret = SubmitBatchSplitKernelEventOneByOne(taskInfo);
332 : } else {
333 38 : ret = SubmitBatchSplitKernelEventDc(taskInfo);
334 : }
335 40 : if (ret != AICPU_SCHEDULE_OK) {
336 2 : aicpusd_err("Submit batch split kernel event failed. parallelId=%u, submitNum=%ld",
337 : taskInfo.parallelId, taskInfo.shardNum);
338 2 : return ret;
339 : }
340 :
341 38 : aicpusd_info("Submit split kernel event success. parallelId=%u, submitNum=%ld",
342 : taskInfo.parallelId, taskInfo.shardNum);
343 :
344 38 : return AICPU_SCHEDULE_OK;
345 : }
346 :
347 2 : uint32_t ComputeProcess::SubmitBatchSplitKernelEventOneByOne(const AICPUSharderTaskInfo &taskInfo) const
348 : {
349 2 : const uint32_t submitNum = static_cast<uint32_t>(taskInfo.shardNum);
350 3 : for (uint32_t i = 0U; i < submitNum; ++i) {
351 2 : const uint32_t ret = SubmitOneSplitKernelEvent(taskInfo);
352 2 : if (ret != AICPU_SCHEDULE_OK) {
353 1 : aicpusd_err("Submit single split kernel event failed. parallelId=%u, i=%u",
354 : taskInfo.parallelId, i);
355 1 : return ret;
356 : }
357 : }
358 :
359 1 : return AICPU_SCHEDULE_OK;
360 : }
361 :
362 38 : uint32_t ComputeProcess::SubmitBatchSplitKernelEventDc(const AICPUSharderTaskInfo &taskInfo)
363 : {
364 38 : AICPUSubEventInfo aicpuEventInfo = {};
365 38 : aicpuEventInfo.para.sharderTaskInfo = taskInfo;
366 38 : event_summary eventInfoSummary = {};
367 38 : eventInfoSummary.pid = getpid();
368 38 : eventInfoSummary.event_id = EVENT_SPLIT_KERNEL;
369 38 : eventInfoSummary.msg = PtrToPtr<AICPUSubEventInfo, char_t>(&aicpuEventInfo);
370 38 : eventInfoSummary.msg_len = static_cast<uint32_t>(sizeof(AICPUSubEventInfo));
371 38 : uint32_t submitSuccessNum = 0U;
372 38 : const uint32_t submitNum = static_cast<uint32_t>(taskInfo.shardNum);
373 38 : const int32_t drvRet = halEschedSubmitEventBatch(deviceVec_[FIRST_INDEX], SHARED_EVENT_ENTRY,
374 38 : &eventInfoSummary, submitNum, &submitSuccessNum);
375 38 : if ((drvRet == DRV_ERROR_NONE) && (submitSuccessNum == submitNum)) {
376 35 : aicpusd_info("Batch submit split kernel event success, parallelId=%u, submitNum=%u",
377 : taskInfo.parallelId, submitNum);
378 35 : return AICPU_SCHEDULE_OK;
379 : }
380 :
381 : /*
382 : * The queue depth of event schedule is only dozens. If too many split kernel event are submited,
383 : * the queue will be full. Therefore, the main thread needs to process the task sending failure.
384 : */
385 3 : aicpusd_warn("Batch submit some of split kernel event success, ret=%d, parallelId=%u, submitNum=%u, "
386 : "submitSuccessNum=%u", drvRet, taskInfo.parallelId, submitNum, submitSuccessNum);
387 :
388 3 : const uint32_t remainNum = (drvRet == DRV_ERROR_NONE) ? submitNum - submitSuccessNum : submitNum;
389 5 : for (uint32_t i = 0U; i < remainNum; ++i) {
390 3 : if (!DoSplitKernelTask(taskInfo)) {
391 1 : aicpusd_err("Run single task failed after batch submit fail, parallelId=%u, submitNum=%u, "
392 : "remainNum=%u, i=%u", taskInfo.parallelId, submitNum, remainNum, i);
393 1 : return AICPU_SCHEDULE_ERROR_INNER_ERROR;
394 : }
395 : }
396 :
397 2 : return AICPU_SCHEDULE_OK;
398 : }
399 :
400 2 : uint32_t ComputeProcess::SubmitOneSplitKernelEvent(const AICPUSharderTaskInfo &taskInfo) const
401 : {
402 2 : AICPUSubEventInfo aicpuEventInfo = {};
403 2 : aicpuEventInfo.para.sharderTaskInfo = taskInfo;
404 2 : event_summary eventInfoSummary = {};
405 2 : eventInfoSummary.pid = getpid();
406 2 : eventInfoSummary.event_id = EVENT_SPLIT_KERNEL;
407 2 : eventInfoSummary.msg = PtrToPtr<AICPUSubEventInfo, char_t>(&aicpuEventInfo);
408 2 : eventInfoSummary.msg_len = static_cast<uint32_t>(sizeof(AICPUSubEventInfo));
409 :
410 2 : const int32_t drvRet = halEschedSubmitEvent(deviceVec_[FIRST_INDEX], &eventInfoSummary);
411 2 : if (drvRet != DRV_ERROR_NONE) {
412 1 : aicpusd_err("Submit split kernel event failed. ret=%d, parallelId=%u",
413 : drvRet, taskInfo.parallelId);
414 1 : return AICPU_SCHEDULE_ERROR_DRV_ERR;
415 : }
416 :
417 1 : return AICPU_SCHEDULE_OK;
418 : }
419 :
420 125 : bool ComputeProcess::GetAndDoSplitKernelTask()
421 : {
422 125 : event_info eventInfo = {};
423 125 : const uint32_t threadIndex = aicpu::GetAicpuThreadIndex();
424 125 : const int32_t retVal = halEschedGetEvent(deviceVec_[FIRST_INDEX], CP_DEFAULT_GROUP_ID, threadIndex,
425 125 : EVENT_SPLIT_KERNEL, &eventInfo);
426 125 : if (retVal == DRV_ERROR_NO_EVENT) {
427 2 : return true;
428 : }
429 123 : if (retVal != DRV_ERROR_NONE) {
430 1 : aicpusd_err("Cannot get event, threadIndex=%u, ret=%d", threadIndex, retVal);
431 1 : return false;
432 : }
433 :
434 122 : const AICPUSubEventInfo * const subEventInfo = PtrToPtr<const char_t, const AICPUSubEventInfo>(eventInfo.priv.msg);
435 122 : aicpusd_info("Begin to process split kernel event. parallelId=%u, threadIdx=%u, type=get",
436 : subEventInfo->para.sharderTaskInfo.parallelId, threadIndex);
437 :
438 122 : return DoSplitKernelTask(subEventInfo->para.sharderTaskInfo);
439 : }
440 :
441 129 : bool ComputeProcess::DoSplitKernelTask(const AICPUSharderTaskInfo &taskInfo)
442 : {
443 129 : aicpu::Closure task;
444 129 : if (!splitKernelTask_.PopTask(taskInfo, task)) {
445 1 : aicpusd_run_warn("Get split kernel task from map failed, parallelId=%u, %s",
446 : taskInfo.parallelId, splitKernelTask_.DebugString().c_str());
447 1 : return true;
448 : }
449 :
450 : try {
451 128 : task();
452 1 : } catch (std::exception &e) {
453 1 : aicpusd_err("Run split kernel task failed. parallelId=%u, exception=%s",
454 : taskInfo.parallelId, e.what());
455 1 : return false;
456 1 : }
457 :
458 127 : return true;
459 129 : }
460 :
461 6 : bool ComputeProcess::DoRandomKernelTask()
462 : {
463 6 : aicpu::Closure task;
464 6 : if (!randomKernelTask_.Dequeue(task)) {
465 4 : aicpusd_err("Get random kernel task from map failed, %s",
466 : randomKernelTask_.DebugString().c_str());
467 4 : return false;
468 : }
469 :
470 : try {
471 2 : task();
472 1 : } catch (std::exception &e) {
473 1 : aicpusd_err("Run random kernel task failed. exception=%s", e.what());
474 1 : return false;
475 1 : }
476 :
477 1 : return true;
478 6 : }
479 :
480 9 : int32_t ComputeProcess::MemorySvmDevice()
481 : {
482 17 : for (size_t i = 0UL; i < deviceVec_.size(); i++) {
483 9 : if (&halMemInitSvmDevice == nullptr) {
484 0 : aicpusd_err("Interface halMemInitSvmDevice is not supported in current device");
485 0 : return AICPU_SCHEDULE_ERROR_DRV_ERR;
486 : }
487 9 : const drvError_t drvRet = halMemInitSvmDevice(hostPid_, vfId_, deviceVec_[i]);
488 9 : if (drvRet != DRV_ERROR_NONE) {
489 1 : aicpusd_err("Drv mem init svm device[%u] failed ret[%d].", deviceVec_[i], drvRet);
490 1 : return AICPU_SCHEDULE_ERROR_DRV_ERR;
491 : }
492 : }
493 8 : aicpusd_info("Drv mem init svm device success.");
494 8 : return AICPU_SCHEDULE_OK;
495 : }
496 :
497 2 : std::string ComputeProcess::DebugString()
498 : {
499 2 : return splitKernelTask_.DebugString();
500 : }
501 : }
|