From 03f910466e3df9acda0cf831421793dc9993fcc9 Mon Sep 17 00:00:00 2001 From: Cencelewska Date: Fri, 13 Sep 2019 12:00:30 +0200 Subject: [PATCH] Remove default constructor of DispatchFlags Resolves: NEO-3394 Change-Id: I6d5d8e389e0680e698423e4e36b4f0d20d173522 Signed-off-by: Cencelewska --- runtime/command_queue/enqueue_common.h | 67 ++++++---- .../command_stream_receiver_hw_base.inl | 4 +- runtime/command_stream/csr_definitions.h | 26 +++- runtime/helpers/task_information.cpp | 90 ++++++++----- ...and_stream_receiver_flush_task_1_tests.cpp | 21 ++-- ...and_stream_receiver_flush_task_2_tests.cpp | 22 ++-- ...and_stream_receiver_flush_task_3_tests.cpp | 119 +++++++++--------- ...stream_receiver_flush_task_gmock_tests.cpp | 14 +-- .../command_stream_receiver_hw_tests.cpp | 7 +- .../ult_command_stream_receiver_fixture.h | 3 +- unit_tests/gen11/coherency_tests_gen11.cpp | 3 +- .../program_media_sampler_tests_gen11.cpp | 4 +- unit_tests/gen8/coherency_tests_gen8.cpp | 3 +- .../command_stream_receiver_hw_tests_gen8.cpp | 4 +- unit_tests/gen9/coherency_tests_gen9.cpp | 3 +- .../command_stream_receiver_hw_tests_gen9.cpp | 3 +- unit_tests/helpers/CMakeLists.txt | 1 + unit_tests/helpers/dispatch_flags_helper.h | 36 ++++++ unit_tests/helpers/timestamp_packet_tests.cpp | 9 +- .../libult/ult_command_stream_receiver.h | 7 +- unit_tests/mocks/mock_csr.h | 5 +- .../linux/drm_command_stream_tests.cpp | 9 +- .../windows/device_command_stream_tests.cpp | 12 +- unit_tests/preemption/preemption_tests.cpp | 4 +- .../source_level_debugger_csr_tests.cpp | 10 +- 25 files changed, 314 insertions(+), 172 deletions(-) create mode 100644 unit_tests/helpers/dispatch_flags_helper.h diff --git a/runtime/command_queue/enqueue_common.h b/runtime/command_queue/enqueue_common.h index 9ed76ba6fb..0674d5473e 100644 --- a/runtime/command_queue/enqueue_common.h +++ b/runtime/command_queue/enqueue_common.h @@ -670,27 +670,35 @@ CompletionStamp CommandQueueHw::enqueueNonBlocked( } } - DispatchFlags dispatchFlags; - dispatchFlags.blocking = blocking; - dispatchFlags.dcFlush = shouldFlushDC(commandType, printfHandler) || allocNeedsFlushDC; - dispatchFlags.useSLM = multiDispatchInfo.usesSlm() || multiDispatchInfo.peekParentKernel(); - dispatchFlags.guardCommandBufferWithPipeControl = true; - dispatchFlags.GSBA32BitRequired = commandType == CL_COMMAND_NDRANGE_KERNEL; + DispatchFlags dispatchFlags( + {}, //csrDependencies + {}, //pipelineSelectArgs + this->flushStamp->getStampReference(), //flushStampReference + getThrottle(), //throttle + PreemptionHelper::taskPreemptionMode(*device, multiDispatchInfo), //preemptionMode + numGrfRequired, //numGrfRequired + L3CachingSettings::l3CacheOn, //l3CacheSettings + blocking, //blocking + shouldFlushDC(commandType, printfHandler) || allocNeedsFlushDC, //dcFlush + multiDispatchInfo.usesSlm() || multiDispatchInfo.peekParentKernel(), //useSLM + true, //guardCommandBufferWithPipeControl + commandType == CL_COMMAND_NDRANGE_KERNEL, //GSBA32BitRequired + requiresCoherency, //requiresCoherency + (QueuePriority::LOW == priority), //lowPriority + implicitFlush, //implicitFlush + !eventBuilder.getEvent() || getGpgpuCommandStreamReceiver().isNTo1SubmissionModelEnabled(), //outOfOrderExecutionAllowed + this->multiEngineQueue, //multiEngineQueue + false //epilogueRequired + ); + dispatchFlags.pipelineSelectArgs.mediaSamplerRequired = mediaSamplerRequired; - dispatchFlags.requiresCoherency = requiresCoherency; - dispatchFlags.lowPriority = (QueuePriority::LOW == priority); - dispatchFlags.throttle = getThrottle(); - dispatchFlags.implicitFlush = implicitFlush; - dispatchFlags.flushStampReference = this->flushStamp->getStampReference(); - dispatchFlags.preemptionMode = PreemptionHelper::taskPreemptionMode(*device, multiDispatchInfo); - dispatchFlags.outOfOrderExecutionAllowed = !eventBuilder.getEvent() || getGpgpuCommandStreamReceiver().isNTo1SubmissionModelEnabled(); + dispatchFlags.pipelineSelectArgs.specialPipelineSelectMode = specialPipelineSelectMode; + if (getGpgpuCommandStreamReceiver().peekTimestampPacketWriteEnabled()) { dispatchFlags.csrDependencies.fillFromEventsRequest(eventsRequest, getGpgpuCommandStreamReceiver(), CsrDependencies::DependenciesType::OutOfCsr); dispatchFlags.csrDependencies.makeResident(getGpgpuCommandStreamReceiver()); } - dispatchFlags.numGrfRequired = numGrfRequired; - dispatchFlags.pipelineSelectArgs.specialPipelineSelectMode = specialPipelineSelectMode; - dispatchFlags.multiEngineQueue = this->multiEngineQueue; + DEBUG_BREAK_IF(taskLevel >= Event::eventNotReady); if (anyUncacheableArgs) { @@ -852,13 +860,26 @@ CompletionStamp CommandQueueHw::enqueueCommandWithoutKernel( bcsCsr->blitBuffer(*enqueueProperties.blitProperties); } - DispatchFlags dispatchFlags = {}; - dispatchFlags.blocking = blocking; - dispatchFlags.multiEngineQueue = multiEngineQueue; - dispatchFlags.preemptionMode = device->getPreemptionMode(); - dispatchFlags.implicitFlush = (enqueueProperties.operation == EnqueueProperties::Operation::Blit); - dispatchFlags.guardCommandBufferWithPipeControl = true; - dispatchFlags.outOfOrderExecutionAllowed = getGpgpuCommandStreamReceiver().isNTo1SubmissionModelEnabled(); + DispatchFlags dispatchFlags( + {}, //csrDependencies + {}, //pipelineSelectArgs + nullptr, //flushStampReference + QueueThrottle::MEDIUM, //throttle + device->getPreemptionMode(), //preemptionMode + GrfConfig::DefaultGrfNumber, //numGrfRequired + L3CachingSettings::l3CacheOn, //l3CacheSettings + blocking, //blocking + false, //dcFlush + false, //useSLM + true, //guardCommandBufferWithPipeControl + false, //GSBA32BitRequired + false, //requiresCoherency + false, //lowPriority + (enqueueProperties.operation == EnqueueProperties::Operation::Blit), //implicitFlush + getGpgpuCommandStreamReceiver().isNTo1SubmissionModelEnabled(), //outOfOrderExecutionAllowed + multiEngineQueue, //multiEngineQueue + false //epilogueRequired + ); if (getGpgpuCommandStreamReceiver().peekTimestampPacketWriteEnabled()) { dispatchFlags.csrDependencies.fillFromEventsRequest(eventsRequest, getGpgpuCommandStreamReceiver(), CsrDependencies::DependenciesType::OutOfCsr); diff --git a/runtime/command_stream/command_stream_receiver_hw_base.inl b/runtime/command_stream/command_stream_receiver_hw_base.inl index 0b2550ffdf..9732a2e6ab 100644 --- a/runtime/command_stream/command_stream_receiver_hw_base.inl +++ b/runtime/command_stream/command_stream_receiver_hw_base.inl @@ -273,7 +273,7 @@ CompletionStamp CommandStreamReceiverHw::flushTask( this->lastSentThreadArbitrationPolicy = this->requiredThreadArbitrationPolicy; } - stateBaseAddressDirty |= ((GSBAFor32BitProgrammed ^ dispatchFlags.GSBA32BitRequired) && force32BitAllocations); + stateBaseAddressDirty |= ((GSBAFor32BitProgrammed ^ dispatchFlags.gsba32BitRequired) && force32BitAllocations); programVFEState(commandStreamCSR, dispatchFlags, device.getDeviceInfo().maxFrontEndThreads); @@ -301,7 +301,7 @@ CompletionStamp CommandStreamReceiverHw::flushTask( GSBAFor32BitProgrammed = false; if (is64bit && scratchSpaceController->getScratchSpaceAllocation() && !force32BitAllocations) { newGSHbase = scratchSpaceController->calculateNewGSH(); - } else if (is64bit && force32BitAllocations && dispatchFlags.GSBA32BitRequired) { + } else if (is64bit && force32BitAllocations && dispatchFlags.gsba32BitRequired) { newGSHbase = getMemoryManager()->getExternalHeapBaseAddress(); GSBAFor32BitProgrammed = true; } diff --git a/runtime/command_stream/csr_definitions.h b/runtime/command_stream/csr_definitions.h index 5ef3d38950..cc6e665f86 100644 --- a/runtime/command_stream/csr_definitions.h +++ b/runtime/command_stream/csr_definitions.h @@ -38,6 +38,30 @@ constexpr uint32_t l3AndL1On = 2u; } // namespace L3CachingSettings struct DispatchFlags { + DispatchFlags() = delete; + DispatchFlags(CsrDependencies csrDependencies, PipelineSelectArgs pipelineSelectArgs, FlushStampTrackingObj *flushStampReference, + QueueThrottle throttle, PreemptionMode preemptionMode, uint32_t numGrfRequired, + uint32_t l3CacheSettings, bool blocking, bool dcFlush, + bool useSLM, bool guardCommandBufferWithPipeControl, bool gsba32BitRequired, + bool requiresCoherency, bool lowPriority, bool implicitFlush, + bool outOfOrderExecutionAllowed, bool multiEngineQueue, bool epilogueRequired) : csrDependencies(csrDependencies), + pipelineSelectArgs(pipelineSelectArgs), + flushStampReference(flushStampReference), + throttle(throttle), + preemptionMode(preemptionMode), + numGrfRequired(numGrfRequired), + l3CacheSettings(l3CacheSettings), + blocking(blocking), + dcFlush(dcFlush), + useSLM(useSLM), + guardCommandBufferWithPipeControl(guardCommandBufferWithPipeControl), + gsba32BitRequired(gsba32BitRequired), + requiresCoherency(requiresCoherency), + lowPriority(lowPriority), + implicitFlush(implicitFlush), + outOfOrderExecutionAllowed(outOfOrderExecutionAllowed), + multiEngineQueue(multiEngineQueue), + epilogueRequired(epilogueRequired){}; CsrDependencies csrDependencies; PipelineSelectArgs pipelineSelectArgs; FlushStampTrackingObj *flushStampReference = nullptr; @@ -49,7 +73,7 @@ struct DispatchFlags { bool dcFlush = false; bool useSLM = false; bool guardCommandBufferWithPipeControl = false; - bool GSBA32BitRequired = false; + bool gsba32BitRequired = false; bool requiresCoherency = false; bool lowPriority = false; bool implicitFlush = false; diff --git a/runtime/helpers/task_information.cpp b/runtime/helpers/task_information.cpp index 74f644784c..05577026d0 100644 --- a/runtime/helpers/task_information.cpp +++ b/runtime/helpers/task_information.cpp @@ -44,15 +44,26 @@ CompletionStamp &CommandMapUnmap::submit(uint32_t taskLevel, bool terminated) { auto &queueCommandStream = commandQueue.getCS(0); size_t offset = queueCommandStream.getUsed(); - DispatchFlags dispatchFlags; - dispatchFlags.blocking = true; - dispatchFlags.dcFlush = true; - dispatchFlags.useSLM = true; - dispatchFlags.guardCommandBufferWithPipeControl = true; - dispatchFlags.lowPriority = commandQueue.getPriority() == QueuePriority::LOW; - dispatchFlags.throttle = commandQueue.getThrottle(); - dispatchFlags.preemptionMode = PreemptionHelper::taskPreemptionMode(commandQueue.getDevice(), nullptr); - dispatchFlags.multiEngineQueue = commandQueue.isMultiEngineQueue(); + DispatchFlags dispatchFlags( + {}, //csrDependencies + {}, //pipelineSelectArgs + nullptr, //flushStampReference + commandQueue.getThrottle(), //throttle + PreemptionHelper::taskPreemptionMode(commandQueue.getDevice(), nullptr), //preemptionMode + GrfConfig::DefaultGrfNumber, //numGrfRequired + L3CachingSettings::l3CacheOn, //l3CacheSettings + true, //blocking + true, //dcFlush + true, //useSLM + true, //guardCommandBufferWithPipeControl + false, //GSBA32BitRequired + false, //requiresCoherency + commandQueue.getPriority() == QueuePriority::LOW, //lowPriority + false, //implicitFlush + false, //outOfOrderExecutionAllowed + commandQueue.isMultiEngineQueue(), //multiEngineQueue + false //epilogueRequired + ); DEBUG_BREAK_IF(taskLevel >= Event::eventNotReady); @@ -174,19 +185,28 @@ CompletionStamp &CommandComputeKernel::submit(uint32_t taskLevel, bool terminate this->kernel->getProgram()->getBlockKernelManager()->makeInternalAllocationsResident(commandStreamReceiver); } - DispatchFlags dispatchFlags; - dispatchFlags.blocking = true; - dispatchFlags.dcFlush = flushDC; - dispatchFlags.useSLM = slmUsed; - dispatchFlags.guardCommandBufferWithPipeControl = true; - dispatchFlags.GSBA32BitRequired = NDRangeKernel; - dispatchFlags.requiresCoherency = requiresCoherency; - dispatchFlags.lowPriority = commandQueue.getPriority() == QueuePriority::LOW; - dispatchFlags.throttle = commandQueue.getThrottle(); - dispatchFlags.preemptionMode = preemptionMode; + DispatchFlags dispatchFlags( + {}, //csrDependencies + {}, //pipelineSelectArgs + nullptr, //flushStampReference + commandQueue.getThrottle(), //throttle + preemptionMode, //preemptionMode + kernel->getKernelInfo().patchInfo.executionEnvironment->NumGRFRequired, //numGrfRequired + L3CachingSettings::l3CacheOn, //l3CacheSettings + true, //blocking + flushDC, //dcFlush + slmUsed, //useSLM + true, //guardCommandBufferWithPipeControl + NDRangeKernel, //GSBA32BitRequired + requiresCoherency, //requiresCoherency + commandQueue.getPriority() == QueuePriority::LOW, //lowPriority + false, //implicitFlush + false, //outOfOrderExecutionAllowed + commandQueue.isMultiEngineQueue(), //multiEngineQueue + false //epilogueRequired + ); dispatchFlags.pipelineSelectArgs.mediaSamplerRequired = kernel->isVmeKernel(); - dispatchFlags.multiEngineQueue = commandQueue.isMultiEngineQueue(); - dispatchFlags.numGrfRequired = kernel->getKernelInfo().patchInfo.executionEnvironment->NumGRFRequired; + if (commandStreamReceiver.peekTimestampPacketWriteEnabled()) { dispatchFlags.csrDependencies.fillFromEventsRequest(eventsRequest, commandStreamReceiver, CsrDependencies::DependenciesType::OutOfCsr); } @@ -257,14 +277,26 @@ CompletionStamp &CommandWithoutKernel::submit(uint32_t taskLevel, bool terminate dispatchBlitOperation(); } - DispatchFlags dispatchFlags; - dispatchFlags.blocking = true; - dispatchFlags.lowPriority = commandQueue.getPriority() == QueuePriority::LOW; - dispatchFlags.throttle = commandQueue.getThrottle(); - dispatchFlags.preemptionMode = commandQueue.getDevice().getPreemptionMode(); - dispatchFlags.multiEngineQueue = commandQueue.isMultiEngineQueue(); - dispatchFlags.guardCommandBufferWithPipeControl = true; - dispatchFlags.outOfOrderExecutionAllowed = commandStreamReceiver.isNTo1SubmissionModelEnabled(); + DispatchFlags dispatchFlags( + {}, //csrDependencies + {}, //pipelineSelectArgs + nullptr, //flushStampReference + commandQueue.getThrottle(), //throttle + commandQueue.getDevice().getPreemptionMode(), //preemptionMode + GrfConfig::DefaultGrfNumber, //numGrfRequired + L3CachingSettings::l3CacheOn, //l3CacheSettings + true, //blocking + false, //dcFlush + false, //useSLM + true, //guardCommandBufferWithPipeControl + false, //GSBA32BitRequired + false, //requiresCoherency + commandQueue.getPriority() == QueuePriority::LOW, //lowPriority + false, //implicitFlush + commandStreamReceiver.isNTo1SubmissionModelEnabled(), //outOfOrderExecutionAllowed + commandQueue.isMultiEngineQueue(), //multiEngineQueue + false //epilogueRequired + ); UNRECOVERABLE_IF(!commandStreamReceiver.peekTimestampPacketWriteEnabled()); diff --git a/unit_tests/command_stream/command_stream_receiver_flush_task_1_tests.cpp b/unit_tests/command_stream/command_stream_receiver_flush_task_1_tests.cpp index 0ef286eae0..46655677d2 100644 --- a/unit_tests/command_stream/command_stream_receiver_flush_task_1_tests.cpp +++ b/unit_tests/command_stream/command_stream_receiver_flush_task_1_tests.cpp @@ -11,6 +11,7 @@ #include "runtime/os_interface/os_context.h" #include "test.h" #include "unit_tests/fixtures/ult_command_stream_receiver_fixture.h" +#include "unit_tests/helpers/dispatch_flags_helper.h" #include "unit_tests/helpers/unit_test_helper.h" #include "unit_tests/mocks/mock_buffer.h" #include "unit_tests/mocks/mock_command_queue.h" @@ -123,7 +124,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenTaskIsSu auto fillSize = MemoryConstants::cacheLineSize - sizeof(typename FamilyType::MI_BATCH_BUFFER_END); commandStream.getSpace(fillSize); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); mockCsr.flushTask(commandStream, @@ -141,7 +142,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenTaskIsSu HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrWhenflushTaskThenDshAndIohNotEvictable) { auto &mockCsr = pDevice->getUltCommandStreamReceiver(); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); mockCsr.flushTask(commandStream, 0, @@ -168,7 +169,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeAndMidThread auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr.submissionAggregator.reset(mockedSubmissionsAggregator); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); dispatchFlags.preemptionMode = PreemptionMode::MidThread; mockCsr.flushTask(commandStream, @@ -199,7 +200,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInDefaultModeAndMidThreadP CommandQueueHw commandQueue(nullptr, pDevice, 0); auto &commandStream = commandQueue.getCS(4096u); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); dispatchFlags.preemptionMode = PreemptionMode::MidThread; mockCsr->flushTask(commandStream, @@ -838,9 +839,9 @@ HWTEST_F(CommandStreamReceiverCQFlushTaskTests, getCSShouldReturnACSWithEnoughSi IndirectHeap linear(&allocation); auto blocking = true; - DispatchFlags dispatchFlags; - dispatchFlags.blocking = blocking; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); + dispatchFlags.blocking = blocking; commandStreamReceiver.flushTask( commandStream, @@ -885,10 +886,10 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, blockingFlushTaskWithOnlyPipeContr auto &commandStreamCSR = commandStreamReceiver->getCS(); commandStreamReceiver->lastSentCoherencyRequest = 0; - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); + dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); dispatchFlags.blocking = blocking; dispatchFlags.guardCommandBufferWithPipeControl = true; - dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); commandStreamReceiver->flushTask( commandStreamTask, @@ -928,11 +929,11 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, FlushTaskBlockingHasPipeControlWit auto &commandStreamTask = commandQueue.getCS(1024); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); + dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); dispatchFlags.blocking = true; dispatchFlags.dcFlush = true; dispatchFlags.guardCommandBufferWithPipeControl = true; - dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); commandStreamReceiver.flushTask( commandStreamTask, diff --git a/unit_tests/command_stream/command_stream_receiver_flush_task_2_tests.cpp b/unit_tests/command_stream/command_stream_receiver_flush_task_2_tests.cpp index 1465e3a735..45859c0ce7 100644 --- a/unit_tests/command_stream/command_stream_receiver_flush_task_2_tests.cpp +++ b/unit_tests/command_stream/command_stream_receiver_flush_task_2_tests.cpp @@ -16,6 +16,7 @@ #include "runtime/os_interface/os_context.h" #include "test.h" #include "unit_tests/fixtures/ult_command_stream_receiver_fixture.h" +#include "unit_tests/helpers/dispatch_flags_helper.h" #include "unit_tests/helpers/unit_test_helper.h" #include "unit_tests/mocks/mock_allocation_properties.h" #include "unit_tests/mocks/mock_buffer.h" @@ -82,7 +83,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, FlushTaskWithTaskCSPassedAsCommand auto &commandStreamTask = commandQueue.getCS(1024); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); // Pass taskCS as command stream parameter auto cs = commandStreamReceiver.flushTask( @@ -965,7 +966,8 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrWhenPreambleNotSentThenReq HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrWhenPreambleNotSentThenRequiredCsrSizeDoesntDependOnmediaSamplerConfigChanged) { UltCommandStreamReceiver &commandStreamReceiver = (UltCommandStreamReceiver &)pDevice->getGpgpuCommandStreamReceiver(); CsrSizeRequestFlags csrSizeRequest = {}; - DispatchFlags flags; + DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags(); + commandStreamReceiver.isPreambleSent = false; csrSizeRequest.mediaSamplerConfigChanged = false; @@ -986,7 +988,8 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenSpecialPipelineSelectModeChan UltCommandStreamReceiver &commandStreamReceiver = (UltCommandStreamReceiver &)pDevice->getGpgpuCommandStreamReceiver(); CsrSizeRequestFlags csrSizeRequest = {}; - DispatchFlags flags; + DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags(); + csrSizeRequest.specialPipelineSelectModeChanged = true; commandStreamReceiver.overrideCsrSizeReqFlags(csrSizeRequest); size_t size = commandStreamReceiver.getCmdSizeForPipelineSelect(); @@ -1004,7 +1007,8 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrWhenPreambleSentThenRequir UltCommandStreamReceiver &commandStreamReceiver = (UltCommandStreamReceiver &)pDevice->getGpgpuCommandStreamReceiver(); CsrSizeRequestFlags csrSizeRequest = {}; - DispatchFlags flags; + DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags(); + commandStreamReceiver.isPreambleSent = true; csrSizeRequest.mediaSamplerConfigChanged = false; @@ -1030,7 +1034,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrWhenSamplerCacheFlushSentT typedef typename FamilyType::PIPELINE_SELECT PIPELINE_SELECT; UltCommandStreamReceiver &commandStreamReceiver = (UltCommandStreamReceiver &)pDevice->getGpgpuCommandStreamReceiver(); CsrSizeRequestFlags csrSizeRequest = {}; - DispatchFlags flags; + DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags(); commandStreamReceiver.isPreambleSent = true; commandStreamReceiver.overrideCsrSizeReqFlags(csrSizeRequest); @@ -1058,8 +1062,9 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInNonDirtyStateWhenflushTa configureCSRtoNonDirtyState(); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); + mockCsr->flushTask(commandStream, 0, dsh, @@ -1086,8 +1091,9 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInNonDirtyStateAndBatching configureCSRtoNonDirtyState(); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); + mockCsr->flushTask(commandStream, 0, dsh, @@ -1109,7 +1115,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInNonDirtyStateAndBatching HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrWhenGeneralStateBaseAddressIsProgrammedThenDecanonizedAddressIsWritten) { uint64_t generalStateBaseAddress = 0xffff800400010000ull; StateBaseAddressHelper helper; - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); helper.programStateBaseAddress(commandStream, dsh, 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 6c47c05489..334f422c80 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 @@ -13,6 +13,7 @@ #include "runtime/platform/platform.h" #include "test.h" #include "unit_tests/fixtures/ult_command_stream_receiver_fixture.h" +#include "unit_tests/helpers/dispatch_flags_helper.h" #include "unit_tests/mocks/mock_command_queue.h" #include "unit_tests/mocks/mock_context.h" #include "unit_tests/mocks/mock_csr.h" @@ -39,9 +40,9 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenFlushTas auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - DispatchFlags dispatchFlags; - dispatchFlags.guardCommandBufferWithPipeControl = true; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); + dispatchFlags.guardCommandBufferWithPipeControl = true; mockCsr->flushTask(commandStream, 0, @@ -96,7 +97,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeAndTwoRecord auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); dispatchFlags.guardCommandBufferWithPipeControl = true; mockCsr->flushTask(commandStream, @@ -147,9 +148,9 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeAndThreeReco auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - DispatchFlags dispatchFlags; - dispatchFlags.guardCommandBufferWithPipeControl = true; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); + dispatchFlags.guardCommandBufferWithPipeControl = true; mockCsr->flushTask(commandStream, 0, @@ -212,9 +213,9 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeAndThreeReco auto memorySize = (size_t)pDevice->getDeviceInfo().globalMemSize; MockGraphicsAllocation largeAllocation(nullptr, memorySize); - DispatchFlags dispatchFlags; - dispatchFlags.guardCommandBufferWithPipeControl = true; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); + dispatchFlags.guardCommandBufferWithPipeControl = true; mockCsr->flushTask(commandStream, 0, @@ -277,9 +278,9 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenFlushTas auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - DispatchFlags dispatchFlags; - dispatchFlags.guardCommandBufferWithPipeControl = true; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); + dispatchFlags.guardCommandBufferWithPipeControl = true; mockCsr->flushTask(commandStream, 0, @@ -351,10 +352,11 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenRecorded mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); configureCSRtoNonDirtyState(); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); + dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); dispatchFlags.guardCommandBufferWithPipeControl = true; dispatchFlags.requiresCoherency = true; - dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); + mockCsr->lastSentCoherencyRequest = 1; commandStream.getSpace(4); @@ -428,7 +430,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenBlocking configureCSRtoNonDirtyState(); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); dispatchFlags.blocking = true; dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); @@ -481,9 +483,9 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenFlushTas mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch); - DispatchFlags dispatchFlags; - dispatchFlags.guardCommandBufferWithPipeControl = true; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); + dispatchFlags.guardCommandBufferWithPipeControl = true; mockCsr->flushTask(commandStream, 0, @@ -507,9 +509,10 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInDefaultModeWhenFlushTask CommandQueueHw commandQueue(nullptr, pDevice, 0); auto &commandStream = commandQueue.getCS(4096u); - DispatchFlags dispatchFlags; - dispatchFlags.guardCommandBufferWithPipeControl = true; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); + dispatchFlags.guardCommandBufferWithPipeControl = true; + auto &csr = commandQueue.getGpgpuCommandStreamReceiver(); csr.flushTask(commandStream, @@ -537,9 +540,9 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenWaitForT auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - DispatchFlags dispatchFlags; - dispatchFlags.guardCommandBufferWithPipeControl = true; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); + dispatchFlags.guardCommandBufferWithPipeControl = true; mockCsr->flushTask(commandStream, 0, @@ -577,9 +580,9 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenEnqueueI auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - DispatchFlags dispatchFlags; - dispatchFlags.guardCommandBufferWithPipeControl = true; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); + dispatchFlags.guardCommandBufferWithPipeControl = true; mockCsr->flushTask(commandStream, 0, @@ -617,9 +620,9 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenSusbsequ auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - DispatchFlags dispatchFlags; - dispatchFlags.guardCommandBufferWithPipeControl = true; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); + dispatchFlags.guardCommandBufferWithPipeControl = true; mockCsr->flushTask(commandStream, 0, @@ -682,10 +685,9 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenTotalRes auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - DispatchFlags dispatchFlags; - dispatchFlags.guardCommandBufferWithPipeControl = true; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); - + dispatchFlags.guardCommandBufferWithPipeControl = true; mockedMemoryManager->budgetExhausted = true; mockCsr->flushTask(commandStream, @@ -738,10 +740,10 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); + dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); dispatchFlags.guardCommandBufferWithPipeControl = true; dispatchFlags.outOfOrderExecutionAllowed = true; - dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); auto taskLevelPriorToSubmission = mockCsr->peekTaskLevel(); @@ -816,9 +818,9 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenDcFlushI mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch); - DispatchFlags dispatchFlags; - dispatchFlags.guardCommandBufferWithPipeControl = true; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); + dispatchFlags.guardCommandBufferWithPipeControl = true; mockCsr->flushTask(commandStream, 0, @@ -844,10 +846,10 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenCommandA mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); + dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); dispatchFlags.guardCommandBufferWithPipeControl = true; dispatchFlags.outOfOrderExecutionAllowed = true; - dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); mockCsr->flushTask(commandStream, 0, @@ -875,10 +877,10 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWithOutOfOrd mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); + dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); dispatchFlags.guardCommandBufferWithPipeControl = true; dispatchFlags.outOfOrderExecutionAllowed = false; - dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); mockCsr->flushTask(commandStream, 0, @@ -909,10 +911,10 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenDcFlushI auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); + dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); dispatchFlags.dcFlush = true; dispatchFlags.outOfOrderExecutionAllowed = true; - dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); mockCsr->flushTask(commandStream, 0, @@ -942,10 +944,11 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenEpiloguePipeControlThenDcFlus auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); + dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); dispatchFlags.guardCommandBufferWithPipeControl = true; dispatchFlags.outOfOrderExecutionAllowed = false; - dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); + mockCsr->flushTask(commandStream, 0, dsh, @@ -980,10 +983,11 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenEpiloguePipeControlWhendDcFlu auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); + dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); dispatchFlags.guardCommandBufferWithPipeControl = true; dispatchFlags.outOfOrderExecutionAllowed = false; - dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); + mockCsr->flushTask(commandStream, 0, dsh, @@ -1015,7 +1019,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); dispatchFlags.guardCommandBufferWithPipeControl = true; dispatchFlags.outOfOrderExecutionAllowed = false; @@ -1073,7 +1077,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeAndOoqFlagSe auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); dispatchFlags.guardCommandBufferWithPipeControl = true; dispatchFlags.outOfOrderExecutionAllowed = false; @@ -1112,10 +1116,10 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenPipeCont auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); + dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); dispatchFlags.guardCommandBufferWithPipeControl = true; dispatchFlags.outOfOrderExecutionAllowed = true; - dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); auto taskLevelPriorToSubmission = mockCsr->peekTaskLevel(); @@ -1174,10 +1178,10 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); + dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); dispatchFlags.guardCommandBufferWithPipeControl = true; dispatchFlags.outOfOrderExecutionAllowed = true; - dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); auto taskLevelPriorToSubmission = mockCsr->peekTaskLevel(); @@ -1315,9 +1319,9 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDispatchFlagsWithThrottleSetT auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - DispatchFlags dispatchFlags; - dispatchFlags.throttle = QueueThrottle::LOW; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); + dispatchFlags.throttle = QueueThrottle::LOW; mockCsr->flushTask(commandStream, 0, @@ -1347,9 +1351,9 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDispatchFlagsWithThrottleSetT auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - DispatchFlags dispatchFlags; - dispatchFlags.throttle = QueueThrottle::MEDIUM; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); + dispatchFlags.throttle = QueueThrottle::MEDIUM; mockCsr->flushTask(commandStream, 0, @@ -1396,9 +1400,9 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDispatchFlagsWithThrottleSetT auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - DispatchFlags dispatchFlags; - dispatchFlags.throttle = QueueThrottle::HIGH; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); + dispatchFlags.throttle = QueueThrottle::HIGH; mockCsr->flushTask(commandStream, 0, @@ -1418,7 +1422,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenEpilogueRequiredFlagWhenTaskI configureCSRtoNonDirtyState(); auto &commandStreamReceiver = this->pDevice->getUltCommandStreamReceiver(); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); EXPECT_EQ(0u, commandStreamReceiver.getCmdSizeForEpilogue(dispatchFlags)); @@ -1469,8 +1473,7 @@ class UltCommandStreamReceiverForDispatchFlags : public UltCommandStreamReceiver using BaseClass = UltCommandStreamReceiver; public: - UltCommandStreamReceiverForDispatchFlags(ExecutionEnvironment &executionEnvironment) : BaseClass(executionEnvironment) { - } + UltCommandStreamReceiverForDispatchFlags(ExecutionEnvironment &executionEnvironment) : BaseClass(executionEnvironment) {} CompletionStamp flushTask(LinearStream &commandStream, size_t commandStreamStart, const IndirectHeap &dsh, const IndirectHeap &ioh, const IndirectHeap &ssh, @@ -1479,7 +1482,7 @@ class UltCommandStreamReceiverForDispatchFlags : public UltCommandStreamReceiver return BaseClass::flushTask(commandStream, commandStreamStart, dsh, ioh, ssh, taskLevel, dispatchFlags, device); } - DispatchFlags savedDispatchFlags; + DispatchFlags savedDispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); }; HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenBlockedKernelWhenItIsUnblockedThenDispatchFlagsAreSetCorrectly) { @@ -1547,7 +1550,8 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, whenPerDssBackBufferProgrammingEna DebugManager.flags.ForcePerDssBackedBufferProgramming.set(true); auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); + commandStreamReceiver.flushTask(commandStream, 0, dsh, @@ -1569,7 +1573,8 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, whenPerDssBackBufferProgrammingEna auto memoryManager = pDevice->getMemoryManager(); commandStreamReceiver.perDssBackedBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); + commandStreamReceiver.flushTask(commandStream, 0, dsh, diff --git a/unit_tests/command_stream/command_stream_receiver_flush_task_gmock_tests.cpp b/unit_tests/command_stream/command_stream_receiver_flush_task_gmock_tests.cpp index 85afa9a179..3878570a97 100644 --- a/unit_tests/command_stream/command_stream_receiver_flush_task_gmock_tests.cpp +++ b/unit_tests/command_stream/command_stream_receiver_flush_task_gmock_tests.cpp @@ -27,6 +27,7 @@ #include "unit_tests/fixtures/built_in_fixture.h" #include "unit_tests/fixtures/device_fixture.h" #include "unit_tests/fixtures/ult_command_stream_receiver_fixture.h" +#include "unit_tests/helpers/dispatch_flags_helper.h" #include "unit_tests/helpers/hw_parse.h" #include "unit_tests/libult/create_command_stream.h" #include "unit_tests/libult/ult_command_stream_receiver.h" @@ -71,7 +72,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskGmockTests, givenCsrInBatchingModeThreeRe auto mockedSubmissionsAggregator = new mockSubmissionsAggregator(); mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); dispatchFlags.guardCommandBufferWithPipeControl = true; dispatchFlags.outOfOrderExecutionAllowed = true; @@ -133,7 +134,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskGmockTests, givenMockCommandStreamerWhenA mockCsr->overwriteFlatBatchBufferHelper(mockHelper); pDevice->resetCommandStreamReceiver(mockCsr); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); dispatchFlags.throttle = QueueThrottle::MEDIUM; EXPECT_CALL(*mockHelper, setPatchInfoData(_)).Times(0); @@ -161,8 +162,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskGmockTests, givenMockCommandStreamerWhenA pDevice->resetCommandStreamReceiver(mockCsr); - DispatchFlags dispatchFlags; - dispatchFlags.throttle = QueueThrottle::MEDIUM; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); std::vector patchInfoDataVector; EXPECT_CALL(*mockHelper, setPatchInfoData(_)) @@ -269,7 +269,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskGmockTests, givenPatch bool vfeStateDirty; mockCsr->getScratchSpaceController()->setRequiredScratchSpace(nullptr, 10u, 0u, 1u, *pDevice->getDefaultEngine().osContext, stateBaseAddressDirty, vfeStateDirty); - DispatchFlags flags; + DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags(); mockCsr->requiredScratchSize = 0x200000; mockCsr->programVFEState(commandStream, flags, 10); @@ -288,7 +288,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskGmockTests, givenPatch bool vfeStateDirty; mockCsr->getScratchSpaceController()->setRequiredScratchSpace(nullptr, 10u, 0u, 1u, *pDevice->getDefaultEngine().osContext, stateBaseAddressDirty, vfeStateDirty); - DispatchFlags flags; + DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags(); mockCsr->requiredScratchSize = 0x200000; mockCsr->programVFEState(commandStream, flags, 10); @@ -305,7 +305,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskGmockTests, givenPatch std::unique_ptr> mockCsr(new MockCsrHw2(*pDevice->executionEnvironment)); mockCsr->overwriteFlatBatchBufferHelper(new MockFlatBatchBufferHelper(*pDevice->executionEnvironment)); - DispatchFlags flags; + DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags(); mockCsr->requiredScratchSize = 0x200000; mockCsr->programVFEState(commandStream, flags, 10); diff --git a/unit_tests/command_stream/command_stream_receiver_hw_tests.cpp b/unit_tests/command_stream/command_stream_receiver_hw_tests.cpp index 68b9566bb2..ff453e9f3b 100644 --- a/unit_tests/command_stream/command_stream_receiver_hw_tests.cpp +++ b/unit_tests/command_stream/command_stream_receiver_hw_tests.cpp @@ -31,6 +31,7 @@ #include "unit_tests/fixtures/built_in_fixture.h" #include "unit_tests/fixtures/device_fixture.h" #include "unit_tests/fixtures/ult_command_stream_receiver_fixture.h" +#include "unit_tests/helpers/dispatch_flags_helper.h" #include "unit_tests/helpers/hw_parse.h" #include "unit_tests/helpers/unit_test_helper.h" #include "unit_tests/libult/create_command_stream.h" @@ -73,7 +74,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, UltCommandStreamReceiverTest, givenNotSentStateSipWh CommandQueueHw commandQueue(nullptr, mockDevice.get(), 0); auto &commandStream = commandQueue.getCS(4096u); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); dispatchFlags.preemptionMode = PreemptionMode::MidThread; MockGraphicsAllocation allocation(nullptr, 0); @@ -111,7 +112,7 @@ HWTEST_F(UltCommandStreamReceiverTest, givenCsrWhenProgramStateSipIsCalledThenIs HWTEST_F(UltCommandStreamReceiverTest, givenSentStateSipFlagSetWhenGetRequiredStateSipCmdSizeIsCalledThenStateSipCmdSizeIsNotIncluded) { auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); commandStreamReceiver.isStateSipSent = false; auto sizeWithStateSipIsNotSent = commandStreamReceiver.getRequiredCmdStreamSize(dispatchFlags, *pDevice); @@ -125,7 +126,7 @@ HWTEST_F(UltCommandStreamReceiverTest, givenSentStateSipFlagSetWhenGetRequiredSt HWTEST_F(UltCommandStreamReceiverTest, givenSentStateSipFlagSetAndSourceLevelDebuggerIsActiveWhenGetRequiredStateSipCmdSizeIsCalledThenStateSipCmdSizeIsIncluded) { auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); commandStreamReceiver.isStateSipSent = true; auto sizeWithoutSourceKernelDebugging = commandStreamReceiver.getRequiredCmdStreamSize(dispatchFlags, *pDevice); diff --git a/unit_tests/fixtures/ult_command_stream_receiver_fixture.h b/unit_tests/fixtures/ult_command_stream_receiver_fixture.h index 7cc0a05f7b..bf474970b7 100644 --- a/unit_tests/fixtures/ult_command_stream_receiver_fixture.h +++ b/unit_tests/fixtures/ult_command_stream_receiver_fixture.h @@ -13,6 +13,7 @@ #include "runtime/gmm_helper/gmm_helper.h" #include "runtime/helpers/cache_policy.h" #include "unit_tests/fixtures/device_fixture.h" +#include "unit_tests/helpers/dispatch_flags_helper.h" #include "unit_tests/helpers/hw_parse.h" #include "unit_tests/libult/ult_command_stream_receiver.h" #include "unit_tests/mocks/mock_graphics_allocation.h" @@ -137,7 +138,7 @@ struct UltCommandStreamReceiverTest return reinterpret_cast &>(pDevice->getGpgpuCommandStreamReceiver()); } - DispatchFlags flushTaskFlags = {}; + DispatchFlags flushTaskFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); uint32_t taskLevel = 42; LinearStream commandStream; IndirectHeap dsh = {nullptr}; diff --git a/unit_tests/gen11/coherency_tests_gen11.cpp b/unit_tests/gen11/coherency_tests_gen11.cpp index e4b605f499..aa009ace3b 100644 --- a/unit_tests/gen11/coherency_tests_gen11.cpp +++ b/unit_tests/gen11/coherency_tests_gen11.cpp @@ -9,6 +9,7 @@ #include "runtime/gen11/reg_configs.h" #include "runtime/helpers/hw_helper.h" #include "test.h" +#include "unit_tests/helpers/dispatch_flags_helper.h" #include "unit_tests/helpers/hw_parse.h" #include "unit_tests/mocks/mock_device.h" @@ -36,7 +37,7 @@ struct Gen11CoherencyRequirements : public ::testing::Test { myCsr *csr = nullptr; std::unique_ptr device; - DispatchFlags flags = {}; + DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags(); }; GEN11TEST_F(Gen11CoherencyRequirements, coherencyCmdSize) { diff --git a/unit_tests/gen11/program_media_sampler_tests_gen11.cpp b/unit_tests/gen11/program_media_sampler_tests_gen11.cpp index cb7a31330b..cc23b6c6d0 100644 --- a/unit_tests/gen11/program_media_sampler_tests_gen11.cpp +++ b/unit_tests/gen11/program_media_sampler_tests_gen11.cpp @@ -10,6 +10,7 @@ #include "runtime/gen11/reg_configs.h" #include "runtime/helpers/hw_helper.h" #include "test.h" +#include "unit_tests/helpers/dispatch_flags_helper.h" #include "unit_tests/helpers/hw_parse.h" #include "unit_tests/mocks/mock_device.h" @@ -51,8 +52,7 @@ struct Gen11MediaSamplerProgramingTest : public ::testing::Test { myCsr *csr = nullptr; std::unique_ptr device; - DispatchFlags flags = {}; - + DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags(); char buff[MemoryConstants::pageSize]; std::unique_ptr stream; }; diff --git a/unit_tests/gen8/coherency_tests_gen8.cpp b/unit_tests/gen8/coherency_tests_gen8.cpp index 5406ebb0e9..447e8a9712 100644 --- a/unit_tests/gen8/coherency_tests_gen8.cpp +++ b/unit_tests/gen8/coherency_tests_gen8.cpp @@ -9,6 +9,7 @@ #include "runtime/execution_environment/execution_environment.h" #include "runtime/platform/platform.h" #include "test.h" +#include "unit_tests/helpers/dispatch_flags_helper.h" using namespace NEO; @@ -19,7 +20,7 @@ GEN8TEST_F(Gen8CoherencyRequirements, noCoherencyProgramming) { executionEnvironment->initializeMemoryManager(); CommandStreamReceiverHw csr(*executionEnvironment); LinearStream stream; - DispatchFlags flags = {}; + DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags(); auto retSize = csr.getCmdSizeForComputeMode(); EXPECT_EQ(0u, retSize); diff --git a/unit_tests/gen8/command_stream_receiver_hw_tests_gen8.cpp b/unit_tests/gen8/command_stream_receiver_hw_tests_gen8.cpp index d454035b35..e3d6a2eda6 100644 --- a/unit_tests/gen8/command_stream_receiver_hw_tests_gen8.cpp +++ b/unit_tests/gen8/command_stream_receiver_hw_tests_gen8.cpp @@ -10,6 +10,7 @@ #include "runtime/command_stream/command_stream_receiver.h" #include "test.h" #include "unit_tests/fixtures/device_fixture.h" +#include "unit_tests/helpers/dispatch_flags_helper.h" #include "unit_tests/helpers/hw_parse.h" #include "unit_tests/mocks/mock_command_queue.h" #include "unit_tests/mocks/mock_context.h" @@ -43,7 +44,8 @@ GEN8TEST_F(CommandStreamReceiverHwTestGen8, GivenChangedL3ConfigWhenL3IsProgramm void *buffer = alignedMalloc(bufferSize, 64); LinearStream stream(buffer, bufferSize); - DispatchFlags flags; + DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags(); + uint32_t l3Config = 0x12345678; csr.programL3(stream, flags, l3Config); diff --git a/unit_tests/gen9/coherency_tests_gen9.cpp b/unit_tests/gen9/coherency_tests_gen9.cpp index 951e1515a7..914e2cf162 100644 --- a/unit_tests/gen9/coherency_tests_gen9.cpp +++ b/unit_tests/gen9/coherency_tests_gen9.cpp @@ -9,6 +9,7 @@ #include "runtime/execution_environment/execution_environment.h" #include "runtime/platform/platform.h" #include "test.h" +#include "unit_tests/helpers/dispatch_flags_helper.h" using namespace NEO; @@ -19,7 +20,7 @@ GEN9TEST_F(Gen9CoherencyRequirements, noCoherencyProgramming) { executionEnvironment->initializeMemoryManager(); CommandStreamReceiverHw csr(*executionEnvironment); LinearStream stream; - DispatchFlags flags = {}; + DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags(); auto retSize = csr.getCmdSizeForComputeMode(); EXPECT_EQ(0u, retSize); diff --git a/unit_tests/gen9/command_stream_receiver_hw_tests_gen9.cpp b/unit_tests/gen9/command_stream_receiver_hw_tests_gen9.cpp index 21e3597d22..5a2c008979 100644 --- a/unit_tests/gen9/command_stream_receiver_hw_tests_gen9.cpp +++ b/unit_tests/gen9/command_stream_receiver_hw_tests_gen9.cpp @@ -13,6 +13,7 @@ #include "test.h" #include "unit_tests/fixtures/device_fixture.h" #include "unit_tests/fixtures/ult_command_stream_receiver_fixture.h" +#include "unit_tests/helpers/dispatch_flags_helper.h" #include "unit_tests/helpers/hw_parse.h" #include "unit_tests/mocks/mock_command_queue.h" #include "unit_tests/mocks/mock_context.h" @@ -37,7 +38,7 @@ GEN9TEST_F(UltCommandStreamReceiverTest, whenPreambleIsProgrammedThenStateSipCmd pDevice->setPreemptionMode(PreemptionMode::Disabled); pDevice->setSourceLevelDebuggerActive(true); uint32_t newL3Config; - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); auto cmdSizePreamble = commandStreamReceiver.getRequiredCmdSizeForPreamble(*pDevice); StackVec preambleBuffer; diff --git a/unit_tests/helpers/CMakeLists.txt b/unit_tests/helpers/CMakeLists.txt index 1a785cee03..3296fc3543 100644 --- a/unit_tests/helpers/CMakeLists.txt +++ b/unit_tests/helpers/CMakeLists.txt @@ -16,6 +16,7 @@ set(IGDRCL_SRCS_tests_helpers ${CMAKE_CURRENT_SOURCE_DIR}/cmd_buffer_validator_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/debug_helpers_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/dirty_state_helpers_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/dispatch_flags_helper.h ${CMAKE_CURRENT_SOURCE_DIR}/dispatch_info_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/dispatch_info_builder_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/extendable_enum_tests.cpp diff --git a/unit_tests/helpers/dispatch_flags_helper.h b/unit_tests/helpers/dispatch_flags_helper.h new file mode 100644 index 0000000000..cae5bca36d --- /dev/null +++ b/unit_tests/helpers/dispatch_flags_helper.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2019 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#pragma once +#include "runtime/command_stream/csr_definitions.h" + +using namespace NEO; + +struct DispatchFlagsHelper { + static DispatchFlags createDefaultDispatchFlags() { + return DispatchFlags( + {}, //csrDependencies + {}, //pipelineSelectArgs + nullptr, //flushStampReference + QueueThrottle::MEDIUM, //throttle + PreemptionMode::Disabled, //preemptionMode + GrfConfig::DefaultGrfNumber, //numGrfRequired + L3CachingSettings::l3CacheOn, //l3CacheSettings + false, //blocking + false, //dcFlush + false, //useSLM + false, //guardCommandBufferWithPipeControl + false, //gsba32BitRequired + false, //requiresCoherency + false, //lowPriority + false, //implicitFlush + false, //outOfOrderExecutionAllowed + false, //multiEngineQueue + false //epilogueRequired + ); + } +}; \ No newline at end of file diff --git a/unit_tests/helpers/timestamp_packet_tests.cpp b/unit_tests/helpers/timestamp_packet_tests.cpp index c788e8dccb..b99cf4ee19 100644 --- a/unit_tests/helpers/timestamp_packet_tests.cpp +++ b/unit_tests/helpers/timestamp_packet_tests.cpp @@ -15,6 +15,7 @@ #include "runtime/platform/platform.h" #include "runtime/utilities/tag_allocator.h" #include "test.h" +#include "unit_tests/helpers/dispatch_flags_helper.h" #include "unit_tests/helpers/hw_parse.h" #include "unit_tests/helpers/unit_test_helper.h" #include "unit_tests/mocks/mock_command_queue.h" @@ -550,7 +551,7 @@ HWTEST_F(TimestampPacketTests, givenEventsRequestWhenEstimatingStreamSizeForCsrT cl_event waitlist[] = {&event1, &event2, &event3, &event4, &event5}; EventsRequest eventsRequest(numEventsOnWaitlist, waitlist, nullptr); - DispatchFlags flags; + DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags(); auto sizeWithoutEvents = csr.getRequiredCmdStreamSize(flags, *device); @@ -592,7 +593,7 @@ HWTEST_F(TimestampPacketTests, givenEventsRequestWhenEstimatingStreamSizeForDiff cl_event waitlist[] = {&event1, &event2, &event3, &event4, &event5}; EventsRequest eventsRequest(numEventsOnWaitlist, waitlist, nullptr); - DispatchFlags flags; + DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags(); auto sizeWithoutEvents = csr.getRequiredCmdStreamSize(flags, *device.get()); @@ -1577,7 +1578,7 @@ HWTEST_F(TimestampPacketTests, givenBlockedQueueWhenEnqueueingBarrierThenRequest HWTEST_F(TimestampPacketTests, givenPipeControlRequestWhenEstimatingCsrStreamSizeThenAddSizeForPipeControl) { auto &csr = device->getUltCommandStreamReceiver(); - DispatchFlags flags; + DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags(); csr.stallingPipeControlOnNextFlushRequired = false; auto sizeWithoutPcRequest = device->getUltCommandStreamReceiver().getRequiredCmdStreamSize(flags, *device.get()); @@ -1592,7 +1593,7 @@ HWTEST_F(TimestampPacketTests, givenPipeControlRequestWhenEstimatingCsrStreamSiz HWTEST_F(TimestampPacketTests, givenInstructionCacheRequesWhenSizeIsEstimatedThenPipeControlIsAdded) { auto &csr = device->getUltCommandStreamReceiver(); - DispatchFlags flags; + DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags(); csr.requiresInstructionCacheFlush = false; auto sizeWithoutPcRequest = device->getUltCommandStreamReceiver().getRequiredCmdStreamSize(flags, *device.get()); diff --git a/unit_tests/libult/ult_command_stream_receiver.h b/unit_tests/libult/ult_command_stream_receiver.h index fb432efb96..7bec88c2be 100644 --- a/unit_tests/libult/ult_command_stream_receiver.h +++ b/unit_tests/libult/ult_command_stream_receiver.h @@ -10,6 +10,7 @@ #include "runtime/execution_environment/execution_environment.h" #include "runtime/memory_manager/os_agnostic_memory_manager.h" #include "runtime/os_interface/os_context.h" +#include "unit_tests/helpers/dispatch_flags_helper.h" #include "unit_tests/mocks/mock_experimental_command_buffer.h" #include @@ -75,8 +76,8 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw, publ virtual ~UltCommandStreamReceiver() override { } - UltCommandStreamReceiver(ExecutionEnvironment &executionEnvironment) : BaseClass(executionEnvironment), recursiveLockCounter(0) { - } + UltCommandStreamReceiver(ExecutionEnvironment &executionEnvironment) : BaseClass(executionEnvironment), recursiveLockCounter(0), + recordedDispatchFlags(DispatchFlagsHelper::createDefaultDispatchFlags()) {} static CommandStreamReceiver *create(bool withAubDump, ExecutionEnvironment &executionEnvironment) { return new UltCommandStreamReceiver(executionEnvironment); } @@ -210,4 +211,4 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw, publ DispatchFlags recordedDispatchFlags; bool multiOsContextCapable = false; }; -} // namespace NEO +} // namespace NEO \ No newline at end of file diff --git a/unit_tests/mocks/mock_csr.h b/unit_tests/mocks/mock_csr.h index 8d2991d651..5aaeabe260 100644 --- a/unit_tests/mocks/mock_csr.h +++ b/unit_tests/mocks/mock_csr.h @@ -153,7 +153,6 @@ class MockCsr : public MockCsrBase { template class MockCsrHw2 : public CommandStreamReceiverHw { public: - using CommandStreamReceiverHw::CommandStreamReceiverHw; using CommandStreamReceiverHw::flushStamp; using CommandStreamReceiverHw::programL3; using CommandStreamReceiverHw::csrSizeRequestFlags; @@ -169,6 +168,8 @@ class MockCsrHw2 : public CommandStreamReceiverHw { using CommandStreamReceiver::taskLevel; using CommandStreamReceiver::timestampPacketWriteEnabled; + MockCsrHw2(ExecutionEnvironment &executionEnvironment) : CommandStreamReceiverHw::CommandStreamReceiverHw(executionEnvironment) {} + SubmissionAggregator *peekSubmissionAggregator() { return this->submissionAggregator.get(); } @@ -227,7 +228,7 @@ class MockCsrHw2 : public CommandStreamReceiverHw { int flushCalledCount = 0; std::unique_ptr recordedCommandBuffer = nullptr; ResidencyContainer copyOfAllocations; - DispatchFlags passedDispatchFlags = {}; + DispatchFlags passedDispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); }; template diff --git a/unit_tests/os_interface/linux/drm_command_stream_tests.cpp b/unit_tests/os_interface/linux/drm_command_stream_tests.cpp index 0309b6aa1c..5415dfa316 100644 --- a/unit_tests/os_interface/linux/drm_command_stream_tests.cpp +++ b/unit_tests/os_interface/linux/drm_command_stream_tests.cpp @@ -18,6 +18,7 @@ #include "runtime/os_interface/os_context.h" #include "test.h" #include "unit_tests/fixtures/device_fixture.h" +#include "unit_tests/helpers/dispatch_flags_helper.h" #include "unit_tests/helpers/execution_environment_helper.h" #include "unit_tests/helpers/hw_parse.h" #include "unit_tests/mocks/linux/mock_drm_command_stream_receiver.h" @@ -699,8 +700,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamBatchingTests, givenCsrWhenDispatchPolicyIsSe csr->makeResident(*dummyAllocation); csr->setTagAllocation(tagAllocation); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(device->getHardwareInfo()); + csr->flushTask(cs, 0u, cs, cs, cs, 0u, dispatchFlags, *device); //make sure command buffer is recorded @@ -754,9 +756,10 @@ HWTEST_TEMPLATED_F(DrmCommandStreamBatchingTests, givenRecordedCommandBufferWhen //use some bytes submittedCommandBuffer.getSpace(4); - DispatchFlags dispatchFlags; - dispatchFlags.guardCommandBufferWithPipeControl = true; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(device->getHardwareInfo()); + dispatchFlags.guardCommandBufferWithPipeControl = true; + csr->flushTask(cs, 0u, cs, cs, cs, 0u, dispatchFlags, *device); auto &cmdBuffers = mockedSubmissionsAggregator->peekCommandBuffers(); diff --git a/unit_tests/os_interface/windows/device_command_stream_tests.cpp b/unit_tests/os_interface/windows/device_command_stream_tests.cpp index 85d7a48074..d79ef5393b 100644 --- a/unit_tests/os_interface/windows/device_command_stream_tests.cpp +++ b/unit_tests/os_interface/windows/device_command_stream_tests.cpp @@ -31,6 +31,7 @@ #include "unit_tests/fixtures/device_fixture.h" #include "unit_tests/fixtures/memory_management_fixture.h" #include "unit_tests/fixtures/mock_aub_center_fixture.h" +#include "unit_tests/helpers/dispatch_flags_helper.h" #include "unit_tests/helpers/execution_environment_helper.h" #include "unit_tests/mocks/mock_buffer.h" #include "unit_tests/mocks/mock_builtins.h" @@ -738,10 +739,11 @@ HWTEST_F(WddmCommandStreamMockGdiTest, givenRecordedCommandBufferWhenItIsSubmitt IndirectHeap ioh(iohAlloc); IndirectHeap ssh(sshAlloc); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); + dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(device->getHardwareInfo()); dispatchFlags.guardCommandBufferWithPipeControl = true; dispatchFlags.requiresCoherency = true; - dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(device->getHardwareInfo()); + csr->flushTask(cs, 0u, dsh, ioh, ssh, 0u, dispatchFlags, *device); auto &cmdBuffers = mockedSubmissionsAggregator->peekCommandBuffers(); @@ -903,7 +905,8 @@ HWTEST_P(WddmCsrCompressionParameterizedTest, givenEnabledCompressionWhenFlushin .Times(1) .WillOnce(Return(GMM_SUCCESS)); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); + mockWddmCsr->flushTask(cs, 0u, cs, cs, cs, 0u, dispatchFlags, *device); EXPECT_TRUE(mockWddmCsr->pageTableManagerInitialized); @@ -941,7 +944,8 @@ HWTEST_F(WddmCsrCompressionTests, givenDisabledCompressionWhenFlushingThenDontIn EXPECT_FALSE(mockWddmCsr->pageTableManagerInitialized); - DispatchFlags dispatchFlags; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); + mockWddmCsr->flushTask(cs, 0u, cs, cs, cs, 0u, dispatchFlags, *device); EXPECT_FALSE(mockWddmCsr->pageTableManagerInitialized); diff --git a/unit_tests/preemption/preemption_tests.cpp b/unit_tests/preemption/preemption_tests.cpp index d68ee28dcf..138ad4561c 100644 --- a/unit_tests/preemption/preemption_tests.cpp +++ b/unit_tests/preemption/preemption_tests.cpp @@ -12,6 +12,7 @@ #include "runtime/helpers/hw_helper.h" #include "runtime/helpers/options.h" #include "unit_tests/fixtures/preemption_fixture.h" +#include "unit_tests/helpers/dispatch_flags_helper.h" #include "unit_tests/helpers/hw_parse.h" #include "unit_tests/mocks/mock_builtins.h" #include "unit_tests/mocks/mock_device.h" @@ -543,8 +544,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, MidThreadPreemptionTests, givenDirtyCsrStateWhenStat CommandQueueHw commandQueue(nullptr, device.get(), 0); auto &commandStream = commandQueue.getCS(4096u); - DispatchFlags dispatchFlags; - dispatchFlags.preemptionMode = PreemptionMode::MidThread; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); void *buffer = alignedMalloc(MemoryConstants::pageSize, MemoryConstants::pageSize64k); diff --git a/unit_tests/source_level_debugger/source_level_debugger_csr_tests.cpp b/unit_tests/source_level_debugger/source_level_debugger_csr_tests.cpp index e17850b9cb..04f32f1bd8 100644 --- a/unit_tests/source_level_debugger/source_level_debugger_csr_tests.cpp +++ b/unit_tests/source_level_debugger/source_level_debugger_csr_tests.cpp @@ -9,6 +9,7 @@ #include "runtime/source_level_debugger/source_level_debugger.h" #include "test.h" #include "unit_tests/fixtures/device_fixture.h" +#include "unit_tests/helpers/dispatch_flags_helper.h" #include "unit_tests/helpers/execution_environment_helper.h" #include "unit_tests/helpers/hw_parse.h" #include "unit_tests/mocks/mock_builtins.h" @@ -53,8 +54,7 @@ HWTEST_F(CommandStreamReceiverWithActiveDebuggerTest, givenCsrWithActiveDebugger CommandQueueHw commandQueue(nullptr, device.get(), 0); auto &commandStream = commandQueue.getCS(4096u); - DispatchFlags dispatchFlags; - dispatchFlags.preemptionMode = PreemptionMode::Disabled; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); void *buffer = alignedMalloc(MemoryConstants::pageSize, MemoryConstants::pageSize64k); @@ -94,8 +94,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverWithActiveDebuggerTest, givenCs auto &commandStream = commandQueue.getCS(4096u); auto &preambleStream = mockCsr->getCS(0); - DispatchFlags dispatchFlags; - dispatchFlags.preemptionMode = PreemptionMode::Disabled; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); void *buffer = alignedMalloc(MemoryConstants::pageSize, MemoryConstants::pageSize64k); @@ -146,8 +145,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverWithActiveDebuggerTest, givenCs auto &commandStream = commandQueue.getCS(4096u); auto &preambleStream = mockCsr->getCS(0); - DispatchFlags dispatchFlags; - dispatchFlags.preemptionMode = PreemptionMode::Disabled; + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); void *buffer = alignedMalloc(MemoryConstants::pageSize, MemoryConstants::pageSize64k);