diff --git a/level_zero/core/test/unit_tests/sources/cache/linux/test_cache_reservation_impl_prelim.cpp b/level_zero/core/test/unit_tests/sources/cache/linux/test_cache_reservation_impl_prelim.cpp index fc53c38ba4..70c45d908e 100644 --- a/level_zero/core/test/unit_tests/sources/cache/linux/test_cache_reservation_impl_prelim.cpp +++ b/level_zero/core/test/unit_tests/sources/cache/linux/test_cache_reservation_impl_prelim.cpp @@ -145,8 +145,8 @@ HWTEST2_F(CacheReservationTest, GivenCacheReservationSupportedWhenCallingSetCach } HWTEST2_F(CacheReservationTest, GivenCacheReservationSupportedWhenCallingSetCacheAdviceOnReservedCacheRegionThenSetCacheRegionCorrectly, IsCacheReservationSupported) { - auto &gfxCoreHelper = neoDevice->getGfxCoreHelper(); - if (gfxCoreHelper.getNumCacheRegions() == 0) { + auto &productHelper = neoDevice->getProductHelper(); + if (productHelper.getNumCacheRegions() == 0) { GTEST_SKIP(); } size_t cacheLevel = 3; @@ -186,8 +186,8 @@ HWTEST2_F(CacheReservationTest, GivenCacheReservationSupportedWhenCallingSetCach } HWTEST2_F(CacheReservationTest, GivenCacheReservationSupportedWhenCallingSetCacheAdviceOnNonReservedCacheRegionThenSetCacheRegionCorrectly, IsCacheReservationSupported) { - auto &gfxCoreHelper = neoDevice->getGfxCoreHelper(); - if (gfxCoreHelper.getNumCacheRegions() == 0) { + auto &productHelper = neoDevice->getProductHelper(); + if (productHelper.getNumCacheRegions() == 0) { GTEST_SKIP(); } size_t cacheLevel = 3; diff --git a/opencl/test/unit_test/os_interface/linux/cl_mem_cache_clos_tests_xe_hpc.cpp b/opencl/test/unit_test/os_interface/linux/cl_mem_cache_clos_tests_xe_hpc.cpp index 8499a2579b..c26447612c 100644 --- a/opencl/test/unit_test/os_interface/linux/cl_mem_cache_clos_tests_xe_hpc.cpp +++ b/opencl/test/unit_test/os_interface/linux/cl_mem_cache_clos_tests_xe_hpc.cpp @@ -97,8 +97,8 @@ XE_HPC_CORETEST_F(BuffersWithClMemCacheClosTests, givenDrmBuffersWhenTheyAreCrea cl_mem_alloc_flags_intel allocflags = 0; MemoryProperties memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, allocflags, device.get()); - auto &gfxCoreHelper = device->getGfxCoreHelper(); - auto numCacheRegions = gfxCoreHelper.getNumCacheRegions(); + auto &productHelper = device->getProductHelper(); + auto numCacheRegions = productHelper.getNumCacheRegions(); EXPECT_EQ(3u, numCacheRegions); for (uint32_t cacheRegion = 0; cacheRegion < numCacheRegions; cacheRegion++) { diff --git a/shared/source/helpers/gfx_core_helper.h b/shared/source/helpers/gfx_core_helper.h index fd7a526b5c..e65f14f922 100644 --- a/shared/source/helpers/gfx_core_helper.h +++ b/shared/source/helpers/gfx_core_helper.h @@ -131,7 +131,6 @@ class GfxCoreHelper { virtual size_t getSipKernelMaxDbgSurfaceSize(const HardwareInfo &hwInfo) const = 0; virtual bool isCpuImageTransferPreferred(const HardwareInfo &hwInfo) const = 0; virtual aub_stream::MMIOList getExtraMmioList(const HardwareInfo &hwInfo, const GmmHelper &gmmHelper) const = 0; - virtual uint32_t getNumCacheRegions() const = 0; virtual bool isSubDeviceEngineSupported(const RootDeviceEnvironment &rootDeviceEnvironment, const DeviceBitfield &deviceBitfield, aub_stream::EngineType engineType) const = 0; virtual uint32_t getPlanarYuvMaxHeight() const = 0; virtual size_t getPreemptionAllocationAlignment() const = 0; @@ -159,7 +158,6 @@ class GfxCoreHelper { virtual uint32_t getRenderSurfaceStatePitch(void *renderSurfaceState, const ProductHelper &productHelper) const = 0; virtual size_t getMax3dImageWidthOrHeight() const = 0; virtual uint64_t getMaxMemAllocSize() const = 0; - virtual uint64_t getPatIndex(CacheRegion cacheRegion, CachePolicy cachePolicy) const = 0; virtual bool isStatelessToStatefulWithOffsetSupported() const = 0; virtual void encodeBufferSurfaceState(EncodeSurfaceStateArgs &args) const = 0; virtual bool platformSupportsImplicitScaling(const NEO::RootDeviceEnvironment &rootDeviceEnvironment) const = 0; @@ -362,8 +360,6 @@ class GfxCoreHelperHw : public GfxCoreHelper { aub_stream::MMIOList getExtraMmioList(const HardwareInfo &hwInfo, const GmmHelper &gmmHelper) const override; - uint32_t getNumCacheRegions() const override; - bool isSubDeviceEngineSupported(const RootDeviceEnvironment &rootDeviceEnvironment, const DeviceBitfield &deviceBitfield, aub_stream::EngineType engineType) const override; uint32_t getPlanarYuvMaxHeight() const override; @@ -397,7 +393,6 @@ class GfxCoreHelperHw : public GfxCoreHelper { bool preferInternalBcsEngine() const override; size_t getMax3dImageWidthOrHeight() const override; uint64_t getMaxMemAllocSize() const override; - uint64_t getPatIndex(CacheRegion cacheRegion, CachePolicy cachePolicy) const override; bool isStatelessToStatefulWithOffsetSupported() const override; void encodeBufferSurfaceState(EncodeSurfaceStateArgs &args) const override; bool platformSupportsImplicitScaling(const NEO::RootDeviceEnvironment &rootDeviceEnvironment) const override; diff --git a/shared/source/helpers/gfx_core_helper_base.inl b/shared/source/helpers/gfx_core_helper_base.inl index 3ad499b9ae..ddf877fb24 100644 --- a/shared/source/helpers/gfx_core_helper_base.inl +++ b/shared/source/helpers/gfx_core_helper_base.inl @@ -582,11 +582,6 @@ bool GfxCoreHelperHw::isAdditionalFeatureFlagRequired(const FeatureTa return false; } -template -uint32_t GfxCoreHelperHw::getNumCacheRegions() const { - return 0; -} - template bool GfxCoreHelperHw::isSubDeviceEngineSupported(const RootDeviceEnvironment &rootDeviceEnvironment, const DeviceBitfield &deviceBitfield, aub_stream::EngineType engineType) const { return true; @@ -663,13 +658,6 @@ bool GfxCoreHelperHw::isPlatformFlushTaskEnabled(const ProductHelper return productHelper.isFlushTaskAllowed(); } -template -uint64_t GfxCoreHelperHw::getPatIndex(CacheRegion cacheRegion, CachePolicy cachePolicy) const { - UNRECOVERABLE_IF(true); - - return -1; -} - template bool GfxCoreHelperHw::copyThroughLockedPtrEnabled(const HardwareInfo &hwInfo, const ProductHelper &productHelper) const { if (debugManager.flags.ExperimentalCopyThroughLock.get() != -1) { diff --git a/shared/source/os_interface/linux/drm_neo.cpp b/shared/source/os_interface/linux/drm_neo.cpp index 026697a167..9b2ba49a73 100644 --- a/shared/source/os_interface/linux/drm_neo.cpp +++ b/shared/source/os_interface/linux/drm_neo.cpp @@ -1011,9 +1011,9 @@ void Drm::setupSystemInfo(HardwareInfo *hwInfo, SystemInfo *sysInfo) { } void Drm::setupCacheInfo(const HardwareInfo &hwInfo) { - auto &gfxCoreHelper = rootDeviceEnvironment.getHelper(); + auto &productHelper = rootDeviceEnvironment.getHelper(); - if (debugManager.flags.ClosEnabled.get() == 0 || gfxCoreHelper.getNumCacheRegions() == 0) { + if (debugManager.flags.ClosEnabled.get() == 0 || productHelper.getNumCacheRegions() == 0) { this->cacheInfo.reset(new CacheInfo{*ioctlHelper, 0, 0, 0}); return; } @@ -1026,7 +1026,7 @@ void Drm::setupCacheInfo(const HardwareInfo &hwInfo) { constexpr uint16_t maxReservationNumWays = std::min(globalReservationLimit, clientReservationLimit); const size_t totalCacheSize = gtSysInfo->L3CacheSizeInKb * MemoryConstants::kiloByte; const size_t maxReservationCacheSize = (totalCacheSize * maxReservationNumWays) / maxNumWays; - const uint32_t maxReservationNumCacheRegions = gfxCoreHelper.getNumCacheRegions() - 1; + const uint32_t maxReservationNumCacheRegions = productHelper.getNumCacheRegions() - 1; this->cacheInfo.reset(new CacheInfo(*ioctlHelper, maxReservationCacheSize, maxReservationNumCacheRegions, maxReservationNumWays)); } @@ -1366,8 +1366,6 @@ uint64_t Drm::getPatIndex(Gmm *gmm, AllocationType allocationType, CacheRegion c return CommonConstants::unsupportedPatIndex; } - auto &gfxCoreHelper = rootDeviceEnvironment.getHelper(); - GMM_RESOURCE_INFO *resourceInfo = nullptr; bool cachable = !CacheSettingsHelper::isUncachedType(usageType); bool compressed = false; @@ -1389,7 +1387,7 @@ uint64_t Drm::getPatIndex(Gmm *gmm, AllocationType allocationType, CacheRegion c } if (closEnabled) { - patIndex = gfxCoreHelper.getPatIndex(cacheRegion, cachePolicy); + patIndex = productHelper.getPatIndex(cacheRegion, cachePolicy); } return patIndex; diff --git a/shared/source/os_interface/product_helper.h b/shared/source/os_interface/product_helper.h index 4bc3b65ee2..e9ba9597aa 100644 --- a/shared/source/os_interface/product_helper.h +++ b/shared/source/os_interface/product_helper.h @@ -48,6 +48,8 @@ enum class DriverModelType; enum class EngineGroupType : uint32_t; enum class GfxMemoryAllocationMethod : uint32_t; enum class AllocationType; +enum class CacheRegion : uint16_t; +enum class CachePolicy : uint32_t; using ProductHelperCreateFunctionType = std::unique_ptr (*)(); extern ProductHelperCreateFunctionType productHelperFactory[IGFX_MAX_PRODUCT]; @@ -243,6 +245,8 @@ class ProductHelper { virtual uint32_t getCacheLineSize() const = 0; virtual bool supports2DBlockStore() const = 0; virtual bool supports2DBlockLoad() const = 0; + virtual uint32_t getNumCacheRegions() const = 0; + virtual uint64_t getPatIndex(CacheRegion cacheRegion, CachePolicy cachePolicy) const = 0; virtual ~ProductHelper() = default; diff --git a/shared/source/os_interface/product_helper.inl b/shared/source/os_interface/product_helper.inl index 0aa96e6586..92c381779e 100644 --- a/shared/source/os_interface/product_helper.inl +++ b/shared/source/os_interface/product_helper.inl @@ -919,4 +919,15 @@ bool ProductHelperHw::supports2DBlockStore() const { return false; } +template +uint32_t ProductHelperHw::getNumCacheRegions() const { + return 0u; +} + +template +uint64_t ProductHelperHw::getPatIndex(CacheRegion cacheRegion, CachePolicy cachePolicy) const { + UNRECOVERABLE_IF(true); + return -1; +} + } // namespace NEO diff --git a/shared/source/os_interface/product_helper_hw.h b/shared/source/os_interface/product_helper_hw.h index 64b1e2d410..0e8ba8ae26 100644 --- a/shared/source/os_interface/product_helper_hw.h +++ b/shared/source/os_interface/product_helper_hw.h @@ -187,6 +187,8 @@ class ProductHelperHw : public ProductHelper { uint32_t getCacheLineSize() const override; bool supports2DBlockStore() const override; bool supports2DBlockLoad() const override; + uint32_t getNumCacheRegions() const override; + uint64_t getPatIndex(CacheRegion cacheRegion, CachePolicy cachePolicy) const override; ~ProductHelperHw() override = default; diff --git a/shared/source/xe_hpc_core/gfx_core_helper_xe_hpc_core.cpp b/shared/source/xe_hpc_core/gfx_core_helper_xe_hpc_core.cpp index fba0693d54..6a5f8e6f05 100644 --- a/shared/source/xe_hpc_core/gfx_core_helper_xe_hpc_core.cpp +++ b/shared/source/xe_hpc_core/gfx_core_helper_xe_hpc_core.cpp @@ -248,14 +248,6 @@ void GfxCoreHelperHw::setExtraAllocationData(AllocationData &allocationD } } -template <> -uint32_t GfxCoreHelperHw::getNumCacheRegions() const { - constexpr uint32_t numSharedCacheRegions = 1; - constexpr uint32_t numReservedCacheRegions = 2; - constexpr uint32_t numTotalCacheRegions = numSharedCacheRegions + numReservedCacheRegions; - return numTotalCacheRegions; -} - template <> uint32_t GfxCoreHelperHw::alignSlmSize(uint32_t slmSize) const { const uint32_t alignedSlmSizes[] = { @@ -362,32 +354,6 @@ size_t GfxCoreHelperHw::getSipKernelMaxDbgSurfaceSize(const HardwareInfo return 40 * MemoryConstants::megaByte; } -template <> -uint64_t GfxCoreHelperHw::getPatIndex(CacheRegion cacheRegion, CachePolicy cachePolicy) const { - /* - PAT Index CLOS MemType - SHARED - 0 0 UC (00) - 1 0 WC (01) - 2 0 WT (10) - 3 0 WB (11) - RESERVED 1 - 4 1 WT (10) - 5 1 WB (11) - RESERVED 2 - 6 2 WT (10) - 7 2 WB (11) - */ - - if ((debugManager.flags.ForceAllResourcesUncached.get() == true)) { - cacheRegion = CacheRegion::defaultRegion; - cachePolicy = CachePolicy::uncached; - } - - UNRECOVERABLE_IF((cacheRegion > CacheRegion::defaultRegion) && (cachePolicy < CachePolicy::writeThrough)); - return (static_cast(cachePolicy) + (static_cast(cacheRegion) * 2)); -} - template <> bool GfxCoreHelperHw::copyThroughLockedPtrEnabled(const HardwareInfo &hwInfo, const ProductHelper &productHelper) const { if (debugManager.flags.ExperimentalCopyThroughLock.get() != -1) { diff --git a/shared/source/xe_hpc_core/linux/product_helper_xe_hpc_core.inl b/shared/source/xe_hpc_core/linux/product_helper_xe_hpc_core.inl index 33aa776157..c724593098 100644 --- a/shared/source/xe_hpc_core/linux/product_helper_xe_hpc_core.inl +++ b/shared/source/xe_hpc_core/linux/product_helper_xe_hpc_core.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2023 Intel Corporation + * Copyright (C) 2022-2024 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -32,4 +32,38 @@ bool ProductHelperHw::isNonBlockingGpuSubmissionSupported() const { return false; } +template <> +uint32_t ProductHelperHw::getNumCacheRegions() const { + constexpr uint32_t numSharedCacheRegions = 1; + constexpr uint32_t numReservedCacheRegions = 2; + constexpr uint32_t numTotalCacheRegions = numSharedCacheRegions + numReservedCacheRegions; + return numTotalCacheRegions; +} + +template <> +uint64_t ProductHelperHw::getPatIndex(CacheRegion cacheRegion, CachePolicy cachePolicy) const { + /* + PAT Index CLOS MemType + SHARED + 0 0 UC (00) + 1 0 WC (01) + 2 0 WT (10) + 3 0 WB (11) + RESERVED 1 + 4 1 WT (10) + 5 1 WB (11) + RESERVED 2 + 6 2 WT (10) + 7 2 WB (11) + */ + + if ((debugManager.flags.ForceAllResourcesUncached.get() == true)) { + cacheRegion = CacheRegion::defaultRegion; + cachePolicy = CachePolicy::uncached; + } + + UNRECOVERABLE_IF((cacheRegion > CacheRegion::defaultRegion) && (cachePolicy < CachePolicy::writeThrough)); + return (static_cast(cachePolicy) + (static_cast(cacheRegion) * 2)); +} + } // namespace NEO diff --git a/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp b/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp index bbee4f568c..3bc4ccf739 100644 --- a/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp +++ b/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp @@ -1281,11 +1281,6 @@ TEST_F(GfxCoreHelperTest, whenFtrGpGpuMidThreadLevelPreemptFeatureDisabledThenFa EXPECT_FALSE(result); } -HWTEST_F(GfxCoreHelperTest, whenGettingNumberOfCacheRegionsThenReturnZero) { - auto &gfxCoreHelper = getHelper(); - EXPECT_EQ(0u, gfxCoreHelper.getNumCacheRegions()); -} - HWTEST_F(GfxCoreHelperTest, whenSetCompressedFlagThenProperFlagSet) { auto &gfxCoreHelper = getHelper(); auto gmm = std::make_unique(pDevice->getGmmHelper()); diff --git a/shared/test/unit_test/os_interface/linux/drm_cache_info_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_cache_info_tests.cpp index 4fa89b4396..5f6f416fda 100644 --- a/shared/test/unit_test/os_interface/linux/drm_cache_info_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_cache_info_tests.cpp @@ -7,6 +7,7 @@ #include "shared/source/helpers/constants.h" #include "shared/source/os_interface/linux/cache_info.h" +#include "shared/source/os_interface/product_helper.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/default_hw_info.h" #include "shared/test/common/libult/linux/drm_query_mock.h" @@ -21,14 +22,14 @@ TEST(DrmCacheInfoTest, givenCacheRegionsExistsWhenCallingSetUpCacheInfoThenCache auto executionEnvironment = std::make_unique(); DrmQueryMock drm(*executionEnvironment->rootDeviceEnvironments[0]); - auto &gfxCoreHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); + auto &productHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); drm.setupCacheInfo(*defaultHwInfo.get()); auto cacheInfo = drm.getCacheInfo(); EXPECT_NE(nullptr, cacheInfo); - if (gfxCoreHelper.getNumCacheRegions() == 0) { + if (productHelper.getNumCacheRegions() == 0) { EXPECT_EQ(0u, cacheInfo->getMaxReservationCacheSize()); EXPECT_EQ(0u, cacheInfo->getMaxReservationNumCacheRegions()); EXPECT_EQ(0u, cacheInfo->getMaxReservationNumWays()); @@ -40,7 +41,7 @@ TEST(DrmCacheInfoTest, givenCacheRegionsExistsWhenCallingSetUpCacheInfoThenCache constexpr uint16_t maxReservationNumWays = std::min(globalReservationLimit, clientReservationLimit); const size_t totalCacheSize = gtSysInfo->L3CacheSizeInKb * MemoryConstants::kiloByte; const size_t maxReservationCacheSize = (totalCacheSize * maxReservationNumWays) / maxNumWays; - const size_t maxReservationNumCacheRegions = gfxCoreHelper.getNumCacheRegions() - 1; + const size_t maxReservationNumCacheRegions = productHelper.getNumCacheRegions() - 1; EXPECT_EQ(maxReservationCacheSize, cacheInfo->getMaxReservationCacheSize()); EXPECT_EQ(maxReservationNumCacheRegions, cacheInfo->getMaxReservationNumCacheRegions()); diff --git a/shared/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp index 2155d8dd1a..39c92e5c53 100644 --- a/shared/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp @@ -4711,10 +4711,9 @@ TEST_F(DrmAllocationTests, givenDrmAllocationWhenCacheRegionIsSetSuccessfullyThe drm.cacheInfo.reset(new MockCacheInfo(*drm.getIoctlHelper(), 32 * MemoryConstants::kiloByte, 2, 32)); MockDrmAllocation allocation(rootDeviceIndex, AllocationType::buffer, MemoryPool::localMemory); - auto &gfxCoreHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); auto &productHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); - if ((gfxCoreHelper.getNumCacheRegions() == 0) && + if ((productHelper.getNumCacheRegions() == 0) && productHelper.isVmBindPatIndexProgrammingSupported()) { EXPECT_ANY_THROW(allocation.setCacheAdvice(&drm, 1024, CacheRegion::region1, false)); } else { @@ -4732,10 +4731,9 @@ TEST_F(DrmAllocationTests, givenDrmAllocationWhenCacheRegionIsSetSuccessfullyThe MockDrmAllocation allocation(rootDeviceIndex, AllocationType::buffer, MemoryPool::localMemory); allocation.bufferObjects[0] = &bo; - auto &gfxCoreHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); auto &productHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); - if ((gfxCoreHelper.getNumCacheRegions() == 0) && + if ((productHelper.getNumCacheRegions() == 0) && productHelper.isVmBindPatIndexProgrammingSupported()) { EXPECT_ANY_THROW(allocation.setCacheAdvice(&drm, 1024, CacheRegion::region1, false)); } else { @@ -4877,8 +4875,8 @@ TEST_F(DrmAllocationTests, givenCachedTypeWhenForceOverridePatIndexForCachedType TEST_F(DrmMemoryManagerTest, givenDrmAllocationWithHostPtrWhenItIsCreatedWithCacheRegionThenSetRegionInBufferObject) { - auto &gfxCoreHelper = executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->getHelper(); - if (gfxCoreHelper.getNumCacheRegions() == 0) { + auto &productHelper = executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->getHelper(); + if (productHelper.getNumCacheRegions() == 0) { GTEST_SKIP(); } mock->ioctlExpected.total = -1; diff --git a/shared/test/unit_test/os_interface/linux/drm_memory_operations_handler_bind_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_memory_operations_handler_bind_tests.cpp index 5b8cb4aac7..20fc6af1b1 100644 --- a/shared/test/unit_test/os_interface/linux/drm_memory_operations_handler_bind_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_memory_operations_handler_bind_tests.cpp @@ -1089,10 +1089,9 @@ HWTEST_F(DrmMemoryOperationsHandlerBindTest, givenPatIndexProgrammingEnabledWhen auto osContext = memoryManager->createAndRegisterOsContext(csr.get(), EngineDescriptorHelper::getDefaultDescriptor()); csr->setupContext(*osContext); - auto &gfxCoreHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); auto &productHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); - bool closSupported = (gfxCoreHelper.getNumCacheRegions() > 0); + bool closSupported = (productHelper.getNumCacheRegions() > 0); bool patIndexProgrammingSupported = productHelper.isVmBindPatIndexProgrammingSupported(); uint64_t gpuAddress = 0x123000; @@ -1148,9 +1147,8 @@ HWTEST_F(DrmMemoryOperationsHandlerBindTest, givenPatIndexErrorAndUncachedDebugF auto csr = std::make_unique>(*executionEnvironment, 0, DeviceBitfield(1)); auto osContext = memoryManager->createAndRegisterOsContext(csr.get(), EngineDescriptorHelper::getDefaultDescriptor()); csr->setupContext(*osContext); - auto &gfxCoreHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); auto &productHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); - bool closSupported = (gfxCoreHelper.getNumCacheRegions() > 0); + bool closSupported = (productHelper.getNumCacheRegions() > 0); bool patIndexProgrammingSupported = productHelper.isVmBindPatIndexProgrammingSupported(); if (!closSupported || !patIndexProgrammingSupported) { GTEST_SKIP(); @@ -1209,9 +1207,9 @@ HWTEST_F(DrmMemoryOperationsHandlerBindTest, givenDebugFlagSetWhenVmBindCalledTh auto timestampStorageAlloc = csr->getTimestampPacketAllocator()->getTag()->getBaseGraphicsAllocation()->getDefaultGraphicsAllocation(); - auto &gfxCoreHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); + auto &productHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); - if (gfxCoreHelper.getNumCacheRegions() == 0) { + if (productHelper.getNumCacheRegions() == 0) { GTEST_SKIP(); } @@ -1297,9 +1295,9 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenClosEnabledAndAllocationToBeCach mock->cacheInfo.reset(new CacheInfo(*mock->getIoctlHelper(), 64 * MemoryConstants::kiloByte, 2, 32)); - auto &gfxCoreHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); + auto &productHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); - if (gfxCoreHelper.getNumCacheRegions() == 0) { + if (productHelper.getNumCacheRegions() == 0) { GTEST_SKIP(); } @@ -1311,7 +1309,7 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenClosEnabledAndAllocationToBeCach mock->context.receivedVmBindPatIndex.reset(); operationHandler->makeResident(device, ArrayRef(&allocation, 1)); - auto patIndex = gfxCoreHelper.getPatIndex(cacheRegion, CachePolicy::writeBack); + auto patIndex = productHelper.getPatIndex(cacheRegion, CachePolicy::writeBack); EXPECT_EQ(patIndex, mock->context.receivedVmBindPatIndex.value()); @@ -1413,26 +1411,26 @@ using DrmResidencyHandlerTests = ::testing::Test; HWTEST2_F(DrmResidencyHandlerTests, givenClosIndexAndMemoryTypeWhenAskingForPatIndexThenReturnCorrectValue, IsWithinXeGfxFamily) { MockExecutionEnvironment mockExecutionEnvironment{}; - auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper(); + auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper(); - if (gfxCoreHelper.getNumCacheRegions() == 0) { - EXPECT_ANY_THROW(gfxCoreHelper.getPatIndex(CacheRegion::defaultRegion, CachePolicy::uncached)); - EXPECT_ANY_THROW(gfxCoreHelper.getPatIndex(CacheRegion::defaultRegion, CachePolicy::writeBack)); + if (productHelper.getNumCacheRegions() == 0) { + EXPECT_ANY_THROW(productHelper.getPatIndex(CacheRegion::defaultRegion, CachePolicy::uncached)); + EXPECT_ANY_THROW(productHelper.getPatIndex(CacheRegion::defaultRegion, CachePolicy::writeBack)); } else { - EXPECT_EQ(0u, gfxCoreHelper.getPatIndex(CacheRegion::defaultRegion, CachePolicy::uncached)); - EXPECT_EQ(1u, gfxCoreHelper.getPatIndex(CacheRegion::defaultRegion, CachePolicy::writeCombined)); - EXPECT_EQ(2u, gfxCoreHelper.getPatIndex(CacheRegion::defaultRegion, CachePolicy::writeThrough)); - EXPECT_EQ(3u, gfxCoreHelper.getPatIndex(CacheRegion::defaultRegion, CachePolicy::writeBack)); + EXPECT_EQ(0u, productHelper.getPatIndex(CacheRegion::defaultRegion, CachePolicy::uncached)); + EXPECT_EQ(1u, productHelper.getPatIndex(CacheRegion::defaultRegion, CachePolicy::writeCombined)); + EXPECT_EQ(2u, productHelper.getPatIndex(CacheRegion::defaultRegion, CachePolicy::writeThrough)); + EXPECT_EQ(3u, productHelper.getPatIndex(CacheRegion::defaultRegion, CachePolicy::writeBack)); - EXPECT_ANY_THROW(gfxCoreHelper.getPatIndex(CacheRegion::region1, CachePolicy::uncached)); - EXPECT_ANY_THROW(gfxCoreHelper.getPatIndex(CacheRegion::region1, CachePolicy::writeCombined)); - EXPECT_EQ(4u, gfxCoreHelper.getPatIndex(CacheRegion::region1, CachePolicy::writeThrough)); - EXPECT_EQ(5u, gfxCoreHelper.getPatIndex(CacheRegion::region1, CachePolicy::writeBack)); + EXPECT_ANY_THROW(productHelper.getPatIndex(CacheRegion::region1, CachePolicy::uncached)); + EXPECT_ANY_THROW(productHelper.getPatIndex(CacheRegion::region1, CachePolicy::writeCombined)); + EXPECT_EQ(4u, productHelper.getPatIndex(CacheRegion::region1, CachePolicy::writeThrough)); + EXPECT_EQ(5u, productHelper.getPatIndex(CacheRegion::region1, CachePolicy::writeBack)); - EXPECT_ANY_THROW(gfxCoreHelper.getPatIndex(CacheRegion::region2, CachePolicy::uncached)); - EXPECT_ANY_THROW(gfxCoreHelper.getPatIndex(CacheRegion::region2, CachePolicy::writeCombined)); - EXPECT_EQ(6u, gfxCoreHelper.getPatIndex(CacheRegion::region2, CachePolicy::writeThrough)); - EXPECT_EQ(7u, gfxCoreHelper.getPatIndex(CacheRegion::region2, CachePolicy::writeBack)); + EXPECT_ANY_THROW(productHelper.getPatIndex(CacheRegion::region2, CachePolicy::uncached)); + EXPECT_ANY_THROW(productHelper.getPatIndex(CacheRegion::region2, CachePolicy::writeCombined)); + EXPECT_EQ(6u, productHelper.getPatIndex(CacheRegion::region2, CachePolicy::writeThrough)); + EXPECT_EQ(7u, productHelper.getPatIndex(CacheRegion::region2, CachePolicy::writeBack)); } } @@ -1441,26 +1439,26 @@ HWTEST2_F(DrmResidencyHandlerTests, givenForceAllResourcesUnchashedSetAskingForP debugManager.flags.ForceAllResourcesUncached.set(1); MockExecutionEnvironment mockExecutionEnvironment{}; - auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper(); + auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper(); - if (gfxCoreHelper.getNumCacheRegions() == 0) { - EXPECT_ANY_THROW(gfxCoreHelper.getPatIndex(CacheRegion::defaultRegion, CachePolicy::uncached)); - EXPECT_ANY_THROW(gfxCoreHelper.getPatIndex(CacheRegion::defaultRegion, CachePolicy::writeBack)); + if (productHelper.getNumCacheRegions() == 0) { + EXPECT_ANY_THROW(productHelper.getPatIndex(CacheRegion::defaultRegion, CachePolicy::uncached)); + EXPECT_ANY_THROW(productHelper.getPatIndex(CacheRegion::defaultRegion, CachePolicy::writeBack)); } else { - EXPECT_EQ(0u, gfxCoreHelper.getPatIndex(CacheRegion::defaultRegion, CachePolicy::uncached)); - EXPECT_EQ(0u, gfxCoreHelper.getPatIndex(CacheRegion::defaultRegion, CachePolicy::writeCombined)); - EXPECT_EQ(0u, gfxCoreHelper.getPatIndex(CacheRegion::defaultRegion, CachePolicy::writeThrough)); - EXPECT_EQ(0u, gfxCoreHelper.getPatIndex(CacheRegion::defaultRegion, CachePolicy::writeBack)); + EXPECT_EQ(0u, productHelper.getPatIndex(CacheRegion::defaultRegion, CachePolicy::uncached)); + EXPECT_EQ(0u, productHelper.getPatIndex(CacheRegion::defaultRegion, CachePolicy::writeCombined)); + EXPECT_EQ(0u, productHelper.getPatIndex(CacheRegion::defaultRegion, CachePolicy::writeThrough)); + EXPECT_EQ(0u, productHelper.getPatIndex(CacheRegion::defaultRegion, CachePolicy::writeBack)); - EXPECT_EQ(0u, gfxCoreHelper.getPatIndex(CacheRegion::region1, CachePolicy::uncached)); - EXPECT_EQ(0u, gfxCoreHelper.getPatIndex(CacheRegion::region1, CachePolicy::writeCombined)); - EXPECT_EQ(0u, gfxCoreHelper.getPatIndex(CacheRegion::region1, CachePolicy::writeThrough)); - EXPECT_EQ(0u, gfxCoreHelper.getPatIndex(CacheRegion::region1, CachePolicy::writeBack)); + EXPECT_EQ(0u, productHelper.getPatIndex(CacheRegion::region1, CachePolicy::uncached)); + EXPECT_EQ(0u, productHelper.getPatIndex(CacheRegion::region1, CachePolicy::writeCombined)); + EXPECT_EQ(0u, productHelper.getPatIndex(CacheRegion::region1, CachePolicy::writeThrough)); + EXPECT_EQ(0u, productHelper.getPatIndex(CacheRegion::region1, CachePolicy::writeBack)); - EXPECT_EQ(0u, gfxCoreHelper.getPatIndex(CacheRegion::region2, CachePolicy::uncached)); - EXPECT_EQ(0u, gfxCoreHelper.getPatIndex(CacheRegion::region2, CachePolicy::writeCombined)); - EXPECT_EQ(0u, gfxCoreHelper.getPatIndex(CacheRegion::region2, CachePolicy::writeThrough)); - EXPECT_EQ(0u, gfxCoreHelper.getPatIndex(CacheRegion::region2, CachePolicy::writeBack)); + EXPECT_EQ(0u, productHelper.getPatIndex(CacheRegion::region2, CachePolicy::uncached)); + EXPECT_EQ(0u, productHelper.getPatIndex(CacheRegion::region2, CachePolicy::writeCombined)); + EXPECT_EQ(0u, productHelper.getPatIndex(CacheRegion::region2, CachePolicy::writeThrough)); + EXPECT_EQ(0u, productHelper.getPatIndex(CacheRegion::region2, CachePolicy::writeBack)); } } diff --git a/shared/test/unit_test/os_interface/product_helper_tests.cpp b/shared/test/unit_test/os_interface/product_helper_tests.cpp index 36528fa6e1..1aa29c90ab 100644 --- a/shared/test/unit_test/os_interface/product_helper_tests.cpp +++ b/shared/test/unit_test/os_interface/product_helper_tests.cpp @@ -611,6 +611,10 @@ HWTEST_F(ProductHelperTest, givenSamplerStateWhenAdjustSamplerStateThenNothingIs EXPECT_EQ(0, memcmp(&initialState, &state, sizeof(SAMPLER_STATE))); } +HWTEST_F(ProductHelperTest, whenGettingNumberOfCacheRegionsThenReturnZero) { + EXPECT_EQ(0u, productHelper->getNumCacheRegions()); +} + HWTEST2_F(ProductHelperTest, WhenFillingScmPropertiesSupportThenExpectUseCorrectGetters, IsAtLeastGen12lp) { StateComputeModePropertiesSupport scmPropertiesSupport = {}; diff --git a/shared/test/unit_test/xe_hpc_core/excludes_xe_hpc_core.cpp b/shared/test/unit_test/xe_hpc_core/excludes_xe_hpc_core.cpp index 39ec943a14..ee08861826 100644 --- a/shared/test/unit_test/xe_hpc_core/excludes_xe_hpc_core.cpp +++ b/shared/test/unit_test/xe_hpc_core/excludes_xe_hpc_core.cpp @@ -12,7 +12,7 @@ HWTEST_EXCLUDE_PRODUCT(CommandEncodeStatesTest, givenOverrideSlmTotalSizeDebugVa HWTEST_EXCLUDE_PRODUCT(WalkerPartitionTests, givenMiAtomicWhenItIsProgrammedThenAllFieldsAreSetCorrectly, IGFX_XE_HPC_CORE); HWTEST_EXCLUDE_PRODUCT(WalkerPartitionTests, givenProgramBatchBufferStartCommandWhenItIsCalledThenCommandIsProgrammedCorrectly, IGFX_XE_HPC_CORE); HWTEST_EXCLUDE_PRODUCT(GfxCoreHelperTest, givenDefaultGfxCoreHelperHwWhenMinimalSIMDSizeIsQueriedThen8IsReturned, IGFX_XE_HPC_CORE); -HWTEST_EXCLUDE_PRODUCT(GfxCoreHelperTest, whenGettingNumberOfCacheRegionsThenReturnZero, IGFX_XE_HPC_CORE); +HWTEST_EXCLUDE_PRODUCT(ProductHelperTest, whenGettingNumberOfCacheRegionsThenReturnZero, IGFX_XE_HPC_CORE); HWTEST_EXCLUDE_PRODUCT(PipeControlHelperTests, givenGfxCoreHelperwhenAskingForDcFlushThenReturnTrue, IGFX_XE_HPC_CORE); HWTEST_EXCLUDE_PRODUCT(XeHPAndLaterPreemptionTests, GivenDebuggerUsedWhenProgrammingStateSipThenStateSipIsAdded, IGFX_XE_HPC_CORE); HWTEST_EXCLUDE_PRODUCT(ComputeModeRequirements, givenComputeModeProgrammingWhenLargeGrfModeDoesntChangeThenSCMIsNotAdded, IGFX_XE_HPC_CORE);