[Bf-blender-cvs] [8920b618474] cycles_oneapi: Cycles: resolve compiler warnings for oneAPI backend

Xavier Hallade noreply at git.blender.org
Fri Apr 29 17:40:35 CEST 2022


Commit: 8920b6184741689f1478150ce46ecb679c4e01fb
Author: Xavier Hallade
Date:   Fri Apr 29 17:34:12 2022 +0200
Branches: cycles_oneapi
https://developer.blender.org/rB8920b6184741689f1478150ce46ecb679c4e01fb

Cycles: resolve compiler warnings for oneAPI backend

for compiling with intel/llvm 2021-12 and newer

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

M	intern/cycles/device/oneapi/device.cpp
M	intern/cycles/device/oneapi/queue.cpp
M	intern/cycles/kernel/CMakeLists.txt
M	intern/cycles/kernel/device/oneapi/kernel.cpp
M	intern/cycles/util/atomic.h

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

diff --git a/intern/cycles/device/oneapi/device.cpp b/intern/cycles/device/oneapi/device.cpp
index 78a58a2f538..235d9b39374 100644
--- a/intern/cycles/device/oneapi/device.cpp
+++ b/intern/cycles/device/oneapi/device.cpp
@@ -88,8 +88,8 @@ bool device_oneapi_init()
   // right now this cache policy is controlled by env. variables
   VLOG(1) << "Enable oneAPI persistent cache via environment variables";
 #  ifdef _WIN32
-  (void)putenv("SYCL_CACHE_PERSISTENT=1");
-  (void)putenv("SYCL_CACHE_THRESHOLD=0");
+  _putenv_s("SYCL_CACHE_PERSISTENT", "1");
+  _putenv_s("SYCL_CACHE_THRESHOLD", "0");
   VLOG(1) << "Enabled oneAPI JIT caching on Windows platform";
 #  elif __linux__
   setenv("SYCL_CACHE_PERSISTENT", "1", true);
diff --git a/intern/cycles/device/oneapi/queue.cpp b/intern/cycles/device/oneapi/queue.cpp
index a34ff1be21f..7ae8dc4ac01 100644
--- a/intern/cycles/device/oneapi/queue.cpp
+++ b/intern/cycles/device/oneapi/queue.cpp
@@ -87,7 +87,7 @@ OneapiDeviceQueue::OneapiDeviceQueue(OneapiDevice *device)
       oneapi_dll_(device->oneapi_dll_object()),
       kernel_context_(nullptr)
 {
-  if (getenv("CYCLES_ONEAPI_KERNEL_STATS") && VLOG_IS_ON(1)) {
+  if (getenv("CYCLES_ONEAPI_KERNEL_STATS") != nullptr && VLOG_IS_ON(1)) {
     with_kernel_statistics_ = true;
   }
   else {
diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt
index 77ec35bb8b0..91e7797b8bd 100644
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@ -761,6 +761,8 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
     -D_MBCS
     -DWIN32
     -D_WINDOWS
+    -D_CRT_NONSTDC_NO_DEPRECATE
+    -D_CRT_SECURE_NO_DEPRECATE
     -DONEAPI_EXPORT)
 
     if(sycl_compiler_compiler_name MATCHES "dpcpp")
diff --git a/intern/cycles/kernel/device/oneapi/kernel.cpp b/intern/cycles/kernel/device/oneapi/kernel.cpp
index 8d480566dea..bc521029d9b 100644
--- a/intern/cycles/kernel/device/oneapi/kernel.cpp
+++ b/intern/cycles/kernel/device/oneapi/kernel.cpp
@@ -744,7 +744,7 @@ static std::vector<sycl::device> oneapi_available_devices(
     std::map<std::string, std::string> *proper_names_map)
 {
   bool allow_all_devices = false;
-  if (getenv("CYCLES_ONEAPI_ALL_DEVICES"))
+  if (getenv("CYCLES_ONEAPI_ALL_DEVICES") != nullptr)
     allow_all_devices = true;
 
   bool allow_host = false;
diff --git a/intern/cycles/util/atomic.h b/intern/cycles/util/atomic.h
index b895cdd1704..1ebf085ae13 100644
--- a/intern/cycles/util/atomic.h
+++ b/intern/cycles/util/atomic.h
@@ -108,8 +108,6 @@ ccl_device_inline float atomic_compare_and_swap_float(volatile ccl_global float
 
 #  ifdef __KERNEL_ONEAPI__
 
-#    define atomic_ref ext::oneapi::atomic_ref
-
 ccl_device_inline float atomic_add_and_fetch_float(ccl_global float *p, float x)
 {
   sycl::atomic_ref<float,



More information about the Bf-blender-cvs mailing list