Skip to content

[OpenMP][NFC] Move debug declares into CMAKE out of "private.h" #73732

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
Nov 29, 2023
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
6 changes: 6 additions & 0 deletions openmp/libomptarget/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ if (LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
"-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports")
endif()

# Define the TARGET_NAME and DEBUG_PREFIX.
target_compile_definitions(omptarget PRIVATE
TARGET_NAME=omptarget
DEBUG_PREFIX="omptarget"
)

# libomptarget.so needs to be aware of where the plugins live as they
# are now separated in the build directory.
set_target_properties(omptarget PROPERTIES
Expand Down
5 changes: 0 additions & 5 deletions openmp/libomptarget/src/private.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,6 @@ struct TargetMemsetArgsTy {
}
#endif

#define TARGET_NAME Libomptarget
#ifndef DEBUG_PREFIX
#define DEBUG_PREFIX GETNAME(TARGET_NAME)
#endif

////////////////////////////////////////////////////////////////////////////////
/// dump a table of all the host-target pointer pairs on failure
static inline void dumpTargetPointerMappings(const ident_t *Loc,
Expand Down
4 changes: 2 additions & 2 deletions openmp/libomptarget/test/env/omp_target_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ int main(void) {
return 0;
}

// DEBUG: Libomptarget
// NDEBUG-NOT: Libomptarget
// DEBUG: omptarget
// NDEBUG-NOT: omptarget
// NDEBUG-NOT: Target
6 changes: 3 additions & 3 deletions openmp/libomptarget/test/mapping/alloc_fail.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// RUN: %libomptarget-run-fail-generic 2>&1 \
// RUN: | %fcheck-generic

// CHECK: Libomptarget message: explicit extension not allowed: host address specified is 0x{{.*}} (8 bytes), but device allocation maps to host at 0x{{.*}} (8 bytes)
// CHECK: Libomptarget error: Call to getTargetPointer returned null pointer (device failure or illegal mapping).
// CHECK: Libomptarget fatal error 1: failure of target construct while offloading is mandatory
// CHECK: omptarget message: explicit extension not allowed: host address specified is 0x{{.*}} (8 bytes), but device allocation maps to host at 0x{{.*}} (8 bytes)
// CHECK: omptarget error: Call to getTargetPointer returned null pointer (device failure or illegal mapping).
// CHECK: omptarget fatal error 1: failure of target construct while offloading is mandatory

int main() {
int arr[4] = {0, 1, 2, 3};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ int main(int argc, char *argv[]) {
#pragma omp target data map(ompx_hold, alloc : X)
#endif
{
// CHECK: Libomptarget error: Trying to disassociate a pointer with a
// CHECK: omptarget error: Trying to disassociate a pointer with a
// CHECK-SAME: non-zero hold reference count
// CHECK-NEXT: omp_target_disassociate_ptr failed
if (omp_target_disassociate_ptr(&X, DevNum)) {
Expand Down
6 changes: 3 additions & 3 deletions openmp/libomptarget/test/mapping/padding_not_mapped.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ int main() {
#pragma omp target update from(s.x) // should have no effect
fprintf(stderr, "s.x = %d\n", s.x);

// CHECK: Libomptarget message: device mapping required by 'present' map type modifier does not exist for host address 0x{{0*}}[[#HOST_ADDR]] ([[#SIZE]] bytes)
// CHECK: Libomptarget error: Call to getTargetPointer returned null pointer ('present' map type modifier).
// CHECK: Libomptarget fatal error 1: failure of target construct while offloading is mandatory
// CHECK: omptarget message: device mapping required by 'present' map type modifier does not exist for host address 0x{{0*}}[[#HOST_ADDR]] ([[#SIZE]] bytes)
// CHECK: omptarget error: Call to getTargetPointer returned null pointer ('present' map type modifier).
// CHECK: omptarget fatal error 1: failure of target construct while offloading is mandatory
#pragma omp target enter data map(present, alloc: s.x)

return 0;
Expand Down
12 changes: 6 additions & 6 deletions openmp/libomptarget/test/mapping/present/target.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ int main() {
// CHECK: addr=0x[[#%x,HOST_ADDR:]], size=[[#%u,SIZE:]]
fprintf(stderr, "addr=%p, size=%ld\n", &i, sizeof i);

// CHECK-NOT: Libomptarget
// CHECK-NOT: omptarget
#pragma omp target data map(alloc : i)
#pragma omp target map(present, alloc : i)
;

// CHECK: i is present
fprintf(stderr, "i is present\n");

// CHECK: Libomptarget message: device mapping required by 'present' map type modifier does not exist for host address 0x{{0*}}[[#HOST_ADDR]] ([[#SIZE]] bytes)
// CHECK: Libomptarget error: Call to getTargetPointer returned null pointer ('present' map type modifier).
// CHECK: Libomptarget error: Call to targetDataBegin failed, abort target.
// CHECK: Libomptarget error: Failed to process data before launching the kernel.
// CHECK: Libomptarget fatal error 1: failure of target construct while offloading is mandatory
// CHECK: omptarget message: device mapping required by 'present' map type modifier does not exist for host address 0x{{0*}}[[#HOST_ADDR]] ([[#SIZE]] bytes)
// CHECK: omptarget error: Call to getTargetPointer returned null pointer ('present' map type modifier).
// CHECK: omptarget error: Call to targetDataBegin failed, abort target.
// CHECK: omptarget error: Failed to process data before launching the kernel.
// CHECK: omptarget fatal error 1: failure of target construct while offloading is mandatory
#pragma omp target map(present, alloc : i)
;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ int main() {
fprintf(stderr, "addr=%p, size=%ld\n", &arr[LARGE_BEG],
LARGE_SIZE * sizeof arr[0]);

// CHECK-NOT: Libomptarget
// CHECK-NOT: omptarget
#pragma omp target data map(alloc : arr[LARGE])
{
#pragma omp target map(present, tofrom : arr[SMALL])
Expand All @@ -70,12 +70,12 @@ int main() {
// CHECK: arr is present
fprintf(stderr, "arr is present\n");

// CHECK: Libomptarget message: explicit extension not allowed: host address specified is 0x{{0*}}[[#LARGE_ADDR]] ([[#LARGE_BYTES]] bytes), but device allocation maps to host at 0x{{0*}}[[#SMALL_ADDR]] ([[#SMALL_BYTES]] bytes)
// CHECK: Libomptarget message: device mapping required by 'present' map type modifier does not exist for host address 0x{{0*}}[[#LARGE_ADDR]] ([[#LARGE_BYTES]] bytes)
// CHECK: Libomptarget error: Call to getTargetPointer returned null pointer ('present' map type modifier).
// CHECK: Libomptarget error: Call to targetDataBegin failed, abort target.
// CHECK: Libomptarget error: Failed to process data before launching the kernel.
// CHECK: Libomptarget fatal error 1: failure of target construct while offloading is mandatory
// CHECK: omptarget message: explicit extension not allowed: host address specified is 0x{{0*}}[[#LARGE_ADDR]] ([[#LARGE_BYTES]] bytes), but device allocation maps to host at 0x{{0*}}[[#SMALL_ADDR]] ([[#SMALL_BYTES]] bytes)
// CHECK: omptarget message: device mapping required by 'present' map type modifier does not exist for host address 0x{{0*}}[[#LARGE_ADDR]] ([[#LARGE_BYTES]] bytes)
// CHECK: omptarget error: Call to getTargetPointer returned null pointer ('present' map type modifier).
// CHECK: omptarget error: Call to targetDataBegin failed, abort target.
// CHECK: omptarget error: Failed to process data before launching the kernel.
// CHECK: omptarget fatal error 1: failure of target construct while offloading is mandatory
#pragma omp target data map(alloc : arr[SMALL])
{
#pragma omp target map(present, tofrom : arr[LARGE])
Expand Down
6 changes: 3 additions & 3 deletions openmp/libomptarget/test/mapping/present/target_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ int main() {
// CHECK: addr=0x[[#%x,HOST_ADDR:]], size=[[#%u,SIZE:]]
fprintf(stderr, "addr=%p, size=%ld\n", &i, sizeof i);

// CHECK-NOT: Libomptarget
// CHECK-NOT: omptarget
#pragma omp target data map(alloc : i)
#pragma omp target data map(present, alloc : i)
;

// CHECK: i is present
fprintf(stderr, "i is present\n");

// CHECK: Libomptarget message: device mapping required by 'present' map type modifier does not exist for host address 0x{{0*}}[[#HOST_ADDR]] ([[#SIZE]] bytes)
// CHECK: Libomptarget fatal error 1: failure of target construct while offloading is mandatory
// CHECK: omptarget message: device mapping required by 'present' map type modifier does not exist for host address 0x{{0*}}[[#HOST_ADDR]] ([[#SIZE]] bytes)
// CHECK: omptarget fatal error 1: failure of target construct while offloading is mandatory
#pragma omp target data map(present, alloc : i)
;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ int main() {
fprintf(stderr, "addr=%p, size=%ld\n", &arr[LARGE_BEG],
LARGE_SIZE * sizeof arr[0]);

// CHECK-NOT: Libomptarget
// CHECK-NOT: omptarget
#pragma omp target data map(alloc : arr[LARGE])
{
#pragma omp target data map(present, tofrom : arr[SMALL])
Expand All @@ -70,10 +70,10 @@ int main() {
// CHECK: arr is present
fprintf(stderr, "arr is present\n");

// CHECK: Libomptarget message: explicit extension not allowed: host address specified is 0x{{0*}}[[#LARGE_ADDR]] ([[#LARGE_BYTES]] bytes), but device allocation maps to host at 0x{{0*}}[[#SMALL_ADDR]] ([[#SMALL_BYTES]] bytes)
// CHECK: Libomptarget message: device mapping required by 'present' map type modifier does not exist for host address 0x{{0*}}[[#LARGE_ADDR]] ([[#LARGE_BYTES]] bytes)
// CHECK: Libomptarget error: Call to getTargetPointer returned null pointer ('present' map type modifier).
// CHECK: Libomptarget fatal error 1: failure of target construct while offloading is mandatory
// CHECK: omptarget message: explicit extension not allowed: host address specified is 0x{{0*}}[[#LARGE_ADDR]] ([[#LARGE_BYTES]] bytes), but device allocation maps to host at 0x{{0*}}[[#SMALL_ADDR]] ([[#SMALL_BYTES]] bytes)
// CHECK: omptarget message: device mapping required by 'present' map type modifier does not exist for host address 0x{{0*}}[[#LARGE_ADDR]] ([[#LARGE_BYTES]] bytes)
// CHECK: omptarget error: Call to getTargetPointer returned null pointer ('present' map type modifier).
// CHECK: omptarget fatal error 1: failure of target construct while offloading is mandatory
#pragma omp target data map(alloc : arr[SMALL])
{
#pragma omp target data map(present, tofrom : arr[LARGE])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ int main() {
#pragma omp target exit data map(delete : i)
}

// CHECK-NOT: Libomptarget
// CHECK-NOT: omptarget
// CHECK: success
// CHECK-NOT: Libomptarget
// CHECK-NOT: omptarget
fprintf(stderr, "success\n");

return 0;
Expand Down
8 changes: 4 additions & 4 deletions openmp/libomptarget/test/mapping/present/target_enter_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ int main() {
// CHECK: addr=0x[[#%x,HOST_ADDR:]], size=[[#%u,SIZE:]]
fprintf(stderr, "addr=%p, size=%ld\n", &i, sizeof i);

// CHECK-NOT: Libomptarget
// CHECK-NOT: omptarget
#pragma omp target enter data map(alloc : i)
#pragma omp target enter data map(present, alloc : i)
#pragma omp target exit data map(delete : i)

// CHECK: i is present
fprintf(stderr, "i is present\n");

// CHECK: Libomptarget message: device mapping required by 'present' map type modifier does not exist for host address 0x{{0*}}[[#HOST_ADDR]] ([[#SIZE]] bytes)
// CHECK: Libomptarget error: Call to getTargetPointer returned null pointer ('present' map type modifier).
// CHECK: Libomptarget fatal error 1: failure of target construct while offloading is mandatory
// CHECK: omptarget message: device mapping required by 'present' map type modifier does not exist for host address 0x{{0*}}[[#HOST_ADDR]] ([[#SIZE]] bytes)
// CHECK: omptarget error: Call to getTargetPointer returned null pointer ('present' map type modifier).
// CHECK: omptarget fatal error 1: failure of target construct while offloading is mandatory
#pragma omp target enter data map(present, alloc : i)

// CHECK-NOT: i is present
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ int main() {
// CHECK: addr=0x[[#%x,HOST_ADDR:]], size=[[#%u,SIZE:]]
fprintf(stderr, "addr=%p, size=%ld\n", &i, sizeof i);

// CHECK-NOT: Libomptarget
// CHECK-NOT: omptarget
#pragma omp target enter data map(alloc : i)
#pragma omp target exit data map(present, delete : i)

// CHECK: i was present
fprintf(stderr, "i was present\n");

// CHECK: Libomptarget message: device mapping required by 'present' map type modifier does not exist for host address 0x{{0*}}[[#HOST_ADDR]] ([[#SIZE]] bytes)
// CHECK: Libomptarget fatal error 1: failure of target construct while offloading is mandatory
// CHECK: omptarget message: device mapping required by 'present' map type modifier does not exist for host address 0x{{0*}}[[#HOST_ADDR]] ([[#SIZE]] bytes)
// CHECK: omptarget fatal error 1: failure of target construct while offloading is mandatory
#pragma omp target exit data map(present, delete : i)

// CHECK-NOT: i was present
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ int main() {
// CHECK: addr=0x[[#%x,HOST_ADDR:]], size=[[#%u,SIZE:]]
fprintf(stderr, "addr=%p, size=%ld\n", &i, sizeof i);

// CHECK-NOT: Libomptarget
// CHECK-NOT: omptarget
#pragma omp target enter data map(alloc : i)
#pragma omp target exit data map(present, release : i)

// CHECK: i was present
fprintf(stderr, "i was present\n");

// CHECK: Libomptarget message: device mapping required by 'present' map type modifier does not exist for host address 0x{{0*}}[[#HOST_ADDR]] ([[#SIZE]] bytes)
// CHECK: Libomptarget fatal error 1: failure of target construct while offloading is mandatory
// CHECK: omptarget message: device mapping required by 'present' map type modifier does not exist for host address 0x{{0*}}[[#HOST_ADDR]] ([[#SIZE]] bytes)
// CHECK: omptarget fatal error 1: failure of target construct while offloading is mandatory
#pragma omp target exit data map(present, release : i)

// CHECK-NOT: i was present
Expand Down
6 changes: 3 additions & 3 deletions openmp/libomptarget/test/mapping/present/target_update.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ int main() {
// CHECK: addr=0x[[#%x,HOST_ADDR:]], size=[[#%u,SIZE:]]
fprintf(stderr, "addr=%p, size=%ld\n", &i, sizeof i);

// CHECK-NOT: Libomptarget
// CHECK-NOT: omptarget
#pragma omp target enter data map(alloc : i)
#pragma omp target update CLAUSE(present : i)
#pragma omp target exit data map(delete : i)

// CHECK: i is present
fprintf(stderr, "i is present\n");

// CHECK: Libomptarget message: device mapping required by 'present' motion modifier does not exist for host address 0x{{0*}}[[#HOST_ADDR]] ([[#SIZE]] bytes)
// CHECK: Libomptarget fatal error 1: failure of target construct while offloading is mandatory
// CHECK: omptarget message: device mapping required by 'present' motion modifier does not exist for host address 0x{{0*}}[[#HOST_ADDR]] ([[#SIZE]] bytes)
// CHECK: omptarget fatal error 1: failure of target construct while offloading is mandatory
#pragma omp target update CLAUSE(present : i)

// CHECK-NOT: i is present
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ int main() {
// CHECK: addr=0x[[#%x,HOST_ADDR:]], size=[[#%u,SIZE:]]
fprintf(stderr, "addr=%p, size=%ld\n", arr, sizeof arr);

// CHECK-NOT: Libomptarget
// CHECK-NOT: omptarget
#pragma omp target data map(alloc : arr[LARGE])
{
#pragma omp target update CLAUSE(present : arr[SMALL])
Expand All @@ -66,8 +66,8 @@ int main() {
// CHECK: arr is present
fprintf(stderr, "arr is present\n");

// CHECK: Libomptarget message: device mapping required by 'present' motion modifier does not exist for host address 0x{{0*}}[[#HOST_ADDR]] ([[#SIZE]] bytes)
// CHECK: Libomptarget fatal error 1: failure of target construct while offloading is mandatory
// CHECK: omptarget message: device mapping required by 'present' motion modifier does not exist for host address 0x{{0*}}[[#HOST_ADDR]] ([[#SIZE]] bytes)
// CHECK: omptarget fatal error 1: failure of target construct while offloading is mandatory
#pragma omp target data map(alloc : arr[SMALL])
{
#pragma omp target update CLAUSE(present : arr[LARGE])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
int main() {
int i;

// CHECK-NOT: Libomptarget
// CHECK-NOT: omptarget
#pragma omp target data map(alloc : i)
#pragma omp target map(present, alloc : i)
;

// CHECK: i is present
fprintf(stderr, "i is present\n");

// CHECK-NOT: Libomptarget
// CHECK-NOT: omptarget
#pragma omp target map(present, alloc : i)
;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ int main() {
// CHECK: addr=0x[[#%x,HOST_ADDR:]]
fprintf(stderr, "addr=%p\n", arr);

// CHECK-NOT: Libomptarget
// CHECK-NOT: omptarget
#pragma omp target data map(alloc : arr[0 : 5])
#pragma omp target map(present, alloc : arr[0 : 0])
;
Expand All @@ -20,11 +20,11 @@ int main() {

// arr[0:0] doesn't create an actual mapping in the first directive.
//
// CHECK: Libomptarget message: device mapping required by 'present' map type modifier does not exist for host address 0x{{0*}}[[#HOST_ADDR]] (0 bytes)
// CHECK: Libomptarget error: Call to getTargetPointer returned null pointer ('present' map type modifier).
// CHECK: Libomptarget error: Call to targetDataBegin failed, abort target.
// CHECK: Libomptarget error: Failed to process data before launching the kernel.
// CHECK: Libomptarget fatal error 1: failure of target construct while offloading is mandatory
// CHECK: omptarget message: device mapping required by 'present' map type modifier does not exist for host address 0x{{0*}}[[#HOST_ADDR]] (0 bytes)
// CHECK: omptarget error: Call to getTargetPointer returned null pointer ('present' map type modifier).
// CHECK: omptarget error: Call to targetDataBegin failed, abort target.
// CHECK: omptarget error: Failed to process data before launching the kernel.
// CHECK: omptarget fatal error 1: failure of target construct while offloading is mandatory
#pragma omp target data map(alloc : arr[0 : 0])
#pragma omp target map(present, alloc : arr[0 : 0])
;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ int main() {
// CHECK: addr=0x[[#%x,HOST_ADDR:]]
fprintf(stderr, "addr=%p\n", arr);

// CHECK-NOT: Libomptarget
// CHECK-NOT: omptarget
#pragma omp target enter data map(alloc : arr[0 : 5])
#pragma omp target exit data map(present, release : arr[0 : 0])

Expand All @@ -19,8 +19,8 @@ int main() {

// arr[0:0] doesn't create an actual mapping in the first directive.
//
// CHECK: Libomptarget message: device mapping required by 'present' map type modifier does not exist for host address 0x{{0*}}[[#HOST_ADDR]] (0 bytes)
// CHECK: Libomptarget fatal error 1: failure of target construct while offloading is mandatory
// CHECK: omptarget message: device mapping required by 'present' map type modifier does not exist for host address 0x{{0*}}[[#HOST_ADDR]] (0 bytes)
// CHECK: omptarget fatal error 1: failure of target construct while offloading is mandatory
#pragma omp target enter data map(alloc : arr[0 : 0])
#pragma omp target exit data map(present, release : arr[0 : 0])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void check_not_present() {
arr[i] = 88;
}

// CHECK-NOT: Libomptarget
// CHECK-NOT: omptarget
// CHECK-NOT: error
for (int i = 0; i < SIZE; ++i) {
if (arr[i] != 99)
Expand Down Expand Up @@ -95,7 +95,7 @@ void check_is_present() {
arr[i] = 88;
}

// CHECK-NOT: Libomptarget
// CHECK-NOT: omptarget
// CHECK-NOT: error
for (int i = 0; i < SIZE; ++i) {
if (SMALL_BEG <= i && i < SMALL_END) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
int main() {
int arr[5];

// CHECK-NOT: Libomptarget
// CHECK-NOT: omptarget
#pragma omp target data map(alloc : arr[LARGE])
{
#pragma omp target update CLAUSE(arr[SMALL])
Expand All @@ -63,7 +63,7 @@ int main() {
// CHECK: success
fprintf(stderr, "success\n");

// CHECK-NOT: Libomptarget
// CHECK-NOT: omptarget
#pragma omp target data map(alloc : arr[SMALL])
{
#pragma omp target update CLAUSE(arr[LARGE])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ int main() {

#pragma omp target data map(to : x [0:10])
{
// CHECK: Libomptarget device 0 info: variable x does not have a valid device
// CHECK: omptarget device 0 info: variable x does not have a valid device
// counterpart
#pragma omp target data use_device_addr(x)
{
Expand Down
2 changes: 1 addition & 1 deletion openmp/libomptarget/test/offloading/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ int main() {
{ val = 1; }

__tgt_set_info_flag(0x0);
// INFO-NOT: Libomptarget device 0 info: {{.*}}
// INFO-NOT: omptarget device 0 info: {{.*}}
#pragma omp target
{}

Expand Down
Loading