Commit feb475d4 authored by David Gross's avatar David Gross Committed by Lev Proleev
Browse files

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 c97068ab)
parent 61d24121
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment