[1/n] Refactor CPU copies.

- remove waitlist check from buffer
- refactor the flow in CommandQueue::bufferCpuCopyAllowed

Change-Id: I52bb7f886211b05f80118665bb28dfdb5f113fe7
This commit is contained in:
Michal Mrozek
2020-02-21 08:25:43 +01:00
committed by sys_ocldev
parent 656a6cfe8c
commit bd1ac55e2c
5 changed files with 39 additions and 24 deletions

View File

@@ -553,9 +553,26 @@ bool CommandQueue::bufferCpuCopyAllowed(Buffer *buffer, cl_command_type commandT
bool debugVariableSet = (CL_COMMAND_READ_BUFFER == commandType && DebugManager.flags.DoCpuCopyOnReadBuffer.get()) ||
(CL_COMMAND_WRITE_BUFFER == commandType && DebugManager.flags.DoCpuCopyOnWriteBuffer.get());
return (debugVariableSet && !Event::checkUserEventDependencies(numEventsInWaitList, eventWaitList) &&
buffer->getGraphicsAllocation()->getAllocationType() != GraphicsAllocation::AllocationType::BUFFER_COMPRESSED) ||
buffer->isReadWriteOnCpuAllowed(blocking, numEventsInWaitList, ptr, size);
//if we are blocked by user events, we can't service the call on CPU
if (Event::checkUserEventDependencies(numEventsInWaitList, eventWaitList)) {
return false;
}
if (debugVariableSet && buffer->getGraphicsAllocation()->getAllocationType() != GraphicsAllocation::AllocationType::BUFFER_COMPRESSED) {
return true;
}
//check if buffer is compatible
if (!buffer->isReadWriteOnCpuAllowed(blocking, ptr, size)) {
return false;
}
//make sure that event wait list is empty
if (numEventsInWaitList == 0) {
return true;
}
return false;
}
bool CommandQueue::queueDependenciesClearRequired() const {