Add LogicalStateHelper class

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2022-06-14 14:18:28 +00:00
committed by Compute-Runtime-Automation
parent b7eb9b5ed0
commit 939d109362
18 changed files with 103 additions and 0 deletions

View File

@ -10,6 +10,7 @@
#include "shared/source/command_stream/preemption.h" #include "shared/source/command_stream/preemption.h"
#include "shared/source/helpers/engine_control.h" #include "shared/source/helpers/engine_control.h"
#include "shared/source/helpers/hw_helper.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 "shared/source/memory_manager/graphics_allocation.h"
#include "opencl/source/cl_device/cl_device.h" #include "opencl/source/cl_device/cl_device.h"
@ -37,6 +38,8 @@ class CommandQueueHw : public CommandQueue {
const cl_queue_properties *properties, const cl_queue_properties *properties,
bool internalUsage) : BaseClass(context, device, properties, internalUsage) { bool internalUsage) : BaseClass(context, device, properties, internalUsage) {
logicalStateHelper.reset(LogicalStateHelper::create<GfxFamily>(true));
auto clPriority = getCmdQueueProperties<cl_queue_priority_khr>(properties, CL_QUEUE_PRIORITY_KHR); auto clPriority = getCmdQueueProperties<cl_queue_priority_khr>(properties, CL_QUEUE_PRIORITY_KHR);
if (clPriority & static_cast<cl_queue_priority_khr>(CL_QUEUE_PRIORITY_LOW_KHR)) { if (clPriority & static_cast<cl_queue_priority_khr>(CL_QUEUE_PRIORITY_LOW_KHR)) {
@ -502,5 +505,7 @@ class CommandQueueHw : public CommandQueue {
void setupEvent(EventBuilder &eventBuilder, cl_event *outEvent, uint32_t cmdType); void setupEvent(EventBuilder &eventBuilder, cl_event *outEvent, uint32_t cmdType);
bool isBlitAuxTranslationRequired(const MultiDispatchInfo &multiDispatchInfo); bool isBlitAuxTranslationRequired(const MultiDispatchInfo &multiDispatchInfo);
std::unique_ptr<LogicalStateHelper> logicalStateHelper;
}; };
} // namespace NEO } // namespace NEO

View File

@ -10,6 +10,7 @@
#include "shared/source/helpers/array_count.h" #include "shared/source/helpers/array_count.h"
#include "shared/source/helpers/basic_math.h" #include "shared/source/helpers/basic_math.h"
#include "shared/source/helpers/engine_node_helper.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/helpers/timestamp_packet.h"
#include "shared/source/memory_manager/internal_allocation_storage.h" #include "shared/source/memory_manager/internal_allocation_storage.h"
#include "shared/source/memory_manager/memory_manager.h" #include "shared/source/memory_manager/memory_manager.h"
@ -414,6 +415,15 @@ HWTEST_F(CommandQueueCommandStreamTest, givenCommandQueueThatWaitsOnAbortedUserE
EXPECT_EQ(100u, cmdQ.taskLevel); EXPECT_EQ(100u, cmdQ.taskLevel);
} }
HWTEST_F(CommandQueueCommandStreamTest, whenCreatingThenDontCreateLogicalStateHelper) {
MockContext context;
auto mockDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockCommandQueueHw<FamilyType> cmdQ(&context, mockDevice.get(), nullptr);
EXPECT_EQ(nullptr, cmdQ.logicalStateHelper.get());
}
HWTEST_F(CommandQueueCommandStreamTest, WhenCheckIsTextureCacheFlushNeededThenReturnProperValue) { HWTEST_F(CommandQueueCommandStreamTest, WhenCheckIsTextureCacheFlushNeededThenReturnProperValue) {
MockContext context; MockContext context;
auto mockDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr)); auto mockDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));

View File

@ -10,6 +10,7 @@
#include "shared/source/command_stream/scratch_space_controller_base.h" #include "shared/source/command_stream/scratch_space_controller_base.h"
#include "shared/source/command_stream/wait_status.h" #include "shared/source/command_stream/wait_status.h"
#include "shared/source/helpers/constants.h" #include "shared/source/helpers/constants.h"
#include "shared/source/helpers/logical_state_helper.h"
#include "shared/source/os_interface/hw_info_config.h" #include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/engine_descriptor_helper.h" #include "shared/test/common/helpers/engine_descriptor_helper.h"
@ -489,6 +490,11 @@ HWTEST_F(UltCommandStreamReceiverTest, givenMultiplePartitionsWhenCallingWaitKmd
EXPECT_EQ(2u, commandStreamReceiver.waitForCompletionWithTimeoutTaskCountCalled); EXPECT_EQ(2u, commandStreamReceiver.waitForCompletionWithTimeoutTaskCountCalled);
} }
HWTEST_F(UltCommandStreamReceiverTest, whenCreatingThenDontCreateLogicalStateHelper) {
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
EXPECT_EQ(nullptr, commandStreamReceiver.logicalStateHelper.get());
}
typedef UltCommandStreamReceiverTest CommandStreamReceiverFlushTests; typedef UltCommandStreamReceiverTest CommandStreamReceiverFlushTests;
HWTEST_F(CommandStreamReceiverFlushTests, WhenAddingBatchBufferEndThenBatchBufferEndIsAppendedCorrectly) { HWTEST_F(CommandStreamReceiverFlushTests, WhenAddingBatchBufferEndThenBatchBufferEndIsAppendedCorrectly) {

View File

@ -11,6 +11,7 @@
#include "shared/source/gmm_helper/gmm_helper.h" #include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/gmm_helper/resource_info.h" #include "shared/source/gmm_helper/resource_info.h"
#include "shared/source/helpers/aligned_memory.h" #include "shared/source/helpers/aligned_memory.h"
#include "shared/source/helpers/logical_state_helper.h"
#include "shared/source/helpers/pipe_control_args.h" #include "shared/source/helpers/pipe_control_args.h"
#include "shared/source/helpers/string.h" #include "shared/source/helpers/string.h"
#include "shared/source/memory_manager/graphics_allocation.h" #include "shared/source/memory_manager/graphics_allocation.h"
@ -1467,3 +1468,10 @@ HWTEST_F(HwHelperTest, givenHwHelperWhenPassingLinkedCopyEngineTypeThenItsCopyOn
HWTEST_F(HwHelperTest, givenHwHelperWhenPassingComputeEngineTypeThenItsNotCopyOnly) { HWTEST_F(HwHelperTest, givenHwHelperWhenPassingComputeEngineTypeThenItsNotCopyOnly) {
EXPECT_FALSE(EngineHelper::isCopyOnlyEngineType(EngineGroupType::Compute)); EXPECT_FALSE(EngineHelper::isCopyOnlyEngineType(EngineGroupType::Compute));
} }
using LogicalStateHelperTest = ::testing::Test;
HWTEST_F(LogicalStateHelperTest, whenCreatingLogicalStateHelperThenReturnNullptr) {
EXPECT_EQ(nullptr, LogicalStateHelper::create<FamilyType>(true));
EXPECT_EQ(nullptr, LogicalStateHelper::create<FamilyType>(false));
}

View File

@ -243,6 +243,7 @@ class MockCommandQueueHw : public CommandQueueHw<GfxFamily> {
using BaseClass::gpgpuEngine; using BaseClass::gpgpuEngine;
using BaseClass::isBlitAuxTranslationRequired; using BaseClass::isBlitAuxTranslationRequired;
using BaseClass::latestSentEnqueueType; using BaseClass::latestSentEnqueueType;
using BaseClass::logicalStateHelper;
using BaseClass::obtainCommandStream; using BaseClass::obtainCommandStream;
using BaseClass::obtainNewTimestampPacketNodes; using BaseClass::obtainNewTimestampPacketNodes;
using BaseClass::requiresCacheFlushAfterWalker; using BaseClass::requiresCacheFlushAfterWalker;

View File

@ -24,6 +24,7 @@ namespace NEO {
template <typename GfxFamily> template <typename GfxFamily>
class DeviceCommandStreamReceiver; class DeviceCommandStreamReceiver;
struct PipeControlArgs; struct PipeControlArgs;
class LogicalStateHelper;
template <typename GfxFamily> template <typename GfxFamily>
class CommandStreamReceiverHw : public CommandStreamReceiver { class CommandStreamReceiverHw : public CommandStreamReceiver {
@ -189,6 +190,7 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
std::unique_ptr<DirectSubmissionHw<GfxFamily, RenderDispatcher<GfxFamily>>> directSubmission; std::unique_ptr<DirectSubmissionHw<GfxFamily, RenderDispatcher<GfxFamily>>> directSubmission;
std::unique_ptr<DirectSubmissionHw<GfxFamily, BlitterDispatcher<GfxFamily>>> blitterDirectSubmission; std::unique_ptr<DirectSubmissionHw<GfxFamily, BlitterDispatcher<GfxFamily>>> blitterDirectSubmission;
std::unique_ptr<LogicalStateHelper> logicalStateHelper;
size_t cmdStreamStart = 0; size_t cmdStreamStart = 0;
}; };

View File

@ -26,6 +26,7 @@
#include "shared/source/helpers/flat_batch_buffer_helper_hw.h" #include "shared/source/helpers/flat_batch_buffer_helper_hw.h"
#include "shared/source/helpers/flush_stamp.h" #include "shared/source/helpers/flush_stamp.h"
#include "shared/source/helpers/hw_helper.h" #include "shared/source/helpers/hw_helper.h"
#include "shared/source/helpers/logical_state_helper.h"
#include "shared/source/helpers/pause_on_gpu_properties.h" #include "shared/source/helpers/pause_on_gpu_properties.h"
#include "shared/source/helpers/preamble.h" #include "shared/source/helpers/preamble.h"
#include "shared/source/helpers/ptr_math.h" #include "shared/source/helpers/ptr_math.h"
@ -73,6 +74,9 @@ CommandStreamReceiverHw<GfxFamily>::CommandStreamReceiverHw(ExecutionEnvironment
if (DebugManager.flags.EnableTimestampPacket.get() != -1) { if (DebugManager.flags.EnableTimestampPacket.get() != -1) {
timestampPacketWriteEnabled = !!DebugManager.flags.EnableTimestampPacket.get(); timestampPacketWriteEnabled = !!DebugManager.flags.EnableTimestampPacket.get();
} }
logicalStateHelper.reset(LogicalStateHelper::create<GfxFamily>(false));
createScratchSpaceController(); createScratchSpaceController();
configurePostSyncWriteOffset(); configurePostSyncWriteOffset();
} }

View File

@ -11,6 +11,7 @@
#include "shared/source/helpers/hw_helper_base.inl" #include "shared/source/helpers/hw_helper_base.inl"
#include "shared/source/helpers/hw_helper_bdw_and_later.inl" #include "shared/source/helpers/hw_helper_bdw_and_later.inl"
#include "shared/source/helpers/hw_helper_bdw_to_icllp.inl" #include "shared/source/helpers/hw_helper_bdw_to_icllp.inl"
#include "shared/source/helpers/logical_state_helper.inl"
namespace NEO { namespace NEO {
typedef ICLFamily Family; typedef ICLFamily Family;
@ -39,4 +40,6 @@ template class HwHelperHw<Family>;
template class FlatBatchBufferHelperHw<Family>; template class FlatBatchBufferHelperHw<Family>;
template struct MemorySynchronizationCommands<Family>; template struct MemorySynchronizationCommands<Family>;
template struct LriHelper<Family>; template struct LriHelper<Family>;
template LogicalStateHelper *LogicalStateHelper::create<Family>(bool pipelinedState);
} // namespace NEO } // namespace NEO

View File

@ -14,6 +14,7 @@ using Family = NEO::TGLLPFamily;
#include "shared/source/helpers/hw_helper_base.inl" #include "shared/source/helpers/hw_helper_base.inl"
#include "shared/source/helpers/hw_helper_bdw_and_later.inl" #include "shared/source/helpers/hw_helper_bdw_and_later.inl"
#include "shared/source/helpers/hw_helper_tgllp_and_later.inl" #include "shared/source/helpers/hw_helper_tgllp_and_later.inl"
#include "shared/source/helpers/logical_state_helper.inl"
#include "shared/source/os_interface/hw_info_config.h" #include "shared/source/os_interface/hw_info_config.h"
#include "engine_node.h" #include "engine_node.h"
@ -212,4 +213,6 @@ template class HwHelperHw<Family>;
template class FlatBatchBufferHelperHw<Family>; template class FlatBatchBufferHelperHw<Family>;
template struct MemorySynchronizationCommands<Family>; template struct MemorySynchronizationCommands<Family>;
template struct LriHelper<Family>; template struct LriHelper<Family>;
template LogicalStateHelper *LogicalStateHelper::create<Family>(bool pipelinedState);
} // namespace NEO } // namespace NEO

View File

@ -12,6 +12,7 @@
#include "shared/source/helpers/hw_helper_base.inl" #include "shared/source/helpers/hw_helper_base.inl"
#include "shared/source/helpers/hw_helper_bdw_and_later.inl" #include "shared/source/helpers/hw_helper_bdw_and_later.inl"
#include "shared/source/helpers/hw_helper_bdw_to_icllp.inl" #include "shared/source/helpers/hw_helper_bdw_to_icllp.inl"
#include "shared/source/helpers/logical_state_helper.inl"
namespace NEO { namespace NEO {
typedef BDWFamily Family; typedef BDWFamily Family;
@ -80,4 +81,6 @@ template class HwHelperHw<Family>;
template class FlatBatchBufferHelperHw<Family>; template class FlatBatchBufferHelperHw<Family>;
template struct MemorySynchronizationCommands<Family>; template struct MemorySynchronizationCommands<Family>;
template struct LriHelper<Family>; template struct LriHelper<Family>;
template LogicalStateHelper *LogicalStateHelper::create<Family>(bool pipelinedState);
} // namespace NEO } // namespace NEO

View File

@ -11,6 +11,7 @@
#include "shared/source/helpers/hw_helper_base.inl" #include "shared/source/helpers/hw_helper_base.inl"
#include "shared/source/helpers/hw_helper_bdw_and_later.inl" #include "shared/source/helpers/hw_helper_bdw_and_later.inl"
#include "shared/source/helpers/hw_helper_bdw_to_icllp.inl" #include "shared/source/helpers/hw_helper_bdw_to_icllp.inl"
#include "shared/source/helpers/logical_state_helper.inl"
#include <cstring> #include <cstring>
@ -50,4 +51,6 @@ template class HwHelperHw<Family>;
template class FlatBatchBufferHelperHw<Family>; template class FlatBatchBufferHelperHw<Family>;
template struct MemorySynchronizationCommands<Family>; template struct MemorySynchronizationCommands<Family>;
template struct LriHelper<Family>; template struct LriHelper<Family>;
template LogicalStateHelper *LogicalStateHelper::create<Family>(bool pipelinedState);
} // namespace NEO } // namespace NEO

View File

@ -89,6 +89,8 @@ set(NEO_CORE_HELPERS
${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen_sse4.cpp ${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen_sse4.cpp
${CMAKE_CURRENT_SOURCE_DIR}/local_work_size.cpp ${CMAKE_CURRENT_SOURCE_DIR}/local_work_size.cpp
${CMAKE_CURRENT_SOURCE_DIR}/local_work_size.h ${CMAKE_CURRENT_SOURCE_DIR}/local_work_size.h
${CMAKE_CURRENT_SOURCE_DIR}/logical_state_helper.h
${CMAKE_CURRENT_SOURCE_DIR}/logical_state_helper.inl
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}memory_properties_helpers.cpp ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}memory_properties_helpers.cpp
${CMAKE_CURRENT_SOURCE_DIR}/memory_properties_helpers.h ${CMAKE_CURRENT_SOURCE_DIR}/memory_properties_helpers.h
${CMAKE_CURRENT_SOURCE_DIR}/memory_properties_helpers_base.inl ${CMAKE_CURRENT_SOURCE_DIR}/memory_properties_helpers_base.inl

View File

@ -0,0 +1,26 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
namespace NEO {
class LinearStream;
class LogicalStateHelper {
public:
template <typename Family>
static LogicalStateHelper *create(bool pipelinedState);
virtual ~LogicalStateHelper() = default;
virtual void writeStreamInline(LinearStream &linearStream) = 0;
protected:
LogicalStateHelper() = default;
};
} // namespace NEO

View File

@ -0,0 +1,17 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/logical_state_helper.h"
namespace NEO {
template <typename GfxFamily>
LogicalStateHelper *LogicalStateHelper::create(bool pipelinedState) {
return nullptr;
}
} // namespace NEO

View File

@ -17,6 +17,7 @@ using Family = NEO::XeHpFamily;
#include "shared/source/helpers/hw_helper_base.inl" #include "shared/source/helpers/hw_helper_base.inl"
#include "shared/source/helpers/hw_helper_tgllp_and_later.inl" #include "shared/source/helpers/hw_helper_tgllp_and_later.inl"
#include "shared/source/helpers/hw_helper_xehp_and_later.inl" #include "shared/source/helpers/hw_helper_xehp_and_later.inl"
#include "shared/source/helpers/logical_state_helper.inl"
#include "shared/source/os_interface/hw_info_config.h" #include "shared/source/os_interface/hw_info_config.h"
namespace NEO { namespace NEO {
@ -155,4 +156,6 @@ template class HwHelperHw<Family>;
template class FlatBatchBufferHelperHw<Family>; template class FlatBatchBufferHelperHw<Family>;
template struct MemorySynchronizationCommands<Family>; template struct MemorySynchronizationCommands<Family>;
template struct LriHelper<Family>; template struct LriHelper<Family>;
template LogicalStateHelper *LogicalStateHelper::create<Family>(bool pipelinedState);
} // namespace NEO } // namespace NEO

View File

@ -17,6 +17,7 @@ using Family = NEO::XE_HPC_COREFamily;
#include "shared/source/helpers/hw_helper_dg2_and_later.inl" #include "shared/source/helpers/hw_helper_dg2_and_later.inl"
#include "shared/source/helpers/hw_helper_tgllp_and_later.inl" #include "shared/source/helpers/hw_helper_tgllp_and_later.inl"
#include "shared/source/helpers/hw_helper_xehp_and_later.inl" #include "shared/source/helpers/hw_helper_xehp_and_later.inl"
#include "shared/source/helpers/logical_state_helper.inl"
namespace NEO { namespace NEO {
@ -458,4 +459,6 @@ template class HwHelperHw<Family>;
template class FlatBatchBufferHelperHw<Family>; template class FlatBatchBufferHelperHw<Family>;
template struct MemorySynchronizationCommands<Family>; template struct MemorySynchronizationCommands<Family>;
template struct LriHelper<Family>; template struct LriHelper<Family>;
template LogicalStateHelper *LogicalStateHelper::create<Family>(bool pipelinedState);
} // namespace NEO } // namespace NEO

View File

@ -17,6 +17,7 @@ using Family = NEO::XE_HPG_COREFamily;
#include "shared/source/helpers/hw_helper_dg2_and_later.inl" #include "shared/source/helpers/hw_helper_dg2_and_later.inl"
#include "shared/source/helpers/hw_helper_tgllp_and_later.inl" #include "shared/source/helpers/hw_helper_tgllp_and_later.inl"
#include "shared/source/helpers/hw_helper_xehp_and_later.inl" #include "shared/source/helpers/hw_helper_xehp_and_later.inl"
#include "shared/source/helpers/logical_state_helper.inl"
namespace NEO { namespace NEO {
template <> template <>
@ -139,4 +140,6 @@ template class HwHelperHw<Family>;
template class FlatBatchBufferHelperHw<Family>; template class FlatBatchBufferHelperHw<Family>;
template struct MemorySynchronizationCommands<Family>; template struct MemorySynchronizationCommands<Family>;
template struct LriHelper<Family>; template struct LriHelper<Family>;
template LogicalStateHelper *LogicalStateHelper::create<Family>(bool pipelinedState);
} // namespace NEO } // namespace NEO

View File

@ -44,6 +44,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
using BaseClass::isBlitterDirectSubmissionEnabled; using BaseClass::isBlitterDirectSubmissionEnabled;
using BaseClass::isDirectSubmissionEnabled; using BaseClass::isDirectSubmissionEnabled;
using BaseClass::isPerDssBackedBufferSent; using BaseClass::isPerDssBackedBufferSent;
using BaseClass::logicalStateHelper;
using BaseClass::makeResident; using BaseClass::makeResident;
using BaseClass::perDssBackedBuffer; using BaseClass::perDssBackedBuffer;
using BaseClass::postInitFlagsSetup; using BaseClass::postInitFlagsSetup;