Skip to content

Commit ee29dc5

Browse files
Fix L0 device caps
Signed-off-by: Bartosz Dunajski <[email protected]>
1 parent 2c3a1bf commit ee29dc5

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

level_zero/core/source/device/device_imp.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -491,14 +491,14 @@ ze_result_t DeviceImp::getProperties(ze_device_properties_t *pDeviceProperties)
491491
if (NEO::DebugManager.flags.DebugApiUsed.get() == 1) {
492492
pDeviceProperties->numSubslicesPerSlice = hardwareInfo.gtSystemInfo.MaxSubSlicesSupported / hardwareInfo.gtSystemInfo.MaxSlicesSupported;
493493
} else {
494-
if (this->isMultiDeviceCapable() || (this->numSubDevices == 0)) {
495-
pDeviceProperties->numSubslicesPerSlice = hardwareInfo.gtSystemInfo.SubSliceCount / hardwareInfo.gtSystemInfo.SliceCount;
496-
} else {
497-
pDeviceProperties->numSubslicesPerSlice = hardwareInfo.gtSystemInfo.SubSliceCount / hardwareInfo.gtSystemInfo.SliceCount / this->numSubDevices;
498-
}
494+
pDeviceProperties->numSubslicesPerSlice = hardwareInfo.gtSystemInfo.SubSliceCount / hardwareInfo.gtSystemInfo.SliceCount;
499495
}
500496

501-
pDeviceProperties->numSlices = hardwareInfo.gtSystemInfo.SliceCount * std::max(this->neoDevice->getNumGenericSubDevices(), 1u);
497+
pDeviceProperties->numSlices = hardwareInfo.gtSystemInfo.SliceCount;
498+
499+
if (isMultiDeviceCapable()) {
500+
pDeviceProperties->numSlices *= neoDevice->getNumGenericSubDevices();
501+
}
502502

503503
if ((NEO::DebugManager.flags.UseCyclesPerSecondTimer.get() == 1) ||
504504
(pDeviceProperties->stype == ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES_1_2)) {

level_zero/core/test/unit_tests/sources/device/test_device.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,10 +1467,13 @@ TEST_F(MultipleDevicesDisabledImplicitScalingTest, GivenImplicitScalingDisabledW
14671467
device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.MaxSubSlicesSupported = 48;
14681468
device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.MaxSlicesSupported = 3;
14691469
device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.SubSliceCount = 8;
1470-
device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.SliceCount = 1;
1470+
device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.SliceCount = 2;
1471+
1472+
auto &gtSysInfo = device->getNEODevice()->getHardwareInfo().gtSystemInfo;
14711473

14721474
device->getProperties(&deviceProperties);
1473-
EXPECT_EQ(((device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.SubSliceCount * device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.SliceCount) / numSubDevices), deviceProperties.numSubslicesPerSlice);
1475+
EXPECT_EQ(((gtSysInfo.SubSliceCount / gtSysInfo.SliceCount)), deviceProperties.numSubslicesPerSlice);
1476+
EXPECT_EQ(gtSysInfo.SliceCount, deviceProperties.numSlices);
14741477
}
14751478

14761479
TEST_F(MultipleDevicesEnabledImplicitScalingTest, GivenImplicitScalingEnabledWhenGettingDevicePropertiesGetSubslicesPerSliceThenCorrectValuesReturned) {
@@ -1481,10 +1484,13 @@ TEST_F(MultipleDevicesEnabledImplicitScalingTest, GivenImplicitScalingEnabledWhe
14811484
device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.MaxSubSlicesSupported = 48;
14821485
device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.MaxSlicesSupported = 3;
14831486
device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.SubSliceCount = 8;
1484-
device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.SliceCount = 1;
1487+
device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.SliceCount = 2;
1488+
1489+
auto &gtSysInfo = device->getNEODevice()->getHardwareInfo().gtSystemInfo;
14851490

14861491
device->getProperties(&deviceProperties);
1487-
EXPECT_EQ((device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.SubSliceCount * device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.SliceCount), deviceProperties.numSubslicesPerSlice);
1492+
EXPECT_EQ((gtSysInfo.SubSliceCount / gtSysInfo.SliceCount), deviceProperties.numSubslicesPerSlice);
1493+
EXPECT_EQ((gtSysInfo.SliceCount * numSubDevices), deviceProperties.numSlices);
14881494
}
14891495

14901496
TEST_F(MultipleDevicesTest, whenRetrievingNumberOfSubdevicesThenCorrectNumberIsReturned) {
@@ -1731,7 +1737,7 @@ TEST_F(MultipleDevicesTest, givenTopologyForTwoSubdevicesWhenGettingApiSliceIdWi
17311737
NEO::TopologyMap map;
17321738
TopologyMapping mapping;
17331739

1734-
EXPECT_EQ(numSubDevices * hwInfo.gtSystemInfo.SliceCount, deviceProperties.numSlices);
1740+
EXPECT_EQ(hwInfo.gtSystemInfo.SliceCount, deviceProperties.numSlices);
17351741

17361742
mapping.sliceIndices.resize(hwInfo.gtSystemInfo.SliceCount);
17371743
for (uint32_t i = 0; i < hwInfo.gtSystemInfo.SliceCount; i++) {
@@ -1768,7 +1774,7 @@ TEST_F(MultipleDevicesTest, givenTopologyForSingleSubdeviceWhenGettingApiSliceId
17681774
NEO::TopologyMap map;
17691775
TopologyMapping mapping;
17701776

1771-
EXPECT_EQ(numSubDevices * hwInfo.gtSystemInfo.SliceCount, deviceProperties.numSlices);
1777+
EXPECT_EQ(hwInfo.gtSystemInfo.SliceCount, deviceProperties.numSlices);
17721778

17731779
mapping.sliceIndices.resize(hwInfo.gtSystemInfo.SliceCount);
17741780
for (uint32_t i = 0; i < hwInfo.gtSystemInfo.SliceCount; i++) {

0 commit comments

Comments
 (0)