Skip to content

[SYCL][Windows] Improve windows sycl.lib linking #6699

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

Merged
merged 2 commits into from
Sep 8, 2022

Conversation

npmiller
Copy link
Contributor

@npmiller npmiller commented Sep 5, 2022

This patch does two things, first it makes -fsycl ignore -nostdlib
when linking the SYCL library. This is necessary because for Clang on
Windows CMake will generate link commands using -nostdlib and
explicitly list the system libraries, but of course it doesn't do it for
SYCL, so we currently end up never linking the SYCL library when this is
used.

Ignoring -nostdlib for -fsycl on Windows seems like a reasonnable
solution for this as this is also what is done for the OpenMP runtime
libraries.

See the CMake module:

In addition this patch also adds a linker parameter to help clang find
the sycl.lib file without requiring users to tweak their environments
to link against it.

@npmiller npmiller requested a review from a team as a code owner September 5, 2022 16:15
This patch does two things, first it makes `-fsycl` ignore `-nostdlib`
when linking the SYCL library. This is necessary because for Clang on
Windows CMake will generate link commands using `-nostdlib` and
explicitly list the system libraries, but of course it doesn't do it for
SYCL, so we currently end up never linking the SYCL library when this is
used.

Ignoring `-nostdlib` for `-fsycl` on Windows seems like a reasonnable
solution for this as this is also what is done for the OpenMP runtime
libraries.

See the CMake module:
* https://github.com/Kitware/CMake/blob/aa2de7cd2a04699744a224ab84e0ca483559c5d3/Modules/Platform/Windows-Clang.cmake#L79

In addition this patch also adds a linker parameter to help clang find
the `sycl.lib` file without requiring users to tweak their environments
to link against it.
Copy link
Contributor

@mdtoguchi mdtoguchi left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

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.

3 participants