blender/build_files/build_environment/patches/unifiedmemoryframework.diff
Nikita Sirgienko 2dcebbdcec Deps: Upgrade DPC++ to 7.1.0 and update its dependency set
This upgrade of DPC++ and its dependencies is primarily routine
maintenance and preparation for the upcoming OpenImageDenoise
upgrades. Two backports are now obsolete with this release and have
been removed; three new ones are added for known problems. It also
adds Portable Hardware Locality (hwloc) as a new mandatory
dependency: it was previously optional for DPC++ v6.3, but it can no
longer be disabled, so it is now integrated into the build. In
addition, it adds the -Wno-sycl-undefined-func-in-image option, which
silences the "Undefined function ... found in ..." warning emitted at
device link time when the symbol is resolved at runtime.

Pull Request: https://projects.blender.org/blender/blender/pulls/163826
2026-09-15 13:34:55 +02:00

74 lines
3.4 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1eee98b..72b1016 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -372,21 +372,9 @@ if(WINDOWS)
message(STATUS " LIBHWLOC_DLL_DIRS = ${LIBHWLOC_DLL_DIRS}")
endif()
-if(hwloc_targ_SOURCE_DIR)
- # Apply security patch for HWLOC
- execute_process(
- COMMAND git apply ${PROJECT_SOURCE_DIR}/cmake/fix_coverity_issues.patch
- WORKING_DIRECTORY ${hwloc_targ_SOURCE_DIR}
- OUTPUT_VARIABLE UMF_HWLOC_PATCH_OUTPUT
- ERROR_VARIABLE UMF_HWLOC_PATCH_ERROR)
-
- if(UMF_HWLOC_PATCH_OUTPUT)
- message(STATUS "HWLOC patch command output:\n${UMF_HWLOC_PATCH_OUTPUT}")
- endif()
- if(UMF_HWLOC_PATCH_ERROR)
- message(WARNING "HWLOC patch command output:\n${UMF_HWLOC_PATCH_ERROR}")
- endif()
-endif()
+# We are applying the security patch for HWLOC at the Blender level
+# to avoid patching it over and over again, as we are reusing
+# the same HWLOC source code directory.
if(UMF_BUILD_LEVEL_ZERO_PROVIDER)
if(UMF_BUILD_GPU_TESTS OR UMF_BUILD_GPU_EXAMPLES)
@@ -507,6 +495,19 @@ if(WINDOWS AND UMF_USE_DEBUG_POSTFIX)
# The build_umfd target's configuration command requires to have
# CMAKE_PREFIX_PATH with semicolons escaped
string(JOIN "\;" UMFD_CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH})
+
+ # Verify that Level Zero headers are available before the umfd sub-build
+ # needs them. If LEVEL_ZERO_INCLUDE_DIRS is empty, the umfd sub-build will
+ # attempt to fetch Level Zero from GitHub, which will fail when
+ # FETCHCONTENT_FULLY_DISCONNECTED is ON.
+ if(UMF_BUILD_LEVEL_ZERO_PROVIDER AND NOT LEVEL_ZERO_INCLUDE_DIRS)
+ message(FATAL_ERROR "LEVEL_ZERO_INCLUDE_DIRS is not defined but UMF_BUILD_LEVEL_ZERO_PROVIDER is ON. "
+ "Cannot forward Level Zero headers to the umfd sub-build.")
+ endif()
+ if(NOT DEFINED FETCHCONTENT_SOURCE_DIR_HWLOC_TARG)
+ message(FATAL_ERROR "FETCHCONTENT_SOURCE_DIR_HWLOC_TARG is not defined. Cannot forward to unified-runtimed sub-build.")
+ endif()
+
add_custom_target(
build_umfd ALL
COMMAND
@@ -532,6 +533,12 @@ if(WINDOWS AND UMF_USE_DEBUG_POSTFIX)
-DUMF_USE_ASAN=OFF -DUMF_USE_UBSAN=OFF -DUMF_USE_TSAN=OFF
-DUMF_USE_MSAN=OFF -DUMF_USE_VALGRIND=OFF -DUMF_USE_COVERAGE=OFF
-DUMF_PROXY_LIB_BASED_ON_POOL=${UMF_PROXY_LIB_BASED_ON_POOL}
+ # The umfd sub-build must not download anything from the network.
+ # FETCHCONTENT_FULLY_DISCONNECTED is not inherited by sub-builds
+ # spawned via add_custom_target, so we forward it explicitly.
+ -DFETCHCONTENT_FULLY_DISCONNECTED=ON
+ -DUMF_LEVEL_ZERO_INCLUDE_DIR=${LEVEL_ZERO_INCLUDE_DIRS}
+ -DFETCHCONTENT_SOURCE_DIR_HWLOC_TARG=${FETCHCONTENT_SOURCE_DIR_HWLOC_TARG}
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR}/umfd_build --target
umf --config Debug
COMMENT
diff --git a/cmake/helpers.cmake b/cmake/helpers.cmake
index 8ee14bd..605e689 100644
--- a/cmake/helpers.cmake
+++ b/cmake/helpers.cmake
@@ -288,7 +288,6 @@ function(add_umf_target_compile_options name)
${name}
PRIVATE /MD$<$<CONFIG:Debug>:d>
$<$<CONFIG:Release>:/sdl>
- $<$<CXX_COMPILER_ID:MSVC>:/analyze>
/DYNAMICBASE
/W4
/Gy