From 188675fd7e7239f56212d72f8ac10598de87e76a Mon Sep 17 00:00:00 2001 From: Sadik Armagan Date: Fri, 12 Feb 2021 17:16:42 +0000 Subject: IVGCVSW-5665 Basic NN Driver support for next OS Version Signed-off-by: Kevin May Signed-off-by: Sadik Armagan Change-Id: I1e1db52322092c6b1b7ac6183c3adc90aabcec24 --- 1.3/ArmnnDriver.hpp | 34 +++++++++++++++++----------------- 1.3/ArmnnDriverImpl.cpp | 8 ++++---- 1.3/ArmnnDriverImpl.hpp | 6 ++++++ 3 files changed, 27 insertions(+), 21 deletions(-) (limited to '1.3') diff --git a/1.3/ArmnnDriver.hpp b/1.3/ArmnnDriver.hpp index b6b55fae..451b5ab5 100644 --- a/1.3/ArmnnDriver.hpp +++ b/1.3/ArmnnDriver.hpp @@ -95,9 +95,9 @@ public: { ALOGV("hal_1_3::ArmnnDriver::prepareModel_1_1()"); - if (!(preference == ExecutionPreference::LOW_POWER || - preference == ExecutionPreference::FAST_SINGLE_ANSWER || - preference == ExecutionPreference::SUSTAINED_SPEED)) + if (!(preference == V1_1::ExecutionPreference::LOW_POWER || + preference == V1_1::ExecutionPreference::FAST_SINGLE_ANSWER || + preference == V1_1::ExecutionPreference::SUSTAINED_SPEED)) { ALOGV("hal_1_3::ArmnnDriver::prepareModel_1_1: Invalid execution preference"); cb->notify(V1_0::ErrorStatus::INVALID_ARGUMENT, nullptr); @@ -138,9 +138,9 @@ public: { ALOGV("hal_1_3::ArmnnDriver::prepareModel_1_2()"); - if (!(preference == ExecutionPreference::LOW_POWER || - preference == ExecutionPreference::FAST_SINGLE_ANSWER || - preference == ExecutionPreference::SUSTAINED_SPEED)) + if (!(preference == V1_1::ExecutionPreference::LOW_POWER || + preference == V1_1::ExecutionPreference::FAST_SINGLE_ANSWER || + preference == V1_1::ExecutionPreference::SUSTAINED_SPEED)) { ALOGV("hal_1_3::ArmnnDriver::prepareModel_1_2: Invalid execution preference"); cb->notify(V1_0::ErrorStatus::INVALID_ARGUMENT, nullptr); @@ -185,9 +185,9 @@ public: { ALOGV("hal_1_3::ArmnnDriver::prepareModel_1_3()"); - if (!(preference == ExecutionPreference::LOW_POWER || - preference == ExecutionPreference::FAST_SINGLE_ANSWER || - preference == ExecutionPreference::SUSTAINED_SPEED)) + if (!(preference == V1_1::ExecutionPreference::LOW_POWER || + preference == V1_1::ExecutionPreference::FAST_SINGLE_ANSWER || + preference == V1_1::ExecutionPreference::SUSTAINED_SPEED)) { ALOGV("hal_1_3::ArmnnDriver::prepareModel_1_3: Invalid execution preference"); cb->notify_1_3(V1_3::ErrorStatus::INVALID_ARGUMENT, nullptr); @@ -226,7 +226,7 @@ public: return Void(); } - Return getStatus() override + Return getStatus() override { ALOGV("hal_1_3::ArmnnDriver::getStatus()"); @@ -253,32 +253,32 @@ public: const android::hardware::hidl_vec&, const android::hardware::hidl_vec&, const HidlToken&, - const sp& callback) + const android::sp& callback) { ALOGV("hal_1_3::ArmnnDriver::prepareModelFromCache()"); callback->notify_1_2(V1_0::ErrorStatus::GENERAL_FAILURE, nullptr); return V1_0::ErrorStatus::GENERAL_FAILURE; } - Return prepareModelFromCache_1_3( + Return prepareModelFromCache_1_3( const V1_3::OptionalTimePoint&, const android::hardware::hidl_vec&, const android::hardware::hidl_vec&, const HidlToken&, - const sp& callback) + const android::sp& callback) { ALOGV("hal_1_3::ArmnnDriver::prepareModelFromCache()"); - callback->notify_1_3(ErrorStatus::GENERAL_FAILURE, nullptr); - return ErrorStatus::GENERAL_FAILURE; + callback->notify_1_3(V1_3::ErrorStatus::GENERAL_FAILURE, nullptr); + return V1_3::ErrorStatus::GENERAL_FAILURE; } Return allocate(const V1_3::BufferDesc& /*desc*/, - const hidl_vec>& /*preparedModels*/, + const hidl_vec>& /*preparedModels*/, const hidl_vec& /*inputRoles*/, const hidl_vec& /*outputRoles*/, allocate_cb cb) { ALOGV("hal_1_3::ArmnnDriver::allocate()"); - cb(ErrorStatus::GENERAL_FAILURE, nullptr, 0); + cb(V1_3::ErrorStatus::GENERAL_FAILURE, nullptr, 0); return Void(); } diff --git a/1.3/ArmnnDriverImpl.cpp b/1.3/ArmnnDriverImpl.cpp index f5a6e856..6a69765c 100644 --- a/1.3/ArmnnDriverImpl.cpp +++ b/1.3/ArmnnDriverImpl.cpp @@ -66,9 +66,9 @@ const char *g_OperandTypeInt32PerformanceExecTime = "Armnn.operandType const char *g_OperandTypeInt32PerformancePowerUsage = "Armnn.operandTypeInt32Performance.powerUsage"; -void NotifyCallbackAndCheck(const sp& callback, +void NotifyCallbackAndCheck(const android::sp& callback, V1_3::ErrorStatus errorStatus, - const sp& preparedModelPtr) + const android::sp& preparedModelPtr) { Return returned = callback->notify_1_3(errorStatus, preparedModelPtr); // This check is required, if the callback fails and it isn't checked it will bring down the service @@ -81,7 +81,7 @@ void NotifyCallbackAndCheck(const sp& callback, Return FailPrepareModel(V1_3::ErrorStatus error, const std::string& message, - const sp& callback) + const android::sp& callback) { ALOGW("ArmnnDriverImpl::prepareModel: %s", message.c_str()); NotifyCallbackAndCheck(callback, error, nullptr); @@ -100,7 +100,7 @@ Return ArmnnDriverImpl::prepareArmnnModel_1_3( const armnn::IGpuAccTunedParametersPtr& clTunedParameters, const DriverOptions& options, const V1_3::Model& model, - const sp& cb, + const android::sp& cb, bool float32ToFloat16, V1_3::Priority priority) { diff --git a/1.3/ArmnnDriverImpl.hpp b/1.3/ArmnnDriverImpl.hpp index 2b39d4e0..3c094fe5 100644 --- a/1.3/ArmnnDriverImpl.hpp +++ b/1.3/ArmnnDriverImpl.hpp @@ -11,7 +11,13 @@ #include +#if !defined(ARMNN_ANDROID_S) using namespace android::nn::hal; +#endif + +#ifdef ARMNN_ANDROID_S +using namespace android::hardware; +#endif namespace V1_0 = ::android::hardware::neuralnetworks::V1_0; namespace V1_2 = ::android::hardware::neuralnetworks::V1_2; -- cgit v1.2.1