mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 15:53:45 +08:00
Initial support for enqueue blit operation
Change-Id: Iab37beeeb574243c00a5579568e15bcbd1307c43 Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com> Related-To: NEO-3020
This commit is contained in:
committed by
sys_ocldev
parent
031d865b59
commit
576005f7bb
@@ -583,4 +583,16 @@ bool CommandQueue::bufferCpuCopyAllowed(Buffer *buffer, cl_command_type commandT
|
||||
buffer->getGraphicsAllocation()->getAllocationType() != GraphicsAllocation::AllocationType::BUFFER_COMPRESSED) ||
|
||||
buffer->isReadWriteOnCpuAllowed(blocking, numEventsInWaitList, ptr, size);
|
||||
}
|
||||
|
||||
cl_int CommandQueue::enqueueReadWriteBufferWithBlitTransfer(cl_command_type commandType, Buffer *buffer,
|
||||
size_t offset, size_t size, void *ptr, cl_uint numEventsInWaitList,
|
||||
const cl_event *eventWaitList, cl_event *event) {
|
||||
CsrDependencies csrDependencies;
|
||||
auto blitCommandStreamReceiver = context->getCommandStreamReceiverForBlitOperation(*buffer);
|
||||
|
||||
auto copyDirection = (CL_COMMAND_WRITE_BUFFER == commandType) ? BlitterConstants::BlitWithHostPtrDirection::FromHostPtr
|
||||
: BlitterConstants::BlitWithHostPtrDirection::ToHostPtr;
|
||||
blitCommandStreamReceiver->blitWithHostPtr(*buffer, ptr, true, offset, size, copyDirection, csrDependencies);
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
} // namespace NEO
|
||||
|
||||
@@ -439,6 +439,10 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
|
||||
void *enqueueMapMemObject(TransferProperties &transferProperties, EventsRequest &eventsRequest, cl_int &errcodeRet);
|
||||
cl_int enqueueUnmapMemObject(TransferProperties &transferProperties, EventsRequest &eventsRequest);
|
||||
|
||||
cl_int enqueueReadWriteBufferWithBlitTransfer(cl_command_type commandType, Buffer *buffer,
|
||||
size_t offset, size_t size, void *ptr, cl_uint numEventsInWaitList,
|
||||
const cl_event *eventWaitList, cl_event *event);
|
||||
|
||||
virtual void obtainTaskLevelAndBlockedStatus(unsigned int &taskLevel, cl_uint &numEventsInWaitList, const cl_event *&eventWaitList, bool &blockQueue, unsigned int commandType){};
|
||||
|
||||
MOCKABLE_VIRTUAL void dispatchAuxTranslation(MultiDispatchInfo &multiDispatchInfo, MemObjsForAuxTranslation &memObjsForAuxTranslation,
|
||||
|
||||
@@ -40,6 +40,8 @@ cl_int CommandQueueHw<GfxFamily>::enqueueReadBuffer(
|
||||
bool isMemTransferNeeded = buffer->isMemObjZeroCopy() ? buffer->checkIfMemoryTransferIsRequired(offset, 0, ptr, CL_COMMAND_READ_BUFFER) : true;
|
||||
bool isCpuCopyAllowed = bufferCpuCopyAllowed(buffer, CL_COMMAND_READ_BUFFER, blockingRead, size, ptr,
|
||||
numEventsInWaitList, eventWaitList);
|
||||
bool blitOperationsSupported = device->getExecutionEnvironment()->getHardwareInfo()->capabilityTable.blitterOperationsSupported &&
|
||||
DebugManager.flags.EnableBlitterOperationsForReadWriteBuffers.get();
|
||||
|
||||
if (isCpuCopyAllowed) {
|
||||
if (isMemTransferNeeded) {
|
||||
@@ -52,6 +54,9 @@ cl_int CommandQueueHw<GfxFamily>::enqueueReadBuffer(
|
||||
} else if (!isMemTransferNeeded) {
|
||||
return enqueueMarkerForReadWriteOperation(buffer, ptr, CL_COMMAND_READ_BUFFER, blockingRead,
|
||||
numEventsInWaitList, eventWaitList, event);
|
||||
} else if (blitOperationsSupported) {
|
||||
return enqueueReadWriteBufferWithBlitTransfer(CL_COMMAND_READ_BUFFER, buffer, offset, size, ptr,
|
||||
numEventsInWaitList, eventWaitList, event);
|
||||
}
|
||||
|
||||
auto &builder = getDevice().getExecutionEnvironment()->getBuiltIns()->getBuiltinDispatchInfoBuilder(EBuiltInOps::CopyBufferToBuffer,
|
||||
|
||||
@@ -35,6 +35,8 @@ cl_int CommandQueueHw<GfxFamily>::enqueueWriteBuffer(
|
||||
auto isMemTransferNeeded = buffer->isMemObjZeroCopy() ? buffer->checkIfMemoryTransferIsRequired(offset, 0, ptr, CL_COMMAND_WRITE_BUFFER) : true;
|
||||
bool isCpuCopyAllowed = bufferCpuCopyAllowed(buffer, CL_COMMAND_WRITE_BUFFER, blockingWrite, size, const_cast<void *>(ptr),
|
||||
numEventsInWaitList, eventWaitList);
|
||||
bool blitOperationsSupported = device->getExecutionEnvironment()->getHardwareInfo()->capabilityTable.blitterOperationsSupported &&
|
||||
DebugManager.flags.EnableBlitterOperationsForReadWriteBuffers.get();
|
||||
|
||||
if (isCpuCopyAllowed) {
|
||||
if (isMemTransferNeeded) {
|
||||
@@ -47,6 +49,9 @@ cl_int CommandQueueHw<GfxFamily>::enqueueWriteBuffer(
|
||||
} else if (!isMemTransferNeeded) {
|
||||
return enqueueMarkerForReadWriteOperation(buffer, const_cast<void *>(ptr), CL_COMMAND_WRITE_BUFFER, blockingWrite,
|
||||
numEventsInWaitList, eventWaitList, event);
|
||||
} else if (blitOperationsSupported) {
|
||||
return enqueueReadWriteBufferWithBlitTransfer(CL_COMMAND_WRITE_BUFFER, buffer, offset, size, const_cast<void *>(ptr),
|
||||
numEventsInWaitList, eventWaitList, event);
|
||||
}
|
||||
|
||||
auto &builder = getDevice().getExecutionEnvironment()->getBuiltIns()->getBuiltinDispatchInfoBuilder(EBuiltInOps::CopyBufferToBuffer,
|
||||
|
||||
@@ -100,6 +100,7 @@ DECLARE_DEBUG_VARIABLE(bool, EnableExtendedVaFormats, false, "Enable more format
|
||||
DECLARE_DEBUG_VARIABLE(bool, AddClGlSharing, false, "Add cl-gl extension")
|
||||
DECLARE_DEBUG_VARIABLE(bool, EnablePassInlineData, false, "Enable passing of inline data")
|
||||
DECLARE_DEBUG_VARIABLE(bool, EnableFormatQuery, false, "Enable sharing format querying")
|
||||
DECLARE_DEBUG_VARIABLE(bool, EnableBlitterOperationsForReadWriteBuffers, false, "Use Blitter engine for Read/Write Buffers operations")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, EnableCacheFlushAfterWalker, 0, "-1: platform behavior, 0: disabled, 1: enabled. Adds dedicated cache flush command after WALKER command when surfaces used by kernel require to flush the cache")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, EnableLocalMemory, -1, "-1: default behavior, 0: disabled, 1: enabled, Allows allocating graphics memory in Local Memory")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, EnableStatelessToStatefulBufferOffsetOpt, -1, "-1: dont override, 0: disable, 1: enable, Enables buffer-offset improvement of the stateless to stateful optimization")
|
||||
|
||||
Reference in New Issue
Block a user