Commit ead675f1 authored by Joel E. Denny's avatar Joel E. Denny
Browse files

[Clacc][OpenMP] Fix libomptarget test mapping/ompx_hold/struct.c

For me, the test fails for nvptx64 offload.  The problem was
introduced by D146838, which landed as 747af241.  It tries to copy
a string constant's address from device to host and then print the
string.  This patch copies the contents of the string instead.

We upstreamed this previously as D149623, which landed as
3a1e06e0.

This patch also removes the test from `LIT_FILTER_OUT` throughout
Clacc's CI config.
parent 877d4abb
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -161,17 +161,13 @@ stages:
      libomp :: worksharing/for/kmp_set_dispatch_buf.c
      libomptarget :: nvptx64-nvidia-cuda :: mapping/low_alignment.c
      libomptarget :: nvptx64-nvidia-cuda :: mapping/map_back_race.cpp
      libomptarget :: nvptx64-nvidia-cuda :: mapping/ompx_hold/struct.c
      libomptarget :: nvptx64-nvidia-cuda :: offloading/bug49334.cpp
      libomptarget :: nvptx64-nvidia-cuda-LTO :: mapping/low_alignment.c
      libomptarget :: nvptx64-nvidia-cuda-LTO :: mapping/ompx_hold/struct.c
      libomptarget :: nvptx64-nvidia-cuda-LTO :: offloading/bug49334.cpp
      libomptarget :: powerpc64le-ibm-linux-gnu :: offloading/bug49334.cpp
      libomptarget :: powerpc64le-ibm-linux-gnu :: mapping/low_alignment.c
      libomptarget :: powerpc64le-ibm-linux-gnu :: mapping/ompx_hold/struct.c
      libomptarget :: powerpc64le-ibm-linux-gnu :: offloading/target_nowait_target.cpp
      libomptarget :: powerpc64le-ibm-linux-gnu-LTO :: mapping/low_alignment.c
      libomptarget :: powerpc64le-ibm-linux-gnu-LTO :: mapping/ompx_hold/struct.c
      libomptarget :: powerpc64le-ibm-linux-gnu-LTO :: offloading/bug49334.cpp
      libomptarget :: powerpc64le-ibm-linux-gnu-LTO :: offloading/target_nowait_target.cpp
      "
@@ -209,13 +205,11 @@ stages:
    LIT_NPROC_DIVISOR: 1
    TEST_LIT_XFAIL:
      "
      libomptarget :: nvptx64-nvidia-cuda :: mapping/ompx_hold/struct.c
      libomptarget :: nvptx64-nvidia-cuda :: mapping/target_derefence_array_pointrs.cpp
      libomptarget :: nvptx64-nvidia-cuda :: mapping/target_has_device_addr.c
      libomptarget :: nvptx64-nvidia-cuda :: unified_shared_memory/close_enter_exit.c
      libomptarget :: nvptx64-nvidia-cuda :: unified_shared_memory/close_modifier.c
      libomptarget :: nvptx64-nvidia-cuda :: unified_shared_memory/shared_update.c
      libomptarget :: nvptx64-nvidia-cuda-LTO :: mapping/ompx_hold/struct.c
      libomptarget :: nvptx64-nvidia-cuda-LTO :: mapping/target_derefence_array_pointrs.cpp
      libomptarget :: nvptx64-nvidia-cuda-LTO :: mapping/target_has_device_addr.c
      libomptarget :: nvptx64-nvidia-cuda-LTO :: offloading/info.c
+14 −7
Original line number Diff line number Diff line
@@ -5,9 +5,16 @@
#include <stdio.h>

#pragma omp begin declare target
char *N1, *N2;
#define MAX_NAME_SIZE 100
char N1[MAX_NAME_SIZE], N2[MAX_NAME_SIZE];
int V1, V2;
#pragma omp declare target
void copy_name(char *dst, char *src) {
  int i;
  for (i = 0; i < MAX_NAME_SIZE - 1 && src[i]; ++i)
    dst[i] = src[i];
  dst[i] = 0;
}
#pragma omp end declare target

#define CHECK_PRESENCE(Var1, Var2, Var3)                                       \
  printf("    presence of %s, %s, %s: %d, %d, %d\n", #Var1, #Var2, #Var3,      \
@@ -19,12 +26,12 @@ int V1, V2;
  printf("    values of %s, %s: %d, %d\n", N1, N2, (Var1), (Var2))

#define CHECK_VALUES_DELAYED(Var1, Var2)                                       \
  N1 = #Var1;                                                                  \
  N2 = #Var2;                                                                  \
  copy_name(N1, #Var1);                                                        \
  copy_name(N2, #Var2);                                                        \
  V1 = (Var1);                                                                 \
  V2 = (Var2);

#define CHECK_DELAYED_VALUS()                                                  \
#define CHECK_DELAYED_VALUES()                                                 \
  _Pragma("omp target update from(N1, N2, V1, V2)")                            \
      CHECK_VALUES_HELPER(N1, N2, V1, V2)

@@ -149,7 +156,7 @@ int main() {
      // CHECK-NEXT: values of s.i, s.j: 21, 31
      CHECK_VALUES_DELAYED(s.i, s.j);
    }
    CHECK_DELAYED_VALUS();
    CHECK_DELAYED_VALUES();
  }
  // CHECK-NEXT: presence of s, s.i, s.j: 0, 0, 0
  // CHECK-NEXT: values of s.i, s.j: 21, 31
@@ -180,7 +187,7 @@ int main() {
      // CHECK-NEXT: values of s.i, s.j: 21, 31
      CHECK_VALUES_DELAYED(s.i, s.j);
    }
    CHECK_DELAYED_VALUS();
    CHECK_DELAYED_VALUES();
  }
  // CHECK-NEXT: presence of s, s.i, s.j: 0, 0, 0
  // CHECK-NEXT: values of s.i, s.j: 21, 31