From 035004e65dbffb6534ad4183cf8f95da0544fd28 Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Tue, 13 Apr 2021 19:44:17 +0100 Subject: Add support for a global allocator for OpenCL tensors Give the ability to the user to specify an allocator that can be used by all the internal function tensors. This being a global needs to outlive all the tensors/functions that are using it. Resolves: COMPMID-4212, COMPMID-4213 Signed-off-by: Georgios Pinitas Change-Id: I251871c242879976819ebca1452404133a8e62d7 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5420 Tested-by: Arm Jenkins Reviewed-by: Michele Di Giorgio Comments-Addressed: Arm Jenkins --- arm_compute/runtime/CL/CLTensorAllocator.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'arm_compute/runtime/CL/CLTensorAllocator.h') diff --git a/arm_compute/runtime/CL/CLTensorAllocator.h b/arm_compute/runtime/CL/CLTensorAllocator.h index 067c391489..1b061ee1d6 100644 --- a/arm_compute/runtime/CL/CLTensorAllocator.h +++ b/arm_compute/runtime/CL/CLTensorAllocator.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2020 Arm Limited. + * Copyright (c) 2016-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -26,6 +26,7 @@ #include "arm_compute/runtime/CL/CLArray.h" #include "arm_compute/runtime/CL/CLMemory.h" +#include "arm_compute/runtime/IAllocator.h" #include "arm_compute/runtime/ITensorAllocator.h" #include "arm_compute/runtime/MemoryGroup.h" @@ -127,6 +128,13 @@ public: */ void set_associated_memory_group(IMemoryGroup *associated_memory_group); + /** Sets global allocator that will be used by all CLTensor objects + * + * + * @param[in] allocator Allocator to be used as a global allocator + */ + static void set_global_allocator(IAllocator *allocator); + protected: /** Call map() on the OpenCL buffer. * -- cgit v1.2.1