aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin May <kevin.may@arm.com>2020-05-15 15:34:03 +0100
committerKevin May <kevin.may@arm.com>2020-05-15 15:12:24 +0000
commitabc95d04dfb2462ffb42bc1facde4f45ecc65319 (patch)
tree3c90cb117cd048a4c4742e3d0929b76b7ad640df
parentbe6b3c292dee16d69ed1849f7cfb3febd4568ee3 (diff)
downloadandroid-nn-driver-abc95d04dfb2462ffb42bc1facde4f45ecc65319.tar.gz
IVGCVSW-4837 Add driver service name command line option
* revert commit 8a510e8e9ed22ec0bbd295b69a6700ad0ba7cfd8 * Add driver option to give service a name, default to "armnn" Change-Id: I9755206494f637bee4c8299bf6370fc4731638c8 Signed-off-by: Kevin May <kevin.may@arm.com>
-rw-r--r--Android.mk24
-rw-r--r--DriverOptions.cpp4
-rw-r--r--DriverOptions.hpp2
-rw-r--r--android.hardware.neuralnetworks@1.0-service-armnn.rc (renamed from android.hardware.neuralnetworks@1.0-service-arm-armnn.rc)2
-rw-r--r--android.hardware.neuralnetworks@1.1-service-armnn.rc (renamed from android.hardware.neuralnetworks@1.1-service-arm-armnn.rc)2
-rw-r--r--android.hardware.neuralnetworks@1.2-service-armnn.rc (renamed from android.hardware.neuralnetworks@1.2-service-arm-armnn.rc)2
-rw-r--r--android.hardware.neuralnetworks@1.3-service-armnn.rc (renamed from android.hardware.neuralnetworks@1.3-service-arm-armnn.rc)2
-rw-r--r--docs/IntegratorGuide.md14
-rw-r--r--service.cpp3
9 files changed, 31 insertions, 24 deletions
diff --git a/Android.mk b/Android.mk
index 034495b..bf8bc65 100644
--- a/Android.mk
+++ b/Android.mk
@@ -546,12 +546,12 @@ include $(BUILD_STATIC_LIBRARY)
endif # PLATFORM_VERSION == R
#####################################################
-# android.hardware.neuralnetworks@1.0-service-arm-armnn #
+# android.hardware.neuralnetworks@1.0-service-armnn #
#####################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.neuralnetworks@1.0-service-arm-armnn
-LOCAL_INIT_RC := android.hardware.neuralnetworks@1.0-service-arm-armnn.rc
+LOCAL_MODULE := android.hardware.neuralnetworks@1.0-service-armnn
+LOCAL_INIT_RC := android.hardware.neuralnetworks@1.0-service-armnn.rc
ifeq ($(Q_OR_LATER),1)
# "eng" is deprecated in Android Q
LOCAL_MODULE_TAGS := optional
@@ -650,12 +650,12 @@ ifeq ($(P_OR_LATER),1)
# The following target is available starting from Android P
#####################################################
-# android.hardware.neuralnetworks@1.1-service-arm-armnn #
+# android.hardware.neuralnetworks@1.1-service-armnn #
#####################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.neuralnetworks@1.1-service-arm-armnn
-LOCAL_INIT_RC := android.hardware.neuralnetworks@1.1-service-arm-armnn.rc
+LOCAL_MODULE := android.hardware.neuralnetworks@1.1-service-armnn
+LOCAL_INIT_RC := android.hardware.neuralnetworks@1.1-service-armnn.rc
ifeq ($(Q_OR_LATER),1)
# "eng" is deprecated in Android Q
LOCAL_MODULE_TAGS := optional
@@ -751,12 +751,12 @@ ifeq ($(Q_OR_LATER),1)
# The following target is available starting from Android Q
#####################################################
-# android.hardware.neuralnetworks@1.2-service-arm-armnn #
+# android.hardware.neuralnetworks@1.2-service-armnn #
#####################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.neuralnetworks@1.2-service-arm-armnn
-LOCAL_INIT_RC := android.hardware.neuralnetworks@1.2-service-arm-armnn.rc
+LOCAL_MODULE := android.hardware.neuralnetworks@1.2-service-armnn
+LOCAL_INIT_RC := android.hardware.neuralnetworks@1.2-service-armnn.rc
LOCAL_MODULE_TAGS := optional
LOCAL_ARM_MODE := arm
LOCAL_MODULE_RELATIVE_PATH := hw
@@ -839,12 +839,12 @@ ifeq ($(R_OR_LATER),1)
# The following target is available starting from Android R
#####################################################
-# android.hardware.neuralnetworks@1.3-service-arm-armnn #
+# android.hardware.neuralnetworks@1.3-service-armnn #
#####################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.neuralnetworks@1.3-service-arm-armnn
-LOCAL_INIT_RC := android.hardware.neuralnetworks@1.3-service-arm-armnn.rc
+LOCAL_MODULE := android.hardware.neuralnetworks@1.3-service-armnn
+LOCAL_INIT_RC := android.hardware.neuralnetworks@1.3-service-armnn.rc
LOCAL_MODULE_TAGS := optional
LOCAL_ARM_MODE := arm
LOCAL_MODULE_RELATIVE_PATH := hw
diff --git a/DriverOptions.cpp b/DriverOptions.cpp
index 94fd594..1f534b6 100644
--- a/DriverOptions.cpp
+++ b/DriverOptions.cpp
@@ -76,6 +76,10 @@ DriverOptions::DriverOptions(int argc, char** argv)
po::value<std::string>(&m_RequestInputsAndOutputsDumpDir)->default_value(""),
"If non-empty, the directory where request inputs and outputs should be dumped")
+ ("service-name,n",
+ po::value<std::string>(&m_ServiceName)->default_value("armnn"),
+ "If non-empty, the driver service name to be registered")
+
("unsupported-operations,u",
po::value<std::string>(&unsupportedOperationsAsString)->default_value(""),
"If non-empty, a comma-separated list of operation indices which the driver will forcibly "
diff --git a/DriverOptions.hpp b/DriverOptions.hpp
index 141ca8a..b05647c 100644
--- a/DriverOptions.hpp
+++ b/DriverOptions.hpp
@@ -25,6 +25,7 @@ public:
const std::vector<armnn::BackendId>& GetBackends() const { return m_Backends; }
bool IsVerboseLoggingEnabled() const { return m_VerboseLogging; }
const std::string& GetRequestInputsAndOutputsDumpDir() const { return m_RequestInputsAndOutputsDumpDir; }
+ const std::string& GetServiceName() const { return m_ServiceName; }
const std::set<unsigned int>& GetForcedUnsupportedOperations() const { return m_ForcedUnsupportedOperations; }
const std::string& GetClTunedParametersFile() const { return m_ClTunedParametersFile; }
armnn::IGpuAccTunedParameters::Mode GetClTunedParametersMode() const { return m_ClTunedParametersMode; }
@@ -37,6 +38,7 @@ private:
std::vector<armnn::BackendId> m_Backends;
bool m_VerboseLogging;
std::string m_RequestInputsAndOutputsDumpDir;
+ std::string m_ServiceName;
std::set<unsigned int> m_ForcedUnsupportedOperations;
std::string m_ClTunedParametersFile;
armnn::IGpuAccTunedParameters::Mode m_ClTunedParametersMode;
diff --git a/android.hardware.neuralnetworks@1.0-service-arm-armnn.rc b/android.hardware.neuralnetworks@1.0-service-armnn.rc
index b8a2c9c..d720086 100644
--- a/android.hardware.neuralnetworks@1.0-service-arm-armnn.rc
+++ b/android.hardware.neuralnetworks@1.0-service-armnn.rc
@@ -1,4 +1,4 @@
-service neuralnetworks_hal_service_armnn /vendor/bin/hw/android.hardware.neuralnetworks@1.0-service-arm-armnn
+service neuralnetworks_hal_service_armnn /vendor/bin/hw/android.hardware.neuralnetworks@1.0-service-armnn
class hal
user system
group system
diff --git a/android.hardware.neuralnetworks@1.1-service-arm-armnn.rc b/android.hardware.neuralnetworks@1.1-service-armnn.rc
index fad1905..98efaf9 100644
--- a/android.hardware.neuralnetworks@1.1-service-arm-armnn.rc
+++ b/android.hardware.neuralnetworks@1.1-service-armnn.rc
@@ -1,4 +1,4 @@
-service neuralnetworks_hal_service_armnn /vendor/bin/hw/android.hardware.neuralnetworks@1.1-service-arm-armnn
+service neuralnetworks_hal_service_armnn /vendor/bin/hw/android.hardware.neuralnetworks@1.1-service-armnn
class hal
user system
group system
diff --git a/android.hardware.neuralnetworks@1.2-service-arm-armnn.rc b/android.hardware.neuralnetworks@1.2-service-armnn.rc
index 81f6bc9..5889446 100644
--- a/android.hardware.neuralnetworks@1.2-service-arm-armnn.rc
+++ b/android.hardware.neuralnetworks@1.2-service-armnn.rc
@@ -1,4 +1,4 @@
-service neuralnetworks_hal_service_armnn /vendor/bin/hw/android.hardware.neuralnetworks@1.2-service-arm-armnn
+service neuralnetworks_hal_service_armnn /vendor/bin/hw/android.hardware.neuralnetworks@1.2-service-armnn
class hal
user system
group system
diff --git a/android.hardware.neuralnetworks@1.3-service-arm-armnn.rc b/android.hardware.neuralnetworks@1.3-service-armnn.rc
index 25855d4..3f84d9c 100644
--- a/android.hardware.neuralnetworks@1.3-service-arm-armnn.rc
+++ b/android.hardware.neuralnetworks@1.3-service-armnn.rc
@@ -1,4 +1,4 @@
-service neuralnetworks_hal_service_armnn /vendor/bin/hw/android.hardware.neuralnetworks@1.3-service-arm-armnn
+service neuralnetworks_hal_service_armnn /vendor/bin/hw/android.hardware.neuralnetworks@1.3-service-armnn
class hal
user system
group system
diff --git a/docs/IntegratorGuide.md b/docs/IntegratorGuide.md
index d454f21..8200d81 100644
--- a/docs/IntegratorGuide.md
+++ b/docs/IntegratorGuide.md
@@ -21,19 +21,19 @@ directory. This file is normally called `device.mk`:
For Android P or Q, using NN API version (1.0), the following should be added to `device.mk`:
<pre>
-PRODUCT_PACKAGES += android.hardware.neuralnetworks@1.0-service-arm-armnn
+PRODUCT_PACKAGES += android.hardware.neuralnetworks@1.0-service-armnn
</pre>
For Android P or Q, a new version of the NN API is available (1.1),
thus the following should be added to `device.mk` instead:
<pre>
-PRODUCT_PACKAGES += android.hardware.neuralnetworks@1.1-service-arm-armnn
+PRODUCT_PACKAGES += android.hardware.neuralnetworks@1.1-service-armnn
</pre> `Android.mk` contains the module definition of both versions of the ArmNN driver.
For Android Q, a new version of the NN API is available (1.2),
thus the following should be added to `device.mk` instead:
<pre>
-PRODUCT_PACKAGES += android.hardware.neuralnetworks@1.2-service-arm-armnn
+PRODUCT_PACKAGES += android.hardware.neuralnetworks@1.2-service-armnn
</pre> `Android.mk` contains the module definition of all three versions (1.0, 1.1 and 1.2) of the ArmNN driver.
Similarly, the Neon, CL or reference backend can be enabled/disabled by setting ARMNN_COMPUTE_CL_ENABLE,
@@ -66,7 +66,7 @@ Android P
</pre>
For example, if the ArmNN driver has been built with the NN API 1.0, check for the following file:
<pre>
-<ANDROID_ROOT>/out/target/product/<product>/system/vendor/bin/hw/android.hardware.neuralnetworks@1.0-service-arm-armnn
+<ANDROID_ROOT>/out/target/product/<product>/system/vendor/bin/hw/android.hardware.neuralnetworks@1.0-service-armnn
</pre>
Android Q has a different path:
@@ -79,7 +79,7 @@ Android Q has a different path:
1. Run the ArmNN driver service executable in the background.
The following examples assume that the 1.0 version of the driver is being used:
<pre>
-adb shell /system/vendor/bin/hw/android.hardware.neuralnetworks@1.0-service-arm-armnn &
+adb shell /system/vendor/bin/hw/android.hardware.neuralnetworks@1.0-service-armnn &
</pre>
2. Run some code that exercises the Android Neural Networks API, for example Android's
`NeuralNetworksTest` unit tests (note this is an optional component that must be built).
@@ -101,12 +101,12 @@ The recommended way of using it with ArmNN is to generate the tuning data during
1. Run the ArmNN driver service executable in tuning mode. The path to the tuning data must be writable by the service.
The following examples assume that the 1.0 version of the driver is being used:
<pre>
-adb shell /system/vendor/bin/hw/android.hardware.neuralnetworks@1.0-service-arm-armnn --cl-tuned-parameters-file &lt;PATH_TO_TUNING_DATA&gt; --cl-tuned-parameters-mode UpdateTunedParameters --cl-tuning-level exhaustive &
+adb shell /system/vendor/bin/hw/android.hardware.neuralnetworks@1.0-service-armnn --cl-tuned-parameters-file &lt;PATH_TO_TUNING_DATA&gt; --cl-tuned-parameters-mode UpdateTunedParameters --cl-tuning-level exhaustive &
</pre>
2. Run a representative set of Android NNAPI testing loads. In this mode of operation, each NNAPI workload will be slow the first time it is executed, as the tuning parameters are being selected. Subsequent executions will use the tuning data which has been generated.
3. Stop the service.
4. Deploy the tuned parameters file to a location readable by the ArmNN driver service (for example, to a location within /vendor/etc).
5. During normal operation, pass the location of the tuning data to the driver service (this would normally be done by passing arguments via Android init in the service .rc definition):
<pre>
-adb shell /system/vendor/bin/hw/android.hardware.neuralnetworks@1.0-service-arm-armnn --cl-tuned-parameters-file &lt;PATH_TO_TUNING_DATA&gt; &
+adb shell /system/vendor/bin/hw/android.hardware.neuralnetworks@1.0-service-armnn --cl-tuned-parameters-file &lt;PATH_TO_TUNING_DATA&gt; &
</pre>
diff --git a/service.cpp b/service.cpp
index 740198a..823f0c7 100644
--- a/service.cpp
+++ b/service.cpp
@@ -18,6 +18,7 @@ using namespace std;
int main(int argc, char** argv)
{
android::sp<ArmnnDriver> driver;
+ DriverOptions driverOptions(argc, argv);
try
{
driver = new ArmnnDriver(DriverOptions(argc, argv));
@@ -32,7 +33,7 @@ int main(int argc, char** argv)
android::status_t status = android::UNKNOWN_ERROR;
try
{
- status = driver->registerAsService("arm-armnn");
+ status = driver->registerAsService(driverOptions.GetServiceName());
}
catch (const std::exception& e)
{