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 : namespace AicpuSchedule {
17 : namespace {
18 : const std::string KERNEL_MODEL_DEQUEUE = "modelDequeue";
19 : } // namespace
20 :
21 5 : int32_t OperatorKernelModelDequeue::Compute(const AicpuTaskInfo& kernelTaskInfo, const RunContext& taskContext)
22 : {
23 5 : aicpusd_info("Begin to dequeue. modelId[%u]", taskContext.modelId);
24 : BufEnQueueInfo* const bufInfo =
25 5 : PtrToPtr<void, BufEnQueueInfo>(ValueToPtr(static_cast<uintptr_t>(kernelTaskInfo.paraBase)));
26 5 : if (bufInfo == nullptr) {
27 1 : aicpusd_err(
28 : "ModelDequeue kernelTaskInfo paramBase is null, modelId[%u], streamId[%u], taskId[%u]", taskContext.modelId,
29 : 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 : {
41 4 : return DequeueTask(bufInfo, taskContext, true);
42 : }
43 :
44 6 : REGISTER_OPERATOR_KERNEL(KERNEL_MODEL_DEQUEUE, OperatorKernelModelDequeue);
45 : } // namespace AicpuSchedule
|