From 42477c1d3e7ddf74863e84ab79dbe6f42e4a0ba3 Mon Sep 17 00:00:00 2001 From: Kevin May Date: Thu, 26 Mar 2020 13:34:14 +0000 Subject: IVGCVSW-4447 Add Hal 1_3 Support * Add new 1.3 files HalPolicy, ArmnnDriver, ArmnnDriverImpl * Add new .rc file for 1.3 service * Add ArmnnPreparedModel_1_3 and implement new functions * Update Android.mk with 1.3 driver and service * Refactor ifdef to include ARMNN_ANDROID_NN_V1_3 * Create Utils getMainModel for new 1.3 Model Main Subgraph * Use android Utils to convertToV1_X in ArmnnPrepapredModel_1_3 * Refactor HAL 1.2 convert functions into ConversionUtils_1_2.hpp * Replace ArmnnBurstExecutorWithCache with call to ExecutionBurstServer Signed-off-by: Kevin May Change-Id: I514069e9e1b16bcd1c4abfb5d563d25ac22d02e3 --- ArmnnDriverImpl.cpp | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'ArmnnDriverImpl.cpp') diff --git a/ArmnnDriverImpl.cpp b/ArmnnDriverImpl.cpp index eab95989..9c6d51fd 100644 --- a/ArmnnDriverImpl.cpp +++ b/ArmnnDriverImpl.cpp @@ -8,10 +8,16 @@ #include "ArmnnDriverImpl.hpp" #include "ArmnnPreparedModel.hpp" -#ifdef ARMNN_ANDROID_NN_V1_2 // Using ::android::hardware::neuralnetworks::V1_2 +#if defined(ARMNN_ANDROID_NN_V1_2) || defined(ARMNN_ANDROID_NN_V1_3) // Using ::android::hardware::neuralnetworks::V1_2 #include "ArmnnPreparedModel_1_2.hpp" #endif +#ifdef ARMNN_ANDROID_NN_V1_3 // Using ::android::hardware::neuralnetworks::V1_2 +#include "ArmnnPreparedModel_1_3.hpp" +#endif + +#include "Utils.hpp" + #include "ModelToINetworkConverter.hpp" #include "SystemPropertiesUtils.hpp" #include @@ -227,14 +233,14 @@ Return ArmnnDriverImpl::getSupportedOperations(const armnn::IRu if (!runtime) { - cb(V1_0::ErrorStatus::DEVICE_UNAVAILABLE, result); + cb(HalErrorStatus::DEVICE_UNAVAILABLE, result); return Void(); } // Run general model validation, if this doesn't pass we shouldn't analyse the model anyway. if (!android::nn::validateModel(model)) { - cb(V1_0::ErrorStatus::INVALID_ARGUMENT, result); + cb(HalErrorStatus::INVALID_ARGUMENT, result); return Void(); } @@ -246,20 +252,22 @@ Return ArmnnDriverImpl::getSupportedOperations(const armnn::IRu if (modelConverter.GetConversionResult() != ConversionResult::Success && modelConverter.GetConversionResult() != ConversionResult::UnsupportedFeature) { - cb(V1_0::ErrorStatus::GENERAL_FAILURE, result); + cb(HalErrorStatus::GENERAL_FAILURE, result); return Void(); } // Check each operation if it was converted successfully and copy the flags // into the result (vector) that we need to return to Android. - result.reserve(model.operations.size()); - for (uint32_t operationIdx = 0; operationIdx < model.operations.size(); operationIdx++) + result.reserve(getMainModel(model).operations.size()); + for (uint32_t operationIdx = 0; + operationIdx < getMainModel(model).operations.size(); + ++operationIdx) { bool operationSupported = modelConverter.IsOperationSupported(operationIdx); result.push_back(operationSupported); } - cb(V1_0::ErrorStatus::NONE, result); + cb(HalErrorStatus::NONE, result); return Void(); } @@ -286,4 +294,10 @@ template class ArmnnDriverImpl; template class ArmnnDriverImpl; #endif +#ifdef ARMNN_ANDROID_NN_V1_3 +template class ArmnnDriverImpl; +template class ArmnnDriverImpl; +template class ArmnnDriverImpl; +#endif + } // namespace armnn_driver -- cgit v1.2.1