-
Notifications
You must be signed in to change notification settings - Fork 769
[SYCL] Warning if use sycl without dynamic C++ RT on Windows #2501
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
[SYCL] Warning if use sycl without dynamic C++ RT on Windows #2501
Conversation
/summary:run |
@@ -1,5 +1,3 @@ | |||
// RUN: %clangxx %s -o %t1.out -lsycl -I %sycl_include |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we prohibit use of the compile to build C++ code? Otherwise we do not need to remove this code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This command compiles a test with static C++ RT on Windows, which causes an assert in stl.hpp
(the assert is added in this PR).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vladimir, Do you have good ideas on how to allow such compilation on Linux (where default C++ RT is dynamic) and not allow on Windows without -fsycl (where default C++ RT is static)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have OS specific placehoders for OpenCL CPU: https://github.com/intel/llvm/blob/sycl/sycl/test/lit.cfg.py#L144
You can have some general LINUX placeholder to run the compilation only on Linux.
But it is not perfect solution so I will not insist on implementing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not find any good way to detect if the compilation runs with -fsyntax-only or without it.
@@ -1,4 +1,4 @@ | |||
// RUN: %clangxx -fsyntax-only -Xclang -verify %s -I %sycl_include -Xclang -verify-ignore-unexpected=note,warning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need to change this test as it is compile-time check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new static_assert at stl.hpp is emitted on Windows when a) user does not use -fsycl and b) when such compilation would potentially lead to linking with static RT.
I will check if there is any difference in compilation macros with/with -fsyntax-only and if that difference usable in stl.hpp to not give an error with -fsyntax-only.
@v-klochkov, could you resolve merge conflicts and address comments from @romanovvlad, please? |
f875ed0
to
a132f41
Compare
…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 <[email protected]>
a132f41
to
47e9ed2
Compare
sycl/include/CL/sycl/stl.hpp
Outdated
// which is not guaranteed to work and considered not safe in general. | ||
// Only using same dynamic C++ runtime library for sycl[d].dll and for | ||
// the application using sycl[d].dll is guaranteed to work properly. | ||
inline constexpr bool isMSVCDynamicCXXRuntime() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
constexpr
implies inline
inline constexpr bool isMSVCDynamicCXXRuntime() { | |
constexpr bool isMSVCDynamicCXXRuntime() { |
Signed-off-by: Vyacheslav N Klochkov <[email protected]>
…md_stl_static_assert
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sycl/test/esimd/vadd.cpp LGTM.
3 or 4 failed tests from the Jenkins/Precommit use separate compilation, e.g.: Such usage model caused the hit of the new static_assert (added in this PR). In short terms it makes sense replacing "static_assert()" with '#pragma message()". |
Signed-off-by: Vyacheslav N Klochkov <[email protected]>
…md_stl_static_assert
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes in sycl/test/esimd/vadd.cpp
LGTM
@@ -1,5 +1,4 @@ | |||
// TODO ESIMD enable host device under -fsycl | |||
// RUN: %clangxx -I %sycl_include %s -o %t.out -lsycl | |||
// RUN: %clangxx -fsycl %s -o %t.out |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for not catching it, but there is a regression for this test. BTW, I'm not sure how it slipped through the CI.
This test fails with:
InvalidFunctionCall: Unexpected llvm intrinsic:
llvm.genx.local.id.v3i32 [Src: /iusers/dbakhval/github/llvm/llvm-spirv/lib/SPIRV/SPIRVWriter.cpp:2782 false ]
As of today, we still require -fsycl-explicit-simd
flag for ESIMD code. I submitted #3457 to fix this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, I'm not sure how it slipped through the CI.
This casts shadow on CI validation and ESIMD feature validation in particular. @DenisBakhvalov, could you investigate why this regression happened, please? Could it be a conflict between commits?
…-patch [L0] Fixes potential overwrite in ZeEventPoolDesc.pNext
[L0] Fixes potential overwrite in ZeEventPoolDesc.pNext
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 [email protected]