From 87a74effff65f6fa1b0e565818e02c3b414ae1cf Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Fri, 20 Aug 2021 17:26:45 +0100 Subject: Re-use auxiliary memory withing CpuWinogradConv2d operators Input/Output transformation operations are independent and done in different time-steps of the algorithm, this memory can be re-used between this transformation stages. Moreover, reduce the allocation when extracting workspace sizes for Winograd trasformations. There is a mix return of sizes in bytes and elements, thus ensure the correct is in place. storage_size() member functions return elements while working_space() function bytes. Resolves: COMPMID-4781 Signed-off-by: Georgios Pinitas Change-Id: I705445ba7ca818cead48369db3cacd49684c7192 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/6145 Tested-by: Arm Jenkins Comments-Addressed: Arm Jenkins Reviewed-by: Michele Di Giorgio --- arm_compute/core/experimental/Types.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'arm_compute') diff --git a/arm_compute/core/experimental/Types.h b/arm_compute/core/experimental/Types.h index 1983344075..a478513b1b 100644 --- a/arm_compute/core/experimental/Types.h +++ b/arm_compute/core/experimental/Types.h @@ -104,6 +104,20 @@ struct MemoryInfo alignment(alignment) { } + + bool merge(int slot, size_t new_size, size_t new_alignment = 0) noexcept + { + if(slot != this->slot) + { + return false; + } + + size = std::max(size, new_size); + alignment = std::max(alignment, new_alignment); + + return true; + } + int slot{ ACL_UNKNOWN }; MemoryLifetime lifetime{ MemoryLifetime::Temporary }; size_t size{ 0 }; -- cgit v1.2.1