// Does the inference.
runtime.EnqueueWorkload(netId, inputTensors, outputTensors);
- // Get readable buffer for inference timeline
- auto inferenceReadableBuffer = bufferManager.GetReadableBuffer();
- BOOST_CHECK(inferenceReadableBuffer != nullptr);
+ // Get readable buffer for input workload
+ auto inputReadableBuffer = bufferManager.GetReadableBuffer();
+ BOOST_CHECK(inputReadableBuffer != nullptr);
// Get readable buffer for output workload
auto outputReadableBuffer = bufferManager.GetReadableBuffer();
BOOST_CHECK(outputReadableBuffer != nullptr);
- // Get readable buffer for input workload
- auto inputReadableBuffer = bufferManager.GetReadableBuffer();
- BOOST_CHECK(inputReadableBuffer != nullptr);
+ // Get readable buffer for inference timeline
+ auto inferenceReadableBuffer = bufferManager.GetReadableBuffer();
+ BOOST_CHECK(inferenceReadableBuffer != nullptr);
// Validate input workload data
size = inputReadableBuffer->GetSize();
std::unique_lock<std::mutex> readableListLock(m_ReadableMutex, std::defer_lock);
packetBuffer->Commit(size);
readableListLock.lock();
- m_ReadableList.push_back(std::move(packetBuffer));
+ m_ReadableList.push(std::move(packetBuffer));
readableListLock.unlock();
if (notifyConsumer)
IPacketBufferPtr buffer = std::make_unique<PacketBuffer>(m_MaxBufferSize);
m_AvailableList.emplace_back(std::move(buffer));
}
- m_ReadableList.reserve(m_NumberOfBuffers);
}
void BufferManager::Release(IPacketBufferPtr& packetBuffer)
std::lock_guard<std::mutex> availableListLock(m_AvailableMutex);
m_AvailableList.clear();
- m_ReadableList.clear();
+ std::queue<IPacketBufferPtr>().swap(m_ReadableList);
Initialize();
}
std::unique_lock<std::mutex> readableListLock(m_ReadableMutex);
if (!m_ReadableList.empty())
{
- IPacketBufferPtr buffer = std::move(m_ReadableList.back());
- m_ReadableList.pop_back();
+ IPacketBufferPtr buffer = std::move(m_ReadableList.front());
+ m_ReadableList.pop();
readableListLock.unlock();
return buffer;
}
#include <condition_variable>
#include <mutex>
#include <vector>
+#include <queue>
namespace armnn
{
std::vector<IPacketBufferPtr> m_AvailableList;
// List of readable packet buffers
- std::vector<IPacketBufferPtr> m_ReadableList;
+ std::queue<IPacketBufferPtr> m_ReadableList;
// Mutex for available packet buffer list
std::mutex m_AvailableMutex;
// Does the inference.
runtime.EnqueueWorkload(netId, inputTensors, outputTensors);
- // Get readable buffer for inference timeline
- auto inferenceReadableBuffer = bufferManager.GetReadableBuffer();
- BOOST_CHECK(inferenceReadableBuffer != nullptr);
+ // Get readable buffer for input workload
+ auto inputReadableBuffer = bufferManager.GetReadableBuffer();
+ BOOST_CHECK(inputReadableBuffer != nullptr);
// Get readable buffer for output workload
auto outputReadableBuffer = bufferManager.GetReadableBuffer();
BOOST_CHECK(outputReadableBuffer != nullptr);
- // Get readable buffer for input workload
- auto inputReadableBuffer = bufferManager.GetReadableBuffer();
- BOOST_CHECK(inputReadableBuffer != nullptr);
+ // Get readable buffer for inference timeline
+ auto inferenceReadableBuffer = bufferManager.GetReadableBuffer();
+ BOOST_CHECK(inferenceReadableBuffer != nullptr);
// Validate input workload data
size = inputReadableBuffer->GetSize();