Skip to content

Commit 94f3e54

Browse files
Move semaphore to local memory on XE_HPG
Signed-off-by: Lukasz Jobczyk <[email protected]>
1 parent 61b2ee4 commit 94f3e54

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

shared/source/helpers/extra_allocation_data_xehp_and_later.inl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ void HwHelperHw<Family>::setExtraAllocationData(AllocationData &allocationData,
2828
allocationData.flags.requiresCpuAccess = false;
2929
allocationData.storageInfo.isLockable = false;
3030
}
31+
} else if (hwInfo.featureTable.flags.ftrLocalMemory &&
32+
(properties.allocationType == AllocationType::COMMAND_BUFFER ||
33+
properties.allocationType == AllocationType::RING_BUFFER ||
34+
properties.allocationType == AllocationType::SEMAPHORE_BUFFER)) {
35+
allocationData.flags.useSystemMemory = false;
36+
allocationData.flags.requiresCpuAccess = true;
3137
}
3238

3339
if (hwInfoConfig.allowStatelessCompression(hwInfo)) {

shared/test/unit_test/xe_hpg_core/hw_helper_tests_xe_hpg_core.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,30 @@ XE_HPG_CORETEST_F(LriHelperTestsXeHpgCore, whenProgrammingLriCommandThenExpectMm
8989
EXPECT_TRUE(memcmp(lri, &expectedLri, sizeof(MI_LOAD_REGISTER_IMM)) == 0);
9090
}
9191

92+
XE_HPG_CORETEST_F(HwHelperTestXeHpgCore, givenAllocDataWhenSetExtraAllocationDataThenSetLocalMemForProperTypes) {
93+
auto &hwHelper = HwHelper::get(renderCoreFamily);
94+
95+
for (int type = 0; type < static_cast<int>(AllocationType::COUNT); type++) {
96+
AllocationProperties allocProperties(0, 1, static_cast<AllocationType>(type), {});
97+
AllocationData allocData{};
98+
allocData.flags.useSystemMemory = true;
99+
allocData.flags.requiresCpuAccess = false;
100+
101+
hwHelper.setExtraAllocationData(allocData, allocProperties, *defaultHwInfo);
102+
103+
if (defaultHwInfo->featureTable.flags.ftrLocalMemory &&
104+
(allocProperties.allocationType == AllocationType::COMMAND_BUFFER ||
105+
allocProperties.allocationType == AllocationType::RING_BUFFER ||
106+
allocProperties.allocationType == AllocationType::SEMAPHORE_BUFFER)) {
107+
EXPECT_FALSE(allocData.flags.useSystemMemory);
108+
EXPECT_TRUE(allocData.flags.requiresCpuAccess);
109+
} else {
110+
EXPECT_TRUE(allocData.flags.useSystemMemory);
111+
EXPECT_FALSE(allocData.flags.requiresCpuAccess);
112+
}
113+
}
114+
}
115+
92116
XE_HPG_CORETEST_F(HwHelperTestXeHpgCore, GivenVariousValuesWhenAlignSlmSizeIsCalledThenCorrectValueIsReturned) {
93117
EXPECT_EQ(0u, HwHelperHw<FamilyType>::get().alignSlmSize(0));
94118
EXPECT_EQ(1024u, HwHelperHw<FamilyType>::get().alignSlmSize(1));

0 commit comments

Comments
 (0)