From 08d4e57cb304514727677a6ab10e8f7fd00dea46 Mon Sep 17 00:00:00 2001 From: Kamil Kopryk Date: Fri, 18 Nov 2022 12:30:40 +0000 Subject: [PATCH] Move L0HwHelper ownership to RootDeviceEnvironment 5/n Related-To: NEO-6853 Signed-off-by: Kamil Kopryk Use RootDeviceEnvironment getHelper for - enableFrontEndStateTracking - enablePipelineSelectStateTracking - enableStateComputeModeTracking - enableImmediateCmdListHeapSharing - platformSupportsCmdListHeapSharing - platformSupportsStateComputeModeTracking - platformSupportsFrontEndTracking - platformSupportsPipelineSelectTracking --- level_zero/core/source/cmdlist/cmdlist_hw.inl | 13 +++++----- .../core/source/cmdlist/cmdlist_imp.cpp | 4 ++- level_zero/core/source/cmdqueue/cmdqueue.cpp | 8 +++--- .../core/source/hw_helpers/l0_hw_helper.cpp | 23 +++++++++++------ .../core/source/hw_helpers/l0_hw_helper.h | 25 ++++++++++--------- .../hw_helpers/l0_hw_helper_skl_and_later.inl | 8 +++--- .../l0_hw_helper_xehp_and_later.inl | 8 +++--- .../gen11/test_l0_hw_helper_gen11.cpp | 19 +++++++------- .../gen12lp/test_l0_hw_helper_gen12lp.cpp | 18 ++++++------- .../gen9/test_l0_hw_helper_gen9.cpp | 19 +++++++------- .../sources/cmdlist/test_cmdlist_1.cpp | 9 +++---- .../sources/cmdlist/test_cmdlist_2.cpp | 4 +-- .../sources/cmdqueue/test_cmdqueue_1.cpp | 9 +++---- .../test_l0_hw_helper_xe_hp_core.cpp | 12 +++------ .../test_l0_hw_helper_xe_hpc_core.cpp | 12 +++------ .../test_l0_hw_helper_xe_hpg_core.cpp | 12 +++------ 16 files changed, 101 insertions(+), 102 deletions(-) diff --git a/level_zero/core/source/cmdlist/cmdlist_hw.inl b/level_zero/core/source/cmdlist/cmdlist_hw.inl index f300c5bddc..ba129d8a52 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw.inl @@ -133,14 +133,15 @@ ze_result_t CommandListCoreFamily::initialize(Device *device, NEO this->flags = flags; auto &hwInfo = device->getHwInfo(); + auto &rootDeviceEnvironment = device->getNEODevice()->getRootDeviceEnvironment(); this->dcFlushSupport = NEO::MemorySynchronizationCommands::getDcFlushEnable(true, hwInfo); this->systolicModeSupport = NEO::PreambleHelper::isSystolicModeConfigurable(hwInfo); - this->stateComputeModeTracking = L0HwHelper::enableStateComputeModeTracking(hwInfo); - this->frontEndStateTracking = L0HwHelper::enableFrontEndStateTracking(hwInfo); - this->pipelineSelectStateTracking = L0HwHelper::enablePipelineSelectStateTracking(hwInfo); - this->pipeControlMultiKernelEventSync = L0HwHelper::usePipeControlMultiKernelEventSync(hwInfo); - this->compactL3FlushEventPacket = L0HwHelper::useCompactL3FlushEventPacket(hwInfo); - this->signalAllEventPackets = L0HwHelper::useSignalAllEventPackets(hwInfo); + this->stateComputeModeTracking = L0CoreHelper::enableStateComputeModeTracking(rootDeviceEnvironment); + this->frontEndStateTracking = L0CoreHelper::enableFrontEndStateTracking(rootDeviceEnvironment); + this->pipelineSelectStateTracking = L0CoreHelper::enablePipelineSelectStateTracking(rootDeviceEnvironment); + this->pipeControlMultiKernelEventSync = L0CoreHelper::usePipeControlMultiKernelEventSync(hwInfo); + this->compactL3FlushEventPacket = L0CoreHelper::useCompactL3FlushEventPacket(hwInfo); + this->signalAllEventPackets = L0CoreHelper::useSignalAllEventPackets(hwInfo); if (device->isImplicitScalingCapable() && !this->internalUsage && !isCopyOnly()) { this->partitionCount = static_cast(this->device->getNEODevice()->getDeviceBitfield().count()); diff --git a/level_zero/core/source/cmdlist/cmdlist_imp.cpp b/level_zero/core/source/cmdlist/cmdlist_imp.cpp index c2da64a81d..175ce08081 100644 --- a/level_zero/core/source/cmdlist/cmdlist_imp.cpp +++ b/level_zero/core/source/cmdlist/cmdlist_imp.cpp @@ -139,7 +139,9 @@ CommandList *CommandList::createImmediate(uint32_t productFamily, Device *device commandList->isFlushTaskSubmissionEnabled = !!NEO::DebugManager.flags.EnableFlushTaskSubmission.get(); } PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Flush Task for Immediate command list : %s\n", commandList->isFlushTaskSubmissionEnabled ? "Enabled" : "Disabled"); - commandList->immediateCmdListHeapSharing = L0HwHelper::enableImmediateCmdListHeapSharing(hwInfo, commandList->isFlushTaskSubmissionEnabled); + + auto &rootDeviceEnvironment = device->getNEODevice()->getRootDeviceEnvironment(); + commandList->immediateCmdListHeapSharing = L0CoreHelper::enableImmediateCmdListHeapSharing(rootDeviceEnvironment, commandList->isFlushTaskSubmissionEnabled); } returnValue = commandList->initialize(device, engineGroupType, desc->flags); if (returnValue != ZE_RESULT_SUCCESS) { diff --git a/level_zero/core/source/cmdqueue/cmdqueue.cpp b/level_zero/core/source/cmdqueue/cmdqueue.cpp index 923ed079e2..23034224f0 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue.cpp +++ b/level_zero/core/source/cmdqueue/cmdqueue.cpp @@ -70,10 +70,10 @@ ze_result_t CommandQueueImp::initialize(bool copyOnly, bool isInternal) { if (NEO::Debugger::isDebugEnabled(internalUsage) && device->getL0Debugger()) { device->getL0Debugger()->notifyCommandQueueCreated(device->getNEODevice()); } - auto &hwInfo = device->getHwInfo(); - this->stateComputeModeTracking = L0HwHelper::enableStateComputeModeTracking(hwInfo); - this->frontEndStateTracking = L0HwHelper::enableFrontEndStateTracking(hwInfo); - this->pipelineSelectStateTracking = L0HwHelper::enablePipelineSelectStateTracking(hwInfo); + auto &rootDeviceEnvironment = device->getNEODevice()->getRootDeviceEnvironment(); + this->stateComputeModeTracking = L0CoreHelper::enableStateComputeModeTracking(rootDeviceEnvironment); + this->frontEndStateTracking = L0CoreHelper::enableFrontEndStateTracking(rootDeviceEnvironment); + this->pipelineSelectStateTracking = L0CoreHelper::enablePipelineSelectStateTracking(rootDeviceEnvironment); } return returnValue; } diff --git a/level_zero/core/source/hw_helpers/l0_hw_helper.cpp b/level_zero/core/source/hw_helpers/l0_hw_helper.cpp index e6c1a9dea4..2199ddf081 100644 --- a/level_zero/core/source/hw_helpers/l0_hw_helper.cpp +++ b/level_zero/core/source/hw_helpers/l0_hw_helper.cpp @@ -10,6 +10,9 @@ #include "shared/source/execution_environment/root_device_environment.h" #include "shared/source/helpers/hw_info.h" +template <> +L0::L0HwHelper &NEO::RootDeviceEnvironment::getHelper() const; + namespace L0 { L0HwHelper *l0HwHelperFactory[IGFX_MAX_CORE] = {}; @@ -18,32 +21,36 @@ L0HwHelper &L0HwHelper::get(GFXCORE_FAMILY gfxCore) { return *l0HwHelperFactory[gfxCore]; } -bool L0HwHelper::enableFrontEndStateTracking(const NEO::HardwareInfo &hwInfo) { +bool L0HwHelper::enableFrontEndStateTracking(const NEO::RootDeviceEnvironment &rootDeviceEnvironment) { if (NEO::DebugManager.flags.EnableFrontEndTracking.get() != -1) { return !!NEO::DebugManager.flags.EnableFrontEndTracking.get(); } - return get(hwInfo.platform.eRenderCoreFamily).platformSupportsFrontEndTracking(hwInfo); + auto &l0CoreHelper = rootDeviceEnvironment.getHelper(); + return l0CoreHelper.platformSupportsFrontEndTracking(); } -bool L0HwHelper::enablePipelineSelectStateTracking(const NEO::HardwareInfo &hwInfo) { +bool L0HwHelper::enablePipelineSelectStateTracking(const NEO::RootDeviceEnvironment &rootDeviceEnvironment) { if (NEO::DebugManager.flags.EnablePipelineSelectTracking.get() != -1) { return !!NEO::DebugManager.flags.EnablePipelineSelectTracking.get(); } - return get(hwInfo.platform.eRenderCoreFamily).platformSupportsPipelineSelectTracking(hwInfo); + auto &l0CoreHelper = rootDeviceEnvironment.getHelper(); + return l0CoreHelper.platformSupportsPipelineSelectTracking(); } -bool L0HwHelper::enableStateComputeModeTracking(const NEO::HardwareInfo &hwInfo) { +bool L0HwHelper::enableStateComputeModeTracking(const NEO::RootDeviceEnvironment &rootDeviceEnvironment) { if (NEO::DebugManager.flags.EnableStateComputeModeTracking.get() != -1) { return !!NEO::DebugManager.flags.EnableStateComputeModeTracking.get(); } - return get(hwInfo.platform.eRenderCoreFamily).platformSupportsStateComputeModeTracking(hwInfo); + auto &l0CoreHelper = rootDeviceEnvironment.getHelper(); + return l0CoreHelper.platformSupportsStateComputeModeTracking(); } -bool L0HwHelper::enableImmediateCmdListHeapSharing(const NEO::HardwareInfo &hwInfo, bool cmdlistSupport) { +bool L0HwHelper::enableImmediateCmdListHeapSharing(const NEO::RootDeviceEnvironment &rootDeviceEnvironment, bool cmdlistSupport) { if (NEO::DebugManager.flags.EnableImmediateCmdListHeapSharing.get() != -1) { return !!NEO::DebugManager.flags.EnableImmediateCmdListHeapSharing.get(); } - bool platformSupport = get(hwInfo.platform.eRenderCoreFamily).platformSupportsCmdListHeapSharing(hwInfo); + auto &l0CoreHelper = rootDeviceEnvironment.getHelper(); + bool platformSupport = l0CoreHelper.platformSupportsCmdListHeapSharing(); return platformSupport && cmdlistSupport; } diff --git a/level_zero/core/source/hw_helpers/l0_hw_helper.h b/level_zero/core/source/hw_helpers/l0_hw_helper.h index 4fa196f75b..13aa9f598b 100644 --- a/level_zero/core/source/hw_helpers/l0_hw_helper.h +++ b/level_zero/core/source/hw_helpers/l0_hw_helper.h @@ -19,6 +19,7 @@ namespace NEO { enum class EngineGroupType : uint32_t; struct HardwareInfo; struct EngineGroupT; +struct RootDeviceEnvironment; } // namespace NEO namespace L0 { @@ -33,10 +34,10 @@ using L0CoreHelper = L0HwHelper; class L0HwHelper { public: static L0HwHelper &get(GFXCORE_FAMILY gfxCore); - static bool enableFrontEndStateTracking(const NEO::HardwareInfo &hwInfo); - static bool enablePipelineSelectStateTracking(const NEO::HardwareInfo &hwInfo); - static bool enableStateComputeModeTracking(const NEO::HardwareInfo &hwInfo); - static bool enableImmediateCmdListHeapSharing(const NEO::HardwareInfo &hwInfo, bool cmdlistSupport); + static bool enableFrontEndStateTracking(const NEO::RootDeviceEnvironment &rootDeviceEnvironment); + static bool enablePipelineSelectStateTracking(const NEO::RootDeviceEnvironment &rootDeviceEnvironment); + static bool enableStateComputeModeTracking(const NEO::RootDeviceEnvironment &rootDeviceEnvironment); + static bool enableImmediateCmdListHeapSharing(const NEO::RootDeviceEnvironment &rootDeviceEnvironment, bool cmdlistSupport); static bool usePipeControlMultiKernelEventSync(const NEO::HardwareInfo &hwInfo); static bool useCompactL3FlushEventPacket(const NEO::HardwareInfo &hwInfo); static bool useDynamicEventPacketsCount(const NEO::HardwareInfo &hwInfo); @@ -53,10 +54,10 @@ class L0HwHelper { virtual std::vector getThreadsFromAttentionBitmask(const NEO::HardwareInfo &hwInfo, uint32_t tile, const uint8_t *bitmask, const size_t bitmaskSize) const = 0; virtual bool multiTileCapablePlatform() const = 0; virtual bool alwaysAllocateEventInLocalMem() const = 0; - virtual bool platformSupportsCmdListHeapSharing(const NEO::HardwareInfo &hwInfo) const = 0; - virtual bool platformSupportsStateComputeModeTracking(const NEO::HardwareInfo &hwInfo) const = 0; - virtual bool platformSupportsFrontEndTracking(const NEO::HardwareInfo &hwInfo) const = 0; - virtual bool platformSupportsPipelineSelectTracking(const NEO::HardwareInfo &hwInfo) const = 0; + virtual bool platformSupportsCmdListHeapSharing() const = 0; + virtual bool platformSupportsStateComputeModeTracking() const = 0; + virtual bool platformSupportsFrontEndTracking() const = 0; + virtual bool platformSupportsPipelineSelectTracking() const = 0; virtual uint32_t getEventMaxKernelCount(const NEO::HardwareInfo &hwInfo) const = 0; virtual uint32_t getEventBaseMaxPacketCount(const NEO::HardwareInfo &hwInfo) const = 0; @@ -84,10 +85,10 @@ class L0HwHelperHw : public L0HwHelper { std::vector getThreadsFromAttentionBitmask(const NEO::HardwareInfo &hwInfo, uint32_t tile, const uint8_t *bitmask, const size_t bitmaskSize) const override; bool multiTileCapablePlatform() const override; bool alwaysAllocateEventInLocalMem() const override; - bool platformSupportsCmdListHeapSharing(const NEO::HardwareInfo &hwInfo) const override; - bool platformSupportsStateComputeModeTracking(const NEO::HardwareInfo &hwInfo) const override; - bool platformSupportsFrontEndTracking(const NEO::HardwareInfo &hwInfo) const override; - bool platformSupportsPipelineSelectTracking(const NEO::HardwareInfo &hwInfo) const override; + bool platformSupportsCmdListHeapSharing() const override; + bool platformSupportsStateComputeModeTracking() const override; + bool platformSupportsFrontEndTracking() const override; + bool platformSupportsPipelineSelectTracking() const override; uint32_t getEventMaxKernelCount(const NEO::HardwareInfo &hwInfo) const override; uint32_t getEventBaseMaxPacketCount(const NEO::HardwareInfo &hwInfo) const override; diff --git a/level_zero/core/source/hw_helpers/l0_hw_helper_skl_and_later.inl b/level_zero/core/source/hw_helpers/l0_hw_helper_skl_and_later.inl index 619eb94a41..aa7c14d83d 100644 --- a/level_zero/core/source/hw_helpers/l0_hw_helper_skl_and_later.inl +++ b/level_zero/core/source/hw_helpers/l0_hw_helper_skl_and_later.inl @@ -19,22 +19,22 @@ bool L0HwHelperHw::multiTileCapablePlatform() const { } template -bool L0HwHelperHw::platformSupportsCmdListHeapSharing(const NEO::HardwareInfo &hwInfo) const { +bool L0HwHelperHw::platformSupportsCmdListHeapSharing() const { return false; } template -bool L0HwHelperHw::platformSupportsStateComputeModeTracking(const NEO::HardwareInfo &hwInfo) const { +bool L0HwHelperHw::platformSupportsStateComputeModeTracking() const { return false; } template -bool L0HwHelperHw::platformSupportsFrontEndTracking(const NEO::HardwareInfo &hwInfo) const { +bool L0HwHelperHw::platformSupportsFrontEndTracking() const { return false; } template -bool L0HwHelperHw::platformSupportsPipelineSelectTracking(const NEO::HardwareInfo &hwInfo) const { +bool L0HwHelperHw::platformSupportsPipelineSelectTracking() const { return false; } diff --git a/level_zero/core/source/hw_helpers/l0_hw_helper_xehp_and_later.inl b/level_zero/core/source/hw_helpers/l0_hw_helper_xehp_and_later.inl index c47273dfce..673f22bfaa 100644 --- a/level_zero/core/source/hw_helpers/l0_hw_helper_xehp_and_later.inl +++ b/level_zero/core/source/hw_helpers/l0_hw_helper_xehp_and_later.inl @@ -17,22 +17,22 @@ bool L0HwHelperHw::multiTileCapablePlatform() const { } template -bool L0HwHelperHw::platformSupportsCmdListHeapSharing(const NEO::HardwareInfo &hwInfo) const { +bool L0HwHelperHw::platformSupportsCmdListHeapSharing() const { return true; } template -bool L0HwHelperHw::platformSupportsStateComputeModeTracking(const NEO::HardwareInfo &hwInfo) const { +bool L0HwHelperHw::platformSupportsStateComputeModeTracking() const { return true; } template -bool L0HwHelperHw::platformSupportsFrontEndTracking(const NEO::HardwareInfo &hwInfo) const { +bool L0HwHelperHw::platformSupportsFrontEndTracking() const { return true; } template -bool L0HwHelperHw::platformSupportsPipelineSelectTracking(const NEO::HardwareInfo &hwInfo) const { +bool L0HwHelperHw::platformSupportsPipelineSelectTracking() const { return true; } diff --git a/level_zero/core/test/unit_tests/gen11/test_l0_hw_helper_gen11.cpp b/level_zero/core/test/unit_tests/gen11/test_l0_hw_helper_gen11.cpp index 90a7debbab..e285c0b69c 100644 --- a/level_zero/core/test/unit_tests/gen11/test_l0_hw_helper_gen11.cpp +++ b/level_zero/core/test/unit_tests/gen11/test_l0_hw_helper_gen11.cpp @@ -9,30 +9,31 @@ #include "shared/test/common/test_macros/hw_test.h" #include "level_zero/core/source/hw_helpers/l0_hw_helper.h" +#include "level_zero/core/test/unit_tests/fixtures/device_fixture.h" namespace L0 { namespace ult { -using L0HwHelperTestGen11 = ::testing::Test; +using L0HwHelperTestGen11 = Test; GEN11TEST_F(L0HwHelperTestGen11, GivenGen11WhenCheckingL0HelperForCmdListHeapSharingSupportThenReturnFalse) { - NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo; - EXPECT_FALSE(L0::L0HwHelperHw::get().platformSupportsCmdListHeapSharing(hwInfo)); + auto &l0CoreHelper = getHelper(); + EXPECT_FALSE(l0CoreHelper.platformSupportsCmdListHeapSharing()); } GEN11TEST_F(L0HwHelperTestGen11, GivenGen11WhenCheckingL0HelperForStateComputeModeTrackingSupportThenReturnFalse) { - NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo; - EXPECT_FALSE(L0::L0HwHelperHw::get().platformSupportsStateComputeModeTracking(hwInfo)); + auto &l0CoreHelper = getHelper(); + EXPECT_FALSE(l0CoreHelper.platformSupportsStateComputeModeTracking()); } GEN11TEST_F(L0HwHelperTestGen11, GivenGen11WhenCheckingL0HelperForFrontEndTrackingSupportThenReturnFalse) { - NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo; - EXPECT_FALSE(L0::L0HwHelperHw::get().platformSupportsFrontEndTracking(hwInfo)); + auto &l0CoreHelper = getHelper(); + EXPECT_FALSE(l0CoreHelper.platformSupportsFrontEndTracking()); } GEN11TEST_F(L0HwHelperTestGen11, GivenGen11WhenCheckingL0HelperForPipelineSelectTrackingSupportThenReturnFalse) { - NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo; - EXPECT_FALSE(L0::L0HwHelperHw::get().platformSupportsPipelineSelectTracking(hwInfo)); + auto &l0CoreHelper = getHelper(); + EXPECT_FALSE(l0CoreHelper.platformSupportsPipelineSelectTracking()); } } // namespace ult diff --git a/level_zero/core/test/unit_tests/gen12lp/test_l0_hw_helper_gen12lp.cpp b/level_zero/core/test/unit_tests/gen12lp/test_l0_hw_helper_gen12lp.cpp index dc4ad122a3..410835536f 100644 --- a/level_zero/core/test/unit_tests/gen12lp/test_l0_hw_helper_gen12lp.cpp +++ b/level_zero/core/test/unit_tests/gen12lp/test_l0_hw_helper_gen12lp.cpp @@ -20,26 +20,26 @@ HWTEST_EXCLUDE_PRODUCT(L0HwHelperTest, givenBitmaskWithAttentionBitsForAllEUsWhe HWTEST_EXCLUDE_PRODUCT(L0HwHelperTest, givenEu0To1Threads0To3BitmaskWhenGettingThreadsThenCorrectThreadsAreReturned, IGFX_GEN12LP_CORE); HWTEST_EXCLUDE_PRODUCT(L0HwHelperTest, givenBitmaskWithAttentionBitsForHalfOfThreadsWhenGettingThreadsThenCorrectThreadsAreReturned, IGFX_GEN12LP_CORE); -using L0HwHelperTestGen12Lp = ::testing::Test; +using L0HwHelperTestGen12Lp = Test; GEN12LPTEST_F(L0HwHelperTestGen12Lp, GivenGen12LpWhenCheckingL0HelperForCmdListHeapSharingSupportThenReturnFalse) { - NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo; - EXPECT_FALSE(L0::L0HwHelperHw::get().platformSupportsCmdListHeapSharing(hwInfo)); + auto &l0CoreHelper = getHelper(); + EXPECT_FALSE(l0CoreHelper.platformSupportsCmdListHeapSharing()); } GEN12LPTEST_F(L0HwHelperTestGen12Lp, GivenGen12LpWhenCheckingL0HelperForStateComputeModeTrackingSupportThenReturnFalse) { - NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo; - EXPECT_FALSE(L0::L0HwHelperHw::get().platformSupportsStateComputeModeTracking(hwInfo)); + auto &l0CoreHelper = getHelper(); + EXPECT_FALSE(l0CoreHelper.platformSupportsStateComputeModeTracking()); } GEN12LPTEST_F(L0HwHelperTestGen12Lp, GivenGen12LpWhenCheckingL0HelperForFrontEndTrackingSupportThenReturnFalse) { - NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo; - EXPECT_FALSE(L0::L0HwHelperHw::get().platformSupportsFrontEndTracking(hwInfo)); + auto &l0CoreHelper = getHelper(); + EXPECT_FALSE(l0CoreHelper.platformSupportsFrontEndTracking()); } GEN12LPTEST_F(L0HwHelperTestGen12Lp, GivenGen12LpWhenCheckingL0HelperForPipelineSelectTrackingSupportThenReturnFalse) { - NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo; - EXPECT_FALSE(L0::L0HwHelperHw::get().platformSupportsPipelineSelectTracking(hwInfo)); + auto &l0CoreHelper = getHelper(); + EXPECT_FALSE(l0CoreHelper.platformSupportsPipelineSelectTracking()); } } // namespace ult diff --git a/level_zero/core/test/unit_tests/gen9/test_l0_hw_helper_gen9.cpp b/level_zero/core/test/unit_tests/gen9/test_l0_hw_helper_gen9.cpp index 4e215b3a7f..a62e0ca78b 100644 --- a/level_zero/core/test/unit_tests/gen9/test_l0_hw_helper_gen9.cpp +++ b/level_zero/core/test/unit_tests/gen9/test_l0_hw_helper_gen9.cpp @@ -9,30 +9,31 @@ #include "shared/test/common/test_macros/hw_test.h" #include "level_zero/core/source/hw_helpers/l0_hw_helper.h" +#include "level_zero/core/test/unit_tests/fixtures/device_fixture.h" namespace L0 { namespace ult { -using L0HwHelperTestGen9 = ::testing::Test; +using L0HwHelperTestGen9 = Test; GEN9TEST_F(L0HwHelperTestGen9, GivenGen9WhenCheckingL0HelperForCmdListHeapSharingSupportThenReturnFalse) { - NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo; - EXPECT_FALSE(L0::L0HwHelperHw::get().platformSupportsCmdListHeapSharing(hwInfo)); + auto &l0CoreHelper = getHelper(); + EXPECT_FALSE(l0CoreHelper.platformSupportsCmdListHeapSharing()); } GEN9TEST_F(L0HwHelperTestGen9, GivenGen9WhenCheckingL0HelperForStateComputeModeTrackingSupportThenReturnFalse) { - NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo; - EXPECT_FALSE(L0::L0HwHelperHw::get().platformSupportsStateComputeModeTracking(hwInfo)); + auto &l0CoreHelper = getHelper(); + EXPECT_FALSE(l0CoreHelper.platformSupportsStateComputeModeTracking()); } GEN9TEST_F(L0HwHelperTestGen9, GivenGen9WhenCheckingL0HelperForFrontEndTrackingSupportThenReturnFalse) { - NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo; - EXPECT_FALSE(L0::L0HwHelperHw::get().platformSupportsFrontEndTracking(hwInfo)); + auto &l0CoreHelper = getHelper(); + EXPECT_FALSE(l0CoreHelper.platformSupportsFrontEndTracking()); } GEN9TEST_F(L0HwHelperTestGen9, GivenGen9WhenCheckingL0HelperForPipelineSelectTrackingSupportThenReturnFalse) { - NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo; - EXPECT_FALSE(L0::L0HwHelperHw::get().platformSupportsPipelineSelectTracking(hwInfo)); + auto &l0CoreHelper = getHelper(); + EXPECT_FALSE(l0CoreHelper.platformSupportsPipelineSelectTracking()); } } // namespace ult diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp index aaca441dfb..62addfb6dc 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp @@ -2121,20 +2121,19 @@ HWTEST2_F(CommandListCreate, givenNullEventWhenAppendEventAfterWalkerThenNothing } TEST_F(CommandListCreate, givenCreatedCommandListWhenGettingTrackingFlagsThenDefaultValuseIsHwSupported) { - auto &hwInfo = device->getHwInfo(); - auto &l0HwHelper = L0HwHelper::get(hwInfo.platform.eRenderCoreFamily); + auto &l0CoreHelper = device->getNEODevice()->getRootDeviceEnvironment().getHelper(); ze_result_t returnValue; std::unique_ptr commandList(whiteboxCast(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue))); ASSERT_NE(nullptr, commandList.get()); - bool expectedStateComputeModeTracking = l0HwHelper.platformSupportsStateComputeModeTracking(hwInfo); + bool expectedStateComputeModeTracking = l0CoreHelper.platformSupportsStateComputeModeTracking(); EXPECT_EQ(expectedStateComputeModeTracking, commandList->stateComputeModeTracking); - bool expectedPipelineSelectTracking = l0HwHelper.platformSupportsPipelineSelectTracking(hwInfo); + bool expectedPipelineSelectTracking = l0CoreHelper.platformSupportsPipelineSelectTracking(); EXPECT_EQ(expectedPipelineSelectTracking, commandList->pipelineSelectStateTracking); - bool expectedFrontEndTracking = l0HwHelper.platformSupportsFrontEndTracking(hwInfo); + bool expectedFrontEndTracking = l0CoreHelper.platformSupportsFrontEndTracking(); EXPECT_EQ(expectedFrontEndTracking, commandList->frontEndStateTracking); } diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_2.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_2.cpp index 2ad50b929f..1172efb472 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_2.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_2.cpp @@ -1355,7 +1355,7 @@ HWTEST2_F(CommandListAppendMemoryCopyBlit, whenAppendMemoryCopyBlitIsAppendedAnd template struct MockL0HwHelperSupportsCmdListHeapSharingHw : L0::L0HwHelperHw { - bool platformSupportsCmdListHeapSharing(const HardwareInfo &hwInfo) const override { return true; } + bool platformSupportsCmdListHeapSharing() const override { return true; } }; HWTEST2_F(CommandListCreate, givenPlatformSupportsSharedHeapsWhenImmediateCmdListCreatedWithFlushTaskSetThenSharedHeapsFollowsTheSameSetting, IsAtLeastSkl) { @@ -1385,7 +1385,7 @@ HWTEST2_F(CommandListCreate, givenPlatformSupportsSharedHeapsWhenImmediateCmdLis template struct MockL0HwHelperNoSupportsCmdListHeapSharingHw : L0::L0HwHelperHw { - bool platformSupportsCmdListHeapSharing(const HardwareInfo &hwInfo) const override { return false; } + bool platformSupportsCmdListHeapSharing() const override { return false; } }; HWTEST2_F(CommandListCreate, givenPlatformNotSupportsSharedHeapsWhenImmediateCmdListCreatedWithFlushTaskSetThenSharedHeapsIsNotEnabled, IsAtLeastSkl) { diff --git a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_1.cpp b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_1.cpp index b86c75fabc..e0e0ed0f10 100644 --- a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_1.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_1.cpp @@ -1824,8 +1824,7 @@ TEST_F(CommandQueueCreate, givenOverrideCmdQueueSyncModeToSynchronousWhenCommand } TEST_F(CommandQueueCreate, givenCreatedCommandQueueWhenGettingTrackingFlagsThenDefaultValuseIsHwSupported) { - auto &hwInfo = device->getHwInfo(); - auto &l0HwHelper = L0HwHelper::get(hwInfo.platform.eRenderCoreFamily); + auto &l0CoreHelper = device->getNEODevice()->getRootDeviceEnvironment().getHelper(); const ze_command_queue_desc_t desc{}; ze_result_t returnValue; auto commandQueue = whiteboxCast(CommandQueue::create(productFamily, @@ -1839,13 +1838,13 @@ TEST_F(CommandQueueCreate, givenCreatedCommandQueueWhenGettingTrackingFlagsThenD EXPECT_EQ(returnValue, ZE_RESULT_SUCCESS); ASSERT_NE(nullptr, commandQueue); - bool expectedStateComputeModeTracking = l0HwHelper.platformSupportsStateComputeModeTracking(hwInfo); + bool expectedStateComputeModeTracking = l0CoreHelper.platformSupportsStateComputeModeTracking(); EXPECT_EQ(expectedStateComputeModeTracking, commandQueue->stateComputeModeTracking); - bool expectedPipelineSelectTracking = l0HwHelper.platformSupportsPipelineSelectTracking(hwInfo); + bool expectedPipelineSelectTracking = l0CoreHelper.platformSupportsPipelineSelectTracking(); EXPECT_EQ(expectedPipelineSelectTracking, commandQueue->pipelineSelectStateTracking); - bool expectedFrontEndTracking = l0HwHelper.platformSupportsFrontEndTracking(hwInfo); + bool expectedFrontEndTracking = l0CoreHelper.platformSupportsFrontEndTracking(); EXPECT_EQ(expectedFrontEndTracking, commandQueue->frontEndStateTracking); commandQueue->destroy(); diff --git a/level_zero/core/test/unit_tests/xe_hp_core/test_l0_hw_helper_xe_hp_core.cpp b/level_zero/core/test/unit_tests/xe_hp_core/test_l0_hw_helper_xe_hp_core.cpp index 5e03d04f77..bb2a9551df 100644 --- a/level_zero/core/test/unit_tests/xe_hp_core/test_l0_hw_helper_xe_hp_core.cpp +++ b/level_zero/core/test/unit_tests/xe_hp_core/test_l0_hw_helper_xe_hp_core.cpp @@ -30,26 +30,22 @@ XEHPTEST_F(L0HwHelperTestXeHp, GivenXeHpWhenCheckingL0HelperForMultiTileCapableP XEHPTEST_F(L0HwHelperTestXeHp, GivenXeHpWhenCheckingL0HelperForCmdListHeapSharingSupportThenReturnTrue) { auto &l0CoreHelper = getHelper(); - NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo; - EXPECT_TRUE(l0CoreHelper.platformSupportsCmdListHeapSharing(hwInfo)); + EXPECT_TRUE(l0CoreHelper.platformSupportsCmdListHeapSharing()); } XEHPTEST_F(L0HwHelperTestXeHp, GivenXeHpWhenCheckingL0HelperForStateComputeModeTrackingSupportThenReturnTrue) { auto &l0CoreHelper = getHelper(); - NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo; - EXPECT_TRUE(l0CoreHelper.platformSupportsStateComputeModeTracking(hwInfo)); + EXPECT_TRUE(l0CoreHelper.platformSupportsStateComputeModeTracking()); } XEHPTEST_F(L0HwHelperTestXeHp, GivenXeHpWhenCheckingL0HelperForFrontEndTrackingSupportThenReturnTrue) { auto &l0CoreHelper = getHelper(); - NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo; - EXPECT_TRUE(l0CoreHelper.platformSupportsFrontEndTracking(hwInfo)); + EXPECT_TRUE(l0CoreHelper.platformSupportsFrontEndTracking()); } XEHPTEST_F(L0HwHelperTestXeHp, GivenXeHpWhenCheckingL0HelperForPipelineSelectTrackingSupportThenReturnTrue) { auto &l0CoreHelper = getHelper(); - NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo; - EXPECT_TRUE(l0CoreHelper.platformSupportsPipelineSelectTracking(hwInfo)); + EXPECT_TRUE(l0CoreHelper.platformSupportsPipelineSelectTracking()); } } // namespace ult diff --git a/level_zero/core/test/unit_tests/xe_hpc_core/test_l0_hw_helper_xe_hpc_core.cpp b/level_zero/core/test/unit_tests/xe_hpc_core/test_l0_hw_helper_xe_hpc_core.cpp index 07e1572292..4549556964 100644 --- a/level_zero/core/test/unit_tests/xe_hpc_core/test_l0_hw_helper_xe_hpc_core.cpp +++ b/level_zero/core/test/unit_tests/xe_hpc_core/test_l0_hw_helper_xe_hpc_core.cpp @@ -31,26 +31,22 @@ XE_HPC_CORETEST_F(L0HwHelperTestXeHpc, GivenHpcPlatformsWhenAlwaysAllocateEventI XE_HPC_CORETEST_F(L0HwHelperTestXeHpc, GivenXeHpcWhenCheckingL0HelperForCmdListHeapSharingSupportThenReturnTrue) { auto &l0CoreHelper = getHelper(); - NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo; - EXPECT_TRUE(l0CoreHelper.platformSupportsCmdListHeapSharing(hwInfo)); + EXPECT_TRUE(l0CoreHelper.platformSupportsCmdListHeapSharing()); } XE_HPC_CORETEST_F(L0HwHelperTestXeHpc, GivenXeHpcWhenCheckingL0HelperForStateComputeModeTrackingSupportThenReturnTrue) { auto &l0CoreHelper = getHelper(); - NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo; - EXPECT_TRUE(l0CoreHelper.platformSupportsStateComputeModeTracking(hwInfo)); + EXPECT_TRUE(l0CoreHelper.platformSupportsStateComputeModeTracking()); } XE_HPC_CORETEST_F(L0HwHelperTestXeHpc, GivenXeHpcWhenCheckingL0HelperForFrontEndTrackingSupportThenReturnTrue) { auto &l0CoreHelper = getHelper(); - NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo; - EXPECT_TRUE(l0CoreHelper.platformSupportsFrontEndTracking(hwInfo)); + EXPECT_TRUE(l0CoreHelper.platformSupportsFrontEndTracking()); } XE_HPC_CORETEST_F(L0HwHelperTestXeHpc, GivenXeHpcWhenCheckingL0HelperForPipelineSelectTrackingSupportThenReturnTrue) { auto &l0CoreHelper = getHelper(); - NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo; - EXPECT_TRUE(l0CoreHelper.platformSupportsPipelineSelectTracking(hwInfo)); + EXPECT_TRUE(l0CoreHelper.platformSupportsPipelineSelectTracking()); } } // namespace ult diff --git a/level_zero/core/test/unit_tests/xe_hpg_core/test_l0_hw_helper_xe_hpg_core.cpp b/level_zero/core/test/unit_tests/xe_hpg_core/test_l0_hw_helper_xe_hpg_core.cpp index 9509c2a9aa..72ad29f5c2 100644 --- a/level_zero/core/test/unit_tests/xe_hpg_core/test_l0_hw_helper_xe_hpg_core.cpp +++ b/level_zero/core/test/unit_tests/xe_hpg_core/test_l0_hw_helper_xe_hpg_core.cpp @@ -32,26 +32,22 @@ XE_HPG_CORETEST_F(L0HwHelperTestXeHpg, GivenXeHpgWhenCheckingL0HelperForMultiTil XE_HPG_CORETEST_F(L0HwHelperTestXeHpg, GivenXeHpgWhenCheckingL0HelperForCmdListHeapSharingSupportThenReturnTrue) { auto &l0CoreHelper = getHelper(); - NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo; - EXPECT_TRUE(l0CoreHelper.platformSupportsCmdListHeapSharing(hwInfo)); + EXPECT_TRUE(l0CoreHelper.platformSupportsCmdListHeapSharing()); } XE_HPG_CORETEST_F(L0HwHelperTestXeHpg, GivenXeHpgcWhenCheckingL0HelperForStateComputeModeTrackingSupportThenReturnTrue) { auto &l0CoreHelper = getHelper(); - NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo; - EXPECT_TRUE(l0CoreHelper.platformSupportsStateComputeModeTracking(hwInfo)); + EXPECT_TRUE(l0CoreHelper.platformSupportsStateComputeModeTracking()); } XE_HPG_CORETEST_F(L0HwHelperTestXeHpg, GivenXeHpgWhenCheckingL0HelperForFrontEndTrackingSupportThenReturnTrue) { auto &l0CoreHelper = getHelper(); - NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo; - EXPECT_TRUE(l0CoreHelper.platformSupportsFrontEndTracking(hwInfo)); + EXPECT_TRUE(l0CoreHelper.platformSupportsFrontEndTracking()); } XE_HPG_CORETEST_F(L0HwHelperTestXeHpg, GivenXeHpgWhenCheckingL0HelperForPipelineSelectTrackingSupportThenReturnTrue) { auto &l0CoreHelper = getHelper(); - NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo; - EXPECT_TRUE(l0CoreHelper.platformSupportsPipelineSelectTracking(hwInfo)); + EXPECT_TRUE(l0CoreHelper.platformSupportsPipelineSelectTracking()); } } // namespace ult