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 __AE_KERNEL_LIB_BASE_H_
12 : #define __AE_KERNEL_LIB_BASE_H_
13 :
14 : #include <vector>
15 : #include <string>
16 : #include <mutex>
17 : #include "aicpu_engine.h"
18 : #include "aicpu_event_struct.h"
19 : #include "ae_so_manager.hpp"
20 :
21 : namespace cce {
22 : // max kernel name len
23 : constexpr uint32_t AE_MAX_KERNEL_NAME = 200U;
24 : // max so name len
25 : constexpr uint32_t AE_MAX_SO_NAME = 100U;
26 :
27 : /*
28 : * Abstract Class
29 : * To define All AI Kernel lib Abstract interface
30 : */
31 : class AIKernelsLibBase {
32 : public:
33 12 : AIKernelsLibBase() = default;
34 11 : virtual ~AIKernelsLibBase() = default;
35 : virtual aeStatus_t Init();
36 : virtual int32_t CallKernelApi(const aicpu::KernelType kernelType, const void * const kernelBase) = 0;
37 : virtual aeStatus_t CloseSo(const char_t * const soName) = 0;
38 : virtual aeStatus_t BatchLoadKernelSo(const aicpu::KernelType kernelType,
39 : std::vector<std::string> &soVec) = 0;
40 :
41 : protected:
42 : cce::MultiSoManager soMngr_; // So manager to manage all cce so in process.
43 : aicpu::AicpuRunMode runMode_; // aicpu run mode
44 : };
45 : }
46 : #endif
|