Skip to content

Commit 895946d

Browse files
committed
Address more review comments
1 parent b7dd092 commit 895946d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

sycl/plugins/level_zero/pi_level_zero.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,19 +1089,20 @@ _pi_queue::getZeCopyCommandQueue(int *CopyQueueIndex,
10891089
int n = ZeCopyCommandQueues.size();
10901090
int LowerCopyQueueIndex = getRangeOfAllowedCopyEngines.first;
10911091
int UpperCopyQueueIndex = getRangeOfAllowedCopyEngines.second;
1092-
LowerCopyQueueIndex =
1093-
(LowerCopyQueueIndex == -1) ? -1 : std::max(0, LowerCopyQueueIndex);
1094-
UpperCopyQueueIndex = std::min(UpperCopyQueueIndex, n - 1);
10951092

10961093
// Return nullptr when no copy command queues are allowed to be used or if
10971094
// no copy command queues are available.
1098-
if ((LowerCopyQueueIndex > UpperCopyQueueIndex) || (n == 0)) {
1095+
if ((LowerCopyQueueIndex == -1) || (UpperCopyQueueIndex == -1) ||
1096+
(LowerCopyQueueIndex > UpperCopyQueueIndex) || (n == 0)) {
10991097
if (CopyQueueGroupIndex)
11001098
*CopyQueueGroupIndex = -1;
11011099
*CopyQueueIndex = -1;
11021100
return nullptr;
11031101
}
11041102

1103+
LowerCopyQueueIndex = std::max(0, LowerCopyQueueIndex);
1104+
UpperCopyQueueIndex = std::min(UpperCopyQueueIndex, n - 1);
1105+
11051106
// If there is only one copy queue, it is the main copy queue, which is the
11061107
// first, and only entry in ZeCopyCommandQueues.
11071108
if (n == 1) {

0 commit comments

Comments
 (0)