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_CPU_KERNEL_GENERATOR_H__
18#define __ONERT_BACKEND_CPU_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 cpu
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 op_ind) override;
46
47 void visit(const ir::operation::AddN &) override;
48 void visit(const ir::operation::ArgMinMax &) override;
49 void visit(const ir::operation::BatchMatMul &) override;
50 void visit(const ir::operation::BatchToSpaceND &) override;
51 void visit(const ir::operation::BinaryArithmetic &) override;
52 void visit(const ir::operation::BroadcastTo &) override;
53 void visit(const ir::operation::Comparison &) override;
54 void visit(const ir::operation::Concat &) override;
55 void visit(const ir::operation::Conv2D &) override;
56 void visit(const ir::operation::Custom &node) override;
57 void visit(const ir::operation::DepthToSpace &) override;
58 void visit(const ir::operation::DepthwiseConv2D &) override;
59 void visit(const ir::operation::Einsum &) override;
60 void visit(const ir::operation::ElementwiseActivation &) override;
61 void visit(const ir::operation::ElementwiseBinary &) override;
62 void visit(const ir::operation::ElementwiseUnary &) override;
63 void visit(const ir::operation::ExpandDims &) override;
64 void visit(const ir::operation::Fill &) override;
65 void visit(const ir::operation::FullyConnected &) override;
66 void visit(const ir::operation::FusedBatchNorm &) override;
67 void visit(const ir::operation::Gather &) override;
68 void visit(const ir::operation::L2Normalization &) override;
69 void visit(const ir::operation::LogSoftmax &) override;
70 void visit(const ir::operation::LSTM &) override;
71 void visit(const ir::operation::MatrixBandPart &) override;
72 void visit(const ir::operation::DetectionPostProcess &) override;
73 void visit(const ir::operation::OneHot &) override;
74 void visit(const ir::operation::Pack &) override;
75 void visit(const ir::operation::Pad &) override;
76 void visit(const ir::operation::Pool2D &) override;
77 void visit(const ir::operation::Pow &) override;
78 void visit(const ir::operation::Range &) override;
79 void visit(const ir::operation::Rank &) override;
80 void visit(const ir::operation::Reduce &) override;
81 void visit(const ir::operation::Reshape &) override;
82 void visit(const ir::operation::ResizeBilinear &node) override;
83 void visit(const ir::operation::Reverse &) override;
84 void visit(const ir::operation::RmsNorm &) override;
85 void visit(const ir::operation::RoPE &) override;
86 void visit(const ir::operation::Select &) override;
87 void visit(const ir::operation::Shape &) override;
88 void visit(const ir::operation::Slice &) override;
89 void visit(const ir::operation::Softmax &) override;
90 void visit(const ir::operation::SpaceToBatchND &) override;
91 void visit(const ir::operation::SpaceToDepth &) override;
92 void visit(const ir::operation::Split &) override;
93 void visit(const ir::operation::SplitV &) override;
94 void visit(const ir::operation::SquaredDifference &) override;
95 void visit(const ir::operation::Squeeze &) override;
96 void visit(const ir::operation::StatelessRandomUniform &) override;
97 void visit(const ir::operation::StridedSlice &) override;
98 void visit(const ir::operation::Tile &) override;
99 void visit(const ir::operation::Transpose &) override;
100 void visit(const ir::operation::Unpack &) override;
101
102private:
103 const ir::Operands &_ctx;
104 const ir::Operations &_operations_ctx;
105 std::shared_ptr<TensorBuilder> _tensor_builder;
106 std::shared_ptr<basic::TensorRegistry> _tensor_reg;
107 std::shared_ptr<backend::custom::IKernelBuilder> _kernel_builder;
108 const std::shared_ptr<ExternalContext> _external_context;
109};
110
111} // namespace cpu
112} // namespace backend
113} // namespace onert
114
115#endif // __ONERT_BACKEND_CPU_KERNEL_GENERATOR_H__
void visit(const ir::operation::AddN &) override
std::unique_ptr< exec::FunctionSequence > generate(ir::OperationIndex op_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)