blob: f8d165b4c8d2b9a3d105c70587b51d6f7fc2ac23 [file] [log] [blame]
Ramy Elgammalf800adf2022-12-14 15:39:29 +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_CLCOMPONENTRESHAPE
25#define SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTRESHAPE
26
27#include "src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h"
28
29namespace arm_compute
30{
31/** Forward declaration */
32class ITensorInfo;
33namespace experimental
34{
35namespace dynamic_fusion
36{
37/** Forward declaration */
38template <typename T>
39class ArgumentPack;
40
41/** Forward declaration */
42class ClTemplateReshape;
43
44class ClComponentReshape final : public IGpuKernelComponent
45{
46public:
47public:
48 /** Validate the component
49 *
50 * @param[in,out] tensors Tensor arguments to the component
51 *
52 * @return Status Validation results
53 *
54 * Tensor argument names:
55 * - ACL_SRC_0: src
56 * - ACL_DST_0: dst
57 *
58 * Tensor argument constness:
59 * - ACL_SRC_0: Const
60 * - ACL_DST_0: Const
61 *
62 * Valid data layouts:
63 * - All
64 *
65 * Valid data type configurations:
66 * - All
67 */
68 static Status validate(const ArgumentPack<ITensorInfo> &tensors);
69
70 /** Constructor
71 *
72 * @param[in] id Component id
73 * @param[in] properties Component properties @ref Properties
74 * @param[in] tensors Tensor arguments to the component
75 */
76 ClComponentReshape(
77 ComponentId id,
78 const Properties &properties,
79 const ArgumentPack<ITensorInfo> &tensors);
80
81 /** Destructor */
82 ~ClComponentReshape() override;
83 /** Prevent instances of this class from being copy constructed */
84 ClComponentReshape(const ClComponentReshape &component) = delete;
85 /** Prevent instances of this class from being copied */
86 ClComponentReshape &operator=(const ClComponentReshape &component) = delete;
87 /** Allow instances of this class to be move constructed */
88 ClComponentReshape(ClComponentReshape &&component) = default;
89 /** Allow instances of this class to be moved */
90 ClComponentReshape &operator=(ClComponentReshape &&component) = default;
91 /** Get template writer for the component */
92 const IGpuTemplateComponentWriter *template_writer() const override;
93 /** Get component type */
94 GpuComponentType type() const override
95 {
96 return GpuComponentType::Complex;
97 }
98
99private:
100 std::unique_ptr<ClTemplateReshape> _component_writer;
101};
102} // namespace dynamic_fusion
103} // namespace experimental
104} // namespace arm_compute
105
106#endif /* SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTRESHAPE */