Skip to content

Commit 6a44253

Browse files
committed
Address more review comments
1 parent 119f8e2 commit 6a44253

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
@@ -69,13 +69,13 @@ static const bool UseCopyEngineForD2DCopy = [] {
6969
// the copy engines will not be used at all. A value of 1 indicates that all
7070
// available copy engines can be used.
7171
static const std::pair<int, int> getRangeOfAllowedCopyEngines = [] {
72-
std::string CopyEngineRange =
73-
std::getenv("SYCL_PI_LEVEL_ZERO_USE_COPY_ENGINE");
72+
const char *EnvVar = std::getenv("SYCL_PI_LEVEL_ZERO_USE_COPY_ENGINE");
7473
// If the environment variable is not set, all available copy engines can be
7574
// used.
76-
if (CopyEngineRange.empty()) {
75+
if (!EnvVar) {
7776
return std::pair<int, int>(0, INT_MAX);
7877
}
78+
std::string CopyEngineRange = EnvVar;
7979
// Environment variable can be a single integer or a pair of integers
8080
// separated by ":"
8181
auto pos = CopyEngineRange.find(":");
@@ -1089,7 +1089,8 @@ _pi_queue::getZeCopyCommandQueue(int *CopyQueueIndex,
10891089
int n = ZeCopyCommandQueues.size();
10901090
int LowerCopyQueueIndex = getRangeOfAllowedCopyEngines.first;
10911091
int UpperCopyQueueIndex = getRangeOfAllowedCopyEngines.second;
1092-
LowerCopyQueueIndex = std::max(0, LowerCopyQueueIndex);
1092+
LowerCopyQueueIndex =
1093+
(LowerCopyQueueIndex == -1) ? -1 : std::max(0, LowerCopyQueueIndex);
10931094
UpperCopyQueueIndex = std::min(UpperCopyQueueIndex, n - 1);
10941095

10951096
// Return nullptr when no copy command queues are allowed to be used or if

0 commit comments

Comments
 (0)