1 /** 2 * Copyright 2023 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 17 #ifndef MINDSPORE_MINDSPORE_CCSRC_KERNEL_PYBOOST_PYBOOST_KERNEL_EXTRA_FUNC_H_ 18 #define MINDSPORE_MINDSPORE_CCSRC_KERNEL_PYBOOST_PYBOOST_KERNEL_EXTRA_FUNC_H_ 19 20 #include <memory> 21 #include <string> 22 #include <utility> 23 #include <vector> 24 #include "kernel/kernel.h" 25 26 namespace mindspore { 27 namespace kernel { 28 namespace pyboost { 29 class BACKEND_EXPORT PyboostKernelExtraFunc { 30 public: 31 virtual ~PyboostKernelExtraFunc() = default; SetThreadPool(const kernel::KernelModPtr & kernel)32 virtual void SetThreadPool(const kernel::KernelModPtr &kernel) {} 33 virtual bool IsPyBoostCustomRegistered(const std::string &op_name) = 0; 34 virtual bool IsKernelModRegistered(const std::string &op_name) = 0; 35 virtual bool IsEnableProfiler() = 0; 36 virtual void LaunchKernelWithProfiler(const std::string &op_name, const device::DeviceContext *device_context, 37 const std::vector<BaseShapePtr> &base_shape, 38 const std::function<void()> &func) = 0; 39 }; 40 41 using PyboostKernelExtraFuncPtr = std::shared_ptr<PyboostKernelExtraFunc>; 42 } // namespace pyboost 43 } // namespace kernel 44 } // namespace mindspore 45 #endif // MINDSPORE_MINDSPORE_CCSRC_KERNEL_PYBOOST_PYBOOST_KERNEL_EXTRA_FUNC_H_ 46