From 819908ec942b18bddbb5806d1e053c3923a5a3a3 Mon Sep 17 00:00:00 2001 From: Mateusz Jablonski Date: Wed, 30 Aug 2023 11:20:43 +0000 Subject: [PATCH] performance: allocate timestamp packet tag buffer in local mem on DG2 Signed-off-by: Mateusz Jablonski --- .../extra_allocation_data_xehp_and_later.inl | 1 + .../gfx_core_helper_tests_xe_hpg_core.cpp | 31 +++++++++++-------- 2 files changed, 19 insertions(+), 13 deletions(-) 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 d3d5a53f0e..f75b4162a8 100644 --- a/shared/source/helpers/extra_allocation_data_xehp_and_later.inl +++ b/shared/source/helpers/extra_allocation_data_xehp_and_later.inl @@ -37,6 +37,7 @@ void GfxCoreHelperHw::setExtraAllocationData(AllocationData &allocationD } else if (hwInfo.featureTable.flags.ftrLocalMemory && (properties.allocationType == AllocationType::COMMAND_BUFFER || properties.allocationType == AllocationType::RING_BUFFER || + properties.allocationType == AllocationType::TIMESTAMP_PACKET_TAG_BUFFER || properties.allocationType == AllocationType::SEMAPHORE_BUFFER)) { allocationData.flags.useSystemMemory = false; allocationData.flags.requiresCpuAccess = true; diff --git a/shared/test/unit_test/xe_hpg_core/gfx_core_helper_tests_xe_hpg_core.cpp b/shared/test/unit_test/xe_hpg_core/gfx_core_helper_tests_xe_hpg_core.cpp index 3d994d4f79..ba84245add 100644 --- a/shared/test/unit_test/xe_hpg_core/gfx_core_helper_tests_xe_hpg_core.cpp +++ b/shared/test/unit_test/xe_hpg_core/gfx_core_helper_tests_xe_hpg_core.cpp @@ -101,24 +101,29 @@ XE_HPG_CORETEST_F(LriHelperTestsXeHpgCore, whenProgrammingLriCommandThenExpectMm XE_HPG_CORETEST_F(GfxCoreHelperTestXeHpgCore, givenAllocDataWhenSetExtraAllocationDataThenSetLocalMemForProperTypes) { auto &gfxCoreHelper = getHelper(); - + DebugManagerStateRestore restore; + DebugManager.flags.ForceLocalMemoryAccessMode.set(0); for (int type = 0; type < static_cast(AllocationType::COUNT); type++) { AllocationProperties allocProperties(0, 1, static_cast(type), {}); AllocationData allocData{}; - allocData.flags.useSystemMemory = true; - allocData.flags.requiresCpuAccess = false; + for (auto &localMemSupport : ::testing::Bool()) { + allocData.flags.useSystemMemory = true; + allocData.flags.requiresCpuAccess = false; + pDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->featureTable.flags.ftrLocalMemory = localMemSupport; - gfxCoreHelper.setExtraAllocationData(allocData, allocProperties, pDevice->getRootDeviceEnvironment()); + gfxCoreHelper.setExtraAllocationData(allocData, allocProperties, pDevice->getRootDeviceEnvironment()); - if (defaultHwInfo->featureTable.flags.ftrLocalMemory && - (allocProperties.allocationType == AllocationType::COMMAND_BUFFER || - allocProperties.allocationType == AllocationType::RING_BUFFER || - allocProperties.allocationType == AllocationType::SEMAPHORE_BUFFER)) { - EXPECT_FALSE(allocData.flags.useSystemMemory); - EXPECT_TRUE(allocData.flags.requiresCpuAccess); - } else { - EXPECT_TRUE(allocData.flags.useSystemMemory); - EXPECT_FALSE(allocData.flags.requiresCpuAccess); + if (localMemSupport && + (allocProperties.allocationType == AllocationType::COMMAND_BUFFER || + allocProperties.allocationType == AllocationType::RING_BUFFER || + allocProperties.allocationType == AllocationType::TIMESTAMP_PACKET_TAG_BUFFER || + allocProperties.allocationType == AllocationType::SEMAPHORE_BUFFER)) { + EXPECT_FALSE(allocData.flags.useSystemMemory); + EXPECT_TRUE(allocData.flags.requiresCpuAccess); + } else { + EXPECT_TRUE(allocData.flags.useSystemMemory); + EXPECT_FALSE(allocData.flags.requiresCpuAccess); + } } } }