diff options
Diffstat (limited to 'offload/test')
-rw-r--r-- | offload/test/offloading/CUDA/basic_launch_multi_arg.cu | 2 | ||||
-rw-r--r-- | offload/test/offloading/barrier_fence.c | 3 | ||||
-rw-r--r-- | offload/test/offloading/gpupgo/pgo_atomic_teams.c | 1 | ||||
-rw-r--r-- | offload/test/offloading/gpupgo/pgo_atomic_threads.c | 1 | ||||
-rw-r--r-- | offload/test/offloading/gpupgo/pgo_device_and_host.c | 1 | ||||
-rw-r--r-- | offload/test/offloading/gpupgo/pgo_device_only.c | 1 | ||||
-rw-r--r-- | offload/test/offloading/interop-print.c | 83 |
7 files changed, 91 insertions, 1 deletions
diff --git a/offload/test/offloading/CUDA/basic_launch_multi_arg.cu b/offload/test/offloading/CUDA/basic_launch_multi_arg.cu index b2e1edf..7a32983f 100644 --- a/offload/test/offloading/CUDA/basic_launch_multi_arg.cu +++ b/offload/test/offloading/CUDA/basic_launch_multi_arg.cu @@ -8,7 +8,7 @@ // REQUIRES: gpu // // FIXME: https://github.com/llvm/llvm-project/issues/161265 -// XFAIL: gpu +// UNSUPPORTED: gpu #include <stdio.h> diff --git a/offload/test/offloading/barrier_fence.c b/offload/test/offloading/barrier_fence.c index 73d259d..e43db0a5 100644 --- a/offload/test/offloading/barrier_fence.c +++ b/offload/test/offloading/barrier_fence.c @@ -4,6 +4,9 @@ // RUN: %libomptarget-run-generic // REQUIRES: gpu +// +// FIXME: https://github.com/llvm/llvm-project/issues/161265 +// UNSUPPORTED: gpu #include <omp.h> #include <stdio.h> diff --git a/offload/test/offloading/gpupgo/pgo_atomic_teams.c b/offload/test/offloading/gpupgo/pgo_atomic_teams.c index b3b72db..42d8ae4 100644 --- a/offload/test/offloading/gpupgo/pgo_atomic_teams.c +++ b/offload/test/offloading/gpupgo/pgo_atomic_teams.c @@ -18,6 +18,7 @@ // REQUIRES: amdgpu // REQUIRES: pgo +// XFAIL: amdgpu int test1(int a) { return a / 2; } int test2(int a) { return a * 2; } diff --git a/offload/test/offloading/gpupgo/pgo_atomic_threads.c b/offload/test/offloading/gpupgo/pgo_atomic_threads.c index 440a6b5..09a4dc1 100644 --- a/offload/test/offloading/gpupgo/pgo_atomic_threads.c +++ b/offload/test/offloading/gpupgo/pgo_atomic_threads.c @@ -18,6 +18,7 @@ // REQUIRES: amdgpu // REQUIRES: pgo +// XFAIL: amdgpu int test1(int a) { return a / 2; } diff --git a/offload/test/offloading/gpupgo/pgo_device_and_host.c b/offload/test/offloading/gpupgo/pgo_device_and_host.c index 3e95791..c53e69a 100644 --- a/offload/test/offloading/gpupgo/pgo_device_and_host.c +++ b/offload/test/offloading/gpupgo/pgo_device_and_host.c @@ -50,6 +50,7 @@ // REQUIRES: amdgpu // REQUIRES: pgo +// XFAIL: amdgpu int main() { int host_var = 0; diff --git a/offload/test/offloading/gpupgo/pgo_device_only.c b/offload/test/offloading/gpupgo/pgo_device_only.c index 2939af61..644df6e 100644 --- a/offload/test/offloading/gpupgo/pgo_device_only.c +++ b/offload/test/offloading/gpupgo/pgo_device_only.c @@ -16,6 +16,7 @@ // REQUIRES: amdgpu // REQUIRES: pgo +// XFAIL: amdgpu int test1(int a) { return a / 2; } int test2(int a) { return a * 2; } diff --git a/offload/test/offloading/interop-print.c b/offload/test/offloading/interop-print.c new file mode 100644 index 0000000..a386420 --- /dev/null +++ b/offload/test/offloading/interop-print.c @@ -0,0 +1,83 @@ +// RUN: %libomptarget-compile-amdgcn-amd-amdhsa +// RUN: %libomptarget-run-generic 2>&1 | \ +// RUN: %fcheck-amdgcn-amd-amdhsa -check-prefixes=AMD + +// RUN: %libomptarget-compile-nvptx64-nvidia-cuda +// RUN: %libomptarget-run-generic 2>&1 | \ +// RUN: %fcheck-nvptx64-nvidia-cuda -check-prefixes=NVIDIA + +// REQUIRES: gpu +// XFAIL: nvptx64-nvidia-cuda + +#include <omp.h> +#include <stdio.h> + +const char *interop_int_to_string(const int interop_int) { + switch (interop_int) { + case 1: + return "cuda"; + case 2: + return "cuda_driver"; + case 3: + return "opencl"; + case 4: + return "sycl"; + case 5: + return "hip"; + case 6: + return "level_zero"; + case 7: + return "hsa"; + default: + return "unknown"; + } +} + +int main(int argc, char **argv) { + + // Loop over all available devices + for (int id = 0; id < omp_get_num_devices(); ++id) { + omp_interop_t iobj = omp_interop_none; + + // TODO: Change targetsync to target when AMD toolchain supports it. +#pragma omp interop init(target : iobj) device(id) + + int err; + int interop_int = omp_get_interop_int(iobj, omp_ipr_fr_id, &err); + + if (err) { + fprintf(stderr, "omp_get_interop_int failed: %d\n", err); + return -1; + } + + // AMD: {{.*}} hsa + // NVIDIA: {{.*}} cuda + printf("omp_get_interop_int returned %s\n", + interop_int_to_string(interop_int)); + + const char *interop_vendor = + omp_get_interop_str(iobj, omp_ipr_vendor_name, &err); + if (err) { + fprintf(stderr, "omp_get_interop_str failed: %d\n", err); + return -1; + } + + // AMD: {{.*}} amd + // NVIDIA: {{.*}} nvidia + printf("omp_get_interop_str returned %s\n", interop_vendor); + + const char *interop_fr_name = + omp_get_interop_str(iobj, omp_ipr_fr_name, &err); + if (err) { + fprintf(stderr, "omp_get_interop_str failed: %d\n", err); + return -1; + } + + // AMD: {{.*}} hsa + // NVIDIA: {{.*}} cuda + printf("omp_get_interop_str returned %s\n", interop_fr_name); + +#pragma omp interop destroy(iobj) + } + return 0; +} |