diff --git a/opencl/source/command_queue/enqueue_common.h b/opencl/source/command_queue/enqueue_common.h index 666792b857..e37d3c2f8d 100644 --- a/opencl/source/command_queue/enqueue_common.h +++ b/opencl/source/command_queue/enqueue_common.h @@ -1406,8 +1406,12 @@ cl_int CommandQueueHw::enqueueBlit(const MultiDispatchInfo &multiDisp bcsCsr.ensurePrimaryCsrInitialized(this->device->getDevice()); } + TakeOwnershipWrapper> queueOwnership(*this); auto bcsCommandStreamReceiverOwnership = bcsCsr.obtainUniqueOwnership(); std::unique_lock commandStreamReceiverOwnership; + if (debugManager.flags.ForceCsrLockInBcsEnqueueOnlyForGpgpuSubmission.get() != 1) { + commandStreamReceiverOwnership = getGpgpuCommandStreamReceiver().obtainUniqueOwnership(); + } registerBcsCsrClient(bcsCsr); @@ -1427,10 +1431,6 @@ cl_int CommandQueueHw::enqueueBlit(const MultiDispatchInfo &multiDisp const bool profilingEnabled = isProfilingEnabled() && pEventBuilder->getEvent(); std::unique_ptr blockedCommandsData; - TakeOwnershipWrapper> queueOwnership(*this); - if (debugManager.flags.ForceCsrLockInBcsEnqueueOnlyForGpgpuSubmission.get() != 1) { - commandStreamReceiverOwnership = getGpgpuCommandStreamReceiver().obtainUniqueOwnership(); - } auto blockQueue = false; bool migratedMemory = false;