diff options
Diffstat (limited to '1.0')
-rw-r--r-- | 1.0/ArmnnDriver.hpp | 5 | ||||
-rw-r--r-- | 1.0/ArmnnDriverImpl.cpp | 68 | ||||
-rw-r--r-- | 1.0/ArmnnDriverImpl.hpp | 28 |
3 files changed, 99 insertions, 2 deletions
diff --git a/1.0/ArmnnDriver.hpp b/1.0/ArmnnDriver.hpp index 18e25968..97613118 100644 --- a/1.0/ArmnnDriver.hpp +++ b/1.0/ArmnnDriver.hpp @@ -8,6 +8,7 @@ #include <HalInterfaces.h> #include "ArmnnDevice.hpp" +#include "ArmnnDriverImpl.hpp" #include "../ArmnnDriverImpl.hpp" #include <log/log.h> @@ -33,8 +34,8 @@ public: { ALOGV("V1_0::ArmnnDriver::getCapabilities()"); - return armnn_driver::ArmnnDriverImpl<HalVersion_1_0>::getCapabilities(m_Runtime, - cb); + return V1_0::ArmnnDriverImpl::getCapabilities(m_Runtime, + cb); } Return<void> getSupportedOperations( diff --git a/1.0/ArmnnDriverImpl.cpp b/1.0/ArmnnDriverImpl.cpp new file mode 100644 index 00000000..925d9dbe --- /dev/null +++ b/1.0/ArmnnDriverImpl.cpp @@ -0,0 +1,68 @@ +// +// Copyright © 2017 Arm Ltd. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +#include "ArmnnDriverImpl.hpp" +#include "../SystemPropertiesUtils.hpp" + +#include <log/log.h> + +using namespace std; +using namespace android; +using namespace android::nn; +using namespace android::hardware; + +namespace +{ + +const char *g_Float32PerformanceExecTimeName = "ArmNN.float32Performance.execTime"; +const char *g_Float32PerformancePowerUsageName = "ArmNN.float32Performance.powerUsage"; +const char *g_Quantized8PerformanceExecTimeName = "ArmNN.quantized8Performance.execTime"; +const char *g_Quantized8PerformancePowerUsageName = "ArmNN.quantized8Performance.powerUsage"; + +} // anonymous namespace + +namespace armnn_driver +{ +namespace V1_0 +{ + +Return<void> ArmnnDriverImpl::getCapabilities( + const armnn::IRuntimePtr& runtime, + neuralnetworks::V1_0::IDevice::getCapabilities_cb cb) +{ + ALOGV("V1_0::ArmnnDriverImpl::getCapabilities()"); + + neuralnetworks::V1_0::Capabilities capabilities; + if (runtime) + { + capabilities.float32Performance.execTime = + ParseSystemProperty(g_Float32PerformanceExecTimeName, .1f); + + capabilities.float32Performance.powerUsage = + ParseSystemProperty(g_Float32PerformancePowerUsageName, .1f); + + capabilities.quantized8Performance.execTime = + ParseSystemProperty(g_Quantized8PerformanceExecTimeName, .1f); + + capabilities.quantized8Performance.powerUsage = + ParseSystemProperty(g_Quantized8PerformancePowerUsageName, .1f); + + cb(ErrorStatus::NONE, capabilities); + } + else + { + capabilities.float32Performance.execTime = 0; + capabilities.float32Performance.powerUsage = 0; + capabilities.quantized8Performance.execTime = 0; + capabilities.quantized8Performance.powerUsage = 0; + + cb(ErrorStatus::DEVICE_UNAVAILABLE, capabilities); + } + + return Void(); +} + +} // namespace armnn_driver::V1_0 +} // namespace armnn_driver diff --git a/1.0/ArmnnDriverImpl.hpp b/1.0/ArmnnDriverImpl.hpp new file mode 100644 index 00000000..b44350d8 --- /dev/null +++ b/1.0/ArmnnDriverImpl.hpp @@ -0,0 +1,28 @@ +// +// Copyright © 2017 Arm Ltd. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +#pragma once + +#include <HalInterfaces.h> + +#include "../DriverOptions.hpp" + +#include <armnn/ArmNN.hpp> + +namespace armnn_driver +{ +namespace V1_0 +{ + +class ArmnnDriverImpl +{ +public: + static Return<void> getCapabilities( + const armnn::IRuntimePtr& runtime, + ::android::hardware::neuralnetworks::V1_0::IDevice::getCapabilities_cb cb); +}; + +} // namespace armnn_driver::V1_0 +} // namespace armnn_driver |