Skip to content

Commit 3484fcb

Browse files
committed
Merging two env vars
1 parent 57d3c21 commit 3484fcb

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

sycl/doc/EnvironmentVariables.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ subject to change. Do not rely on these variables in production code.
3131
| `SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR` | MaxPoolableSize,Capacity,MaxPoolSize | Values specified as positive integers. Defaults are 1, 4, 256. MaxPoolableSize is the maximum allocation size in MB that may be pooled. Capacity is the number of allocations in each size range that are freed by the program but retained in the pool for reallocation. Size ranges follow this pattern: 32, 48, 64, 96, 128, 192, and so on, i.e., powers of 2, with one range in between. MaxPoolSize is the maximum size of the pool in MB. |
3232
| `SYCL_PI_LEVEL_ZERO_BATCH_SIZE` | Integer | Sets a preferred number of commands to batch into a command list before executing the command list. A value of 0 causes the batch size to be adjusted dynamically. A value greater than 0 specifies fixed size batching, with the batch size set to the specified value. The default is 0. |
3333
| `SYCL_PI_LEVEL_ZERO_FILTER_EVENT_WAIT_LIST` | Integer | When set to 0, disables filtering of signaled events from wait lists when using the Level Zero backend. The default is 1. |
34-
| `SYCL_PI_LEVEL_ZERO_USE_COPY_ENGINE` | Integer | Allows the use of copy engines, if available in the device, in Level Zero plugin to transfer SYCL buffer or image data between the host and/or device(s) and to fill SYCL buffer or image data in device or shared memory. The default is 1. |
34+
| `SYCL_PI_LEVEL_ZERO_USE_COPY_ENGINE` | Any(\*) | This environment variable enables users to control use of copy engines for copy operations. If the value is an integer, it will allow the use of copy engines, if available in the device, in Level Zero plugin to transfer SYCL buffer or image data between the host and/or device(s) and to fill SYCL buffer or image data in device or shared memory. The value of this environment variable can also be a pair of the form "lower_index:upper_index" where the indices point to copy engines in a list of all available copy engines. The default is 1. |
3535
| `SYCL_PI_LEVEL_ZERO_USE_COPY_ENGINE_FOR_D2D_COPY` (experimental) | Integer | Allows the use of copy engine, if available in the device, in Level Zero plugin for device to device copy operations. The default is 0. This option is experimental and will be removed once heuristics are added to make a decision about use of copy engine for device to device copy operations. |
36-
| `SYCL_PI_LEVEL_ZERO_USE_COPY_ENGINE_RANGE` | Any(\*) | This environment variable enables users to select a desired range of copy engines to use for copy operations. The value of this environment variable is a pair of the form "lower_index:upper_index" where the indices point to copy engines in a list of all available copy engines.
3736
| `SYCL_PI_LEVEL_ZERO_TRACK_INDIRECT_ACCESS_MEMORY` | Any(\*) | Enable support of the kernels with indirect access and corresponding deferred release of memory allocations in the Level Zero plugin. |
3837
| `SYCL_PARALLEL_FOR_RANGE_ROUNDING_TRACE` | Any(\*) | Enables tracing of `parallel_for` invocations with rounded-up ranges. |
3938
| `SYCL_DISABLE_PARALLEL_FOR_RANGE_ROUNDING` | Any(\*) | Disables automatic rounding-up of `parallel_for` invocation ranges. |

sycl/plugins/level_zero/pi_level_zero.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,20 @@ static const bool UseCopyEngineForD2DCopy = [] {
6363
// TODO: Add support for non-zero values of SYCL_PI_LEVEL_ZERO_USE_COPY_ENGINE
6464
static const bool CopyEngineRequested = [] {
6565
const char *CopyEngine = std::getenv("SYCL_PI_LEVEL_ZERO_USE_COPY_ENGINE");
66-
bool UseCopyEngine = (!CopyEngine || (std::stoi(CopyEngine) != 0));
66+
bool UseCopyEngine = (!CopyEngine || ((CopyEngine[1] == '\0') &&
67+
(std::stoi(CopyEngine) != 0)));
6768
return UseCopyEngine;
6869
}();
6970

7071
static const std::pair<int, int> getRangeOfAllowedCopyEngines = [] {
7172
const char *CopyEngineRange =
72-
std::getenv("SYCL_PI_LEVEL_ZERO_USE_COPY_ENGINE_RANGE");
73+
std::getenv("SYCL_PI_LEVEL_ZERO_USE_COPY_ENGINE");
74+
if (CopyEngineRange && (CopyEngineRange[1] == '\0')) {
75+
if (CopyEngineRange[0] == '0')
76+
return std::pair<int, int>(-1, -1);
77+
else
78+
return std::pair<int, int>(0, 8);
79+
}
7380
int LowerCopyEngineIndex = (CopyEngineRange) ? (CopyEngineRange[0] - '0') : 0;
7481
int UpperCopyEngineIndex = (CopyEngineRange) ? (CopyEngineRange[2] - '0') : 8;
7582
return std::pair<int, int>(LowerCopyEngineIndex, UpperCopyEngineIndex);

0 commit comments

Comments
 (0)