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 d08c09162f..5c9634d0b3 100644 --- a/shared/source/helpers/extra_allocation_data_xehp_and_later.inl +++ b/shared/source/helpers/extra_allocation_data_xehp_and_later.inl @@ -28,6 +28,10 @@ void HwHelperHw::setExtraAllocationData(AllocationData &allocationData, allocationData.flags.requiresCpuAccess = false; allocationData.storageInfo.isLockable = false; } + } else if (hwInfo.featureTable.flags.ftrLocalMemory && + properties.allocationType == AllocationType::COMMAND_BUFFER) { + allocationData.flags.useSystemMemory = false; + allocationData.flags.requiresCpuAccess = true; } if (hwInfoConfig.allowStatelessCompression(hwInfo)) { 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 9b75ebf78b..3861fa2b1b 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 @@ -89,6 +89,28 @@ XE_HPG_CORETEST_F(LriHelperTestsXeHpgCore, whenProgrammingLriCommandThenExpectMm EXPECT_TRUE(memcmp(lri, &expectedLri, sizeof(MI_LOAD_REGISTER_IMM)) == 0); } +XE_HPG_CORETEST_F(HwHelperTestXeHpgCore, givenAllocDataWhenSetExtraAllocationDataThenSetLocalMemForProperTypes) { + auto &hwHelper = HwHelper::get(renderCoreFamily); + + 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; + + hwHelper.setExtraAllocationData(allocData, allocProperties, *defaultHwInfo); + + if (defaultHwInfo->featureTable.flags.ftrLocalMemory && + allocProperties.allocationType == AllocationType::COMMAND_BUFFER) { + EXPECT_FALSE(allocData.flags.useSystemMemory); + EXPECT_TRUE(allocData.flags.requiresCpuAccess); + } else { + EXPECT_TRUE(allocData.flags.useSystemMemory); + EXPECT_FALSE(allocData.flags.requiresCpuAccess); + } + } +} + XE_HPG_CORETEST_F(HwHelperTestXeHpgCore, GivenVariousValuesWhenAlignSlmSizeIsCalledThenCorrectValueIsReturned) { EXPECT_EQ(0u, HwHelperHw::get().alignSlmSize(0)); EXPECT_EQ(1024u, HwHelperHw::get().alignSlmSize(1));