diff options
Diffstat (limited to 'offload')
-rw-r--r-- | offload/include/OpenMP/InteropAPI.h | 12 | ||||
-rw-r--r-- | offload/libomptarget/OpenMP/InteropAPI.cpp | 3 | ||||
-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 |
9 files changed, 98 insertions, 9 deletions
diff --git a/offload/include/OpenMP/InteropAPI.h b/offload/include/OpenMP/InteropAPI.h index 53ac4be..8c06ba3 100644 --- a/offload/include/OpenMP/InteropAPI.h +++ b/offload/include/OpenMP/InteropAPI.h @@ -25,8 +25,8 @@ typedef enum kmp_interop_type_t { } kmp_interop_type_t; struct interop_attrs_t { - bool inorder : 1; - int reserved : 31; + uint32_t inorder : 1; + uint32_t reserved : 31; /// Check if the supported attributes are compatible with the current /// attributes. Only if an attribute is supported can the value be true, @@ -44,15 +44,15 @@ struct interop_spec_t { }; struct interop_flags_t { - bool implicit : 1; // dispatch (true) or interop (false) - bool nowait : 1; // has nowait flag - int reserved : 30; + uint32_t implicit : 1; // dispatch (true) or interop (false) + uint32_t nowait : 1; // has nowait flag + uint32_t reserved : 30; }; struct interop_ctx_t { uint32_t version; // version of the interface (current is 0) interop_flags_t flags; - int gtid; + int32_t gtid; }; struct dep_pack_t { diff --git a/offload/libomptarget/OpenMP/InteropAPI.cpp b/offload/libomptarget/OpenMP/InteropAPI.cpp index c55ef2c..d6ef17c 100644 --- a/offload/libomptarget/OpenMP/InteropAPI.cpp +++ b/offload/libomptarget/OpenMP/InteropAPI.cpp @@ -22,8 +22,7 @@ extern "C" { void __kmpc_omp_wait_deps(ident_t *loc_ref, int32_t gtid, int32_t ndeps, kmp_depend_info_t *dep_list, int32_t ndeps_noalias, - kmp_depend_info_t *noalias_dep_list) - __attribute__((weak)); + kmp_depend_info_t *noalias_dep_list); } // extern "C" 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; +} |