Skip to content

[SYCL][UR] Add Windows debug libs to install target #17512

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

Conversation

kbenzie
Copy link
Contributor

@kbenzie kbenzie commented Mar 18, 2025

  1. Add install target for Windows debug libs called install-unified-runtime-libraries which installs only the runtime library subset of targets. This can be used to provide ur_loaderd.dll and ur_adatper_<name>d.dll which link against the multithreaded debug DLL C runtime by using the DEBUG_POSTFIX target property to append d to the library names.
  2. Add UR_USE_DEBUG_POSTFIX option to enable adding the d suffix to library names.
  3. Remove setting redundant OUTPUT_NAMEs as combining DEBUG_POSTFIX=d and then setting LIBRARY_OUTPUT_NAME/RUNTIME_OUTPUT_NAME exposes a bug in CMake where the DEBUG_POSTFIX is ignored for the ur_loader.dll. Removing these redundant property setters fixed the previous issue.
  4. Add debug UR subbuild on Windows ExternalProject compiled in debug mode and with the UR_USE_DEBUG_POSTFIX option enabled.
    • The resulting libraries are then copied to the <build>/bin/<build>/lib directories so they can be used in testing (not yet implemented).
    • Additionally, they are also included in the deploy-sycl-toolchain install target alongside the normally named runtime libraries.
  5. Update ur_proxy_loaderd.dll to use Windows debug libs

@kbenzie kbenzie force-pushed the benie/ur-debug-lib-suffix branch from 8a462bf to 3c4e12e Compare March 20, 2025 14:45
@kbenzie kbenzie force-pushed the benie/ur-debug-lib-suffix branch from 613d83b to a448455 Compare March 20, 2025 17:44
@kbenzie kbenzie marked this pull request as ready for review March 21, 2025 10:44
@kbenzie kbenzie requested review from a team as code owners March 21, 2025 10:44
Copy link
Contributor Author

@kbenzie kbenzie left a comment

Choose a reason for hiding this comment

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

@bratpiorka as mentioned in my last email, here's where to hook in the UMF debug postfix option and copy/install the library to the relevant places.

-DUMF_LINK_HWLOC_STATICALLY:BOOL=${UMF_LINK_HWLOC_STATICALLY}
-DUMF_DISABLE_HWLOC:BOOL=${UMF_DISABLE_HWLOC}
# TODO: Enable d suffix in UMF
# -DUMF_USE_DEBUG_POSTFIX=ON
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Enable building umfd.dll/umfd.lib in the UR subbuild.

urd_copy_library_to_build(ur_adapter_${adatper}d)
endforeach()
# TODO: Also copy umfd.dll/umfd.lib
# urd_copy_library_to_build(umfd)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy umfd.dll/umfd.lib into the parent <build>/bin/<build>/lib directories for use in testing.

Comment on lines +418 to +424
# TODO: Also install umfd.dll/umfd.lib
# install(
# FILES ${URD_INSTALL_DIR}/bin/umfd.dll
# DESTINATION "bin" COMPONENT unified-memory-framework)
# install(
# FILES ${URD_INSTALL_DIR}/lib/umfd.lib
# DESTINATION "lib${LLVM_LIBDIR_SUFFIX}" COMPONENT unified-memory-framework)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add umfd.dll/umfd.lib to the install target.

Comment on lines +236 to +239
-P ${CMAKE_BINARY_DIR}/cmake_install.cmake
# TODO: Also install debug UMF runtime libraries component
DEPENDS unified-runtime-libraries
# TODO: Add dependency on building debug UMF libraries
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add command to install only umfd.dll/umfd.lib, we don't want a full install here since we only care about the runtime libraries being installed with the debug postfix.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I'll test this today.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is mostly working, I've commented on the PR with one issue.

@kbenzie kbenzie changed the title [UR] Add install target for Windows debug libs [SYCL][UR] Add Windows debug libs to install target Mar 21, 2025
kbenzie added 2 commits March 21, 2025 11:33
This patch adds the `install-unified-runtime-libraries` target which
installs only the runtime library subset of targets. This can be used to
provide `ur_loaderd.dll` and `ur_adatper_<name>d.dll` which link against
the multithreaded debug DLL C runtime by using the `DEBUG_POSTFIX`
target property to append `d` to the library names.
Instead of implicitly adding the `d` suffix to library names make this
optional. `DEBUG_POSTFIX` appears to be broken on Windows, the place
it's most useful, as `urinfo.exe` still attempts to load `ur_loader.dll`
when it should be looking for `ur_loaderd.dll`. Switching this over to
`OUTPUT_NAME ${name}d` fixes this.
kbenzie added 4 commits March 21, 2025 11:33
Looks like combining `DEBUG_POSTFIX=d` and then setting
`LIBRARY_OUTPUT_NAME`/`RUNTIME_OUTPUT_NAME` exposes a bug in CMake where
the `DEBUG_POSTFIX` is ignored for the `ur_loader.dll`. Removing these
redundant propert setters fixed the previous issue.
Using ExternalProject this commit adds a subbuild of UR in compiled in
debug mode and with the `UR_USE_DEBUG_POSTFIX` option enabled. The
resulting libraries are then copied to the `<build>/bin`/`<build>/lib`
directories so they can be used in testing (not yet implemented).
Additionally, they are also included in the `deploy-sycl-toolchain`
install target alongside the normally named runtime libraries.
@kbenzie kbenzie force-pushed the benie/ur-debug-lib-suffix branch from a448455 to 468c07c Compare March 21, 2025 11:35
--build <BINARY_DIR>
--target install-unified-runtime-libraries
CMAKE_CACHE_ARGS
-DCMAKE_BUILD_TYPE:STRING=Debug
Copy link
Contributor

Choose a reason for hiding this comment

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

Windows generators might ignore CMAKE_BUILD_TYPE. Consider using a cmake argument --config Debug instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That would need to be included in the install command?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, in the install command add: --config Debug. And perhaps leave -DCMAKE_BUILD_TYPE:STRING=Debug here as well, just for the case where Unix Makefiles generator is used on Windows.

Copy link
Contributor

@steffenlarsen steffenlarsen left a comment

Choose a reason for hiding this comment

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

Looks reasonable to me, but I would like to also hear @cperkinsintel thoughts on this.

@PatKamin
Copy link
Contributor

There is a PR with requested changes in UMF if you would like to test them: oneapi-src/unified-memory-framework#1219

@steffenlarsen
Copy link
Contributor

@kbenzie - Is this ready to go in (after a conflict resolution?)

@kbenzie
Copy link
Contributor Author

kbenzie commented Apr 16, 2025

@kbenzie - Is this ready to go in (after a conflict resolution?)

It needs to pull in the UMF changes which I've not tested yet due a few high priority bug reports that have come in this week.

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