Handle TimestamPacket with implicit dependencies ownership

Change-Id: I22a4de4e9eb904c359583e235e0de54a7c743e07
Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz
2018-09-25 15:44:43 -07:00
committed by sys_ocldev
parent 7ddf1d554b
commit cbd017d495
25 changed files with 352 additions and 48 deletions

View File

@@ -20,6 +20,7 @@
#include "runtime/helpers/get_info.h"
#include "runtime/helpers/mipmap.h"
#include "runtime/helpers/options.h"
#include "runtime/helpers/kernel_commands.h"
#include "runtime/helpers/ptr_math.h"
#include "runtime/helpers/timestamp_packet.h"
#include "runtime/mem_obj/buffer.h"

View File

@@ -250,8 +250,14 @@ LinearStream &getCommandStream(CommandQueue &commandQueue, cl_uint numEventsInWa
expectedSizeCS += EnqueueOperation<GfxFamily>::getSizeRequiredCS(eventType, reserveProfilingCmdsSpace, reservePerfCounterCmdsSpace, commandQueue, &scheduler);
}
if (commandQueue.getDevice().getCommandStreamReceiver().peekTimestampPacketWriteEnabled()) {
auto semaphoreSize = sizeof(typename GfxFamily::MI_SEMAPHORE_WAIT);
auto atomicSize = sizeof(typename GfxFamily::MI_ATOMIC);
expectedSizeCS += EnqueueOperation<GfxFamily>::getSizeRequiredForTimestampPacketWrite();
expectedSizeCS += (numEventsInWaitList + 1) * sizeof(typename GfxFamily::MI_SEMAPHORE_WAIT);
expectedSizeCS += numEventsInWaitList * (semaphoreSize + atomicSize);
if (!commandQueue.isOOQEnabled()) {
expectedSizeCS += semaphoreSize + atomicSize;
}
}
return commandQueue.getCS(expectedSizeCS);
}

View File

@@ -457,11 +457,8 @@ inline void GpgpuWalkerHelper<GfxFamily>::dispatchOnDeviceWaitlistSemaphores(Lin
if (event->isUserEvent() || (&event->getCommandQueue()->getDevice() != &currentDevice)) {
continue;
}
auto timestampPacket = event->getTimestampPacketNode()->tag;
auto compareAddress = timestampPacket->pickAddressForDataWrite(TimestampPacket::DataIndex::ContextEnd);
KernelCommandsHelper<GfxFamily>::programMiSemaphoreWait(*commandStream, compareAddress, 1);
TimestmapPacketHelper::programSemaphoreWithImplicitDependency<GfxFamily>(*commandStream, *event->getTimestampPacketNode()->tag);
}
}
@@ -472,20 +469,16 @@ void GpgpuWalkerHelper<GfxFamily>::setupTimestampPacket(
TimestampPacket *timestampPacket,
TimestampPacket::WriteOperationType writeOperationType) {
uint64_t address;
if (TimestampPacket::WriteOperationType::BeforeWalker == writeOperationType) {
address = timestampPacket->pickAddressForDataWrite(TimestampPacket::DataIndex::Submit);
} else {
address = timestampPacket->pickAddressForDataWrite(TimestampPacket::DataIndex::ContextEnd);
if (TimestampPacket::WriteOperationType::AfterWalker == writeOperationType) {
uint64_t address = timestampPacket->pickAddressForDataWrite(TimestampPacket::DataIndex::ContextEnd);
auto pipeControlCmd = cmdStream->getSpaceForCmd<PIPE_CONTROL>();
*pipeControlCmd = PIPE_CONTROL::sInit();
pipeControlCmd->setCommandStreamerStallEnable(true);
pipeControlCmd->setPostSyncOperation(PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA);
pipeControlCmd->setAddress(static_cast<uint32_t>(address & 0x0000FFFFFFFFULL));
pipeControlCmd->setAddressHigh(static_cast<uint32_t>(address >> 32));
pipeControlCmd->setImmediateData(0);
}
auto pipeControlCmd = cmdStream->getSpaceForCmd<PIPE_CONTROL>();
*pipeControlCmd = PIPE_CONTROL::sInit();
pipeControlCmd->setCommandStreamerStallEnable(true);
pipeControlCmd->setPostSyncOperation(PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA);
pipeControlCmd->setAddress(static_cast<uint32_t>(address & 0x0000FFFFFFFFULL));
pipeControlCmd->setAddressHigh(static_cast<uint32_t>(address >> 32));
pipeControlCmd->setImmediateData(0);
}
template <typename GfxFamily>
@@ -740,7 +733,7 @@ size_t EnqueueOperation<GfxFamily>::getSizeRequiredCSNonKernel(bool reserveProfi
template <typename GfxFamily>
size_t EnqueueOperation<GfxFamily>::getSizeRequiredForTimestampPacketWrite() {
return 2 * sizeof(PIPE_CONTROL);
return sizeof(PIPE_CONTROL);
}
} // namespace OCLRT

View File

@@ -84,8 +84,7 @@ void HardwareInterface<GfxFamily>::dispatchWalker(
GpgpuWalkerHelper<GfxFamily>::dispatchOnDeviceWaitlistSemaphores(commandStream, commandQueue.getDevice(),
numEventsInWaitList, eventWaitList);
if (previousTimestampPacketNode) {
auto compareAddress = previousTimestampPacketNode->tag->pickAddressForDataWrite(TimestampPacket::DataIndex::ContextEnd);
KernelCommandsHelper<GfxFamily>::programMiSemaphoreWait(*commandStream, compareAddress, 1);
TimestmapPacketHelper::programSemaphoreWithImplicitDependency<GfxFamily>(*commandStream, *previousTimestampPacketNode->tag);
}
}