Timestamp Packet ownership

- Tag allocator: reference count tracking
- Obtain tag by command queue and pass to Event if exist during enqueue
- Handle Timestamp Packet lifetime on Event and CmdQueue destruction

Change-Id: I9a5969830ea7a9d729e6f70519d8c28ff70fcf06
Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz
2018-08-28 14:11:25 +02:00
committed by sys_ocldev
parent b49101803c
commit da0f9381dc
11 changed files with 174 additions and 27 deletions

View File

@@ -36,6 +36,7 @@
#include "runtime/helpers/mipmap.h"
#include "runtime/helpers/options.h"
#include "runtime/helpers/ptr_math.h"
#include "runtime/helpers/timestamp_packet.h"
#include "runtime/mem_obj/buffer.h"
#include "runtime/mem_obj/image.h"
#include "runtime/helpers/surface_formats.h"
@@ -43,6 +44,7 @@
#include "runtime/helpers/string.h"
#include "CL/cl_ext.h"
#include "runtime/utilities/api_intercept.h"
#include "runtime/utilities/tag_allocator.h"
#include "runtime/helpers/convert_color.h"
#include "runtime/helpers/queue_helpers.h"
#include <map>
@@ -102,6 +104,10 @@ CommandQueue::~CommandQueue() {
auto memoryManager = device->getMemoryManager();
DEBUG_BREAK_IF(nullptr == memoryManager);
if (timestampPacketNode) {
memoryManager->getTimestampPacketAllocator()->returnTag(timestampPacketNode);
}
if (commandStream && commandStream->getGraphicsAllocation()) {
memoryManager->storeAllocation(std::unique_ptr<GraphicsAllocation>(commandStream->getGraphicsAllocation()), REUSABLE_ALLOCATION);
commandStream->replaceGraphicsAllocation(nullptr);
@@ -604,4 +610,13 @@ void CommandQueue::dispatchAuxTranslation(MultiDispatchInfo &multiDispatchInfo,
builder.buildDispatchInfos(multiDispatchInfo, dispatchParams);
}
void CommandQueue::obtainNewTimestampPacketNode() {
auto allocator = device->getMemoryManager()->getTimestampPacketAllocator();
if (timestampPacketNode) {
allocator->returnTag(timestampPacketNode);
}
timestampPacketNode = allocator->getTag();
}
} // namespace OCLRT