Fix a bug with cpu copy and simulation mode.

- if buffer was used on GPU it would be marked as non-updateable from CPU
- if we do CPU data transfer from the host, we however need to deliver data
to the buffer
- in such scenario mark such buffer for update in subsequent submissions.

Change-Id: Id3813c4193aa18917de117c61303fd6f62745abb
Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>
This commit is contained in:
Michal Mrozek
2020-02-10 13:44:22 +01:00
committed by sys_ocldev
parent e0dbb03b90
commit d2df43d169
2 changed files with 30 additions and 3 deletions

View File

@@ -85,6 +85,7 @@ void *CommandQueue::cpuDataTransferHandler(TransferProperties &transferPropertie
// read/write buffers are always blocking
if (!blockQueue || transferProperties.blocking) {
err.set(Event::waitForEvents(eventsRequest.numEventsInWaitList, eventsRequest.eventWaitList));
bool modifySimulationFlags = false;
if (outEventObj) {
outEventObj->setSubmitTimeStamp();
@@ -123,9 +124,7 @@ void *CommandQueue::cpuDataTransferHandler(TransferProperties &transferPropertie
eventCompleted = true;
}
if (!unmapInfo.readOnly) {
auto graphicsAllocation = transferProperties.memObj->getGraphicsAllocation();
graphicsAllocation->setAubWritable(true, GraphicsAllocation::defaultBank);
graphicsAllocation->setTbxWritable(true, GraphicsAllocation::defaultBank);
modifySimulationFlags = true;
}
break;
case CL_COMMAND_READ_BUFFER:
@@ -135,6 +134,7 @@ void *CommandQueue::cpuDataTransferHandler(TransferProperties &transferPropertie
case CL_COMMAND_WRITE_BUFFER:
memcpy_s(transferProperties.getCpuPtrForReadWrite(), transferProperties.size[0], transferProperties.ptr, transferProperties.size[0]);
eventCompleted = true;
modifySimulationFlags = true;
break;
case CL_COMMAND_MARKER:
break;
@@ -152,6 +152,11 @@ void *CommandQueue::cpuDataTransferHandler(TransferProperties &transferPropertie
outEventObj->updateExecutionStatus();
}
}
if (modifySimulationFlags) {
auto graphicsAllocation = transferProperties.memObj->getGraphicsAllocation();
graphicsAllocation->setAubWritable(true, GraphicsAllocation::defaultBank);
graphicsAllocation->setTbxWritable(true, GraphicsAllocation::defaultBank);
}
}
if (context->isProvidingPerformanceHints()) {