Skip to content

Commit 6e30f39

Browse files
Use sub-devices count when calculating globalMemCacheSize
Signed-off-by: Filip Hazubski <[email protected]>
1 parent 2ae883d commit 6e30f39

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

opencl/source/cl_device/cl_device_caps.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,8 @@ void ClDevice::initializeCaps() {
287287
//copy system info to prevent misaligned reads
288288
const auto systemInfo = hwInfo.gtSystemInfo;
289289

290-
deviceInfo.globalMemCacheSize = systemInfo.L3CacheSizeInKb * KB;
290+
const auto subDevicesCount = std::max(getNumGenericSubDevices(), 1u);
291+
deviceInfo.globalMemCacheSize = systemInfo.L3CacheSizeInKb * KB * subDevicesCount;
291292
deviceInfo.grfSize = hwInfo.capabilityTable.grfSize;
292293

293294
deviceInfo.globalMemCacheType = CL_READ_WRITE_CACHE;
@@ -302,7 +303,7 @@ void ClDevice::initializeCaps() {
302303

303304
deviceInfo.maxWorkItemDimensions = 3;
304305

305-
deviceInfo.maxComputUnits = systemInfo.EUCount * std::max(getNumGenericSubDevices(), 1u);
306+
deviceInfo.maxComputUnits = systemInfo.EUCount * subDevicesCount;
306307
if (device.isEngineInstanced()) {
307308
deviceInfo.maxComputUnits /= systemInfo.CCSInfo.NumberOfCCSEnabled;
308309
}

opencl/test/unit_test/device/device_caps_tests.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,3 +1545,17 @@ HWTEST_F(DeviceGetCapsTest, givenDSSCountEqualZeroWhenDeviceCreatedThenMaxEuPerD
15451545

15461546
EXPECT_EQ(device->sharedDeviceInfo.maxNumEUsPerSubSlice, device->sharedDeviceInfo.maxNumEUsPerDualSubSlice);
15471547
}
1548+
1549+
TEST_F(DeviceGetCapsTest, givenRootDeviceWithSubDevicesWhenQueriedForCacheSizeThenValueIsMultiplied) {
1550+
UltClDeviceFactory deviceFactory{1, 0};
1551+
auto singleRootDeviceCacheSize = deviceFactory.rootDevices[0]->deviceInfo.globalMemCacheSize;
1552+
1553+
for (uint32_t subDevicesCount : {2, 3, 4}) {
1554+
UltClDeviceFactory deviceFactory{1, subDevicesCount};
1555+
auto rootDeviceCacheSize = deviceFactory.rootDevices[0]->deviceInfo.globalMemCacheSize;
1556+
for (auto &subDevice : deviceFactory.rootDevices[0]->subDevices) {
1557+
EXPECT_EQ(singleRootDeviceCacheSize, subDevice->getDeviceInfo().globalMemCacheSize);
1558+
EXPECT_EQ(rootDeviceCacheSize, subDevice->getDeviceInfo().globalMemCacheSize * subDevicesCount);
1559+
}
1560+
}
1561+
}

0 commit comments

Comments
 (0)