2 * Copyright (c) 2020 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_XNNPACK_KERNEL_GENERATOR_H__
18 #define __ONERT_BACKEND_XNNPACK_KERNEL_GENERATOR_H__
20 #include "ExternalContext.h"
21 #include "TensorBuilder.h"
22 #include "backend/cpu_common/TensorRegistry.h"
25 #include <backend/CustomKernelBuilder.h>
26 #include <backend/cpu_common/KernelGeneratorBase.h>
27 #include <ir/Operands.h>
28 #include <ir/Operations.h>
37 class KernelGenerator : public cpu_common::KernelGeneratorBase
40 KernelGenerator(const ir::Operands &operands_ctx, const ir::Operations &operations_ctx,
41 const std::shared_ptr<TensorBuilder> &tensor_builder,
42 const std::shared_ptr<cpu_common::TensorRegistry> &tensor_reg,
43 const std::shared_ptr<custom::IKernelBuilder> &kernel_builder,
44 const std::shared_ptr<ExternalContext> &external_context);
46 void visit(const ir::OpSequence &) override;
47 void visit(const ir::operation::Conv2D &) override;
48 void visit(const ir::operation::DepthwiseConv2D &) override;
49 void visit(const ir::operation::FullyConnected &) override;
52 const ir::Operands &_ctx;
53 const ir::Operations &_operations_ctx;
54 std::shared_ptr<TensorBuilder> _tensor_builder;
55 std::shared_ptr<cpu_common::TensorRegistry> _tensor_reg;
56 std::shared_ptr<backend::custom::IKernelBuilder> _kernel_builder;
57 ir::Layout _current_layout;
58 const std::shared_ptr<ExternalContext> _external_context;
61 } // namespace xnnpack
62 } // namespace backend
65 #endif // __ONERT_BACKEND_XNNPACK_KERNEL_GENERATOR_H__