blob: 29276c3257a6e05fe40832804900b04b42dab0c3 [file] [log] [blame]
Jakub Sujak8ae57142022-12-02 16:09:06 +00001/*
Gunes Bayir91cb7332023-07-25 17:00:33 +01002 * Copyright (c) 2022-2023 Arm Limited.
Jakub Sujak8ae57142022-12-02 16:09:06 +00003 *
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
25#ifndef SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTRESIZE
26#define SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTRESIZE
27
28#include "arm_compute/dynamic_fusion/sketch/attributes/ResizeAttributes.h"
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010029
Jakub Sujak8ae57142022-12-02 16:09:06 +000030#include "src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h"
31
32namespace arm_compute
33{
34/** Forward declaration */
35class ITensorInfo;
36namespace experimental
37{
38namespace dynamic_fusion
39{
40/** Forward declaration */
41template <typename T>
42class ArgumentPack;
43
44/** Forward declaration */
Gunes Bayir91cb7332023-07-25 17:00:33 +010045#ifndef ACL_INTERNAL_TEST_CKW_IN_DF
Jakub Sujak8ae57142022-12-02 16:09:06 +000046class ClTemplateResize;
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010047#else // ACL_INTERNAL_TEST_CKW_IN_DF
Gunes Bayir91cb7332023-07-25 17:00:33 +010048class GpuCkwResize;
49#endif // ACL_INTERNAL_TEST_CKW_IN_DF
Jakub Sujak8ae57142022-12-02 16:09:06 +000050
51class ClComponentResize final : public IGpuKernelComponent
52{
53public:
54 /** Attributes are a set of backend-agnostic parameters that define what a component does */
55 using Attributes = ResizeAttributes;
56
57 /** Validate the component
58 *
59 * @param[in] properties Component properties @ref Properties
60 * @param[in,out] tensors Tensor arguments to the component
61 * @param[in] attributes Component attributes @ref Attributes
62 *
63 * @return Status Validation results
64 *
65 * Tensor argument names:
66 * - ACL_SRC_0: Input
67 * - ACL_DST_0: Output
68 *
69 * Tensor argument constness:
70 * - ACL_SRC_0: Const
71 * - ACL_DST_0: Const
72 *
73 * Valid data layouts:
74 * - NHWC
75 *
76 ** Valid data type configurations:
77 * |ACL_SRC_0 |ACL_DST_0 |
78 * |:--------------|:--------------|
79 * |QASYMM8 |QASYMM8 |
80 * |QASYMM8_SIGNED |QASYMM8_SIGNED |
81 * |F16 |F16 |
82 * |F32 |F32 |
83 * |U8 |U8 |
84 * |S16 |S16 |
85 */
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010086 static Status
87 validate(const Properties &properties, const ArgumentPack<ITensorInfo> &tensors, const Attributes &attributes);
Jakub Sujak8ae57142022-12-02 16:09:06 +000088
89 /** Constructor
90 *
91 * Similar to @ref ClComponentResize::validate()
92 */
93 ClComponentResize(ComponentId id,
94 const Properties &properties,
95 const ArgumentPack<ITensorInfo> &tensors,
96 const Attributes &attributes);
97
98 /** Destructor */
99 ~ClComponentResize() override;
100
101 /** Prevent instances of this class from being copy constructed */
102 ClComponentResize(const ClComponentResize &component) = delete;
103
104 /** Prevent instances of this class from being copied */
105 ClComponentResize &operator=(const ClComponentResize &component) = delete;
106
107 /** Allow instances of this class to be move constructed */
108 ClComponentResize(ClComponentResize &&component) = default;
109
110 /** Allow instances of this class to be moved */
111 ClComponentResize &operator=(ClComponentResize &&component) = default;
112
Gunes Bayir91cb7332023-07-25 17:00:33 +0100113 /** Get writer for the component */
114#ifndef ACL_INTERNAL_TEST_CKW_IN_DF
Jakub Sujak8ae57142022-12-02 16:09:06 +0000115 const IGpuTemplateComponentWriter *template_writer() const override;
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100116#else // ACL_INTERNAL_TEST_CKW_IN_DF
Gunes Bayir91cb7332023-07-25 17:00:33 +0100117 const IGpuCkwComponentDriver *ckw_component_driver() const override;
118#endif // ACL_INTERNAL_TEST_CKW_IN_DF
Jakub Sujak8ae57142022-12-02 16:09:06 +0000119
120 /** Get component type */
121 GpuComponentType type() const override
122 {
123 return GpuComponentType::Complex;
124 }
125
126private:
Gunes Bayir91cb7332023-07-25 17:00:33 +0100127#ifndef ACL_INTERNAL_TEST_CKW_IN_DF
Jakub Sujak8ae57142022-12-02 16:09:06 +0000128 std::unique_ptr<ClTemplateResize> _component_writer;
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100129#else // ACL_INTERNAL_TEST_CKW_IN_DF
Gunes Bayir91cb7332023-07-25 17:00:33 +0100130 std::unique_ptr<GpuCkwResize> _component_writer;
131#endif // ACL_INTERNAL_TEST_CKW_IN_DF
Jakub Sujak8ae57142022-12-02 16:09:06 +0000132};
133
134} // namespace dynamic_fusion
135} // namespace experimental
136} // namespace arm_compute
137
138#endif /* SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTRESIZE */