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 44 commits into
base: sycl
Choose a base branch
from

Conversation

steffenlarsen
Copy link
Contributor

@steffenlarsen steffenlarsen commented Apr 25, 2025

Currently the SYCL library and its constituents build both a release build and a debug build (/MDd) on Windows, no matter what the build type is. This PR changes the build to only build in the mode specified by the CMAKE_BUILD_TYPE, meaning that packaging of release builds must build both explicitly and copy the files into the packages.

To allow parity with old builds, the -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL can be used during configuration to use the debug UCRT in release mode, generating "d"-suffixed libraries. This can also be controlled in the configure.py script using the --use-debug-crt-dll option.

Additionally, this PR adds a new test that checks that library files in build mode all have the required postfix ("d" or "d-preview") when they link with Windows debug URCT, and the release variant if not.

Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
@@ -55,9 +55,6 @@ if (NOT DEFINED LEVEL_ZERO_LIBRARY OR NOT DEFINED LEVEL_ZERO_INCLUDE_DIR)
# Prevent L0 loader from exporting extra symbols
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS OFF)

set(CMAKE_MSVC_RUNTIME_LIBRARY_BAK "${CMAKE_MSVC_RUNTIME_LIBRARY}")
# UMF has not yet been able to build as static
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kbenzie - Do you know if this is still a problem? I was able to build in static configuration locally without any issues.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's a question for a UMF maintainer @bratpiorka

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what is behind this comment, but since everything is working now, that's great

endif()
if (SYCL_ENABLE_XPTI_TRACING)
target_link_libraries(${LIB_NAME} PRIVATE ${CMAKE_DL_LIBS})
target_link_libraries(${LIB_TARGET_NAME} PRIVATE ${CMAKE_DL_LIBS})
endif()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l201. should it be LIB_TARGET_NAME too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! Good catch.

# Version-agnostic name of the import library, has effect on Windows only.
set(IMPLIB_NAME "sycl")
set(IMPLIB_PREVIEW_NAME "${IMPLIB_NAME}-preview")
if (CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_MSVC_RUNTIME_LIBRARY STREQUAL MultiThreadedDebugDLL)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we not have "if (WIN32)" or similar check here because we apply this setting in add_sycl_rt_library for windows only? can we just set IMPLIB_* vars at l348 and do changes in the win path together with other name related vars?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we not have "if (WIN32)" or similar check here because we apply this setting in add_sycl_rt_library for windows only?

Exactly!

can we just set IMPLIB_* vars at l348 and do changes in the win path together with other name related vars?

We could, e.g. by moving the first sets here to before the if (WIN32), but it does make the fact that this just appends a d to the names a little less obvious. If you think it is better I will happily do it though. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants