From ee29dc5c13554e4230f2ff4a502462b65092191d Mon Sep 17 00:00:00 2001 From: Bartosz Dunajski Date: Fri, 26 Nov 2021 12:45:37 +0000 Subject: [PATCH] Fix L0 device caps Signed-off-by: Bartosz Dunajski --- level_zero/core/source/device/device_imp.cpp | 12 ++++++------ .../unit_tests/sources/device/test_device.cpp | 18 ++++++++++++------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/level_zero/core/source/device/device_imp.cpp b/level_zero/core/source/device/device_imp.cpp index 074e9c9a19..cdae51a804 100644 --- a/level_zero/core/source/device/device_imp.cpp +++ b/level_zero/core/source/device/device_imp.cpp @@ -491,14 +491,14 @@ ze_result_t DeviceImp::getProperties(ze_device_properties_t *pDeviceProperties) if (NEO::DebugManager.flags.DebugApiUsed.get() == 1) { pDeviceProperties->numSubslicesPerSlice = hardwareInfo.gtSystemInfo.MaxSubSlicesSupported / hardwareInfo.gtSystemInfo.MaxSlicesSupported; } else { - if (this->isMultiDeviceCapable() || (this->numSubDevices == 0)) { - pDeviceProperties->numSubslicesPerSlice = hardwareInfo.gtSystemInfo.SubSliceCount / hardwareInfo.gtSystemInfo.SliceCount; - } else { - pDeviceProperties->numSubslicesPerSlice = hardwareInfo.gtSystemInfo.SubSliceCount / hardwareInfo.gtSystemInfo.SliceCount / this->numSubDevices; - } + pDeviceProperties->numSubslicesPerSlice = hardwareInfo.gtSystemInfo.SubSliceCount / hardwareInfo.gtSystemInfo.SliceCount; } - pDeviceProperties->numSlices = hardwareInfo.gtSystemInfo.SliceCount * std::max(this->neoDevice->getNumGenericSubDevices(), 1u); + pDeviceProperties->numSlices = hardwareInfo.gtSystemInfo.SliceCount; + + if (isMultiDeviceCapable()) { + pDeviceProperties->numSlices *= neoDevice->getNumGenericSubDevices(); + } if ((NEO::DebugManager.flags.UseCyclesPerSecondTimer.get() == 1) || (pDeviceProperties->stype == ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES_1_2)) { diff --git a/level_zero/core/test/unit_tests/sources/device/test_device.cpp b/level_zero/core/test/unit_tests/sources/device/test_device.cpp index da20cf0253..05e577c352 100644 --- a/level_zero/core/test/unit_tests/sources/device/test_device.cpp +++ b/level_zero/core/test/unit_tests/sources/device/test_device.cpp @@ -1467,10 +1467,13 @@ TEST_F(MultipleDevicesDisabledImplicitScalingTest, GivenImplicitScalingDisabledW device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.MaxSubSlicesSupported = 48; device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.MaxSlicesSupported = 3; device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.SubSliceCount = 8; - device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.SliceCount = 1; + device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.SliceCount = 2; + + auto >SysInfo = device->getNEODevice()->getHardwareInfo().gtSystemInfo; device->getProperties(&deviceProperties); - EXPECT_EQ(((device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.SubSliceCount * device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.SliceCount) / numSubDevices), deviceProperties.numSubslicesPerSlice); + EXPECT_EQ(((gtSysInfo.SubSliceCount / gtSysInfo.SliceCount)), deviceProperties.numSubslicesPerSlice); + EXPECT_EQ(gtSysInfo.SliceCount, deviceProperties.numSlices); } TEST_F(MultipleDevicesEnabledImplicitScalingTest, GivenImplicitScalingEnabledWhenGettingDevicePropertiesGetSubslicesPerSliceThenCorrectValuesReturned) { @@ -1481,10 +1484,13 @@ TEST_F(MultipleDevicesEnabledImplicitScalingTest, GivenImplicitScalingEnabledWhe device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.MaxSubSlicesSupported = 48; device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.MaxSlicesSupported = 3; device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.SubSliceCount = 8; - device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.SliceCount = 1; + device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.SliceCount = 2; + + auto >SysInfo = device->getNEODevice()->getHardwareInfo().gtSystemInfo; device->getProperties(&deviceProperties); - EXPECT_EQ((device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.SubSliceCount * device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.SliceCount), deviceProperties.numSubslicesPerSlice); + EXPECT_EQ((gtSysInfo.SubSliceCount / gtSysInfo.SliceCount), deviceProperties.numSubslicesPerSlice); + EXPECT_EQ((gtSysInfo.SliceCount * numSubDevices), deviceProperties.numSlices); } TEST_F(MultipleDevicesTest, whenRetrievingNumberOfSubdevicesThenCorrectNumberIsReturned) { @@ -1731,7 +1737,7 @@ TEST_F(MultipleDevicesTest, givenTopologyForTwoSubdevicesWhenGettingApiSliceIdWi NEO::TopologyMap map; TopologyMapping mapping; - EXPECT_EQ(numSubDevices * hwInfo.gtSystemInfo.SliceCount, deviceProperties.numSlices); + EXPECT_EQ(hwInfo.gtSystemInfo.SliceCount, deviceProperties.numSlices); mapping.sliceIndices.resize(hwInfo.gtSystemInfo.SliceCount); for (uint32_t i = 0; i < hwInfo.gtSystemInfo.SliceCount; i++) { @@ -1768,7 +1774,7 @@ TEST_F(MultipleDevicesTest, givenTopologyForSingleSubdeviceWhenGettingApiSliceId NEO::TopologyMap map; TopologyMapping mapping; - EXPECT_EQ(numSubDevices * hwInfo.gtSystemInfo.SliceCount, deviceProperties.numSlices); + EXPECT_EQ(hwInfo.gtSystemInfo.SliceCount, deviceProperties.numSlices); mapping.sliceIndices.resize(hwInfo.gtSystemInfo.SliceCount); for (uint32_t i = 0; i < hwInfo.gtSystemInfo.SliceCount; i++) {