@@ -69,13 +69,13 @@ static const bool UseCopyEngineForD2DCopy = [] {
69
69
// the copy engines will not be used at all. A value of 1 indicates that all
70
70
// available copy engines can be used.
71
71
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" );
74
73
// If the environment variable is not set, all available copy engines can be
75
74
// used.
76
- if (CopyEngineRange. empty () ) {
75
+ if (!EnvVar ) {
77
76
return std::pair<int , int >(0 , INT_MAX);
78
77
}
78
+ std::string CopyEngineRange = EnvVar;
79
79
// Environment variable can be a single integer or a pair of integers
80
80
// separated by ":"
81
81
auto pos = CopyEngineRange.find (" :" );
@@ -1089,7 +1089,8 @@ _pi_queue::getZeCopyCommandQueue(int *CopyQueueIndex,
1089
1089
int n = ZeCopyCommandQueues.size ();
1090
1090
int LowerCopyQueueIndex = getRangeOfAllowedCopyEngines.first ;
1091
1091
int UpperCopyQueueIndex = getRangeOfAllowedCopyEngines.second ;
1092
- LowerCopyQueueIndex = std::max (0 , LowerCopyQueueIndex);
1092
+ LowerCopyQueueIndex =
1093
+ (LowerCopyQueueIndex == -1 ) ? -1 : std::max (0 , LowerCopyQueueIndex);
1093
1094
UpperCopyQueueIndex = std::min (UpperCopyQueueIndex, n - 1 );
1094
1095
1095
1096
// Return nullptr when no copy command queues are allowed to be used or if
0 commit comments