From 48c5e44c66eb5ec24d379aaf192a6ec321470b9f Mon Sep 17 00:00:00 2001 From: Kevin B Smith Date: Thu, 8 Oct 2020 08:04:16 -0700 Subject: [PATCH 1/2] [SYCL][PI][L0] Rename environment variables from LEVEL0 to LEVEL_ZERO. --- sycl/doc/EnvironmentVariables.md | 4 ++-- sycl/plugins/level_zero/pi_level_zero.cpp | 6 +++--- sycl/plugins/level_zero/pi_level_zero.hpp | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sycl/doc/EnvironmentVariables.md b/sycl/doc/EnvironmentVariables.md index 2bbf87371e7f3..9e5a085266669 100644 --- a/sycl/doc/EnvironmentVariables.md +++ b/sycl/doc/EnvironmentVariables.md @@ -26,8 +26,8 @@ subject to change. Do not rely on these variables in production code. | SYCL_DEVICE_ALLOWLIST | A list of devices and their driver version following the pattern: DeviceName:{{XXX}},DriverVersion:{{X.Y.Z.W}}. Also may contain PlatformName and PlatformVersion | Filter out devices that do not match the pattern specified. Regular expression can be passed and the DPC++ runtime will select only those devices which satisfy the regex. Special characters, such as parenthesis, must be escaped. More than one device can be specified using the piping symbol "\|".| | SYCL_QUEUE_THREAD_POOL_SIZE | Positive integer | Number of threads in thread pool of queue. | | SYCL_DEVICELIB_NO_FALLBACK | Any(\*) | Disable loading and linking of device library images | -| SYCL_PI_LEVEL0_MAX_COMMAND_LIST_CACHE | Positive integer | Maximum number of oneAPI Level Zero Command lists that can be allocated with no reuse before throwing an "out of resources" error. Default is 20000, threshold may be increased based on resource availabilty and workload demand. | -| SYCL_PI_LEVEL0_DISABLE_USM_ALLOCATOR | Any(\*) | Disable USM allocator in Level Zero plugin (each memory request will go directly to Level Zero runtime) | +| SYCL_PI_LEVEL_ZERO_MAX_COMMAND_LIST_CACHE | Positive integer | Maximum number of oneAPI Level Zero Command lists that can be allocated with no reuse before throwing an "out of resources" error. Default is 20000, threshold may be increased based on resource availabilty and workload demand. | +| SYCL_PI_LEVEL_ZERO_DISABLE_USM_ALLOCATOR | Any(\*) | Disable USM allocator in Level Zero plugin (each memory request will go directly to Level Zero runtime) | `(*) Note: Any means this environment variable is effective when set to any non-null value.` diff --git a/sycl/plugins/level_zero/pi_level_zero.cpp b/sycl/plugins/level_zero/pi_level_zero.cpp index d0cd5c3b91e34..f806a766bc979 100644 --- a/sycl/plugins/level_zero/pi_level_zero.cpp +++ b/sycl/plugins/level_zero/pi_level_zero.cpp @@ -682,13 +682,13 @@ static pi_result getOrCreatePlatform(ze_driver_handle_t ZeDriver, // it only has to be executed once static pi_uint32 CommandListCacheSizeValue = ([] { const char *CommandListCacheSize = - std::getenv("SYCL_PI_LEVEL0_MAX_COMMAND_LIST_CACHE"); + std::getenv("SYCL_PI_LEVEL_ZERO_MAX_COMMAND_LIST_CACHE"); pi_uint32 CommandListCacheSizeValue; try { CommandListCacheSizeValue = CommandListCacheSize ? std::stoi(CommandListCacheSize) : 20000; } catch (std::exception const &) { - zePrint("SYCL_PI_LEVEL0_MAX_COMMAND_LIST_CACHE: invalid value provided, " + zePrint("SYCL_PI_LEVEL_ZERO_MAX_COMMAND_LIST_CACHE: invalid value provided, " "default set.\n"); CommandListCacheSizeValue = 20000; } @@ -4345,7 +4345,7 @@ pi_result piextUSMHostAlloc(void **ResultPtr, pi_context Context, static bool ShouldUseUSMAllocator() { // Enable allocator by default if it's not explicitly disabled - return std::getenv("SYCL_PI_LEVEL0_DISABLE_USM_ALLOCATOR") == nullptr; + return std::getenv("SYCL_PI_LEVEL_ZERO_DISABLE_USM_ALLOCATOR") == nullptr; } static const bool UseUSMAllocator = ShouldUseUSMAllocator(); diff --git a/sycl/plugins/level_zero/pi_level_zero.hpp b/sycl/plugins/level_zero/pi_level_zero.hpp index 71e34a5b2a834..9cd994af8e179 100644 --- a/sycl/plugins/level_zero/pi_level_zero.hpp +++ b/sycl/plugins/level_zero/pi_level_zero.hpp @@ -84,8 +84,8 @@ struct _pi_platform { // Maximum Number of Command Lists that can be created. // This Value is initialized to 20000, but can be changed by the user - // thru the environment variable SYCL_PI_LEVEL0_MAX_COMMAND_LIST_CACHE - // ie SYCL_PI_LEVEL0_MAX_COMMAND_LIST_CACHE =10000. + // thru the environment variable SYCL_PI_LEVEL_ZERO_MAX_COMMAND_LIST_CACHE + // ie SYCL_PI_LEVEL_ZERO_MAX_COMMAND_LIST_CACHE =10000. int ZeMaxCommandListCache = 0; // Current number of L0 Command Lists created on this platform. From 3d6af6e62b3a2dae1a815733853325f6405f0600 Mon Sep 17 00:00:00 2001 From: Alexey Bader Date: Thu, 8 Oct 2020 19:15:21 +0300 Subject: [PATCH 2/2] Fix formatting issues. --- sycl/plugins/level_zero/pi_level_zero.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sycl/plugins/level_zero/pi_level_zero.cpp b/sycl/plugins/level_zero/pi_level_zero.cpp index 486ab16c475a5..62aff3182bc07 100644 --- a/sycl/plugins/level_zero/pi_level_zero.cpp +++ b/sycl/plugins/level_zero/pi_level_zero.cpp @@ -771,8 +771,9 @@ static pi_result getOrCreatePlatform(ze_driver_handle_t ZeDriver, CommandListCacheSizeValue = CommandListCacheSize ? std::stoi(CommandListCacheSize) : 20000; } catch (std::exception const &) { - zePrint("SYCL_PI_LEVEL_ZERO_MAX_COMMAND_LIST_CACHE: invalid value provided, " - "default set.\n"); + zePrint( + "SYCL_PI_LEVEL_ZERO_MAX_COMMAND_LIST_CACHE: invalid value provided, " + "default set.\n"); CommandListCacheSizeValue = 20000; } return CommandListCacheSizeValue;