History log of /frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
aec086a4a628f1f186323f7db8f4574515d74f24 03-May-2018 Michael Butler <butlermichael@google.com> Free wrapper resource before assignment

Any resources owned by "this" (lefthand side of assignment) are never
released (as the destructor would do), but are overwritten by the
move-assignment process and are therefore leaked.

This CL frees the resource before assignment. Additionally, it adds
missing ownership documentation for Compilation.

Bug: 79205067
Test: mma
Test: NeuralNetworksTest_static
Change-Id: Iacd561adee5205cb039fc7dea4fd1a816ca8d641
/frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h
247996038e3595d638dad6a54aeae69a634d8727 22-Mar-2018 Michael Butler <butlermichael@google.com> Explicitly set dimension to be nullptr when empty vector

An empty std::vector is allowed to have any value for the
std::vector::data (pointer) field. When a std::vector is
transferred into ANeuralNetworksOperandType::dimensionCount
and ANeuralNetworksOperandType::dimensions,
ANeuralNetworksOperandType::dimensions must be explicit set
to nullptr if the std::vector is empty.

This CL additionally has come code cleanup, such as removing the
now-unused setFromIntList utility function.

Bug: 76122637
Test: mma
Test: NeuralNetworksTest
Change-Id: I097464df78ee037fd87bc8a970f696d5d3bb6e3e
/frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h
b74d2837ab1687c1a4f913aa5f90a9838efe0add 21-Feb-2018 Miao Wang <miaowang@google.com> Add relaxed execution tests

- Extend the test generator and test wrapper to allow relaxed
execution.
- Make the accpeted error range to be 5 ULP of FP16.
- Copy and modify existing V1_0 tests to be V1_1 relaxed tests.

Bug: 63911257
Test: mm
Test: Relaxed tests pass on devices with FP16 support
Change-Id: I8954aeeebcf7312d7d94580992708f1b42e2b32e
/frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h
a7e5f8d601737eebef06b7b4e3866975cc4645df 22-Nov-2017 David Gross <dgross@google.com> Improve error handling for Model::finish().

- finish() fails if Model is in invalid state.
- If finish() fails put Model in invalid state.

Test: nn/runtime/test

Change-Id: I9bf16a332505136d67d371ba5d55f56b7c3cce53
/frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h
46ada93580e5036924e969b56799e2c62bdb8699 01-Nov-2017 David Gross <dgross@google.com> Add missing Result values to NeuralNetworksWrapper.h.

Bug: 68728827

Test: nn/runtime/test
Change-Id: I00b4a09b5d0dcf3d1d6776fb4b57c9003820f16f
/frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h
66d5cb6e3a90aefc8d545f6369080ab88de9d667 05-Oct-2017 Jean-Luc Brouillet <jeanluc@google.com> Rename setInputsAndOutputs

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
/frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h
e3178825b8686f3300a895572691a2e8c1f0676b 05-Oct-2017 David Gross <dgross@google.com> Asynchronus partitioned execution, plus minor code cleanup.

Partioned execution is now asynchronous end-to-end, although
the individual execution steps are serialized with respect to
one another.

Other changes:
- Minor code cleanup per comments from previous CL
https://googleplex-android-review.git.corp.google.com/#/c/platform/frameworks/ml/+/3000624/
including comments on memory management for
inter-partition temporaries.
- Remove "simulation" form of partitioning, and renumber
values of debug.nn.partition property accordingly.
- Fix android:nn:wrapper::Event -- add missing contructor
and fix comment.

Bug: 63905942
Test: mma (user)
mma (userdebug)
ml/nn/runtime/tests (userdebug)
(and spot check that debug.nn.partition unspecified,
0, and 1 exhibits the correct control over
partitioning behavior)

Change-Id: I5767d2144c4a42258444a6445866529919d4fe8d
/frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h
45bf79e5b9fee354fde7c1f64417d9ca4a1da7da 25-Sep-2017 Miao Wang <miaowang@google.com> Clarify the expectation of scale and zeroPoint for affected ops.

- Remove the OperandType constructor taking f_min and f_max as
quantization parameters as it causes confusions for ops like
LOGISTIC and SOFTMAX.
- Update the documenation to clearly state the expected scale and
zeroPoint for LOGISTIC, SOFTMAX and CONCATENATION.
- Update the tests to directly input scale and zeroPoint.

Bug: 63905942
Test: mm
Test: NeuralNetworksTest pass
Change-Id: Ia450d6ce9509205d22e6383bd7e454afa0568cbb
/frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h
39dcb0f2cc87b0eba06b314a91d55e50efea5abe 14-Sep-2017 David Gross <dgross@google.com> Merge changes I5922f13a,I7194e277 into oc-mr1-dev

* changes:
Bring back Event, and wait on Event rather than on Execution.
Make Compilation API synchronous.
425b2594c76e934dfdbc93209253e3c189571149 14-Sep-2017 David Gross <dgross@google.com> Bring back Event, and wait on Event rather than on Execution.

This is at the recommendation of the API council.

This undoes change I50b8e155d9589210e14920237878a4f295e7755f

Bug: 63905942
Test: nn/runtime/test

Change-Id: I5922f13ae7070f7ec0af035557a9921c88ca9221
/frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h
65aa556323f4a054f80a75b6c4c721b2a7ed3298 14-Sep-2017 David Gross <dgross@google.com> Make Compilation API synchronous.

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
/frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h
a5c16e4e73a34e6776a8f071ab884444c28b6893 14-Sep-2017 Miao Wang <miaowang@google.com> Rename ANeuralNetworksOperandType.offset to zeroPoint

Bug: 63905942
Test: NeuralNetworksTest
Change-Id: I15464657dc4eed9adbfc444df306cd0062993be3
/frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h
7612f29b31f97f3b15769264131566b36dea9a25 12-Sep-2017 Jean-Luc Brouillet <jeanluc@google.com> Remove the initialization and shutdown APIs.

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
/frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h
d2d0c031c43e8e5aafc75e8a652d79bcc2aaca99 12-Sep-2017 Jean-Luc Brouillet <jeanluc@google.com> Update documentation. Remove IntList.

As NDK council request, updated some documentation and removed
IntList. Other issues will be addressed in other CLs.

Bug: 63905942
Test: Compiled and ran the unit tests.

Change-Id: Iff6898737696daa6bbf41643b07d0a4508af4c0d
/frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h
66d56404cdfab9ab8aa79d4bda83be3832a3aff9 14-Sep-2017 Miao Wang <miaowang@google.com> Make the enums pass as int32_t, and make offset and length size_t.

- Also removes fp16 perf and bootup time info.

Bug: 63905942
Test: NeuralNetworksTest
Change-Id: I1f722fed06a4227eb5f204eb51f7728fe749f5ec
/frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h
01df5047f2661fd8428d5fc966bc3b7984ec1857 14-Sep-2017 David Gross <dgross@google.com> Merge "Rename Request to Execution at the API level." into oc-mr1-dev
5e7827e7bdc7ee6b6fc9b1989070c98fa10e9797 13-Sep-2017 David Gross <dgross@google.com> Move OEM codes out of NeuralNetworks.h to new file NeuralNetworksOEM.h.

Also remove FAKE_QUANT operation.

Bug: 63905942
Test: nn/runtime/tests, vts

Change-Id: Ia9262ec727f93dfe1b0ccade4ed76347c55ba163
/frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h
3ced3cfd5b8f22b632c35f24e585c4847383b195 13-Sep-2017 David Gross <dgross@google.com> Rename Request to Execution at the API level.

There's a separate notion of Request at the HIDL level;
this is not renamed.

Bug: 63905942
Test: nn/runtime/tests

Change-Id: I671e3b387d735a9091dc5a2d14afbea6b45f444c
/frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h
05292dc440641a38fab6a07c1372ce6780816c1c 13-Sep-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Update ANeuralNetworksMemory related API" into oc-mr1-dev
5f916fc9a7ae95f172492bdfe5344c37beff3a6f 12-Sep-2017 Michael Butler <butlermichael@google.com> Neuralnetworks HAL cleanup -- frameworks/ml/nn

Does three primary cleanups:
1) Removes unused OperandTypes, creates OEM types
2) Creates explicit ErrorStatus; functions return status
3) IDevice::initialize renamed to getCapabilities,
IDevice::getSupportedSubgraph renamed to getSupportedOperations

It makes the corresponding changes to the runtime.

Bug: 63905942
Test: mm, frameworks/ml/nn/runtime/test
Change-Id: I1545373dfa30780aaf9b61b3938be536cf122e74
/frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h
42dc6a6cd68877cd85e3bc475b41bda0fd946c41 13-Sep-2017 Miao Wang <miaowang@google.com> Update ANeuralNetworksMemory related API

- Remove ANeuralNetworksMemory_createShared.
- Remove ANeuralNetworksMemory_getPointer.
- Allow a offset specified for
ANeuralNetworksMemory_createFromFd.
- Update the tests.

Bug: 63905942
Test: mm
Test: updated NeuralNetworksTests pass.
Change-Id: I1fd7362ec379f5f855c71c6758e0b647be9aaa76
/frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h
4ffc65b9cb9c9d04c694f0948117554526a46b17 12-Sep-2017 David Gross <dgross@google.com> Remove Event and wait on Request instead.

Bug: 63905942
Test: nn/runtime/tests
Change-Id: I50b8e155d9589210e14920237878a4f295e7755f
/frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h
18c58d289c2346d750301392866229630960b392 12-Sep-2017 David Gross <dgross@google.com> Merge "Fix bug in the way an Event handles a bound thread." into oc-mr1-dev
402baa3fde7795bcea6e2ebeffab97c70b228dd4 12-Sep-2017 David Gross <dgross@google.com> Fix bug in the way an Event handles a bound thread.

Previously, we were calling std::thread::join() from the
Event destructor. However, if the Event's reference count
drops to zero due to action in the bound thread, then the
bound thread calls the Event's destructor, and tries to
join itself; this throws an exception, and produces a
message like

terminating with uncaught exception of type std::__1::system_error:
thread::join failed: Resource deadlock would occur

However, we do not seem to have had any test cases that actully
call ANeuralNetworksEvent_free(), so every Event would leak, and
we never hit this problem.

Now also change Request::compute() to stop leaking its event -- doing
this without changing bound thread handling would produce the exception
shown above.

Bug: 63905942
Test: nn/runtime/tests
Change-Id: I0d9370d187c10be00a4a69db8eb5f79854c9be12
/frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h
544739620cd7f37d40524d2407c92042e485c73f 11-Sep-2017 David Gross <dgross@google.com> More discipline for models and requests.

- 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
/frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h
83e24dc4706a5b7089881a55daf05b3924fab3b7 10-Sep-2017 David Gross <dgross@google.com> Add compilation APIs.

For now, compilation is implemented as a synchronous no-op.

Bug: 63905942
Test: nn/runtime/tests, nn/common/operations tests

Change-Id: I1cb96a7e800671d0c70c9cc1b7eab6f8244232cb
/frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h
0afe5897f4034528b027294efbe45c836924643c 09-Sep-2017 Michael Butler <butlermichael@google.com> Merge "Disallow copy semantics for NeuralNetworkWrapper objects." into oc-mr1-dev
105807d963d969197fe78185ed588bfad3dc0ea5 05-Sep-2017 Miao Wang <miaowang@google.com> Add support for mmaped file descriptor

- create new API to create ANeuralNetworks_Memory from a mmaped fd.
- add the corresponding Memory constructor to NeuralNetworksWrapper.h
- Add unit test TestFd for the new API.

Bug: 63905942
Test: mm
Test: TestFd pass with CPU path.
Test: TestFd pass on sample HIDL driver, with ag/2588539

Change-Id: I1fcb0f0bd01e58bd592e18eff11c27034ee4a4c3
/frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h
7b87fec6bb919d16a8cc2820d470733a2776e8fa 07-Sep-2017 Michael Butler <butlermichael@google.com> Disallow copy semantics for NeuralNetworkWrapper objects.

Before this CL, the NeuralNetworks runtime would double-free a
NeuralNetworks runtime object if its corresponding wrapper object was
copied as in the following scenario:

{
Model base_model = Model(...); // ANeuralNetworksModel_create x1
Model copied_model = base_model; // Copies runtime object's pointer
} // ANeuralNetworksModel_free x2, double-free

This CL removes copy semantics on Wrapper objects. Additionally, it
explicitly handles move semantics to ensure the runtime object is only
freed once.

Bug: 63905942
Test: mm -j40
Change-Id: Ibd0e8e67eb851a97c18482683c8a37edd665b162
/frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h
2150f1d186b2854fb5aa609594be12a667f845f0 01-Sep-2017 Jean-Luc Brouillet <jeanluc@google.com> Improvements to the Memory code.

Addresses the comments of a previous CL that arrived after
submission. Change_Id of that CL was I997a10f6102dcae7c6876c96a4f6f913eaf54c74.

- Improved documentation.
- getPointer is now getPointerAndSize. It returns a status code, as
not all Memory will be able to return a pointer.

Test: Compiled and ran the unit test.
Bug: 63905942
Change-Id: I8aade863212dd7e95856d7c3d583c1b5f00eda48
/frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h
910c9f04913e3bee1a0b6406b6e146457d19c5e7 31-Aug-2017 Miao Wang <miaowang@google.com> Fix the OperandType constructor in NN wrapper.

- Use constructor delegation in OperandType constructors for the
quantized variants.

Bug: 63905942
Test: mm
Test: Created a quantized AVERAGE_POOL tests, and it pass
Change-Id: I1c0a4c26fc056873ff837ba2f60ec85923985fe2
/frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h
b8810af67d4efbd966d6788c56cd01c5aa06a71e 30-Aug-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add full support for Memory pools." into oc-mr1-dev
8b99bb1d98a42b67ba1c00e12c7abb3708cf7c05 21-Aug-2017 Jean-Luc Brouillet <jeanluc@google.com> Add full support for Memory pools.

Weights can now be passed via memory pools.

Test: Compiled and ran the unit test.
Bug: 63905942
Change-Id: I997a10f6102dcae7c6876c96a4f6f913eaf54c74
/frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h
ca0ae89800ff957f76345c94eeb06d8c5643974b 29-Aug-2017 Jean-Luc Brouillet <jeanluc@google.com> Remove baseline models

Also remove submodels, which were to be used with baseline models.

Bug: 63905942
Test: Compiled and ran the tests on Marlin.
Change-Id: I54495e4e0dfbd6dabf049c8bdc2997600451b047
/frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h
27e9be3904b034e422ee9b6ab70b35ea994d2b39 03-Aug-2017 Miao Wang <miaowang@google.com> Initial implementation of the following quantized ops.

- CONV_QUANT8
- DEPTHWISE_CONV_QUANT8
- AVERAGE_POOL_QUANT8
- MAX_POOL_QUANT8
- LOGISTIC_QUANT8

Additionally, added functions to plumb through quantization
parameters.

Bug: 63905942
Test: mm
Test: end-to-end MobileNet quantized test pass

Change-Id: Ib2753c68bf2c51467ae1c158b45541bcfdf10789
/frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h
707dbd2d55f5dacf78ffb3ad7c8b3f37c2e9d758 25-Jul-2017 Jean-Luc Brouillet <jeanluc@google.com> Pass the model as an HIDL component.

Major rework where instead of serializing the model and
passing it in a shared memory, we pass it via HIDL.

The runtime/test code does two run, one goes through the
default CPU path, the other through any available driver.

Note: The code in hardware/../sample was written by Michael Buttler.

Bug: 63905942
Test: Runs both the CPU path and through the sample driver.
Change-Id: Ie3ee975d33056ba299895b13193f4698a690dd04
/frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h
96775128e3bcfdc5be51b62edc50309c83861fe8 12-Jul-2017 Jean-Luc Brouillet <jeanluc@google.com> First implementation of the Neural Networks API.

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
/frameworks/ml/nn/runtime/include/NeuralNetworksWrapper.h