aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatteo Martincigh <matteo.martincigh@arm.com>2019-01-31 15:40:08 +0000
committerMatteo Martincigh <matteo.martincigh@arm.com>2019-01-31 16:05:28 +0000
commit01c9151e995adbce540336e8b5835ab903d22870 (patch)
tree7ebc3361fe5303f6609344d7142ff4b3b52054ff
parent2036f85c81840ce9b222a3651fcc0cc330890133 (diff)
downloadandroid-nn-driver-01c9151e995adbce540336e8b5835ab903d22870.tar.gz
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 Change-Id: I06e71c352bb9d7048bc439e5c8ccac0a9c2bb47b Signed-off-by: Matteo Martincigh <matteo.martincigh@arm.com>
-rw-r--r--Android.mk21
-rw-r--r--ArmnnDevice.cpp2
2 files changed, 23 insertions, 0 deletions
diff --git a/Android.mk b/Android.mk
index 84b5c5ab..3d23ecc7 100644
--- a/Android.mk
+++ b/Android.mk
@@ -12,6 +12,11 @@ ARMNN_UTILS_HEADER_PATH := $(LOCAL_PATH)/armnn/src/armnnUtils
OPENCL_HEADER_PATH := $(LOCAL_PATH)/clframework/include
NN_HEADER_PATH := $(LOCAL_PATH)/../../../frameworks/ml/nn/runtime/include
+# Variables to control CL/NEON backend support
+# Set them to '0' to disable support for a specific backend
+ARMNN_COMPUTE_CL_ENABLED := 1
+ARMNN_COMPUTE_NEON_ENABLED := 1
+
#######################
# libarmnn-driver@1.0 #
#######################
@@ -45,6 +50,14 @@ ifeq ($(ARMNN_DRIVER_DEBUG),1)
LOCAL_CFLAGS+= \
-UNDEBUG
endif # ARMNN_DRIVER_DEBUG == 1
+ifeq ($(ARMNN_COMPUTE_CL_ENABLED),1)
+LOCAL_CFLAGS += \
+ -DARMCOMPUTECL_ENABLED
+endif # ARMNN_COMPUTE_CL_ENABLED == 1
+ifeq ($(ARMNN_COMPUTE_NEON_ENABLED),1)
+LOCAL_CFLAGS += \
+ -DARMCOMPUTENEON_ENABLED
+endif # ARMNN_COMPUTE_NEON_ENABLED == 1
LOCAL_SRC_FILES := \
1.0/ArmnnDriverImpl.cpp \
@@ -120,6 +133,14 @@ ifeq ($(ARMNN_DRIVER_DEBUG),1)
LOCAL_CFLAGS+= \
-UNDEBUG
endif # ARMNN_DRIVER_DEBUG == 1
+ifeq ($(ARMNN_COMPUTE_CL_ENABLED),1)
+LOCAL_CFLAGS += \
+ -DARMCOMPUTECL_ENABLED
+endif # ARMNN_COMPUTE_CL_ENABLED == 1
+ifeq ($(ARMNN_COMPUTE_NEON_ENABLED),1)
+LOCAL_CFLAGS += \
+ -DARMCOMPUTENEON_ENABLED
+endif # ARMNN_COMPUTE_NEON_ENABLED == 1
LOCAL_SRC_FILES := \
1.0/ArmnnDriverImpl.cpp \
diff --git a/ArmnnDevice.cpp b/ArmnnDevice.cpp
index ff017019..b807cfa9 100644
--- a/ArmnnDevice.cpp
+++ b/ArmnnDevice.cpp
@@ -35,6 +35,7 @@ ArmnnDevice::ArmnnDevice(DriverOptions options)
SetMinimumLogSeverity(base::INFO);
}
+#if defined(ARMCOMPUTECL_ENABLED)
try
{
armnn::IRuntime::CreationOptions options;
@@ -62,6 +63,7 @@ ArmnnDevice::ArmnnDevice(DriverOptions options)
{
ALOGE("ArmnnDevice: Failed to setup CL runtime: %s. Device will be unavailable.", error.what());
}
+#endif
}
} // namespace armnn_driver