2 * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef __ONERT_BACKEND_ICONFIG_H__
18 #define __ONERT_BACKEND_ICONFIG_H__
20 #include "ir/Layout.h"
21 #include "ir/IOperation.h"
22 #include "util/ITimer.h"
34 virtual ~IConfig() = default;
36 * @brief Returns ID of the backend
38 * @return std::string ID of this backend
40 virtual std::string id() = 0;
42 * @brief Initialize the backend. This is called as soon as the backend is loaded.
44 * @return true Initialization succeeded
45 * @return false Initialization failed, so it cannot use this backend
47 virtual bool initialize() = 0;
49 * @brief Returns supported layout for the given \p node and \p frontend_layout
51 * @param node IOperation
52 * @param frontend_layout The layout defined in the model
53 * @return ir::Layout The layout that the backend kernel actually uses
55 virtual ir::Layout supportLayout(const ir::IOperation &node, ir::Layout frontend_layout) = 0;
57 * @brief The function that is called after each Operation run on profiling mode.
58 * This may be useful for profiling GPU-based or special computing units.
60 virtual void sync() const {}
62 * @brief Returns Timer object for this backend. For some computing units, it may need its own
63 * Timer implementation.
65 * @return std::unique_ptr<util::ITimer> Timer object for this backend
67 virtual std::unique_ptr<util::ITimer> timer() { return nullptr; }
69 virtual bool supportPermutation() = 0;
70 virtual bool supportDynamicTensor() = 0;
71 virtual bool supportFP16() = 0;
74 } // namespace backend
77 #endif // __ONERT_BACKEND_ICONFIG_H__