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 : #ifndef OPERATOR_KERNEL_MODEL_PREPARE_H
12 : #define OPERATOR_KERNEL_MODEL_PREPARE_H
13 :
14 : #include <vector>
15 : #include "operator_kernel.h"
16 : #include "operator_kernel_dequeue_base.h"
17 :
18 :
19 : namespace AicpuSchedule {
20 : class OperatorKernelModelPrepare : public OperatorKernel, public OperatorKernelDequeueBase {
21 : public:
22 68 : OperatorKernelModelPrepare() = default;
23 71 : ~OperatorKernelModelPrepare() = default;
24 : int32_t Compute(const AicpuTaskInfo &kernelTaskInfo, const RunContext &taskContext) override;
25 : private:
26 : int32_t ChecPrepareNullptr(const AicpuPrepareInfo &prepareInfo) const;
27 : int32_t CheckPrepareMaxSize(const AicpuPrepareInfo &prepareInfo) const;
28 : bool CheckPointListNullptr(const uint64_t * const pointList, const uint32_t pointSize) const;
29 : int32_t DoCompute(AicpuPrepareInfo &msgInfo, const RunContext &taskContext) const;
30 : int32_t DequeueMbufList(const AicpuPrepareInfo &msgInfo, ModelPrepareData &prepareData,
31 : std::vector<void *> &inputsData, const RunContext &taskContext) const;
32 : int32_t CopyDequeueDataPtrToInputAddr(AicpuPrepareInfo &msgInfo, const std::vector<void *> &inputsData) const;
33 : int32_t AllocOutputMbufList(AicpuPrepareInfo &msgInfo, Mbuf **lastInputMbuflistPptr,
34 : Mbuf *(&mbufPtrStore)[MAX_SIZE_NUM], const RunContext &taskContext) const;
35 : int32_t GetDataPtrsFromMbufs(const AicpuPrepareInfo &msgInfo, Mbuf *(&mbufPtrStore)[MAX_SIZE_NUM],
36 : void *(&dataPtrStore)[MAX_SIZE_NUM]) const;
37 : int32_t CopyOutputDataPtrToOutputAddr(AicpuPrepareInfo &msgInfo, void * const (&dataPtrStore)[MAX_SIZE_NUM]) const;
38 : int32_t BuildEnqueueMbufPtrList(AicpuPrepareInfo &msgInfo, Mbuf *(&mbufPtrStore)[MAX_SIZE_NUM]) const;
39 : int32_t GetMbufListDataPtr(void *mbufPtr, void **dataAddrPtr, const uint32_t mbufIndex) const;
40 : };
41 : } // namespace AicpuSchedule
42 : #endif // OPERATOR_KERNEL_MODEL_PREPARE_H
|