Fix NNAPI HIDL 1.3 VTS MemoryDomainExecutionTest

MemoryDomainTests.cpp#1131 in aosp/13591469 fixed a problem with
VtsHalNeuralnetworksTargetTest's MemoryDomainExecutionTest's
InvalidDimensions test where a dimension was doubled but the number of
bytes and size of shared memory did not double, but this change was not
ported to VtsHalNeuralnetworksV1_3TargetTest. This CL ports that fix to
VtsHalNeuralnetworksV1_3TargetTest.

Bug: 213197824
Test: mma
Test: VtsHalNeuralnetworksV1_3TargetTest
Change-Id: Ib7323e584c17ab230bde71487c0b94349701ec57
This commit is contained in:
Michael Butler 2021-12-31 09:36:23 -08:00
parent ceb3a960ed
commit 77414ebf5a

View file

@ -1158,12 +1158,15 @@ TEST_P(MemoryDomainExecutionTest, InvalidDimensions) {
auto [buffer, token] = allocateBuffer(preparedModel, {0}, {0}, kTestOperand.dimensions);
if (buffer == nullptr) return;
Request::MemoryPool sharedMemory = createSharedMemoryPool(kTestOperandDataSize);
Request::MemoryPool deviceMemory = createDeviceMemoryPool(token);
// Use an incompatible dimension and make sure the length matches with the bad dimension.
auto badDimensions = kTestOperand.dimensions;
badDimensions[0] = 2;
const uint32_t badTestOperandDataSize = kTestOperandDataSize * 2;
Request::MemoryPool sharedMemory = createSharedMemoryPool(badTestOperandDataSize);
Request::MemoryPool deviceMemory = createDeviceMemoryPool(token);
RequestArgument sharedMemoryArg = {
.location = {.poolIndex = 0, .offset = 0, .length = kTestOperandDataSize},
.location = {.poolIndex = 0, .offset = 0, .length = badTestOperandDataSize},
.dimensions = badDimensions};
RequestArgument deviceMemoryArg = {.location = {.poolIndex = 1}};
RequestArgument deviceMemoryArgWithBadDimensions = {.location = {.poolIndex = 1},