-
Notifications
You must be signed in to change notification settings - Fork 769
[CMake] Disable STL-internal assertions in device code #7236
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
Conversation
Before:
|
8f565ab
to
ffae919
Compare
Looks reasonable. @pvchupin | @cperkinsintel - If we merge this, should we enable the option for some CI configurations? |
On Thu Dec 1, 2022 at 10:04 PM GMT, Pavel Chupin wrote:
@ldrumm, I think #7483 could address
this problem.
It looks like this might address the specific problem in this specific version
of libstdc++, but I think the present patch should be merged as well; it's
simply not a tenable, nor a good user experience to try and put out these fires
every time libstdc++ updates.
I doubt most people building dpc++ in debug configuration care about what's
going on in the system standard library. If they do, they will be knowledgable
engought to opt-in. The converse is not true.
Can you check?
Yes.
Same behaviour:
```
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/array:208:2: error: SYCL kernel cannot call an undefined function without SYCL_EXTERNAL attribute
__glibcxx_requires_subscript(__n);
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/debug/assertions.h:52:3: note: expanded from macro '__glibcxx_requires_subscript'
__glibcxx_assert(_N < this->size())
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/x86_64-linux-gnu/c++/12/bits/c++config.h:588:8: note: expanded from macro '__glibcxx_assert'
do { __glibcxx_assert_impl(cond); } while (false)
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/x86_64-linux-gnu/c++/12/bits/c++config.h:573:10: note: expanded from macro '__glibcxx_assert_impl'
std::__glibcxx_assert_fail(__FILE__, __LINE__, __PRETTY_FUNCTION__, \
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/x86_64-linux-gnu/c++/12/bits/c++config.h:564:3: note: '__glibcxx_assert_fail' declared here
__glibcxx_assert_fail(const char* __file, int __line,
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/array:206:7: note: called by 'operator[]'
operator[](size_type __n) noexcept
^
What GCC version do you have in the system?
```shell-session
$ gcc --version
gcc (Debian 12.2.0-9) 12.2.0
```
|
Would it disable it from both host and device compilation? Ideally, we'd like to do that for device only. |
Looks like the root cause is in assert implementation that was implemented in libstdc++11 in a header as inline function with builtins:
and in libstdc++ 12 it is a library call:
which is basically:
I agree that it makes sense to shut it down for device code only. |
I've dug around a bit today, and see that this macro is only used by being appended to I can't think of a way to enable it only for device code without putting logic in the driver to strip it off (and maybe warn) which I don't feel right about - especially when its value is questionable. This might be like saying "we've never had to use that fire extinguisher so let's get rid of it", but: has this ever caught an error in how the C++ standard libraries are used? The more I look at it, the more I question whether it should exist at all. So I'm happy to disable it by default, or delete all references, but I'm not happy about specializing it when it's only used by lit tests |
:) Good question. We need to figure out next steps. It will hit us on the next OS uplift anyway. |
What exactly are we talking about here? Testing approach or libstdc++ support? |
Both.
|
Why do we want to turn it off? I understand that it fails with libstdc++12, but we have a test that tells us about it. That's exactly what we added test for. I think the right course of actions is to fix compilation for libstdc++12. |
How? |
Allow calls on device to __glibcxx-prefixed routines? |
So we will simply fail at JIT stage instead of compilation stage? For LIT tests that's probably not an issue, but do we really want to tweak our FE simply to support our unit-tests and moreover their host part? I would suggest that we simply set this macro only for host compilation but not for device: this way RT folks will have instrumentations which helps during analysis/debugging/development but at the same time we won't be forced to deal with new built-ins or unsupported constructs coming from new versions of headers which we don't control. |
I don't think there is a good protection from potential issues new versions of libstdc++ might bring. I thought our strategy is reactive i.e. enable new versions by implementing missing compiler built-ins for GPU. Tagging @jinge90. |
This issue is currently observed at https://github.com/intel/llvm/actions/runs/3753931926/jobs/6377676704 and blocking #7671 |
It seems we're split on this. I personally think changing the default and then having those who care otherwise pass the cmake switch during their own configure to be a reasonable compromise. As Pavel notes: this is causing blocking issues right now. I think we should merge the present patch, and if anyone has better ideas for solving this in a clean way in-general they can come back to it later |
What's the current state of things here? Both viewpoints are valid, but I'd like people to remain pragmatic and understand that if you need the old behaviour you can simply flip the switch, but for new users it's a big barrier to actually using SYCL on newer machines. Would it satisfy the "no"s in the room if I ensure that the buildbots re-enable this flag for CI? |
I think @bader and @sergey-semenov (plus maybe @steffenlarsen) have to make the decision. |
I'm okay with merging this PR to unblock #7671, but we need to file an issue to enable assertions back. |
Agreed. |
@ldrumm, are pre-commit failures related to the change? Could you also open an issue to re-enable assertions, please? |
I suggest you merge the tip of the sycl branch to re-run testing. The latest results are 1.5 months old, so we probably should get recent results before doing the analysis. |
SYCL_DISABLE_STL_ASSERTIONS=ON Unless we maintain our own STL for SYCL we can't know the visibility of the internal assertion mechanism of libstdc++ and friends. This caused random-looking build failures in device code for which we have no reliable method of avoision when I adopted gcc12.2.
ffae919
to
30444db
Compare
There is only one failure, which is known issue, so this PR is ready to go. Failed Tests (1): |
SYCL_DISABLE_STL_ASSERTIONS=ON
Unless we maintain our own STL for SYCL we can't know the visibility of the internal assertion mechanism of libstdc++ and friends.
This caused random-looking build failures in device code for which we have no reliable method of avoision when I adopted gcc12.2.