Skip to content

Commit 4b1b01b

Browse files
authored
[SYCL] Fix issue with sub-sub-device in plugin (#6349)
Signed-off-by: Arvind Sudarsanam <arvind.sudarsanam@intel.com>
1 parent 8a4777d commit 4b1b01b

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

sycl/plugins/level_zero/pi_level_zero.cpp

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -684,20 +684,26 @@ pi_result _pi_device::initialize(int SubSubDeviceOrdinal,
684684
ZE_CALL(zeDeviceGetCommandQueueGroupProperties,
685685
(ZeDevice, &numQueueGroups, QueueGroupProperties.data()));
686686

687-
// Initialize a sub-sub-device with its own ordinal and index
687+
// Initialize ordinal and compute queue group properties
688+
for (uint32_t i = 0; i < numQueueGroups; i++) {
689+
if (QueueGroupProperties[i].flags &
690+
ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE) {
691+
QueueGroup[queue_group_info_t::Compute].ZeOrdinal = i;
692+
QueueGroup[queue_group_info_t::Compute].ZeProperties =
693+
QueueGroupProperties[i];
694+
break;
695+
}
696+
}
697+
698+
// Reinitialize a sub-sub-device with its own ordinal, index and numQueues
699+
// Our sub-sub-device representation is currently [Level-Zero sub-device
700+
// handle + Level-Zero compute group/engine index]. As we have a single queue
701+
// per device, we need to reinitialize numQueues in ZeProperties to be 1.
688702
if (SubSubDeviceOrdinal >= 0) {
689703
QueueGroup[queue_group_info_t::Compute].ZeOrdinal = SubSubDeviceOrdinal;
690704
QueueGroup[queue_group_info_t::Compute].ZeIndex = SubSubDeviceIndex;
691-
} else { // This is a root or a sub-device
692-
for (uint32_t i = 0; i < numQueueGroups; i++) {
693-
if (QueueGroupProperties[i].flags &
694-
ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE) {
695-
QueueGroup[queue_group_info_t::Compute].ZeOrdinal = i;
696-
QueueGroup[queue_group_info_t::Compute].ZeProperties =
697-
QueueGroupProperties[i];
698-
break;
699-
}
700-
}
705+
QueueGroup[queue_group_info_t::Compute].ZeProperties.numQueues = 1;
706+
} else { // Proceed with initialization for root and sub-device
701707
// How is it possible that there are no "compute" capabilities?
702708
if (QueueGroup[queue_group_info_t::Compute].ZeOrdinal < 0) {
703709
return PI_ERROR_UNKNOWN;

0 commit comments

Comments
 (0)