From 7ebd97b852b7535d22f93a90e7627853ffe7f0e1 Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Fri, 26 Jul 2024 15:18:10 -0500 Subject: [PATCH] [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. --- offload/DeviceRTL/src/Debug.cpp | 3 +++ offload/test/libc/assert.c | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/offload/DeviceRTL/src/Debug.cpp b/offload/DeviceRTL/src/Debug.cpp index 4e16591cc6c5..5a2c84c7ee38 100644 --- a/offload/DeviceRTL/src/Debug.cpp +++ b/offload/DeviceRTL/src/Debug.cpp @@ -26,10 +26,13 @@ using namespace ompx; extern "C" { void __assert_assume(bool condition) { __builtin_assume(condition); } +#ifndef OMPTARGET_HAS_LIBC [[gnu::weak]] void __assert_fail(const char *expr, const char *file, unsigned line, const char *function) { __assert_fail_internal(expr, nullptr, file, line, function); } +#endif + void __assert_fail_internal(const char *expr, const char *msg, const char *file, unsigned line, const char *function) { if (msg) { diff --git a/offload/test/libc/assert.c b/offload/test/libc/assert.c index 0501e3632902..bf155b6f463b 100644 --- a/offload/test/libc/assert.c +++ b/offload/test/libc/assert.c @@ -2,10 +2,6 @@ // RUN: %fcheck-generic --check-prefix=CHECK // REQUIRES: libc - -// AMDGPU and NVPTX without LTO uses the implementation in OpenMP currently. -// UNSUPPORTED: nvptx64-nvidia-cuda -// UNSUPPORTED: amdgcn-amd-amdhsa // REQUIRES: gpu #include