Skip to content

[SYCL][Driver] Link with sycl libs at link step of clang-cl -fsycl #12793

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 1 commit into from
Feb 22, 2024

Conversation

againull
Copy link
Contributor

This PR is addressing the following scenario:
clang-cl -I[path to sycl headers] sycl_program.cpp # program compiled but without sycl libs
clang-cl -fsycl sycl_program.obj # user expects sycl libs to be linked automatically here.

Without this fix this scenario fails at link step because sycl libraries are not pulled in.

This scenario already works for clang driver, so only clang-cl needs a fix.

This PR is addressing the following scenario:
clang-cl -I[path to sycl headers] sycl_program.cpp # program compiled
but without sycl libs
clang-cl -fsycl sycl_program.obj # user expects sycl libs to be linked
automatically here.

Without this fix this scenario fails at link step because sycl libraries
are not pulled in.

This scenario already works for clang driver, so only clang-cl needs a fix.
@againull againull requested a review from a team as a code owner February 22, 2024 00:17
@againull
Copy link
Contributor Author

ESIMD/regression/complex-lib-lin.cpp failure unrelated and was seen on another PRs, e.g. #12367

@againull
Copy link
Contributor Author

againull commented Feb 22, 2024

Failed Tests (8):
  SYCL :: Assert/assert_in_kernels_win.cpp
  SYCL :: Assert/assert_in_multiple_tus_one_ndebug_win.cpp
  SYCL :: Assert/assert_in_multiple_tus_win.cpp
  SYCL :: Assert/assert_in_one_kernel_win.cpp
  SYCL :: Assert/assert_in_simultaneous_kernels_win.cpp
  SYCL :: Assert/assert_in_simultaneously_multiple_tus.cpp
  SYCL :: Assert/assert_in_simultaneously_multiple_tus_one_ndebug.cpp
  SYCL :: Plugin/sycl-ls-unified-runtime.cpp

These tests are also failing in #12367 and #12783 and are unrelated to this PR.

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. I could imagine scenarios where the object is built with -fpreview-breaking-changes but the option is not used during the link (or vice-versa) causing different sycl libs to be linked in. Is there anything we can do about that?

@againull againull merged commit d6eecfa into intel:sycl Feb 22, 2024
@againull
Copy link
Contributor Author

LGTM. I could imagine scenarios where the object is built with -fpreview-breaking-changes but the option is not used during the link (or vice-versa) causing different sycl libs to be linked in. Is there anything we can do about that?

Oh, good question, I don't have quick ideas, will need to try experiment locally.

againull added a commit to againull/llvm that referenced this pull request Apr 9, 2024
@againull againull deleted the clang_cl_linking_issue branch April 9, 2024 19:56
againull added a commit that referenced this pull request Apr 9, 2024
…fsycl (#12793)" (#13326)

This reverts commit d6eecfa.

This was commit was trying to cover the scenario:
```
clang-cl -I[path to sycl headers] sycl_program.cpp 
clang-cl -fsycl sycl_program.obj
```
and automatically link with sycl library at link step in such case.

But problem is that at link step there is no way to know if -fsycl -MDd
option was used at compile step or not.
if -fsycl -MDd is used at compilation step then driver adds
--dependent-lib=msvcrtd --dependent-lib=sycl7d options:
`clang-cl -fsycl -MDd sycl_program.cpp # --dependent-lib=msvcrtd
--dependent-lib=sycl7d`
If then user links the program like this (without  -MDd):
`clang-cl -fsycl sycl_program.obj` then we will also link with sycl7
library (release version) which will cause a problem.
Because at link step we don't know if we need to use debug of release
version of the library.


So, from my understanding this case:
```
clang-cl -I[path to sycl headers] sycl_program.cpp 
clang-cl -fsycl sycl_program.obj
```
can't be supported and needs to be considered as user's mistake.
dm-vodopyanov added a commit to dm-vodopyanov/llvm that referenced this pull request Apr 24, 2024
dm-vodopyanov added a commit that referenced this pull request Apr 24, 2024
Patch which causes the regression:
#12793
Revert of that patch: #13326
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.

2 participants