Commit graph

403 commits

Author SHA1 Message Date
Michael Butler
648ada5fcf NNAPI VTS update in response to utility function change
The frameworks/ml/nn CL "Improve performance of Burst executions"
changed the signature of a utility function used by NNAPI's VTS tests.
This CL modifies the test accordingly.

Bug: 132073143
Test: mma
Test: VtsHalNeuralnetworksV1_2TargetTest (with sample-all)
Test: VtsHalNeuralnetworksV1_3TargetTest (with sample-all)
Change-Id: I56c3b04e6fec11d526e2a1ff5b896f31cb12eb5f
Merged-In: I56c3b04e6fec11d526e2a1ff5b896f31cb12eb5f
(cherry picked from commit 5756887a7b)
2019-10-28 13:17:08 -07:00
Lev Proleev
e5376fea95 Add template for 1.3 types.hal and regenerate it
After this update, types.hal v1.3 no longer refers to API level 30.

Test: none needed
Bug: 140132458
Change-Id: If707dfbcade6be1a0885fc21f6ddf47f3c27b244
Merged-In: If707dfbcade6be1a0885fc21f6ddf47f3c27b244
(cherry picked from commit e98e6793be)
2019-10-28 13:03:00 +00:00
Lev Proleev
26d1bc8a4e Modify NNAPI VTS tests to run on version 1.3
Bug: 139120468
Test: VtsHalNeuralnetworksV1_3TargetTest
Change-Id: I4654dc75c17f8801103015dc1da91663dfa28d52
Merged-In: I4654dc75c17f8801103015dc1da91663dfa28d52
(cherry picked from commit b49dadfb64)
2019-10-17 18:34:51 +01:00
Lev Proleev
ce8c632a09 Create NNAPI HAL v1.3 and add TENSOR_QUANT8_ASYMM_SIGNED OperandType
Bug: 137828494
Bug: 139120468
Bug: 136735770
Test: mma
Change-Id: I28f74e4b364fec1d7431a96cf5687256b3106069
Merged-In: I28f74e4b364fec1d7431a96cf5687256b3106069
(cherry picked from commit 5a7b67ab8f)
2019-10-17 18:34:51 +01:00
Dan Shi
ecbc1ab590 Merge "Add VtsHalLightV2_0TargetTest and VtsHalNeuralnetworksV1_* to vts-core" am: 0e1efc568c am: 7626cc8cd5 am: 86395146bf
am: 9154805dce

Change-Id: Ic87df0df72d87be833bc408af5bc6a9139dcf7f4
2019-10-14 09:12:32 -07:00
Dan Shi
0e1efc568c Merge "Add VtsHalLightV2_0TargetTest and VtsHalNeuralnetworksV1_* to vts-core" 2019-10-14 15:35:48 +00:00
Michael Butler
50d76d6cfe Merge "NNAPI VTS update in response to utility function change" 2019-10-11 17:31:20 +00:00
Colin Cross
552c7a66ea Revert "Revert "Modify NNAPI VTS tests to run on version 1.3" am: 64f9eb4bd5 am: 7973d7dec5 am: 8bde98b027"
This reverts commit 496320b1ec.

Reason for revert: revert of a cherry-pick broke master

Change-Id: I4654dc75c17f8801103015dc1da91663dfa28d52
2019-10-10 23:13:36 +00:00
Lev Proleev
496320b1ec Revert "Modify NNAPI VTS tests to run on version 1.3" am: 64f9eb4bd5 am: 7973d7dec5 am: 8bde98b027
am: edadec3f9e

Change-Id: Idb6d7245c58afd0aba52db67cb1a540604ed8e33
2019-10-10 14:54:42 -07:00
Dan Shi
4856370e54 Add VtsHalLightV2_0TargetTest and VtsHalNeuralnetworksV1_* to vts-core
Bug: None
Test: None
Change-Id: I3fbbba0dc283bec2de025f0b743d97ded5874bf9
2019-10-10 13:45:43 -07:00
Lev Proleev
839ca3c428 Revert "Create NNAPI HAL v1.3 and add TENSOR_QUANT8_ASYMM_SIGNED OperandType"
This reverts commit bd2b4e78ac.

Reason for revert: the topic breaks git_qt-dev-plus-aosp

Change-Id: Ic72dcbb7ac4ef8e6ed597eb778289b39475f03f8
2019-10-10 14:01:05 +00:00
Lev Proleev
64f9eb4bd5 Revert "Modify NNAPI VTS tests to run on version 1.3"
This reverts commit 543606fb92.

Reason for revert: the topic breaks git_qt-dev-plus-aosp

Change-Id: I74859bae687d65d344ed7edc617e1a7d086960a1
2019-10-10 13:54:38 +00:00
Michael Butler
5756887a7b NNAPI VTS update in response to utility function change
The frameworks/ml/nn CL "Improve performance of Burst executions"
changed the signature of a utility function used by NNAPI's VTS tests.
This CL modifies the test accordingly.

Bug: 132073143
Test: mma
Test: VtsHalNeuralnetworksV1_2TargetTest (with sample-all)
Test: VtsHalNeuralnetworksV1_3TargetTest (with sample-all)
Change-Id: I56c3b04e6fec11d526e2a1ff5b896f31cb12eb5f
2019-10-09 11:15:08 -07:00
Lev Proleev
e98e6793be Add template for 1.3 types.hal and regenerate it
After this update, types.hal v1.3 no longer refers to API level 30.

Test: none needed
Bug: 140132458
Change-Id: If707dfbcade6be1a0885fc21f6ddf47f3c27b244
2019-10-09 16:32:11 +01:00
Lev Proleev
543606fb92 Modify NNAPI VTS tests to run on version 1.3
Bug: 139120468
Test: VtsHalNeuralnetworksV1_3TargetTest
Change-Id: Id9e4d99852da8a3d5167ab7464c0e71885250501
Merged-In: Id9e4d99852da8a3d5167ab7464c0e71885250501
(cherry picked from commit b49dadfb64)
2019-10-09 14:18:49 +01:00
Lev Proleev
bd2b4e78ac Create NNAPI HAL v1.3 and add TENSOR_QUANT8_ASYMM_SIGNED OperandType
Bug: 137828494
Bug: 139120468
Bug: 136735770
Test: mma
Change-Id: I1f615047d1c0c208a90082ffb6ffc43f252f77b4
Merged-In: I1f615047d1c0c208a90082ffb6ffc43f252f77b4
(cherry picked from commit 5a7b67ab8f)
2019-10-09 14:18:49 +01:00
David Gross
8c0a48bceb Replace sync_enums_to_hal.py with generate_api.{py,sh} and regenerate */types.hal
There are certain pieces of NeuralNetworks.h and of our various *.hal
files that ought to be kept in sync -- most notably the operand type
and operation type definitions and descriptions in our
NeuralNetworks.h and types.hal files.  To avoid having to do this
manually, a tool can be employed.

The old solution to this problem is sync_enums_to_hal.py, which parses
the existing NeuralNetworks.h and types.hal files, and then rewrites
the types.hal files: It identifies the operand type and operation type
portions of the files, and in the types.hal files replaces them with
transformed versions of the portions from NeuralNetworks.h.  This
approach is brittle -- it is very sensitive to the structure of the
files, as was recognized when this tool was created.  Changes to those
files since the script was last updated essentially broke the script,
as noted in http://b/140132458.

The new solution employs a new tool generate_api.py to combine a
single "specification file" with one "template file" per API file
(NeuralNetworks.h or types.hal) to produce that API file.  The script
generate_api.sh invokes generate_api.py once per API file, passing
appropriate arguments.  See frameworks/ml/nn/tools/api/README.md for
more details.

In the process of combining information from NeuralNetworks.h and
*/types.hal, some formatting, syntactic, and semantic changes have
been made to those files.  For example:
- types.hal files no longer refer to API levels or (similarly)
  to HAL versions other than earlier HAL versions

Bug: 130169064
Bug: 140132458

Test: cd neuralnetworks ; mma

Change-Id: Iceb38effc2c7e6c32344e49225b85256144c0945
Merged-In: Iceb38effc2c7e6c32344e49225b85256144c0945
(cherry picked from commit 2cae5c8b01)
2019-10-09 14:18:06 +01:00
Lev Proleev
b58075603a Merge changes from topic "NNAPI v1.3"
* changes:
  Modify NNAPI VTS tests to run on version 1.3
  Copy VTS tests from v1.2 to v1.3
  Create NNAPI HAL v1.3 and add TENSOR_QUANT8_ASYMM_SIGNED OperandType
2019-10-04 15:34:10 +00:00
David Gross
2cae5c8b01 Replace sync_enums_to_hal.py with generate_api.{py,sh} and regenerate */types.hal
There are certain pieces of NeuralNetworks.h and of our various *.hal
files that ought to be kept in sync -- most notably the operand type
and operation type definitions and descriptions in our
NeuralNetworks.h and types.hal files.  To avoid having to do this
manually, a tool can be employed.

The old solution to this problem is sync_enums_to_hal.py, which parses
the existing NeuralNetworks.h and types.hal files, and then rewrites
the types.hal files: It identifies the operand type and operation type
portions of the files, and in the types.hal files replaces them with
transformed versions of the portions from NeuralNetworks.h.  This
approach is brittle -- it is very sensitive to the structure of the
files, as was recognized when this tool was created.  Changes to those
files since the script was last updated essentially broke the script,
as noted in http://b/140132458.

The new solution employs a new tool generate_api.py to combine a
single "specification file" with one "template file" per API file
(NeuralNetworks.h or types.hal) to produce that API file.  The script
generate_api.sh invokes generate_api.py once per API file, passing
appropriate arguments.  See frameworks/ml/nn/tools/api/README.md for
more details.

In the process of combining information from NeuralNetworks.h and
*/types.hal, some formatting, syntactic, and semantic changes have
been made to those files.  For example:
- types.hal files no longer refer to API levels or (similarly)
  to HAL versions other than earlier HAL versions

Bug: 130169064
Bug: 140132458

Test: cd neuralnetworks ; mma

Change-Id: Iceb38effc2c7e6c32344e49225b85256144c0945
2019-10-03 14:14:20 -07:00
Lev Proleev
b49dadfb64 Modify NNAPI VTS tests to run on version 1.3
Bug: 139120468
Test: VtsHalNeuralnetworksV1_3TargetTest
Change-Id: Id9e4d99852da8a3d5167ab7464c0e71885250501
2019-10-02 13:45:02 +01:00
Lev Proleev
5a7b67ab8f Create NNAPI HAL v1.3 and add TENSOR_QUANT8_ASYMM_SIGNED OperandType
Bug: 137828494
Bug: 139120468
Bug: 136735770
Test: mma
Change-Id: I1f615047d1c0c208a90082ffb6ffc43f252f77b4
2019-10-02 13:44:52 +01:00
Michael Butler
0763328464 Change NNAPI VTS to use TEST_P to iterate across all service instances
This CL removes a dependency on the VTS test runner by dynamically
discovering all NN HAL service instances in the gtest binary itself,
and runs through all service instances with parameterized tests.

This CL converts TEST_F cases to TEST_P cases, where the test parameter
is the name of the service instance. For existing TEST_P cases (such as
the generated test cases), the service instance name is made to be the
first test parameter.

This CL enables the NN VTS tests to be more portable, e.g., they can
run directly as a presubmit test.

Fixes: 124540002
Test: mma
Test: VtsHalNeuralnetworksV1_*TargetTest (with sample-all)
Test: cd $ANDROID_BUILD_TOP/hardware/interfaces/neuralnetworks && atest
Change-Id: I1e301d7c9f9342bb8f35a267bef180f510944b19
Merged-In: I1e301d7c9f9342bb8f35a267bef180f510944b19
(cherry picked from commit 7076f629b7)
2019-09-20 11:20:48 -07:00
Michael Butler
b3c8032b12 Specify NNAPI Burst FMQ read/write requirements
This CL additionally adds missing documentation for timing
information when returning results on the resultChannel.

Bug: 133773876
Test: mma
Change-Id: I1eb1affbb4a912d5fdeab012e2be7e7005deb04d
Merged-In: I1eb1affbb4a912d5fdeab012e2be7e7005deb04d
(cherry picked from commit f99bffd08a)
2019-09-19 13:31:01 -07:00
Michael Butler
7b19ebb5c8 Merge "Change NNAPI VTS to use TEST_P to iterate across all service instances" 2019-09-19 17:46:56 +00:00
Michael Butler
7076f629b7 Change NNAPI VTS to use TEST_P to iterate across all service instances
This CL removes a dependency on the VTS test runner by dynamically
discovering all NN HAL service instances in the gtest binary itself,
and runs through all service instances with parameterized tests.

This CL converts TEST_F cases to TEST_P cases, where the test parameter
is the name of the service instance. For existing TEST_P cases (such as
the generated test cases), the service instance name is made to be the
first test parameter.

This CL enables the NN VTS tests to be more portable, e.g., they can
run directly as a presubmit test.

Fixes: 124540002
Test: mma
Test: VtsHalNeuralnetworksV1_*TargetTest (with sample-all)
Test: cd $ANDROID_BUILD_TOP/hardware/interfaces/neuralnetworks && atest
Change-Id: I1e301d7c9f9342bb8f35a267bef180f510944b19
2019-09-16 16:34:20 -07:00
Michael Butler
f99bffd08a Specify NNAPI Burst FMQ read/write requirements
This CL additionally adds missing documentation for timing
information when returning results on the resultChannel.

Bug: 133773876
Test: mma
Change-Id: I1eb1affbb4a912d5fdeab012e2be7e7005deb04d
2019-09-12 15:58:16 -07:00
David Gross
29d90d1455 "successful preparation means successful execution" guarantee neglects bad operation inputs
Under certain circumstances, we guarantee that a prepared model can be
executed successfully.  In describing those circumstances, we
neglected to specify that operation input operands must have legal
values for the guarantee to hold.  For example, the guarantee doesn't
hold if an ADD operation has an activation input that is not one of
the defined values; or if a RESHAPE operation has a shape input in
which two or more components are -1.

This change modifies the guarantee to apply only when operation input
operands have legal values.  It also documents this guarantee for
burst execution.

Note that if an operation has an input operand that can be proven to
have an illegal value at preparation time (e.g., a constant value that
is illegal), model preparation might (but is not required to) fail for
that reason.

Bug: 135933040

Test: $ cd neuralnetworks ; mma
Change-Id: I8b421550dd89e4bbbdae899e7cb5e9e88a46d2fb
(cherry picked from commit 48544cc38a)
2019-09-12 14:27:35 -07:00
Michael Butler
13b0516e56 Consolidate NNAPI VTS utility code
This CL does additional NNAPI VTS test cleanup, including consolidating
duplicate functionality. Specifically, this CL:
* consolidates the createPreparedModel function, removing the duplicate
* consolidates the std::out ErrorStatus and DeviceStatus code into Utils
* changes non-null constant pointers to constant references
* removes redudant leading namespace specifiers (V1_0::, ::testing, etc.)
* makes the Valdiation tests free functions
* renames device to kDevice and mTestModel to kTestModel

Bug: N/A
Test: mma
Test: VtsHalNeuralnetworksV1_*TargetTest (with sample-all)
Change-Id: Ic401bb1f1760cc10384ac0d30c0c93409b63a9c7
Merged-In: Ic401bb1f1760cc10384ac0d30c0c93409b63a9c7
(cherry picked from commit e16af0a44b)
2019-09-11 11:04:54 -07:00
David Gross
48544cc38a "successful preparation means successful execution" guarantee neglects bad operation inputs
Under certain circumstances, we guarantee that a prepared model can be
executed successfully.  In describing those circumstances, we
neglected to specify that operation input operands must have legal
values for the guarantee to hold.  For example, the guarantee doesn't
hold if an ADD operation has an activation input that is not one of
the defined values; or if a RESHAPE operation has a shape input in
which two or more components are -1.

This change modifies the guarantee to apply only when operation input
operands have legal values.  It also documents this guarantee for
burst execution.

Note that if an operation has an input operand that can be proven to
have an illegal value at preparation time (e.g., a constant value that
is illegal), model preparation might (but is not required to) fail for
that reason.

Bug: 135933040

Test: $ cd neuralnetworks ; mma
Change-Id: I8b421550dd89e4bbbdae899e7cb5e9e88a46d2fb
2019-09-09 14:35:49 -07:00
Michael Butler
e16af0a44b Consolidate NNAPI VTS utility code
This CL does additional NNAPI VTS test cleanup, including consolidating
duplicate functionality. Specifically, this CL:
* consolidates the createPreparedModel function, removing the duplicate
* consolidates the std::out ErrorStatus and DeviceStatus code into Utils
* changes non-null constant pointers to constant references
* removes redudant leading namespace specifiers (V1_0::, ::testing, etc.)
* makes the Valdiation tests free functions
* renames device to kDevice and mTestModel to kTestModel

Bug: N/A
Test: mma
Test: VtsHalNeuralnetworksV1_*TargetTest (with sample-all)
Change-Id: Ic401bb1f1760cc10384ac0d30c0c93409b63a9c7
2019-08-30 14:01:38 -07:00
Michael Butler
f952adda07 Cleanup NNAPI VTS tests
am: 62749b917e

Change-Id: Ia71e9765a810b2f07c4dbec5e101e357c64ba91d
2019-08-30 11:17:32 -07:00
Michael Butler
62749b917e Cleanup NNAPI VTS tests
This CL includes the following cleanups:
* namespace compression
* remove "using" from header files
* remove no-op code, default no-op constructors
* clang-formats the code

Bug: N/A
Test: mma
Test: VtsHalNeuralnetworksV1_*TargetTest
Change-Id: I023997d8686ca65223858eed3a0881f5444ed2d6
Merged-In: I023997d8686ca65223858eed3a0881f5444ed2d6
(cherry picked from commit bbe5dad266)
2019-08-29 12:55:56 -07:00
David Gross
c9981f9592 Merge "Fix V1_2::IDevice::getType documentation: was @param instead of @return"
am: 15b826ad6a

Change-Id: I81b920f6c0edb6f1709af8d8b609e21d64e5755e
2019-08-29 11:14:21 -07:00
Michael Butler
8bc15b59ae Merge "Cleanup NNAPI VTS tests" 2019-08-29 18:04:01 +00:00
David Gross
15b826ad6a Merge "Fix V1_2::IDevice::getType documentation: was @param instead of @return" 2019-08-29 17:44:04 +00:00
Michael Butler
bbe5dad266 Cleanup NNAPI VTS tests
This CL includes the following cleanups:
* namespace compression
* remove "using" from header files
* remove no-op code, default no-op constructors
* clang-formats the code

Bug: N/A
Test: mma
Test: VtsHalNeuralnetworksV1_*TargetTest
Change-Id: I023997d8686ca65223858eed3a0881f5444ed2d6
2019-08-28 17:29:40 -07:00
Michael Butler
52da1b820c NNAPI Combine Compatability test with VTS test
am: 3247f76e35

Change-Id: If447a9db2d0a9d5906396eb5f927a0df13f868ae
2019-08-28 14:12:36 -07:00
Michael Butler
ba2da6c2d3 Change NNAPI VTS to use static library
am: 01ba094edb

Change-Id: Ia6d6fc4f68c77a36c514025af4384bbe18b0db99
2019-08-28 14:12:28 -07:00
Xusong Wang
0ac1896ef5 Merge changes from topic "nnapi_test_dynamic_reg"
am: 6568622209

Change-Id: I298f137a70b07bdb7f9e6f85d8b293ec1bad7c86
2019-08-28 13:21:01 -07:00
Xusong Wang
5fb57da9a2 Update VTS tests with the new test harness.
am: bcaa78293a

Change-Id: I690d0111167d8ec1e7db98021a6f302dfe01f839
2019-08-28 13:20:49 -07:00
David Gross
9dedd439ab Fix V1_2::IDevice::getType documentation: was @param instead of @return
Bug: 124346013

Test: $ cd neuralnetworks/1.2 ; mma
Change-Id: I45d1320a9edae73cde7d9ccaca57b5b9519b0210
Merged-In: I45d1320a9edae73cde7d9ccaca57b5b9519b0210
(cherry picked from commit c7cdd550a0)
2019-08-28 11:40:01 -07:00
Michael Butler
3247f76e35 NNAPI Combine Compatability test with VTS test
Bug: 139889855
Fixes: 140120312
Test: mma
Test: VtsHalNeuralnetworksV1_*TargetTest (with sample-all)
Change-Id: Ib93d159dc657eaf292d16140ebdd9de3b0f5f1d3
Merged-In: Ib93d159dc657eaf292d16140ebdd9de3b0f5f1d3
(cherry picked from commit 72227f3ef8)
2019-08-28 11:35:29 -07:00
Michael Butler
01ba094edb Change NNAPI VTS to use static library
This CL also adds Compilation Caching tests to the Presubmit tests,
which were missing configuration files before.

Bug: 139889855
Test: mma
Test: VtsHalNeuralnetworksV1_*TargetTest (with sample-all)
Test: VtsHalNeuralnetworksV1_*CompatV1_*TargetTest (with sample-all)
Change-Id: I65274b5f72def815ff238a8d8df10c9d014afc44
Merged-In: I65274b5f72def815ff238a8d8df10c9d014afc44
(cherry picked from commit f7a8f03e3d)
2019-08-28 11:34:58 -07:00
David Gross
1f75c5cbaf Merge "Fix V1_2::IDevice::getType documentation: was @param instead of @return" 2019-08-28 18:21:32 +00:00
Michael Butler
72227f3ef8 NNAPI Combine Compatability test with VTS test
Bug: 139889855
Fixes: 140120312
Test: mma
Test: VtsHalNeuralnetworksV1_*TargetTest (with sample-all)
Change-Id: Ib93d159dc657eaf292d16140ebdd9de3b0f5f1d3
2019-08-27 23:33:41 +00:00
Michael Butler
05f50b3d52 Merge "Change NNAPI VTS to use static library" 2019-08-27 23:32:00 +00:00
Xusong Wang
ee80b02ae9 Statically check test enums against HIDL definitions.
Fixes: 123092187
Test: mma all VTS
Test: Attempt to modify test enum value,
      confirm that there is build error with proper error message.

Change-Id: I0129378c87637b33bb145ec93307634273a9d2fd
Merged-In: I0129378c87637b33bb145ec93307634273a9d2fd
(cherry picked from commit cbfa6b998e)
2019-08-27 16:09:30 -07:00
Xusong Wang
bcaa78293a Update VTS tests with the new test harness.
Bug: 120601396
Test: All VTS
Change-Id: I539e75585b2cc01d153565814491361adfa048be
Merged-In: I539e75585b2cc01d153565814491361adfa048be
(cherry picked from commit 9e2b97b83c)
2019-08-27 16:09:12 -07:00
Michael Butler
f7a8f03e3d Change NNAPI VTS to use static library
This CL also adds Compilation Caching tests to the Presubmit tests,
which were missing configuration files before.

Bug: 139889855
Test: mma
Test: VtsHalNeuralnetworksV1_*TargetTest (with sample-all)
Test: VtsHalNeuralnetworksV1_*CompatV1_*TargetTest (with sample-all)
Change-Id: I65274b5f72def815ff238a8d8df10c9d014afc44
2019-08-27 21:59:16 +00:00
David Gross
c7cdd550a0 Fix V1_2::IDevice::getType documentation: was @param instead of @return
Bug: 124346013

Test: $ cd neuralnetworks/1.2 ; mma
Change-Id: I45d1320a9edae73cde7d9ccaca57b5b9519b0210
2019-08-27 12:22:01 -07:00
TreeHugger Robot
c6145e4327 Merge "Statically check test enums against HIDL definitions." 2019-08-27 18:04:32 +00:00
Xusong Wang
323ba2ee8b Modify validateBurstSanitized to take a single request.
This CL is to modify validateBurstSanitized implementation in accordance
with the new test generator and test harness change in the same topic.

Bug: 123092187
Test: 1.2 VTS
Change-Id: Iacfe0e3bba8b4b44b7aee023d1c8129cbd089d4a
Merged-In: Iacfe0e3bba8b4b44b7aee023d1c8129cbd089d4a
(cherry picked from commit 8fc4622bf1)
2019-08-27 10:45:03 -07:00
Xusong Wang
6d0270b056 Modify 1.2 VTS tests to consume test struct directly.
Comparing with v1.1, the converter for 1.2 HIDL model has additional support
for extraParam, dynamic output shape, and zero-sized output.

Modify CompilationCachingTests to use the new test struct.

Bug: 123092187
Bug: 138718240
Test: All VTS
Change-Id: I54ac97f62898e47a338b51cc6d895a0309ab001f
Merged-In: I54ac97f62898e47a338b51cc6d895a0309ab001f
(cherry picked from commit 491b0a8913)
2019-08-27 10:44:29 -07:00
Xusong Wang
ead950d402 Modify 1.2 VTS tests to consume test struct directly.
Comparing with v1.1, the converter for 1.2 HIDL model has additional support
for extraParam, dynamic output shape, and zero-sized output.

Modify CompilationCachingTests to use the new test struct.

Bug: 123092187
Bug: 138718240
Test: All VTS
Change-Id: I54ac97f62898e47a338b51cc6d895a0309ab001f
Merged-In: I54ac97f62898e47a338b51cc6d895a0309ab001f
(cherry picked from commit 491b0a8913)
2019-08-26 15:10:18 -07:00
Xusong Wang
cbfa6b998e Statically check test enums against HIDL definitions.
Fixes: 123092187
Test: mma all VTS
Test: Attempt to modify test enum value,
      confirm that there is build error with proper error message.

Change-Id: I0129378c87637b33bb145ec93307634273a9d2fd
2019-08-26 14:47:30 -07:00
Xusong Wang
9e2b97b83c Update VTS tests with the new test harness.
Bug: 120601396
Test: All VTS
Change-Id: I539e75585b2cc01d153565814491361adfa048be
2019-08-26 14:15:15 -07:00
Xusong Wang
8fc4622bf1 Modify validateBurstSanitized to take a single request.
This CL is to modify validateBurstSanitized implementation in accordance
with the new test generator and test harness change in the same topic.

Bug: 123092187
Test: 1.2 VTS
Change-Id: Iacfe0e3bba8b4b44b7aee023d1c8129cbd089d4a
2019-08-21 17:35:10 -07:00
Xusong Wang
491b0a8913 Modify 1.2 VTS tests to consume test struct directly.
Comparing with v1.1, the converter for 1.2 HIDL model has additional support
for extraParam, dynamic output shape, and zero-sized output.

Modify CompilationCachingTests to use the new test struct.

Bug: 123092187
Bug: 138718240
Test: All VTS
Change-Id: I54ac97f62898e47a338b51cc6d895a0309ab001f
2019-08-21 17:35:05 -07:00
Slava Shklyaev
1c4b95fb56 Merge "Refactor generated NNAPI tests (follow-up)" am: 651869e0c6 am: adf64d6cbe am: 6c1d24473f am: 0deb8aa21b
am: 20763ef488

Change-Id: I9e96057d994c322157588b818de58bc09089e796
2019-08-15 13:39:20 -07:00
Slava Shklyaev
adf64d6cbe Merge "Refactor generated NNAPI tests (follow-up)"
am: 651869e0c6

Change-Id: Ia3bdfbfc6abbdc970efcd0cf31df2b58676eebe8
2019-08-15 10:15:52 -07:00
Slava Shklyaev
e2f9d55a26 Merge "Refactor generated NNAPI tests"
am: caedc76b18

Change-Id: I5087c042a51954a7276d7d20167f526884c987c0
2019-08-15 09:14:24 -07:00
Slava Shklyaev
0da5c34a3a Refactor generated NNAPI tests (follow-up)
Bug: 136097638
Test: m
Change-Id: I0688a843ab04caca9d62f95d38179804eb1b0f80
2019-08-07 12:29:38 +01:00
Slava Shklyaev
e8b2446b35 Refactor generated NNAPI tests
See change I2c0366fb87c96851fa6e0f8fe9ceac012d8e3513

Bug: 136097638
Test: m VtsHalNeuralnetworksV1_0TargetTest
Test: m VtsHalNeuralnetworksV1_1TargetTest
Test: m VtsHalNeuralnetworksV1_2TargetTest
Test: m VtsHalNeuralnetworksV1_2CompatV1_0TargetTest
Change-Id: I6fdede028422145d313d46532b5d2154ef0d40bc
Merged-In: I6fdede028422145d313d46532b5d2154ef0d40bc
(cherry picked from commit 2bcfdc82a0)
2019-08-07 12:17:59 +01:00
Michael Butler
8f77ce7442 NNAPI VTS fix from NNAPI CL: Cleanup HalInterfaces.h
am: 3835f61986

Change-Id: If5d04badade5bc72470aafd186468701d21ee2ee
2019-07-26 14:18:35 -07:00
Xusong Wang
6e8f9859c2 Move strided_slice_invalid_output_dims to spec directory.
am: ee7fe25e99

Change-Id: If3ac5efaf33acfe3f8aa3808e631f877216d3ead
2019-07-26 14:18:19 -07:00
Michael Butler
3835f61986 NNAPI VTS fix from NNAPI CL: Cleanup HalInterfaces.h
Prior to this CL, HalInterfaces.h polluted the global namespace through
the "using" declarations. To fix b/72880287, those names were put in a
new ::android::nn::hal namespace. This CL fixes the compilation errors
that occur due to this cleanup.

Bug: 72880287
Test: mma
Change-Id: Idb228e37615af7c0343a09f9a51de378e63bdb5a
Merged-In: Idb228e37615af7c0343a09f9a51de378e63bdb5a
(cherry picked from commit 4745a3d96e)
2019-07-26 13:55:25 +01:00
Xusong Wang
ee7fe25e99 Move strided_slice_invalid_output_dims to spec directory.
Bug: 132155416
Test: 1.2 VTS
Change-Id: I0479b8172c55e5e290f3fc8530a428ac5f54998f
Merged-In: I0479b8172c55e5e290f3fc8530a428ac5f54998f
(cherry picked from commit c99ced161c)
2019-07-26 13:55:24 +01:00
Slava Shklyaev
2bcfdc82a0 Refactor generated NNAPI tests
See change I2c0366fb87c96851fa6e0f8fe9ceac012d8e3513

Bug: 136097638
Test: m VtsHalNeuralnetworksV1_0TargetTest
Test: m VtsHalNeuralnetworksV1_1TargetTest
Test: m VtsHalNeuralnetworksV1_2TargetTest
Test: m VtsHalNeuralnetworksV1_2CompatV1_0TargetTest
Change-Id: I6fdede028422145d313d46532b5d2154ef0d40bc
2019-07-23 15:30:49 +01:00
Michael Butler
734a3020ac Merge "NNAPI VTS fix from NNAPI CL: Cleanup HalInterfaces.h" 2019-07-22 21:06:24 +00:00
Xusong Wang
0d0af2cbe3 Merge "Move strided_slice_invalid_output_dims to spec directory." 2019-07-22 19:47:38 +00:00
Michael Butler
6fd5eaec52 Update NN VTS callback objects
am: 051cf39f99

Change-Id: Ibab8657b851d56af18965766303e0f26bc51bded
2019-07-19 13:25:15 -07:00
Xusong Wang
237bfc9854 Remove compiler flag for dynamic output shape tests.
am: e108bc15e6

Change-Id: Icf4f851b0ed919f7041620d1e7a4b40ccfcbae34
2019-07-19 13:25:00 -07:00
Slava Shklyaev
868ef4ac7a Update paths to NNAPI VTS models
am: cac83eefa5

Change-Id: I72034e2205fb7a6052894271974d3bedcae71f6b
2019-07-19 13:24:44 -07:00
Slava Shklyaev
bc50034109 Refactor NNAPI VTS to remove unreasonable dependence between versions
am: 73ee79dafa

Change-Id: Ie79a5693ceb255d0e44579cc6627254840166d8f
2019-07-19 13:10:50 -07:00
Michael Butler
051cf39f99 Update NN VTS callback objects
The VTS Callback files are a subset of the Callback files in
frameworks/ml/nn/runtime/Callbacks.*. This CL syncs the implementations,
removing the functionality that is not needed in VTS.

Fixes: 132322149
Test: mma
Test: VtsHalNeuralnetworksV1_0TargetTest
Test: VtsHalNeuralnetworksV1_1TargetTest
Test: VtsHalNeuralnetworksV1_2TargetTest
Change-Id: I114ce7f3b6c3d58de0196e9508209614d0a73e11
Merged-In: I114ce7f3b6c3d58de0196e9508209614d0a73e11
(cherry picked from commit 23d0e562e0)
2019-07-19 14:00:40 +01:00
Xusong Wang
e108bc15e6 Remove compiler flag for dynamic output shape tests.
Having separate VTS models and tests for difference HAL version. This
compiler flag is no longer needed.

Bug: 122740334
Test: All VTS 1.x and 1.xCompat1.y
Change-Id: Idbd96a954da9bd5a0e0e66afd9120d84a1efc784
Merged-In: Idbd96a954da9bd5a0e0e66afd9120d84a1efc784
(cherry picked from commit 7763d53545)
2019-07-19 14:00:38 +01:00
Slava Shklyaev
cac83eefa5 Update paths to NNAPI VTS models
See change If3bfbdfa016cd32a39b8a63028481da7318d6e02

Bug: 124040454
Test: VtsHalNeuralnetworksV1_0TargetTest
Test: VtsHalNeuralnetworksV1_1TargetTest
Test: VtsHalNeuralnetworksV1_1CompatV1_0TargetTest
Test: VtsHalNeuralnetworksV1_2TargetTest
Test: VtsHalNeuralnetworksV1_2CompatV1_0TargetTest
Test: VtsHalNeuralnetworksV1_2CompatV1_1TargetTest
Change-Id: I17dd4377ee5110ac10ae8142fa7403329eda067c
Merged-In: I17dd4377ee5110ac10ae8142fa7403329eda067c
(cherry picked from commit 8226861489)
2019-07-19 14:00:35 +01:00
Slava Shklyaev
73ee79dafa Refactor NNAPI VTS to remove unreasonable dependence between versions
To make it easier to create the next version of NNAPI, this change
removes the following nonsensical dependence:
- NNAPI 1.0 VTS depends on NNAPI 1.1 and 1.2
- NNAPI 1.1 VTS depends on NNAPI 1.2

In particular, I made the following changes:
- split GeneratedTestHarness.cpp into three separate implementations,
- created a restricted version of Callbacks.h for 1.0 and 1.1,
- removed the dependency on frameworks/ml/nn/HalInterfaces.h,
- refactored Android.bp files for more autonomy between 1.0, 1.1, and 1.2,
- consolidated some common code into Utils.h,
- created structure for sharing code between VTS versions (VtsHalNeuralNetworksV1_0_utils).

Bug: 74827824
Bug: 124462414
Test: VtsHalNeuralnetworksV1_0TargetTest
Test: VtsHalNeuralnetworksV1_1TargetTest
Test: VtsHalNeuralnetworksV1_1CompatV1_0TargetTest
Test: VtsHalNeuralnetworksV1_2TargetTest
Test: VtsHalNeuralnetworksV1_2CompatV1_0TargetTest
Test: VtsHalNeuralnetworksV1_2CompatV1_1TargetTest
Change-Id: I4243d0b5e574255cef1070850f4d0a284f65f54e
Merged-In: I4243d0b5e574255cef1070850f4d0a284f65f54e
(cherry picked from commit 1d6b465997)
2019-07-19 14:00:29 +01:00
Xusong Wang
c99ced161c Move strided_slice_invalid_output_dims to spec directory.
Bug: 132155416
Test: 1.2 VTS
Change-Id: I0479b8172c55e5e290f3fc8530a428ac5f54998f
2019-07-18 13:31:04 -07:00
Michael Butler
4745a3d96e NNAPI VTS fix from NNAPI CL: Cleanup HalInterfaces.h
Prior to this CL, HalInterfaces.h polluted the global namespace through
the "using" declarations. To fix b/72880287, those names were put in a
new ::android::nn::hal namespace. This CL fixes the compilation errors
that occur due to this cleanup.

Bug: 72880287
Test: mma
Change-Id: Idb228e37615af7c0343a09f9a51de378e63bdb5a
2019-07-17 21:25:37 +00:00
Michael Butler
23d0e562e0 Update NN VTS callback objects
The VTS Callback files are a subset of the Callback files in
frameworks/ml/nn/runtime/Callbacks.*. This CL syncs the implementations,
removing the functionality that is not needed in VTS.

Fixes: 132322149
Test: mma
Test: VtsHalNeuralnetworksV1_0TargetTest
Test: VtsHalNeuralnetworksV1_1TargetTest
Test: VtsHalNeuralnetworksV1_2TargetTest
Change-Id: I114ce7f3b6c3d58de0196e9508209614d0a73e11
2019-07-16 17:13:13 -07:00
Xusong Wang
7763d53545 Remove compiler flag for dynamic output shape tests.
Having separate VTS models and tests for difference HAL version. This
compiler flag is no longer needed.

Bug: 122740334
Test: All VTS 1.x and 1.xCompat1.y
Change-Id: Idbd96a954da9bd5a0e0e66afd9120d84a1efc784
2019-07-11 10:01:41 -07:00
Slava Shklyaev
8226861489 Update paths to NNAPI VTS models
See change If3bfbdfa016cd32a39b8a63028481da7318d6e02

Bug: 124040454
Test: VtsHalNeuralnetworksV1_0TargetTest
Test: VtsHalNeuralnetworksV1_1TargetTest
Test: VtsHalNeuralnetworksV1_1CompatV1_0TargetTest
Test: VtsHalNeuralnetworksV1_2TargetTest
Test: VtsHalNeuralnetworksV1_2CompatV1_0TargetTest
Test: VtsHalNeuralnetworksV1_2CompatV1_1TargetTest
Change-Id: I17dd4377ee5110ac10ae8142fa7403329eda067c
2019-07-03 15:58:08 +01:00
Slava Shklyaev
1d6b465997 Refactor NNAPI VTS to remove unreasonable dependence between versions
To make it easier to create the next version of NNAPI, this change
removes the following nonsensical dependence:
- NNAPI 1.0 VTS depends on NNAPI 1.1 and 1.2
- NNAPI 1.1 VTS depends on NNAPI 1.2

In particular, I made the following changes:
- split GeneratedTestHarness.cpp into three separate implementations,
- created a restricted version of Callbacks.h for 1.0 and 1.1,
- removed the dependency on frameworks/ml/nn/HalInterfaces.h,
- refactored Android.bp files for more autonomy between 1.0, 1.1, and 1.2,
- consolidated some common code into Utils.h,
- created structure for sharing code between VTS versions (VtsHalNeuralNetworksV1_0_utils).

Bug: 74827824
Bug: 124462414
Test: VtsHalNeuralnetworksV1_0TargetTest
Test: VtsHalNeuralnetworksV1_1TargetTest
Test: VtsHalNeuralnetworksV1_1CompatV1_0TargetTest
Test: VtsHalNeuralnetworksV1_2TargetTest
Test: VtsHalNeuralnetworksV1_2CompatV1_0TargetTest
Test: VtsHalNeuralnetworksV1_2CompatV1_1TargetTest
Change-Id: I4243d0b5e574255cef1070850f4d0a284f65f54e
2019-07-03 15:58:08 +01:00
David Gross
491d626c89 Merge "Improve documentation related to execution." am: b575cedd74 am: 3059c66d53 am: 9c59f1d42b
am: 653714d3bb

Change-Id: Ib0a93f03cfa7bf1138fac44930d6eb95a8deb269
2019-06-21 12:28:33 -07:00
David Gross
9c59f1d42b Merge "Improve documentation related to execution." am: b575cedd74
am: 3059c66d53

Change-Id: Ie1b4244f9267a96df67f8f64c42b91f3b455f416
2019-06-21 12:11:13 -07:00
David Gross
b575cedd74 Merge "Improve documentation related to execution." 2019-06-21 18:40:03 +00:00
David Gross
f406bf9b1e Improve documentation related to execution.
Bug: 121347610 document that NNAPI Execution inputs/outputs and HAL Request inputs/outputs must not be modified

Test: cd hardware/interfaces/neuralnetworks/1.0/vts/functional ; mma
Test: cd hardware/interfaces/neuralnetworks/1.2/vts/functional ; mma

Change-Id: Iac71d6d5ad92a90afd1b6babb7cfa128d7484c64
2019-06-21 11:28:19 -07:00
Slava Shklyaev
a29dd23938 Ensure that drivers return an error if STRIDED_SLICE parameters are invalid am: 95a5978983
am: 87dff647e1

Change-Id: I92774e7aeff1376e354d6624d60e1add21810d33
2019-06-20 13:59:21 -07:00
Slava Shklyaev
95a5978983 Ensure that drivers return an error if STRIDED_SLICE parameters are invalid
We don't have a framework for handcrafting tests resulting in execution
failure. To produce this test, I created
strided_slice_invalid_output_dims.mod.py and used our VTS test generator
to create the corresponding example.cpp and model.cpp files. I put those
under the new directory neuralnetworks/1.2/vts/functional/generated to
distinguish them from the streamlined generated tests.

Bug: 79856511
Bug: 132155416
Test: VtsHalNeuralnetworksV1_2TargetTest
Change-Id: Ib331778605c2e3828195e1e7d1651091873985a0
Merged-In: Ib331778605c2e3828195e1e7d1651091873985a0
(cherry picked from commit 1a18c08052)
2019-06-19 11:16:48 +01:00
Lev Proleev
e61b7b98c9 Fix LSTM documentation
The documentation said that cell-to-input weights are required to be
present when input-to-input weights, recurrent-to-input weights and
input gate bias are present. This was incorrect since this weights can
be omitted if peephole connections are not used even if all the other
tensors are present.

Another bug that is fixed in this change is that for output #0 the docs
said "of shape [batch_size, num_units * 4] with CIFG, or [batch_size,
num_units * 3] without CIFG" when in fact it is the opposite, i.e.  "of
shape [batch_size, num_units * 3] with CIFG, or [batch_size, num_units *
4] without CIFG."

Existing CTS/VTS tests expect behaviour described in the fixed documentation.
Existing CPU implementation is also compliant with the fixed documentation.

Fix: 111842951
Test: mma
Change-Id: Id011783e33672ae65dc6fe3784cb26feb832acf9
Merged-In: Id011783e33672ae65dc6fe3784cb26feb832acf9
(cherry picked from commit e0537f09fb)
2019-05-15 14:57:34 +01:00
Slava Shklyaev
1a18c08052 Ensure that drivers return an error if STRIDED_SLICE parameters are invalid
We don't have a framework for handcrafting tests resulting in execution
failure. To produce this test, I created
strided_slice_invalid_output_dims.mod.py and used our VTS test generator
to create the corresponding example.cpp and model.cpp files. I put those
under the new directory neuralnetworks/1.2/vts/functional/generated to
distinguish them from the streamlined generated tests.

Bug: 79856511
Bug: 132155416
Test: VtsHalNeuralnetworksV1_2TargetTest
Change-Id: Ib331778605c2e3828195e1e7d1651091873985a0
2019-05-15 10:36:55 +00:00
Xusong Wang
8fe6f244f0 Merge "Add quant8 variant of VTS CompilationCachingTest." into qt-dev am: c9d90efcc7
am: 5d8fec169e

Change-Id: I71acf1cabd83d0f9e70736990fc9305c5d133429
2019-05-09 20:23:37 -07:00
Xusong Wang
5d8fec169e Merge "Add quant8 variant of VTS CompilationCachingTest." into qt-dev
am: c9d90efcc7

Change-Id: Iccc7cbb84462e07d8f3462d3ef4eb4f3edf59459
2019-05-09 17:42:51 -07:00
Xusong Wang
0e0721f56e Add quant8 variant of VTS CompilationCachingTest.
Prior to this CL, the VTS compilation caching tests are using float32
models. However, there exists several drivers that only support QUANT8
operations, and most of the tests are simply skipped.

This CL makes the CompilationCachingTest fixture parameterized that
every test will run twice, with the first pass running with float32
models and the second pass running with quant8 models.

Bug: 132112463
Test: 1.2 VTS with sample drivers
Test: 1.2 VTS with test drivers that can read and write cache entries
Change-Id: Iaf28065e46c2d90ab8b347b9848be1e6546cce86
Merged-In: Iaf28065e46c2d90ab8b347b9848be1e6546cce86
(cherry picked from commit 35e7599eb2)
2019-05-09 15:45:35 -07:00
Xusong Wang
4f71afc50d Move getSupportedOperations out of saveToCache.
Before this change, getSupportedOperations_1_2 was invoked in
saveModelToCache prior to prepareModel_1_2, which delayed the model
preparation and cache overwriting always ran faster in
SaveToCache_TOCTOU test.

This change increases the chance that the model is overwritten after it
is saved in SaveToCache_TOCTOU test by moving getSupportedOperations_1_2
out of saveToCache.

Bug: 123433989
Test: VtsHalNeuralnetworksV1_xTargetTest with 1.2 sample driver
Test: VtsHalNeuralnetworksV1_xTargetTest with a test driver that can
      read and write cache entries
Test: TOCTOU tests with a sample driver that is deliberately broken

Change-Id: Ieba6a82252623ac429d5fcb6950b99db949f9886
Merged-In: Ieba6a82252623ac429d5fcb6950b99db949f9886
(cherry picked from commit f8c5987bbd)
2019-05-09 15:45:01 -07:00
Xusong Wang
e371f6f85e Test corrupted data cache in CompilationCachingTests.
We only expect the driver to not crash.

Bug: 123433989
Test: VtsHalNeuralnetworksV1_xTargetTest with 1.2 sample driver
Test: VtsHalNeuralnetworksV1_xTargetTest with a test driver that can
      read and write cache entries

Change-Id: Ic9bd7ad6e42d77d505955cb9dda597a39e95cdb6
Merged-In: Ic9bd7ad6e42d77d505955cb9dda597a39e95cdb6
(cherry picked from commit 83ab17f224)
2019-05-09 15:44:46 -07:00
Xusong Wang
7cc0cccf5d Test TOCTOU in VTS CompilationCachingTests.
Two tests are added into VTS:

1. The TOCTOU test, for a fixed number of iterations.

We try to attack the driver by replacing the model cache with another
cache entry from a similar model while the driver is saving to or
preparing from cache, and see if the driver crashes or falsely prepares
an unexpected model (by checking the execution result). Either of the
following results are acceptable

* Fails -> the driver detects this corruption.
* Succeeds and produces correct execution result -> the corruption
happens before saving to cache or after preparing from cache.

Due to the racy nature, this test is probabilistic and we run it several
times.

2. Similar to the TOCTOU test but replace the content between
compile-to-cache and compile-from-cache (once only).

Additionally, remove tmp cache directory if test succeeds.

Bug: 123433989
Test: VtsHalNeuralnetworksV1_xTargetTest with 1.2 sample driver
Test: VtsHalNeuralnetworksV1_xTargetTest with a test driver that can
      read and write cache entries
Test: Check /data/local/tmp and confirm that
      * dirs are preserved on failure
      * dirs are removed on success

Change-Id: Ie04fa905f465c3775979f0ca74359d185dcacea9
Merged-In: Ie04fa905f465c3775979f0ca74359d185dcacea9
(cherry picked from commit a44e130a92)
2019-05-09 15:44:28 -07:00
Xusong Wang
c9d90efcc7 Merge "Add quant8 variant of VTS CompilationCachingTest." into qt-dev 2019-05-09 22:38:54 +00:00
Michael Butler
353a624bd4 Follow up CL to "Add validation tests for NNAPI Burst serialized format"
Bug: 129779280
Bug: 129157135
Test: mma
Test: atest NeuralNetworksTest_static
Test: atest VtsHalNeuralnetworksV1_0TargetTest (with sample-all)
Test: atest VtsHalNeuralnetworksV1_1TargetTest (with sample-all)
Test: atest VtsHalNeuralnetworksV1_2TargetTest (with sample-all)
Change-Id: I6bd088f01c051a76561c0ecf9bbf878bb21c5754
Merged-In: I6bd088f01c051a76561c0ecf9bbf878bb21c5754
(cherry picked from commit 0a1ad962bb)
2019-05-08 22:46:10 +00:00