Release winograd transformed weights if not needed on NEON
authorGeorgios Pinitas <georgios.pinitas@arm.com>
Fri, 15 Jan 2021 09:42:26 +0000 (09:42 +0000)
committerGeorgios Pinitas <georgios.pinitas@arm.com>
Fri, 15 Jan 2021 15:20:13 +0000 (15:20 +0000)
GEMM function used within NEWinogradLayer re-transforms the weights
after the original winograd transformation leading to double allocation
of the weights. Release appropriately and retain only one copy of the
weights, the last transformed one.

Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com>
Change-Id: I60459bfe370bff453150dfe9536cd9e7a5b56def
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4862
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>

src/runtime/NEON/functions/NEWinogradConvolutionLayer.cpp

index bd3bdd6a26db4e2c8d0cf96a3655460a0c11b1d2..21a4b7973a47ccff4ae4c36f7ea128c1c3955604 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2020 Arm Limited.
+ * Copyright (c) 2017-2021 Arm Limited.
  *
  * SPDX-License-Identifier: MIT
  *
@@ -766,8 +766,14 @@ void NEWinogradConvolutionLayer::prepare()
         // Transform weights
         _kernel_storage.allocator()->allocate();
         NEScheduler::get().schedule(_transform_weights_kernel.get(), Window::DimX);
-
         _weights_hwio.allocator()->free();
+
+        _gemm_function.prepare();
+        if(!_kernel_storage.is_used())
+        {
+            _kernel_storage.allocator()->free();
+        }
+
         _is_prepared = true;
     }
 }