forked from blender/blender
main sync #3
@ -754,10 +754,9 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
|
|||||||
-shared
|
-shared
|
||||||
-DWITH_ONEAPI
|
-DWITH_ONEAPI
|
||||||
-ffast-math
|
-ffast-math
|
||||||
-DNDEBUG
|
|
||||||
-O2
|
-O2
|
||||||
-o ${cycles_kernel_oneapi_lib}
|
-o"${cycles_kernel_oneapi_lib}"
|
||||||
-I${CMAKE_CURRENT_SOURCE_DIR}/..
|
-I"${CMAKE_CURRENT_SOURCE_DIR}/.."
|
||||||
${SYCL_CPP_FLAGS}
|
${SYCL_CPP_FLAGS}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -785,14 +784,14 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
|
|||||||
list(APPEND sycl_compiler_flags -fsycl-targets=${targets_string})
|
list(APPEND sycl_compiler_flags -fsycl-targets=${targets_string})
|
||||||
foreach(target ${CYCLES_ONEAPI_SYCL_TARGETS})
|
foreach(target ${CYCLES_ONEAPI_SYCL_TARGETS})
|
||||||
if(DEFINED CYCLES_ONEAPI_SYCL_OPTIONS_${target})
|
if(DEFINED CYCLES_ONEAPI_SYCL_OPTIONS_${target})
|
||||||
list(APPEND sycl_compiler_flags -Xsycl-target-backend=${target} "${CYCLES_ONEAPI_SYCL_OPTIONS_${target}}")
|
list(APPEND sycl_compiler_flags "-Xsycl-target-backend=${target} \"${CYCLES_ONEAPI_SYCL_OPTIONS_${target}}\"")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
else()
|
else()
|
||||||
# If AOT is disabled, build for spir64
|
# If AOT is disabled, build for spir64
|
||||||
list(APPEND sycl_compiler_flags
|
list(APPEND sycl_compiler_flags
|
||||||
-fsycl-targets=spir64
|
-fsycl-targets=spir64
|
||||||
-Xsycl-target-backend=spir64 "${CYCLES_ONEAPI_SYCL_OPTIONS_spir64}")
|
"-Xsycl-target-backend=spir64 \"${CYCLES_ONEAPI_SYCL_OPTIONS_spir64}\"")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_NANOVDB)
|
if(WITH_NANOVDB)
|
||||||
@ -806,7 +805,6 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
get_filename_component(sycl_compiler_root ${SYCL_COMPILER} DIRECTORY)
|
get_filename_component(sycl_compiler_root ${SYCL_COMPILER} DIRECTORY)
|
||||||
get_filename_component(sycl_compiler_compiler_name ${SYCL_COMPILER} NAME_WE)
|
|
||||||
|
|
||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE)
|
||||||
if(NOT WITH_CXX11_ABI)
|
if(NOT WITH_CXX11_ABI)
|
||||||
@ -818,7 +816,7 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32) # Add Windows specific compiler flags.
|
||||||
list(APPEND sycl_compiler_flags
|
list(APPEND sycl_compiler_flags
|
||||||
-fuse-ld=link
|
-fuse-ld=link
|
||||||
-fms-extensions
|
-fms-extensions
|
||||||
@ -845,20 +843,43 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
|
|||||||
get_filename_component(WINDOWS_KIT_DIR "${WINDOWS_KIT_DIR}/../" ABSOLUTE)
|
get_filename_component(WINDOWS_KIT_DIR "${WINDOWS_KIT_DIR}/../" ABSOLUTE)
|
||||||
endif()
|
endif()
|
||||||
list(APPEND sycl_compiler_flags
|
list(APPEND sycl_compiler_flags
|
||||||
-L "${MSVC_TOOLS_DIR}/lib/x64"
|
-L"${MSVC_TOOLS_DIR}/lib/x64"
|
||||||
-L "${WINDOWS_KIT_DIR}/um/x64"
|
-L"${WINDOWS_KIT_DIR}/um/x64"
|
||||||
-L "${WINDOWS_KIT_DIR}/ucrt/x64")
|
-L"${WINDOWS_KIT_DIR}/ucrt/x64")
|
||||||
|
else() # Add Linux specific compiler flags.
|
||||||
|
list(APPEND sycl_compiler_flags -fPIC)
|
||||||
|
|
||||||
|
# We avoid getting __FAST_MATH__ to be defined when building on CentOS-7 and Rocky-8
|
||||||
|
# until the compilation issues it triggers at either AoT or JIT stages gets fixed.
|
||||||
|
list(APPEND sycl_compiler_flags -fhonor-nans)
|
||||||
|
|
||||||
|
# add $ORIGIN to cycles_kernel_oneapi.so rpath so libsycl.so and
|
||||||
|
# libpi_level_zero.so can be placed next to it and get found.
|
||||||
|
list(APPEND sycl_compiler_flags -Wl,-rpath,'$$ORIGIN')
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Create CONFIG specific compiler flags.
|
||||||
set(sycl_compiler_flags_Release ${sycl_compiler_flags})
|
set(sycl_compiler_flags_Release ${sycl_compiler_flags})
|
||||||
set(sycl_compiler_flags_Debug ${sycl_compiler_flags})
|
set(sycl_compiler_flags_Debug ${sycl_compiler_flags})
|
||||||
set(sycl_compiler_flags_RelWithDebInfo ${sycl_compiler_flags})
|
set(sycl_compiler_flags_RelWithDebInfo ${sycl_compiler_flags})
|
||||||
set(sycl_compiler_flags_MinSizeRel ${sycl_compiler_flags})
|
|
||||||
list(APPEND sycl_compiler_flags_RelWithDebInfo -g)
|
list(APPEND sycl_compiler_flags_Release
|
||||||
|
-DNDEBUG
|
||||||
|
)
|
||||||
|
list(APPEND sycl_compiler_flags_RelWithDebInfo
|
||||||
|
-DNDEBUG
|
||||||
|
-g
|
||||||
|
)
|
||||||
list(APPEND sycl_compiler_flags_Debug
|
list(APPEND sycl_compiler_flags_Debug
|
||||||
-g
|
-g
|
||||||
-D_DEBUG
|
)
|
||||||
-nostdlib -Xclang --dependent-lib=msvcrtd)
|
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
list(APPEND sycl_compiler_flags_Debug
|
||||||
|
-D_DEBUG
|
||||||
|
-nostdlib
|
||||||
|
-Xclang --dependent-lib=msvcrtd
|
||||||
|
)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${cycles_kernel_oneapi_lib} ${cycles_kernel_oneapi_linker_lib}
|
OUTPUT ${cycles_kernel_oneapi_lib} ${cycles_kernel_oneapi_linker_lib}
|
||||||
COMMAND ${CMAKE_COMMAND} -E env
|
COMMAND ${CMAKE_COMMAND} -E env
|
||||||
@ -872,27 +893,29 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
|
|||||||
COMMAND_EXPAND_LISTS
|
COMMAND_EXPAND_LISTS
|
||||||
DEPENDS ${cycles_oneapi_kernel_sources})
|
DEPENDS ${cycles_oneapi_kernel_sources})
|
||||||
else()
|
else()
|
||||||
list(APPEND sycl_compiler_flags -fPIC)
|
|
||||||
|
|
||||||
# We avoid getting __FAST_MATH__ to be defined when building on CentOS-7 until the compilation
|
|
||||||
# crash it triggers at either AoT or JIT stages gets fixed.
|
|
||||||
# TODO: check if this is still needed on Rocky-8.
|
|
||||||
list(APPEND sycl_compiler_flags -fhonor-nans)
|
|
||||||
|
|
||||||
# add $ORIGIN to cycles_kernel_oneapi.so rpath so libsycl.so and
|
|
||||||
# libpi_level_zero.so can be placed next to it and get found.
|
|
||||||
list(APPEND sycl_compiler_flags -Wl,-rpath,'$$ORIGIN')
|
|
||||||
|
|
||||||
if(NOT IGC_INSTALL_DIR)
|
if(NOT IGC_INSTALL_DIR)
|
||||||
get_filename_component(IGC_INSTALL_DIR "${sycl_compiler_root}/../lib/igc" ABSOLUTE)
|
get_filename_component(IGC_INSTALL_DIR "${sycl_compiler_root}/../lib/igc" ABSOLUTE)
|
||||||
endif()
|
endif()
|
||||||
|
# The following join/replace operations are to prevent cmake from
|
||||||
|
# escaping space chars with backslashes in add_custom_command.
|
||||||
|
list(JOIN sycl_compiler_flags_Release " " sycl_compiler_flags_Release_str)
|
||||||
|
string(REPLACE " " ";" sycl_compiler_flags_Release_str ${sycl_compiler_flags_Release_str})
|
||||||
|
list(JOIN sycl_compiler_flags_RelWithDebInfo " " sycl_compiler_flags_RelWithDebInfo_str)
|
||||||
|
string(REPLACE " " ";" sycl_compiler_flags_RelWithDebInfo_str ${sycl_compiler_flags_RelWithDebInfo_str})
|
||||||
|
list(JOIN sycl_compiler_flags_Debug " " sycl_compiler_flags_Debug_str)
|
||||||
|
string(REPLACE " " ";" sycl_compiler_flags_Debug_str ${sycl_compiler_flags_Debug_str})
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${cycles_kernel_oneapi_lib}
|
OUTPUT ${cycles_kernel_oneapi_lib}
|
||||||
COMMAND ${CMAKE_COMMAND} -E env
|
COMMAND ${CMAKE_COMMAND} -E env
|
||||||
"LD_LIBRARY_PATH=${sycl_compiler_root}/../lib:${OCLOC_INSTALL_DIR}/lib:${IGC_INSTALL_DIR}/lib"
|
"LD_LIBRARY_PATH=${sycl_compiler_root}/../lib:${OCLOC_INSTALL_DIR}/lib:${IGC_INSTALL_DIR}/lib"
|
||||||
# `$ENV{PATH}` is for compiler to find `ld`.
|
# `$ENV{PATH}` is for compiler to find `ld`.
|
||||||
"PATH=${OCLOC_INSTALL_DIR}/bin:${sycl_compiler_root}:$ENV{PATH}"
|
"PATH=${OCLOC_INSTALL_DIR}/bin:${sycl_compiler_root}:$ENV{PATH}"
|
||||||
${SYCL_COMPILER} $<$<CONFIG:Debug>:-g>$<$<CONFIG:RelWithDebInfo>:-g> ${sycl_compiler_flags}
|
${SYCL_COMPILER}
|
||||||
|
"$<$<CONFIG:Release>:${sycl_compiler_flags_Release_str}>"
|
||||||
|
"$<$<CONFIG:RelWithDebInfo>:${sycl_compiler_flags_RelWithDebInfo_str}>"
|
||||||
|
"$<$<CONFIG:Debug>:${sycl_compiler_flags_Debug_str}>"
|
||||||
|
"$<$<CONFIG:MinSizeRel>:${sycl_compiler_flags_Release_str}>"
|
||||||
|
COMMAND_EXPAND_LISTS
|
||||||
DEPENDS ${cycles_oneapi_kernel_sources})
|
DEPENDS ${cycles_oneapi_kernel_sources})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user