ONE - On-device Neural Engine
Loading...
Searching...
No Matches
KernelGenerator.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
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 __ONERT_BACKEND_XNNPACK_KERNEL_GENERATOR_H__
18#define __ONERT_BACKEND_XNNPACK_KERNEL_GENERATOR_H__
19
20#include "ExternalContext.h"
21#include "TensorBuilder.h"
23#include "Tensor.h"
24
27#include <ir/Operands.h>
28#include <ir/Operations.h>
29
30namespace onert
31{
32namespace backend
33{
34namespace xnnpack
35{
36
38{
39public:
40 KernelGenerator(const ir::Graph &graph, const std::shared_ptr<TensorBuilder> &tensor_builder,
41 const std::shared_ptr<basic::TensorRegistry> &tensor_reg,
42 const std::shared_ptr<custom::IKernelBuilder> &kernel_builder,
43 const std::shared_ptr<ExternalContext> &external_context);
44
45 std::unique_ptr<exec::FunctionSequence> generate(ir::OperationIndex ind) override;
46
47private:
48 void visit(const ir::operation::Conv2D &) override;
49 void visit(const ir::operation::DepthwiseConv2D &) override;
50 void visit(const ir::operation::FullyConnected &) override;
51
52private:
53 const ir::Operands &_ctx;
54 const ir::Operations &_operations_ctx;
55 std::shared_ptr<TensorBuilder> _tensor_builder;
56 std::shared_ptr<basic::TensorRegistry> _tensor_reg;
57 std::shared_ptr<backend::custom::IKernelBuilder> _kernel_builder;
58 const std::shared_ptr<ExternalContext> _external_context;
59};
60
61} // namespace xnnpack
62} // namespace backend
63} // namespace onert
64
65#endif // __ONERT_BACKEND_XNNPACK_KERNEL_GENERATOR_H__
std::unique_ptr< exec::FunctionSequence > generate(ir::OperationIndex ind) override
KernelGenerator(const ir::Graph &graph, const std::shared_ptr< TensorBuilder > &tensor_builder, const std::shared_ptr< basic::TensorRegistry > &tensor_reg, const std::shared_ptr< custom::IKernelBuilder > &kernel_builder, const std::shared_ptr< ExternalContext > &external_context)