diff options
author | Gunes Bayir <gunes.bayir@arm.com> | 2024-02-07 15:34:45 +0000 |
---|---|---|
committer | Gunes Bayir <gunes.bayir@arm.com> | 2024-02-09 15:59:45 +0000 |
commit | 0ee13afc4429411de9a05ba4c2ff8a580784b568 (patch) | |
tree | c9ee1acf684d52b92ffb7500b0b65eee8377ce45 /src/dynamic_fusion/sketch/gpu/components | |
parent | a3e1b50588b89a2c0c67da2679728a422fc16402 (diff) | |
download | ComputeLibrary-0ee13afc4429411de9a05ba4c2ff8a580784b568.tar.gz |
Remove CKW prototype and Template Writer
Gpu code in dynamic fusion is now written by stable CKW. We do not need CKW protoype and the older writer implementation, i.e. TemplateWriter.
It also removes the need for the flag -DACL_INTERNAL_TEST_CKW_IN_DF to compile and test dynamic fusion operator.
Resolves: COMPMID-6715
Signed-off-by: Gunes Bayir <gunes.bayir@arm.com>
Change-Id: I9f9453311e79d9be612bd4754240d832f98503e8
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/11116
Benchmark: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Jakub Sujak <jakub.sujak@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/dynamic_fusion/sketch/gpu/components')
24 files changed, 60 insertions, 712 deletions
diff --git a/src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h b/src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h index 4b8eea2f57..6678c929e9 100644 --- a/src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h +++ b/src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Arm Limited. + * Copyright (c) 2022-2024 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -21,8 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_IGPUKERNELCOMPONENT -#define ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_IGPUKERNELCOMPONENT +#ifndef ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_IGPUKERNELCOMPONENT_H +#define ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_IGPUKERNELCOMPONENT_H #include "src/dynamic_fusion/sketch/ArgumentPack.h" #include "src/dynamic_fusion/sketch/gpu/GpuWorkloadSourceCode.h" @@ -100,10 +100,6 @@ public: return _properties; } /** Get writer for the component */ - virtual const IGpuTemplateComponentWriter *template_writer() const - { - return nullptr; - } virtual const IGpuCkwComponentDriver *ckw_component_driver() const { return nullptr; @@ -119,4 +115,4 @@ private: } // namespace dynamic_fusion } // namespace experimental } // namespace arm_compute -#endif /* ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_IGPUKERNELCOMPONENT */ +#endif // ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_IGPUKERNELCOMPONENT_H diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentActivation.cpp b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentActivation.cpp index fdf528a65d..e316bdf46d 100644 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentActivation.cpp +++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentActivation.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Arm Limited. + * Copyright (c) 2022-2024 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -24,11 +24,7 @@ #include "ClComponentActivation.h" #include "src/core/CL/CLValidate.h" -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF -#include "src/dynamic_fusion/sketch/gpu/template_writer/cl/ClTemplateActivation.h" -#else //ACL_INTERNAL_TEST_CKW_IN_DF #include "src/dynamic_fusion/sketch/gpu/ckw_driver/components/GpuCkwActivation.h" -#endif //ACL_INTERNAL_TEST_CKW_IN_DF namespace arm_compute { @@ -69,11 +65,7 @@ ClComponentActivation::ClComponentActivation(ComponentId const ArgumentPack<ITensorInfo> &tensors, const Attributes &attributes) : IGpuKernelComponent{id, properties, tensors}, -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF - _component_writer{std::make_unique<ClTemplateActivation>(id, tensors, attributes)} -#else //ACL_INTERNAL_TEST_CKW_IN_DF _component_writer{std::make_unique<GpuCkwActivation>(id, tensors, attributes)} -#endif //ACL_INTERNAL_TEST_CKW_IN_DF { } @@ -81,11 +73,7 @@ ClComponentActivation::~ClComponentActivation() { } -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF -const IGpuTemplateComponentWriter *ClComponentActivation::template_writer() const -#else //ACL_INTERNAL_TEST_CKW_IN_DF const IGpuCkwComponentDriver *ClComponentActivation::ckw_component_driver() const -#endif //ACL_INTERNAL_TEST_CKW_IN_DF { return _component_writer.get(); } diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentActivation.h b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentActivation.h index 02c854356a..b8185158f3 100644 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentActivation.h +++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentActivation.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Arm Limited. + * Copyright (c) 2022-2024 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -21,8 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTACTIVATION -#define SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTACTIVATION +#ifndef ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTACTIVATION_H +#define ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTACTIVATION_H #include "arm_compute/function_info/ActivationLayerInfo.h" @@ -41,11 +41,7 @@ template <typename T> class ArgumentPack; /** Forward declaration */ -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF -class ClTemplateActivation; -#else //ACL_INTERNAL_TEST_CKW_IN_DF class GpuCkwActivation; -#endif //ACL_INTERNAL_TEST_CKW_IN_DF class ClComponentActivation final : public IGpuKernelComponent { @@ -106,11 +102,7 @@ public: ClComponentActivation &operator=(ClComponentActivation &&component) = default; /** Get writer for the component */ -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF - const IGpuTemplateComponentWriter *template_writer() const override; -#else //ACL_INTERNAL_TEST_CKW_IN_DF - const IGpuCkwComponentDriver *ckw_component_driver() const override; -#endif //ACL_INTERNAL_TEST_CKW_IN_DF + const IGpuCkwComponentDriver *ckw_component_driver() const override; /** Get component type */ GpuComponentType type() const override @@ -119,13 +111,9 @@ public: } private: -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF - std::unique_ptr<ClTemplateActivation> _component_writer; -#else //ACL_INTERNAL_TEST_CKW_IN_DF std::unique_ptr<GpuCkwActivation> _component_writer; -#endif //ACL_INTERNAL_TEST_CKW_IN_DF }; } // namespace dynamic_fusion } // namespace experimental } // namespace arm_compute -#endif /* SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTACTIVATION */ +#endif // ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTACTIVATION_H diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentCast.cpp b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentCast.cpp index b1636795a3..e1850d78c4 100644 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentCast.cpp +++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentCast.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Arm Limited. + * Copyright (c) 2022-2024 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -27,11 +27,7 @@ #include "src/core/CL/CLValidate.h" #include "src/dynamic_fusion/sketch/ArgumentPack.h" -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF -#include "src/dynamic_fusion/sketch/gpu/template_writer/cl/ClTemplateCast.h" -#else //ACL_INTERNAL_TEST_CKW_IN_DF #include "src/dynamic_fusion/sketch/gpu/ckw_driver/components/GpuCkwCast.h" -#endif //ACL_INTERNAL_TEST_CKW_IN_DF namespace arm_compute { @@ -72,22 +68,16 @@ ClComponentCast::ClComponentCast(ComponentId id, const Attributes &attributes, const Settings &settings) : IGpuKernelComponent{id, properties, tensors}, -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF - _component_writer{std::make_unique<ClTemplateCast>(id, tensors, attributes)} -#else //ACL_INTERNAL_TEST_CKW_IN_DF _component_writer{std::make_unique<GpuCkwCast>(id, tensors, attributes)} -#endif //ACL_INTERNAL_TEST_CKW_IN_DF { ARM_COMPUTE_UNUSED(attributes, settings); } + ClComponentCast::~ClComponentCast() { } -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF -const IGpuTemplateComponentWriter *ClComponentCast::template_writer() const -#else //ACL_INTERNAL_TEST_CKW_IN_DF + const IGpuCkwComponentDriver *ClComponentCast::ckw_component_driver() const -#endif //ACL_INTERNAL_TEST_CKW_IN_DF { return _component_writer.get(); } diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentCast.h b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentCast.h index ed77b1203b..201dacc288 100644 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentCast.h +++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentCast.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Arm Limited. + * Copyright (c) 2022-2024 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -21,8 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTCAST -#define SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTCAST +#ifndef ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTCAST_H +#define ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTCAST_H #include "arm_compute/dynamic_fusion/sketch/attributes/CastAttributes.h" @@ -49,11 +49,7 @@ private: }; /** Forward declaration */ -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF -class ClTemplateCast; -#else //ACL_INTERNAL_TEST_CKW_IN_DF class GpuCkwCast; -#endif //ACL_INTERNAL_TEST_CKW_IN_DF class ClComponentCast final : public IGpuKernelComponent { @@ -120,11 +116,7 @@ public: /** Allow instances of this class to be moved */ ClComponentCast &operator=(ClComponentCast &&component) = default; /** Get writer for the component */ -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF - const IGpuTemplateComponentWriter *template_writer() const override; -#else //ACL_INTERNAL_TEST_CKW_IN_DF const IGpuCkwComponentDriver *ckw_component_driver() const override; -#endif //ACL_INTERNAL_TEST_CKW_IN_DF /** Get component type */ GpuComponentType type() const override { @@ -132,14 +124,10 @@ public: } private: -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF - std::unique_ptr<ClTemplateCast> _component_writer; -#else //ACL_INTERNAL_TEST_CKW_IN_DF - std::unique_ptr<GpuCkwCast> _component_writer; -#endif //ACL_INTERNAL_TEST_CKW_IN_DF + std::unique_ptr<GpuCkwCast> _component_writer; }; } // namespace dynamic_fusion } // namespace experimental } // namespace arm_compute -#endif /* SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTCAST */ +#endif // ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTCAST_H diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDepthwiseConv2d.cpp b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDepthwiseConv2d.cpp index ca8037c393..7cd23d6115 100644 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDepthwiseConv2d.cpp +++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDepthwiseConv2d.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Arm Limited. + * Copyright (c) 2022-2024 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -28,11 +28,7 @@ #include "arm_compute/dynamic_fusion/sketch/attributes/DepthwiseConv2dAttributes.h" #include "src/core/CL/CLValidate.h" -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF -#include "src/dynamic_fusion/sketch/gpu/template_writer/cl/ClTemplateDepthwiseConv2d.h" -#else //ACL_INTERNAL_TEST_CKW_IN_DF #include "src/dynamic_fusion/sketch/gpu/ckw_driver/components/GpuCkwDepthwiseConv2d.h" -#endif //ACL_INTERNAL_TEST_CKW_IN_DF namespace arm_compute { @@ -212,22 +208,14 @@ ClComponentDepthwiseConv2d::ClComponentDepthwiseConv2d(ComponentId const Attributes &attributes, const Settings &settings) : IGpuKernelComponent{id, properties, tensors}, -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF - _component_writer{std::make_unique<ClTemplateDepthwiseConv2d>(id, tensors, attributes, settings)} -#else //ACL_INTERNAL_TEST_CKW_IN_DF _component_writer{std::make_unique<GpuCkwDepthwiseConv2d>(id, tensors, attributes, settings)} -#endif //ACL_INTERNAL_TEST_CKW_IN_DF { ARM_COMPUTE_UNUSED(attributes, settings); } ClComponentDepthwiseConv2d::~ClComponentDepthwiseConv2d() { } -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF -const IGpuTemplateComponentWriter *ClComponentDepthwiseConv2d::template_writer() const -#else //ACL_INTERNAL_TEST_CKW_IN_DF const IGpuCkwComponentDriver *ClComponentDepthwiseConv2d::ckw_component_driver() const -#endif //ACL_INTERNAL_TEST_CKW_IN_DF { return _component_writer.get(); } diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDepthwiseConv2d.h b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDepthwiseConv2d.h index 01168e9ded..7526361f1c 100644 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDepthwiseConv2d.h +++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDepthwiseConv2d.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Arm Limited. + * Copyright (c) 2022-2024 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -44,11 +44,7 @@ class ArgumentPack; class DepthwiseConv2dAttributes; /** Forward declaration */ -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF -class ClTemplateDepthwiseConv2d; -#else //ACL_INTERNAL_TEST_CKW_IN_DF class GpuCkwDepthwiseConv2d; -#endif //ACL_INTERNAL_TEST_CKW_IN_DF /** Component specific settings */ @@ -161,13 +157,8 @@ public: ClComponentDepthwiseConv2d(ClComponentDepthwiseConv2d &&component) = default; /** Allow instances of this class to be moved */ ClComponentDepthwiseConv2d &operator=(ClComponentDepthwiseConv2d &&component) = default; - /** Get template writer for the component */ -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF - const IGpuTemplateComponentWriter *template_writer() const override; -#else //ACL_INTERNAL_TEST_CKW_IN_DF - const IGpuCkwComponentDriver *ckw_component_driver() const override; -#endif //ACL_INTERNAL_TEST_CKW_IN_DF - + /** Get writer for the component */ + const IGpuCkwComponentDriver *ckw_component_driver() const override; /** Get component type */ GpuComponentType type() const override { @@ -175,11 +166,7 @@ public: } private: -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF - std::unique_ptr<ClTemplateDepthwiseConv2d> _component_writer; -#else //ACL_INTERNAL_TEST_CKW_IN_DF std::unique_ptr<GpuCkwDepthwiseConv2d> _component_writer; -#endif //ACL_INTERNAL_TEST_CKW_IN_DF }; } // namespace dynamic_fusion } // namespace experimental diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDirectConv2d.cpp b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDirectConv2d.cpp index 98f3d6a882..783a17df30 100644 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDirectConv2d.cpp +++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDirectConv2d.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Arm Limited. + * Copyright (c) 2022-2024 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -28,12 +28,7 @@ #include "arm_compute/dynamic_fusion/sketch/attributes/Conv2dAttributes.h" #include "src/core/CL/CLValidate.h" - -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF -#include "src/dynamic_fusion/sketch/gpu/template_writer/cl/ClTemplateDirectConv2d.h" -#else // ACL_INTERNAL_TEST_CKW_IN_DF #include "src/dynamic_fusion/sketch/gpu/ckw_driver/components/GpuCkwDirectConv2d.h" -#endif // ACL_INTERNAL_TEST_CKW_IN_DF namespace arm_compute { @@ -153,11 +148,7 @@ ClComponentDirectConv2d::ClComponentDirectConv2d(ComponentId const Attributes &attributes, const Settings &settings) : IGpuKernelComponent{id, properties, tensors}, -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF - _component_writer{std::make_unique<ClTemplateDirectConv2d>(id, tensors, attributes, settings)} -#else // ACL_INTERNAL_TEST_CKW_IN_DF _component_writer{std::make_unique<GpuCkwDirectConv2d>(id, tensors, attributes, settings)} -#endif // ACL_INTERNAL_TEST_CKW_IN_DF { } @@ -165,11 +156,7 @@ ClComponentDirectConv2d::~ClComponentDirectConv2d() { } -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF -const IGpuTemplateComponentWriter *ClComponentDirectConv2d::template_writer() const -#else // ACL_INTERNAL_TEST_CKW_IN_DF const IGpuCkwComponentDriver *ClComponentDirectConv2d::ckw_component_driver() const -#endif // ACL_INTERNAL_TEST_CKW_IN_DF { return _component_writer.get(); } diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDirectConv2d.h b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDirectConv2d.h index d6d9705d3c..c50b0fa0ce 100644 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDirectConv2d.h +++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDirectConv2d.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Arm Limited. + * Copyright (c) 2022-2024 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -21,8 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTDIRECTCONV2D -#define SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTDIRECTCONV2D +#ifndef ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTDIRECTCONV2D_H +#define ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTDIRECTCONV2D_H #include "arm_compute/core/Error.h" #include "arm_compute/core/KernelDescriptors.h" @@ -68,11 +68,7 @@ private: }; /** Forward declaration */ -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF -class ClTemplateDirectConv2d; -#else // ACL_INTERNAL_TEST_CKW_IN_DF class GpuCkwDirectConv2d; -#endif // ACL_INTERNAL_TEST_CKW_IN_DF class ClComponentDirectConv2d final : public IGpuKernelComponent { @@ -139,11 +135,7 @@ public: /** Allow instances of this class to be moved */ ClComponentDirectConv2d &operator=(ClComponentDirectConv2d &&component) = default; /** Get writer for the component */ -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF - const IGpuTemplateComponentWriter *template_writer() const override; -#else // ACL_INTERNAL_TEST_CKW_IN_DF - const IGpuCkwComponentDriver *ckw_component_driver() const override; -#endif // ACL_INTERNAL_TEST_CKW_IN_DF + const IGpuCkwComponentDriver *ckw_component_driver() const override; /** Get component type */ GpuComponentType type() const override { @@ -151,13 +143,9 @@ public: } private: -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF - std::unique_ptr<ClTemplateDirectConv2d> _component_writer; -#else // ACL_INTERNAL_TEST_CKW_IN_DF std::unique_ptr<GpuCkwDirectConv2d> _component_writer; -#endif // ACL_INTERNAL_TEST_CKW_IN_DF }; } // namespace dynamic_fusion } // namespace experimental } // namespace arm_compute -#endif /* SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTDIRECTCONV2D */ +#endif // ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTDIRECTCONV2D_H diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentElementwiseBinary.cpp b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentElementwiseBinary.cpp index 5b136427e4..209c73dbee 100644 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentElementwiseBinary.cpp +++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentElementwiseBinary.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Arm Limited. + * Copyright (c) 2022-2024 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -26,11 +26,7 @@ #include "arm_compute/core/Validate.h" #include "src/core/CL/CLValidate.h" -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF -#include "src/dynamic_fusion/sketch/gpu/template_writer/cl/ClTemplateElementwiseBinary.h" -#else //ACL_INTERNAL_TEST_CKW_IN_DF #include "src/dynamic_fusion/sketch/gpu/ckw_driver/components/GpuCkwElementwiseBinary.h" -#endif //ACL_INTERNAL_TEST_CKW_IN_DF namespace arm_compute { @@ -117,19 +113,11 @@ ClComponentElementwiseBinary::ClComponentElementwiseBinary(ComponentId const ArgumentPack<ITensorInfo> &tensors, const Attributes &attributes) : IGpuKernelComponent{id, properties, tensors}, -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF - _component_writer{std::make_unique<ClTemplateElementwiseBinary>(id, tensors, attributes)} -#else //ACL_INTERNAL_TEST_CKW_IN_DF _component_writer{std::make_unique<GpuCkwElementwiseBinary>(id, tensors, attributes)} -#endif //ACL_INTERNAL_TEST_CKW_IN_DF { } -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF -const IGpuTemplateComponentWriter *ClComponentElementwiseBinary::template_writer() const -#else //ACL_INTERNAL_TEST_CKW_IN_DF const IGpuCkwComponentDriver *ClComponentElementwiseBinary::ckw_component_driver() const -#endif //ACL_INTERNAL_TEST_CKW_IN_DF { return _component_writer.get(); } diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentElementwiseBinary.h b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentElementwiseBinary.h index 7589b9732c..a4395a6219 100644 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentElementwiseBinary.h +++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentElementwiseBinary.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Arm Limited. + * Copyright (c) 2022-2024 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -21,8 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTELEMENTWISEBINARY -#define ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTELEMENTWISEBINARY +#ifndef ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTELEMENTWISEBINARY_H +#define ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTELEMENTWISEBINARY_H #include "src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h" #include "src/dynamic_fusion/sketch/gpu/operators/internal/GpuElementwiseBinaryCommon.h" @@ -40,11 +40,7 @@ template <typename T> class ArgumentPack; /** Forward declaration */ -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF -class ClTemplateElementwiseBinary; -#else //ACL_INTERNAL_TEST_CKW_IN_DF class GpuCkwElementwiseBinary; -#endif //ACL_INTERNAL_TEST_CKW_IN_DF class ClComponentElementwiseBinary final : public IGpuKernelComponent { @@ -105,12 +101,7 @@ public: /** Allow instances of this class to be moved */ ClComponentElementwiseBinary &operator=(ClComponentElementwiseBinary &&component) = default; /** Get writer for the component */ -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF - const IGpuTemplateComponentWriter *template_writer() const override; -#else //ACL_INTERNAL_TEST_CKW_IN_DF - const IGpuCkwComponentDriver *ckw_component_driver() const override; -#endif //ACL_INTERNAL_TEST_CKW_IN_DF - + const IGpuCkwComponentDriver *ckw_component_driver() const override; /** Get component type */ GpuComponentType type() const override { @@ -118,13 +109,9 @@ public: } private: -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF - std::unique_ptr<ClTemplateElementwiseBinary> _component_writer; -#else //ACL_INTERNAL_TEST_CKW_IN_DF std::unique_ptr<GpuCkwElementwiseBinary> _component_writer; -#endif //ACL_INTERNAL_TEST_CKW_IN_DF }; } // namespace dynamic_fusion } // namespace experimental } // namespace arm_compute -#endif /* ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTELEMENTWISEBINARY */ +#endif // ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTELEMENTWISEBINARY_H diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DMaxShiftExpSum.cpp b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DMaxShiftExpSum.cpp deleted file mode 100644 index 27c13bd654..0000000000 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DMaxShiftExpSum.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2022-2023 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#include "src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DMaxShiftExpSum.h" - -#include "arm_compute/core/CL/CLHelpers.h" -#include "arm_compute/core/utils/misc/ShapeCalculator.h" -#include "arm_compute/core/Validate.h" -#include "arm_compute/dynamic_fusion/sketch/attributes/SoftmaxAttributes.h" - -#include "src/core/CL/CLValidate.h" -#include "src/dynamic_fusion/sketch/gpu/template_writer/cl/ClTemplateLogits1DMaxShiftExpSum.h" - -namespace arm_compute -{ -namespace experimental -{ -namespace dynamic_fusion -{ -Status ClComponentLogits1DMaxShiftExpSum::validate(const Properties &properties, - const ArgumentPack<ITensorInfo> &tensors, - const Attributes &attributes) -{ - ARM_COMPUTE_UNUSED(properties, attributes); - - const ITensorInfo *src = tensors.get_const_tensor(TensorType::ACL_SRC_0); - const ITensorInfo *sum = tensors.get_const_tensor(TensorType::ACL_DST_0); - const ITensorInfo *dst = tensors.get_const_tensor(TensorType::ACL_DST_1); - - ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(src); - ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(sum); - ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(dst); - - // 1. Check validity - // All tensor infos are initialized - ARM_COMPUTE_RETURN_ERROR_ON(src->tensor_shape().total_size() == 0); - ARM_COMPUTE_RETURN_ERROR_ON(sum->tensor_shape().total_size() == 0); - ARM_COMPUTE_RETURN_ERROR_ON(dst->tensor_shape().total_size() == 0); - - // Check for mismatches in shapes and data types - ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(src, dst, sum); - ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(src, dst); - - // Device requirements are met - ARM_COMPUTE_RETURN_ERROR_ON_F16_UNSUPPORTED(src); - - // 2. Check support level - ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(src, 1, DataType::F16, DataType::F32); - - return Status{}; -} - -ClComponentLogits1DMaxShiftExpSum::ClComponentLogits1DMaxShiftExpSum(ComponentId id, - const Properties &properties, - const ArgumentPack<ITensorInfo> &tensors, - const Attributes &attributes) - : IGpuKernelComponent{id, properties, tensors}, - _component_writer{std::make_unique<ClTemplateLogits1DMaxShiftExpSum>(id, tensors, attributes)} -{ -} - -ClComponentLogits1DMaxShiftExpSum::~ClComponentLogits1DMaxShiftExpSum() -{ -} - -const IGpuTemplateComponentWriter *ClComponentLogits1DMaxShiftExpSum::template_writer() const -{ - return _component_writer.get(); -} -} // namespace dynamic_fusion -} // namespace experimental -} // namespace arm_compute diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DMaxShiftExpSum.h b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DMaxShiftExpSum.h deleted file mode 100644 index 91ab5de3b5..0000000000 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DMaxShiftExpSum.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2022-2023 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTLOGITS1DMAXSHIFTEXPSUM -#define SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTLOGITS1DMAXSHIFTEXPSUM - -#include "arm_compute/dynamic_fusion/sketch/attributes/SoftmaxAttributes.h" - -#include "src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h" - -namespace arm_compute -{ -/** Forward declaration */ -class ITensorInfo; -namespace experimental -{ -namespace dynamic_fusion -{ -/** Forward declaration */ -template <typename T> -class ArgumentPack; - -/** Forward declaration */ -class ClTemplateLogits1DMaxShiftExpSum; - -/** Component to calculate max-shifted exponentials and their sum - * - * 1D example: - * input: [x1, x2, ... , xn], shape: (1 x d) - * - * Let max(x1...xn) = m - * - * (output) sum: [exp(x1-m) + ... + exp(xn-m)], shape: (1 x 1) - * (output) dst: [exp(x1-m) ... exp(xn-m)], shape: (1 x d) - * - * This component is used by the softmax operator. The subsequent - * operation normalizes dst with sum, therefore the max-shifting - * since exp(m) will be cancelled in numerator and denominator. -*/ -class ClComponentLogits1DMaxShiftExpSum final : public IGpuKernelComponent -{ -public: - /** Attributes are a set of backend-agnostic parameters that define what a component does */ - using Attributes = SoftmaxAttributes; - - /** Validate the component - * - * @param[in] properties Component properties @ref Properties - * @param[in] tensors Tensor arguments to the component - * @param[in] attributes Component attributes @ref Attributes - * - * @return Status Validation results - * - * Tensor argument names: - * - ACL_SRC_0: Input - * - ACL_DST_0: Output - * - ACL_DST_1: Output - * - * Tensor argument constness: - * - ACL_SRC_0: Const - * - ACL_DST_0: Const - * - ACL_DST_1: Const - * - * Valid data layouts: - * - All - * - ** Valid data type configurations: - * |ACL_SRC_0 |ACL_DST_0 |ACL_DST_1 | - * |:----------|:----------|:----------| - * |F16 | F16 | F16 | - * |F32 | F32 | F32 | - */ - static Status - validate(const Properties &properties, const ArgumentPack<ITensorInfo> &tensors, const Attributes &attributes); - - /** Constructor - * - * Similar to @ref ClComponentLogits1DMaxShiftExpSum::validate() - */ - ClComponentLogits1DMaxShiftExpSum(ComponentId id, - const Properties &properties, - const ArgumentPack<ITensorInfo> &tensors, - const Attributes &attributes); - - /** Destructor */ - ~ClComponentLogits1DMaxShiftExpSum() override; - /** Prevent instances of this class from being copy constructed */ - ClComponentLogits1DMaxShiftExpSum(const ClComponentLogits1DMaxShiftExpSum &component) = delete; - /** Prevent instances of this class from being copied */ - ClComponentLogits1DMaxShiftExpSum &operator=(const ClComponentLogits1DMaxShiftExpSum &component) = delete; - /** Allow instances of this class to be move constructed */ - ClComponentLogits1DMaxShiftExpSum(ClComponentLogits1DMaxShiftExpSum &&component) = default; - /** Allow instances of this class to be moved */ - ClComponentLogits1DMaxShiftExpSum &operator=(ClComponentLogits1DMaxShiftExpSum &&component) = default; - /** Get template writer for the component */ - const IGpuTemplateComponentWriter *template_writer() const override; - /** Get component type */ - GpuComponentType type() const override - { - return GpuComponentType::Unfusable; - } - -private: - std::unique_ptr<ClTemplateLogits1DMaxShiftExpSum> _component_writer; -}; -} // namespace dynamic_fusion -} // namespace experimental -} // namespace arm_compute - -#endif /* SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTLOGITS1DMAXSHIFTEXPSUM */ diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DNorm.cpp b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DNorm.cpp deleted file mode 100644 index fb2544385c..0000000000 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DNorm.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2023 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#include "src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DNorm.h" - -#include "arm_compute/core/CL/CLHelpers.h" -#include "arm_compute/core/utils/misc/ShapeCalculator.h" -#include "arm_compute/core/Validate.h" -#include "arm_compute/dynamic_fusion/sketch/attributes/SoftmaxAttributes.h" - -#include "src/core/CL/CLValidate.h" -#include "src/dynamic_fusion/sketch/gpu/template_writer/cl/ClTemplateLogits1DNorm.h" - -namespace arm_compute -{ -namespace experimental -{ -namespace dynamic_fusion -{ -Status ClComponentLogits1DNorm::validate(const Properties &properties, - const ArgumentPack<ITensorInfo> &tensors, - const Attributes &attributes) -{ - ARM_COMPUTE_UNUSED(properties, attributes); - - const ITensorInfo *src = tensors.get_const_tensor(TensorType::ACL_SRC_0); - const ITensorInfo *sum = tensors.get_const_tensor(TensorType::ACL_SRC_1); - const ITensorInfo *dst = tensors.get_const_tensor(TensorType::ACL_DST_0); - - ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(src); - ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(sum); - ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(dst); - - // 1. Check validity - // All tensor infos are initialized - ARM_COMPUTE_RETURN_ERROR_ON(src->tensor_shape().total_size() == 0); - ARM_COMPUTE_RETURN_ERROR_ON(sum->tensor_shape().total_size() == 0); - ARM_COMPUTE_RETURN_ERROR_ON(dst->tensor_shape().total_size() == 0); - - // Check for mismatches in shapes and data types - ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(src, dst, sum); - ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(src, dst); - - ARM_COMPUTE_RETURN_ERROR_ON(attributes.is_log_softmax() && !is_data_type_float(src->data_type())); - - // Device requirements are met - ARM_COMPUTE_RETURN_ERROR_ON_F16_UNSUPPORTED(src); - - // 2. Check support level - ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(src, 1, DataType::F16, DataType::F32); - - return Status{}; -} - -ClComponentLogits1DNorm::ClComponentLogits1DNorm(ComponentId id, - const Properties &properties, - const ArgumentPack<ITensorInfo> &tensors, - const Attributes &attributes) - : IGpuKernelComponent{id, properties, tensors}, - _component_writer{std::make_unique<ClTemplateLogits1DNorm>(id, tensors, attributes)} -{ -} - -ClComponentLogits1DNorm::~ClComponentLogits1DNorm() -{ -} - -const IGpuTemplateComponentWriter *ClComponentLogits1DNorm::template_writer() const -{ - return _component_writer.get(); -} -} // namespace dynamic_fusion -} // namespace experimental -} // namespace arm_compute diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DNorm.h b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DNorm.h deleted file mode 100644 index 74c0273604..0000000000 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DNorm.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2023 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTLOGITS1DNORM -#define SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTLOGITS1DNORM - -#include "arm_compute/dynamic_fusion/sketch/attributes/SoftmaxAttributes.h" - -#include "src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h" - -namespace arm_compute -{ -/** Forward declaration */ -class ITensorInfo; -namespace experimental -{ -namespace dynamic_fusion -{ -/** Forward declaration */ -template <typename T> -class ArgumentPack; - -/** Forward declaration */ -class ClTemplateLogits1DNorm; - -/** Component to calculate the final step of the Softmax Layer - * where each logit value is multiplied by the inverse of the sum of the logits. - * - * 1D example: - * - * (input) src: [x1 x2 ... xn], shape: (1 x d) - * (input) sum: [x1 + x2 + ... + xn], shape: (1 x 1) - * (output) dst: [x1/sum x2/sum ... xn/sum], shape: (1 x d) - * - * This component is used by the softmax operator to get the final result. -*/ -class ClComponentLogits1DNorm final : public IGpuKernelComponent -{ -public: - /** Attributes are a set of backend-agnostic parameters that define what a component does */ - using Attributes = SoftmaxAttributes; - - /** Validate the component - * - * @param[in] properties Component properties @ref Properties - * @param[in] tensors Tensor arguments to the component - * @param[in] attributes Component attributes @ref Attributes - * - * @return Status Validation results - * - * Tensor argument names: - * - ACL_SRC_0: Input - * - ACL_SRC_1: Input - * - ACL_DST_0: Output - * - * Tensor argument constness: - * - ACL_SRC_0: Const - * - ACL_SRC_1: Const - * - ACL_DST_0: Const - * - * Valid data layouts: - * - All - * - ** Valid data type configurations: - * |ACL_SRC_0 |ACL_SRC_1 |ACL_DST_0 | - * |:----------|:----------|:----------| - * |F16 | F16 | F16 | - * |F32 | F32 | F32 | - */ - static Status - validate(const Properties &properties, const ArgumentPack<ITensorInfo> &tensors, const Attributes &attributes); - - /** Constructor - * - * Similar to @ref ClComponentLogits1DNorm::validate() - */ - ClComponentLogits1DNorm(ComponentId id, - const Properties &properties, - const ArgumentPack<ITensorInfo> &tensors, - const Attributes &attributes); - - /** Destructor */ - ~ClComponentLogits1DNorm() override; - /** Prevent instances of this class from being copy constructed */ - ClComponentLogits1DNorm(const ClComponentLogits1DNorm &component) = delete; - /** Prevent instances of this class from being copied */ - ClComponentLogits1DNorm &operator=(const ClComponentLogits1DNorm &component) = delete; - /** Allow instances of this class to be move constructed */ - ClComponentLogits1DNorm(ClComponentLogits1DNorm &&component) = default; - /** Allow instances of this class to be moved */ - ClComponentLogits1DNorm &operator=(ClComponentLogits1DNorm &&component) = default; - /** Get template writer for the component */ - const IGpuTemplateComponentWriter *template_writer() const override; - /** Get component type */ - GpuComponentType type() const override - { - return GpuComponentType::Unfusable; - } - -private: - std::unique_ptr<ClTemplateLogits1DNorm> _component_writer; -}; -} // namespace dynamic_fusion -} // namespace experimental -} // namespace arm_compute - -#endif /* SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTLOGITS1DNORM */ diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentMatMul.cpp b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentMatMul.cpp index f238d42d98..53ac8da41f 100644 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentMatMul.cpp +++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentMatMul.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Arm Limited. + * Copyright (c) 2023-2024 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -21,7 +21,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifdef ACL_INTERNAL_TEST_CKW_IN_DF #include "src/dynamic_fusion/sketch/gpu/components/cl/ClComponentMatMul.h" @@ -147,5 +146,3 @@ const IGpuCkwComponentDriver *ClComponentMatMul::ckw_component_driver() const } // namespace dynamic_fusion } // namespace experimental } // namespace arm_compute - -#endif // ACL_INTERNAL_TEST_CKW_IN_DF diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentPool2d.cpp b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentPool2d.cpp index 5544963b3f..6e7243dc04 100644 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentPool2d.cpp +++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentPool2d.cpp @@ -30,7 +30,6 @@ #include "src/core/CL/CLValidate.h" #include "src/dynamic_fusion/sketch/gpu/ckw_driver/components/GpuCkwPool2d.h" -#include "src/dynamic_fusion/sketch/gpu/template_writer/cl/ClTemplatePool2d.h" #include "src/dynamic_fusion/utils/Utils.h" #include <memory> @@ -93,27 +92,16 @@ ClComponentPool2d::ClComponentPool2d(ComponentId id, const Attributes &attributes, const Settings &settings) : IGpuKernelComponent{id, properties, tensors}, -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF - _component_writer{std::make_unique<ClTemplatePool2d>(id, tensors, attributes, settings)} -#else //ACL_INTERNAL_TEST_CKW_IN_DF _component_writer{std::make_unique<GpuCkwPool2d>(id, tensors, attributes, settings)} -#endif //ACL_INTERNAL_TEST_CKW_IN_DF { } ClComponentPool2d::~ClComponentPool2d() { } -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF -const IGpuTemplateComponentWriter *ClComponentPool2d::template_writer() const -{ - return _component_writer.get(); -} -#else //ACL_INTERNAL_TEST_CKW_IN_DF const IGpuCkwComponentDriver *ClComponentPool2d::ckw_component_driver() const { return _component_writer.get(); } -#endif //ACL_INTERNAL_TEST_CKW_IN_DF } // namespace dynamic_fusion } // namespace experimental } // namespace arm_compute diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentPool2d.h b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentPool2d.h index 98fed65004..d33e601f18 100644 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentPool2d.h +++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentPool2d.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Arm Limited. + * Copyright (c) 2023-2024 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -42,11 +42,7 @@ class ArgumentPack; class Pool2dAttributes; /** Forward declaration */ -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF -class ClTemplatePool2d; -#else // ACL_INTERNAL_TEST_CKW_IN_DF class GpuCkwPool2d; -#endif // ACL_INTERNAL_TEST_CKW_IN_DF class ClComponentPool2d final : public IGpuKernelComponent { @@ -116,13 +112,9 @@ public: /** Allow instances of this class to be moved */ ClComponentPool2d &operator=(ClComponentPool2d &&component) = default; -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF - /** Get template writer for the component */ - const IGpuTemplateComponentWriter *template_writer() const override; -#else // ACL_INTERNAL_TEST_CKW_IN_DF + /** Get GPU kernel writer for the component */ const IGpuCkwComponentDriver *ckw_component_driver() const override; -#endif // ACL_INTERNAL_TEST_CKW_IN_DF /** Get component type */ GpuComponentType type() const override @@ -131,11 +123,7 @@ public: } private: -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF - std::unique_ptr<ClTemplatePool2d> _component_writer; -#else // ACL_INTERNAL_TEST_CKW_IN_DF std::unique_ptr<GpuCkwPool2d> _component_writer; -#endif // ACL_INTERNAL_TEST_CKW_IN_DF }; } // namespace dynamic_fusion } // namespace experimental diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentReshape.cpp b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentReshape.cpp index 0ece9de970..dce85c424e 100644 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentReshape.cpp +++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentReshape.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Arm Limited. + * Copyright (c) 2023-2024 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -27,7 +27,6 @@ #include "arm_compute/core/Validate.h" #include "src/core/CL/CLValidate.h" -#include "src/dynamic_fusion/sketch/gpu/template_writer/cl/ClTemplateReshape.h" namespace arm_compute { @@ -54,15 +53,16 @@ Status ClComponentReshape::validate(const ArgumentPack<ITensorInfo> &tensors) ClComponentReshape::ClComponentReshape(ComponentId id, const Properties &properties, const ArgumentPack<ITensorInfo> &tensors) - : IGpuKernelComponent{id, properties, tensors}, _component_writer{std::make_unique<ClTemplateReshape>(id, tensors)} + : IGpuKernelComponent{id, properties, tensors} { } ClComponentReshape::~ClComponentReshape() { } -const IGpuTemplateComponentWriter *ClComponentReshape::template_writer() const +const IGpuCkwComponentDriver *ClComponentReshape::ckw_component_driver() const { - return _component_writer.get(); + /* NOT IMPLEMENTED */ + return nullptr; } } // namespace dynamic_fusion } // namespace experimental diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentReshape.h b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentReshape.h index 78163d6603..fd0f966da1 100644 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentReshape.h +++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentReshape.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Arm Limited. + * Copyright (c) 2023-2024 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -21,8 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTRESHAPE -#define SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTRESHAPE +#ifndef ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTRESHAPE_H +#define ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTRESHAPE_H #include "src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h" @@ -85,8 +85,8 @@ public: ClComponentReshape(ClComponentReshape &&component) = default; /** Allow instances of this class to be moved */ ClComponentReshape &operator=(ClComponentReshape &&component) = default; - /** Get template writer for the component */ - const IGpuTemplateComponentWriter *template_writer() const override; + /** Get writer for the component */ + const IGpuCkwComponentDriver *ckw_component_driver() const override; /** Get component type */ GpuComponentType type() const override { @@ -94,10 +94,9 @@ public: } private: - std::unique_ptr<ClTemplateReshape> _component_writer; }; } // namespace dynamic_fusion } // namespace experimental } // namespace arm_compute -#endif /* SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTRESHAPE */ +#endif // ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTRESHAPE_H diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentResize.cpp b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentResize.cpp index b05eb04698..411eeca802 100644 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentResize.cpp +++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentResize.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Arm Limited. + * Copyright (c) 2022-2024 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -29,12 +29,7 @@ #include "src/core/CL/CLValidate.h" #include "src/core/utils/ScaleUtils.h" #include "src/dynamic_fusion/sketch/ArgumentPack.h" - -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF -#include "src/dynamic_fusion/sketch/gpu/template_writer/cl/ClTemplateResize.h" -#else // ACL_INTERNAL_TEST_CKW_IN_DF #include "src/dynamic_fusion/sketch/gpu/ckw_driver/components/GpuCkwResize.h" -#endif // ACL_INTERNAL_TEST_CKW_IN_DF namespace arm_compute { @@ -43,11 +38,7 @@ namespace experimental namespace dynamic_fusion { /** Forward declaration */ -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF -class ClTemplateResize; -#else // ACL_INTERNAL_TEST_CKW_IN_DF class GpuCkwResize; -#endif // ACL_INTERNAL_TEST_CKW_IN_DF Status ClComponentResize::validate(const IGpuKernelComponent::Properties &properties, const ArgumentPack<ITensorInfo> &tensors, @@ -82,11 +73,7 @@ ClComponentResize::ClComponentResize(ComponentId id, const ArgumentPack<ITensorInfo> &tensors, const ClComponentResize::Attributes &attributes) : IGpuKernelComponent{id, properties, tensors}, -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF - _component_writer{std::make_unique<ClTemplateResize>(id, tensors, attributes)} -#else // ACL_INTERNAL_TEST_CKW_IN_DF _component_writer{std::make_unique<GpuCkwResize>(id, tensors, attributes)} -#endif // ACL_INTERNAL_TEST_CKW_IN_DF { } @@ -94,11 +81,7 @@ ClComponentResize::~ClComponentResize() { } -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF -const IGpuTemplateComponentWriter *ClComponentResize::template_writer() const -#else // ACL_INTERNAL_TEST_CKW_IN_DF const IGpuCkwComponentDriver *ClComponentResize::ckw_component_driver() const -#endif // ACL_INTERNAL_TEST_CKW_IN_DF { return _component_writer.get(); } diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentResize.h b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentResize.h index 29276c3257..9a1169c45f 100644 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentResize.h +++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentResize.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Arm Limited. + * Copyright (c) 2022-2024 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -22,8 +22,8 @@ * SOFTWARE. */ -#ifndef SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTRESIZE -#define SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTRESIZE +#ifndef ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTRESIZE_H +#define ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTRESIZE_H #include "arm_compute/dynamic_fusion/sketch/attributes/ResizeAttributes.h" @@ -42,11 +42,7 @@ template <typename T> class ArgumentPack; /** Forward declaration */ -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF -class ClTemplateResize; -#else // ACL_INTERNAL_TEST_CKW_IN_DF class GpuCkwResize; -#endif // ACL_INTERNAL_TEST_CKW_IN_DF class ClComponentResize final : public IGpuKernelComponent { @@ -111,11 +107,7 @@ public: ClComponentResize &operator=(ClComponentResize &&component) = default; /** Get writer for the component */ -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF - const IGpuTemplateComponentWriter *template_writer() const override; -#else // ACL_INTERNAL_TEST_CKW_IN_DF const IGpuCkwComponentDriver *ckw_component_driver() const override; -#endif // ACL_INTERNAL_TEST_CKW_IN_DF /** Get component type */ GpuComponentType type() const override @@ -124,15 +116,11 @@ public: } private: -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF - std::unique_ptr<ClTemplateResize> _component_writer; -#else // ACL_INTERNAL_TEST_CKW_IN_DF std::unique_ptr<GpuCkwResize> _component_writer; -#endif // ACL_INTERNAL_TEST_CKW_IN_DF }; } // namespace dynamic_fusion } // namespace experimental } // namespace arm_compute -#endif /* SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTRESIZE */ +#endif // ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTRESIZE_H diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentStore.cpp b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentStore.cpp index dcbecaff35..3db6c5cd2d 100644 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentStore.cpp +++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentStore.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Arm Limited. + * Copyright (c) 2022-2024 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -24,11 +24,7 @@ #include "ClComponentStore.h" #include "src/dynamic_fusion/sketch/ArgumentPack.h" -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF -#include "src/dynamic_fusion/sketch/gpu/template_writer/cl/ClTemplateStore.h" -#else //ACL_INTERNAL_TEST_CKW_IN_DF #include "src/dynamic_fusion/sketch/gpu/ckw_driver/components/GpuCkwStore.h" -#endif //ACL_INTERNAL_TEST_CKW_IN_DF #include <memory> @@ -46,22 +42,13 @@ Status ClComponentStore::validate(const Properties &properties, const ArgumentPa ClComponentStore::ClComponentStore(ComponentId id, const Properties &properties, const ArgumentPack<ITensorInfo> &tensors) - : IGpuKernelComponent{id, properties, tensors}, -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF - _component_writer{std::make_unique<ClTemplateStore>(id, tensors)} -#else //ACL_INTERNAL_TEST_CKW_IN_DF - _component_writer{std::make_unique<GpuCkwStore>(id, tensors)} -#endif //ACL_INTERNAL_TEST_CKW_IN_DF + : IGpuKernelComponent{id, properties, tensors}, _component_writer{std::make_unique<GpuCkwStore>(id, tensors)} { } ClComponentStore::~ClComponentStore() { } -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF -const IGpuTemplateComponentWriter *ClComponentStore::template_writer() const -#else //ACL_INTERNAL_TEST_CKW_IN_DF const IGpuCkwComponentDriver *ClComponentStore::ckw_component_driver() const -#endif //ACL_INTERNAL_TEST_CKW_IN_DF { return _component_writer.get(); } diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentStore.h b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentStore.h index 948785c480..2c1dd0f6fc 100644 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentStore.h +++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentStore.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Arm Limited. + * Copyright (c) 2022-2024 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -21,8 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTSTORE -#define SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTSTORE +#ifndef ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTSTORE_H +#define ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTSTORE_H #include "src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h" @@ -39,11 +39,7 @@ namespace dynamic_fusion /** Forward declaration */ template <typename T> class ArgumentPack; -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF -class ClTemplateStore; -#else //ACL_INTERNAL_TEST_CKW_IN_DF class GpuCkwStore; -#endif //ACL_INTERNAL_TEST_CKW_IN_DF class ClComponentStore final : public IGpuKernelComponent { @@ -88,11 +84,7 @@ public: /** Allow instances of this class to be moved */ ClComponentStore &operator=(ClComponentStore &&component) = default; /** Get writer for the component */ -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF - const IGpuTemplateComponentWriter *template_writer() const override; -#else //ACL_INTERNAL_TEST_CKW_IN_DF const IGpuCkwComponentDriver *ckw_component_driver() const override; -#endif //ACL_INTERNAL_TEST_CKW_IN_DF /** Get component type */ GpuComponentType type() const override { @@ -100,13 +92,9 @@ public: } private: -#ifndef ACL_INTERNAL_TEST_CKW_IN_DF - std::unique_ptr<ClTemplateStore> _component_writer; -#else //ACL_INTERNAL_TEST_CKW_IN_DF - std::unique_ptr<GpuCkwStore> _component_writer; -#endif //ACL_INTERNAL_TEST_CKW_IN_DF + std::unique_ptr<GpuCkwStore> _component_writer; }; } // namespace dynamic_fusion } // namespace experimental } // namespace arm_compute -#endif /* SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTSTORE */ +#endif // ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTSTORE_H |