diff --git a/level_zero/core/source/cmdlist/cmdlist_hw.inl b/level_zero/core/source/cmdlist/cmdlist_hw.inl index 682520bf69..a98785e053 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw.inl @@ -144,7 +144,7 @@ ze_result_t CommandListCoreFamily::initialize(Device *device, NEO } } - this->logicalStateHelper.reset(NEO::LogicalStateHelper::create(true)); + this->logicalStateHelper.reset(NEO::LogicalStateHelper::create()); return returnType; } diff --git a/level_zero/core/source/cmdqueue/cmdqueue_hw.inl b/level_zero/core/source/cmdqueue/cmdqueue_hw.inl index a3cfa74261..b6957c0729 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue_hw.inl +++ b/level_zero/core/source/cmdqueue/cmdqueue_hw.inl @@ -377,7 +377,7 @@ ze_result_t CommandQueueHw::executeCommandLists( frontEndStateDirty = false; } - csr->getLogicalStateHelper()->writeStreamInline(child); + csr->getLogicalStateHelper()->writeStreamInline(child, false); } for (auto i = 0u; i < numCommandLists; ++i) { diff --git a/opencl/source/command_queue/command_queue.cpp b/opencl/source/command_queue/command_queue.cpp index ab48169c9e..7122bc5eaa 100644 --- a/opencl/source/command_queue/command_queue.cpp +++ b/opencl/source/command_queue/command_queue.cpp @@ -12,7 +12,6 @@ #include "shared/source/helpers/array_count.h" #include "shared/source/helpers/engine_node_helper.h" #include "shared/source/helpers/get_info.h" -#include "shared/source/helpers/logical_state_helper.h" #include "shared/source/helpers/ptr_math.h" #include "shared/source/helpers/string.h" #include "shared/source/helpers/timestamp_packet.h" @@ -1230,8 +1229,4 @@ void CommandQueue::clearLastBcsPackets() { } } -LogicalStateHelper *CommandQueue::getLogicalStateHelper() const { - return logicalStateHelper.get(); -} - } // namespace NEO diff --git a/opencl/source/command_queue/command_queue.h b/opencl/source/command_queue/command_queue.h index 096ebb586c..62d77515b9 100644 --- a/opencl/source/command_queue/command_queue.h +++ b/opencl/source/command_queue/command_queue.h @@ -35,7 +35,6 @@ class IndirectHeap; class Kernel; class MemObj; class PerformanceCounters; -class LogicalStateHelper; struct CompletionStamp; struct MultiDispatchInfo; @@ -359,8 +358,6 @@ class CommandQueue : public BaseObject<_cl_command_queue> { bool isTextureCacheFlushNeeded(uint32_t commandType) const; - LogicalStateHelper *getLogicalStateHelper() const; - protected: void *enqueueReadMemObjForMap(TransferProperties &transferProperties, EventsRequest &eventsRequest, cl_int &errcodeRet); cl_int enqueueWriteMemObjForUnmap(MemObj *memObj, void *mappedPtr, EventsRequest &eventsRequest); @@ -428,7 +425,6 @@ class CommandQueue : public BaseObject<_cl_command_queue> { std::unique_ptr deferredTimestampPackets; std::unique_ptr timestampPacketContainer; - std::unique_ptr logicalStateHelper; struct BcsTimestampPacketContainers { TimestampPacketContainer lastBarrierToWaitFor; diff --git a/opencl/source/command_queue/command_queue_hw.h b/opencl/source/command_queue/command_queue_hw.h index 61bff41690..0b7bda5537 100644 --- a/opencl/source/command_queue/command_queue_hw.h +++ b/opencl/source/command_queue/command_queue_hw.h @@ -10,7 +10,6 @@ #include "shared/source/command_stream/preemption.h" #include "shared/source/helpers/engine_control.h" #include "shared/source/helpers/hw_helper.h" -#include "shared/source/helpers/logical_state_helper.h" #include "shared/source/memory_manager/graphics_allocation.h" #include "opencl/source/cl_device/cl_device.h" @@ -38,8 +37,6 @@ class CommandQueueHw : public CommandQueue { const cl_queue_properties *properties, bool internalUsage) : BaseClass(context, device, properties, internalUsage) { - logicalStateHelper.reset(LogicalStateHelper::create(true)); - auto clPriority = getCmdQueueProperties(properties, CL_QUEUE_PRIORITY_KHR); if (clPriority & static_cast(CL_QUEUE_PRIORITY_LOW_KHR)) { diff --git a/opencl/test/unit_test/command_queue/command_queue_tests.cpp b/opencl/test/unit_test/command_queue/command_queue_tests.cpp index e8f9fd52f9..d32192bd6d 100644 --- a/opencl/test/unit_test/command_queue/command_queue_tests.cpp +++ b/opencl/test/unit_test/command_queue/command_queue_tests.cpp @@ -10,7 +10,6 @@ #include "shared/source/helpers/array_count.h" #include "shared/source/helpers/basic_math.h" #include "shared/source/helpers/engine_node_helper.h" -#include "shared/source/helpers/logical_state_helper.h" #include "shared/source/helpers/timestamp_packet.h" #include "shared/source/memory_manager/internal_allocation_storage.h" #include "shared/source/memory_manager/memory_manager.h" @@ -415,15 +414,6 @@ HWTEST_F(CommandQueueCommandStreamTest, givenCommandQueueThatWaitsOnAbortedUserE EXPECT_EQ(100u, cmdQ.taskLevel); } -HWTEST_F(CommandQueueCommandStreamTest, whenCreatingThenDontCreateLogicalStateHelper) { - MockContext context; - auto mockDevice = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); - - MockCommandQueueHw cmdQ(&context, mockDevice.get(), nullptr); - - EXPECT_EQ(nullptr, cmdQ.logicalStateHelper.get()); -} - HWTEST_F(CommandQueueCommandStreamTest, WhenCheckIsTextureCacheFlushNeededThenReturnProperValue) { MockContext context; auto mockDevice = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); diff --git a/opencl/test/unit_test/command_queue/enqueue_command_without_kernel_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_command_without_kernel_tests.cpp index 3ac1a64054..7cf052b6f7 100644 --- a/opencl/test/unit_test/command_queue/enqueue_command_without_kernel_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_command_without_kernel_tests.cpp @@ -66,7 +66,7 @@ HWTEST_F(EnqueueHandlerTest, givenLogicalStateHelperWhenDispatchingCommandsThenA using MI_NOOP = typename FamilyType::MI_NOOP; auto mockCmdQ = std::make_unique>(context, pClDevice, nullptr); - auto logicalStateHelper = new LogicalStateHelperMock(false); + auto logicalStateHelper = new LogicalStateHelperMock(); auto &ultCsr = static_cast &>(mockCmdQ->getGpgpuCommandStreamReceiver()); ultCsr.logicalStateHelper.reset(logicalStateHelper); diff --git a/opencl/test/unit_test/helpers/hw_helper_tests.cpp b/opencl/test/unit_test/helpers/hw_helper_tests.cpp index 37bd5654fb..25aa145fea 100644 --- a/opencl/test/unit_test/helpers/hw_helper_tests.cpp +++ b/opencl/test/unit_test/helpers/hw_helper_tests.cpp @@ -1479,6 +1479,5 @@ HWTEST_F(HwHelperTest, givenHwHelperWhenPassingComputeEngineTypeThenItsNotCopyOn using LogicalStateHelperTest = ::testing::Test; HWTEST_F(LogicalStateHelperTest, whenCreatingLogicalStateHelperThenReturnNullptr) { - EXPECT_EQ(nullptr, LogicalStateHelper::create(true)); - EXPECT_EQ(nullptr, LogicalStateHelper::create(false)); + EXPECT_EQ(nullptr, LogicalStateHelper::create()); } diff --git a/opencl/test/unit_test/mocks/mock_command_queue.h b/opencl/test/unit_test/mocks/mock_command_queue.h index 53dfd2088f..28eb40241b 100644 --- a/opencl/test/unit_test/mocks/mock_command_queue.h +++ b/opencl/test/unit_test/mocks/mock_command_queue.h @@ -243,7 +243,6 @@ class MockCommandQueueHw : public CommandQueueHw { using BaseClass::gpgpuEngine; using BaseClass::isBlitAuxTranslationRequired; using BaseClass::latestSentEnqueueType; - using BaseClass::logicalStateHelper; using BaseClass::obtainCommandStream; using BaseClass::obtainNewTimestampPacketNodes; using BaseClass::requiresCacheFlushAfterWalker; diff --git a/opencl/test/unit_test/os_interface/linux/cl_drm_memory_manager_tests.cpp b/opencl/test/unit_test/os_interface/linux/cl_drm_memory_manager_tests.cpp index 4b73f04bbb..8e52d61094 100644 --- a/opencl/test/unit_test/os_interface/linux/cl_drm_memory_manager_tests.cpp +++ b/opencl/test/unit_test/os_interface/linux/cl_drm_memory_manager_tests.cpp @@ -12,6 +12,7 @@ #include "shared/source/gmm_helper/gmm_helper.h" #include "shared/source/helpers/aligned_memory.h" #include "shared/source/helpers/constants.h" +#include "shared/source/helpers/logical_state_helper.h" #include "shared/source/helpers/ptr_math.h" #include "shared/source/helpers/timestamp_packet.h" #include "shared/source/os_interface/linux/allocator_helper.h" @@ -30,6 +31,7 @@ #include "shared/test/common/test_macros/hw_test.h" #include "shared/test/unit_test/helpers/gtest_helpers.h" +#include "opencl/source/command_queue/command_queue.h" #include "opencl/source/event/event.h" #include "opencl/source/helpers/cl_memory_properties_helpers.h" #include "opencl/source/mem_obj/buffer.h" @@ -483,6 +485,9 @@ HWTEST_F(ClDrmMemoryManagerTest, givenDrmMemoryManagerWhenTiledImageIsBeingCreat MockContext context(pClDevice); + auto testedCsr = static_cast *>(context.getSpecialQueue(rootDeviceIndex)->getGpgpuEngine().commandStreamReceiver); + testedCsr->logicalStateHelper.reset(LogicalStateHelper::create()); + cl_image_format imageFormat; imageFormat.image_channel_data_type = CL_UNORM_INT8; imageFormat.image_channel_order = CL_R; 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 f35ebdd398..ca9769d3a2 100644 --- a/shared/source/command_stream/command_stream_receiver_hw_base.inl +++ b/shared/source/command_stream/command_stream_receiver_hw_base.inl @@ -75,7 +75,7 @@ CommandStreamReceiverHw::CommandStreamReceiverHw(ExecutionEnvironment timestampPacketWriteEnabled = !!DebugManager.flags.EnableTimestampPacket.get(); } - logicalStateHelper.reset(LogicalStateHelper::create(false)); + logicalStateHelper.reset(LogicalStateHelper::create()); createScratchSpaceController(); configurePostSyncWriteOffset(); @@ -540,7 +540,7 @@ CompletionStamp CommandStreamReceiverHw::flushTask( } if (logicalStateHelper) { - logicalStateHelper->writeStreamInline(commandStreamCSR); + logicalStateHelper->writeStreamInline(commandStreamCSR, false); } // If the CSR has work in its CS, flush it before the task @@ -1069,7 +1069,7 @@ std::optional CommandStreamReceiverHw::flushBcsTask(const B } if (logicalStateHelper) { - logicalStateHelper->writeStreamInline(commandStream); + logicalStateHelper->writeStreamInline(commandStream, false); } for (auto &blitProperties : blitPropertiesContainer) { diff --git a/shared/source/direct_submission/direct_submission_hw.inl b/shared/source/direct_submission/direct_submission_hw.inl index accdb51bad..b0f9da4dd5 100644 --- a/shared/source/direct_submission/direct_submission_hw.inl +++ b/shared/source/direct_submission/direct_submission_hw.inl @@ -646,7 +646,7 @@ void DirectSubmissionHw::dispatchSystemMemoryFenceAddress EncodeMemoryFence::encodeSystemMemoryFence(ringCommandStream, this->globalFenceAllocation, this->logicalStateHelper); if (logicalStateHelper) { - logicalStateHelper->writeStreamInline(ringCommandStream); + logicalStateHelper->writeStreamInline(ringCommandStream, false); } } diff --git a/shared/source/gen11/hw_helper_gen11.cpp b/shared/source/gen11/hw_helper_gen11.cpp index ca4bf2c0da..2a0b1cf661 100644 --- a/shared/source/gen11/hw_helper_gen11.cpp +++ b/shared/source/gen11/hw_helper_gen11.cpp @@ -41,5 +41,5 @@ template class FlatBatchBufferHelperHw; template struct MemorySynchronizationCommands; template struct LriHelper; -template LogicalStateHelper *LogicalStateHelper::create(bool pipelinedState); +template LogicalStateHelper *LogicalStateHelper::create(); } // namespace NEO diff --git a/shared/source/gen12lp/hw_helper_gen12lp.cpp b/shared/source/gen12lp/hw_helper_gen12lp.cpp index 717b53f646..b0e8f6038e 100644 --- a/shared/source/gen12lp/hw_helper_gen12lp.cpp +++ b/shared/source/gen12lp/hw_helper_gen12lp.cpp @@ -214,5 +214,5 @@ template class FlatBatchBufferHelperHw; template struct MemorySynchronizationCommands; template struct LriHelper; -template LogicalStateHelper *LogicalStateHelper::create(bool pipelinedState); +template LogicalStateHelper *LogicalStateHelper::create(); } // namespace NEO diff --git a/shared/source/gen8/hw_helper_gen8.cpp b/shared/source/gen8/hw_helper_gen8.cpp index 390018dc64..ac75831fba 100644 --- a/shared/source/gen8/hw_helper_gen8.cpp +++ b/shared/source/gen8/hw_helper_gen8.cpp @@ -82,5 +82,5 @@ template class FlatBatchBufferHelperHw; template struct MemorySynchronizationCommands; template struct LriHelper; -template LogicalStateHelper *LogicalStateHelper::create(bool pipelinedState); +template LogicalStateHelper *LogicalStateHelper::create(); } // namespace NEO diff --git a/shared/source/gen9/hw_helper_gen9.cpp b/shared/source/gen9/hw_helper_gen9.cpp index 50cb5d8aac..c808a35320 100644 --- a/shared/source/gen9/hw_helper_gen9.cpp +++ b/shared/source/gen9/hw_helper_gen9.cpp @@ -52,5 +52,5 @@ template class FlatBatchBufferHelperHw; template struct MemorySynchronizationCommands; template struct LriHelper; -template LogicalStateHelper *LogicalStateHelper::create(bool pipelinedState); +template LogicalStateHelper *LogicalStateHelper::create(); } // namespace NEO diff --git a/shared/source/helpers/logical_state_helper.h b/shared/source/helpers/logical_state_helper.h index 38942b4ef2..75c54ab7e2 100644 --- a/shared/source/helpers/logical_state_helper.h +++ b/shared/source/helpers/logical_state_helper.h @@ -13,15 +13,14 @@ class LinearStream; class LogicalStateHelper { public: template - static LogicalStateHelper *create(bool pipelinedState); + static LogicalStateHelper *create(); virtual ~LogicalStateHelper() = default; - virtual void writeStreamInline(LinearStream &linearStream) = 0; + virtual void writeStreamInline(LinearStream &linearStream, bool pipelinedState) = 0; protected: - LogicalStateHelper(bool pipelinedState){}; - LogicalStateHelper() = delete; + LogicalStateHelper() = default; }; } // namespace NEO \ No newline at end of file diff --git a/shared/source/helpers/logical_state_helper.inl b/shared/source/helpers/logical_state_helper.inl index 2b89997d7a..dc0eea0545 100644 --- a/shared/source/helpers/logical_state_helper.inl +++ b/shared/source/helpers/logical_state_helper.inl @@ -10,7 +10,7 @@ namespace NEO { template -LogicalStateHelper *LogicalStateHelper::create(bool pipelinedState) { +LogicalStateHelper *LogicalStateHelper::create() { return nullptr; } diff --git a/shared/source/xe_hp_core/hw_helper_xe_hp_core.cpp b/shared/source/xe_hp_core/hw_helper_xe_hp_core.cpp index 3bef0d8a6d..eedb571cc4 100644 --- a/shared/source/xe_hp_core/hw_helper_xe_hp_core.cpp +++ b/shared/source/xe_hp_core/hw_helper_xe_hp_core.cpp @@ -157,5 +157,5 @@ template class FlatBatchBufferHelperHw; template struct MemorySynchronizationCommands; template struct LriHelper; -template LogicalStateHelper *LogicalStateHelper::create(bool pipelinedState); +template LogicalStateHelper *LogicalStateHelper::create(); } // namespace NEO diff --git a/shared/source/xe_hpc_core/hw_helper_xe_hpc_core.cpp b/shared/source/xe_hpc_core/hw_helper_xe_hpc_core.cpp index 1611c69d29..d8ed8d73d4 100644 --- a/shared/source/xe_hpc_core/hw_helper_xe_hpc_core.cpp +++ b/shared/source/xe_hpc_core/hw_helper_xe_hpc_core.cpp @@ -460,5 +460,5 @@ template class FlatBatchBufferHelperHw; template struct MemorySynchronizationCommands; template struct LriHelper; -template LogicalStateHelper *LogicalStateHelper::create(bool pipelinedState); +template LogicalStateHelper *LogicalStateHelper::create(); } // namespace NEO diff --git a/shared/source/xe_hpg_core/hw_helper_xe_hpg_core.cpp b/shared/source/xe_hpg_core/hw_helper_xe_hpg_core.cpp index e58c7935cd..63cc2c641e 100644 --- a/shared/source/xe_hpg_core/hw_helper_xe_hpg_core.cpp +++ b/shared/source/xe_hpg_core/hw_helper_xe_hpg_core.cpp @@ -153,5 +153,5 @@ template class FlatBatchBufferHelperHw; template struct MemorySynchronizationCommands; template struct LriHelper; -template LogicalStateHelper *LogicalStateHelper::create(bool pipelinedState); +template LogicalStateHelper *LogicalStateHelper::create(); } // namespace NEO diff --git a/shared/test/common/mocks/linux/mock_drm_command_stream_receiver.h b/shared/test/common/mocks/linux/mock_drm_command_stream_receiver.h index 65eb10c5d7..7662b47026 100644 --- a/shared/test/common/mocks/linux/mock_drm_command_stream_receiver.h +++ b/shared/test/common/mocks/linux/mock_drm_command_stream_receiver.h @@ -24,6 +24,7 @@ class TestedDrmCommandStreamReceiver : public DrmCommandStreamReceiver class LogicalStateHelperMock : public GfxFamily::LogicalStateHelperHw { public: - LogicalStateHelperMock(bool pipelinedState) : GfxFamily::LogicalStateHelperHw(pipelinedState) { + LogicalStateHelperMock() : GfxFamily::LogicalStateHelperHw() { } - void writeStreamInline(LinearStream &linearStream) override { + void writeStreamInline(LinearStream &linearStream, bool pipelinedState) override { writeStreamInlineCalledCounter++; auto cmd = linearStream.getSpaceForCmd();