summaryrefslogtreecommitdiff
path: root/nn/runtime/test/TestMain.cpp
diff options
context:
space:
mode:
authorMichael Butler <butlermichael@google.com>2019-01-24 02:36:37 -0800
committerMichael Butler <butlermichael@google.com>2019-01-27 23:14:04 -0800
commit89e99ba1e6337459b4e821fc93f3adcd6decb684 (patch)
treecd78f31b1e7052cc99a1056dde898d103745686a /nn/runtime/test/TestMain.cpp
parent5c3e2046e8205d835f51440b9cd22ce9bc95af3e (diff)
downloadml-89e99ba1e6337459b4e821fc93f3adcd6decb684.tar.gz
NNAPI Burst -- runtime and CTS
The NNAPI is introducing the notion of an "Execution Burst" object (or more simply a "Burst" object), which is similar to an ANeuralNetworksExecution, but is intended to be reused across multiple executions and has lower IPC overheads. It achieves this low IPC overhead by replacing HIDL HwBinder calls with FMQ messages. This CL implements the NDK burst functions, implements the path through the partitioner/scheduler, and creates CTS tests using the burst object. Bug: 119570067 Test: mma Test: NeuralNetworksTest_static Change-Id: I1d2414f454910ad3ba4b2af728ab95ef8b609c9c
Diffstat (limited to 'nn/runtime/test/TestMain.cpp')
-rw-r--r--nn/runtime/test/TestMain.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/nn/runtime/test/TestMain.cpp b/nn/runtime/test/TestMain.cpp
index 87528f13e..dc32cec00 100644
--- a/nn/runtime/test/TestMain.cpp
+++ b/nn/runtime/test/TestMain.cpp
@@ -40,7 +40,8 @@ using namespace android::nn::test_wrapper;
// non-public DeviceManager::setSyncExecHal(); we assume the setting is always
// true, and if we are asked to set it to false, we return 0 ("success") without
// running tests.
-static int test(bool useCpuOnly, bool computeUsesSynchronousAPI, bool allowSyncExecHal = true) {
+static int test(bool useCpuOnly, bool computeUsesSynchronousAPI, bool allowSyncExecHal = true,
+ bool computeUsesBurstAPI = false) {
#ifdef NNTEST_ONLY_PUBLIC_API
if (useCpuOnly || !allowSyncExecHal) {
return 0;
@@ -51,6 +52,7 @@ static int test(bool useCpuOnly, bool computeUsesSynchronousAPI, bool allowSyncE
#endif
Execution::setComputeUsesSynchronousAPI(computeUsesSynchronousAPI);
+ Execution::setComputeUsesBurstAPI(computeUsesBurstAPI);
LOG(INFO) << "test(useCpuOnly = " << useCpuOnly
<< ", computeUsesSynchronousAPI = " << computeUsesSynchronousAPI
@@ -77,5 +79,13 @@ int main(int argc, char** argv) {
// so there's no reason to run test(true, *, false) now.
n |= test(false, false, false) | test(false, true, false);
+ // Now try execution using a burst.
+ //
+ // The burst path is off by default in these tests. This is the first case
+ // where it is turned on. Both "computeUsesSynchronousAPI" and
+ // "allowSyncExecHal" are irrelevant here because the burst path is separate
+ // from both.
+ n |= test(false, false, false, true);
+
return n;
}