Skip to content

[SYCL][Driver] Make /MD default with -fsycl for clang/clang++ drivers #2480

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 14 commits into from
Sep 20, 2020

Conversation

v-klochkov
Copy link
Contributor

… RT on win

SYCL library is designed such a way that STL objects must cross the sycl.dll
boundary, which is guaranteed to work safe on Windows only if the runtime
in the app using sycl.dll and in sycl.dll is the same and is dynamic.

It is not possible to implement safe approach for using sycl libraries
built/linked with static C++ RT as it would cause having multiple copies
of C++ objects (such as scheduler, etc), which are supposed to be
singletones.

This check reports a compile-time error when user tries to compile
the application using sycl.dll with /MT or /MTd switches implying
using static C++ runtime libcmt[d].lib.

sycl.dll is built with /MD and sycld.dll is built with /MDd.
Thus /MD and /MDd are allowed, and /MT /MTd switches are prohibited now.

@v-klochkov v-klochkov requested a review from a team as a code owner September 16, 2020 04:53
@v-klochkov
Copy link
Contributor Author

I uploaded the changes for early review. The patch depends on the patch #2478 being in code-review right now. Without #2478, the most of LIT tests will fail, but will pass after re-base with #2478.

Early comments are really appreciated though.

… RT on win

SYCL library is designed such a way that STL objects must cross the sycl.dll
boundary, which is guaranteed to work safe on Windows only if the runtime
in the app using sycl.dll and in sycl.dll is the same and is dynamic.

It is not possible to implement safe approach for using sycl libraries
built/linked with static C++ RT as it would cause having multiple copies
of C++ objects (such as scheduler, etc), which are supposed to be
singletones.

This check reports a compile-time error when user tries to compile
the application using sycl.dll with /MT or /MTd switches implying
using static C++ runtime libcmt[d].lib.

sycl.dll is built with /MD and sycld.dll is built with /MDd.
Thus /MD and /MDd are allowed, and /MT /MTd switches are prohibited now.
@v-klochkov v-klochkov force-pushed the public_vklochkov_syclmtd_dll branch from a817cba to 6d87519 Compare September 16, 2020 05:00
That is odd that clang-format required me to do fixes that I did not
really touch (only had changed preceding the problem places).
Copy link
Contributor

@romanovvlad romanovvlad left a comment

Choose a reason for hiding this comment

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

LGTM

alexbatashev
alexbatashev previously approved these changes Sep 16, 2020
Copy link
Contributor

@alexbatashev alexbatashev left a comment

Choose a reason for hiding this comment

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

Did you run clang format on this file? I see a lot of unrelated changes. I don’t mind committing them now, though.

@v-klochkov
Copy link
Contributor Author

v-klochkov commented Sep 16, 2020

Did you run clang format on this file? I see a lot of unrelated changes. I don’t mind committing them now, though

No )) I did not want fixing clang-format for the rest of the file, but 'clang-format-check' buildbot required me to do that by reporting an error for the lines that I did not even touch.

@v-klochkov
Copy link
Contributor Author

@mdtoguchi
I needed to do an additional fix for clang++ driver to to make /MD default with -fsycl. It is similar to changes for clang-cl that you did here: #2478

@v-klochkov
Copy link
Contributor Author

The new static_assert in sycl/stl.hpp causes many fails in LIT tests and requires elaborate fixes in LIT tests + maybe adding back-door macro disabling the static_assert.

That is why I am going to keep in only clang driver changes in this PR
and move the static_assert + LIT tests into a separate PR.

@v-klochkov v-klochkov changed the title [SYCL] Add a static_assert/check that app and sycl use consistent C++… [SYCL][Driver] Make /MD default with -fsycl for clang/clang++ drivers Sep 18, 2020
mdtoguchi
mdtoguchi previously approved these changes Sep 18, 2020
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

Otherwise, the errors reported during device code compilation because
device code cannot handle implib call.
@v-klochkov v-klochkov merged commit 8735bb8 into intel:sycl Sep 20, 2020
@v-klochkov v-klochkov deleted the public_vklochkov_syclmtd_dll branch September 20, 2020 05:06
v-klochkov added a commit to v-klochkov/llvm that referenced this pull request Mar 26, 2021
…t -fsycl

With -fsycl switch the dynamic runtime is used.
The patches (intel#2478, intel#2480, intel#2497 implemented that with -fsycl.

This patch adds check that dynamic runtime is used when -fsycl is
not used. That is done by a static_assert in sycl/stl.hpp.

Also, lots of LIT tests had to be changed to comply with the new
requirement (apps must use dynamic C++ RT with use SYCL).

Signed-off-by: Vyacheslav N Klochkov <vyacheslav.n.klochkov@intel.com>
v-klochkov added a commit that referenced this pull request Mar 31, 2021
With -fsycl switch the dynamic runtime is used.
The patches (#2478, #2480, #2497 implemented that with -fsycl.

Applications using sycl headers and linked with sycl[d].dll must be linked
with dynamic C++ runtime on Windows even if compiled without -fsycl.
This patch adds a compile time warning emitted when wrong C++ runtime is used.

Signed-off-by: Vyacheslav N Klochkov <vyacheslav.n.klochkov@intel.com>
jsji pushed a commit that referenced this pull request Apr 4, 2024
Add logic to emit only one global variable when both SPIRV builtin and OCL builtin variants are present in the source code.

Signed-off-by: Arvind Sudarsanam <arvind.sudarsanam@intel.com>

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@2a247a49eddbc8f
kbenzie added a commit to kbenzie/intel-llvm that referenced this pull request Feb 17, 2025
Chenyang-L pushed a commit that referenced this pull request Feb 18, 2025
Use UMF CUDA memory provider in UR
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.

4 participants