Imported Upstream version 1.12.0
[platform/core/ml/nnfw.git] / runtime / onert / backend / acl_neon / KernelGenerator.h
1 /*
2  * Copyright (c) 2019 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_ACL_NEON_KERNEL_GENERATOR_H__
18 #define __ONERT_BACKEND_ACL_NEON_KERNEL_GENERATOR_H__
19
20 #include <backend/cpu_common/KernelGeneratorBase.h>
21
22 #include "ir/Operands.h"
23 #include "TensorBuilder.h"
24 #include "AclTensorRegistry.h"
25 #include "TensorManager.h"
26
27 namespace onert
28 {
29 namespace backend
30 {
31 namespace acl_neon
32 {
33
34 class KernelGenerator : public cpu_common::KernelGeneratorBase
35 {
36 public:
37   KernelGenerator(const ir::Operands &operands_ctx, const ir::Operations &operations_ctx,
38                   const std::shared_ptr<TensorBuilder> &tensor_builder,
39                   const std::shared_ptr<acl_common::AclTensorRegistry<TensorManager>> &_tensor_reg);
40
41   void visit(const ir::OpSequence &) override;
42
43   void visit(const ir::operation::ArgMinMax &) override;
44   void visit(const ir::operation::BatchToSpaceND &) override;
45   void visit(const ir::operation::BinaryArithmetic &) override;
46   void visit(const ir::operation::Comparison &) override;
47   void visit(const ir::operation::Concat &) override;
48   void visit(const ir::operation::Conv2D &) override;
49   void visit(const ir::operation::DepthToSpace &) override;
50   void visit(const ir::operation::DepthwiseConv2D &) override;
51   void visit(const ir::operation::ElementwiseActivation &) override;
52   void visit(const ir::operation::ElementwiseBinary &) override;
53   void visit(const ir::operation::ElementwiseUnary &) override;
54   void visit(const ir::operation::EmbeddingLookup &) override;
55   void visit(const ir::operation::ExpandDims &) override;
56   void visit(const ir::operation::FullyConnected &) override;
57   void visit(const ir::operation::Gather &) override;
58   void visit(const ir::operation::HashtableLookup &) override;
59   void visit(const ir::operation::InstanceNorm &) override;
60   void visit(const ir::operation::L2Normalization &) override;
61   void visit(const ir::operation::LocalResponseNormalization &) override;
62   void visit(const ir::operation::LSTM &) override;
63   void visit(const ir::operation::OneHot &) override;
64   void visit(const ir::operation::Pack &) override;
65   void visit(const ir::operation::Pad &) override;
66   void visit(const ir::operation::Permute &) override;
67   void visit(const ir::operation::Pool2D &) override;
68   void visit(const ir::operation::PReLU &) override;
69   void visit(const ir::operation::Reduce &) override;
70   void visit(const ir::operation::Reshape &) override;
71   void visit(const ir::operation::ResizeBilinear &) override;
72   void visit(const ir::operation::RNN &) override;
73   void visit(const ir::operation::Slice &) override;
74   void visit(const ir::operation::Softmax &) override;
75   void visit(const ir::operation::SpaceToBatchND &) override;
76   void visit(const ir::operation::SpaceToDepth &) override;
77   void visit(const ir::operation::Split &) override;
78   void visit(const ir::operation::SquaredDifference &) override;
79   void visit(const ir::operation::Squeeze &) override;
80   void visit(const ir::operation::StridedSlice &) override;
81   void visit(const ir::operation::Transpose &) override;
82   void visit(const ir::operation::TransposeConv &) override;
83   void visit(const ir::operation::Unpack &) override;
84
85 private:
86   const ir::Operands &_ctx;
87   const ir::Operations &_operations_ctx;
88   std::shared_ptr<TensorBuilder> _tensor_builder;
89   std::shared_ptr<acl_common::AclTensorRegistry<TensorManager>> _tensor_reg;
90   ir::Layout _current_layout;
91 };
92
93 } // namespace acl_neon
94 } // namespace backend
95 } // namespace onert
96
97 #endif // __ONERT_BACKEND_ACL_NEON_KERNEL_GENERATOR_H__