Commit graph

394 commits

Author SHA1 Message Date
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
c9d90efcc7 Merge "Add quant8 variant of VTS CompilationCachingTest." into qt-dev 2019-05-09 22:38:54 +00:00
Xusong Wang
35e7599eb2 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
2019-05-08 15:22:34 -07:00
Michael Butler
7b1c33dd07 Merge "Follow up CL to "Add validation tests for NNAPI Burst serialized format"" into qt-dev am: e84f442c4c
am: 720f869dd9

Change-Id: I2aa81b9466c42b995d0aab27184a42d8939980c5
2019-05-08 15:05:04 -07:00
Michael Butler
720f869dd9 Merge "Follow up CL to "Add validation tests for NNAPI Burst serialized format"" into qt-dev
am: e84f442c4c

Change-Id: I4f40772d30e3b0fa5aeb41edbf9a7d8a26d2ef51
2019-05-08 14:35:43 -07:00
Lev Proleev
41cb1c3265 Merge "Fix LSTM documentation" into qt-dev am: 881e261f0e
am: 9201bd34ca

Change-Id: Ie838e84c562e584fb5588ebc96cb259b439c2c54
2019-05-08 14:23:19 -07:00
Michael Butler
e84f442c4c Merge "Follow up CL to "Add validation tests for NNAPI Burst serialized format"" into qt-dev 2019-05-08 21:04:12 +00:00
Lev Proleev
9201bd34ca Merge "Fix LSTM documentation" into qt-dev
am: 881e261f0e

Change-Id: Iaae38e885aa2f60d9d39030b2db06e7039cc0872
2019-05-08 13:49:14 -07:00
Lev Proleev
e0537f09fb 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
2019-05-08 17:28:53 +01:00
Michael Butler
0a1ad962bb 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
2019-05-07 15:45:48 -07:00
Michael Butler
7dc791d1cd Merge "NNAPI: validate that FmqResultDatum padding is 0 -- VTS" into qt-dev am: 2cd02a4121
am: 557b9a9581

Change-Id: Ice778d3f6d5b31bc2d3e7f570b04196973fd2d63
2019-05-07 13:21:10 -07:00
Michael Butler
557b9a9581 Merge "NNAPI: validate that FmqResultDatum padding is 0 -- VTS" into qt-dev
am: 2cd02a4121

Change-Id: I6bbb1c4247ca7279edb35db1565afdb56b75f114
2019-05-07 12:54:12 -07:00
Michael Butler
ddb770f0e4 NNAPI: validate that FmqResultDatum padding is 0 -- VTS
FmqResultDatum::OperandInformation has padding that may not be
initialized by an NN HAL service instance. This CL adds a validation
check to ensure that services are not leaking uninitialized data through
this padding region.

Bug: 131356202
Test: mma
Test: atest VtsHalNeuralnetworksV1_2TargetTest
      (for ValidationTest with sample-all)
Test: altered sample-driver to randomly set a padding byte to 1;
      the new validation test successfully failed the test

Change-Id: I6661945392b3fc773493d8f2f306f29b39e09bab
2019-05-07 18:42:47 +00:00
Slava Shklyaev
796842078d Merge "Document that quantized PAD behavior is undefined before NNAPI 1.2" into qt-dev am: 7af01ada85
am: bb840a986a

Change-Id: Id09e8dc3a6ff6f9496274702be954cfd6209cf6b
2019-05-02 03:36:08 -07:00
Slava Shklyaev
bb840a986a Merge "Document that quantized PAD behavior is undefined before NNAPI 1.2" into qt-dev
am: 7af01ada85

Change-Id: Ie720d5e1010d5dfc40f7b05c212fa1e56a028a96
2019-05-02 03:31:09 -07:00
Michael Butler
b3b579659c Merge "Add validation tests for NNAPI Burst serialized format" into qt-dev am: ef85db2b65
am: 852820c4ed

Change-Id: I82295fb8c25f0a392ea8de449023f4a12368d954
2019-04-30 17:54:44 -07:00
Michael Butler
852820c4ed Merge "Add validation tests for NNAPI Burst serialized format" into qt-dev
am: ef85db2b65

Change-Id: I8c8cdab2b2ea67322601f7d35146430b555e821a
2019-04-30 14:05:38 -07:00
Slava Shklyaev
b01ce9644e Document that quantized PAD behavior is undefined before NNAPI 1.2
We had no tests for quantized PAD in NNAPI 1.1 and think that vendors might have implemented different behaviors.

Bug: 122243484
Test: N/A
Change-Id: Ibfc0801ab746fc271dc5f8efc764b818c6d49df4
2019-04-30 15:27:53 +01:00
Miao Wang
66c1e14e25 Merge "Fix the order of width and height for NNAPI RESIZE_BILINEAR and RESIZE_NEAREST_NEIGHBOR" into qt-dev am: e867be8b40
am: 0221549cfb

Change-Id: I795b47ee8e8a6640dcbfd69ea6a9606c003dffd4
2019-04-29 23:43:50 -07:00
Xusong Wang
35afac9757 Merge "Move getSupportedOperations out of saveToCache." into qt-dev am: 3ca195bf02
am: d49c50c270

Change-Id: I995d3ac2a416fb38483cd931bfd0489f2fa745d8
2019-04-29 23:15:33 -07:00
Miao Wang
0221549cfb Merge "Fix the order of width and height for NNAPI RESIZE_BILINEAR and RESIZE_NEAREST_NEIGHBOR" into qt-dev
am: e867be8b40

Change-Id: Ic98819efbddfba1be56fd4202806470aabdc29cf
2019-04-29 23:07:35 -07:00
Xusong Wang
d49c50c270 Merge "Move getSupportedOperations out of saveToCache." into qt-dev
am: 3ca195bf02

Change-Id: I391d730ee0c7d8965fe4066f303e8348d35013f8
2019-04-29 22:37:05 -07:00
Michael Butler
ef85db2b65 Merge "Add validation tests for NNAPI Burst serialized format" into qt-dev 2019-04-30 03:58:12 +00:00
TreeHugger Robot
e867be8b40 Merge "Fix the order of width and height for NNAPI RESIZE_BILINEAR and RESIZE_NEAREST_NEIGHBOR" into qt-dev 2019-04-30 03:23:31 +00:00
Miao Wang
286339b4c8 Fix the order of width and height for NNAPI RESIZE_BILINEAR and
RESIZE_NEAREST_NEIGHBOR

  - The CPU implementation always had the order of {width, height}.
  - In P, the documentation was incorrectly changed to {height, width}.

Bug: 131623949
Bug: 130035110
Test: mm
Change-Id: I6c79459fa73347fb51fc34a76ad78d5ac207f210
2019-04-30 00:06:17 +00:00
Michael Butler
20f28a24e9 Add validation tests for NNAPI Burst serialized format
This CL adds the following two types of validation tests on the NNAPI
Burst serialized format:
(1) it directly modifies the serialized data (invalidating it) to ensure
    that vendor  driver services properly validates the serialized
    request
(2) it ensures that vendor driver services properly fail when the result
    channel is not large enough to return the data

This CL additionally includes miscellaneous cleanups:
(1) having a generic "validateEverything" function
(2) moving the "prepareModel" function that's common across
    validateRequest and validateBurst to a common area

Fixes: 129779280
Bug: 129157135
Test: mma
Test: VtsHalNeuralnetworksV1_2TargetTest (with sample-all)
Change-Id: Ib90fe7f662824de17db5a254a8c501855e45f6bd
2019-04-29 23:56:48 +00:00
Xusong Wang
f8c5987bbd 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
2019-04-29 11:47:54 -07:00
Xusong Wang
988f9033ae Test corrupted data cache in CompilationCachingTests. am: 83ab17f224
am: 9f4cd602ec

Change-Id: I179aeb0816794c9f36a553d8adfd3baa1242c7c6
2019-04-26 19:19:53 -07:00
Xusong Wang
c3ecc2978b Test TOCTOU in VTS CompilationCachingTests. am: a44e130a92
am: 98bd9a6884

Change-Id: I05677c72259ccacdda8e05e041d74e0354c58228
2019-04-26 19:19:34 -07:00
Xusong Wang
9f4cd602ec Test corrupted data cache in CompilationCachingTests.
am: 83ab17f224

Change-Id: I25a761d0982a8eb4dc5b32d8925feab9f66f61a1
2019-04-26 19:08:43 -07:00
Xusong Wang
98bd9a6884 Test TOCTOU in VTS CompilationCachingTests.
am: a44e130a92

Change-Id: I2e55bfd50ae29981dbc2334b4dbc7dc8e43d02fa
2019-04-26 19:08:33 -07:00
Slava Shklyaev
8066e27ad8 Specify ranks supported by MAXIMUM and MINIMUM am: 6e15578156
am: e5c74550ac

Change-Id: Ide8e91f4f16d1f2cb2d3e2234396cac998c93eca
2019-04-26 16:45:43 -07:00
Slava Shklyaev
e5c74550ac Specify ranks supported by MAXIMUM and MINIMUM
am: 6e15578156

Change-Id: I98e4a1d9b83307967f68948c6f9c6f2a2ba14d43
2019-04-26 16:38:54 -07:00
Xusong Wang
83ab17f224 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
2019-04-26 15:35:03 -07:00
Xusong Wang
a44e130a92 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
2019-04-26 15:35:03 -07:00
Slava Shklyaev
6e15578156 Specify ranks supported by MAXIMUM and MINIMUM
Note that this change documents existing behavior.

Bug: 131210955
Test: mma
Change-Id: I8d877153e1acc8ca2ad5179d7fd7cdc136838ca3
2019-04-25 10:42:43 +00:00
Slava Shklyaev
dcf92d4e95 Merge "Fix docs: clarify usage of float16 scalars in operations" into qt-dev am: 34e718703d
am: 59342bedd4

Change-Id: Ibe40288e9812fc3385cc345578813ef28950ad42
2019-04-23 09:36:49 -07:00
Slava Shklyaev
b019708ace Merge changes Icd1ce2fb,I62087353 into qt-dev am: f22bc9099e
am: f189a0b2ef

Change-Id: I4e0bbd56cfd0d94a363702b7b764db1801279bc1
2019-04-23 09:30:34 -07:00
Slava Shklyaev
59342bedd4 Merge "Fix docs: clarify usage of float16 scalars in operations" into qt-dev
am: 34e718703d

Change-Id: I62baf5479fa4fb80b7c54de9eb574cd4b99a5f93
2019-04-23 09:22:31 -07:00
Slava Shklyaev
f189a0b2ef Merge changes Icd1ce2fb,I62087353 into qt-dev
am: f22bc9099e

Change-Id: I496e65cd536d3629eb1eb2a773855ddfa6fb7a6f
2019-04-23 09:12:59 -07:00
Slava Shklyaev
34e718703d Merge "Fix docs: clarify usage of float16 scalars in operations" into qt-dev 2019-04-23 14:26:21 +00:00
Slava Shklyaev
f22bc9099e Merge changes Icd1ce2fb,I62087353 into qt-dev
* changes:
  Clarify NNAPI documentation for MEAN
  Clarify NNAPI documentation for RESHAPE
2019-04-23 14:25:54 +00:00
Pirama Arumuga Nainar
b2d0eee0ed Merge "Re-enable asan for *VtsHalNeuralnetworksV1_0Test" am: 8e0b1c09b8 am: c1ac036a8c
am: 25dbab29d4

Change-Id: I64bcdcfb2d71e0c7400e0a143a7499ac15192980
2019-04-18 16:14:08 -07:00
Steven Moreland
efd67db7ac Merge "Update hidl makefiles for bpfmt" am: ff0bd741ca am: 96f40f7b02
am: 6d494b2346

Change-Id: I25d4f6591506e1a84a3a302dfec82f59c30e67a4
2019-04-18 15:32:26 -07:00
Pirama Arumuga Nainar
25dbab29d4 Merge "Re-enable asan for *VtsHalNeuralnetworksV1_0Test" am: 8e0b1c09b8
am: c1ac036a8c

Change-Id: Id81953761f60cc8d1b723a6c9023b682b9a78cba
2019-04-18 14:37:12 -07:00
Steven Moreland
6d494b2346 Merge "Update hidl makefiles for bpfmt" am: ff0bd741ca
am: 96f40f7b02

Change-Id: Idbf030e4993067bdb8181321bca2de00c9b6f7ef
2019-04-18 14:34:45 -07:00
Pirama Arumuga Nainar
8e0b1c09b8 Merge "Re-enable asan for *VtsHalNeuralnetworksV1_0Test" 2019-04-18 21:22:18 +00:00
Steven Moreland
ff0bd741ca Merge "Update hidl makefiles for bpfmt" 2019-04-18 20:59:48 +00:00