Skip to content

[SYCL][UR][CMake] Stop creating debug library builds on Windows during release builds #18200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 37 commits into
base: sycl
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
ece7f97
[SYCL] Stop building Windows debug variants in release mode
steffenlarsen Apr 10, 2025
a3e8edd
Merge remote-tracking branch 'intel/sycl' into steffen/remove_win_dou…
steffenlarsen Apr 24, 2025
e43a28c
Add ucrt checks
steffenlarsen Apr 24, 2025
93ec50c
Fix formatting
steffenlarsen Apr 25, 2025
89652ef
Fix formatting
steffenlarsen Apr 28, 2025
78c2798
Fix windows sycl lib install target
steffenlarsen Apr 28, 2025
2c9712c
Revert clang toolchain changes
steffenlarsen Apr 28, 2025
598d724
Remove xptifwd target
steffenlarsen Apr 28, 2025
29ab725
Revert MSVC toolchain changes
steffenlarsen Apr 28, 2025
f2c032d
Fix formatting
steffenlarsen Apr 28, 2025
68889c0
Fix more formatting
steffenlarsen Apr 28, 2025
3f6639d
One more formatting patch
steffenlarsen Apr 28, 2025
8e6a9d7
Change OpenCL Windows check
steffenlarsen Apr 28, 2025
344c638
Fix ucrt check and ignore OpenCL.dll
steffenlarsen Apr 29, 2025
015b566
Add E2E debug library option
steffenlarsen Apr 29, 2025
651a60d
Fix formatting
steffenlarsen Apr 29, 2025
04f3a65
Try fix tests
steffenlarsen Apr 29, 2025
5b4a74c
Only build and run /MDd test in full mode
steffenlarsen May 1, 2025
d2a95ff
Merge remote-tracking branch 'intel/sycl' into steffen/remove_win_dou…
steffenlarsen May 1, 2025
7a2a9e4
Change WIN32 to checking system name
steffenlarsen May 7, 2025
571de8f
Merge remote-tracking branch 'intel/sycl' into steffen/remove_win_dou…
steffenlarsen May 9, 2025
18769c4
Merge branch 'sycl' into steffen/remove_win_double_build
steffenlarsen May 12, 2025
3aa57c1
Merge remote-tracking branch 'intel/sycl' into steffen/remove_win_dou…
steffenlarsen May 21, 2025
b1a29bc
Add option for debug CRT in release
steffenlarsen May 21, 2025
00c6062
Fix formatting
steffenlarsen May 22, 2025
d779890
Remove unnecessary UCRT propagation
steffenlarsen May 22, 2025
b135513
Fix release build failures
steffenlarsen May 22, 2025
bc70f4d
Fix testing
steffenlarsen May 22, 2025
ec2568b
Fix unintended change in preview library name
steffenlarsen May 22, 2025
15e9a3f
Fix copy name
steffenlarsen May 22, 2025
1645253
Use %fsycl in changed test
steffenlarsen May 22, 2025
1f01b96
Fix another case of missnamed preview
steffenlarsen May 22, 2025
89184f2
Merge remote-tracking branch 'intel/sycl' into steffen/remove_win_dou…
steffenlarsen May 23, 2025
a9f4348
Add debug_sycl_library requirement to std_array test
steffenlarsen May 23, 2025
be444f7
Try conjunction
steffenlarsen May 23, 2025
e598847
Avoid linking error during build-only
steffenlarsen May 26, 2025
82914da
Update sycl/test/lit.cfg.py
steffenlarsen May 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions buildbot/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ def do_configure(args, passthrough_args):
"none of them to let download from github.com"
)

if args.use_debug_crt_dll:
cmake_cmd.extend(["-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL"])

# Add additional CMake options if provided
if args.cmake_opt:
cmake_cmd += args.cmake_opt
Expand Down Expand Up @@ -423,6 +426,11 @@ def main():
parser.add_argument(
"--use-zstd", action="store_true", help="Force zstd linkage while building."
)
parser.add_argument(
"--use-debug-crt-dll",
action="store_true",
help="Link libraries with MSVC debug dll in release mode.",
)
args, passthrough_args = parser.parse_known_intermixed_args()

print("args:{}".format(args))
Expand Down
15 changes: 2 additions & 13 deletions sycl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -290,13 +290,6 @@ if (WIN32)
if(SYCL_ENABLE_MAJOR_RELEASE_PREVIEW_LIB)
list(APPEND SYCL_RT_LIBS sycl${SYCL_MAJOR_VERSION}-preview)
endif()
# Do we really support non-MSVC ABI on WIN?
if (MSVC)
list(APPEND SYCL_RT_LIBS sycl${SYCL_MAJOR_VERSION}d)
if(SYCL_ENABLE_MAJOR_RELEASE_PREVIEW_LIB)
list(APPEND SYCL_RT_LIBS sycl${SYCL_MAJOR_VERSION}-previewd)
endif()
endif()
else()
set(SYCL_RT_LIBS sycl)
if(SYCL_ENABLE_MAJOR_RELEASE_PREVIEW_LIB)
Expand Down Expand Up @@ -366,11 +359,7 @@ if(SYCL_ENABLE_XPTI_TRACING AND
endif()

if (SYCL_ENABLE_XPTI_TRACING)
if (MSVC)
set(XPTIFW_LIBS xpti xptid xptifw xptifwd)
else()
set(XPTIFW_LIBS xpti xptifw)
endif()
set(XPTIFW_LIBS xpti xptifw)
endif()

# SYCL toolchain builds all components: compiler, libraries, headers, etc.
Expand Down Expand Up @@ -408,7 +397,7 @@ add_custom_target( sycl-toolchain ALL
)

if (WIN32)
add_dependencies(sycl-toolchain ur_win_proxy_loader unified-runtimed-build)
add_dependencies(sycl-toolchain ur_win_proxy_loader)
endif()

if("cuda" IN_LIST SYCL_ENABLE_BACKENDS)
Expand Down
9 changes: 2 additions & 7 deletions sycl/cmake/modules/AddSYCLUnitTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,8 @@ macro(add_sycl_unittest test_dirname link_variant)
get_target_property(SYCL_BINARY_DIR sycl-toolchain BINARY_DIR)

string(TOLOWER "${CMAKE_BUILD_TYPE}" build_type_lower)
if (MSVC AND build_type_lower MATCHES "debug")
set(sycl_obj_target "sycld_object")
set(sycl_so_target "sycld")
else()
set(sycl_obj_target "sycl_object")
set(sycl_so_target "sycl")
endif()
set(sycl_obj_target "sycl_object")
set(sycl_so_target "sycl")

if ("${link_variant}" MATCHES "SHARED")
set(SYCL_LINK_LIBS ${sycl_so_target})
Expand Down
107 changes: 0 additions & 107 deletions sycl/cmake/modules/FetchUnifiedRuntime.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -317,113 +317,6 @@ if("native_cpu" IN_LIST SYCL_ENABLE_BACKENDS)
endif()
endif()

if(CMAKE_SYSTEM_NAME STREQUAL Windows)
# On Windows, also build/install debug libraries with the d suffix that are
# compiled with /MDd so users can link against these in debug builds.
include(ExternalProject)
set(URD_BINARY_DIR ${CMAKE_BINARY_DIR}/unified-runtimed)
set(URD_INSTALL_DIR ${URD_BINARY_DIR}/install)

# This creates a subbuild which can be used in dependencies with the
# unified-runtimed target. It invokes the install-unified-runtime-libraries
# target to install the UR runtime libraries.
ExternalProject_Add(unified-runtimed
SOURCE_DIR ${UNIFIED_RUNTIME_SOURCE_DIR}
BINARY_DIR ${URD_BINARY_DIR}
INSTALL_DIR ${URD_INSTALL_DIR}
INSTALL_COMMAND ${CMAKE_COMMAND}
--build <BINARY_DIR> --config Debug
--target install-unified-runtime-libraries
CMAKE_CACHE_ARGS
-DCMAKE_BUILD_TYPE:STRING=Debug
-DCMAKE_INSTALL_PREFIX:STRING=<INSTALL_DIR>
# Enable d suffix on libraries
-DUR_USE_DEBUG_POSTFIX:BOOL=ON
# Don't build unnecessary targets in subbuild.
-DUR_BUILD_EXAMPLES:BOOL=OFF
-DUR_BUILD_TESTS:BOOL=OFF
-DUR_BUILD_TOOLS:BOOL=OFF
# Sanitizer layer is not supported on Windows.
-DUR_ENABLE_SYMBOLIZER:BOOL=OFF
# Inherit settings from parent build.
-DUR_ENABLE_TRACING:BOOL=${UR_ENABLE_TRACING}
-DUR_ENABLE_COMGR:BOOL=${UR_ENABLE_COMGR}
-DUR_BUILD_ADAPTER_L0:BOOL=${UR_BUILD_ADAPTER_L0}
-DUR_BUILD_ADAPTER_L0_V2:BOOL=${UR_BUILD_ADAPTER_L0_V2}
-DUR_BUILD_ADAPTER_OPENCL:BOOL=${UR_BUILD_ADAPTER_OPENCL}
-DUR_BUILD_ADAPTER_CUDA:BOOL=${UR_BUILD_ADAPTER_CUDA}
-DUR_BUILD_ADAPTER_HIP:BOOL=${UR_BUILD_ADAPTER_HIP}
-DUR_BUILD_ADAPTER_NATIVE_CPU:BOOL=${UR_BUILD_ADAPTER_NATIVE_CPU}
-DUMF_BUILD_EXAMPLES:BOOL=${UMF_BUILD_EXAMPLES}
-DUMF_BUILD_SHARED_LIBRARY:BOOL=${UMF_BUILD_SHARED_LIBRARY}
-DUMF_LINK_HWLOC_STATICALLY:BOOL=${UMF_LINK_HWLOC_STATICALLY}
-DUMF_DISABLE_HWLOC:BOOL=${UMF_DISABLE_HWLOC}
# Enable d suffix in UMF
-DUMF_USE_DEBUG_POSTFIX:BOOL=ON
)

# Copy the debug UR runtime libraries to <build>/bin & <build>/lib for use in
# the parent build, e.g. integration testing.
set(URD_COPY_FILES)
macro(urd_copy_library_to_build library shared)
if(${shared})
list(APPEND URD_COPY_FILES
${LLVM_BINARY_DIR}/bin/${library}.dll
)
add_custom_command(
OUTPUT
${LLVM_BINARY_DIR}/bin/${library}.dll
COMMAND ${CMAKE_COMMAND} -E copy
${URD_INSTALL_DIR}/bin/${library}.dll
${LLVM_BINARY_DIR}/bin/${library}.dll
)
endif()

list(APPEND URD_COPY_FILES
${LLVM_BINARY_DIR}/lib/${library}.lib
)
add_custom_command(
OUTPUT
${LLVM_BINARY_DIR}/lib/${library}.lib
COMMAND ${CMAKE_COMMAND} -E copy
${URD_INSTALL_DIR}/lib/${library}.lib
${LLVM_BINARY_DIR}/lib/${library}.lib
)
endmacro()

urd_copy_library_to_build(ur_loaderd "NOT;${UR_STATIC_LOADER}")
foreach(adatper ${SYCL_ENABLE_BACKENDS})
if(adapter MATCHES "level_zero")
set(shared "NOT;${UR_STATIC_ADAPTER_L0}")
else()
set(shared TRUE)
endif()
urd_copy_library_to_build(ur_adapter_${adatper}d "${shared}")
endforeach()
# Also copy umfd.dll/umfd.lib
urd_copy_library_to_build(umfd ${UMF_BUILD_SHARED_LIBRARY})

add_custom_target(unified-runtimed-build ALL DEPENDS ${URD_COPY_FILES})
add_dependencies(unified-runtimed-build unified-runtimed)

# Add the debug UR runtime libraries to the parent install.
install(
FILES ${URD_INSTALL_DIR}/bin/ur_loaderd.dll
DESTINATION "bin" COMPONENT unified-runtime-loader)
foreach(adapter ${SYCL_ENABLE_BACKENDS})
install(
FILES ${URD_INSTALL_DIR}/bin/ur_adapter_${adapter}d.dll
DESTINATION "bin" COMPONENT ur_adapter_${adapter})
add_dependencies(install-sycl-ur-adapter-${adapter} unified-runtimed)
endforeach()
if(UMF_BUILD_SHARED_LIBRARY)
# Also install umfd.dll
install(
FILES ${URD_INSTALL_DIR}/bin/umfd.dll
DESTINATION "bin" COMPONENT unified-memory-framework)
endif()
endif()

install(TARGETS umf
LIBRARY DESTINATION "lib${LLVM_LIBDIR_SUFFIX}" COMPONENT unified-memory-framework
ARCHIVE DESTINATION "lib${LLVM_LIBDIR_SUFFIX}" COMPONENT unified-memory-framework
Expand Down
11 changes: 6 additions & 5 deletions sycl/cmake/modules/SYCLUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ include(CheckLinkerFlag)
# add_stripped_pdb(TARGET_NAME)
#
# Will add option for generating stripped PDB file and install the generated
# file as ${ARG_TARGET_NAME}.pdb in bin folder.
# file as ${ARG_TARGET_NAME}{d}.pdb in bin folder.
# NOTE: LLD does not currently support /PDBSTRIPPED so the PDB file is optional.
macro(add_stripped_pdb ARG_TARGET_NAME)
check_linker_flag(CXX "LINKER:/PDBSTRIPPED:${ARG_TARGET_NAME}.stripped.pdb"
set(PDB_FILENAME "${ARG_TARGET_NAME}$<$<CONFIG:Debug>:d>")
check_linker_flag(CXX "LINKER:/PDBSTRIPPED:${PDB_FILENAME}.stripped.pdb"
LINKER_SUPPORTS_PDBSTRIPPED)
if(LINKER_SUPPORTS_PDBSTRIPPED)
target_link_options(${ARG_TARGET_NAME}
PRIVATE "LINKER:/PDBSTRIPPED:${ARG_TARGET_NAME}.stripped.pdb")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${ARG_TARGET_NAME}.stripped.pdb"
PRIVATE "LINKER:/PDBSTRIPPED:${PDB_FILENAME}.stripped.pdb")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PDB_FILENAME}.stripped.pdb"
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
RENAME "${ARG_TARGET_NAME}.pdb"
RENAME "${PDB_FILENAME}.pdb"
COMPONENT ${ARG_TARGET_NAME}
OPTIONAL)
endif()
Expand Down
Loading
Loading