Skip to content

Commit 7ebd97b

Browse files
authoredJul 26, 2024
[OpenMP] Do not define '__assert_fail' if we have the GPU libc (#100409)
Summary: The C library is intended to provide `__assert_fail`, so in the cases that we have both we should defer to that. This means that if you build the C library for GPUs you'll get the RPC based asser, and if not you'll get the trap based one.
1 parent 745aa48 commit 7ebd97b

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed
 

‎offload/DeviceRTL/src/Debug.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,13 @@ using namespace ompx;
2626
extern "C" {
2727
void __assert_assume(bool condition) { __builtin_assume(condition); }
2828

29+
#ifndef OMPTARGET_HAS_LIBC
2930
[[gnu::weak]] void __assert_fail(const char *expr, const char *file,
3031
unsigned line, const char *function) {
3132
__assert_fail_internal(expr, nullptr, file, line, function);
3233
}
34+
#endif
35+
3336
void __assert_fail_internal(const char *expr, const char *msg, const char *file,
3437
unsigned line, const char *function) {
3538
if (msg) {

‎offload/test/libc/assert.c

-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
// RUN: %fcheck-generic --check-prefix=CHECK
33

44
// REQUIRES: libc
5-
6-
// AMDGPU and NVPTX without LTO uses the implementation in OpenMP currently.
7-
// UNSUPPORTED: nvptx64-nvidia-cuda
8-
// UNSUPPORTED: amdgcn-amd-amdhsa
95
// REQUIRES: gpu
106

117
#include <assert.h>

0 commit comments

Comments
 (0)
Please sign in to comment.