From 93deff069835fff686de36a4ff7b273149bc6178 Mon Sep 17 00:00:00 2001 From: Kamil Kopryk Date: Thu, 22 Dec 2022 13:08:01 +0000 Subject: [PATCH] Refactor: don't use global ProductHelper getter in L0 3/n Related-To: NEO-6853 Signed-off-by: Kamil Kopryk --- .../unit_tests/fixtures/cmdlist_fixture.cpp | 3 ++- .../unit_tests/fixtures/device_fixture.cpp | 1 + .../sources/cmdlist/test_cmdlist_7.cpp | 20 ++++++++++++------- .../test_cmdqueue_enqueue_cmdlist.cpp | 3 ++- .../test_cmdqueue_enqueue_cmdlist_2.cpp | 3 ++- .../unit_tests/sources/device/test_device.cpp | 7 ++++--- .../sources/helper/heap_assigner_l0_tests.cpp | 3 ++- .../unit_tests/sources/module/test_module.cpp | 4 ++-- .../xe_hpc_core/pvc/test_cmdlist_pvc.cpp | 4 ++-- .../xe_hpc_core/pvc/test_device_pvc.cpp | 4 ++-- .../xe_hpc_core/test_cmdlist_xe_hpc_core.cpp | 18 ++++++++--------- .../xe_hpg_core/dg2/test_cmdlist_dg2.cpp | 3 ++- .../xe_hpg_core/test_cmdlist_xe_hpg_core.cpp | 2 +- .../tools/source/debug/debug_session_imp.cpp | 2 +- .../pvc/test_debug_session_pvc.cpp | 4 ++-- opencl/source/command_queue/gpgpu_walker.h | 3 +-- 16 files changed, 48 insertions(+), 36 deletions(-) diff --git a/level_zero/core/test/unit_tests/fixtures/cmdlist_fixture.cpp b/level_zero/core/test/unit_tests/fixtures/cmdlist_fixture.cpp index e24d63e415..8fabbc7556 100644 --- a/level_zero/core/test/unit_tests/fixtures/cmdlist_fixture.cpp +++ b/level_zero/core/test/unit_tests/fixtures/cmdlist_fixture.cpp @@ -79,7 +79,8 @@ void MultiTileCommandListFixtureInit::setUpParams(bool createImmediate, bool cre void ModuleMutableCommandListFixture::setUpImpl(uint32_t revision) { if (revision != 0) { - auto revId = NEO::ProductHelper::get(device->getHwInfo().platform.eProductFamily)->getHwRevIdFromStepping(revision, device->getHwInfo()); + auto &productHelper = device->getProductHelper(); + auto revId = productHelper.getHwRevIdFromStepping(revision, device->getHwInfo()); neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->platform.usRevId = revId; } diff --git a/level_zero/core/test/unit_tests/fixtures/device_fixture.cpp b/level_zero/core/test/unit_tests/fixtures/device_fixture.cpp index 5b62026b60..11056ca550 100644 --- a/level_zero/core/test/unit_tests/fixtures/device_fixture.cpp +++ b/level_zero/core/test/unit_tests/fixtures/device_fixture.cpp @@ -58,6 +58,7 @@ HelperType &DeviceFixture::getHelper() const { } template L0GfxCoreHelper &DeviceFixture::getHelper() const; +template NEO::ProductHelper &DeviceFixture::getHelper() const; void PageFaultDeviceFixture::setUp() { neoDevice = NEO::MockDevice::createWithNewExecutionEnvironment(NEO::defaultHwInfo.get()); diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_7.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_7.cpp index cee5f23b4e..56647eb296 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_7.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_7.cpp @@ -366,7 +366,7 @@ HWTEST2_F(CommandListAppendLaunchKernel, GivenComputeModeTraitsSetToFalsePropertiesWhenUpdateStreamPropertiesIsCalledTwiceThenFieldsAreDirtyWithTrackingAndCleanWithoutTracking, ProgramAllFieldsInComputeMode) { DebugManagerStateRestore restorer; - auto &productHelper = *NEO::ProductHelper::get(defaultHwInfo->platform.eProductFamily); + auto &productHelper = device->getProductHelper(); Mock<::L0::Kernel> kernel; auto mockModule = std::unique_ptr(new Mock(device, nullptr)); @@ -770,7 +770,8 @@ using MultiReturnCommandListTest = Test; HWTEST2_F(MultiReturnCommandListTest, givenFrontEndTrackingIsUsedWhenPropertyDisableEuFusionSupportedThenExpectReturnPointsAndBbEndProgramming, IsAtLeastSkl) { using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END; NEO::FrontEndPropertiesSupport fePropertiesSupport = {}; - NEO::ProductHelper::get(productFamily)->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, device->getHwInfo()); + auto &productHelper = device->getProductHelper(); + productHelper.fillFrontEndPropertiesSupportStructure(fePropertiesSupport, device->getHwInfo()); EXPECT_TRUE(commandList->frontEndStateTracking); @@ -936,7 +937,8 @@ HWTEST2_F(MultiReturnCommandListTest, givenFrontEndTrackingIsUsedWhenPropertyDis HWTEST2_F(MultiReturnCommandListTest, givenFrontEndTrackingIsUsedWhenPropertyComputeDispatchAllWalkerSupportedThenExpectReturnPointsAndBbEndProgramming, IsAtLeastSkl) { using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END; NEO::FrontEndPropertiesSupport fePropertiesSupport = {}; - NEO::ProductHelper::get(productFamily)->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, device->getHwInfo()); + auto &productHelper = device->getProductHelper(); + productHelper.fillFrontEndPropertiesSupportStructure(fePropertiesSupport, device->getHwInfo()); EXPECT_TRUE(commandList->frontEndStateTracking); @@ -1101,7 +1103,8 @@ HWTEST2_F(MultiReturnCommandListTest, using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END; NEO::FrontEndPropertiesSupport fePropertiesSupport = {}; - NEO::ProductHelper::get(productFamily)->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, device->getHwInfo()); + auto &productHelper = device->getProductHelper(); + productHelper.fillFrontEndPropertiesSupportStructure(fePropertiesSupport, device->getHwInfo()); EXPECT_TRUE(commandList->frontEndStateTracking); EXPECT_TRUE(commandQueue->frontEndStateTracking); @@ -1350,7 +1353,8 @@ HWTEST2_F(MultiReturnCommandListTest, using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END; NEO::FrontEndPropertiesSupport fePropertiesSupport = {}; - NEO::ProductHelper::get(productFamily)->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, device->getHwInfo()); + auto &productHelper = device->getProductHelper(); + productHelper.fillFrontEndPropertiesSupportStructure(fePropertiesSupport, device->getHwInfo()); NEO::DebugManager.flags.AllowMixingRegularAndCooperativeKernels.set(1); @@ -1596,7 +1600,8 @@ HWTEST2_F(MultiReturnCommandListTest, HWTEST2_F(MultiReturnCommandListTest, givenCmdQueueAndImmediateCmdListUseSameCsrWhenAppendingKernelOnBothRegularFirstThenFrontEndStateIsNotChanged, IsAtLeastSkl) { using VFE_STATE_TYPE = typename FamilyType::VFE_STATE_TYPE; NEO::FrontEndPropertiesSupport fePropertiesSupport = {}; - NEO::ProductHelper::get(productFamily)->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, device->getHwInfo()); + auto &productHelper = device->getProductHelper(); + productHelper.fillFrontEndPropertiesSupportStructure(fePropertiesSupport, device->getHwInfo()); EXPECT_TRUE(commandList->frontEndStateTracking); EXPECT_TRUE(commandListImmediate->frontEndStateTracking); @@ -1721,7 +1726,8 @@ HWTEST2_F(MultiReturnCommandListTest, givenCmdQueueAndImmediateCmdListUseSameCsr HWTEST2_F(MultiReturnCommandListTest, givenCmdQueueAndImmediateCmdListUseSameCsrWhenAppendingKernelOnBothImmediateFirstThenFrontEndStateIsNotChanged, IsAtLeastSkl) { using VFE_STATE_TYPE = typename FamilyType::VFE_STATE_TYPE; NEO::FrontEndPropertiesSupport fePropertiesSupport = {}; - NEO::ProductHelper::get(productFamily)->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, device->getHwInfo()); + auto &productHelper = device->getProductHelper(); + productHelper.fillFrontEndPropertiesSupportStructure(fePropertiesSupport, device->getHwInfo()); EXPECT_TRUE(commandList->frontEndStateTracking); EXPECT_TRUE(commandListImmediate->frontEndStateTracking); diff --git a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist.cpp b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist.cpp index 7b9a409908..aaa8bacb09 100644 --- a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist.cpp @@ -143,7 +143,8 @@ HWTEST_F(CommandQueueExecuteCommandLists, givenCommandListThatRequiresDisabledEU auto result = commandQueue->executeCommandLists(numCommandLists, commandLists, nullptr, true); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - bool disableEuFusion = NEO::ProductHelper::get(device->getHwInfo().platform.eProductFamily)->getFrontEndPropertyDisableEuFusionSupport(); + auto &productHelper = device->getProductHelper(); + bool disableEuFusion = productHelper.getFrontEndPropertyDisableEuFusionSupport(); int32_t expectedDisableEuFusion = (disableEuFusion || commandQueue->frontEndStateTracking) ? 1 : -1; EXPECT_EQ(expectedDisableEuFusion, commandQueue->getCsr()->getStreamProperties().frontEndState.disableEUFusion.value); diff --git a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist_2.cpp b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist_2.cpp index fd2c2d5a64..2f966fee76 100644 --- a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist_2.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist_2.cpp @@ -127,7 +127,8 @@ HWTEST2_F(CommandQueueExecuteCommandListsSimpleTest, whenUsingFenceThenLastPipeC HWTEST2_F(CommandQueueExecuteCommandListsSimpleTest, givenTwoCommandQueuesUsingSingleCsrWhenExecutingFirstTimeOnBothThenPipelineSelectProgrammedOnce, IsAtMostXeHpcCore) { using PIPELINE_SELECT = typename FamilyType::PIPELINE_SELECT; - bool additionalPipelineSelect = NEO::ProductHelper::get(device->getHwInfo().platform.eProductFamily)->is3DPipelineSelectWARequired() && + auto &productHelper = device->getProductHelper(); + bool additionalPipelineSelect = productHelper.is3DPipelineSelectWARequired() && neoDevice->getDefaultEngine().commandStreamReceiver->isRcs(); ze_result_t returnValue; diff --git a/level_zero/core/test/unit_tests/sources/device/test_device.cpp b/level_zero/core/test/unit_tests/sources/device/test_device.cpp index b3f151ef0f..1f280ba27a 100644 --- a/level_zero/core/test/unit_tests/sources/device/test_device.cpp +++ b/level_zero/core/test/unit_tests/sources/device/test_device.cpp @@ -1237,7 +1237,7 @@ TEST_F(DeviceTest, givenCallToDevicePropertiesThenMaximumMemoryToBeAllocatedIsCo } TEST_F(DeviceTest, whenCheckingIfStatelessCompressionIsSupportedThenReturnFalse) { - const auto &productHelper = *ProductHelper::get(defaultHwInfo->platform.eProductFamily); + auto &productHelper = device->getProductHelper(); EXPECT_FALSE(productHelper.allowStatelessCompression(*defaultHwInfo)); } @@ -1691,7 +1691,7 @@ TEST_F(DeviceGetMemoryTests, whenCallingGetMemoryPropertiesWithNonNullPtrThenPro EXPECT_EQ(res, ZE_RESULT_SUCCESS); EXPECT_EQ(1u, count); auto hwInfo = *NEO::defaultHwInfo; - auto &productHelper = *NEO::ProductHelper::get(hwInfo.platform.eProductFamily); + auto &productHelper = device->getProductHelper(); EXPECT_EQ(memProperties.maxClockRate, productHelper.getDeviceMemoryMaxClkRate(hwInfo, nullptr, 0)); EXPECT_EQ(memProperties.maxBusWidth, this->neoDevice->getDeviceInfo().addressBits); EXPECT_EQ(memProperties.totalSize, this->neoDevice->getDeviceInfo().globalMemSize); @@ -2278,7 +2278,8 @@ TEST_F(DeviceTests, WhenGettingMemoryAccessPropertiesThenSuccessIsReturned) { EXPECT_EQ(ZE_RESULT_SUCCESS, result); auto &hwInfo = device->getHwInfo(); - auto &productHelper = *NEO::ProductHelper::get(hwInfo.platform.eProductFamily); + auto &productHelper = device->getProductHelper(); + auto expectedHostAllocCapabilities = static_cast(productHelper.getHostMemCapabilities(&hwInfo)); EXPECT_EQ(expectedHostAllocCapabilities, properties.hostAllocCapabilities); diff --git a/level_zero/core/test/unit_tests/sources/helper/heap_assigner_l0_tests.cpp b/level_zero/core/test/unit_tests/sources/helper/heap_assigner_l0_tests.cpp index 4829c462fa..be0a116625 100644 --- a/level_zero/core/test/unit_tests/sources/helper/heap_assigner_l0_tests.cpp +++ b/level_zero/core/test/unit_tests/sources/helper/heap_assigner_l0_tests.cpp @@ -58,7 +58,8 @@ TEST_F(AlocationHelperTests, GivenLinearStreamAllocTypeWhenUseExternalAllocatorF allocationData.type = AllocationType::LINEAR_STREAM; std::unique_ptr mockMemoryManager(new MockMemoryManagerAllocationHelper(*device->getNEODevice()->getExecutionEnvironment())); mockMemoryManager->allocateGraphicsMemory(allocationData); - EXPECT_EQ(mockMemoryManager->passedUseLocalMem, ProductHelper::get(device->getHwInfo().platform.eProductFamily)->heapInLocalMem(device->getHwInfo())); + auto &productHelper = device->getProductHelper(); + EXPECT_EQ(mockMemoryManager->passedUseLocalMem, productHelper.heapInLocalMem(device->getHwInfo())); } TEST_F(AlocationHelperTests, GivenInternalAllocTypeWhenUseExternalAllocatorForSshAndDshDisabledThenUseLocalMemEqualFalse) { diff --git a/level_zero/core/test/unit_tests/sources/module/test_module.cpp b/level_zero/core/test/unit_tests/sources/module/test_module.cpp index c4c7756123..641ebf9d2c 100644 --- a/level_zero/core/test/unit_tests/sources/module/test_module.cpp +++ b/level_zero/core/test/unit_tests/sources/module/test_module.cpp @@ -153,7 +153,7 @@ HWTEST_F(ModuleTest, givenBlitterAvailableWhenCopyingPatchedSegmentsThenIsaIsTra EXPECT_TRUE(ki->isIsaCopiedToAllocation()); } - const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily); + auto &productHelper = device.getProductHelper(); if (productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *module->getKernelImmutableDataVector()[0]->getIsaGraphicsAllocation())) { EXPECT_EQ(zebinData->numOfKernels, blitterCalled); } else { @@ -2276,7 +2276,7 @@ HWTEST_F(ModuleTranslationUnitTest, WhenCreatingFromNativeBinaryThenSetsUpRequir HWTEST_F(ModuleTranslationUnitTest, WhenCreatingFromNativeBinaryThenSetsUpPackedTargetDeviceBinary) { PatchTokensTestData::ValidEmptyProgram programTokens; - const auto &productHelper = *NEO::ProductHelper::get(productFamily); + auto &productHelper = device->getProductHelper(); NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo; HardwareIpVersion aotConfig = {0}; aotConfig.value = productHelper.getProductConfigFromHwInfo(hwInfo); diff --git a/level_zero/core/test/unit_tests/xe_hpc_core/pvc/test_cmdlist_pvc.cpp b/level_zero/core/test/unit_tests/xe_hpc_core/pvc/test_cmdlist_pvc.cpp index 2fc981b9b5..f4e8480b8d 100644 --- a/level_zero/core/test/unit_tests/xe_hpc_core/pvc/test_cmdlist_pvc.cpp +++ b/level_zero/core/test/unit_tests/xe_hpc_core/pvc/test_cmdlist_pvc.cpp @@ -21,7 +21,7 @@ using CommandListStatePrefetchPvcXt = Test; PVCTEST_F(CommandListStatePrefetchPvcXt, givenCommandBufferIsExhaustedWhenPrefetchApiCalledAndIsPvcXtNotBaseDieA0ThenProgramStatePrefetch) { auto hwInfo = device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo(); - const auto &productHelper = *ProductHelper::get(hwInfo->platform.eProductFamily); + auto &productHelper = device->getProductHelper(); hwInfo->platform.usDeviceID = pvcXtDeviceIds.front(); hwInfo->platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_B, *hwInfo); // not BD A0 checkIfCommandBufferIsExhaustedWhenPrefetchApiCalledThenStatePrefetchProgrammed(hwInfo); @@ -29,7 +29,7 @@ PVCTEST_F(CommandListStatePrefetchPvcXt, givenCommandBufferIsExhaustedWhenPrefet PVCTEST_F(CommandListStatePrefetchPvcXt, givenDebugFlagSetWhenPrefetchApiCalledAndIsPvcXtNotBaseDieA0ThenProgramStatePrefetch) { auto hwInfo = device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo(); - const auto &productHelper = *ProductHelper::get(hwInfo->platform.eProductFamily); + auto &productHelper = device->getProductHelper(); hwInfo = device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo(); hwInfo->platform.usDeviceID = pvcXtDeviceIds.front(); hwInfo->platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_B, *hwInfo); // not BD A0 diff --git a/level_zero/core/test/unit_tests/xe_hpc_core/pvc/test_device_pvc.cpp b/level_zero/core/test/unit_tests/xe_hpc_core/pvc/test_device_pvc.cpp index 17d988b17b..2c43455b38 100644 --- a/level_zero/core/test/unit_tests/xe_hpc_core/pvc/test_device_pvc.cpp +++ b/level_zero/core/test/unit_tests/xe_hpc_core/pvc/test_device_pvc.cpp @@ -24,7 +24,7 @@ using DeviceTestPvcXt = Test; PVCTEST_F(DeviceTestPvcXt, whenCallingGetMemoryPropertiesWithNonNullPtrAndRevisionIsNotBaseDieA0OnPvcXtThenMaxClockRateReturnedIsZero) { auto &device = driverHandle->devices[0]; auto hwInfo = device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo(); - const auto &productHelper = *ProductHelper::get(hwInfo->platform.eProductFamily); + auto &productHelper = device->getProductHelper(); hwInfo->platform.usDeviceID = pvcXtDeviceIds.front(); hwInfo->platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_B, *hwInfo); // not BD A0 @@ -34,7 +34,7 @@ PVCTEST_F(DeviceTestPvcXt, whenCallingGetMemoryPropertiesWithNonNullPtrAndRevisi using DeviceTestPvc = Test; PVCTEST_F(DeviceTestPvc, givenPvcAStepWhenCreatingMultiTileDeviceThenExpectImplicitScalingDisabled) { auto hwInfo = *NEO::defaultHwInfo; - const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily); + auto &productHelper = getHelper(); hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_A0, hwInfo); DebugManager.flags.CreateMultipleSubDevices.set(2); diff --git a/level_zero/core/test/unit_tests/xe_hpc_core/test_cmdlist_xe_hpc_core.cpp b/level_zero/core/test/unit_tests/xe_hpc_core/test_cmdlist_xe_hpc_core.cpp index e606fd0c83..7add2050b4 100644 --- a/level_zero/core/test/unit_tests/xe_hpc_core/test_cmdlist_xe_hpc_core.cpp +++ b/level_zero/core/test/unit_tests/xe_hpc_core/test_cmdlist_xe_hpc_core.cpp @@ -33,7 +33,7 @@ struct LocalMemoryModuleFixture : public ModuleFixture { using CommandListAppendLaunchKernelXeHpcCore = Test; HWTEST2_F(CommandListAppendLaunchKernelXeHpcCore, givenKernelUsingSyncBufferWhenAppendLaunchCooperativeKernelIsCalledThenCorrectValueIsReturned, IsXeHpcCore) { auto &hwInfo = *device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo(); - auto &productHelper = *NEO::ProductHelper::get(hwInfo.platform.eProductFamily); + auto &productHelper = device->getProductHelper(); Mock<::L0::Kernel> kernel; auto pMockModule = std::unique_ptr(new Mock(device, nullptr)); kernel.module = pMockModule.get(); @@ -569,7 +569,7 @@ HWTEST2_F(CommandListAppendLaunchKernelXeHpcCore, ze_result_t result = ZE_RESULT_SUCCESS; auto &hwInfo = *device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo(); - auto &productHelper = *NEO::ProductHelper::get(hwInfo.platform.eProductFamily); + auto &productHelper = device->getProductHelper(); VariableBackup hwRevId{&hwInfo.platform.usRevId}; hwRevId = productHelper.getHwRevIdFromStepping(REVISION_B, hwInfo); @@ -639,7 +639,7 @@ HWTEST2_F(CommandListAppendLaunchKernelXeHpcCore, ze_result_t result = ZE_RESULT_SUCCESS; auto &hwInfo = *device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo(); - auto &productHelper = *NEO::ProductHelper::get(hwInfo.platform.eProductFamily); + auto &productHelper = device->getProductHelper(); VariableBackup hwRevId{&hwInfo.platform.usRevId}; hwRevId = productHelper.getHwRevIdFromStepping(REVISION_B, hwInfo); @@ -707,7 +707,7 @@ HWTEST2_F(CommandListAppendLaunchKernelXeHpcCore, ze_result_t result = ZE_RESULT_SUCCESS; auto &hwInfo = *device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo(); - auto &productHelper = *NEO::ProductHelper::get(hwInfo.platform.eProductFamily); + auto &productHelper = device->getProductHelper(); VariableBackup hwRevId{&hwInfo.platform.usRevId}; hwRevId = productHelper.getHwRevIdFromStepping(REVISION_B, hwInfo); @@ -763,7 +763,7 @@ HWTEST2_F(CommandListAppendLaunchKernelXeHpcCore, ze_result_t result = ZE_RESULT_SUCCESS; auto &hwInfo = *device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo(); - auto &productHelper = *NEO::ProductHelper::get(hwInfo.platform.eProductFamily); + auto &productHelper = device->getProductHelper(); VariableBackup hwRevId{&hwInfo.platform.usRevId}; hwRevId = productHelper.getHwRevIdFromStepping(REVISION_B, hwInfo); @@ -835,7 +835,7 @@ HWTEST2_F(CommandListAppendLaunchKernelXeHpcCore, ze_result_t result = ZE_RESULT_SUCCESS; auto &hwInfo = *device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo(); - auto &productHelper = *NEO::ProductHelper::get(hwInfo.platform.eProductFamily); + auto &productHelper = device->getProductHelper(); VariableBackup hwRevId{&hwInfo.platform.usRevId}; hwRevId = productHelper.getHwRevIdFromStepping(REVISION_B, hwInfo); @@ -905,7 +905,7 @@ HWTEST2_F(CommandListAppendLaunchKernelXeHpcCore, ze_result_t result = ZE_RESULT_SUCCESS; auto &hwInfo = *device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo(); - auto &productHelper = *NEO::ProductHelper::get(hwInfo.platform.eProductFamily); + auto &productHelper = device->getProductHelper(); VariableBackup hwRevId{&hwInfo.platform.usRevId}; hwRevId = productHelper.getHwRevIdFromStepping(REVISION_B, hwInfo); @@ -1045,7 +1045,7 @@ struct CommandListAppendLaunchMultiKernelEventFixture : public LocalMemoryModule ze_result_t result = ZE_RESULT_SUCCESS; auto &hwInfo = *input.device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo(); - auto &productHelper = *NEO::ProductHelper::get(hwInfo.platform.eProductFamily); + auto &productHelper = input.device->getProductHelper(); VariableBackup hwRevId{&hwInfo.platform.usRevId}; hwRevId = productHelper.getHwRevIdFromStepping(REVISION_B, hwInfo); @@ -1107,7 +1107,7 @@ struct CommandListAppendLaunchMultiKernelEventFixture : public LocalMemoryModule ze_result_t result = ZE_RESULT_SUCCESS; auto &hwInfo = *input.device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo(); - auto &productHelper = *NEO::ProductHelper::get(hwInfo.platform.eProductFamily); + auto &productHelper = input.device->getProductHelper(); VariableBackup hwRevId{&hwInfo.platform.usRevId}; hwRevId = productHelper.getHwRevIdFromStepping(REVISION_B, hwInfo); diff --git a/level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_cmdlist_dg2.cpp b/level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_cmdlist_dg2.cpp index b3f01429d7..0d1a5ed3c2 100644 --- a/level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_cmdlist_dg2.cpp +++ b/level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_cmdlist_dg2.cpp @@ -24,7 +24,8 @@ HWTEST2_F(CommandListTests, givenDG2WithBSteppingWhenCreatingCommandListThenAddi ze_result_t returnValue; auto &hwInfo = *neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); - const auto &productHelper = *NEO::ProductHelper::get(hwInfo.platform.eProductFamily); + const auto &productHelper = neoDevice->getProductHelper(); + hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_B, hwInfo); std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Compute, 0u, returnValue)); diff --git a/level_zero/core/test/unit_tests/xe_hpg_core/test_cmdlist_xe_hpg_core.cpp b/level_zero/core/test/unit_tests/xe_hpg_core/test_cmdlist_xe_hpg_core.cpp index 120335a0a2..f312882623 100644 --- a/level_zero/core/test/unit_tests/xe_hpg_core/test_cmdlist_xe_hpg_core.cpp +++ b/level_zero/core/test/unit_tests/xe_hpg_core/test_cmdlist_xe_hpg_core.cpp @@ -339,7 +339,7 @@ struct ProgramAllFieldsInComputeMode { HWTEST2_F(CommandListCreate, GivenComputeModePropertiesWhenUpdateStreamPropertiesIsCalledTwiceThenWithoutTrackingFieldsChangedWithTrackingUpdatedClean, ProgramAllFieldsInComputeMode) { DebugManagerStateRestore restorer; Mock<::L0::Kernel> kernel; - auto &productHelper = *NEO::ProductHelper::get(defaultHwInfo->platform.eProductFamily); + auto &productHelper = device->getProductHelper(); auto mockModule = std::unique_ptr(new Mock(device, nullptr)); kernel.module = mockModule.get(); diff --git a/level_zero/tools/source/debug/debug_session_imp.cpp b/level_zero/tools/source/debug/debug_session_imp.cpp index 390eaafdfc..4221301f51 100644 --- a/level_zero/tools/source/debug/debug_session_imp.cpp +++ b/level_zero/tools/source/debug/debug_session_imp.cpp @@ -278,7 +278,7 @@ size_t DebugSession::getPerThreadScratchOffset(size_t ptss, EuThread::ThreadId t const uint32_t numEuPerSubslice = hwInfo.gtSystemInfo.MaxEuPerSubSlice; const uint32_t numThreadsPerEu = (hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount); - const auto &productHelper = *NEO::ProductHelper::get(hwInfo.platform.eProductFamily); + const auto &productHelper = connectedDevice->getProductHelper(); uint32_t threadEuRatio = productHelper.getThreadEuRatioForScratch(hwInfo); uint32_t multiplyFactor = 1; if (threadEuRatio / numThreadsPerEu > 1) { diff --git a/level_zero/tools/test/unit_tests/sources/debug/xe_hpc_core/pvc/test_debug_session_pvc.cpp b/level_zero/tools/test/unit_tests/sources/debug/xe_hpc_core/pvc/test_debug_session_pvc.cpp index 7d868886c8..34378aafe9 100644 --- a/level_zero/tools/test/unit_tests/sources/debug/xe_hpc_core/pvc/test_debug_session_pvc.cpp +++ b/level_zero/tools/test/unit_tests/sources/debug/xe_hpc_core/pvc/test_debug_session_pvc.cpp @@ -25,8 +25,6 @@ PVCTEST_F(PVCDebugSession, givenPVCRevId3WhenGettingPerThreadScratchOffsetThenPe auto hwInfo = *NEO::defaultHwInfo.get(); hwInfo.platform.usRevId = 3; - const auto &productHelper = *NEO::ProductHelper::get(productFamily); - NEO::Device *neoDevice(NEO::MockDevice::createWithNewExecutionEnvironment(&hwInfo, 0)); L0::ult::Mock deviceImp(neoDevice, neoDevice->getExecutionEnvironment()); auto debugSession = std::make_unique(zet_debug_config_t{0x1234}, &deviceImp); @@ -39,6 +37,8 @@ PVCTEST_F(PVCDebugSession, givenPVCRevId3WhenGettingPerThreadScratchOffsetThenPe EuThread::ThreadId thread2EuLastSubslice1 = {0, 0, 1, hwInfo.gtSystemInfo.MaxEuPerSubSlice - 1, 2}; const uint32_t ptss = 128; + const auto &productHelper = neoDevice->getProductHelper(); + const uint32_t ratio = productHelper.getThreadEuRatioForScratch(hwInfo) / numThreadsPerEu; EXPECT_EQ(2u, productHelper.getThreadEuRatioForScratch(hwInfo) / numThreadsPerEu); diff --git a/opencl/source/command_queue/gpgpu_walker.h b/opencl/source/command_queue/gpgpu_walker.h index 093ec447b2..f577631992 100644 --- a/opencl/source/command_queue/gpgpu_walker.h +++ b/opencl/source/command_queue/gpgpu_walker.h @@ -60,8 +60,7 @@ class GpgpuWalkerHelper { const RootDeviceEnvironment &rootDeviceEnvironment); static void dispatchPerfCountersCommandsStart( - CommandQueue &commandQueue, - TagNodeBase &hwPerfCounter, + CommandQueue &commandQueue, TagNodeBase &hwPerfCounter, LinearStream *commandStream); static void dispatchPerfCountersCommandsEnd(