@@ -684,20 +684,26 @@ pi_result _pi_device::initialize(int SubSubDeviceOrdinal,
684
684
ZE_CALL (zeDeviceGetCommandQueueGroupProperties,
685
685
(ZeDevice, &numQueueGroups, QueueGroupProperties.data ()));
686
686
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.
688
702
if (SubSubDeviceOrdinal >= 0 ) {
689
703
QueueGroup[queue_group_info_t ::Compute].ZeOrdinal = SubSubDeviceOrdinal;
690
704
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
701
707
// How is it possible that there are no "compute" capabilities?
702
708
if (QueueGroup[queue_group_info_t ::Compute].ZeOrdinal < 0 ) {
703
709
return PI_ERROR_UNKNOWN;
0 commit comments