blob: 474524f8fcad8a09626ed597ef59fcb8c7864c1a [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"
29#include "src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h"
30
31namespace arm_compute
32{
33/** Forward declaration */
34class ITensorInfo;
35namespace experimental
36{
37namespace dynamic_fusion
38{
39/** Forward declaration */
40template <typename T>
41class ArgumentPack;
42
43/** Forward declaration */
Gunes Bayir91cb7332023-07-25 17:00:33 +010044#ifndef ACL_INTERNAL_TEST_CKW_IN_DF
Jakub Sujak8ae57142022-12-02 16:09:06 +000045class ClTemplateResize;
Gunes Bayir91cb7332023-07-25 17:00:33 +010046#else // ACL_INTERNAL_TEST_CKW_IN_DF
47class GpuCkwResize;
48#endif // ACL_INTERNAL_TEST_CKW_IN_DF
Jakub Sujak8ae57142022-12-02 16:09:06 +000049
50class ClComponentResize final : public IGpuKernelComponent
51{
52public:
53 /** Attributes are a set of backend-agnostic parameters that define what a component does */
54 using Attributes = ResizeAttributes;
55
56 /** Validate the component
57 *
58 * @param[in] properties Component properties @ref Properties
59 * @param[in,out] tensors Tensor arguments to the component
60 * @param[in] attributes Component attributes @ref Attributes
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 * |QASYMM8 |QASYMM8 |
79 * |QASYMM8_SIGNED |QASYMM8_SIGNED |
80 * |F16 |F16 |
81 * |F32 |F32 |
82 * |U8 |U8 |
83 * |S16 |S16 |
84 */
85 static Status validate(
86 const Properties &properties,
87 const ArgumentPack<ITensorInfo> &tensors,
88 const Attributes &attributes);
89
90 /** Constructor
91 *
92 * Similar to @ref ClComponentResize::validate()
93 */
94 ClComponentResize(ComponentId id,
95 const Properties &properties,
96 const ArgumentPack<ITensorInfo> &tensors,
97 const Attributes &attributes);
98
99 /** Destructor */
100 ~ClComponentResize() override;
101
102 /** Prevent instances of this class from being copy constructed */
103 ClComponentResize(const ClComponentResize &component) = delete;
104
105 /** Prevent instances of this class from being copied */
106 ClComponentResize &operator=(const ClComponentResize &component) = delete;
107
108 /** Allow instances of this class to be move constructed */
109 ClComponentResize(ClComponentResize &&component) = default;
110
111 /** Allow instances of this class to be moved */
112 ClComponentResize &operator=(ClComponentResize &&component) = default;
113
Gunes Bayir91cb7332023-07-25 17:00:33 +0100114 /** Get writer for the component */
115#ifndef ACL_INTERNAL_TEST_CKW_IN_DF
Jakub Sujak8ae57142022-12-02 16:09:06 +0000116 const IGpuTemplateComponentWriter *template_writer() const override;
Gunes Bayir91cb7332023-07-25 17:00:33 +0100117#else // ACL_INTERNAL_TEST_CKW_IN_DF
118 const IGpuCkwComponentDriver *ckw_component_driver() const override;
119#endif // ACL_INTERNAL_TEST_CKW_IN_DF
Jakub Sujak8ae57142022-12-02 16:09:06 +0000120
121 /** Get component type */
122 GpuComponentType type() const override
123 {
124 return GpuComponentType::Complex;
125 }
126
127private:
Gunes Bayir91cb7332023-07-25 17:00:33 +0100128#ifndef ACL_INTERNAL_TEST_CKW_IN_DF
Jakub Sujak8ae57142022-12-02 16:09:06 +0000129 std::unique_ptr<ClTemplateResize> _component_writer;
Gunes Bayir91cb7332023-07-25 17:00:33 +0100130#else // ACL_INTERNAL_TEST_CKW_IN_DF
131 std::unique_ptr<GpuCkwResize> _component_writer;
132#endif // ACL_INTERNAL_TEST_CKW_IN_DF
Jakub Sujak8ae57142022-12-02 16:09:06 +0000133};
134
135} // namespace dynamic_fusion
136} // namespace experimental
137} // namespace arm_compute
138
139#endif /* SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTRESIZE */