From d95e906f135ab9c7a7ac4c9f5d2cef8beb154a88 Mon Sep 17 00:00:00 2001 From: Matteo Martincigh Date: Thu, 31 Jan 2019 15:35:59 +0000 Subject: IVGCVSW-2603 The macros ARMCOMPUTECL_ENABLED and ARMCOMPUTENEON_ENABLED no longer work * Added two master variables ARMNN_COMPUTE_CL_ENABLED and ARMNN_COMPUTE_NEON_ENABLED to android-nn-driver/Android.mk to easily control backend support * Setting either of those two new variables then properly sets the corresponding build macro * If a specific backend gets disabled, the corresponding source files will be excluded from the build * Unified the usage of the pre-compile macros !android-nn-driver:613 Change-Id: I582ff73493b70ba9e22ca2e38d875a0f19566c8a Signed-off-by: Matteo Martincigh --- src/backends/neon/NeonLayerSupport.cpp | 6 +++--- src/backends/neon/backend.mk | 30 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) (limited to 'src/backends/neon') diff --git a/src/backends/neon/NeonLayerSupport.cpp b/src/backends/neon/NeonLayerSupport.cpp index e56d88b7c8..53399a9bf3 100644 --- a/src/backends/neon/NeonLayerSupport.cpp +++ b/src/backends/neon/NeonLayerSupport.cpp @@ -16,7 +16,7 @@ #include -#ifdef ARMCOMPUTENEON_ENABLED +#if defined(ARMCOMPUTENEON_ENABLED) #include "workloads/NeonAdditionWorkload.hpp" #include "workloads/NeonActivationWorkload.hpp" #include "workloads/NeonBatchNormalizationWorkload.hpp" @@ -49,7 +49,7 @@ namespace bool IsNeonBackendSupported(Optional reasonIfUnsupported) { -#if ARMCOMPUTENEON_ENABLED +#if defined(ARMCOMPUTENEON_ENABLED) return true; #else if (reasonIfUnsupported) @@ -78,7 +78,7 @@ bool IsSupportedForDataTypeNeon(Optional reasonIfUnsupported, std::forward(params)...); } -#if ARMCOMPUTENEON_ENABLED +#if defined(ARMCOMPUTENEON_ENABLED) template inline bool IsWorkloadSupported(FuncType& func, Optional reasonIfUnsupported, Args&&... args) { diff --git a/src/backends/neon/backend.mk b/src/backends/neon/backend.mk index 34f797ff46..d9f2ad2255 100644 --- a/src/backends/neon/backend.mk +++ b/src/backends/neon/backend.mk @@ -7,6 +7,12 @@ # in the Android build and it is picked up by the Android.mk # file in the root of ArmNN +# The variable to enable/disable the NEON backend (ARMNN_COMPUTE_NEON_ENABLED) is declared in android-nn-driver/Android.mk +ifeq ($(ARMNN_COMPUTE_NEON_ENABLED),1) + +# ARMNN_COMPUTE_NEON_ENABLED == 1 +# Include the source files for the NEON backend + BACKEND_SOURCES := \ NeonBackend.cpp \ NeonInterceptorScheduler.cpp \ @@ -42,10 +48,25 @@ BACKEND_SOURCES := \ workloads/NeonSoftmaxUint8Workload.cpp \ workloads/NeonSubtractionFloatWorkload.cpp +else + +# ARMNN_COMPUTE_NEON_ENABLED == 0 +# No source file will be compiled for the NEON backend + +BACKEND_SOURCES := + +endif + # BACKEND_TEST_SOURCES contains the list of files to be included # in the Android unit test build (armnn-tests) and it is picked # up by the Android.mk file in the root of ArmNN +# The variable to enable/disable the NEON backend (ARMNN_COMPUTE_NEON_ENABLED) is declared in android-nn-driver/Android.mk +ifeq ($(ARMNN_COMPUTE_NEON_ENABLED),1) + +# ARMNN_COMPUTE_NEON_ENABLED == 1 +# Include the source files for the NEON backend tests + BACKEND_TEST_SOURCES := \ test/NeonCreateWorkloadTests.cpp \ test/NeonEndToEndTests.cpp \ @@ -56,3 +77,12 @@ BACKEND_TEST_SOURCES := \ test/NeonOptimizedNetworkTests.cpp \ test/NeonRuntimeTests.cpp \ test/NeonTimerTest.cpp + +else + +# ARMNN_COMPUTE_NEON_ENABLED == 0 +# No source file will be compiled for the NEON backend tests + +BACKEND_TEST_SOURCES := + +endif -- cgit v1.2.1