diff --git a/runtime/command_queue/enqueue_common.h b/runtime/command_queue/enqueue_common.h index d0a16f7777..e56da3cf4c 100644 --- a/runtime/command_queue/enqueue_common.h +++ b/runtime/command_queue/enqueue_common.h @@ -583,7 +583,8 @@ CompletionStamp CommandQueueHw::enqueueNonBlocked( dispatchFlags.GSBA32BitRequired = commandType == CL_COMMAND_NDRANGE_KERNEL; dispatchFlags.mediaSamplerRequired = mediaSamplerRequired; dispatchFlags.requiresCoherency = requiresCoherency; - dispatchFlags.lowPriority = priority == QueuePriority::LOW; + dispatchFlags.lowPriority = (QueuePriority::LOW == priority); + dispatchFlags.throttle = getThrottle(); dispatchFlags.implicitFlush = implicitFlush; dispatchFlags.flushStampReference = this->flushStamp->getStampReference(); dispatchFlags.preemptionMode = PreemptionHelper::taskPreemptionMode(*device, multiDispatchInfo); diff --git a/unit_tests/command_stream/command_stream_receiver_flush_task_3_tests.cpp b/unit_tests/command_stream/command_stream_receiver_flush_task_3_tests.cpp index 38772e6bb7..e3fe8c3a2a 100644 --- a/unit_tests/command_stream/command_stream_receiver_flush_task_3_tests.cpp +++ b/unit_tests/command_stream/command_stream_receiver_flush_task_3_tests.cpp @@ -5,12 +5,14 @@ * */ +#include "runtime/mem_obj/buffer.h" #include "runtime/memory_manager/internal_allocation_storage.h" #include "runtime/memory_manager/memory_manager.h" #include "test.h" #include "unit_tests/fixtures/ult_command_stream_receiver_fixture.h" #include "unit_tests/helpers/debug_manager_state_restore.h" #include "unit_tests/mocks/mock_command_queue.h" +#include "unit_tests/mocks/mock_context.h" #include "unit_tests/mocks/mock_csr.h" #include "unit_tests/mocks/mock_submissions_aggregator.h" @@ -1281,6 +1283,23 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDispatchFlagsWithThrottleSetT EXPECT_EQ(cmdBuffer->batchBuffer.throttle, QueueThrottle::MEDIUM); } +HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCommandQueueWithThrottleHintWhenFlushingThenPassThrottleHintToCsr) { + MockContext context(pDevice); + cl_queue_properties properties[] = {CL_QUEUE_THROTTLE_KHR, CL_QUEUE_THROTTLE_LOW_KHR, 0}; + CommandQueueHw commandQueue(&context, pDevice, properties); + + auto mockCsr = new MockCsrHw2(*platformDevices[0], *pDevice->executionEnvironment); + pDevice->resetCommandStreamReceiver(mockCsr); + + cl_int retVal = CL_SUCCESS; + auto buffer = std::unique_ptr(Buffer::create(&context, 0, 1, nullptr, retVal)); + buffer->forceDisallowCPUCopy = true; + + uint32_t outPtr; + commandQueue.enqueueReadBuffer(buffer.get(), CL_TRUE, 0, 1, &outPtr, 0, nullptr, nullptr); + EXPECT_EQ(QueueThrottle::LOW, mockCsr->passedDispatchFlags.throttle); +} + HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDispatchFlagsWithThrottleSetToHighWhenFlushTaskIsCalledThenThrottleIsSetInBatchBuffer) { typedef typename FamilyType::MI_BATCH_BUFFER_END MI_BATCH_BUFFER_END; CommandQueueHw commandQueue(nullptr, pDevice, 0);