2 * Copyright (c) 2019 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_ACL_CL_KERNEL_GENERATOR_H__
18 #define __ONERT_BACKEND_ACL_CL_KERNEL_GENERATOR_H__
20 #include <backend/IKernelGenerator.h>
22 #include "ir/Operands.h"
23 #include "TensorBuilder.h"
24 #include "AclTensorRegistry.h"
25 #include "TensorManager.h"
34 class KernelGenerator : public IKernelGenerator
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);
41 void visit(const ir::OpSequence &) override;
42 void visit(const ir::operation::BatchToSpaceND &) override;
43 void visit(const ir::operation::BinaryArithmetic &) override;
44 void visit(const ir::operation::Conv2D &) override;
45 void visit(const ir::operation::DepthwiseConv2D &) override;
46 void visit(const ir::operation::Concat &) override;
47 void visit(const ir::operation::FullyConnected &) override;
48 void visit(const ir::operation::Reduce &) override;
49 void visit(const ir::operation::Reshape &) override;
50 void visit(const ir::operation::Squeeze &) override;
51 void visit(const ir::operation::Softmax &) override;
52 void visit(const ir::operation::Slice &) override;
53 void visit(const ir::operation::StridedSlice &) override;
54 void visit(const ir::operation::Transpose &) override;
55 void visit(const ir::operation::ElementwiseActivation &) override;
56 void visit(const ir::operation::ElementwiseBinary &) override;
57 void visit(const ir::operation::ElementwiseUnary &) override;
58 void visit(const ir::operation::ExpandDims &) override;
59 void visit(const ir::operation::InstanceNorm &) override;
60 void visit(const ir::operation::Comparison &) override;
61 void visit(const ir::operation::LSTM &) override;
62 void visit(const ir::operation::OneHot &) override;
63 void visit(const ir::operation::Pack &) override;
64 void visit(const ir::operation::Pool2D &) override;
65 void visit(const ir::operation::Permute &) override;
66 void visit(const ir::operation::ResizeBilinear &) override;
67 void visit(const ir::operation::ResizeNearestNeighbor &) override;
68 void visit(const ir::operation::RNN &) override;
69 void visit(const ir::operation::SpaceToBatchND &) override;
70 void visit(const ir::operation::SpaceToDepth &) override;
71 void visit(const ir::operation::EmbeddingLookup &) override;
72 void visit(const ir::operation::L2Normalization &) override;
73 void visit(const ir::operation::HashtableLookup &) override;
74 void visit(const ir::operation::PReLU &) override;
75 void visit(const ir::operation::TransposeConv &) override;
76 void visit(const ir::operation::SquaredDifference &) override;
77 void visit(const ir::operation::TopKV2 &) override;
78 void visit(const ir::operation::Gather &) override;
79 void visit(const ir::operation::ArgMax &) override;
80 void visit(const ir::operation::LocalResponseNormalization &) override;
81 void visit(const ir::operation::DepthToSpace &) override;
82 void visit(const ir::operation::Split &) override;
83 void visit(const ir::operation::SplitV &) override;
84 void visit(const ir::operation::Unpack &) override;
85 void visit(const ir::operation::Pad &) override;
86 void visit(const ir::operation::ConvertFp32ToFp16 &) override;
87 void visit(const ir::operation::ConvertFp16ToFp32 &) override;
88 void visit(const ir::operation::Reverse &) override;
91 const ir::Operands &_ctx;
92 const ir::Operations &_operations_ctx;
93 std::shared_ptr<TensorBuilder> _tensor_builder;
94 std::shared_ptr<acl_common::AclTensorRegistry<TensorManager>> _tensor_reg;
95 ir::Layout _current_op_seq_layout;
99 } // namespace backend
102 #endif // __ONERT_BACKEND_ACL_CL_KERNEL_GENERATOR_H__