Skip to content

Commit 70d945c

Browse files
Revert "[SYCL][L0] Report multiple CCS as SYCL sub-devices on a single tile machine" (#7083)
Reverts #6946 due to reported regressions
1 parent 77e92ce commit 70d945c

File tree

1 file changed

+19
-34
lines changed

1 file changed

+19
-34
lines changed

sycl/plugins/level_zero/pi_level_zero.cpp

Lines changed: 19 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2553,45 +2553,24 @@ pi_result _pi_platform::populateDeviceCacheIfNeeded() {
25532553
// Additionally we need to cache all sub-devices too, such that they
25542554
// are readily visible to the piextDeviceCreateWithNativeHandle.
25552555
//
2556-
std::vector<pi_device> PiSubDevices;
25572556
pi_uint32 SubDevicesCount = 0;
25582557
ZE_CALL(zeDeviceGetSubDevices,
25592558
(Device->ZeDevice, &SubDevicesCount, nullptr));
25602559

2561-
if (SubDevicesCount) {
2562-
auto ZeSubdevices = new ze_device_handle_t[SubDevicesCount];
2563-
ZE_CALL(zeDeviceGetSubDevices,
2564-
(Device->ZeDevice, &SubDevicesCount, ZeSubdevices));
2565-
2566-
// Wrap the Level Zero sub-devices into PI sub-devices
2567-
// and add them to cache.
2568-
for (uint32_t I = 0; I < SubDevicesCount; ++I) {
2569-
std::unique_ptr<_pi_device> PiSubDevice(
2570-
new _pi_device(ZeSubdevices[I], this, Device.get()));
2571-
pi_result Result = PiSubDevice->initialize();
2572-
if (Result != PI_SUCCESS) {
2573-
delete[] ZeSubdevices;
2574-
return Result;
2575-
}
2576-
// save pointers to sub-devices for quick retrieval in the future.
2577-
Device->SubDevices.push_back(PiSubDevice.get());
2578-
PiDevicesCache.push_back(std::move(PiSubDevice));
2579-
}
2580-
delete[] ZeSubdevices;
2581-
PiSubDevices = Device->SubDevices;
2582-
} else {
2583-
// Level Zero will not report the sub-device on a single tile
2584-
// machine, but we still want that to be partitionable into
2585-
// multiple CCS-s. In this case the loop below will find out
2586-
// the CCS-s and report them as sub-devices of the root
2587-
// device.
2588-
SubDevicesCount = 1;
2589-
PiSubDevices.push_back(Device.get());
2590-
}
2560+
auto ZeSubdevices = new ze_device_handle_t[SubDevicesCount];
2561+
ZE_CALL(zeDeviceGetSubDevices,
2562+
(Device->ZeDevice, &SubDevicesCount, ZeSubdevices));
25912563

2592-
// Find out CCCs.
2564+
// Wrap the Level Zero sub-devices into PI sub-devices, and add them to
2565+
// cache.
25932566
for (uint32_t I = 0; I < SubDevicesCount; ++I) {
2594-
auto PiSubDevice = PiSubDevices[I];
2567+
std::unique_ptr<_pi_device> PiSubDevice(
2568+
new _pi_device(ZeSubdevices[I], this, Device.get()));
2569+
pi_result Result = PiSubDevice->initialize();
2570+
if (Result != PI_SUCCESS) {
2571+
delete[] ZeSubdevices;
2572+
return Result;
2573+
}
25952574

25962575
// collect all the ordinals for the sub-sub-devices
25972576
std::vector<int> Ordinals;
@@ -2628,7 +2607,7 @@ pi_result _pi_platform::populateDeviceCacheIfNeeded() {
26282607
for (uint32_t K = 0; K < QueueGroupProperties[Ordinals[J]].numQueues;
26292608
++K) {
26302609
std::unique_ptr<_pi_device> PiSubSubDevice(
2631-
new _pi_device(PiSubDevice->ZeDevice, this, PiSubDevice));
2610+
new _pi_device(ZeSubdevices[I], this, PiSubDevice.get()));
26322611
pi_result Result = PiSubSubDevice->initialize(Ordinals[J], K);
26332612
if (Result != PI_SUCCESS) {
26342613
return Result;
@@ -2640,7 +2619,13 @@ pi_result _pi_platform::populateDeviceCacheIfNeeded() {
26402619
PiDevicesCache.push_back(std::move(PiSubSubDevice));
26412620
}
26422621
}
2622+
2623+
// save pointers to sub-devices for quick retrieval in the future.
2624+
Device->SubDevices.push_back(PiSubDevice.get());
2625+
PiDevicesCache.push_back(std::move(PiSubDevice));
26432626
}
2627+
delete[] ZeSubdevices;
2628+
26442629
// Save the root device in the cache for future uses.
26452630
PiDevicesCache.push_back(std::move(Device));
26462631
}

0 commit comments

Comments
 (0)