diff --git a/opencl/test/unit_test/d3d_sharing/d3d_aux_tests.cpp b/opencl/test/unit_test/d3d_sharing/d3d_aux_tests.cpp index 032e5afa03..23d98dfaf4 100644 --- a/opencl/test/unit_test/d3d_sharing/d3d_aux_tests.cpp +++ b/opencl/test/unit_test/d3d_sharing/d3d_aux_tests.cpp @@ -39,7 +39,7 @@ TYPED_TEST_P(D3DAuxTests, given2dSharableTextureWithUnifiedAuxFlagsWhenCreatingT ASSERT_NE(nullptr, image.get()); const auto &hwInfo = context->getDevice(0)->getHardwareInfo(); - const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily); + const auto &productHelper = context->getDevice(0)->getProductHelper(); uint32_t expectedMapAuxGpuVaCalls = productHelper.isPageTableManagerSupported(hwInfo) ? 1 : 0; EXPECT_EQ(expectedMapAuxGpuVaCalls, mockMM->mapAuxGpuVACalled); @@ -63,7 +63,7 @@ TYPED_TEST_P(D3DAuxTests, given2dSharableTextureWithUnifiedAuxFlagsWhenFailOnAux ASSERT_NE(nullptr, image.get()); const auto &hwInfo = context->getDevice(0)->getHardwareInfo(); - const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily); + const auto &productHelper = context->getDevice(0)->getProductHelper(); uint32_t expectedMapAuxGpuVaCalls = productHelper.isPageTableManagerSupported(hwInfo) ? 1 : 0; EXPECT_EQ(expectedMapAuxGpuVaCalls, mockMM->mapAuxGpuVACalled); @@ -102,7 +102,7 @@ TYPED_TEST_P(D3DAuxTests, given2dNonSharableTextureWithUnifiedAuxFlagsWhenCreati ASSERT_NE(nullptr, image.get()); const auto &hwInfo = context->getDevice(0)->getHardwareInfo(); - const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily); + const auto &productHelper = context->getDevice(0)->getProductHelper(); uint32_t expectedMapAuxGpuVaCalls = productHelper.isPageTableManagerSupported(hwInfo) ? 1 : 0; EXPECT_EQ(expectedMapAuxGpuVaCalls, mockMM->mapAuxGpuVACalled); @@ -123,7 +123,7 @@ TYPED_TEST_P(D3DAuxTests, given3dSharableTextureWithUnifiedAuxFlagsWhenCreatingT ASSERT_NE(nullptr, image.get()); const auto &hwInfo = context->getDevice(0)->getHardwareInfo(); - const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily); + const auto &productHelper = context->getDevice(0)->getProductHelper(); uint32_t expectedMapAuxGpuVaCalls = productHelper.isPageTableManagerSupported(hwInfo) ? 1 : 0; EXPECT_EQ(expectedMapAuxGpuVaCalls, mockMM->mapAuxGpuVACalled); @@ -144,7 +144,7 @@ TYPED_TEST_P(D3DAuxTests, given3dSharableTextureWithUnifiedAuxFlagsWhenFailOnAux ASSERT_NE(nullptr, image.get()); const auto &hwInfo = context->getDevice(0)->getHardwareInfo(); - const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily); + const auto &productHelper = context->getDevice(0)->getProductHelper(); uint32_t expectedMapAuxGpuVaCalls = productHelper.isPageTableManagerSupported(hwInfo) ? 1 : 0; EXPECT_EQ(expectedMapAuxGpuVaCalls, mockMM->mapAuxGpuVACalled); @@ -179,7 +179,7 @@ TYPED_TEST_P(D3DAuxTests, given3dNonSharableTextureWithUnifiedAuxFlagsWhenCreati ASSERT_NE(nullptr, image.get()); const auto &hwInfo = context->getDevice(0)->getHardwareInfo(); - const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily); + const auto &productHelper = context->getDevice(0)->getProductHelper(); uint32_t expectedMapAuxGpuVaCalls = productHelper.isPageTableManagerSupported(hwInfo) ? 1 : 0; EXPECT_EQ(expectedMapAuxGpuVaCalls, mockMM->mapAuxGpuVACalled); diff --git a/opencl/test/unit_test/device/device_caps_tests.cpp b/opencl/test/unit_test/device/device_caps_tests.cpp index 37719620a2..2841db9dae 100644 --- a/opencl/test/unit_test/device/device_caps_tests.cpp +++ b/opencl/test/unit_test/device/device_caps_tests.cpp @@ -1062,9 +1062,9 @@ HWTEST_F(DeviceGetCapsTest, givenDisabledFtrPooledEuWhenCalculatingMaxEuPerSSThe auto &gfxCoreHelper = device->getGfxCoreHelper(); auto simdSizeUsed = gfxCoreHelper.getMinimalSIMDSize(); - auto productHelper = ProductHelper::get(myHwInfo.platform.eProductFamily); - auto expectedMaxWGS = productHelper->getMaxThreadsForWorkgroupInDSSOrSS(myHwInfo, static_cast(deviceInfo.maxNumEUsPerSubSlice), - static_cast(deviceInfo.maxNumEUsPerDualSubSlice)) * + auto &productHelper = device->getProductHelper(); + auto expectedMaxWGS = productHelper.getMaxThreadsForWorkgroupInDSSOrSS(myHwInfo, static_cast(deviceInfo.maxNumEUsPerSubSlice), + static_cast(deviceInfo.maxNumEUsPerDualSubSlice)) * simdSizeUsed; expectedMaxWGS = std::min(Math::prevPowerOfTwo(expectedMaxWGS), 1024u); diff --git a/opencl/test/unit_test/gen12lp/buffer_tests_gen12lp.inl b/opencl/test/unit_test/gen12lp/buffer_tests_gen12lp.inl index e52e34a4d3..5839fe0149 100644 --- a/opencl/test/unit_test/gen12lp/buffer_tests_gen12lp.inl +++ b/opencl/test/unit_test/gen12lp/buffer_tests_gen12lp.inl @@ -148,10 +148,12 @@ using Gen12lpCreateBufferTest = ::testing::Test; GEN12LPTEST_F(Gen12lpCreateBufferTest, WhenCreatingBufferWithCopyHostPtrThenDontUseBlitOperation) { uint32_t hostPtr = 0; auto rootDeviceIndex = 1u; + auto hwInfo = *defaultHwInfo; hwInfo.capabilityTable.blitterOperationsSupported = true; - - EXPECT_FALSE(ProductHelper::get(hwInfo.platform.eProductFamily)->isBlitterFullySupported(hwInfo)); + MockExecutionEnvironment mockExecutionEnvironment{&hwInfo, false, 2}; + auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHelper(); + EXPECT_FALSE(productHelper.isBlitterFullySupported(hwInfo)); std::unique_ptr newDevice = std::make_unique(MockClDevice::createWithNewExecutionEnvironment(&hwInfo, rootDeviceIndex)); std::unique_ptr newBcsMockContext = std::make_unique(newDevice.get()); diff --git a/opencl/test/unit_test/gen12lp/tgllp/kernel_tests_tgllp.cpp b/opencl/test/unit_test/gen12lp/tgllp/kernel_tests_tgllp.cpp index bbbb812c37..0b83136a48 100644 --- a/opencl/test/unit_test/gen12lp/tgllp/kernel_tests_tgllp.cpp +++ b/opencl/test/unit_test/gen12lp/tgllp/kernel_tests_tgllp.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2022 Intel Corporation + * Copyright (C) 2020-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -8,6 +8,7 @@ #include "shared/source/gen12lp/hw_cmds_tgllp.h" #include "shared/source/os_interface/hw_info_config.h" #include "shared/test/common/mocks/mock_device.h" +#include "shared/test/common/mocks/mock_execution_environment.h" #include "shared/test/common/test_macros/header/per_product_test_definitions.h" #include "shared/test/common/test_macros/test.h" @@ -22,8 +23,10 @@ using KernelTgllpTests = ::testing::Test; TGLLPTEST_F(KernelTgllpTests, GivenUseOffsetToSkipSetFFIDGPWorkaroundActiveWhenSettingKernelStartOffsetThenAdditionalOffsetIsSet) { const uint64_t defaultKernelStartOffset = 0; const uint64_t additionalOffsetDueToFfid = 0x1234; - auto hwInfo = *defaultHwInfo; - const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily); + + MockExecutionEnvironment mockExecutionEnvironment{}; + auto hwInfo = *mockExecutionEnvironment.rootDeviceEnvironments[0]->getMutableHardwareInfo(); + const auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper(); unsigned short steppings[] = {REVISION_A0, REVISION_A1}; for (auto stepping : steppings) { diff --git a/opencl/test/unit_test/gmm_helper/gmm_helper_tests.cpp b/opencl/test/unit_test/gmm_helper/gmm_helper_tests.cpp index 44c9784917..98da3b0a53 100644 --- a/opencl/test/unit_test/gmm_helper/gmm_helper_tests.cpp +++ b/opencl/test/unit_test/gmm_helper/gmm_helper_tests.cpp @@ -838,7 +838,8 @@ TEST(GmmTest, givenHwInfoWhenDeviceIsCreatedThenSetThisHwInfoToGmmHelper) { } TEST(GmmTest, givenAllocationTypeWhenGettingUsageTypeThenReturnCorrectValue) { - const auto productHelper = ProductHelper::get(defaultHwInfo->platform.eProductFamily); + MockExecutionEnvironment mockExecutionEnvironment{}; + const auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper(); for (uint32_t i = 0; i < static_cast(AllocationType::COUNT); i++) { auto allocationType = static_cast(i); @@ -863,8 +864,8 @@ TEST(GmmTest, givenAllocationTypeWhenGettingUsageTypeThenReturnCorrectValue) { break; case AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER: case AllocationType::TIMESTAMP_PACKET_TAG_BUFFER: - expectedUsage = (forceUncached || productHelper->isDcFlushAllowed()) ? GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED - : GMM_RESOURCE_USAGE_OCL_BUFFER; + expectedUsage = (forceUncached || productHelper.isDcFlushAllowed()) ? GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED + : GMM_RESOURCE_USAGE_OCL_BUFFER; break; default: expectedUsage = forceUncached ? GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED : GMM_RESOURCE_USAGE_OCL_BUFFER; diff --git a/opencl/test/unit_test/helpers/timestamp_packet_1_tests.cpp b/opencl/test/unit_test/helpers/timestamp_packet_1_tests.cpp index 5d1fdd51b3..a2cc5f5faf 100644 --- a/opencl/test/unit_test/helpers/timestamp_packet_1_tests.cpp +++ b/opencl/test/unit_test/helpers/timestamp_packet_1_tests.cpp @@ -184,7 +184,7 @@ HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledWhenEstimatingStr size_t sizeForPipeControl = 0; const auto &hwInfo = device->getHardwareInfo(); - const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily); + const auto &productHelper = device->getProductHelper(); if (productHelper.isResolveDependenciesByPipeControlsSupported(hwInfo, mockCmdQHw->isOOQEnabled())) { sizeForPipeControl = MemorySynchronizationCommands::getSizeForSingleBarrier(false); } diff --git a/opencl/test/unit_test/kernel/cache_flush_tests.inl b/opencl/test/unit_test/kernel/cache_flush_tests.inl index b548a1eb0c..21567d8b4a 100644 --- a/opencl/test/unit_test/kernel/cache_flush_tests.inl +++ b/opencl/test/unit_test/kernel/cache_flush_tests.inl @@ -94,7 +94,9 @@ class GivenCacheFlushAfterWalkerEnabledAndProperSteppingIsSetWhenKernelArgIsSetA DebugManagerStateRestore dbgRestore; DebugManager.flags.EnableCacheFlushAfterWalker.set(1); - const auto &productHelper = *ProductHelper::get(hardwareInfo.platform.eProductFamily); + + pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->setHwInfoAndInitHelpers(&hardwareInfo); + const auto &productHelper = pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->getProductHelper(); auto stepping = (isA0Stepping ? REVISION_A0 : REVISION_A1); hardwareInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(stepping, hardwareInfo); pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->setHwInfoAndInitHelpers(&hardwareInfo); @@ -217,7 +219,9 @@ class GivenCacheFlushAfterWalkerEnabledAndProperSteppingIsSetWhenAllocationRequi DebugManagerStateRestore restore; DebugManager.flags.EnableCacheFlushAfterWalker.set(1); DebugManager.flags.EnableTimestampPacket.set(0); - const auto &productHelper = *ProductHelper::get(hardwareInfo.platform.eProductFamily); + + pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->setHwInfoAndInitHelpers(&hardwareInfo); + const auto &productHelper = pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->getProductHelper(); auto stepping = (isA0Stepping ? REVISION_A0 : REVISION_A1); hardwareInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(stepping, hardwareInfo); pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->setHwInfoAndInitHelpers(&hardwareInfo); diff --git a/opencl/test/unit_test/kernel/kernel_tests.cpp b/opencl/test/unit_test/kernel/kernel_tests.cpp index fafff1bb2b..1f48eec60e 100644 --- a/opencl/test/unit_test/kernel/kernel_tests.cpp +++ b/opencl/test/unit_test/kernel/kernel_tests.cpp @@ -3142,7 +3142,7 @@ TEST_F(KernelTests, givenKernelWithSimdEqual1WhenKernelCreatedThenMaxWorgGroupSi auto deviceMaxWorkGroupSize = pDevice->getDeviceInfo().maxWorkGroupSize; auto deviceInfo = pClDevice->getDevice().getDeviceInfo(); - auto &productHelper = *ProductHelper::get(kernel->getHardwareInfo().platform.eProductFamily); + auto &productHelper = pClDevice->getProductHelper(); auto maxThreadsPerWG = productHelper.getMaxThreadsForWorkgroupInDSSOrSS(kernel->getHardwareInfo(), static_cast(deviceInfo.maxNumEUsPerSubSlice), static_cast(deviceInfo.maxNumEUsPerDualSubSlice)); EXPECT_LT(kernel->getMaxKernelWorkGroupSize(), deviceMaxWorkGroupSize); diff --git a/opencl/test/unit_test/xe_hpc_core/hw_helper_tests_xe_hpc_core.cpp b/opencl/test/unit_test/xe_hpc_core/hw_helper_tests_xe_hpc_core.cpp index 79cbf1cbe0..c4088ec560 100644 --- a/opencl/test/unit_test/xe_hpc_core/hw_helper_tests_xe_hpc_core.cpp +++ b/opencl/test/unit_test/xe_hpc_core/hw_helper_tests_xe_hpc_core.cpp @@ -767,7 +767,7 @@ XE_HPC_CORETEST_F(GfxCoreHelperTestsXeHpcCore, givenBdA0WhenBcsSubDeviceSupportI XE_HPC_CORETEST_F(GfxCoreHelperTestsXeHpcCore, givenBdA0WhenAllocatingOnNonTileZeroThenForceTile0) { DebugManagerStateRestore restore; - HardwareInfo hwInfo = *defaultHwInfo; + HardwareInfo &hwInfo = *pClDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); auto &gfxCoreHelper = getHelper(); auto &productHelper = getHelper(); @@ -793,7 +793,7 @@ XE_HPC_CORETEST_F(GfxCoreHelperTestsXeHpcCore, givenBdA0WhenAllocatingOnNonTileZ allocData.flags.requiresCpuAccess = true; allocData.storageInfo.memoryBanks = originalMask; - gfxCoreHelper.setExtraAllocationData(allocData, allocProperties, hwInfo); + gfxCoreHelper.setExtraAllocationData(allocData, allocProperties, pClDevice->getRootDeviceEnvironment()); bool applyWa = (isBdA0 || (debugFlag == 1)); applyWa &= (debugFlag != 0); @@ -809,7 +809,6 @@ XE_HPC_CORETEST_F(GfxCoreHelperTestsXeHpcCore, givenBdA0WhenAllocatingOnNonTileZ } XE_HPC_CORETEST_F(GfxCoreHelperTestsXeHpcCore, givenCommandBufferAllocationWhenSetExtraAllocationDataThenUseSystemLocalMemoryOnlyForImplicitScalingCommandBuffers) { - HardwareInfo hwInfo = *defaultHwInfo; auto &gfxCoreHelper = getHelper(); constexpr DeviceBitfield singleTileBitfield = 0b0100; @@ -821,10 +820,10 @@ XE_HPC_CORETEST_F(GfxCoreHelperTestsXeHpcCore, givenCommandBufferAllocationWhenS AllocationData allocData; allocData.flags.useSystemMemory = false; - gfxCoreHelper.setExtraAllocationData(allocData, singleTileAllocProperties, hwInfo); + gfxCoreHelper.setExtraAllocationData(allocData, singleTileAllocProperties, pDevice->getRootDeviceEnvironment()); EXPECT_FALSE(allocData.flags.useSystemMemory); - gfxCoreHelper.setExtraAllocationData(allocData, allTilesAllocProperties, hwInfo); + gfxCoreHelper.setExtraAllocationData(allocData, allTilesAllocProperties, pDevice->getRootDeviceEnvironment()); EXPECT_FALSE(allocData.flags.useSystemMemory); } diff --git a/shared/source/gen12lp/hw_helper_gen12lp.cpp b/shared/source/gen12lp/hw_helper_gen12lp.cpp index 2372ab027d..2494eba300 100644 --- a/shared/source/gen12lp/hw_helper_gen12lp.cpp +++ b/shared/source/gen12lp/hw_helper_gen12lp.cpp @@ -193,8 +193,9 @@ bool MemorySynchronizationCommands::isBarrierlPriorToPipelineSelectWaReq } template <> -void GfxCoreHelperHw::setExtraAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const HardwareInfo &hwInfo) const { - const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily); +void GfxCoreHelperHw::setExtraAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const RootDeviceEnvironment &rootDeviceEnvironment) const { + auto &productHelper = rootDeviceEnvironment.getHelper(); + auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo(); if (productHelper.getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessDisallowed) { if (GraphicsAllocation::isCpuAccessRequired(properties.allocationType)) { allocationData.flags.useSystemMemory = true; diff --git a/shared/source/helpers/extra_allocation_data_xehp_and_later.inl b/shared/source/helpers/extra_allocation_data_xehp_and_later.inl index b6757d132d..2f9e267842 100644 --- a/shared/source/helpers/extra_allocation_data_xehp_and_later.inl +++ b/shared/source/helpers/extra_allocation_data_xehp_and_later.inl @@ -5,6 +5,7 @@ * */ +#include "shared/source/execution_environment/root_device_environment.h" #include "shared/source/helpers/hw_helper.h" #include "shared/source/helpers/local_memory_access_modes.h" #include "shared/source/memory_manager/allocation_properties.h" @@ -14,8 +15,9 @@ namespace NEO { template <> -void GfxCoreHelperHw::setExtraAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const HardwareInfo &hwInfo) const { - const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily); +void GfxCoreHelperHw::setExtraAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const RootDeviceEnvironment &rootDeviceEnvironment) const { + auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo(); + auto &productHelper = rootDeviceEnvironment.getHelper(); if (LocalMemoryAccessMode::CpuAccessDisallowed == productHelper.getLocalMemoryAccessMode(hwInfo)) { if (properties.allocationType == AllocationType::LINEAR_STREAM || diff --git a/shared/source/helpers/hw_helper.h b/shared/source/helpers/hw_helper.h index 7084ca141e..84205b4591 100644 --- a/shared/source/helpers/hw_helper.h +++ b/shared/source/helpers/hw_helper.h @@ -103,7 +103,7 @@ class GfxCoreHelper { virtual bool isFusedEuDispatchEnabled(const HardwareInfo &hwInfo, bool disableEUFusionForKernel) const = 0; virtual uint64_t getGpuTimeStampInNS(uint64_t timeStamp, double frequency) const = 0; virtual uint32_t getBindlessSurfaceExtendedMessageDescriptorValue(uint32_t surfStateOffset) const = 0; - virtual void setExtraAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const HardwareInfo &hwInfo) const = 0; + virtual void setExtraAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const RootDeviceEnvironment &rootDeviceEnvironment) const = 0; virtual bool isBankOverrideRequired(const HardwareInfo &hwInfo, const ProductHelper &productHelper) const = 0; virtual uint32_t getGlobalTimeStampBits() const = 0; virtual int32_t getDefaultThreadArbitrationPolicy() const = 0; @@ -296,7 +296,7 @@ class GfxCoreHelperHw : public GfxCoreHelper { uint32_t getGlobalTimeStampBits() const override; - void setExtraAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const HardwareInfo &hwInfo) const override; + void setExtraAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const RootDeviceEnvironment &rootDeviceEnvironment) const override; bool isBankOverrideRequired(const HardwareInfo &hwInfo, const ProductHelper &productHelper) const override; diff --git a/shared/source/helpers/hw_helper_base.inl b/shared/source/helpers/hw_helper_base.inl index 708b945261..40be7a8779 100644 --- a/shared/source/helpers/hw_helper_base.inl +++ b/shared/source/helpers/hw_helper_base.inl @@ -545,7 +545,7 @@ const StackVec GfxCoreHelperHw::getThreadsPerEUConfigs() } template -void GfxCoreHelperHw::setExtraAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const HardwareInfo &hwInfo) const {} +void GfxCoreHelperHw::setExtraAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const RootDeviceEnvironment &rootDeviceEnvironment) const {} template bool GfxCoreHelperHw::isBankOverrideRequired(const HardwareInfo &hwInfo, const ProductHelper &productHelper) const { diff --git a/shared/source/memory_manager/memory_manager.cpp b/shared/source/memory_manager/memory_manager.cpp index ff81b9e5f8..d9e22a0122 100644 --- a/shared/source/memory_manager/memory_manager.cpp +++ b/shared/source/memory_manager/memory_manager.cpp @@ -525,7 +525,7 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo allocationData.flags.crossRootDeviceAccess = properties.flags.crossRootDeviceAccess; allocationData.flags.useSystemMemory |= MemoryPropertiesHelper::useSystemMemoryForCrossRootDeviceAccess(properties.flags.crossRootDeviceAccess); - helper.setExtraAllocationData(allocationData, properties, hwInfo); + helper.setExtraAllocationData(allocationData, properties, rootDeviceEnvironment); allocationData.flags.useSystemMemory |= properties.flags.forceSystemMemory; overrideAllocationData(allocationData, properties); 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 3e9f746042..c7659b048e 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 @@ -220,7 +220,7 @@ void GfxCoreHelperHw::setL1CachePolicy(bool useL1Cache, typename Family: } template <> -void GfxCoreHelperHw::setExtraAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const HardwareInfo &hwInfo) const { +void GfxCoreHelperHw::setExtraAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const RootDeviceEnvironment &rootDeviceEnvironment) const { if (properties.allocationType == AllocationType::TIMESTAMP_PACKET_TAG_BUFFER || properties.allocationType == AllocationType::COMMAND_BUFFER) { allocationData.flags.useSystemMemory = false; } @@ -251,7 +251,9 @@ void GfxCoreHelperHw::setExtraAllocationData(AllocationData &allocationD if (allocationData.flags.requiresCpuAccess && !allocationData.flags.useSystemMemory && (allocationData.storageInfo.getMemoryBanks() > 1)) { - bool applyWa = ProductHelper::get(hwInfo.platform.eProductFamily)->isTilePlacementResourceWaRequired(hwInfo); + auto &productHeler = rootDeviceEnvironment.getHelper(); + auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo(); + bool applyWa = productHeler.isTilePlacementResourceWaRequired(hwInfo); if (applyWa) { allocationData.storageInfo.memoryBanks = 1; // force Tile0 diff --git a/shared/test/common/mocks/mock_hw_helper.h b/shared/test/common/mocks/mock_hw_helper.h index 2e1a892b34..ca6a864290 100644 --- a/shared/test/common/mocks/mock_hw_helper.h +++ b/shared/test/common/mocks/mock_hw_helper.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2022 Intel Corporation + * Copyright (C) 2020-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -30,7 +30,7 @@ class MockGfxCoreHelperWithLocalMemory : public GfxCoreHelperHw { template struct MockGfxCoreHelperHwWithSetIsLockable : public GfxCoreHelperHw { - void setExtraAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const HardwareInfo &hwInfo) const override { + void setExtraAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const RootDeviceEnvironment &rootDeviceEnvironment) const override { allocationData.storageInfo.isLockable = setIsLockable; } bool setIsLockable = true; diff --git a/shared/test/unit_test/gen12lp/dg1/hw_helper_tests_dg1.cpp b/shared/test/unit_test/gen12lp/dg1/hw_helper_tests_dg1.cpp index ed7fdb209a..1963833e76 100644 --- a/shared/test/unit_test/gen12lp/dg1/hw_helper_tests_dg1.cpp +++ b/shared/test/unit_test/gen12lp/dg1/hw_helper_tests_dg1.cpp @@ -5,12 +5,14 @@ * */ +#include "shared/source/execution_environment/root_device_environment.h" #include "shared/source/gen12lp/hw_cmds_dg1.h" #include "shared/source/helpers/hw_helper.h" #include "shared/source/memory_manager/allocation_properties.h" #include "shared/source/os_interface/hw_info_config.h" #include "shared/test/common/helpers/default_hw_info.h" #include "shared/test/common/helpers/hw_helper_tests.h" +#include "shared/test/common/mocks/mock_device.h" #include "shared/test/common/mocks/mock_graphics_allocation.h" #include "shared/test/common/test_macros/header/per_product_test_definitions.h" @@ -64,7 +66,7 @@ DG1TEST_F(GfxCoreHelperTestDg1, givenBufferAllocationTypeWhenSetExtraAllocationD AllocationProperties allocProperties(0, 1, AllocationType::BUFFER, {}); allocData.storageInfo.isLockable = false; allocProperties.flags.shareable = false; - gfxCoreHelper.setExtraAllocationData(allocData, allocProperties, *defaultHwInfo); + gfxCoreHelper.setExtraAllocationData(allocData, allocProperties, pDevice->getRootDeviceEnvironment()); EXPECT_TRUE(allocData.storageInfo.isLockable); } @@ -75,6 +77,6 @@ DG1TEST_F(GfxCoreHelperTestDg1, givenBufferAllocationTypeWhenSetExtraAllocationD AllocationProperties allocProperties(0, 1, AllocationType::BUFFER, {}); allocData.storageInfo.isLockable = false; allocProperties.flags.shareable = true; - gfxCoreHelper.setExtraAllocationData(allocData, allocProperties, *defaultHwInfo); + gfxCoreHelper.setExtraAllocationData(allocData, allocProperties, pDevice->getRootDeviceEnvironment()); EXPECT_FALSE(allocData.storageInfo.isLockable); } diff --git a/shared/test/unit_test/xe_hpg_core/dg2/hw_helper_tests_dg2.cpp b/shared/test/unit_test/xe_hpg_core/dg2/hw_helper_tests_dg2.cpp index 2289886a25..4151142b2f 100644 --- a/shared/test/unit_test/xe_hpg_core/dg2/hw_helper_tests_dg2.cpp +++ b/shared/test/unit_test/xe_hpg_core/dg2/hw_helper_tests_dg2.cpp @@ -104,6 +104,6 @@ DG2TEST_F(GfxCoreHelperTests, givenAllocationTypeInternalHeapWhenSetExtraAllocat AllocationData allocData; allocData.flags.useSystemMemory = false; - gfxCoreHelper.setExtraAllocationData(allocData, singleTileAllocProperties, hwInfo); + gfxCoreHelper.setExtraAllocationData(allocData, singleTileAllocProperties, pDevice->getRootDeviceEnvironment()); EXPECT_TRUE(allocData.flags.useSystemMemory); } \ No newline at end of file diff --git a/shared/test/unit_test/xe_hpg_core/hw_helper_tests_xe_hpg_core.cpp b/shared/test/unit_test/xe_hpg_core/hw_helper_tests_xe_hpg_core.cpp index a1a8633ba8..855f62a6bb 100644 --- a/shared/test/unit_test/xe_hpg_core/hw_helper_tests_xe_hpg_core.cpp +++ b/shared/test/unit_test/xe_hpg_core/hw_helper_tests_xe_hpg_core.cpp @@ -106,7 +106,7 @@ XE_HPG_CORETEST_F(GfxCoreHelperTestXeHpgCore, givenAllocDataWhenSetExtraAllocati allocData.flags.useSystemMemory = true; allocData.flags.requiresCpuAccess = false; - gfxCoreHelper.setExtraAllocationData(allocData, allocProperties, *defaultHwInfo); + gfxCoreHelper.setExtraAllocationData(allocData, allocProperties, pDevice->getRootDeviceEnvironment()); if (defaultHwInfo->featureTable.flags.ftrLocalMemory && (allocProperties.allocationType == AllocationType::COMMAND_BUFFER ||