platform_hardware_interfaces/neuralnetworks/1.0
David Gross ce0048732a Make VtsHalNeuralnetworks* tests more binder-friendly.
Certain mutation testing -- mutateOperandLifeTimeTest and
mutateOperandInputOutputTest -- can introduce potentially very large
CONSTANT_COPY operands, which can in turn create potentially very
large Models which must be passed across binder.  To avoid overflowing
the binder buffer, we estimate the size of the mutated Model, and skip
the test if that size is too high.  The old logic recognizes that our
tests only have a single active binder transaction at a time, and
assumes that there are no other clients using the same service at the
same time, and so we should have the binder buffer to ourselves; to be
conservative, we reject any Model whose estimated size exceeds half
the binder buffer size.  Unfortunately, sometimes the binder buffer
still overflows, because it unexpectedly contains an allocation from
some other transaction: It appears that binder buffer memory
management is not serialized with respect to transactions from our
tests, and therefore depending on scheduler behavior, there may be a
sizeable allocation still in the buffer when we attempt to pass the
large Model.  To fix this problem we become even more conservative,
and instead of limiting the Model to half the binder buffer size, we
limit it to half IBinder.MAX_IPC_SIZE (the recommended transaction
size limit).  To confirm that this change does not exclude too many
tests, I checked how may times the size filter function
exceedsBinderSizeLimit is called, how many times it rejects a model
under the new logic (modelsExceedHalfMaxIPCSize), and how many times
it rejects a model under the old logic (modelsExceedHalfMaxIPCSize).

Test: VtsHalNeuralnetworksV1_0TargetTest --gtest_filter=TestGenerated/ValidationTest.Test/*-*dsp*
Test: # models =  3592, modelsExceedHalfMaxIPCSize = 212, modelsExceedHalfBufferSize = 18
Test: VtsHalNeuralnetworksV1_1TargetTest --gtest_filter=TestGenerated/ValidationTest.Test/*-*dsp*
Test: # models =  7228, modelsExceedHalfMaxIPCSize = 330, modelsExceedHalfBufferSize = 28
Test: VtsHalNeuralnetworksV1_2TargetTest --gtest_filter=TestGenerated/ValidationTest.Test/*-*dsp*
Test: # models = 52072, modelsExceedHalfMaxIPCSize = 506, modelsExceedHalfBufferSize = 28
Test: VtsHalNeuralnetworksV1_3TargetTest --gtest_filter=TestGenerated/ValidationTest.Test/*-*dsp*
Test: # models = 73342, modelsExceedHalfMaxIPCSize = 568, modelsExceedHalfBufferSize = 28
Test: VtsHalNeuralnetworksTargetTest

Bug: 227719657
Bug: 227719752
Bug: 231928847
Bug: 238777741
Bug: 242271308

Merged-In: I3f81d71ca3c0ad4c639096b1dc034a8909bc8971
Change-Id: I3f81d71ca3c0ad4c639096b1dc034a8909bc8971
(cherry picked from commit 79324920f7)
2022-08-31 23:02:26 +00:00
..
utils Move NN_TRY macro out of struct initialization 2022-04-28 22:05:37 +00:00
vts/functional Make VtsHalNeuralnetworks* tests more binder-friendly. 2022-08-31 23:02:26 +00:00
Android.bp [LSC] Add LOCAL_LICENSE_KINDS to hardware/interfaces 2021-02-21 20:36:55 -08:00
IDevice.hal Fix documentation. 2018-04-12 19:16:25 +00:00
IExecutionCallback.hal Sync NNAPI Operand and Operation documentation fixes 2018-04-18 19:08:17 +00:00
IPreparedModel.hal "successful preparation means successful execution" guarantee neglects bad operation inputs 2019-09-12 14:27:35 -07:00
IPreparedModelCallback.hal NNAPI HAL: Change IEvent to explicit callbacks 2017-10-03 18:01:29 +00:00
types.hal Non ABI changes to neuralnetworks HAL 2021-02-22 17:24:43 +00:00
types.t Move NNAPI type information to types.spec 2021-03-17 13:32:50 +00:00