Create single point for selecting engine for builtin ops

- selectCsrForBuiltinOperation selects proper CSR
- selected CSR is passed to dispatchBcsOrGpgpuEnqueue
- Notifications such as notifyEnqueueReadBuffer are now made on correct engine
- Temporary allocs for hostptrs are now created on gpgpuCsr

Related-To: NEO-6057
Signed-off-by: Maciej Dziuban <maciej.dziuban@intel.com>
This commit is contained in:
Maciej Dziuban
2021-08-26 11:53:25 +00:00
committed by Compute-Runtime-Automation
parent e96f1afa6f
commit a03b5f8a95
28 changed files with 272 additions and 185 deletions

View File

@@ -36,12 +36,6 @@ cl_int CommandQueueHw<GfxFamily>::enqueueReadBuffer(
cl_event *event) {
const cl_command_type cmdType = CL_COMMAND_READ_BUFFER;
auto blitAllowed = blitEnqueueAllowed(cmdType);
auto &csr = getCommandStreamReceiver(blitAllowed);
if (nullptr == mapAllocation) {
notifyEnqueueReadBuffer(buffer, !!blockingRead, EngineHelpers::isBcs(csr.getOsContext().getEngineType()));
}
auto rootDeviceIndex = getDevice().getRootDeviceIndex();
bool isMemTransferNeeded = buffer->isMemObjZeroCopy() ? buffer->checkIfMemoryTransferIsRequired(offset, 0, ptr, cmdType) : true;
@@ -67,6 +61,9 @@ cl_int CommandQueueHw<GfxFamily>::enqueueReadBuffer(
}
if (isCpuCopyAllowed) {
if (nullptr == mapAllocation) {
notifyEnqueueReadBuffer(buffer, !!blockingRead, false);
}
if (isMemTransferNeeded) {
return enqueueReadWriteBufferOnCpuWithMemoryTransfer(cmdType, buffer, offset, size, ptr,
numEventsInWaitList, eventWaitList, event);
@@ -102,7 +99,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueReadBuffer(
} else {
surfaces[1] = &hostPtrSurf;
if (size != 0) {
bool status = csr.createAllocationForHostSurface(hostPtrSurf, true);
bool status = getGpgpuCommandStreamReceiver().createAllocationForHostSurface(hostPtrSurf, true);
if (!status) {
return CL_OUT_OF_RESOURCES;
}
@@ -128,7 +125,12 @@ cl_int CommandQueueHw<GfxFamily>::enqueueReadBuffer(
context->providePerformanceHint(CL_CONTEXT_DIAGNOSTICS_LEVEL_BAD_INTEL, CL_ENQUEUE_READ_BUFFER_DOESNT_MEET_ALIGNMENT_RESTRICTIONS, ptr, size, MemoryConstants::pageSize, MemoryConstants::pageSize);
}
}
dispatchBcsOrGpgpuEnqueue<CL_COMMAND_READ_BUFFER>(dispatchInfo, surfaces, eBuiltInOps, numEventsInWaitList, eventWaitList, event, blockingRead, blitAllowed);
CommandStreamReceiver &csr = selectCsrForBuiltinOperation(CL_COMMAND_READ_BUFFER, dispatchInfo);
if (nullptr == mapAllocation) {
notifyEnqueueReadBuffer(buffer, !!blockingRead, EngineHelpers::isBcs(csr.getOsContext().getEngineType()));
}
dispatchBcsOrGpgpuEnqueue<CL_COMMAND_READ_BUFFER>(dispatchInfo, surfaces, eBuiltInOps, numEventsInWaitList, eventWaitList, event, blockingRead, csr);
return CL_SUCCESS;
}