Skip to content

[SYCL][libdevice] Support std::__glibcxx_assert_fail in device code #18527

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
May 22, 2025

Conversation

jinge90
Copy link
Contributor

@jinge90 jinge90 commented May 19, 2025

GCC-15 introduced std::__glibcxx_assert_fail whose behavior is similar to normal assert. It is used extensively by libstdc++ to do some runtime check in some STL items such as std::array when "-O0" is used. We handle it in the same way as normal assert by calling __devicelib_assert_fail provide by IGC.

@jinge90 jinge90 requested a review from a team as a code owner May 19, 2025 05:48
@jinge90 jinge90 requested a review from slawekptak May 19, 2025 05:48
@jinge90 jinge90 temporarily deployed to WindowsCILock May 19, 2025 05:56 — with GitHub Actions Inactive
jinge90 added 2 commits May 19, 2025 14:15
GCC-15 introduced std::__glibcxx_assert_fail whose behavior is similar to normal assert.
It is used extensively by libstdc++ to do some runtime check in some STL items such as std::array when "-O0" is used.
We handle it in the same way as normal assert by calling __devicelib_assert_fail provide by IGC.

Signed-off-by: jinge90 <[email protected]>
Signed-off-by: jinge90 <[email protected]>
@jinge90 jinge90 temporarily deployed to WindowsCILock May 19, 2025 06:27 — with GitHub Actions Inactive
@jinge90 jinge90 temporarily deployed to WindowsCILock May 19, 2025 06:27 — with GitHub Actions Inactive
Copy link
Contributor

@slawekptak slawekptak left a comment

Choose a reason for hiding this comment

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

SYCL changes LGTM

@jinge90 jinge90 temporarily deployed to WindowsCILock May 20, 2025 14:55 — with GitHub Actions Inactive
@jinge90 jinge90 temporarily deployed to WindowsCILock May 20, 2025 15:31 — with GitHub Actions Inactive
@jinge90 jinge90 temporarily deployed to WindowsCILock May 20, 2025 15:31 — with GitHub Actions Inactive
@jinge90 jinge90 temporarily deployed to WindowsCILock May 21, 2025 08:14 — with GitHub Actions Inactive
@jinge90 jinge90 temporarily deployed to WindowsCILock May 21, 2025 08:54 — with GitHub Actions Inactive
@jinge90 jinge90 temporarily deployed to WindowsCILock May 21, 2025 08:54 — with GitHub Actions Inactive
@jinge90
Copy link
Contributor Author

jinge90 commented May 22, 2025

Hi, @intel/llvm-gatekeepers
Could you help merge this PR?
Thanks very much.

@jinge90 jinge90 requested a review from a team May 22, 2025 01:48
@steffenlarsen steffenlarsen merged commit 983a865 into intel:sycl May 22, 2025
24 checks passed
@pbalcer
Copy link
Contributor

pbalcer commented May 22, 2025

This broke our perf CI:

FAILED: lib/libsycl-crt.new.o /home/test-user/actions-runners/ur_01/_work/unified-runtime/unified-runtime/sycl_build/lib/libsycl-crt.new.o 
cd /home/test-user/actions-runners/ur_01/_work/unified-runtime/unified-runtime/sycl_build/tools/libdevice && /home/test-user/actions-runners/ur_01/_work/unified-runtime/unified-runtime/sycl_build/bin/clang-21 -I /home/test-user/actions-runners/ur_01/_work/unified-runtime/unified-runtime/sycl_build/include -Wno-sycl-strict -Wno-undefined-internal -sycl-std=2020 --target=x86_64-unknown-linux-gnu -fsycl -c --offload-new-driver -foffload-lto=thin -fsycl-targets=spir64_x86_64-unknown-unknown,spir64_gen-unknown-unknown,spir64-unknown-unknown,spirv64-unknown-unknown -fsycl -c --offload-new-driver -foffload-lto=thin -fsycl-targets=spir64_x86_64-unknown-unknown,spir64_gen-unknown-unknown,spir64-unknown-unknown,spirv64-unknown-unknown /home/test-user/actions-runners/ur_01/_work/unified-runtime/unified-runtime/sycl-repo/libdevice/crt_wrapper.cpp -o /home/test-user/actions-runners/ur_01/_work/unified-runtime/unified-runtime/sycl_build/./lib/libsycl-crt.new.o
/home/test-user/actions-runners/ur_01/_work/unified-runtime/unified-runtime/sycl-repo/libdevice/crt_wrapper.cpp:135:6: error: '__glibcxx_assert_fail' is missing exception specification 'noexcept'
  135 | void __glibcxx_assert_fail(const char *file, int line, const char *func,
      |      ^
  136 |                            const char *cond) {
      |                                              noexcept
/usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/x86_64-linux-gnu/c++/14/bits/c++config.h:[579](https://github.com/oneapi-src/unified-runtime/actions/runs/15181703744/job/42692398118#step:10:580):3: note: previous declaration is here
  579 |   __glibcxx_assert_fail /* Called when a precondition violation is detected. */
      |   ^
1 error generated.

https://github.com/oneapi-src/unified-runtime/actions/runs/15181703744/job/42692398118

$ gcc --version
gcc (Ubuntu 14.2.0-4ubuntu2) 14.2.0

@pbalcer
Copy link
Contributor

pbalcer commented May 22, 2025

ping @jinge90

KornevNikita pushed a commit that referenced this pull request May 27, 2025
…18527)

GCC-15 introduced std::__glibcxx_assert_fail whose behavior is similar
to normal assert. It is used extensively by libstdc++ to do some runtime
check in some STL items such as std::array when "-O0" is used. We handle
it in the same way as normal assert by calling __devicelib_assert_fail
provide by IGC.

---------

Signed-off-by: jinge90 <[email protected]>
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