blob: 896048e27aa82ec91366ee8f649f3db680754133 [file] [log] [blame]
Mohammed Suhail Munshia18d85c2023-01-03 10:16:16 +00001/*
2 * Copyright (c) 2023 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#ifndef SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTPOOL2D
25#define SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTPOOL2D
26
27#include "arm_compute/dynamic_fusion/sketch/gpu/operators/GpuPool2d.h"
28#include "src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h"
29
30namespace arm_compute
31{
32/** Forward declaration */
33class ITensorInfo;
34namespace experimental
35{
36namespace dynamic_fusion
37{
38/** Forward declaration */
39template <typename T>
40class ArgumentPack;
41class Pool2dAttributes;
42
43/** Forward declaration */
44class ClTemplatePool2d;
45
46class ClComponentPool2d final : public IGpuKernelComponent
47{
48public:
49 /** Attributes are a set of backend-agnostic parameters that define what a component does */
50 using Attributes = Pool2dAttributes;
51 /** Settings are a set of backend-specific parameters that influence the implementation of a component */
52 using Settings = GpuPool2dSettings;
53
54public:
55 /** Validate the component
56 *
57 * @param[in] properties Component properties
58 * @param[in,out] tensors Tensor arguments to the component
59 * @param[in] attributes Component attributes
60 * @param[in] settings Component settings
61 *
62 * @return Status Validation results
63 *
64 * Tensor argument names:
65 * - ACL_SRC_0: Input
66 * - ACL_DST_0: Output
67 *
68 * Tensor argument constness:
69 * - ACL_SRC_0: Const
70 * - ACL_DST_0: Const
71 *
72 * Valid data layouts:
73 * - NHWC
74 *
75 * Valid data type configurations:
76 * |ACL_SRC_0 |ACL_DST_0 |
77 * |:--------------|:--------------|
78 * |F16 |F16 |
79 * |F32 |F32 |
80 */
81 static Status validate(
82 const Properties &properties,
83 const ArgumentPack<ITensorInfo> &tensors,
84 const Attributes &attributes,
85 const Settings &settings);
86
87 /** Constructor
88 *
89 * @param[in] id Unique Component Identifier within a workload
90 * @param[in] properties Component properties
91 * @param[in,out] tensors Tensor arguments to the component
92 * @param[in] attributes Component attributes
93 * @param[in] settings Component settings
94 */
95 ClComponentPool2d(
96 ComponentId id,
97 const Properties &properties,
98 const ArgumentPack<ITensorInfo> &tensors,
99 const Attributes &attributes,
100 const Settings &settings);
101
102 /** Destructor */
103 ~ClComponentPool2d() override;
104
105 /** Prevent instances of this class from being copy constructed */
106 ClComponentPool2d(const ClComponentPool2d &component) = delete;
107
108 /** Prevent instances of this class from being copied */
109 ClComponentPool2d &operator=(const ClComponentPool2d &component) = delete;
110
111 /** Allow instances of this class to be move constructed */
112 ClComponentPool2d(ClComponentPool2d &&component) = default;
113
114 /** Allow instances of this class to be moved */
115 ClComponentPool2d &operator=(ClComponentPool2d &&component) = default;
116
117 /** Get template writer for the component */
118 const IGpuTemplateComponentWriter *template_writer() const override;
119
120 /** Get component type */
121 GpuComponentType type() const override
122 {
123 return GpuComponentType::Unfusable;
124 }
125
126private:
127 std::unique_ptr<ClTemplatePool2d> _component_writer;
128};
129} // namespace dynamic_fusion
130} // namespace experimental
131} // namespace arm_compute
132#endif /* SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTPOOL2D */