diff --git a/opencl/test/unit_test/kernel/kernel_tests.cpp b/opencl/test/unit_test/kernel/kernel_tests.cpp index 217a2ed6d9..8aaeace351 100644 --- a/opencl/test/unit_test/kernel/kernel_tests.cpp +++ b/opencl/test/unit_test/kernel/kernel_tests.cpp @@ -530,6 +530,10 @@ class CommandStreamReceiverMock : public CommandStreamReceiver { return CommandStreamReceiverType::CSR_HW; } + void programHardwareContext() override {} + size_t getCmdsSizeForHardwareContext() const override { + return 0; + } std::map residency; bool passResidencyCallToBaseClass = true; std::unique_ptr mockExecutionEnvironment; diff --git a/shared/source/command_stream/command_stream_receiver.h b/shared/source/command_stream/command_stream_receiver.h index 57b81e1938..05b810f97c 100644 --- a/shared/source/command_stream/command_stream_receiver.h +++ b/shared/source/command_stream/command_stream_receiver.h @@ -82,6 +82,8 @@ class CommandStreamReceiver { virtual bool flushBatchedSubmissions() = 0; bool submitBatchBuffer(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency); + virtual void programHardwareContext() = 0; + virtual size_t getCmdsSizeForHardwareContext() const = 0; MOCKABLE_VIRTUAL void makeResident(GraphicsAllocation &gfxAllocation); virtual void makeNonResident(GraphicsAllocation &gfxAllocation); diff --git a/shared/source/command_stream/command_stream_receiver_hw.h b/shared/source/command_stream/command_stream_receiver_hw.h index d7a4bc0ab8..609dcbed7d 100644 --- a/shared/source/command_stream/command_stream_receiver_hw.h +++ b/shared/source/command_stream/command_stream_receiver_hw.h @@ -40,6 +40,8 @@ class CommandStreamReceiverHw : public CommandStreamReceiver { uint32_t taskLevel, DispatchFlags &dispatchFlags, Device &device) override; bool flushBatchedSubmissions() override; + void programHardwareContext() override; + size_t getCmdsSizeForHardwareContext() const override; static void addBatchBufferEnd(LinearStream &commandStream, void **patchLocation); void programEndingCmd(LinearStream &commandStream, void **patchLocation, bool directSubmissionEnabled); @@ -109,7 +111,7 @@ class CommandStreamReceiverHw : public CommandStreamReceiver { void programEngineModeEpliogue(LinearStream &csr, const DispatchFlags &dispatchFlags); void programEnginePrologue(LinearStream &csr); - size_t getCmdSizeForPrologue(const DispatchFlags &dispatchFlags) const; + size_t getCmdSizeForPrologue() const; void addClearSLMWorkAround(typename GfxFamily::PIPE_CONTROL *pCmd); void addPipeControlCmd(LinearStream &commandStream, PipeControlArgs &args); diff --git a/shared/source/command_stream/command_stream_receiver_hw_base.inl b/shared/source/command_stream/command_stream_receiver_hw_base.inl index e5e0957e92..255799cc6d 100644 --- a/shared/source/command_stream/command_stream_receiver_hw_base.inl +++ b/shared/source/command_stream/command_stream_receiver_hw_base.inl @@ -142,6 +142,16 @@ inline void CommandStreamReceiverHw::addPipeControlCmd( MemorySynchronizationCommands::addPipeControl(commandStream, args); } +template +void CommandStreamReceiverHw::programHardwareContext() { + programEnginePrologue(commandStream); +} + +template +size_t CommandStreamReceiverHw::getCmdsSizeForHardwareContext() const { + return getCmdSizeForPrologue(); +} + template CompletionStamp CommandStreamReceiverHw::flushTask( LinearStream &commandStreamTask, @@ -283,7 +293,8 @@ CompletionStamp CommandStreamReceiverHw::flushTask( if (executionEnvironment.rootDeviceEnvironments[device.getRootDeviceIndex()]->pageTableManager.get() && !pageTableManagerInitialized) { pageTableManagerInitialized = executionEnvironment.rootDeviceEnvironments[device.getRootDeviceIndex()]->pageTableManager->initPageTableManagerRegisters(this); } - programEnginePrologue(commandStreamCSR); + + programHardwareContext(); programComputeMode(commandStreamCSR, dispatchFlags); programPipelineSelect(commandStreamCSR, dispatchFlags.pipelineSelectArgs); programL3(commandStreamCSR, dispatchFlags, newL3Config); @@ -674,7 +685,7 @@ size_t CommandStreamReceiverHw::getRequiredCmdStreamSize(const Dispat size += getCmdSizeForPipelineSelect(); size += getCmdSizeForPreemption(dispatchFlags); size += getCmdSizeForEpilogue(dispatchFlags); - size += getCmdSizeForPrologue(dispatchFlags); + size += getCmdsSizeForHardwareContext(); if (executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo()->workaroundTable.waSamplerCacheFlushBetweenRedescribedSurfaceReads) { if (this->samplerCacheFlushRequired != SamplerCacheFlushState::samplerCacheFlushNotRequired) { @@ -959,7 +970,7 @@ inline void CommandStreamReceiverHw::programEnginePrologue(LinearStre } template -inline size_t CommandStreamReceiverHw::getCmdSizeForPrologue(const DispatchFlags &dispatchFlags) const { +inline size_t CommandStreamReceiverHw::getCmdSizeForPrologue() const { return 0u; } diff --git a/shared/test/unit_test/mocks/mock_command_stream_receiver.h b/shared/test/unit_test/mocks/mock_command_stream_receiver.h index 124c8fc0e2..47c66925d3 100644 --- a/shared/test/unit_test/mocks/mock_command_stream_receiver.h +++ b/shared/test/unit_test/mocks/mock_command_stream_receiver.h @@ -75,4 +75,9 @@ class MockCommandStreamReceiver : public CommandStreamReceiver { void downloadAllocations() override { downloadAllocationsCalled = true; } + + void programHardwareContext() override {} + size_t getCmdsSizeForHardwareContext() const override { + return 0; + } };