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_dequeue.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_DEQUEUE = "modelDequeue";
20 : } // namespace
21 :
22 5 : int32_t OperatorKernelModelDequeue::Compute(const AicpuTaskInfo &kernelTaskInfo, const RunContext &taskContext)
23 : {
24 5 : aicpusd_info("Begin to dequeue. modelId[%u]", taskContext.modelId);
25 : BufEnQueueInfo * const bufInfo =
26 5 : PtrToPtr<void, BufEnQueueInfo>(ValueToPtr(static_cast<uintptr_t>(kernelTaskInfo.paraBase)));
27 5 : if (bufInfo == nullptr) {
28 1 : aicpusd_err("ModelDequeue kernelTaskInfo paramBase is null, modelId[%u], streamId[%u], taskId[%u]",
29 : taskContext.modelId, taskContext.streamId, kernelTaskInfo.taskID);
30 1 : return AICPU_SCHEDULE_ERROR_PARAMETER_NOT_VALID;
31 : }
32 4 : g_aicpuProfiler.SetDqStart();
33 4 : const uint32_t ret = DoModelDequeue(*bufInfo, taskContext);
34 4 : g_aicpuProfiler.SetDqEnd();
35 4 : g_aicpuProfiler.SetModelStart();
36 4 : return ret;
37 : }
38 :
39 4 : uint32_t OperatorKernelModelDequeue::DoModelDequeue(BufEnQueueInfo &bufInfo, const RunContext &taskContext) const {
40 4 : return DequeueTask(bufInfo, taskContext, true);
41 : }
42 :
43 6 : REGISTER_OPERATOR_KERNEL(KERNEL_MODEL_DEQUEUE, OperatorKernelModelDequeue);
44 : } // namespace AicpuSchedule
|