From ec1e5b8d0a0eeba7eae0f1fdb5e32c72f8a8093c Mon Sep 17 00:00:00 2001 From: Kevin May Date: Wed, 26 Feb 2020 17:00:39 +0000 Subject: IVGCVSW-4473 Android R pre Hal 1_3 build changes * Update ErrorStatus to V1_0::ErrorStatus * Update Request to V1_0::Request * Update OperandType to V1_2::OperandType * Add namespace android::nn::hal in ArmnnDriverImpl for R only * Add missing g_RelaxedFloat32toFloat16PerformancePowerUsageName * Add namespace V1_0 or V1_1 where necessary * Update Android.mk with R macro and android.hardware.neuralnetworks@1.3 * Remove androidnn.go * include IAllocator in DriverTestHelpers * Remove unused LOCAL_CFLAGS Signed-off-by: Kevin May Change-Id: I1787f1ed6784b3bbec017536d87d49197405e853 Signed-off-by: Kevin May --- test/DriverTestHelpers.hpp | 58 +++++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 27 deletions(-) (limited to 'test/DriverTestHelpers.hpp') diff --git a/test/DriverTestHelpers.hpp b/test/DriverTestHelpers.hpp index 9da02603..7a35b23e 100644 --- a/test/DriverTestHelpers.hpp +++ b/test/DriverTestHelpers.hpp @@ -12,6 +12,10 @@ #include #include +#include + +using ::android::hidl::allocator::V1_0::IAllocator; + namespace android { namespace hardware @@ -21,7 +25,7 @@ namespace neuralnetworks namespace V1_0 { -std::ostream& operator<<(std::ostream& os, ErrorStatus stat); +std::ostream& operator<<(std::ostream& os, V1_0::ErrorStatus stat); } // namespace android::hardware::neuralnetworks::V1_0 } // namespace android::hardware::neuralnetworks @@ -36,7 +40,7 @@ std::ostream& operator<<(std::ostream& os, V1_0::ErrorStatus stat); struct ExecutionCallback : public V1_0::IExecutionCallback { ExecutionCallback() : mNotified(false) {} - Return notify(ErrorStatus status) override; + Return notify(V1_0::ErrorStatus status) override; /// wait until the callback has notified us that it is done Return wait(); @@ -52,18 +56,18 @@ class PreparedModelCallback : public V1_0::IPreparedModelCallback { public: PreparedModelCallback() - : m_ErrorStatus(ErrorStatus::NONE) + : m_ErrorStatus(V1_0::ErrorStatus::NONE) , m_PreparedModel() { } ~PreparedModelCallback() override { } - Return notify(ErrorStatus status, + Return notify(V1_0::ErrorStatus status, const android::sp& preparedModel) override; - ErrorStatus GetErrorStatus() { return m_ErrorStatus; } + V1_0::ErrorStatus GetErrorStatus() { return m_ErrorStatus; } android::sp GetPreparedModel() { return m_PreparedModel; } private: - ErrorStatus m_ErrorStatus; + V1_0::ErrorStatus m_ErrorStatus; android::sp m_PreparedModel; }; @@ -73,24 +77,24 @@ class PreparedModelCallback_1_2 : public V1_2::IPreparedModelCallback { public: PreparedModelCallback_1_2() - : m_ErrorStatus(ErrorStatus::NONE) + : m_ErrorStatus(V1_0::ErrorStatus::NONE) , m_PreparedModel() , m_PreparedModel_1_2() { } ~PreparedModelCallback_1_2() override { } - Return notify(ErrorStatus status, const android::sp& preparedModel) override; + Return notify(V1_0::ErrorStatus status, const android::sp& preparedModel) override; - Return notify_1_2(ErrorStatus status, const android::sp& preparedModel) override; + Return notify_1_2(V1_0::ErrorStatus status, const android::sp& preparedModel) override; - ErrorStatus GetErrorStatus() { return m_ErrorStatus; } + V1_0::ErrorStatus GetErrorStatus() { return m_ErrorStatus; } android::sp GetPreparedModel() { return m_PreparedModel; } android::sp GetPreparedModel_1_2() { return m_PreparedModel_1_2; } private: - ErrorStatus m_ErrorStatus; + V1_0::ErrorStatus m_ErrorStatus; android::sp m_PreparedModel; android::sp m_PreparedModel_1_2; }; @@ -100,7 +104,7 @@ private: hidl_memory allocateSharedMemory(int64_t size); template -android::sp AddPoolAndGetData(uint32_t size, Request& request) +android::sp AddPoolAndGetData(uint32_t size, V1_0::Request& request) { hidl_memory pool; @@ -119,7 +123,7 @@ android::sp AddPoolAndGetData(uint32_t size, Request& request) } template -void AddPoolAndSetData(uint32_t size, Request& request, const T* data) +void AddPoolAndSetData(uint32_t size, V1_0::Request& request, const T* data) { android::sp memory = AddPoolAndGetData(size, request); @@ -201,7 +205,7 @@ void AddTensorOperand(HalModel& model, const hidl_vec& dimensions, const T* values, HalOperandType operandType = HalOperandType::TENSOR_FLOAT32, - HalOperandLifeTime operandLifeTime = HalOperandLifeTime::CONSTANT_COPY, + HalOperandLifeTime operandLifeTime = V1_0::OperandLifeTime::CONSTANT_COPY, double scale = 0.f, int offset = 0) { @@ -247,7 +251,7 @@ void AddTensorOperand(HalModel& model, const hidl_vec& dimensions, const std::vector& values, HalOperandType operandType = HalPolicy::OperandType::TENSOR_FLOAT32, - HalOperandLifeTime operandLifeTime = HalOperandLifeTime::CONSTANT_COPY, + HalOperandLifeTime operandLifeTime = V1_0::OperandLifeTime::CONSTANT_COPY, double scale = 0.f, int offset = 0) { @@ -306,15 +310,15 @@ void AddOutputOperand(HalModel& model, android::sp PrepareModelWithStatus(const V1_0::Model& model, armnn_driver::ArmnnDriver& driver, - ErrorStatus& prepareStatus, - ErrorStatus expectedStatus = ErrorStatus::NONE); + V1_0::ErrorStatus& prepareStatus, + V1_0::ErrorStatus expectedStatus = V1_0::ErrorStatus::NONE); #if defined(ARMNN_ANDROID_NN_V1_1) || defined(ARMNN_ANDROID_NN_V1_2) android::sp PrepareModelWithStatus(const V1_1::Model& model, armnn_driver::ArmnnDriver& driver, - ErrorStatus& prepareStatus, - ErrorStatus expectedStatus = ErrorStatus::NONE); + V1_0::ErrorStatus& prepareStatus, + V1_0::ErrorStatus expectedStatus = V1_0::ErrorStatus::NONE); #endif @@ -322,7 +326,7 @@ template android::sp PrepareModel(const HalModel& model, armnn_driver::ArmnnDriver& driver) { - ErrorStatus prepareStatus = ErrorStatus::NONE; + V1_0::ErrorStatus prepareStatus = V1_0::ErrorStatus::NONE; return PrepareModelWithStatus(model, driver, prepareStatus); } @@ -330,25 +334,25 @@ android::sp PrepareModel(const HalModel& model, android::sp PrepareModelWithStatus_1_2(const armnn_driver::hal_1_2::HalPolicy::Model& model, armnn_driver::ArmnnDriver& driver, - ErrorStatus& prepareStatus, - ErrorStatus expectedStatus = ErrorStatus::NONE); + V1_0::ErrorStatus& prepareStatus, + V1_0::ErrorStatus expectedStatus = V1_0::ErrorStatus::NONE); template android::sp PrepareModel_1_2(const HalModel& model, armnn_driver::ArmnnDriver& driver) { - ErrorStatus prepareStatus = ErrorStatus::NONE; + V1_0::ErrorStatus prepareStatus = V1_0::ErrorStatus::NONE; return PrepareModelWithStatus_1_2(model, driver, prepareStatus); } #endif -ErrorStatus Execute(android::sp preparedModel, - const Request& request, - ErrorStatus expectedStatus = ErrorStatus::NONE); +V1_0::ErrorStatus Execute(android::sp preparedModel, + const V1_0::Request& request, + V1_0::ErrorStatus expectedStatus = V1_0::ErrorStatus::NONE); android::sp ExecuteNoWait(android::sp preparedModel, - const Request& request); + const V1_0::Request& request); } // namespace driverTestHelpers -- cgit v1.2.1