Compute Library
 22.08
ClDirectConvolutionKernelComponent.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022 Arm Limited.
3  *
4  * SPDX-License-Identifier: MIT
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to
8  * deal in the Software without restriction, including without limitation the
9  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10  * sell copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all
14  * copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
24 #ifdef ENABLE_EXPERIMENTAL_DYNAMIC_FUSION
25 
26 #ifndef ARM_COMPUTE_EXPERIMENTAL_DYNAMICFUSION_IMPL_COMPONENTS_CLDIRECTCONVOLUTIONKERNELCOMPONENT_H
27 #define ARM_COMPUTE_EXPERIMENTAL_DYNAMICFUSION_IMPL_COMPONENTS_CLDIRECTCONVOLUTIONKERNELCOMPONENT_H
28 
30 
31 #include "utils/TypePrinter.h"
32 
33 namespace arm_compute
34 {
35 namespace experimental
36 {
37 namespace dynamic_fusion
38 {
40 {
41 public:
43  const Link &src, const Link &weight, const Link &dst, const Link &bias = Link{})
44  : IClKernelComponent(blueprint), _desc{ desc }, _src{ src }, _weight{ weight }, _bias{ bias }, _dst{ dst }
45  {
46  }
47 
48  ComponentType get_component_type() const override;
49  std::set<std::string> get_headers_list() const override;
50  std::string get_additional_macros() const override;
51  std::string get_component_code() const override;
52  Window get_window() const override;
54  CLBuildOptions generate_build_options() const override;
55 
56  virtual std::vector<Link> get_links() const override
57  {
58  return { _src, _weight, _bias, _dst };
59  }
60 
61  virtual TagLUT get_tag_lut(const SharedVarTable &vtable) const override;
62  virtual void allocate_shared_vars(SharedVarTable &vtable) const override;
63 
64  virtual std::string name() const override
65  {
66  return "direct_convolution_" + to_string(_blueprint->impl().get_kernel_argument_info(_src.arg_id)->data_layout()) + "_" + std::to_string(id());
67  }
68 
69 private:
71  Link _src{};
72  Link _weight{};
73  Link _bias{};
74  Link _dst{};
75 };
76 
77 } // namespace dynamic_fusion
78 } // namespace experimental
79 } // namespace arm_compute
80 #endif // ARM_COMPUTE_EXPERIMENTAL_DYNAMICFUSION_IMPL_COMPONENTS_CLDIRECTCONVOLUTIONKERNELCOMPONENT_H
81 #endif /* ENABLE_EXPERIMENTAL_DYNAMIC_FUSION */
virtual TagLUT get_tag_lut(const SharedVarTable &vtable) const override
Get the tag look-up table used to instantiate the component code.
std::string to_string(const CLBuildOptions &cl_build_opts)
Definition: Utils.h:51
SimpleTensor< float > src
Definition: DFT.cpp:155
Copyright (c) 2017-2022 Arm Limited.
std::map< int, ClKernelArgDescriptor > ClKernelArgList
Definition: ClWorkload.h:87
Intermediate representation of the final, complete kernel source.
A table of all the variables used in the kernel / blueprint Because we limit the DependencyGraph in t...
Definition: Common.h:92
virtual void allocate_shared_vars(SharedVarTable &vtable) const override
Allocate all shared variables used by the component in the vtable.
Describe a multidimensional execution window.
Definition: Window.h:39
ClDirectConvolutionKernelComponent(ClKernelBlueprint *blueprint, const ClDirectConv2dKernelDescriptor &desc, const Link &src, const Link &weight, const Link &dst, const Link &bias=Link{})
const int32_t * bias