diff options
author | Michael Butler <butlermichael@google.com> | 2022-04-26 12:42:22 -0700 |
---|---|---|
committer | Michael Butler <butlermichael@google.com> | 2022-04-27 00:08:40 +0000 |
commit | d468abed9bbb7b1e5395ae84c07ce12ff0bec9e8 (patch) | |
tree | bccac26b8f7950621821e9de6fb72ca41fc2de57 /neuralnetworks | |
parent | cb1fd25a53b3d775c1e5d639695f44ad0eaa8565 (diff) |
Do not call releaseMemoryResource on ignored slot in NN VTS
For IBurst, a slot value of -1 indicates the slot should be ignored.
However, GeneratedTestHarness still attempts to call
IBurst::releaseMemoryResource on ignored slots. Instead, we should skip
releasing any ignored slots.
Bug: 230103381
Test: mma
Test: VtsHalNeuralnetworksTargetTest
Test: presubmit
Change-Id: I82e538aa0fd9e8ecc077df1c1ceece46a6166e67
Diffstat (limited to 'neuralnetworks')
-rw-r--r-- | neuralnetworks/aidl/vts/functional/GeneratedTestHarness.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/neuralnetworks/aidl/vts/functional/GeneratedTestHarness.cpp b/neuralnetworks/aidl/vts/functional/GeneratedTestHarness.cpp index 40f6cd1573..dcf8451919 100644 --- a/neuralnetworks/aidl/vts/functional/GeneratedTestHarness.cpp +++ b/neuralnetworks/aidl/vts/functional/GeneratedTestHarness.cpp @@ -659,6 +659,7 @@ void EvaluatePreparedModel(const std::shared_ptr<IDevice>& device, ASSERT_NE(nullptr, burst.get()); // associate a unique slot with each memory pool + constexpr int64_t kIgnoreSlot = -1; int64_t currentSlot = 0; std::vector<int64_t> slots; slots.reserve(request.pools.size()); @@ -667,7 +668,7 @@ void EvaluatePreparedModel(const std::shared_ptr<IDevice>& device, slots.push_back(currentSlot++); } else { EXPECT_EQ(pool.getTag(), RequestMemoryPool::Tag::token); - slots.push_back(-1); + slots.push_back(kIgnoreSlot); } } @@ -698,8 +699,10 @@ void EvaluatePreparedModel(const std::shared_ptr<IDevice>& device, // Mark each slot as unused after the execution. This is unnecessary because the // burst is freed after this scope ends, but this is here to test the functionality. for (int64_t slot : slots) { - ret = burst->releaseMemoryResource(slot); - ASSERT_TRUE(ret.isOk()) << ret.getDescription(); + if (slot != kIgnoreSlot) { + ret = burst->releaseMemoryResource(slot); + ASSERT_TRUE(ret.isOk()) << ret.getDescription(); + } } break; |