diff --git a/shared/source/os_interface/windows/wddm_memory_manager.cpp b/shared/source/os_interface/windows/wddm_memory_manager.cpp index 0150b1bfe8..9e7c929770 100644 --- a/shared/source/os_interface/windows/wddm_memory_manager.cpp +++ b/shared/source/os_interface/windows/wddm_memory_manager.cpp @@ -199,7 +199,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemory64kb(const Allocati } GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryUsingKmdAndMapItToCpuVA(const AllocationData &allocationData, bool allowLargePages) { - if (allocationData.alignment != MemoryConstants::pageSize64k) { + if (allocationData.alignment < MemoryConstants::pageSize64k) { allowLargePages = false; } @@ -271,7 +271,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryUsingKmdAndMapItToC if (alignGpuAddressTo64KB) { void *tempCPUPtr = cpuPtr; - cpuPtr = alignUp(cpuPtr, MemoryConstants::pageSize64k); + cpuPtr = alignUp(cpuPtr, std::max(allocationData.alignment, MemoryConstants::pageSize64k)); wddmAllocation->setGpuAddress(wddmAllocation->getGpuAddress() + ptrDiff(cpuPtr, tempCPUPtr)); } } diff --git a/shared/source/xe2_hpg_core/bmg/os_agnostic_product_helper_bmg.inl b/shared/source/xe2_hpg_core/bmg/os_agnostic_product_helper_bmg.inl index 63a41a5925..70eab7b9d1 100644 --- a/shared/source/xe2_hpg_core/bmg/os_agnostic_product_helper_bmg.inl +++ b/shared/source/xe2_hpg_core/bmg/os_agnostic_product_helper_bmg.inl @@ -30,6 +30,17 @@ std::optional ProductHelperHw::getAubStre return aub_stream::ProductFamily::Bmg; }; +template <> +std::optional ProductHelperHw::getPreferredAllocationMethod(AllocationType allocationType) const { + switch (allocationType) { + case AllocationType::tagBuffer: + case AllocationType::timestampPacketTagBuffer: + return {}; + default: + return GfxMemoryAllocationMethod::allocateByKmd; + } +} + template <> void ProductHelperHw::adjustNumberOfCcs(HardwareInfo &hwInfo) const { hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 1; diff --git a/shared/test/unit_test/xe2_hpg_core/bmg/excludes_xe2_hpg_core_bmg.cpp b/shared/test/unit_test/xe2_hpg_core/bmg/excludes_xe2_hpg_core_bmg.cpp index d7948edf7d..664cee9aa0 100644 --- a/shared/test/unit_test/xe2_hpg_core/bmg/excludes_xe2_hpg_core_bmg.cpp +++ b/shared/test/unit_test/xe2_hpg_core/bmg/excludes_xe2_hpg_core_bmg.cpp @@ -6,3 +6,5 @@ */ #include "shared/test/common/test_macros/hw_test_base.h" + +HWTEST_EXCLUDE_PRODUCT(ProductHelperTest, whenGettingPreferredAllocationMethodThenNoPreferenceIsReturned, IGFX_BMG); \ No newline at end of file diff --git a/shared/test/unit_test/xe2_hpg_core/bmg/product_helper_tests_bmg.cpp b/shared/test/unit_test/xe2_hpg_core/bmg/product_helper_tests_bmg.cpp index 8261c22868..9fac7611a1 100644 --- a/shared/test/unit_test/xe2_hpg_core/bmg/product_helper_tests_bmg.cpp +++ b/shared/test/unit_test/xe2_hpg_core/bmg/product_helper_tests_bmg.cpp @@ -7,6 +7,7 @@ #include "shared/source/command_stream/stream_properties.h" #include "shared/source/helpers/compiler_product_helper.h" +#include "shared/source/memory_manager/allocation_type.h" #include "shared/source/os_interface/product_helper.h" #include "shared/source/xe2_hpg_core/hw_cmds_bmg.h" #include "shared/source/xe2_hpg_core/hw_info_xe2_hpg_core.h" @@ -68,6 +69,20 @@ BMGTEST_F(BmgProductHelper, givenProductHelperWhenGetCommandsStreamPropertiesSup EXPECT_FALSE(productHelper->getPipelineSelectPropertySystolicModeSupport()); } +BMGTEST_F(BmgProductHelper, whenCheckPreferredAllocationMethodThenAllocateByKmdIsReturnedExceptTagBufferAndTimestampPacketTagBuffer) { + for (auto i = 0; i < static_cast(AllocationType::count); i++) { + auto allocationType = static_cast(i); + auto preferredAllocationMethod = productHelper->getPreferredAllocationMethod(allocationType); + if (allocationType == AllocationType::tagBuffer || + allocationType == AllocationType::timestampPacketTagBuffer) { + EXPECT_FALSE(preferredAllocationMethod.has_value()); + } else { + EXPECT_TRUE(preferredAllocationMethod.has_value()); + EXPECT_EQ(GfxMemoryAllocationMethod::allocateByKmd, preferredAllocationMethod.value()); + } + } +} + BMGTEST_F(BmgProductHelper, WhenFillingScmPropertiesSupportThenExpectUseCorrectExtraGetters) { StateComputeModePropertiesSupport scmPropertiesSupport = {};