Skip to content

[OpenMP] Do not define '__assert_fail' if we have the GPU libc #100409

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 1 commit into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions offload/DeviceRTL/src/Debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@ using namespace ompx;
extern "C" {
void __assert_assume(bool condition) { __builtin_assume(condition); }

#ifndef OMPTARGET_HAS_LIBC
Copy link
Contributor

Choose a reason for hiding this comment

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

No OMPTARGET anymore I suggest.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think there's a lot of other stuff we'd need to clean up so it'd be easier to do that all at once.

Copy link
Contributor

Choose a reason for hiding this comment

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

Even though we have a lot but they are "legacy". I don't think it's a good idea to introduce more.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is an existing macro, so if I wanted to use something else I'd need to rename it which would make the patch more complicated.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh didn't notice that. It is indeed an existing one. Okay. Renaming belongs to a separate patch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah we should probably do it all at once.

[[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) {
Expand Down
4 changes: 0 additions & 4 deletions offload/test/libc/assert.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <assert.h>
Expand Down
Loading