summaryrefslogtreecommitdiff
path: root/nn/runtime/test/TestMemoryInternal.cpp
diff options
context:
space:
mode:
authorDavid Gross <dgross@google.com>2018-11-15 21:10:05 -0800
committerLev Proleev <levp@google.com>2018-11-29 18:41:21 +0000
commitfeb475d4a7464c64f9eb89193f19d06f0438f973 (patch)
tree458b8e82276941f7f9a2b6756689a37a1b6dd84c /nn/runtime/test/TestMemoryInternal.cpp
parent61d241218842776a80e6572cb15cc6540daf63e2 (diff)
downloadml-feb475d4a7464c64f9eb89193f19d06f0438f973.tar.gz
Implement ANeuralNetworksExecution_compute() and add related properties.
Change wrapper::Execution::compute() to use ANeuralNetworksExecution_compute() rather than simulating it using ANeuralNetworksExecution_startCompute(). Change test_wrapper::Execution::compute() the same way by default, but to permit simulation by setting global state using test_wrapper::Execution::setComputeUsesSynchronousAPI(). Setting the new property debug.nn.syncexec-runtime to 1 makes ANeuralNetworksExecution_startCompute() behave synchronously (i.e., it will not return until the work is complete). In this case, the runtime itself will not spawn a thread to do the work. This simulates using ANeuralNetworksExecution_compute(). Setting the new property debug.nn.syncexec-cpu to 1 instructs the runtime not to spawn a thread to do CPU execution. Remove the execution path that was under the control of preprocessor symbol DISABLE_PARTITIONED_EXECUTION. Modify NeuralNetworksTest so that instead of iterating over {useCpuOnly=no, useCpuOnly=yes} it instead iterates over {useCpuOnly=no, useCpuOnly=yes} x {computeUsesSynchronousAPI=no, computeUsesSynchronousAPI=yes} Bug: 115920643 Bug: 119272497 Test: NeuralNetworksTest_static (and verify from logcat that we're getting correct threading behavior according to API choices and property settings) Test: cts -m CtsNNAPITestCases Change-Id: I9723aa502197a8d48a95a3ae5d7f053d381001da Merged-In: I9723aa502197a8d48a95a3ae5d7f053d381001da (cherry picked from commit c97068abfcb2174f6ffa6cb477250b5ccdca1a82)
Diffstat (limited to 'nn/runtime/test/TestMemoryInternal.cpp')
-rw-r--r--nn/runtime/test/TestMemoryInternal.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/nn/runtime/test/TestMemoryInternal.cpp b/nn/runtime/test/TestMemoryInternal.cpp
index f05f7f28f..755af09fd 100644
--- a/nn/runtime/test/TestMemoryInternal.cpp
+++ b/nn/runtime/test/TestMemoryInternal.cpp
@@ -20,9 +20,9 @@
#include "TestMemory.h"
-#include "NeuralNetworksWrapper.h"
#include "Manager.h"
#include "Memory.h"
+#include "TestNeuralNetworksWrapper.h"
#include <android/sharedmem.h>
#include <gtest/gtest.h>
@@ -30,13 +30,13 @@
#include <fstream>
#include <string>
-using WrapperCompilation = ::android::nn::wrapper::Compilation;
-using WrapperExecution = ::android::nn::wrapper::Execution;
-using WrapperMemory = ::android::nn::wrapper::Memory;
-using WrapperModel = ::android::nn::wrapper::Model;
-using WrapperOperandType = ::android::nn::wrapper::OperandType;
-using WrapperResult = ::android::nn::wrapper::Result;
-using WrapperType = ::android::nn::wrapper::Type;
+using WrapperCompilation = ::android::nn::test_wrapper::Compilation;
+using WrapperExecution = ::android::nn::test_wrapper::Execution;
+using WrapperMemory = ::android::nn::test_wrapper::Memory;
+using WrapperModel = ::android::nn::test_wrapper::Model;
+using WrapperOperandType = ::android::nn::test_wrapper::OperandType;
+using WrapperResult = ::android::nn::test_wrapper::Result;
+using WrapperType = ::android::nn::test_wrapper::Type;
namespace {