Skip to content

Commit 424cda5

Browse files
committed
fix sub-sub-device index
Signed-off-by: Sergey V Maslov <sergey.v.maslov@intel.com>
1 parent f35220a commit 424cda5

File tree

1 file changed

+23
-26
lines changed

1 file changed

+23
-26
lines changed

sycl/plugins/level_zero/pi_level_zero.cpp

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -732,14 +732,13 @@ pi_result _pi_device::initialize(int SubSubDeviceOrdinal,
732732
}
733733
}
734734

735-
// Reinitialize a sub-sub-device with its own ordinal, index and numQueues
735+
// Reinitialize a sub-sub-device with its own ordinal, index.
736736
// Our sub-sub-device representation is currently [Level-Zero sub-device
737-
// handle + Level-Zero compute group/engine index]. As we have a single queue
738-
// per device, we need to reinitialize numQueues in ZeProperties to be 1.
737+
// handle + Level-Zero compute group/engine index]. Only the specified
738+
// index queue will be used to submit work to the sub-sub-device.
739739
if (SubSubDeviceOrdinal >= 0) {
740740
QueueGroup[queue_group_info_t::Compute].ZeOrdinal = SubSubDeviceOrdinal;
741741
QueueGroup[queue_group_info_t::Compute].ZeIndex = SubSubDeviceIndex;
742-
QueueGroup[queue_group_info_t::Compute].ZeProperties.numQueues = 1;
743742
} else { // Proceed with initialization for root and sub-device
744743
// How is it possible that there are no "compute" capabilities?
745744
if (QueueGroup[queue_group_info_t::Compute].ZeOrdinal < 0) {
@@ -1156,32 +1155,30 @@ _pi_queue::_pi_queue(std::vector<ze_command_queue_handle_t> &ComputeQueues,
11561155
// First, see if the queue's device allows for round-robin or it is
11571156
// fixed to one particular compute CCS (it is so for sub-sub-devices).
11581157
auto &ComputeQueueGroupInfo = Device->QueueGroup[queue_type::Compute];
1158+
ComputeQueueGroup.ZeQueues = ComputeQueues;
11591159
if (ComputeQueueGroupInfo.ZeIndex >= 0) {
11601160
ComputeQueueGroup.LowerIndex = ComputeQueueGroupInfo.ZeIndex;
11611161
ComputeQueueGroup.UpperIndex = ComputeQueueGroupInfo.ZeIndex;
11621162
ComputeQueueGroup.NextIndex = ComputeQueueGroupInfo.ZeIndex;
11631163
} else {
1164-
ComputeQueueGroup.LowerIndex = 0;
1165-
ComputeQueueGroup.UpperIndex = INT_MAX;
1166-
ComputeQueueGroup.NextIndex = 0;
1167-
}
1168-
1169-
uint32_t FilterLowerIndex = getRangeOfAllowedComputeEngines.first;
1170-
uint32_t FilterUpperIndex = getRangeOfAllowedComputeEngines.second;
1171-
FilterUpperIndex =
1172-
std::min((size_t)FilterUpperIndex, ComputeQueues.size() - 1);
1173-
if (FilterLowerIndex <= FilterUpperIndex) {
1174-
ComputeQueueGroup.ZeQueues = ComputeQueues;
1175-
ComputeQueueGroup.LowerIndex = FilterLowerIndex;
1176-
ComputeQueueGroup.UpperIndex = FilterUpperIndex;
1177-
ComputeQueueGroup.NextIndex = ComputeQueueGroup.LowerIndex;
1178-
// Create space to hold immediate commandlists corresponding to the ZeQueues
1179-
if (UseImmediateCommandLists) {
1180-
ComputeQueueGroup.ImmCmdLists = std::vector<pi_command_list_ptr_t>(
1181-
ComputeQueueGroup.ZeQueues.size(), CommandListMap.end());
1164+
// Set-up to round-robin across allowed range of engines.
1165+
uint32_t FilterLowerIndex = getRangeOfAllowedComputeEngines.first;
1166+
uint32_t FilterUpperIndex = getRangeOfAllowedComputeEngines.second;
1167+
FilterUpperIndex = std::min((size_t)FilterUpperIndex,
1168+
FilterLowerIndex + ComputeQueues.size() - 1);
1169+
if (FilterLowerIndex <= FilterUpperIndex) {
1170+
ComputeQueueGroup.LowerIndex = FilterLowerIndex;
1171+
ComputeQueueGroup.UpperIndex = FilterUpperIndex;
1172+
ComputeQueueGroup.NextIndex = ComputeQueueGroup.LowerIndex;
1173+
// Create space to hold immediate commandlists corresponding to the
1174+
// ZeQueues
1175+
if (UseImmediateCommandLists) {
1176+
ComputeQueueGroup.ImmCmdLists = std::vector<pi_command_list_ptr_t>(
1177+
ComputeQueueGroup.ZeQueues.size(), CommandListMap.end());
1178+
}
1179+
} else {
1180+
die("No compute queue available/allowed.");
11821181
}
1183-
} else {
1184-
die("No compute queue available.");
11851182
}
11861183

11871184
// Copy group initialization.
@@ -1192,8 +1189,8 @@ _pi_queue::_pi_queue(std::vector<ze_command_queue_handle_t> &ComputeQueues,
11921189
} else {
11931190
uint32_t FilterLowerIndex = getRangeOfAllowedCopyEngines.first;
11941191
uint32_t FilterUpperIndex = getRangeOfAllowedCopyEngines.second;
1195-
FilterUpperIndex =
1196-
std::min((size_t)FilterUpperIndex, CopyQueues.size() - 1);
1192+
FilterUpperIndex = std::min((size_t)FilterUpperIndex,
1193+
FilterLowerIndex + CopyQueues.size() - 1);
11971194
if (FilterLowerIndex <= FilterUpperIndex) {
11981195
CopyQueueGroup.ZeQueues = CopyQueues;
11991196
CopyQueueGroup.LowerIndex = FilterLowerIndex;

0 commit comments

Comments
 (0)