Skip to content

[Driver][SYCL] Improve way sycld is pulled in for Linux based Windows… #6974

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 4 commits into from
Oct 7, 2022

Conversation

mdtoguchi
Copy link
Contributor

… driver

Update the way sycld is pulled in by matching if msvcrtd is brought in via the command line. Cmake uses '-Xclang --dependent-lib=msvcrtd' when there is the desire to link in with the debug libraries. Check for this and use an equivalent '--dependent-lib=sycld' to pull in the SYCL runtime library.

This is only done for the Linux based drivers on Windows. The MSVC based driver behavior already pulls in the proper libraries given /MDd.

… driver

Update the way sycld is pulled in by matching if msvcrtd is brought in
via the command line.  Cmake uses '-Xclang --dependent-lib=msvcrtd' when
there is the desire to link in with the debug libraries.  Check for this
and use an equivalent '--dependent-lib=sycld' to pull in the SYCL runtime
library.

This is only done for the Linux based drivers on Windows.  The MSVC based
driver behavior already pulls in the proper libraries given /MDd.
@mdtoguchi mdtoguchi requested a review from npmiller October 5, 2022 21:09
@mdtoguchi mdtoguchi requested a review from a team as a code owner October 5, 2022 21:09
@densamoilov
Copy link

Does SYCL library on Windows for open-source compiler include version in its name?

@mdtoguchi
Copy link
Contributor Author

Does SYCL library on Windows for open-source compiler include version in its name?

@densamoilov, it was introduced here: #6745

CmdArgs.push_back("-defaultlib:sycl" SYCL_MAJOR_VERSION "d.lib");
else
CmdArgs.push_back("-defaultlib:sycl" SYCL_MAJOR_VERSION ".lib");
CmdArgs.push_back("-defaultlib:sycl" SYCL_MAJOR_VERSION ".lib");
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 we need to skip this when --dependent-lib=sycld is set.

I've tried the patch with a Debug build using the CMake module and it crashed with debug mismatches. It seems that --dependent-lib is handled by clang and -defaultlib is passed to link.exe so it ends up still picking up the release SYCL library.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The same can be said about the addition of -defaultlib:msvcrt, as it would override the user setting as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes but in the case of the CMake module it uses -nostdlib before passing -Xclang --dependent-lib=msvcrtd so -defaultlib:msvcrt doesn't get added in the toolchain.

The SYCL library currently doesn't respect -nostdlib (see: #6699 ), so if we implicitly add --dependent-lib=sycld we also need to avoid adding -defaultlib:sycld.

@mdtoguchi
Copy link
Contributor Author

Failures are not related to my change. @intel/llvm-gatekeepers, ok for merge?

@pvchupin pvchupin merged commit ebf6c59 into intel:sycl Oct 7, 2022
@mdtoguchi mdtoguchi deleted the improved-sycld-inclusion branch October 7, 2022 18:05
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.

5 participants