Commit graph

245 commits

Author SHA1 Message Date
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
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
Steven Moreland
6d494b2346 Merge "Update hidl makefiles for bpfmt" am: ff0bd741ca
am: 96f40f7b02

Change-Id: Idbf030e4993067bdb8181321bca2de00c9b6f7ef
2019-04-18 14:34:45 -07:00
Steven Moreland
ff0bd741ca Merge "Update hidl makefiles for bpfmt" 2019-04-18 20:59:48 +00:00
Viet Dang
014dd02f6e Merge "BidirectionalSequenceLSTM op: Fixes VTS test for merge_outputs" into qt-dev 2019-04-18 10:22:13 +00:00
Michael Butler
04878fd29a Fix IBurstCallback.hal typo
am: 248eaba9c1

Change-Id: I560703f4c19db1148411e094370a505c4e4e3d0c
2019-04-17 11:41:10 -07:00
Michael Butler
a1707a6b58 Fix IBurstCallback.hal typo
Test: mma
Bug: N/A
Change-Id: If753c6618c31a11672c4449f798fb57aa4bb7831
Merged-In: If753c6618c31a11672c4449f798fb57aa4bb7831
(cherry picked from commit f1ca6754a8)
(cherry picked from commit 24f9c4aa3f4e85d375da5e7df90b54bdf938b481)
2019-04-17 17:37:30 +00:00
Steven Moreland
1ae4615d9f Update hidl makefiles for bpfmt
hidl-generated makefiles are now generated such that bpfmt(file) == file.

Bug: 67417008
Test: enable bpfmt hook
Change-Id: I1f69d292bc23a7cc293a66110cb02d597e1019ad
2019-04-17 09:38:50 -07:00
Viet Dang
ea551fd12a BidirectionalSequenceLSTM op: Fixes VTS test for merge_outputs
Bug: 123644584

Test: VtsHalNeuralnetworksV1_xTargetTest
Change-Id: I8829fd47094ca4af05e5d60da917499ce61acc5e
Merged-In: I8829fd47094ca4af05e5d60da917499ce61acc5e
(cherry picked from commit a8f33f7dbf)
2019-04-17 15:49:05 +00:00
Michael Butler
248eaba9c1 Fix IBurstCallback.hal typo
Test: mma
Bug: 126892442
Change-Id: If753c6618c31a11672c4449f798fb57aa4bb7831
(cherry picked from commit f1ca6754a8)
2019-04-17 01:23:46 +00:00
Michael Butler
f1ca6754a8 Fix IBurstCallback.hal typo
Test: mma
Bug: N/A
Change-Id: If753c6618c31a11672c4449f798fb57aa4bb7831
2019-04-16 15:13:50 -07:00
Lev Proleev
6d13ba258b Fix docs: clarify usage of float16 scalars in operations
Update the docs for ops:
- LOG_SOFTMAX
- LOCAL_RESPONSE_NORMALIZATION

The docs mentioned possibility to use float16 as an input type but
didn't specify that other inputs must be float16 as well in that case.

Fix: 123500722
Test: mma
Change-Id: I9028c4a109c80f0b8571fab45555818e9e4bc783
2019-04-12 17:49:54 +01:00