Commit graph

394 commits

Author SHA1 Message Date
Lev Proleev
fdf3c0363a Fix operations docs
* Add missing float16-related docs
* Fix weights' shapes in QUANTIZED_16BIT_LSTM

Bug: 126872052
Bug: 126870779
Test: mma
Change-Id: Iba0b208b101db676b03b04e03e43c7378877843c
2019-03-05 11:07:39 +00:00
Steven Moreland
7f4e21adda Merge "Update makefies: no 'types'" am: 4ee5ec1469 am: bab622f6a6
am: 7224bc9bcf

Change-Id: I434939e0770afa436c532a945542fce30a71ef7d
2019-03-04 16:05:59 -08:00
Steven Moreland
a878aee9ab Update makefies: no 'types'
Bug: 123976090
Test: N/A
Change-Id: I30fb04c81889b62775e1b764b965fdb0f893de17
2019-03-04 11:27:17 -08:00
Lev Proleev
603244cb70 Adds TENSOR_QUANT8_SYMM support to test infrastructure
This is needed to be able to test DEQUANTIZE after adding
TENSOR_QUANT8_SYMM support.

Test: NeuralNetworksTest_static
Test: VtsHalNeuralnetworksV1_2TargetTest
Change-Id: Iba9b286df70919d7b67cd77c91e625a044bd686c
Merged-In: Iba9b286df70919d7b67cd77c91e625a044bd686c
(cherry picked from commit bf26a9e3d7)
2019-02-21 14:11:34 +00:00
Michael Butler
80ad3f8449 Merge "Add presubmit tests to NNAPI -- hardware/interfaces/neuralnetworks" 2019-02-20 18:23:40 +00:00
TreeHugger Robot
504b7a968d Merge "Adds TENSOR_QUANT8_SYMM support to test infrastructure" 2019-02-20 16:04:18 +00:00
Lev Proleev
bf26a9e3d7 Adds TENSOR_QUANT8_SYMM support to test infrastructure
This is needed to be able to test DEQUANTIZE after adding
TENSOR_QUANT8_SYMM support.

Test: NeuralNetworksTest_static
Test: VtsHalNeuralnetworksV1_2TargetTest
Change-Id: Iba9b286df70919d7b67cd77c91e625a044bd686c
2019-02-20 12:49:14 +00:00
Michael Butler
58caa831bd Add presubmit tests to NNAPI -- hardware/interfaces/neuralnetworks
This CL creates a new suite of tests to enable presubmit tests:
* PresubmitHalNeuralnetworksV1_0TargetTest
* PresubmitHalNeuralnetworksV1_1TargetTest
* PresubmitHalNeuralnetworksV1_2TargetTest

These tests are the same as the VTS tests, with the exception that they
will skip running all tests (but still pass) if the service cannot be
found and its name starts with "service-".

This change does not affect the existing NNAPI VTS tests.

Test: mma
Test: atest
Bug: 124040554
Change-Id: I36a38b66b21fd51d0ca381bb4e05a39266dd353f
(cherry picked from commit ed68233697)
2019-02-19 12:04:24 -08:00
Michael Butler
669fe0b1f9 Merge "Add presubmit tests to NNAPI -- hardware/interfaces/neuralnetworks" 2019-02-19 17:32:56 +00:00
Lev Proleev
fd1134a6f3 Update TRANSPOSE_CONV_2D docs
* Add info about per-channel quantization
* Update current.txt

Test: mma
Change-Id: I197d984c8b65b4c46bf526eb137f212ad8844926
Merged-In: I197d984c8b65b4c46bf526eb137f212ad8844926
(cherry picked from commit 44015c090a)
2019-02-18 09:00:19 +00:00
Michael Butler
857142085f Pretty-print ErrorStatus and DeviceStatus test failure logs
Argument-dependent lookup will only work for operator>> if the operator
is in one of the argument's namespaces. This caused the enumerations to
pretty-print for V1_0, but not for V1_1 or V1_2. This change ensures the
V1_0 namespace is used.

Test: mma
Test: atest VtsHalNeuralnetworksV1_0TargetTest (verified the test output "OFFLINE" for DeviceStatus and "DEVICE_UNAVAILABLE" for ErrorStatus instead of raw byte value representation)
Test: atest VtsHalNeuralnetworksV1_1TargetTest (verified the test output "OFFLINE" for DeviceStatus and "DEVICE_UNAVAILABLE" for ErrorStatus instead of raw byte value representation)
Test: atest VtsHalNeuralnetworksV1_2TargetTest (verified ran and passed tests)
Fixes: 124316129
Change-Id: I764a46e2d87615b1f3da0ab0e6edb134bb533887
(cherry picked from commit 42a35bee10)
2019-02-15 13:34:50 -08:00
Michael Butler
ed68233697 Add presubmit tests to NNAPI -- hardware/interfaces/neuralnetworks
This CL creates a new suite of tests to enable presubmit tests:
* PresubmitHalNeuralnetworksV1_0TargetTest
* PresubmitHalNeuralnetworksV1_1TargetTest
* PresubmitHalNeuralnetworksV1_2TargetTest

These tests are the same as the VTS tests, with the exception that they
will skip running all tests (but still pass) if the service cannot be
found and its name starts with "service-".

This change does not affect the existing NNAPI VTS tests.

Test: mma
Test: atest
Bug: 124040554
Change-Id: I36a38b66b21fd51d0ca381bb4e05a39266dd353f
2019-02-15 11:47:00 -08:00
Lev Proleev
44015c090a Update TRANSPOSE_CONV_2D docs
* Add info about per-channel quantization
* Update current.txt

Test: mma
Change-Id: I197d984c8b65b4c46bf526eb137f212ad8844926
2019-02-15 16:01:49 +00:00
Xusong Wang
3ee1f4a333 Modify several 1.2 nn operation specs.
- Add TENSOR_QUANT8_ASYMM to RESIZE_BILINEAR
- Change the spec of batch_split in
  * GENERATE_PROPOSALS
  * ROI_ALIGN
  * ROI_POOLING
  * AXIS_ALIGNED_BBOX_TRANSFORM
  * BOX_WITH_NMS_LIMIT
- Add new op RESIZE_NEAREST_NEIGHBOR
- Fix minor specification error in
  * AXIS_ALIGNED_BBOX_TRANSFORM
  * GENERATE_PROPOSALS

Bug: 124060811
Bug: 124061329
Bug: 124061327
Test: 1.2 VTS tests with sample driver
Change-Id: If8b8cabd249f17247d8a5278b8360685c97c68e6
Merged-In: If8b8cabd249f17247d8a5278b8360685c97c68e6
(cherry picked from commit b9319bd3bf)
2019-02-14 18:13:35 -08:00
Michael Butler
9e3f898921 Merge "Pretty-print ErrorStatus and DeviceStatus test failure logs" 2019-02-14 20:49:00 +00:00
Michael Butler
42a35bee10 Pretty-print ErrorStatus and DeviceStatus test failure logs
Argument-dependent lookup will only work for operator>> if the operator
is in one of the argument's namespaces. This caused the enumerations to
pretty-print for V1_0, but not for V1_1 or V1_2. This change ensures the
V1_0 namespace is used.

Test: mma
Test: atest VtsHalNeuralnetworksV1_0TargetTest (verified the test output "OFFLINE" for DeviceStatus and "DEVICE_UNAVAILABLE" for ErrorStatus instead of raw byte value representation)
Test: atest VtsHalNeuralnetworksV1_1TargetTest (verified the test output "OFFLINE" for DeviceStatus and "DEVICE_UNAVAILABLE" for ErrorStatus instead of raw byte value representation)
Test: atest VtsHalNeuralnetworksV1_2TargetTest (verified ran and passed tests)
Fixes: 124316129
Change-Id: I764a46e2d87615b1f3da0ab0e6edb134bb533887
2019-02-14 20:48:40 +00:00
Xusong Wang
6824cc1e64 Remove tmp directory after CompilationCachingTest if cache not supported.
The tmp directory is only removed when the driver reports caching not
supported, otherwise it is kept for debugging purpose.

Test: 1.2 VTS tests with sample driver
Change-Id: I5969beb1ec365c992765f40d7693630606f16e18
Merged-In: I5969beb1ec365c992765f40d7693630606f16e18
(cherry picked from commit 350d91b1df)
2019-02-14 10:16:41 -08:00
Hervé Guihot
ac7ac525b2 Added missing ASSERT_NE.
Test was failing with segmentation fault (and crashing whole VTS) when
device was not available.

Change-Id: Id0f28d061dc5858fa00ef1bac5f7aa467d860864
Merged-In: Id0f28d061dc5858fa00ef1bac5f7aa467d860864
(cherry picked from commit 70d25b813e)
2019-02-14 10:15:27 -08:00
Xusong Wang
e50086a29d Merge "Remove tmp directory after CompilationCachingTest if cache not supported." 2019-02-14 18:10:18 +00:00
Miao Wang
6e06a5ce41 Fix the usage of GTEST_SKIP
Test: mm
Test: VtsHalNeuralnetworksV1_0TargetTest
Change-Id: I6baaf54c626778129c1aab4f6622af570b34ec3f
Merged-In: I6baaf54c626778129c1aab4f6622af570b34ec3f
(cherry picked from commit 4135a8e94c)
2019-02-13 14:21:22 -08:00
Xusong Wang
b9319bd3bf Modify several 1.2 nn operation specs.
- Add TENSOR_QUANT8_ASYMM to RESIZE_BILINEAR
- Change the spec of batch_split in
  * GENERATE_PROPOSALS
  * ROI_ALIGN
  * ROI_POOLING
  * AXIS_ALIGNED_BBOX_TRANSFORM
  * BOX_WITH_NMS_LIMIT
- Add new op RESIZE_NEAREST_NEIGHBOR
- Fix minor specification error in
  * AXIS_ALIGNED_BBOX_TRANSFORM
  * GENERATE_PROPOSALS

Bug: 124060811
Bug: 124061329
Bug: 124061327
Test: 1.2 VTS tests with sample driver
Change-Id: If8b8cabd249f17247d8a5278b8360685c97c68e6
2019-02-13 13:09:38 -08:00
Xusong Wang
350d91b1df Remove tmp directory after CompilationCachingTest if cache not supported.
The tmp directory is only removed when the driver reports caching not
supported, otherwise it is kept for debugging purpose.

Test: 1.2 VTS tests with sample driver
Change-Id: I5969beb1ec365c992765f40d7693630606f16e18
2019-02-13 11:53:19 -08:00
Lev Proleev
dce38f1364 Fix VTS tests.
* Adds a specification of invalid scale and zero point for TENSOR_BOOL8.
This fixes vts failures for comparison ops.
* Removes (FUNDAMENTAL_MIN - 1) from invalid OperationTypes.
FUNDAMENTAL_MIN is equal to 0 and resulting -1 was statically casted to
uint32_t and passed 4294967295 as an invalid OperationType. However, our
validateOperation function interpreted this ID as an extension ID and
didn't fail.
* Adds mutateOperationOperandTypeSkip for QUANTIZE and DEQUANTIZE.
* Adds removeOperandSkip for BIDIRECTIONAL_SEQUENCE_RNN.

Fix: 121130841
Fix: 123247345
Test: VtsHalNeuralnetworksV1_2TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.2::IDevice/sample-all
Change-Id: Iefb502c6b9301d5470eb4cdaa46d398f1a0e512a
Merged-In: Iefb502c6b9301d5470eb4cdaa46d398f1a0e512a
(cherry picked from commit 923b8c5842)
2019-02-13 13:16:28 +00:00
Steven Moreland
e694cb2dad neuralnetworks: Update makefiles.
Bug: N/A
Test: N/A
Change-Id: I83a920c646cf03dcc161a6fbc928a6dc09b2d7f1
Merged-In: I5fb6c126a090a3fe0fa4829ea9224564133dc1ae
2019-02-12 17:10:15 -08:00
Hervé Guihot
70d25b813e Added missing ASSERT_NE.
Test was failing with segmentation fault (and crashing whole VTS) when
device was not available.

Change-Id: Id0f28d061dc5858fa00ef1bac5f7aa467d860864
2019-02-12 16:22:44 -08:00
Lev Proleev
2756283e30 Sync docs between NeuralNetworks.h and HAL file
Test: VtsHalNeuralnetworksV1_2TargetTest
Bug: 116445845
Fixes: 124246635
(cherry picked from commit 5d2ec0f5f0)
Merged-In: I4287a947faa260f69ba50c746bd40a0981548e50
Change-Id: I4287a947faa260f69ba50c746bd40a0981548e50
2019-02-12 13:49:56 -08:00
Slava Shklyaev
7081726008 Deprecate OEM types in NNAPI
Fix: 119856868
Test: N/A
Change-Id: I12e0c98324c1310815e150d24e0b25e26073a424
Merged-In: I12e0c98324c1310815e150d24e0b25e26073a424
(cherry picked from commit 341f6b335d)
2019-02-12 10:23:16 +00:00
Slava Shklyaev
e94dc72150 Update NNAPI Extensions documentation
This is a follow-up to change Ia9b99015eec7a48bbf969cbe503862271f09adca

Bug: 118605927
Test: mma
Change-Id: I7ddafca04bce6fd37a9c0877270cee325111d833
Merged-In: I7ddafca04bce6fd37a9c0877270cee325111d833
(cherry picked from commit 1ffe69a8e9)
2019-02-12 10:09:51 +00:00
Steven Moreland
f8a47b7f01 Update makefiles.
Bug: 123976090
Test: N/A
Change-Id: I5fb6c126a090a3fe0fa4829ea9224564133dc1ae
2019-02-11 21:14:16 -08:00
Hervé Guihot
86a9fa0900 Added TENSOR_QUANT8_SYMM type.
Test: none
Change-Id: I02fc8698b3f80e1ae2a318e5cde593c6d7222bac
Merged-In: I02fc8698b3f80e1ae2a318e5cde593c6d7222bac
(cherry picked from commit bae91697b5)
2019-02-08 10:35:43 -08:00
Xusong Wang
cf6a9111cc Add new OperandType TENSOR_QUANT16_ASYMM.
Test: NeuralNetworksTest_static
Test: VtsHalNeuralnetworksV1_2TargetTest
Change-Id: I8fcd6b30c32f8fbc181d2b43f9ac0b94fdc57e2f
Merged-In: I8fcd6b30c32f8fbc181d2b43f9ac0b94fdc57e2f
(cherry picked from commit d49f665c42)
2019-02-08 10:17:17 -08:00
Xusong Wang
96e68dc8e0 Add VTS tests for NNAPI compilation caching.
Add the following tests for compilation caching:
- validation tests
  - Test isCachingSupported
  - Test prepareModelFromCache with invalid numFd and invalid access mode
  - Test saveToCache with invalid numFd, invalid access mode,
    invalid file size, and invalid fd offset
- execution test
  - Save a mobilenet model to cache and then retrieve and run accuracy
    evaluation.
  - The same test but the file offsets for prepareModelFromCache is not at zero.
- security test
  - CompilationCachingSecurityTest.CorruptedSecuritySensitiveCache
    Randomly flip one bit of security-sensitive cache.
  - CompilationCachingSecurityTest.WrongLengthSecuritySensitiveCache
    Randomly append bytes to security-sensitive cache.
  - CompilationCachingSecurityTest.WrongToken
    Randomly flip one bit of cache token.

Bug: 119616526
Test: VtsHalNeuralnetworksV1_xTargetTest with 1.2 sample driver
Test: VtsHalNeuralnetworksV1_xTargetTest with a test driver that can
      read and write cache entries
Change-Id: Iae9211cb28ce972b29572dfedd45d1ade4dfdaf5
Merged-In: Iae9211cb28ce972b29572dfedd45d1ade4dfdaf5
(cherry picked from commit 3405878e5e)
2019-02-08 10:17:17 -08:00
Slava Shklyaev
c9ff099c01 Add getSupportedExtensions to NNAPI IDevice
Bug: 118603011
Test: mma
Change-Id: I5bd1cf2dfd8c4700819d52a87931df2959ef6929
Merged-In: I5bd1cf2dfd8c4700819d52a87931df2959ef6929
(cherry picked from commit 6148d0f446)
2019-02-08 10:17:17 -08:00
Slava Shklyaev
bbcdc42abb Define NNAPI Extensions types
Machine Learning is a fast moving domain: new operations and data types
are introduced at a staggering speed. The Android API, on the other
hand, evolves on a yearly cycle. Many application developers, OEMs, and
SoC vendors would like to be able to define new operations at a faster
cycle.

In OC-MR1, NNAPI provided a simple mechanism to mitigate this problem:
two OEM data types and an OEM operation. The downside of this mechanism is that
it is simplistic: There’s no guarantee of consistency between vendors.

Examples of features that are required by the first parties' use cases
that we would like to be able to define outside of the normal Android
release cycle:
- New data types:
  - Sparse tensor (used by some speech generation models).
  - 16 bit int tensor (needed by OCR).
  - 16 bit float tensor.
- New operations:
  - 16 bit quantized LSTM (needed by OCR).
  - Basic primitives like sqrt and floor.
  - Logical operations.
  - Complex neural network layers.
  - Control flow.
- Enhancement to existing operations:
  - Concatenate supporting different scales/zeroPoints for arguments.
  - High-dimensional tensors.
  - Ordering of dimensions.

We are going to provide support for two types of extensions:
- NNAPI Platform extension. This is functionality that will become part of
  future releases of NNAPI. These extensions provide generic,
  non-vendor-specific functionality. Only the Android team can define new
  platform extensions. These extensions will be defined in the master
  branch of AOSP. Each extension comes with:
  - Documentation defining the extension,
  - A header file for the new constants,
  - A parameter validation library to be used by drivers, and
  - Validation tests akin to the CTS and VTS tests.
- Vendor extension. A vendor-specific extension is an alternative to OEM
  operation and data types. Its usage will be limited only to first party apps
  preinstalled on the /vendor or /odm partition.
  Each vendor will be identified by a specific value to
  prevent collisions between multiple IPs found on the same SoC. This
  effectively creates a vendor-specific namespace. These identifiers are
  assigned by Google.

This change only defines the new interface. The implementation follows
in changes Ie4e2530e4c81fabe4eb59b7a6ba4a3b4bb483bd1,
I02aa12f4a8444012ddf3b20c2bfbba6a21ce9ce9, and
Icf59ed04e602aa7a730eb1eb45e5f6b1204fafb3.

Bug: 118605927
Test: mma
Change-Id: Ia9b99015eec7a48bbf969cbe503862271f09adca
Merged-In: Ia9b99015eec7a48bbf969cbe503862271f09adca
(cherry picked from commit 9212018558)
2019-02-08 10:17:17 -08:00
Steven Moreland
94755be332 Merge "Update makefiles." am: b35c23e70c am: b37145e08e
am: d78f1f0d8e

Change-Id: If698913e654c92897db703d865e900e49fe6231d
2019-02-06 12:06:14 -08:00
Lev Proleev
312f58e1a0 Merge "Sync docs between NeuralNetworks.h and HAL file" 2019-02-06 12:47:18 +00:00
Steven Moreland
941f105b60 Update makefiles.
Some of these are out of date.

Bug: N/A
Test: N/A
Change-Id: Ibf87fad9981d4e430a0bf797feadbb0bede232fc
2019-02-05 13:14:26 -08:00
Miao Wang
641f446a7a Merge "Fix the usage of GTEST_SKIP" 2019-02-04 22:07:18 +00:00
Miao Wang
4135a8e94c Fix the usage of GTEST_SKIP
Test: mm
Test: VtsHalNeuralnetworksV1_0TargetTest
Change-Id: I6baaf54c626778129c1aab4f6622af570b34ec3f
2019-02-01 14:02:08 -08:00
TreeHugger Robot
b7a562e4f3 Merge "Update NNAPI Extensions documentation" 2019-02-01 13:15:29 +00:00
Lev Proleev
5d2ec0f5f0 Sync docs between NeuralNetworks.h and HAL file
Test: VtsHalNeuralnetworksV1_2TargetTest
Fix: 116445845
Change-Id: I4287a947faa260f69ba50c746bd40a0981548e50
2019-01-31 22:23:06 +00:00
Lev Proleev
923b8c5842 Fix VTS tests.
* Adds a specification of invalid scale and zero point for TENSOR_BOOL8.
This fixes vts failures for comparison ops.
* Removes (FUNDAMENTAL_MIN - 1) from invalid OperationTypes.
FUNDAMENTAL_MIN is equal to 0 and resulting -1 was statically casted to
uint32_t and passed 4294967295 as an invalid OperationType. However, our
validateOperation function interpreted this ID as an extension ID and
didn't fail.
* Adds mutateOperationOperandTypeSkip for QUANTIZE and DEQUANTIZE.
* Adds removeOperandSkip for BIDIRECTIONAL_SEQUENCE_RNN.

Fix: 121130841
Fix: 123247345
Test: VtsHalNeuralnetworksV1_2TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.2::IDevice/sample-all
Change-Id: Iefb502c6b9301d5470eb4cdaa46d398f1a0e512a
2019-01-31 14:00:31 +00:00
Xusong Wang
4faf072e22 Add VTS test for dynamic output shape.
Test dynamic output shape with generated models when
- Dimensions of output operands are fully specified
- Dimensions of output operands are unspecified with sufficient buffer
- Dimensions of output operands are unspecified with insufficient buffer

Test: VTS on 1.2 sample driver
Change-Id: I4d26395ce443687ccbd47445b36e3356d70035cc
Merged-In: I4d26395ce443687ccbd47445b36e3356d70035cc
(cherry picked from commit 929fd21e06)
2019-01-30 11:18:24 -08:00
Slava Shklyaev
2739b2ef57 Shorten NNAPI enum range names
Test: mma
Change-Id: I5138589acc127336e8c0e72ca7d6b49532a4eeb9
Merged-In: I5138589acc127336e8c0e72ca7d6b49532a4eeb9
(cherry picked from commit 794703db84)
2019-01-30 10:49:49 -08:00
Miao Wang
d2668b5b9d Report "SKIPPED" for unsupported tests.
- Instead of reporting PASS for unsupported tests, use GTEST_SKIP to
  skip the tests at runtime.

Bug: 113356629
Test: mm
Test: VTS tests on HVX driver
Change-Id: I6a870b61809e58490e66dd4ea36ddeb64fc68a07
Merged-In: I6a870b61809e58490e66dd4ea36ddeb64fc68a07
(cherry picked from commit bb685a4a97)
2019-01-29 15:16:10 -08:00
Xusong Wang
fc67805f4a Implement NN HAL for compilation caching.
Add three methods
- IDevice::isCachingSupported
- IDevice::prepareModelFromCache
- IPreparedModel::saveToCache

Bug: 119616526
Test: NeuralNetworksTest_static
Test: VtsHalNeuralnetworksV1_xTargetTest with 1.2 sample driver
Change-Id: If28ffe0be48bcb9f4715293fc1201c8d2dbeb946
Merged-In: If28ffe0be48bcb9f4715293fc1201c8d2dbeb946
(cherry picked from commit 89dfafb42f)
2019-01-29 15:00:49 -08:00
TreeHugger Robot
9a42155ffb Merge "Added TENSOR_QUANT8_SYMM type." 2019-01-29 22:31:16 +00:00
Hervé Guihot
bae91697b5 Added TENSOR_QUANT8_SYMM type.
Test: none
Change-Id: I02fc8698b3f80e1ae2a318e5cde593c6d7222bac
2019-01-29 11:45:17 -08:00
Michael Butler
29471a8935 NNAPI Burst -- HAL VTS tests
FastMessageQueue is a Treble-compliant data structure that enables fast
communication between two processes. The FMQ object itself is an atomic
circular buffer that is optionally synchronized with a futex. However,
FMQ has no notion of ownership or lifetime across processes, so it must
be paired with higher-level constructs to manage the lifetime and
ownership.

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.
Specifically, it replaces IPreparedModel::executeSynchronously's call
from the client into the service with fmq_sync<FmqRequestDatum> (an FMQ
channel used to pass a serialized Request object) and it replaces
the return from the service into the client with
fmq_sync<FmqResultDatum> (an FMQ channel used to return serialized
result status and OutputShapes information).

Each channel is a unidirectional flow of information with exactly one
producer and exactly one consumer. The channels are created by the NN
runtime and passed to the service via
IPreparedModel::configureExecutionBurst.

This CL tests the Burst in both the execution path and validation path
in the Vendor Test Suite (VTS) in neuralnetworks/1.*/vts/functional/.

The VTS binary--VtsHalNeuralnetworksV1_2TargetTest--can be built and run
as any previous version could.

Bug: 119570067
Test: mma
Test: VtsHalNeuralnetworksV1_2TargetTest
Change-Id: I3a36484eff9565c2d028c07c099804a0289f294a
Merged-In: I3a36484eff9565c2d028c07c099804a0289f294a
(cherry picked from commit 814d8372f3)
2019-01-29 18:34:34 +00:00
Slava Shklyaev
1ffe69a8e9 Update NNAPI Extensions documentation
This is a follow-up to change Ia9b99015eec7a48bbf969cbe503862271f09adca

Bug: 118605927
Test: mma
Change-Id: I7ddafca04bce6fd37a9c0877270cee325111d833
2019-01-29 17:49:38 +00:00
Xusong Wang
3405878e5e Add VTS tests for NNAPI compilation caching.
Add the following tests for compilation caching:
- validation tests
  - Test isCachingSupported
  - Test prepareModelFromCache with invalid numFd and invalid access mode
  - Test saveToCache with invalid numFd, invalid access mode,
    invalid file size, and invalid fd offset
- execution test
  - Save a mobilenet model to cache and then retrieve and run accuracy
    evaluation.
  - The same test but the file offsets for prepareModelFromCache is not at zero.
- security test
  - CompilationCachingSecurityTest.CorruptedSecuritySensitiveCache
    Randomly flip one bit of security-sensitive cache.
  - CompilationCachingSecurityTest.WrongLengthSecuritySensitiveCache
    Randomly append bytes to security-sensitive cache.
  - CompilationCachingSecurityTest.WrongToken
    Randomly flip one bit of cache token.

Bug: 119616526
Test: VtsHalNeuralnetworksV1_xTargetTest with 1.2 sample driver
Test: VtsHalNeuralnetworksV1_xTargetTest with a test driver that can
      read and write cache entries
Change-Id: Iae9211cb28ce972b29572dfedd45d1ade4dfdaf5
2019-01-29 08:59:06 -08:00
Slava Shklyaev
38264cde55 Merge changes from topic "get-supported-extensions"
* changes:
  Add getSupportedExtensions to NNAPI IDevice
  Define NNAPI Extensions types
2019-01-29 15:26:33 +00:00
Xusong Wang
c76cf9c674 Merge "Add VTS test for dynamic output shape." 2019-01-29 07:52:17 +00:00
Slava Shklyaev
6148d0f446 Add getSupportedExtensions to NNAPI IDevice
Bug: 118603011
Test: mma
Change-Id: I5bd1cf2dfd8c4700819d52a87931df2959ef6929
2019-01-28 21:56:18 +00:00
Slava Shklyaev
9212018558 Define NNAPI Extensions types
Machine Learning is a fast moving domain: new operations and data types
are introduced at a staggering speed. The Android API, on the other
hand, evolves on a yearly cycle. Many application developers, OEMs, and
SoC vendors would like to be able to define new operations at a faster
cycle.

In OC-MR1, NNAPI provided a simple mechanism to mitigate this problem:
two OEM data types and an OEM operation. The downside of this mechanism is that
it is simplistic: There’s no guarantee of consistency between vendors.

Examples of features that are required by the first parties' use cases
that we would like to be able to define outside of the normal Android
release cycle:
- New data types:
  - Sparse tensor (used by some speech generation models).
  - 16 bit int tensor (needed by OCR).
  - 16 bit float tensor.
- New operations:
  - 16 bit quantized LSTM (needed by OCR).
  - Basic primitives like sqrt and floor.
  - Logical operations.
  - Complex neural network layers.
  - Control flow.
- Enhancement to existing operations:
  - Concatenate supporting different scales/zeroPoints for arguments.
  - High-dimensional tensors.
  - Ordering of dimensions.

We are going to provide support for two types of extensions:
- NNAPI Platform extension. This is functionality that will become part of
  future releases of NNAPI. These extensions provide generic,
  non-vendor-specific functionality. Only the Android team can define new
  platform extensions. These extensions will be defined in the master
  branch of AOSP. Each extension comes with:
  - Documentation defining the extension,
  - A header file for the new constants,
  - A parameter validation library to be used by drivers, and
  - Validation tests akin to the CTS and VTS tests.
- Vendor extension. A vendor-specific extension is an alternative to OEM
  operation and data types. Its usage will be limited only to first party apps
  preinstalled on the /vendor or /odm partition.
  Each vendor will be identified by a specific value to
  prevent collisions between multiple IPs found on the same SoC. This
  effectively creates a vendor-specific namespace. These identifiers are
  assigned by Google.

This change only defines the new interface. The implementation follows
in changes Ie4e2530e4c81fabe4eb59b7a6ba4a3b4bb483bd1,
I02aa12f4a8444012ddf3b20c2bfbba6a21ce9ce9, and
Icf59ed04e602aa7a730eb1eb45e5f6b1204fafb3.

Bug: 118605927
Test: mma
Change-Id: Ia9b99015eec7a48bbf969cbe503862271f09adca
2019-01-28 21:56:18 +00:00
Slava Shklyaev
794703db84 Shorten NNAPI enum range names
Test: mma
Change-Id: I5138589acc127336e8c0e72ca7d6b49532a4eeb9
2019-01-28 21:30:40 +00:00
Xusong Wang
929fd21e06 Add VTS test for dynamic output shape.
Test dynamic output shape with generated models when
- Dimensions of output operands are fully specified
- Dimensions of output operands are unspecified with sufficient buffer
- Dimensions of output operands are unspecified with insufficient buffer

Test: VTS on 1.2 sample driver
Change-Id: I4d26395ce443687ccbd47445b36e3356d70035cc
2019-01-28 11:24:15 -08:00
Miao Wang
4848f4c8de Merge "Report "SKIPPED" for unsupported tests." 2019-01-28 19:08:46 +00:00
Xusong Wang
14393d0e24 Merge "Implement NN HAL for compilation caching." 2019-01-26 16:59:51 +00:00
Michael Butler
814d8372f3 NNAPI Burst -- HAL VTS tests
FastMessageQueue is a Treble-compliant data structure that enables fast
communication between two processes. The FMQ object itself is an atomic
circular buffer that is optionally synchronized with a futex. However,
FMQ has no notion of ownership or lifetime across processes, so it must
be paired with higher-level constructs to manage the lifetime and
ownership.

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.
Specifically, it replaces IPreparedModel::executeSynchronously's call
from the client into the service with fmq_sync<FmqRequestDatum> (an FMQ
channel used to pass a serialized Request object) and it replaces
the return from the service into the client with
fmq_sync<FmqResultDatum> (an FMQ channel used to return serialized
result status and OutputShapes information).

Each channel is a unidirectional flow of information with exactly one
producer and exactly one consumer. The channels are created by the NN
runtime and passed to the service via
IPreparedModel::configureExecutionBurst.

This CL tests the Burst in both the execution path and validation path
in the Vendor Test Suite (VTS) in neuralnetworks/1.*/vts/functional/.

The VTS binary--VtsHalNeuralnetworksV1_2TargetTest--can be built and run
as any previous version could.

Bug: 119570067
Test: mma
Test: VtsHalNeuralnetworksV1_2TargetTest
Change-Id: I3a36484eff9565c2d028c07c099804a0289f294a
2019-01-25 14:28:51 -08:00
Xusong Wang
89dfafb42f Implement NN HAL for compilation caching.
Add three methods
- IDevice::isCachingSupported
- IDevice::prepareModelFromCache
- IPreparedModel::saveToCache

Bug: 119616526
Test: NeuralNetworksTest_static
Test: VtsHalNeuralnetworksV1_xTargetTest with 1.2 sample driver
Change-Id: If28ffe0be48bcb9f4715293fc1201c8d2dbeb946
2019-01-25 11:21:03 -08:00
Xusong Wang
d22c5232f3 Test dynamic output shape in GeneratedTests.
Enable VTS unit test for dynamic output shape deduction.

Only test dynamic output shape for V1_2::IDevice with V1_2::Model.

Bug: 73506513
Test: VtsHalNeuralnetworksV1_xTargetTest with 1.2 sample driver
Change-Id: I4134e1ec54a15554eb8533134897279651b57da3
Merged-In: I4134e1ec54a15554eb8533134897279651b57da3
(cherry picked from commit a316581b21)
2019-01-24 19:11:36 -08:00
David Gross
55a3d328b7 Update neuralnetworks HAL to allow collecting execution duration.
Test: VtsHalNeuralnetworksV1_0TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.0::IDevice/sample-all
Test: VtsHalNeuralnetworksV1_1TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.1::IDevice/sample-all
Test: VtsHalNeuralnetworksV1_2TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.2::IDevice/sample-all

Bug: 115390094

Change-Id: If67a5ffe39cfdd78498e01f26251734fdc8e66c7
Merged-In: If67a5ffe39cfdd78498e01f26251734fdc8e66c7
(cherry picked from commit e301349b05)
2019-01-24 16:07:03 -08:00
Xusong Wang
5d67a0bf05 Clean and reorder operation enums.
Four operation enums are removed:
- DETECTION_OUTPUT
- PRIOR_BOX
- SPARSE_TO_DENSE
- EMBEDDING_LOOKUP_SPARSE

Operation enums are reorder into alphabetic order.

Bug: 123253865
Bug: 122744669
Test: NeuralNetworksTest_static
Change-Id: Ie5d2bff6fac061bdca0a99e5b8c8ac05733fac4b
Merged-In: Ie5d2bff6fac061bdca0a99e5b8c8ac05733fac4b
(cherry picked from commit 28a33a9cb1)
2019-01-24 16:05:33 -08:00
Lev Proleev
2d98264026 mutateOperationOperandTypeSkip for new TRANSPOSE_CONV_2D variant
Bug: 119255406
Test: Vts NNAPI tests.
Change-Id: I63f7fc67cedcc2a9db8c359ff96be3c9403b9a20
Merged-In: I63f7fc67cedcc2a9db8c359ff96be3c9403b9a20
(cherry picked from commit 1509a2664c)
2019-01-24 16:05:08 -08:00
Xusong Wang
b50bc313d7 Add 1.2 NN HAL interface for dynamic output shape.
Let notify_1_2() notify output shapes.

Document unspecified dimensions and rank.

Bug: 73506513
Bug: 77234888
Test: NeuralNetworksTest_static
Test: VtsHalNeuralnetworksV1_xTargetTest with 1.2 sample driver
Change-Id: I01108913212d9f4aa47daf2f293ea19259925865
Merged-In: I01108913212d9f4aa47daf2f293ea19259925865
(cherry picked from commit 187c59715c)
2019-01-24 14:19:00 -08:00
Miao Wang
e586a23815 Update NNAPI VTS test makefile after adding AHardwareBuffer support
Test: mm
Test: VTS
Change-Id: Ib98c08ce5cbbcd46f66ade80af28569f9cb14449
Merged-In: Ib98c08ce5cbbcd46f66ade80af28569f9cb14449
(cherry picked from commit 276b55b900)
2019-01-24 14:04:39 -08:00
Michael Butler
a06e261af9 NNAPI Burst -- HAL interface
FastMessageQueue is a Treble-compliant data structure that enables fast
communication between two processes. The FMQ object itself is an atomic
circular buffer that is optionally synchronized with a futex. However,
FMQ has no notion of ownership or lifetime across processes, so it must
be paired with higher-level constructs to manage the lifetime and
ownership.

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.
Specifically, it replaces IPreparedModel::executeSynchronously's call
from the client into the service with fmq_sync<FmqRequestDatum> (an FMQ
channel used to pass a serialized Request object) and it replaces
the return from the service into the client with
fmq_sync<FmqResultDatum> (an FMQ channel used to return serialized
result status and OutputShapes information).

Each channel is a unidirectional flow of information with exactly one
producer and exactly one consumer. The channels are created by the NN
runtime and passed to the service via
IPreparedModel::configureExecutionBurst.

This CL defines the FmqRequestDatum and FmqResultDatum types in
types.hal. IBurstContext.hal defines IBurstContext, a HIDL object used
by the service to manage the resources of a Burst. IBurstCallback.hal
defines IBurstCallback, a HIDL callback object that can be used to
retrieve the handle to a resource the service has either not yet seen or
has evicted from its cache. Finally, IPreparedModel.hal is extended with
IPreparedModel::configureExecutionBurst to create the burst object.

Bug: 119570067
Test: mma
Change-Id: I333da70201531b1396efc714d096c277e8e1d47b
Merged-In: I333da70201531b1396efc714d096c277e8e1d47b
(cherry picked from commit 7e91e24fe1)
2019-01-24 14:04:35 -08:00
Lev Proleev
b35eb1eabc mutateOperationOperandTypeSkip for new GROUPED_CONV_2D variant
Bug: 119255406
Test: Vts NNAPI tests.
Change-Id: I234727f5abba546c1392f7096b7d411d36566bbf
Merged-In: I234727f5abba546c1392f7096b7d411d36566bbf
(cherry picked from commit b0762ccb2f)
2019-01-24 14:04:01 -08:00
Miao Wang
7176fe7a63 Add HAL entry to allow querying the device type
Bug: 111425781
Bug: 112661050
Test: mm
Test: NeuralNetworksTest_static
Change-Id: Iced35c24eb2905c10fbf86d55319fdb5c7488703
Merged-In: Iced35c24eb2905c10fbf86d55319fdb5c7488703
(cherry picked from commit e3b93534c0)
2019-01-24 14:03:59 -08:00
David Gross
95c821918e Merge "Update neuralnetworks HAL to allow collecting execution duration." 2019-01-24 20:51:50 +00:00
TreeHugger Robot
ed85890b79 Merge "Clean and reorder operation enums." 2019-01-24 09:07:49 +00:00
Miao Wang
4f3ff85b5d Merge "Update NNAPI VTS test makefile after adding AHardwareBuffer support" 2019-01-24 03:07:57 +00:00
David Gross
e301349b05 Update neuralnetworks HAL to allow collecting execution duration.
Test: VtsHalNeuralnetworksV1_0TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.0::IDevice/sample-all
Test: VtsHalNeuralnetworksV1_1TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.1::IDevice/sample-all
Test: VtsHalNeuralnetworksV1_2TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.2::IDevice/sample-all

Bug: 115390094

Change-Id: If67a5ffe39cfdd78498e01f26251734fdc8e66c7
2019-01-23 14:01:52 -08:00
Xusong Wang
28a33a9cb1 Clean and reorder operation enums.
Four operation enums are removed:
- DETECTION_OUTPUT
- PRIOR_BOX
- SPARSE_TO_DENSE
- EMBEDDING_LOOKUP_SPARSE

Operation enums are reorder into alphabetic order.

Bug: 123253865
Bug: 122744669
Test: NeuralNetworksTest_static
Change-Id: Ie5d2bff6fac061bdca0a99e5b8c8ac05733fac4b
2019-01-23 11:47:54 -08:00
Michael Butler
f96dc6ed8f Merge "NNAPI Burst -- HAL interface" 2019-01-23 19:17:06 +00:00
Michael Butler
7e91e24fe1 NNAPI Burst -- HAL interface
FastMessageQueue is a Treble-compliant data structure that enables fast
communication between two processes. The FMQ object itself is an atomic
circular buffer that is optionally synchronized with a futex. However,
FMQ has no notion of ownership or lifetime across processes, so it must
be paired with higher-level constructs to manage the lifetime and
ownership.

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.
Specifically, it replaces IPreparedModel::executeSynchronously's call
from the client into the service with fmq_sync<FmqRequestDatum> (an FMQ
channel used to pass a serialized Request object) and it replaces
the return from the service into the client with
fmq_sync<FmqResultDatum> (an FMQ channel used to return serialized
result status and OutputShapes information).

Each channel is a unidirectional flow of information with exactly one
producer and exactly one consumer. The channels are created by the NN
runtime and passed to the service via
IPreparedModel::configureExecutionBurst.

This CL defines the FmqRequestDatum and FmqResultDatum types in
types.hal. IBurstContext.hal defines IBurstContext, a HIDL object used
by the service to manage the resources of a Burst. IBurstCallback.hal
defines IBurstCallback, a HIDL callback object that can be used to
retrieve the handle to a resource the service has either not yet seen or
has evicted from its cache. Finally, IPreparedModel.hal is extended with
IPreparedModel::configureExecutionBurst to create the burst object.

Bug: 119570067
Test: mma
Change-Id: I333da70201531b1396efc714d096c277e8e1d47b
2019-01-22 20:23:08 -08:00
Miao Wang
276b55b900 Update NNAPI VTS test makefile after adding AHardwareBuffer support
Test: mm
Test: VTS
Change-Id: Ib98c08ce5cbbcd46f66ade80af28569f9cb14449
2019-01-22 14:00:02 -08:00
Lev Proleev
1509a2664c mutateOperationOperandTypeSkip for new TRANSPOSE_CONV_2D variant
Bug: 119255406
Test: Vts NNAPI tests.
Change-Id: I63f7fc67cedcc2a9db8c359ff96be3c9403b9a20
2019-01-22 15:20:13 +00:00
Lev Proleev
b0762ccb2f mutateOperationOperandTypeSkip for new GROUPED_CONV_2D variant
Bug: 119255406
Test: Vts NNAPI tests.
Change-Id: I234727f5abba546c1392f7096b7d411d36566bbf
2019-01-21 11:37:28 +00:00
Xusong Wang
f637f04a36 Merge "Add new OperandType TENSOR_QUANT16_ASYMM." 2019-01-19 03:37:04 +00:00
Xusong Wang
02838e4b0d Merge "Test dynamic output shape in GeneratedTests." 2019-01-19 00:20:30 +00:00
Xusong Wang
d49f665c42 Add new OperandType TENSOR_QUANT16_ASYMM.
Test: NeuralNetworksTest_static
Test: VtsHalNeuralnetworksV1_2TargetTest
Change-Id: I8fcd6b30c32f8fbc181d2b43f9ac0b94fdc57e2f
2019-01-18 14:50:17 -08:00
Miao Wang
b5eb0fc941 Merge "Add HAL entry to allow querying the device type" 2019-01-18 22:33:37 +00:00
Xusong Wang
a316581b21 Test dynamic output shape in GeneratedTests.
Enable VTS unit test for dynamic output shape deduction.

Only test dynamic output shape for V1_2::IDevice with V1_2::Model.

Bug: 73506513
Test: VtsHalNeuralnetworksV1_xTargetTest with 1.2 sample driver
Change-Id: I4134e1ec54a15554eb8533134897279651b57da3
2019-01-17 18:39:08 -08:00
Miao Wang
e3b93534c0 Add HAL entry to allow querying the device type
Bug: 111425781
Bug: 112661050
Test: mm
Test: NeuralNetworksTest_static
Change-Id: Iced35c24eb2905c10fbf86d55319fdb5c7488703
2019-01-17 17:23:38 -08:00
Slava Shklyaev
341f6b335d Deprecate OEM types in NNAPI
Change-Id: I12e0c98324c1310815e150d24e0b25e26073a424
Fix: 119856868
Test: N/A
2019-01-15 13:59:18 +00:00
Xusong Wang
0ba24d97b6 Merge "Add 1.2 NN HAL interface for dynamic output shape." 2019-01-11 04:42:42 +00:00
Xusong Wang
187c59715c Add 1.2 NN HAL interface for dynamic output shape.
Let notify_1_2() notify output shapes.

Document unspecified dimensions and rank.

Bug: 73506513
Bug: 77234888
Test: NeuralNetworksTest_static
Test: VtsHalNeuralnetworksV1_xTargetTest with 1.2 sample driver
Change-Id: I01108913212d9f4aa47daf2f293ea19259925865
2019-01-10 15:52:51 -08:00
Xusong Wang
1f59bc3b24 Modify operation enum.
Remove ROTATED_BBOX_TRANSFORM since it is no longer needed.
Add DETECTION_POSTPROCESS for SSD NMS postprocessing op.

Bug: 120983926
Test: NeuralNetworksTest_static
Change-Id: Id6b1021c8707734499feddddf0aac24a3fff90f8
2019-01-10 12:20:34 -08:00
Przemyslaw Szczepaniak
725f68487a mutateOperationOperandTypeSkip for new DEPTHWISE_CONV_2D variant.
Bug: 119255406
Test: Vts NNAPI tests.
Change-Id: Iaeb1ef1095dde51e9324f526a2126ed5d0491586
Merged-In: Iaeb1ef1095dde51e9324f526a2126ed5d0491586
(cherry picked from commit 47b9141609)
2019-01-10 18:12:28 +00:00
Xusong Wang
c3ea0775ba Add INSTANCE_NORMALIZATION to operation enum.
Bug: 120064464
Test: NeuralNetworksTest_static
Change-Id: Ia81c8e4a79e65275e4a85b93e3bc18a02ac2cbb0
Merged-In: Ia81c8e4a79e65275e4a85b93e3bc18a02ac2cbb0
(cherry picked from commit 897c0afbdf)
2019-01-10 18:08:27 +00:00
Michael K. Sanders
6049d17c3c Merge "Add support for QUANT8_SYMM_PER_CHANNEL as graph input" 2019-01-10 18:07:11 +00:00
Przemyslaw Szczepaniak
2fadc84792 mutateOperationOperandTypeSkip for new CONV_2D variant.
Bug: 119255406
Test: Vts NNAPI tests.
Change-Id: I265ae4968f5fe3589d79e5846a7d640a735a012f
Merged-In: I265ae4968f5fe3589d79e5846a7d640a735a012f
(cherry picked from commit f54f12634c)
2019-01-10 08:16:56 +00:00
Michael K. Sanders
41e6732a66 Adds float16 support for RANDOM_MULTINOMIAL.
Bug: 118607845
Test: VtsHalNeuralnetworksV1_2TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.2::IDevice/sample-all
Change-Id: Iac8c0c23a8219702697a7a126e5e2e43ef0461f4
Merged-In: Iac8c0c23a8219702697a7a126e5e2e43ef0461f4
(cherry picked from commit 5b2615be21)
2019-01-10 08:16:38 +00:00
Przemyslaw Szczepaniak
4766f8b1a1 Add TENSOR_QUANT8_SYMM_PER_CHANNEL to operand types
Added ExtraParams union for extra Operand parameters.
It's a more sensible approach than adding more fields
to the Operand struct.

Bug: 119249581
Test: NeuralNetworksTest_static
Test: VtsHalNeuralnetworksV1_0TargetTest
Test: VtsHalNeuralnetworksV1_1TargetTest
Test: VtsHalNeuralnetworksV1_2TargetTest
Change-Id: I59731134cf0ea34cf9e10342686d331da9e9c3b3
Merged-In: I59731134cf0ea34cf9e10342686d331da9e9c3b3
(cherry picked from commit faa59b8a2c)
2019-01-10 08:15:58 +00:00
Przemyslaw Szczepaniak
c3da78ad14 Add support for QUANT8_SYMM_PER_CHANNEL as graph input
Bug: 119255406
Test: Vts/Cts NNAPI tests.
Change-Id: If7407355f7c1ac878f919369c06ec98592e3f3d4
Merged-In: If7407355f7c1ac878f919369c06ec98592e3f3d4
(cherry picked from commit 429096160d)
2019-01-09 14:15:52 +00:00
Slava Shklyaev
edf67ee8e7 Add REDUCE_* operations
Bug: 113564646
Test: mma
Change-Id: I6088e270c0167bcf8fc6c4002ed7f4e939b6d435
Merged-In: I6088e270c0167bcf8fc6c4002ed7f4e939b6d435
(cherry picked from commit 4fdb8b5727)
2019-01-09 09:45:33 +00:00
Miao Wang
bb685a4a97 Report "SKIPPED" for unsupported tests.
- Instead of reporting PASS for unsupported tests, use GTEST_SKIP to
  skip the tests at runtime.

Bug: 113356629
Test: mm
Test: VTS tests on HVX driver
Change-Id: I6a870b61809e58490e66dd4ea36ddeb64fc68a07
2019-01-08 12:35:35 -08:00
David Gross
4592ed15cd Add @1.2::IPreparedModel::executeSynchronously() and corresponding VTS tests.
Bug: 119274127

Test: all of the following, with the appropriate android.hardware.neuralnetworks@1.${X}::IDevice/sample-all
    VtsHalNeuralnetworksV1_0TargetTest
    VtsHalNeuralnetworksV1_0TargetTest
    VtsHalNeuralnetworksV1_1CompatV1_0TargetTest
    VtsHalNeuralnetworksV1_1CompatV1_0TargetTest
    VtsHalNeuralnetworksV1_1TargetTest
    VtsHalNeuralnetworksV1_1TargetTest
    VtsHalNeuralnetworksV1_2CompatV1_0TargetTest
    VtsHalNeuralnetworksV1_2CompatV1_0TargetTest
    VtsHalNeuralnetworksV1_2CompatV1_1TargetTest
    VtsHalNeuralnetworksV1_2CompatV1_1TargetTest
    VtsHalNeuralnetworksV1_2TargetTest
    VtsHalNeuralnetworksV1_2TargetTest

Change-Id: Iedfa485b4008d9cec3b81ff4c0ce3ebc0b83c823
(cherry picked from commit 49e41678f5)
2019-01-02 11:13:11 -08:00
Xusong Wang
47c26b7226 Merge "Add INSTANCE_NORMALIZATION to operation enum." 2018-12-28 04:20:19 +00:00
David Gross
782bb2c095 Merge "Add @1.2::IPreparedModel::executeSynchronously() and corresponding VTS tests." 2018-12-22 02:52:22 +00:00
David Gross
49e41678f5 Add @1.2::IPreparedModel::executeSynchronously() and corresponding VTS tests.
Bug: 119274127

Test: all of the following, with the appropriate android.hardware.neuralnetworks@1.${X}::IDevice/sample-all
    VtsHalNeuralnetworksV1_0TargetTest
    VtsHalNeuralnetworksV1_0TargetTest
    VtsHalNeuralnetworksV1_1CompatV1_0TargetTest
    VtsHalNeuralnetworksV1_1CompatV1_0TargetTest
    VtsHalNeuralnetworksV1_1TargetTest
    VtsHalNeuralnetworksV1_1TargetTest
    VtsHalNeuralnetworksV1_2CompatV1_0TargetTest
    VtsHalNeuralnetworksV1_2CompatV1_0TargetTest
    VtsHalNeuralnetworksV1_2CompatV1_1TargetTest
    VtsHalNeuralnetworksV1_2CompatV1_1TargetTest
    VtsHalNeuralnetworksV1_2TargetTest
    VtsHalNeuralnetworksV1_2TargetTest

Change-Id: Iedfa485b4008d9cec3b81ff4c0ce3ebc0b83c823
2018-12-21 11:25:52 -08:00
Przemyslaw Szczepaniak
47b9141609 mutateOperationOperandTypeSkip for new DEPTHWISE_CONV_2D variant.
Bug: 119255406
Test: Vts NNAPI tests.
Change-Id: Iaeb1ef1095dde51e9324f526a2126ed5d0491586
2018-12-21 11:40:10 +00:00
Xusong Wang
5666626b33 Add new OperandType FLOAT16.
Bug: 120225191
Test: NeuralNetworksTest_static
Test: VtsHalNeuralnetworksV1_2TargetTest
Change-Id: Iaabebe490303c9c93a34d319c8c594df13fb7899
Merged-In: Iaabebe490303c9c93a34d319c8c594df13fb7899
(cherry picked from commit 7bca34bee7)
2018-12-18 16:20:00 +00:00
Lev Proleev
a26349a847 Add two missing comparison ops to HAL
Bug: 113561733
Test: NeuralNetworksTest_static
Test: VtsHalNeuralnetworksV1_2TargetTest
Change-Id: Ied32f217f4e4ece3c082f6485f99cf8dee78e55f
Merged-In: Ied32f217f4e4ece3c082f6485f99cf8dee78e55f
(cherry picked from commit 149f2b018b)
2018-12-18 09:17:15 +00:00
Michael K. Sanders
2a0101203f Fixes VTS test failures.
Moves comments for type range values into their enums to make it harder
to forget to update them.

Adds missing float16 types for ARGMAX/ARGMIN/CAST.

Test: VtsHalNeuralnetworksV1_2TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.2::IDevice/sample-all
Test: [  PASSED  ] 2519 tests.

Change-Id: Ic7c3df8c8fbff45fe497f304b6b2c7a09e7dc5a6
Merged-In: Ic7c3df8c8fbff45fe497f304b6b2c7a09e7dc5a6
(cherry picked from commit bbdab2feee)
2018-12-18 09:15:51 +00:00
Xusong Wang
897c0afbdf Add INSTANCE_NORMALIZATION to operation enum.
Bug: 120064464
Test: NeuralNetworksTest_static
Change-Id: Ia81c8e4a79e65275e4a85b93e3bc18a02ac2cbb0
2018-12-17 14:17:46 -08:00
Przemyslaw Szczepaniak
429096160d Add support for QUANT8_SYMM_PER_CHANNEL as graph input
Bug: 119255406
Test: Vts/Cts NNAPI tests.
Change-Id: If7407355f7c1ac878f919369c06ec98592e3f3d4
2018-12-17 17:42:54 +00:00
Przemyslaw Szczepaniak
0c157d30f2 Merge "mutateOperationOperandTypeSkip for new CONV_2D variant." 2018-12-14 16:12:16 +00:00
Xusong Wang
1a06e77831 Add 1.2 NN HAL: IPreparedModel & callbacks.
Create 1.2 version IPreparedModel, IPreparedModelCallback, and
IExecutionCallback.

Currently the new interfaces are created the same as 1.0 version,
but will have more methods introduced in later CLs.

Bug: 73506513
Test: VtsHalNeuralnetworksV1_xTargetTest with 1.2 sample driver
Change-Id: Icf4d04c22f88e825d87562f1489377fdf6bf585d
Merged-In: Icf4d04c22f88e825d87562f1489377fdf6bf585d
(cherry picked from commit b5cb8f7632)
2018-12-13 13:56:51 -08:00
Xusong Wang
a3aa40af3e Merge "Add 1.2 NN HAL: IPreparedModel & callbacks." 2018-12-13 20:55:48 +00:00
Slava Shklyaev
dc98cb0a6b Add TENSOR_BOOL8 support to generated tests
Bug: 119096815
Test: mma
Change-Id: I6a9c49d5c4312a37a91943c668ff8c8ed5ef38c5
Merged-In: I6a9c49d5c4312a37a91943c668ff8c8ed5ef38c5
(cherry picked from commit 9e3fad1801)
2018-12-13 09:18:53 +00:00
Slava Shklyaev
51e44f7090 Add new operand type TENSOR_BOOL8
Bug: 119096815
Test: mma
Change-Id: I2adc7e7a328d53a9dafba52a1f8dfaba63e234b2
Merged-In: I2adc7e7a328d53a9dafba52a1f8dfaba63e234b2
(cherry picked from commit 4aad16b684)
2018-12-13 09:18:53 +00:00
Przemyslaw Szczepaniak
f54f12634c mutateOperationOperandTypeSkip for new CONV_2D variant.
Bug: 119255406
Test: Vts NNAPI tests.
Change-Id: I265ae4968f5fe3589d79e5846a7d640a735a012f
2018-12-12 12:54:06 +00:00
Xusong Wang
b5cb8f7632 Add 1.2 NN HAL: IPreparedModel & callbacks.
Create 1.2 version IPreparedModel, IPreparedModelCallback, and
IExecutionCallback.

Currently the new interfaces are created the same as 1.0 version,
but will have more methods introduced in later CLs.

Bug: 73506513
Test: VtsHalNeuralnetworksV1_xTargetTest with 1.2 sample driver
Change-Id: Icf4d04c22f88e825d87562f1489377fdf6bf585d
2018-12-11 17:33:15 -08:00
Przemyslaw Szczepaniak
faa59b8a2c Add TENSOR_QUANT8_SYMM_PER_CHANNEL to operand types
Added ExtraParams union for extra Operand parameters.
It's a more sensible approach than adding more fields
to the Operand struct.

Bug: 119249581
Test: NeuralNetworksTest_static
Test: VtsHalNeuralnetworksV1_0TargetTest
Test: VtsHalNeuralnetworksV1_1TargetTest
Test: VtsHalNeuralnetworksV1_2TargetTest
Change-Id: I59731134cf0ea34cf9e10342686d331da9e9c3b3
2018-12-10 13:08:03 +00:00
Slava Shklyaev
4fdb8b5727 Add REDUCE_* operations
Bug: 113564646
Test: mma
Change-Id: I6088e270c0167bcf8fc6c4002ed7f4e939b6d435
2018-12-10 10:31:15 +00:00
Xusong Wang
2256f080d4 Merge "Add new OperandType FLOAT16." 2018-12-08 02:49:25 +00:00
Keun Soo YIM
68ae05dd2d pack VTS cc_test binaries as general-tests
Test: make general-tests
Bug: 120093339
Merged-In: I363450d205868f900e4925ccff1430e2a569f2a4
Change-Id: I363450d205868f900e4925ccff1430e2a569f2a4
2018-12-07 10:49:56 -08:00
TreeHugger Robot
3ef664747e Merge "Adds float16 support for RANDOM_MULTINOMIAL." 2018-12-07 09:51:22 +00:00
Xusong Wang
7bca34bee7 Add new OperandType FLOAT16.
Bug: 120225191
Test: NeuralNetworksTest_static
Test: VtsHalNeuralnetworksV1_2TargetTest
Change-Id: Iaabebe490303c9c93a34d319c8c594df13fb7899
2018-12-06 16:32:28 -08:00
Michael K. Sanders
5b2615be21 Adds float16 support for RANDOM_MULTINOMIAL.
Bug: 118607845
Test: VtsHalNeuralnetworksV1_2TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.2::IDevice/sample-all
Change-Id: Iac8c0c23a8219702697a7a126e5e2e43ef0461f4
2018-12-06 12:35:10 +00:00
Lev Proleev
149f2b018b Add two missing comparison ops to HAL
Bug: 113561733
Test: NeuralNetworksTest_static
Test: VtsHalNeuralnetworksV1_2TargetTest
Change-Id: Ied32f217f4e4ece3c082f6485f99cf8dee78e55f
2018-12-05 16:24:38 +00:00
Miao Wang
5a080f41a9 Merge changes from topics "replace_asymm", "fp16-op-add"
* changes:
  Replace TENSOR_QUANT16_ASYMM with TENSOR_QUANT16_SYMM
  Fix VTS ValidationTest for 1.2 ops.
  Adds float16 support to generated tests.
  Autogenerates VTS ValidationTest tests.
  Fix VTS ValidationTest for 1.2 ops.
  Separates VTS tests by HAL version.
2018-12-03 18:48:58 +00:00
Michael K. Sanders
bbdab2feee Fixes VTS test failures.
Moves comments for type range values into their enums to make it harder
to forget to update them.

Adds missing float16 types for ARGMAX/ARGMIN/CAST.

Test: VtsHalNeuralnetworksV1_2TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.2::IDevice/sample-all
Test: [  PASSED  ] 2519 tests.

Change-Id: Ic7c3df8c8fbff45fe497f304b6b2c7a09e7dc5a6
2018-12-03 17:08:45 +00:00
Slava Shklyaev
61984d221b Merge changes from topic "nnapi-tensor-bool"
* changes:
  Add TENSOR_BOOL8 support to generated tests
  Add new operand type TENSOR_BOOL8
2018-12-03 14:44:38 +00:00
Slava Shklyaev
9e3fad1801 Add TENSOR_BOOL8 support to generated tests
Bug: 119096815
Test: mma
Change-Id: I6a9c49d5c4312a37a91943c668ff8c8ed5ef38c5
2018-11-30 17:55:12 +00:00
Slava Shklyaev
4aad16b684 Add new operand type TENSOR_BOOL8
Bug: 119096815
Test: mma
Change-Id: I2adc7e7a328d53a9dafba52a1f8dfaba63e234b2
2018-11-30 17:54:55 +00:00
Steven Moreland
4fb17ff880 Merge "Update makefiles." am: 2f3c139981 am: 464839dc43
am: a3beee1be9

Change-Id: I5ff7f3a71d3b2ae503f347ffd50b94797dc92a7e
2018-11-30 01:19:22 -08:00
Steven Moreland
6b110994d2 Update makefiles.
Bug: N/A
Test: N/A
Change-Id: Ie4ccc7f7638e9eca3bcd43c36c16f2f0053ac596
2018-11-29 18:05:35 -08:00
Lev Proleev
217c4071cc Replace TENSOR_QUANT16_ASYMM with TENSOR_QUANT16_SYMM
* Update doc string
* Update zero point mutation to check for symmetric quantization

Fix: 118671831
Test: VtsHalNeuralnetworksV1_2TargetTest
Change-Id: Id1999c793c839b892cfe45cbb245611b12db2a72
Merged-In: Id1999c793c839b892cfe45cbb245611b12db2a72
(cherry picked from commit 48c8820bac)
2018-11-29 18:46:36 +00:00
Xusong Wang
1a2492f311 Fix VTS ValidationTest for 1.2 ops.
Fix VTS ValidationTest for 1.2 ops by skipping invalid tests.

Bug: 119425787

Test: VtsHalNeuralnetworksV1_xTargetTest with 1.2 sample driver
Change-Id: I61e33d8ff3d9121d9ceb28e667ba6c00bb9951ac
Merged-In: I61e33d8ff3d9121d9ceb28e667ba6c00bb9951ac
(cherry picked from commit 5b747ae02b)
2018-11-29 18:46:36 +00:00
Michael K. Sanders
650fd186e4 Adds float16 support to generated tests.
Uses the _Float16 type (ISO/IEC TS 18661-3:2015) for storage.

Test: VtsHalNeuralnetworksV1_2TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.2::IDevice/sample-all
Bug: 113563458
Change-Id: I1779b828d397b5354dc854c68d21c159cd5b582c
Merged-In: I1779b828d397b5354dc854c68d21c159cd5b582c
(cherry picked from commit efa4c814fb)
2018-11-29 18:46:36 +00:00
Michael K. Sanders
a8efddc558 Autogenerates VTS ValidationTest tests.
This removes the use of a separately updated list of models
that has fallen out of sync.

Bug: 119293899
Test: VtsHalNeuralnetworksV1_2TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.2::IDevice/sample-all
Test: VtsHalNeuralnetworksV1_2CompatV1_1TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.2::IDevice/sample-all
Test: VtsHalNeuralnetworksV1_2CompatV1_0TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.2::IDevice/sample-all
Test: VtsHalNeuralnetworksV1_1TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.1::IDevice/sample-all
Test: VtsHalNeuralnetworksV1_1CompatV1_0TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.1::IDevice/sample-all
Test: VtsHalNeuralnetworksV1_0TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.0::IDevice/sample-all

Change-Id: I2d8804d78331b8fceab4c622c871802aa0f0a4b4
Merged-In: I2d8804d78331b8fceab4c622c871802aa0f0a4b4
(cherry picked from commit b5fe58b95a)
2018-11-29 18:46:36 +00:00
Xusong Wang
a6b1dc7d9b Fix VTS ValidationTest for 1.2 ops.
Skip L2_NORMALIZATION,  LOCAL_RESPONSE_NORMALIZATION, and SOFTMAX for
addOperationInputTest.

Test: VtsHalNeuralnetworksV1_xTargetTest with 1.2 sample driver
Change-Id: I16de09e2eef7610e564f1f49ff067af7efca3784
Merged-In: I16de09e2eef7610e564f1f49ff067af7efca3784
(cherry picked from commit 6433728e2c)
2018-11-29 18:46:36 +00:00
Michael K. Sanders
fc2b10ec86 Separates VTS tests by HAL version.
This prevents a fatal relocation error trying to link
VtsHalNeuralnetworksV1_2TargetTest if it exceeds 1GB.

Test: VtsHalNeuralnetworksV1_2TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.2::IDevice/sample-all
Test: VtsHalNeuralnetworksV1_2CompatV1_1TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.2::IDevice/sample-all
Test: VtsHalNeuralnetworksV1_2CompatV1_0TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.2::IDevice/sample-all
Test: VtsHalNeuralnetworksV1_1TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.1::IDevice/sample-all
Test: VtsHalNeuralnetworksV1_1CompatV1_0TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.1::IDevice/sample-all
Test: VtsHalNeuralnetworksV1_0TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.0::IDevice/sample-all
Bug: 119135172

Change-Id: Id5cfdeddc2f0d810b4eb47084640ae1dbf297ea1
Merged-In: Id5cfdeddc2f0d810b4eb47084640ae1dbf297ea1
(cherry-pick from 0fb3892c93)
2018-11-29 18:46:31 +00:00
Keun Soo YIM
ff84c37bc1 pack VTS cc_test binaries as general-tests
Test: make general-tests
Bug: 120093339
Change-Id: I363450d205868f900e4925ccff1430e2a569f2a4
2018-11-27 16:11:41 -08:00
TreeHugger Robot
c3c3ebad33 Merge "Replace TENSOR_QUANT16_ASYMM with TENSOR_QUANT16_SYMM" 2018-11-16 00:42:40 +00:00
Xusong Wang
9319968f99 Merge "Add two operations to 1.2 nn hal." am: af32d47028 am: 0468984419
am: 1bdc688304

Change-Id: Id53736a0e002f05bdf654cf6478aaab40087a791
2018-11-15 06:42:43 -08:00
Lev Proleev
48c8820bac Replace TENSOR_QUANT16_ASYMM with TENSOR_QUANT16_SYMM
* Update doc string
* Update zero point mutation to check for symmetric quantization

Fix: 118671831
Test: VtsHalNeuralnetworksV1_2TargetTest
Change-Id: Id1999c793c839b892cfe45cbb245611b12db2a72
2018-11-15 10:22:50 +00:00
Michael K. Sanders
9233dbedcc Adds symbolic min/max values for type enums.
This abstracts the boundary values for OperandType and
OperationType to avoid the need to update them in the
model validation functions.

Test: VtsHalNeuralnetworksV1_2TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.2::IDevice/sample-all
Test: VtsHalNeuralnetworksV1_2CompatV1_1TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.2::IDevice/sample-all
Test: VtsHalNeuralnetworksV1_2CompatV1_0TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.2::IDevice/sample-all

Change-Id: I39155148d67215e32b4eb1991b885f65d5eeaca8
Merged-In: I39155148d67215e32b4eb1991b885f65d5eeaca8
(cherry-pick from c785d46eb6)
2018-11-15 09:15:06 +00:00
Xusong Wang
5b747ae02b Fix VTS ValidationTest for 1.2 ops.
Fix VTS ValidationTest for 1.2 ops by skipping invalid tests.

Bug: 119425787

Test: VtsHalNeuralnetworksV1_xTargetTest with 1.2 sample driver
Change-Id: I61e33d8ff3d9121d9ceb28e667ba6c00bb9951ac
2018-11-13 15:07:57 -08:00
Michael K. Sanders
32072766b8 Merge "Adds symbolic min/max values for type enums." 2018-11-13 10:02:31 +00:00
Michael K. Sanders
a4c85981fa Merge "Adds float16 support to generated tests." 2018-11-12 17:34:21 +00:00
Michael K. Sanders
efa4c814fb Adds float16 support to generated tests.
Uses the _Float16 type (ISO/IEC TS 18661-3:2015) for storage.

Test: VtsHalNeuralnetworksV1_2TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.2::IDevice/sample-all
Bug: 113563458
Change-Id: I1779b828d397b5354dc854c68d21c159cd5b582c
2018-11-12 14:15:22 +00:00
Michael K. Sanders
c785d46eb6 Adds symbolic min/max values for type enums.
This abstracts the boundary values for OperandType and
OperationType to avoid the need to update them in the
model validation functions.

Test: VtsHalNeuralnetworksV1_2TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.2::IDevice/sample-all
Test: VtsHalNeuralnetworksV1_2CompatV1_1TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.2::IDevice/sample-all
Test: VtsHalNeuralnetworksV1_2CompatV1_0TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.2::IDevice/sample-all
Change-Id: I39155148d67215e32b4eb1991b885f65d5eeaca8
2018-11-12 11:43:31 +00:00
Xusong Wang
35faff38a7 Add two operations to 1.2 nn hal.
Add ABS and ROI_POOLING to 1.2 nn types.hal

Test: mma
Change-Id: I367e5ea58bcc6bf373fd3a477fbf39c9892a2130
2018-11-09 21:00:56 -08:00
Lev Proleev
ed7ce7afdf Add int16_t to MixedTyped
Test: NeuralNetworksTest_static
Test: VtsHalNeuralnetworksV1_2TargetTest
Change-Id: I223a36cd2106b54155e0a80ffabe4f7a1c1f23f9
Merged-In: I223a36cd2106b54155e0a80ffabe4f7a1c1f23f9
(cherry picked from commit ca80ff0840)
2018-11-09 20:57:12 -08:00
Lev Proleev
d36b7a8d52 Add static asserts to functions using MixedTyped
This makes it easier to find all the places that need to be changed
after adding a new type to MixedTyped.

Test: VtsHalNeuralnetworksV1_2TargetTest
Change-Id: I92867de6574ec6dc1a17e30d889c79501ea93063
Merged-In: I92867de6574ec6dc1a17e30d889c79501ea93063
(cherry picked from commit 9b490f4833)
2018-11-09 20:56:33 -08:00