From 0cf77981fadb883b97efec112e115450873e64c3 Mon Sep 17 00:00:00 2001 From: Pablo Tello Date: Wed, 24 Oct 2018 15:32:39 +0100 Subject: COMPMID-1626: Fixed VGG 16/19 bad_alloc failure. Some systems don't have enough memory to run the VGG networks, for example on systems with only 2GB memory the VGG example fails throwing a bad_alloc exception. This patch introduces the concept of global memory policy in ACL, the policy is a mechanism which could be used by the library's functions to try to reduce memory consumption on systems with limited memory. In this specific case the VGG examples set the policy to MINIMIZE. The GEMM function checks if the policy is MINIMIZE and in this case does not use the pretransposed weights path as this requires considerable more memory. Change-Id: I53abc3c9c64d045d8306793ffc9d24b28e228b7b --- src/runtime/NEON/functions/NEGEMM.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/runtime/NEON/functions/NEGEMM.cpp') diff --git a/src/runtime/NEON/functions/NEGEMM.cpp b/src/runtime/NEON/functions/NEGEMM.cpp index e8bf6732b2..82b9cb80ae 100644 --- a/src/runtime/NEON/functions/NEGEMM.cpp +++ b/src/runtime/NEON/functions/NEGEMM.cpp @@ -62,7 +62,14 @@ void NEGEMM::configure(const ITensor *a, const ITensor *b, const ITensor *c, ITe if(run_optimised) { - _asm_glue.configure(a, b, d, alpha, beta, _reshape_b_only_on_first_run); + if(MEMInfo::get_policy() == MemoryPolicy::MINIMIZE) + { + _asm_glue.configure(a, b, d, alpha, beta, false); + } + else + { + _asm_glue.configure(a, b, d, alpha, beta, _reshape_b_only_on_first_run); + } ARM_COMPUTE_ERROR_ON(!_asm_glue.is_configured()); } else -- cgit v1.2.1