Don't copy compressed buffer on CPU

Change-Id: I9c36ee8f23284286bb846fd9a0fd196733d0f8f9
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2019-04-03 13:15:07 +02:00
parent 3c8b3e9633
commit f76c0e84fb
6 changed files with 94 additions and 4 deletions

View File

@@ -304,7 +304,7 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
cl_event *oclEvent,
cl_uint cmdType);
void *cpuDataTransferHandler(TransferProperties &transferProperties, EventsRequest &eventsRequest, cl_int &retVal);
MOCKABLE_VIRTUAL void *cpuDataTransferHandler(TransferProperties &transferProperties, EventsRequest &eventsRequest, cl_int &retVal);
virtual cl_int finish(bool dcFlush) { return CL_SUCCESS; }

View File

@@ -36,7 +36,8 @@ cl_int CommandQueueHw<GfxFamily>::enqueueReadBuffer(
cl_int retVal = CL_SUCCESS;
bool isMemTransferNeeded = buffer->isMemObjZeroCopy() ? buffer->checkIfMemoryTransferIsRequired(offset, 0, ptr, CL_COMMAND_READ_BUFFER) : true;
if (((DebugManager.flags.DoCpuCopyOnReadBuffer.get() && !Event::checkUserEventDependencies(numEventsInWaitList, eventWaitList)) ||
if (((DebugManager.flags.DoCpuCopyOnReadBuffer.get() && !Event::checkUserEventDependencies(numEventsInWaitList, eventWaitList) &&
buffer->getGraphicsAllocation()->getAllocationType() != GraphicsAllocation::AllocationType::BUFFER_COMPRESSED) ||
buffer->isReadWriteOnCpuAllowed(blockingRead, numEventsInWaitList, ptr, size)) &&
context->getDevice(0)->getDeviceInfo().cpuCopyAllowed) {
if (!isMemTransferNeeded) {

View File

@@ -33,7 +33,8 @@ cl_int CommandQueueHw<GfxFamily>::enqueueWriteBuffer(
cl_int retVal = CL_SUCCESS;
auto isMemTransferNeeded = buffer->isMemObjZeroCopy() ? buffer->checkIfMemoryTransferIsRequired(offset, 0, ptr, CL_COMMAND_READ_BUFFER) : true;
if (((DebugManager.flags.DoCpuCopyOnWriteBuffer.get() && !Event::checkUserEventDependencies(numEventsInWaitList, eventWaitList)) ||
if (((DebugManager.flags.DoCpuCopyOnWriteBuffer.get() && !Event::checkUserEventDependencies(numEventsInWaitList, eventWaitList) &&
buffer->getGraphicsAllocation()->getAllocationType() != GraphicsAllocation::AllocationType::BUFFER_COMPRESSED) ||
buffer->isReadWriteOnCpuAllowed(blockingWrite, numEventsInWaitList, const_cast<void *>(ptr), size)) &&
context->getDevice(0)->getDeviceInfo().cpuCopyAllowed) {
if (!isMemTransferNeeded) {