In a nutshell, this moves our libomptarget code to populate the offload subproject. With this commit, users need to enable the new LLVM/Offload subproject as a runtime in their cmake configuration. No further changes are expected for downstream code. Tests and other components still depend on OpenMP and have also not been renamed. The results below are for a build in which OpenMP and Offload are enabled runtimes. In addition to the pure `git mv`, we needed to adjust some CMake files. Nothing is intended to change semantics. ``` ninja check-offload ``` Works with the X86 and AMDGPU offload tests ``` ninja check-openmp ``` Still works but doesn't build offload tests anymore. ``` ls install/lib ``` Shows all expected libraries, incl. - `libomptarget.devicertl.a` - `libomptarget-nvptx-sm_90.bc` - `libomptarget.rtl.amdgpu.so` -> `libomptarget.rtl.amdgpu.so.18git` - `libomptarget.so` -> `libomptarget.so.18git` Fixes: https://github.com/llvm/llvm-project/issues/75124 --------- Co-authored-by: Saiyedul Islam <Saiyedul.Islam@amd.com>
54 lines
1.4 KiB
C++
54 lines
1.4 KiB
C++
// RUN: %libomptarget-compilexx-run-and-check-aarch64-unknown-linux-gnu
|
|
// RUN: %libomptarget-compilexx-run-and-check-powerpc64-ibm-linux-gnu
|
|
// RUN: %libomptarget-compilexx-run-and-check-powerpc64le-ibm-linux-gnu
|
|
// RUN: %libomptarget-compilexx-run-and-check-x86_64-pc-linux-gnu
|
|
// RUN: %libomptarget-compilexx-run-and-check-nvptx64-nvidia-cuda
|
|
|
|
#include <cstdio>
|
|
#include <cstdlib>
|
|
|
|
typedef struct {
|
|
short *a;
|
|
long d1, d2;
|
|
} DV_A;
|
|
|
|
typedef struct {
|
|
DV_A b;
|
|
long d3;
|
|
} C;
|
|
|
|
typedef struct {
|
|
C *c;
|
|
long d4, d5;
|
|
} DV_B;
|
|
|
|
int main() {
|
|
|
|
short arr1[10] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
|
|
short arr2[10] = {20, 31, 22, 23, 24, 25, 26, 27, 28, 29};
|
|
|
|
C c1[2];
|
|
c1[0].b.a = (short *)arr1;
|
|
c1[1].b.a = (short *)arr2;
|
|
c1[0].b.d1 = 111;
|
|
|
|
DV_B dvb1;
|
|
dvb1.c = (C *)&c1;
|
|
|
|
// CHECK: 10 111
|
|
printf("%d %ld %p %p %p %p\n", dvb1.c[0].b.a[0], dvb1.c[0].b.d1, &dvb1,
|
|
&dvb1.c[0], &dvb1.c[0].b, &dvb1.c[0].b.a[0]);
|
|
#pragma omp target map(to : dvb1, dvb1.c[0 : 2]) \
|
|
map(tofrom : dvb1.c[0].b.a[0 : 10], dvb1.c[1].b.a[0 : 10])
|
|
{
|
|
// CHECK: 10 111
|
|
printf("%d %ld %p %p %p %p\n", dvb1.c[0].b.a[0], dvb1.c[0].b.d1, &dvb1,
|
|
&dvb1.c[0], &dvb1.c[0].b, &dvb1.c[0].b.a[0]);
|
|
dvb1.c[0].b.a[0] = 333;
|
|
dvb1.c[0].b.d1 = 444;
|
|
}
|
|
// CHECK: 333 111
|
|
printf("%d %ld %p %p %p %p\n", dvb1.c[0].b.a[0], dvb1.c[0].b.d1, &dvb1,
|
|
&dvb1.c[0], &dvb1.c[0].b, &dvb1.c[0].b.a[0]);
|
|
}
|