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 :
11 : #include "operator_kernel_model_enqueue.h"
12 :
13 : #include "aicpusd_status.h"
14 : #include "aicpusd_profiler.h"
15 :
16 :
17 : namespace AicpuSchedule {
18 : namespace {
19 : const std::string KERNEL_MODEL_ENQUEUE = "modelEnqueue";
20 : } // namespace
21 :
22 7 : int32_t OperatorKernelModelEnqueue::Compute(const AicpuTaskInfo &kernelTaskInfo, const RunContext &taskContext)
23 : {
24 7 : auto bufInfo = PtrToPtr<void, BufEnQueueInfo>(ValueToPtr(kernelTaskInfo.paraBase));
25 7 : if (bufInfo == nullptr) {
26 1 : aicpusd_err("ModelEnqueue kernelTaskInfo paramBase is null, modelId[%u], streamId[%u], taskId[%u]",
27 : taskContext.modelId, taskContext.streamId, kernelTaskInfo.taskID);
28 1 : return AICPU_SCHEDULE_ERROR_PARAMETER_NOT_VALID;
29 : }
30 6 : g_aicpuProfiler.SetEndGraph();
31 6 : g_aicpuProfiler.SetEqStart();
32 6 : const int32_t ret = EnqueueTask(*bufInfo, taskContext);
33 6 : g_aicpuProfiler.SetEqEnd();
34 6 : g_aicpuProfiler.SetModelEnd();
35 6 : return static_cast<uint32_t>(ret);
36 : }
37 :
38 :
39 6 : REGISTER_OPERATOR_KERNEL(KERNEL_MODEL_ENQUEUE, OperatorKernelModelEnqueue);
40 : } // namespace AicpuSchedule
|