Enable zero copy for enqueueReadBufferRect with hint

Change-Id: I4e7d89edfcff2674e7c163d70ad974d3464bf64f
This commit is contained in:
mplewka
2018-01-25 13:17:35 +01:00
parent 251de14ee6
commit 377fc8d20b
5 changed files with 276 additions and 2 deletions

View File

@@ -49,7 +49,31 @@ cl_int CommandQueueHw<GfxFamily>::enqueueReadBufferRect(
cl_event *event) {
MultiDispatchInfo dispatchInfo;
size_t bufferOffset;
size_t hostOffset;
computeOffsetsValueForRectCommands(&bufferOffset, &hostOffset, bufferOrigin, hostOrigin, region, bufferRowPitch, bufferSlicePitch, hostRowPitch, hostSlicePitch);
auto isMemTransferNeeded = buffer->checkIfMemoryTransferIsRequired(bufferOffset, hostOffset, ptr, CL_COMMAND_READ_BUFFER_RECT);
if (!isMemTransferNeeded) {
NullSurface s;
Surface *surfaces[] = {&s};
enqueueHandler<CL_COMMAND_MARKER>(
surfaces,
blockingRead == CL_TRUE,
dispatchInfo,
numEventsInWaitList,
eventWaitList,
event);
if (event) {
auto pEvent = castToObjectOrAbort<Event>(*event);
pEvent->setCmdType(CL_COMMAND_READ_BUFFER_RECT);
}
if (context->isProvidingPerformanceHints()) {
context->providePerformanceHint(CL_CONTEXT_DIAGNOSTICS_LEVEL_GOOD_INTEL, CL_ENQUEUE_READ_BUFFER_RECT_DOESNT_REQUIRES_COPY_DATA, static_cast<cl_mem>(buffer), ptr);
}
return CL_SUCCESS;
}
auto &builder = BuiltIns::getInstance().getBuiltinDispatchInfoBuilder(EBuiltInOps::CopyBufferRect,
this->getContext(), this->getDevice());
builder.takeOwnership(this->context);
@@ -88,4 +112,4 @@ cl_int CommandQueueHw<GfxFamily>::enqueueReadBufferRect(
return CL_SUCCESS;
}
}
} // namespace OCLRT