[Bf-blender-cvs] [610862927e0] cycles_oneapi: Cycles: use immediate commandlists in oneAPI backend

Xavier Hallade noreply at git.blender.org
Tue May 10 22:21:13 CEST 2022


Commit: 610862927e05bf51281fa2241066c24471cf9c05
Author: Xavier Hallade
Date:   Thu May 5 09:16:16 2022 +0200
Branches: cycles_oneapi
https://developer.blender.org/rB610862927e05bf51281fa2241066c24471cf9c05

Cycles: use immediate commandlists in oneAPI backend

through SYCL specific environment variables and without overriding
already defined ones.
Immediate commandlists improve stability when using
sycl-nightly/20220416 and newer.

===================================================================

M	intern/cycles/device/oneapi/device.cpp

===================================================================

diff --git a/intern/cycles/device/oneapi/device.cpp b/intern/cycles/device/oneapi/device.cpp
index 235d9b39374..ff617673b17 100644
--- a/intern/cycles/device/oneapi/device.cpp
+++ b/intern/cycles/device/oneapi/device.cpp
@@ -86,18 +86,28 @@ bool device_oneapi_init()
 
   // NOTE(sirgienko) we need to enable JIT cache from here and
   // right now this cache policy is controlled by env. variables
-  VLOG(1) << "Enable oneAPI persistent cache via environment variables";
+  // NOTE(hallade) we also enable immediate command lists + device scope events
+  // as they improve stability as of intel/llvm sycl-nighly/20220501.
+  // All these env variable can be set beforehand by end-users and
+  // will in that case -not- be overwritten.
 #  ifdef _WIN32
-  _putenv_s("SYCL_CACHE_PERSISTENT", "1");
-  _putenv_s("SYCL_CACHE_THRESHOLD", "0");
-  VLOG(1) << "Enabled oneAPI JIT caching on Windows platform";
+  if (getenv("SYCL_CACHE_PERSISTENT") == nullptr) {
+    _putenv_s("SYCL_CACHE_PERSISTENT", "1");
+  }
+  if (getenv("SYCL_CACHE_TRESHOLD") == nullptr) {
+    _putenv_s("SYCL_CACHE_THRESHOLD", "0");
+  }
+  if (getenv("SYCL_PI_LEVEL_ZERO_DEVICE_SCOPE_EVENTS") == nullptr) {
+    _putenv_s("SYCL_PI_LEVEL_ZERO_DEVICE_SCOPE_EVENTS", "0");
+  }
+  if (getenv("SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS") == nullptr) {
+    _putenv_s("SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS", "1");
+  }
 #  elif __linux__
-  setenv("SYCL_CACHE_PERSISTENT", "1", true);
-  setenv("SYCL_CACHE_THRESHOLD", "0", true);
-  VLOG(1) << "Enabled oneAPI JIT caching on Linux platform ";
-#  else
-  VLOG(1) << "Could not enable oneAPI JIT caching because the OS (Operating System) platform is "
-             "neither Linux nor Windows";
+  setenv("SYCL_CACHE_PERSISTENT", "1", false);
+  setenv("SYCL_CACHE_THRESHOLD", "0", false);
+  setenv("SYCL_PI_LEVEL_ZERO_DEVICE_SCOPE_EVENTS", "0", false);
+  setenv("SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS", "1", false);
 #  endif
 
   return true;



More information about the Bf-blender-cvs mailing list