From d6539c58519962acd8967e93ceb2da049631c832 Mon Sep 17 00:00:00 2001 From: Sadik Armagan Date: Wed, 22 May 2019 18:00:30 +0100 Subject: IVGCVSW-2911 Add Android Q support to android-nn-driver infrastructure * Updated Android.mk to build Android Q * Added androidnn.go to inject cpp flags for Q * Create Runtime when ACL is not enabled Change-Id: Ia3e7a8e484fc81ce63998a65e29753cbf941173c Signed-off-by: Sadik Armagan Signed-off-by: Kevin May --- test/1.1/Mean.cpp | 4 ++-- test/1.1/Transpose.cpp | 4 ++-- test/Android.mk | 51 ++++++++++++++++++++++++++++++++++++++++++++------ 3 files changed, 49 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/1.1/Mean.cpp b/test/1.1/Mean.cpp index 4ebb8cfa..7d482433 100644 --- a/test/1.1/Mean.cpp +++ b/test/1.1/Mean.cpp @@ -32,7 +32,7 @@ void MeanTestImpl(const TestTensor& input, V1_1::Model model = {}; AddInputOperand (model, input.GetDimensions()); - AddTensorOperand(model, axisDimensions, const_cast(axisValues), OperandType::TENSOR_INT32); + AddTensorOperand(model, axisDimensions, const_cast(axisValues), V1_0::OperandType::TENSOR_INT32); AddIntOperand (model, keepDims); AddOutputOperand(model, expectedOutput.GetDimensions()); @@ -42,7 +42,7 @@ void MeanTestImpl(const TestTensor& input, model.operations[0].outputs = hidl_vec{ 3 }; model.relaxComputationFloat32toFloat16 = fp16Enabled; - android::sp preparedModel = PrepareModel(model, *driver); + android::sp preparedModel = PrepareModel(model, *driver); // The request's memory pools will follow the same order as the inputs DataLocation inLoc = {}; diff --git a/test/1.1/Transpose.cpp b/test/1.1/Transpose.cpp index a0521436..6dc3e0ee 100644 --- a/test/1.1/Transpose.cpp +++ b/test/1.1/Transpose.cpp @@ -30,7 +30,7 @@ void TransposeTestImpl(const TestTensor & inputs, int32_t perm[], V1_1::Model model = {}; AddInputOperand(model,inputs.GetDimensions()); - AddTensorOperand(model, hidl_vec{4}, perm, OperandType::TENSOR_INT32); + AddTensorOperand(model, hidl_vec{4}, perm, V1_0::OperandType::TENSOR_INT32); AddOutputOperand(model, expectedOutputTensor.GetDimensions()); model.operations.resize(1); @@ -38,7 +38,7 @@ void TransposeTestImpl(const TestTensor & inputs, int32_t perm[], model.operations[0].inputs = hidl_vec{0, 1}; model.operations[0].outputs = hidl_vec{2}; - android::sp preparedModel = PrepareModel(model, *driver); + android::sp preparedModel = PrepareModel(model, *driver); // the request's memory pools will follow the same order as // the inputs diff --git a/test/Android.mk b/test/Android.mk index 87f0b636..820cfd61 100644 --- a/test/Android.mk +++ b/test/Android.mk @@ -18,7 +18,12 @@ ARMNN_DRIVER_HEADER_PATH := $(LOCAL_PATH)/.. include $(CLEAR_VARS) LOCAL_MODULE := armnn-driver-tests@1.0 +ifeq ($(PLATFORM_VERSION),Q) +# "eng" is deprecated in Android Q +LOCAL_MODULE_TAGS := optional +else LOCAL_MODULE_TAGS := eng optional +endif LOCAL_ARM_MODE := arm LOCAL_PROPRIETARY_MODULE := true # Mark source files as dependent on Android.mk @@ -36,7 +41,8 @@ LOCAL_CFLAGS := \ -Werror \ -O0 \ -UNDEBUG -ifeq ($(PLATFORM_VERSION),9) + +ifeq ($(P_OR_LATER),1) # Required to build with the changes made to the Android ML framework starting from Android P, # regardless of the HAL version used for the build. LOCAL_CFLAGS+= \ @@ -78,18 +84,32 @@ LOCAL_SHARED_LIBRARIES := \ libutils \ android.hardware.neuralnetworks@1.0 \ android.hidl.allocator@1.0 \ - android.hidl.memory@1.0 \ - libOpenCL -ifeq ($(PLATFORM_VERSION),9) + android.hidl.memory@1.0 + +ifeq ($(P_OR_LATER),1) # Required to build the 1.0 version of the NN Driver on Android P and later versions, # as the 1.0 version of the NN API needs the 1.1 HAL headers to be included regardless. LOCAL_SHARED_LIBRARIES+= \ android.hardware.neuralnetworks@1.1 endif # PLATFORM_VERSION == 9 +ifeq ($(Q_OR_LATER),1) +LOCAL_SHARED_LIBRARIES+= \ + libnativewindow \ + libui \ + libfmq \ + libcutils \ + android.hardware.neuralnetworks@1.2 +endif # PLATFORM_VERSION == Q + +ifeq ($(ARMNN_COMPUTE_CL_ENABLED),1) +LOCAL_SHARED_LIBRARIES+= \ + libOpenCL +endif + include $(BUILD_EXECUTABLE) -ifeq ($(PLATFORM_VERSION),9) +ifeq ($(P_OR_LATER),1) # The following target is available starting from Android P ########################## @@ -98,7 +118,13 @@ ifeq ($(PLATFORM_VERSION),9) include $(CLEAR_VARS) LOCAL_MODULE := armnn-driver-tests@1.1 +ifeq ($(PLATFORM_VERSION),Q) +# "eng" is deprecated in Android Q +LOCAL_MODULE_TAGS := optional +else LOCAL_MODULE_TAGS := eng optional +endif +#PRODUCT_PACKAGES_ENG := libarmnn LOCAL_ARM_MODE := arm LOCAL_PROPRIETARY_MODULE := true # Mark source files as dependent on Android.mk @@ -157,8 +183,21 @@ LOCAL_SHARED_LIBRARIES := \ android.hardware.neuralnetworks@1.0 \ android.hardware.neuralnetworks@1.1 \ android.hidl.allocator@1.0 \ - android.hidl.memory@1.0 \ + android.hidl.memory@1.0 + +ifeq ($(Q_OR_LATER),1) +LOCAL_SHARED_LIBRARIES+= \ + libnativewindow \ + libui \ + libfmq \ + libcutils \ + android.hardware.neuralnetworks@1.2 +endif # PLATFORM_VERSION == Q + +ifeq ($(ARMNN_COMPUTE_CL_ENABLED),1) +LOCAL_SHARED_LIBRARIES+= \ libOpenCL +endif include $(BUILD_EXECUTABLE) -- cgit v1.2.1