fix(l0): adjust getCacheProperties

Use L3CacheSizeInKb value for cacheSize calculation

Resolves: NEO-7655
Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
Krzysztof Gibala 2023-01-24 10:11:10 +00:00 committed by Compute-Runtime-Automation
parent a3212f8362
commit 19c655076c
2 changed files with 25 additions and 1 deletions

View File

@ -910,7 +910,8 @@ ze_result_t DeviceImp::getCacheProperties(uint32_t *pCount, ze_device_cache_prop
}
const auto &hardwareInfo = this->getHwInfo();
pCacheProperties[0].cacheSize = hardwareInfo.gtSystemInfo.L3BankCount * 128 * KB;
uint32_t subDeviceCount = NEO::GfxCoreHelper::getSubDevicesCount(&hardwareInfo);
pCacheProperties[0].cacheSize = hardwareInfo.gtSystemInfo.L3CacheSizeInKb * subDeviceCount * KB;
pCacheProperties[0].flags = 0;
if (pCacheProperties->pNext) {

View File

@ -1058,6 +1058,29 @@ TEST_F(DeviceTest, givenDeviceCachePropertiesThenAllPropertiesAreAssigned) {
EXPECT_NE(deviceCacheProperties.cacheSize, deviceCachePropertiesBefore.cacheSize);
}
TEST_F(DeviceTest, givenDeviceWithSubDevicesWhenQueriedForCacheSizeThenValueIsMultiplied) {
ze_device_cache_properties_t deviceCacheProperties = {};
auto rootDeviceIndex = device->getNEODevice()->getRootDeviceIndex();
auto &hwInfo = *device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[rootDeviceIndex]->getMutableHardwareInfo();
auto singleRootDeviceCacheSize = hwInfo.gtSystemInfo.L3CacheSizeInKb * KB;
hwInfo.gtSystemInfo.L3BankCount = 0u;
hwInfo.gtSystemInfo.MultiTileArchInfo.IsValid = true;
uint32_t count = 0;
ze_result_t res = device->getCacheProperties(&count, nullptr);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
EXPECT_EQ(count, 1u);
for (uint32_t subDevicesCount : {1, 2, 3}) {
hwInfo.gtSystemInfo.MultiTileArchInfo.TileCount = subDevicesCount;
res = device->getCacheProperties(&count, &deviceCacheProperties);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
EXPECT_EQ(deviceCacheProperties.cacheSize, singleRootDeviceCacheSize * subDevicesCount);
}
}
TEST_F(DeviceTest, givenDevicePropertiesStructureWhenDevicePropertiesCalledThenAllPropertiesAreAssigned) {
ze_device_properties_t deviceProperties, devicePropertiesBefore;
deviceProperties = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES};