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 #ifndef SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTACTIVATION 25 #define SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTACTIVATION 26 27 #include "src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h" 28 29 namespace arm_compute 30 { 31 /** Forward declaration */ 32 class ITensorInfo; 33 namespace experimental 34 { 35 namespace dynamic_fusion 36 { 37 /** Forward declaration */ 38 template <typename T> 39 class ArgumentPack; 40 41 /** Forward declaration */ 42 class ClTemplateActivation; 43 44 class ClComponentActivation final : public IGpuKernelComponent 45 { 46 public: 47 /** Attributes are a set of backend-agnostic parameters that define what a component does */ 48 using Attributes = ActivationLayerInfo; 49 50 /** Validate the component 51 * 52 * @param[in] properties Component properties @ref Properties 53 * @param[in, out] tensors Tensor arguments to the component 54 * @param[in] attributes Component attributes @ref Attributes 55 * 56 * @return Status Validation results 57 * 58 * Tensor argument names: 59 * - ACL_SRC: Input 60 * - ACL_DST: Output 61 * 62 * Tensor argument constness: 63 * - ACL_SRC: Const 64 * - ACL_DST: Const 65 * 66 * Valid data layouts: 67 * - All 68 * 69 * Valid data type configurations: 70 * |ACL_SRC |ACL_DST | 71 * |:--------------|:--------------| 72 * |F16 |F16 | 73 * |F32 |F32 | 74 */ 75 static Status validate( 76 const Properties &properties, 77 const ArgumentPack<ITensorInfo> &tensors, 78 const Attributes &attributes); 79 80 /** Constructor 81 * 82 * Similar to @ref ClComponentActivation::validate() 83 */ 84 ClComponentActivation( 85 ComponentId id, 86 const Properties &properties, 87 const ArgumentPack<ITensorInfo> &tensors, 88 const Attributes &attributes); 89 90 /** Destructor */ 91 ~ClComponentActivation() override = default; 92 93 /** Prevent instances of this class from being copy constructed */ 94 ClComponentActivation(const ClComponentActivation &component) = delete; 95 96 /** Prevent instances of this class from being copied */ 97 ClComponentActivation &operator=(const ClComponentActivation &component) = delete; 98 99 /** Allow instances of this class to be move constructed */ 100 ClComponentActivation(ClComponentActivation &&component) = default; 101 102 /** Allow instances of this class to be moved */ 103 ClComponentActivation &operator=(ClComponentActivation &&component) = default; 104 105 /** Get template writer for the component */ 106 const IGpuTemplateComponentWriter *template_writer() const override; 107 108 /** Get component type */ type()109 GpuComponentType type() const override 110 { 111 return GpuComponentType::Simple; 112 } 113 114 private: 115 std::unique_ptr<ClTemplateActivation> _component_writer; 116 }; 117 } // namespace dynamic_fusion 118 } // namespace experimental 119 } // namespace arm_compute 120 #endif /* SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTACTIVATION */ 121