diff options
author | SiCong Li <sicong.li@arm.com> | 2023-06-28 09:49:45 +0100 |
---|---|---|
committer | SiCong Li <sicong.li@arm.com> | 2023-07-25 15:48:50 +0000 |
commit | 23882a9014eb3972bca958206866c8e0d0b829cc (patch) | |
tree | 9139b91699099160e26a64abd8cf182bd7447278 /src/dynamic_fusion/sketch/gpu/components/cl | |
parent | 0a59e69fd922b02d9e3b5b043ee7f891061df7be (diff) | |
download | ComputeLibrary-23882a9014eb3972bca958206866c8e0d0b829cc.tar.gz |
Add GpuKernelArgumentBinding for runtime argument setting
* Add flexible runtime argument setting that accept argument bindings
exported from ckw.
* Introduce internal build flag ACL_INTERNAL_TEST_CKW_IN_DF. If set to
true, ckw will be tested in dynamic fusion validation tests. Otherwise
it will not be tested and the dynamic fusion will keep using
ClTemplateWriter instead.
* Fix CKW sampler for elementwise binary to deal with tile sizes > 1
in both dimensions
Resolves: COMPMID-6282
Partially resolves: COMPMID-6260
Signed-off-by: SiCong Li <sicong.li@arm.com>
Change-Id: I0ab225a4484eb2119643d900a4e72806558626ee
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/9917
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Jakub Sujak <jakub.sujak@arm.com>
Reviewed-by: Anitha Raj <Anitha.Raj@arm.com>
Reviewed-by: Viet-Hoa Do <viet-hoa.do@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Benchmark: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/dynamic_fusion/sketch/gpu/components/cl')
8 files changed, 128 insertions, 44 deletions
diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentActivation.cpp b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentActivation.cpp index d2cde40a10..c41257d18c 100644 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentActivation.cpp +++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentActivation.cpp @@ -24,8 +24,11 @@ #include "ClComponentActivation.h" #include "src/core/CL/CLValidate.h" -#include "src/dynamic_fusion/sketch/gpu/ckw_driver/components/GpuCkwActivation.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 { @@ -66,8 +69,17 @@ ClComponentActivation::ClComponentActivation(ComponentId const ArgumentPack<ITensorInfo> &tensors, const Attributes &attributes) : IGpuKernelComponent{ id, properties, tensors }, - _component_writer{ std::make_unique<ClTemplateActivation>(id, tensors, attributes) }, - _ckw_driver{ std::make_unique<GpuCkwActivation>(id, tensors, attributes) } +#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 { } @@ -75,15 +87,15 @@ 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(); } -const IGpuCkwComponentDriver *ClComponentActivation::ckw_component_driver() const -{ - return _ckw_driver.get(); -} } // namespace dynamic_fusion } // namespace experimental } // namespace arm_compute diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentActivation.h b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentActivation.h index bb6f7c6e30..ebe8719420 100644 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentActivation.h +++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentActivation.h @@ -42,8 +42,11 @@ 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,10 +109,12 @@ public: /** Allow instances of this class to be moved */ ClComponentActivation &operator=(ClComponentActivation &&component) = default; - /** Get template writer for the component */ + /** Get writer for the component */ +#ifndef ACL_INTERNAL_TEST_CKW_IN_DF const IGpuTemplateComponentWriter *template_writer() const override; - - const IGpuCkwComponentDriver *ckw_component_driver() 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 @@ -118,8 +123,11 @@ public: } private: +#ifndef ACL_INTERNAL_TEST_CKW_IN_DF std::unique_ptr<ClTemplateActivation> _component_writer; - std::unique_ptr<GpuCkwActivation> _ckw_driver; +#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 diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentCast.cpp b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentCast.cpp index 92933ae7a5..635869f817 100644 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentCast.cpp +++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentCast.cpp @@ -26,8 +26,11 @@ #include "arm_compute/core/Error.h" #include "src/core/CL/CLValidate.h" #include "src/dynamic_fusion/sketch/ArgumentPack.h" -#include "src/dynamic_fusion/sketch/gpu/ckw_driver/components/GpuCkwCast.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 { @@ -67,23 +70,32 @@ ClComponentCast::ClComponentCast(ComponentId id, const Attributes &attributes, const Settings &settings) : IGpuKernelComponent{ id, properties, tensors }, - _component_writer{ std::make_unique<ClTemplateCast>(id, tensors, attributes) }, - _ckw_driver{ std::make_unique<GpuCkwCast>(id, tensors, attributes) } +#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(); } -const IGpuCkwComponentDriver *ClComponentCast::ckw_component_driver() const -{ - return _ckw_driver.get(); -} } // namespace dynamic_fusion } // namespace experimental } // namespace arm_compute diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentCast.h b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentCast.h index 174f9670b3..37b8cbb6c9 100644 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentCast.h +++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentCast.h @@ -48,8 +48,11 @@ 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 { @@ -116,10 +119,12 @@ public: ClComponentCast(ClComponentCast &&component) = default; /** Allow instances of this class to be moved */ ClComponentCast &operator=(ClComponentCast &&component) = default; - /** Get template writer for the component */ + /** Get writer for the component */ +#ifndef ACL_INTERNAL_TEST_CKW_IN_DF const IGpuTemplateComponentWriter *template_writer() const override; - /** Get GPU kernel writer for the component */ +#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 { @@ -127,8 +132,11 @@ public: } private: +#ifndef ACL_INTERNAL_TEST_CKW_IN_DF std::unique_ptr<ClTemplateCast> _component_writer; - std::unique_ptr<GpuCkwCast> _ckw_driver; +#else //ACL_INTERNAL_TEST_CKW_IN_DF + std::unique_ptr<GpuCkwCast> _component_writer; +#endif //ACL_INTERNAL_TEST_CKW_IN_DF }; } // namespace dynamic_fusion } // namespace experimental diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentElementwiseBinary.cpp b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentElementwiseBinary.cpp index 52739e23c0..88d729170c 100644 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentElementwiseBinary.cpp +++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentElementwiseBinary.cpp @@ -25,8 +25,11 @@ #include "arm_compute/core/Validate.h" #include "src/core/CL/CLValidate.h" -#include "src/dynamic_fusion/sketch/gpu/ckw_driver/components/GpuCkwElementwiseBinary.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 { @@ -106,28 +109,38 @@ Status ClComponentElementwiseBinary::validate(const ArgumentPack<ITensorInfo> &t return Status{}; } +ClComponentElementwiseBinary::~ClComponentElementwiseBinary() +{ +} ClComponentElementwiseBinary::ClComponentElementwiseBinary( ComponentId id, const Properties &properties, const ArgumentPack<ITensorInfo> &tensors, const Attributes &attributes) : IGpuKernelComponent{ id, properties, tensors }, - _component_writer{ std::make_unique<ClTemplateElementwiseBinary>(id, tensors, attributes) }, - _ckw_driver{ std::make_unique<GpuCkwElementwiseBinary>(id, tensors, attributes) } +#ifndef ACL_INTERNAL_TEST_CKW_IN_DF + _component_writer { + std::make_unique<ClTemplateElementwiseBinary>(id, tensors, attributes) } -ClComponentElementwiseBinary::~ClComponentElementwiseBinary() +#else //ACL_INTERNAL_TEST_CKW_IN_DF + _component_writer { + std::make_unique<GpuCkwElementwiseBinary>(id, tensors, attributes) } -const IGpuTemplateComponentWriter *ClComponentElementwiseBinary::template_writer() const +#endif //ACL_INTERNAL_TEST_CKW_IN_DF { - return _component_writer.get(); } +#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 _ckw_driver.get(); + return _component_writer.get(); } + } // namespace dynamic_fusion } // namespace experimental } // namespace arm_compute diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentElementwiseBinary.h b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentElementwiseBinary.h index a56dd8b37d..f7175903d0 100644 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentElementwiseBinary.h +++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentElementwiseBinary.h @@ -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_CLCOMPONENTELEMENTWISEBINARY -#define SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTELEMENTWISEBINARY +#ifndef ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTELEMENTWISEBINARY +#define ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTELEMENTWISEBINARY #include "src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h" #include "src/dynamic_fusion/sketch/gpu/operators/internal/GpuElementwiseBinaryCommon.h" @@ -40,8 +40,11 @@ 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 { @@ -101,10 +104,13 @@ public: ClComponentElementwiseBinary(ClComponentElementwiseBinary &&component) = default; /** Allow instances of this class to be moved */ ClComponentElementwiseBinary &operator=(ClComponentElementwiseBinary &&component) = default; - /** Get template writer for the component */ + /** 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 { @@ -112,10 +118,13 @@ public: } private: +#ifndef ACL_INTERNAL_TEST_CKW_IN_DF std::unique_ptr<ClTemplateElementwiseBinary> _component_writer; - std::unique_ptr<GpuCkwElementwiseBinary> _ckw_driver; +#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 /* SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTELEMENTWISEBINARY */ +#endif /* ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTELEMENTWISEBINARY */ diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentStore.cpp b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentStore.cpp index a3283b1866..12b81c3d56 100644 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentStore.cpp +++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentStore.cpp @@ -24,8 +24,11 @@ #include "ClComponentStore.h" #include "src/dynamic_fusion/sketch/ArgumentPack.h" -#include "src/dynamic_fusion/sketch/gpu/ckw_driver/components/GpuCkwStore.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> @@ -43,19 +46,30 @@ Status ClComponentStore::validate( return Status{}; } ClComponentStore::ClComponentStore(ComponentId id, const Properties &properties, const ArgumentPack<ITensorInfo> &tensors) - : IGpuKernelComponent{ id, properties, tensors }, _component_writer{ std::make_unique<ClTemplateStore>(id, tensors) }, _ckw_driver{ std::make_unique<GpuCkwStore>(id, tensors) } + : IGpuKernelComponent{ id, properties, tensors }, +#ifndef ACL_INTERNAL_TEST_CKW_IN_DF + _component_writer { + std::make_unique<ClTemplateStore>(id, tensors) } -ClComponentStore::~ClComponentStore() +#else //ACL_INTERNAL_TEST_CKW_IN_DF + _component_writer { + std::make_unique<GpuCkwStore>(id, tensors) } -const IGpuTemplateComponentWriter *ClComponentStore::template_writer() const +#endif //ACL_INTERNAL_TEST_CKW_IN_DF { - return _component_writer.get(); } +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 _ckw_driver.get(); + return _component_writer.get(); } } // namespace dynamic_fusion } // namespace experimental diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentStore.h b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentStore.h index f168ccb97e..853ee39012 100644 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentStore.h +++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentStore.h @@ -25,7 +25,6 @@ #define SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTSTORE #include "src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h" -#include "src/dynamic_fusion/sketch/gpu/template_writer/cl/ClTemplateStore.h" #include <memory> namespace arm_compute @@ -39,7 +38,11 @@ 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 { @@ -85,10 +88,12 @@ public: ClComponentStore(ClComponentStore &&component) = default; /** Allow instances of this class to be moved */ ClComponentStore &operator=(ClComponentStore &&component) = default; - /** Get template writer for the component */ + /** 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 { @@ -96,8 +101,11 @@ public: } private: +#ifndef ACL_INTERNAL_TEST_CKW_IN_DF std::unique_ptr<ClTemplateStore> _component_writer; - std::unique_ptr<GpuCkwStore> _ckw_driver; +#else //ACL_INTERNAL_TEST_CKW_IN_DF + std::unique_ptr<GpuCkwStore> _component_writer; +#endif //ACL_INTERNAL_TEST_CKW_IN_DF }; } // namespace dynamic_fusion } // namespace experimental |