summaryrefslogtreecommitdiff
path: root/nn/runtime/test/TestTrivialModel.cpp
AgeCommit message (Collapse)Author
2020-10-07Merge "ml: add define guards for hardware buffer tests"Treehugger Robot
2020-10-06Fix AHWB handle leak in CpuExecutor when locking fails.Xusong Wang
Fixes: 169166682 Test: NNT_static Change-Id: I78ff6f1d8ad454e69601bf69e00f4c7f4e865d2d Merged-In: I78ff6f1d8ad454e69601bf69e00f4c7f4e865d2d (cherry picked from commit 4f8699a89ba93512f835c71c0e503cffee6a2537)
2020-10-01ml: add define guards for hardware buffer testsJim Pollock
In ChromeOS, we do not have hardware buffer support. In order to keep our codebases as close as possible, we would like to only build in the hardware buffer tests when on the Android platform. Bug: 165801983 Test: mma in frameworks/ml Change-Id: I6a5cda93c1fd74b3edd95a687803155d82c0b63e
2020-03-13Add a test that uses AHardwareBuffer as execution inputMiao Wang
- If AHardwareBuffer_unlock returns valid sync fence, ANeuralNetworksExecution_startComputeWithDependencies will be used to perform the execution. Bug: 148979873 Test: mm Test: CtsNNAPITestCases Change-Id: I012fa0deb81ac899d85d7ec3149b4e970ffeeb5c Merged-In: I012fa0deb81ac899d85d7ec3149b4e970ffeeb5c (cherry picked from commit 5401d830d847e4a295e67d498b2177f3a218abac)
2020-01-30Update sync fence related APIsMiao Wang
- Allow ANeuralNetworksExecution_startComputeWithDependencies to measure execution duration after all dependencies are done. - Allow ANeuralNetworksExecution_startComputeWithDependencies to specify post-gate-release timeout duration. Bug: 142778241 Bug: 136739795 Test: mm Test: NNAPI CTS & VTS tests Change-Id: Ie32e30b7d1cb98882f3084c1741e975d3e39d970 Merged-In: Ie32e30b7d1cb98882f3084c1741e975d3e39d970 (cherry picked from commit 879701620e997b462fdbd66bc5963dba47399436)
2020-01-27Add tests for sync fence related API.Miao Wang
The following tests are added: - basic validation tests - generated tests for ANeuralNetworksExecution_startComputeWithDependencies. Bug: 142778241 Test: mm Change-Id: I5591db4583e8b752868d06e16874780800d4410e Merged-In: I5591db4583e8b752868d06e16874780800d4410e (cherry picked from commit 688992b3e241dd8936d63c6a21977bfc6b6f0773)
2019-11-07Add new helper method to TestNeuralNetworksWrapperSlava Shklyaev
addConstantOperand is a shortcut for writing more readable tests. Before: const int32_t kValue = 1; uint32_t operand = model.addOperand(&type); model.setOperandValue(operand, &kValue, sizeof(kValue)); After: uint32_t operand = model.addConstantOperand(&type, int32_t{1}); Bug: 139181916 Test: NNT_static Change-Id: I660e1949aac4334199e66352b0e16167b08566e3 Merged-In: I660e1949aac4334199e66352b0e16167b08566e3 (cherry picked from commit 586e4b9f3e2946b50c0773205c18ace1c56430d2)
2019-08-23clang-format for frameworks/ml/nnMichael Butler
This CL formats all of frameworks/ml/nn/* with the following commands: $ $CLANG_DIR/clang-format --style=file -i `find $NNAPI_DIR -name "*.cpp"` $ $CLANG_DIR/clang-format --style=file -i `find $NNAPI_DIR -name "*.h"` where: * "NNAPI_DIR" is "$ANDROID_BUILD_TOP/frameworks/ml/nn" * "CLANG_DIR" is "$ANDROID_BUILD_TOP/prebuilts/clang/host/linux-x86/clang-stable/bin" Bug: N/A Test: mma Change-Id: Idddbc7ecaeab76fb0bbee4250830333752a1f29b Merged-In: Idddbc7ecaeab76fb0bbee4250830333752a1f29b (cherry picked from commit 67e41a5467d7879b34f613069ade6cf61d5bd633)
2018-11-29Implement ANeuralNetworksExecution_compute() and add related properties.David Gross
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)
2017-11-15Improve validation of the HAL structures.Jean-Luc Brouillet
Add a lot of validation of the structures passed in the HAL. Particularly important are those that operands & arguments don't try to reach out of their memory blocks. Also grabs a few missing generated tests. Bug: 67828197 Test: System tests & VTS tests. Change-Id: I2edf6219fc660fab7c5b6a73e7a9cb8a358fb29b
2017-10-06Allow fine grain verbose logging control through system property.Miao Wang
- Existing DEBUG and INFO change to the new mechanism, existing ERROR and WARNING unchanged. - By default, all verbose logging are disabled. - setprop debug.nn.vlog 1 enables all verbose logging. - setprop debug.nn.vlog "tag1 tag2 ..." only enable the selected tags. - Available tags: all: same as 1. model: enable logging with tag MODEL. compilation: enable logging with tag COMPILATION. execution: enable logging with tag EXECUTION. cpuexe: enable logging with tag CPUEXE. manager: enable logging with tag MANAGER. driver: enable logging with tag DRIVER. Bug: 63905942 Test: mm Test: NeuralNetworksTests pass Test: manually set property to allow individual module to logging verbosely Test: tested with debug.nn.partition default -> 0 -> 1 to make sure getProp still works fine Change-Id: Iaa0ffa62176dabcdc35058748597df720fd6e47e
2017-10-04Rename setInputsAndOutputsJean-Luc Brouillet
To avoid confusion with other set* functions, rename setInputsAndOutputs to identifyInputsAndOutputs. Also added a few new generated tests when I reran generate_test.sh. Bug: 63905942 Test: local & VTS tests Change-Id: Ie947044bee1a97426c847b9d66e60f0c25395bbc
2017-09-13Make Compilation API synchronous.David Gross
Per advice from the API council, the Compilation API no longer exposes asynchronous behavior to the user -- rather than start() and wait() APIs, we now have a finish() API. Also: - Track whether or not Compilation::finish() has been invoked, for the sake of API usage checking. - Changed Model::finish() to return Result not int, for consistency. - Made Model and Compilation documentation more similar to one another. - Fixed typos in documentation. NOTE: It's possible to implement compilation asynchronously behind the synchronous API -- e.g., Compilation_finish() starts compilation asynchronously, and we implicitly wait for it to complete at the point of Request_startCompute(). However, this would defeat one of the purposes of an explicit Compilation API -- giving the application control over when to spend the time compiling, to keep it off a critical timing path, such as repeatedly applying a model to a sequence of frames in real time. Bug: 63905942 Test: nn/runtime/tests Change-Id: I7194e277aa6211af66794d917dcc5254c7d81af4
2017-09-13Remove the initialization and shutdown APIs.Jean-Luc Brouillet
Initialize the list of drivers as needed rather than requiring an API call. This initialization will be triggered when compiling the first model. Bug: 63905942 Test: Compiled and ran the unit tests. Change-Id: I1893a9f9d96d9d241916de3a7dd3cb7a54e33b06
2017-09-13Rename Request to Execution at the API level.David Gross
There's a separate notion of Request at the HIDL level; this is not renamed. Bug: 63905942 Test: nn/runtime/tests Change-Id: I671e3b387d735a9091dc5a2d14afbea6b45f444c
2017-09-11More discipline for models and requests.David Gross
- Must explicitly call new finish() API on model before compiling or freeing. - Must not modify a request once start() has been called on it. Bug: 63905942 Test: nn/runtime/tests, nn/common/operations tests Change-Id: Ifc6e614bda647d729e8702023a02613e629ca6a0
2017-09-10Add compilation APIs.David Gross
For now, compilation is implemented as a synchronous no-op. Bug: 63905942 Test: nn/runtime/tests, nn/common/operations tests Change-Id: I1cb96a7e800671d0c70c9cc1b7eab6f8244232cb
2017-09-09Explicitly add "_2D" to applicable ops, and add fused activationMiao Wang
function enum. - Add the fused activation enum to explicitly set the expectation that only the included ones are supported for fused ops. - Add "_2D" to CONV, DEPTHWISE_CONV, AVG_POOL, MAX_POOL, and L2_POOL, since they are only supposed to do 2D computation. - Updated the tests and the stack to plumbing the changes through. Bug: 63905942 Test: mm Test: NeuralNetworksTests pass for both CPU path and sample hidl driver. Change-Id: I60aeabab1d193d26d938c0d1d3ffdd519740d222
2017-09-01Making Add and Mul able to handle broadcast Add/Mul.Miao Wang
Bug: 63905942 Test: mm Test: BroadcastAddTwo, BroadcastMulTwo Change-Id: I41460be25ab812069fff31abfbd1f6ab66b7aba2
2017-08-29Add full support for Memory pools.Jean-Luc Brouillet
Weights can now be passed via memory pools. Test: Compiled and ran the unit test. Bug: 63905942 Change-Id: I997a10f6102dcae7c6876c96a4f6f913eaf54c74
2017-08-25Fix test that broke when number of ADD inputs increased from 2 to 3.David Gross
Test: adb shell NeuralNetworksTest_static Bug: 63905942 Change-Id: I51ae1cbc8850a66035185de4e8a40f95b03b1d38
2017-07-14First implementation of the Neural Networks API.Jean-Luc Brouillet
This first version can run a simple query on the CPU either via the fallback path or through a simulated driver. This code has many deficiencies: single threaded, not all validation are done, not going through HIDL, and not enough unit tests. Expect more changes! Test: Compiled and ran the unit tests Change-Id: I9f6a485a2e7207aeb5f91a2904dcb4b7fd8a6f65