ONE - On-device Neural Engine
Loading...
Searching...
No Matches
KernelGenerator.cc
Go to the documentation of this file.
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#include "KernelGenerator.h"
18
19#include <arm_compute/runtime/NEON/NEFunctions.h> // Include all ARM Compute NEON functions
20#include <arm_compute/runtime/NEON/NEFunctionsEx.h> // Include all ARM Compute EX NEON functions
21
23#include <AclFunction.h>
24#include <Convert.h>
25#include <Swizzle.h>
26
27#include "ir/Index.h"
28#include "ir/DataType.h"
29#include "ir/InternalType.h"
30#include "exec/NopFunction.h"
31#include "util/logging.h"
32#include "AclKernelGen.h"
33
35{
36
37using ::onert::backend::acl_common::asAclFunction;
39 ::arm_compute::ITensor, ::arm_compute::NEActivationLayer, acl_common::AclFunction>;
40
42 const ir::Graph &graph, const std::shared_ptr<TensorBuilder> &tensor_builder,
43 const std::shared_ptr<acl_common::AclTensorRegistry<TensorManager>> &tensor_reg)
44 : basic::KernelGeneratorBase{graph}, _ctx(graph.operands()), _operations_ctx(graph.operations()),
45 _tensor_builder(tensor_builder), _tensor_reg(tensor_reg)
46{
47 // DO NOTHING
48}
49
50std::unique_ptr<exec::FunctionSequence> KernelGenerator::generate(ir::OperationIndex ind)
51{
52 auto ret = std::make_unique<exec::FunctionSequence>();
53 ret->enableDynamicShapeInferer(false);
54
55 const auto &op = _graph.operations().at(ind);
56 op.accept(*this);
57 ret->append(releaseFunction());
58 return ret;
59}
60
61} // namespace onert::backend::acl_neon
This file defines NopFunction.
Tensor registry class for acl backends.
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< acl_common::AclTensorRegistry< TensorManager > > &_tensor_reg)
std::unique_ptr< exec::IFunction > releaseFunction()
const Operations & operations() const override
Definition Graph.h:105
const Object & at(const Index &index) const
Get the object that is associated with the given index.