[Bf-blender-cvs] [86a03923de0] cycles_oneapi: Cycles: Fix missing oneAPI dependencies for kernel compilation

Sergey Sharybin noreply at git.blender.org
Mon Apr 4 15:27:52 CEST 2022


Commit: 86a03923de0a6f906aa99ad204059e959b15425d
Author: Sergey Sharybin
Date:   Mon Apr 4 15:26:01 2022 +0200
Branches: cycles_oneapi
https://developer.blender.org/rB86a03923de0a6f906aa99ad204059e959b15425d

Cycles: Fix missing oneAPI dependencies for kernel compilation

The code was relying on kernel_sources variables set by the CUDA
kernel commands initialization.

Additionally, make sure the output path is the same for both the
custom command itself and for the output file provided to the
add_custom_command. Makes it more clear that no implicit path
deduction is used.

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

M	intern/cycles/kernel/CMakeLists.txt

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

diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt
index 596d2ce6c46..960c4252876 100644
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@ -701,10 +701,19 @@ endif()
 
 if(WITH_CYCLES_DEVICE_ONEAPI)
   if(WIN32)
-    set(cycles_kernel_oneapi_lib cycles_kernel_oneapi.dll)
+    set(cycles_kernel_oneapi_lib ${CMAKE_CURRENT_BINARY_DIR}/cycles_kernel_oneapi.dll)
   else()
-    set(cycles_kernel_oneapi_lib cycles_kernel_oneapi.so)
+    set(cycles_kernel_oneapi_lib ${CMAKE_CURRENT_BINARY_DIR}/cycles_kernel_oneapi.so)
   endif()
+
+  set(cycles_oneapi_kernel_sources
+    ${SRC_KERNEL_DEVICE_ONEAPI}
+    ${SRC_KERNEL_HEADERS}
+    ${SRC_KERNEL_DEVICE_GPU_HEADERS}
+    ${SRC_KERNEL_DEVICE_ONEAPI_HEADERS}
+    ${SRC_UTIL_HEADERS}
+  )
+
   set(dpcpp_flags
       ${CMAKE_CURRENT_SOURCE_DIR}/${SRC_KERNEL_DEVICE_ONEAPI}
       -fsycl
@@ -715,7 +724,7 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
       -ffast-math
       -DNDEBUG
       -O2
-      -o ${CMAKE_CURRENT_BINARY_DIR}/${cycles_kernel_oneapi_lib}
+      -o ${cycles_kernel_oneapi_lib}
       -I${CMAKE_CURRENT_SOURCE_DIR}/..
       -I${LEVEL_ZERO_INCLUDE_DIR}
       ${LEVEL_ZERO_LIBRARY}
@@ -753,13 +762,13 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
       OUTPUT ${cycles_kernel_oneapi_lib}
       COMMAND "${dpcpp_root}/../../env/vars.bat"
       COMMAND ${SYCL_DPCPP_COMPILER} ${dpcpp_flags}
-      DEPENDS ${kernel_sources})
+      DEPENDS ${cycles_oneapi_kernel_sources})
   else()
     list(APPEND dpcpp_flags -fPIC)
     add_custom_command(
       OUTPUT ${cycles_kernel_oneapi_lib}
       COMMAND bash -c \"source ${dpcpp_root}/../../env/vars.sh&&${SYCL_DPCPP_COMPILER} ${dpcpp_flags}\"
-      DEPENDS ${kernel_sources})
+      DEPENDS ${cycles_oneapi_kernel_sources})
   endif()
 
   delayed_install("${CMAKE_CURRENT_BINARY_DIR}" "${cycles_kernel_oneapi_lib}" ${CYCLES_INSTALL_PATH}/lib)



More information about the Bf-blender-cvs mailing list