diff --git a/opencl/source/command_queue/command_queue.cpp b/opencl/source/command_queue/command_queue.cpp index 891f260cae..af2acba213 100644 --- a/opencl/source/command_queue/command_queue.cpp +++ b/opencl/source/command_queue/command_queue.cpp @@ -155,14 +155,6 @@ void CommandQueue::initializeGpgpuInternals() const { auto &hwHelper = NEO::HwHelper::get(hwInfo.platform.eRenderCoreFamily); const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily); - if (getCmdQueueProperties(propertiesVector.data(), CL_QUEUE_PROPERTIES) & static_cast(CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)) { - this->gpgpuEngine->commandStreamReceiver->overrideDispatchPolicy(DispatchMode::BatchedDispatch); - if (DebugManager.flags.CsrDispatchMode.get() != 0) { - this->gpgpuEngine->commandStreamReceiver->overrideDispatchPolicy(static_cast(DebugManager.flags.CsrDispatchMode.get())); - } - this->gpgpuEngine->commandStreamReceiver->enableNTo1SubmissionModel(); - } - if (device->getDevice().getDebugger() && !this->gpgpuEngine->commandStreamReceiver->getDebugSurfaceAllocation()) { auto maxDbgSurfaceSize = hwHelper.getSipKernelMaxDbgSurfaceSize(hwInfo); auto debugSurface = this->gpgpuEngine->commandStreamReceiver->allocateDebugSurface(maxDbgSurfaceSize); @@ -178,6 +170,14 @@ void CommandQueue::initializeGpgpuInternals() const { gpgpuEngine->osContext->ensureContextInitialized(); gpgpuEngine->commandStreamReceiver->initDirectSubmission(); + + if (getCmdQueueProperties(propertiesVector.data(), CL_QUEUE_PROPERTIES) & static_cast(CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE) && !this->gpgpuEngine->commandStreamReceiver->isUpdateTagFromWaitEnabled()) { + this->gpgpuEngine->commandStreamReceiver->overrideDispatchPolicy(DispatchMode::BatchedDispatch); + if (DebugManager.flags.CsrDispatchMode.get() != 0) { + this->gpgpuEngine->commandStreamReceiver->overrideDispatchPolicy(static_cast(DebugManager.flags.CsrDispatchMode.get())); + } + this->gpgpuEngine->commandStreamReceiver->enableNTo1SubmissionModel(); + } } CommandStreamReceiver &CommandQueue::getGpgpuCommandStreamReceiver() const { diff --git a/opencl/test/unit_test/api/cl_create_command_queue_tests.inl b/opencl/test/unit_test/api/cl_create_command_queue_tests.inl index e037b34390..7e7c260e89 100644 --- a/opencl/test/unit_test/api/cl_create_command_queue_tests.inl +++ b/opencl/test/unit_test/api/cl_create_command_queue_tests.inl @@ -85,6 +85,24 @@ HWTEST_F(clCreateCommandQueueTest, GivenOoqParametersWhenQueueIsCreatedThenComma retVal = clReleaseCommandQueue(cmdq); } +HWTEST_F(clCreateCommandQueueTest, GivenOoqParametersWhenQueueIsCreatedAndUpdateTaskCountFromWaitEnabledThenCommandStreamReceiverDoesntSwitchToBatchingMode) { + DebugManagerStateRestore restorer; + DebugManager.flags.UpdateTaskCountFromWait.set(3); + + using BaseType = typename CommandQueue::BaseType; + cl_int retVal = CL_SUCCESS; + cl_queue_properties ooq = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE; + auto clDevice = castToObject(testedClDevice); + auto mockDevice = reinterpret_cast(&clDevice->getDevice()); + auto &csr = mockDevice->getUltCommandStreamReceiver(); + EXPECT_EQ(DispatchMode::ImmediateDispatch, csr.dispatchMode); + + auto cmdq = clCreateCommandQueue(pContext, testedClDevice, ooq, &retVal); + auto queue = castToObject(static_cast(cmdq)); + EXPECT_EQ(DispatchMode::ImmediateDispatch, queue->getGpgpuCommandStreamReceiver().getDispatchMode()); + retVal = clReleaseCommandQueue(cmdq); +} + HWTEST_F(clCreateCommandQueueTest, GivenForcedDispatchModeAndOoqParametersWhenQueueIsCreatedThenCommandStreamReceiverDoesntSwitchToBatchingMode) { DebugManagerStateRestore restorer; DebugManager.flags.CsrDispatchMode.set(static_cast(DispatchMode::ImmediateDispatch));