1 /** 2 * Copyright 2024 Huawei Technologies Co., Ltd 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 #ifndef AICPU_CPU_KERNEL_INC_MS_CPU_KERNEL_H 17 #define AICPU_CPU_KERNEL_INC_MS_CPU_KERNEL_H 18 #include "inc/cpu_kernel.h" 19 20 #define REGISTER_CUST_KERNEL(type, clazz) \ 21 std::shared_ptr<CpuKernel> Creator_Cust##type##_Kernel() { \ 22 std::shared_ptr<clazz> ptr = nullptr; \ 23 ptr = MakeShared<clazz>(); \ 24 return ptr; \ 25 } \ 26 bool g_Cust##type##_Kernel_Creator __attribute__((unused)) = \ 27 RegistCpuKernel("Cust" + static_cast<std::string>(type), Creator_Cust##type##_Kernel) 28 29 #define REGISTER_MS_CPU_KERNEL(type, clazz) \ 30 REGISTER_CPU_KERNEL(type, clazz); \ 31 REGISTER_CUST_KERNEL(type, clazz); 32 33 enum KernelStatus : uint32_t { 34 KERNEL_STATUS_OK = 0, 35 KERNEL_STATUS_PARAM_INVALID = 1, 36 KERNEL_STATUS_INNER_ERROR = 2, 37 KERNEL_STATUS_TIMEOUT = 3, 38 KERNEL_STATUS_PROTOBUF_ERROR = 4, 39 KERNEL_STATUS_SHARDER_ERROR = 5, 40 KERNEL_STATUS_END_OF_SEQUENCE = 201 41 }; 42 #endif 43