]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libgomp.{c,fortran}/interop-{hip,cuda}: Fix dg-run target selection
authorTobias Burnus <tburnus@baylibre.com>
Fri, 9 May 2025 08:57:44 +0000 (10:57 +0200)
committerTobias Burnus <tburnus@baylibre.com>
Fri, 9 May 2025 08:57:44 +0000 (10:57 +0200)
While the tests checked whether the CUDA/HIP runtime is available
before processing them, the execution was then done unconditionally,
leading to FAIL when the default device was the host (or the wrong
offload device).

Now the test is only executed ('run') when the default device is an
Nvidia or AMD GPU (depending on the test case, cf. the test file name).
Otherwise, only a 'link' test is done. (Except when the effective-target
check cannot find the runtime lib - then the test is skipped [as before].)

Note: The cublas/hipblas tests use variant functions and iterate over
all devices, such that the cublas or hipblas, respectively, is only
called when the active device is an AMD or Nvidia device, respectively,
while for the host and other device types the fallback is called.

libgomp/ChangeLog:

* testsuite/libgomp.c/interop-cuda-full.c: Use 'link' instead
of 'run' when the default device is "! offload_device_nvptx".
* testsuite/libgomp.c/interop-cuda-libonly.c: Likewise.
* testsuite/libgomp.c/interop-hip-nvidia-full.c: Likewise.
* testsuite/libgomp.c/interop-hip-nvidia-no-headers.c: Likewise.
* testsuite/libgomp.c/interop-hip-nvidia-no-hip-header.c: Likewise.
* testsuite/libgomp.fortran/interop-hip-nvidia-full.F90: Likewise.
* testsuite/libgomp.fortran/interop-hip-nvidia-no-module.F90: Likewise.
* testsuite/libgomp.c/interop-hip-amd-full.c: Use 'link' instead
of 'run' when the default device is "! offload_device_gcn".
* testsuite/libgomp.c/interop-hip-amd-no-hip-header.c: Likewise.
* testsuite/libgomp.fortran/interop-hip-amd-full.F90: Likewise.
* testsuite/libgomp.fortran/interop-hip-amd-no-module.F90: Likewise.

libgomp/testsuite/libgomp.c/interop-cuda-full.c
libgomp/testsuite/libgomp.c/interop-cuda-libonly.c
libgomp/testsuite/libgomp.c/interop-hip-amd-full.c
libgomp/testsuite/libgomp.c/interop-hip-amd-no-hip-header.c
libgomp/testsuite/libgomp.c/interop-hip-nvidia-full.c
libgomp/testsuite/libgomp.c/interop-hip-nvidia-no-headers.c
libgomp/testsuite/libgomp.c/interop-hip-nvidia-no-hip-header.c
libgomp/testsuite/libgomp.fortran/interop-hip-amd-full.F90
libgomp/testsuite/libgomp.fortran/interop-hip-amd-no-module.F90
libgomp/testsuite/libgomp.fortran/interop-hip-nvidia-full.F90
libgomp/testsuite/libgomp.fortran/interop-hip-nvidia-no-module.F90

index 38aa6b130bb70b6f07d3c0261ed5d31c7b63acdb..c48a934978d90d59767dbd625f465dfc8a144a44 100644 (file)
@@ -1,3 +1,6 @@
+/* { dg-do run { target { offload_device_nvptx } } } */
+/* { dg-do link { target { ! offload_device_nvptx } } } */
+
 /* { dg-require-effective-target openacc_cuda } */
 /* { dg-require-effective-target openacc_cudart } */
 /* { dg-additional-options "-lcuda -lcudart" } */
index 17cbb1591838bee83e8071d84ca9aef666b3b839..bc257a24ee89dddbd3046dd23d56a49879b67ff6 100644 (file)
@@ -1,3 +1,6 @@
+/* { dg-do run { target { offload_device_nvptx } } } */
+/* { dg-do link { target { ! offload_device_nvptx } } } */
+
 /* { dg-require-effective-target openacc_libcudart } */
 /* { dg-require-effective-target openacc_libcuda } */
 /* { dg-additional-options "-lcuda -lcudart" } */
index d7725fc8e349f410123d3eb4ab05de3cd05c7aa6..bd44f442210df9b81b851108ca2fffc638e16b41 100644 (file)
@@ -1,3 +1,6 @@
+/* { dg-do run { target { offload_device_gcn } } } */
+/* { dg-do link { target { ! offload_device_gcn } } } */
+
 /* { dg-require-effective-target gomp_hip_header_amd } */
 /* { dg-require-effective-target gomp_libamdhip64 } */
 /* { dg-additional-options "-lamdhip64" } */
index 25845379fcc1df9acd6e7aec411bb6760710a146..91ad987631f55a3bbb7b6f5d9fd8cf2fbea3f3a8 100644 (file)
@@ -1,3 +1,6 @@
+/* { dg-do run { target { offload_device_gcn } } } */
+/* { dg-do link { target { ! offload_device_gcn } } } */
+
 /* { dg-require-effective-target gomp_libamdhip64 } */
 /* { dg-additional-options "-lamdhip64" } */
 
index 79af47dc07654532cafdcc11c6f3c3d1d08599fe..d5dc236fcd86cd3812e7f895e3c09f1045812f3e 100644 (file)
@@ -1,3 +1,6 @@
+/* { dg-do run { target { offload_device_nvptx } } } */
+/* { dg-do link { target { ! offload_device_nvptx } } } */
+
 /* { dg-require-effective-target openacc_cudart } */
 /* { dg-require-effective-target openacc_cuda } */
 /* { dg-require-effective-target gomp_hip_header_nvidia } */
index 4586398ff00eed32c7d0c21059d38780cbed890b..7cff2cb80af0919ddaae7385b3cde2fc05a946ba 100644 (file)
@@ -1,3 +1,6 @@
+/* { dg-do run { target { offload_device_nvptx } } } */
+/* { dg-do link { target { ! offload_device_nvptx } } } */
+
 /* { dg-require-effective-target openacc_libcudart } */
 /* { dg-require-effective-target openacc_libcuda } */
 /* { dg-additional-options "-lcuda -lcudart" } */
index 41869848fc5dcb049ef6c8030b3145022c7a310a..7b7dc74639794ee3475406628dbfa4c825d58d84 100644 (file)
@@ -1,3 +1,6 @@
+/* { dg-do run { target { offload_device_nvptx } } } */
+/* { dg-do link { target { ! offload_device_nvptx } } } */
+
 /* { dg-require-effective-target openacc_cudart } */
 /* { dg-require-effective-target openacc_cuda } */
 /* { dg-additional-options "-lcuda -lcudart" } */
index bbd49ddd01024c118788e72f4214ca8ba979399d..eb2f4373de9a289b9d460aeb1ff5a3a9b3a49d60 100644 (file)
@@ -1,3 +1,6 @@
+! { dg-do run { target { offload_device_gcn } } }
+! { dg-do link { target { ! offload_device_gcn } } }
+
 ! { dg-require-effective-target gomp_hipfort_module }
 ! { dg-require-effective-target gomp_libamdhip64 }
 ! { dg-additional-options "-lamdhip64" }
index 0afec83184133883bae79d5fc951ddb819e2190c..0ebbe8063e39ac7e9612743649589e502e155831 100644 (file)
@@ -1,3 +1,6 @@
+! { dg-do run { target { offload_device_gcn } } }
+! { dg-do link { target { ! offload_device_gcn } } }
+
 ! { dg-require-effective-target gomp_libamdhip64 }
 ! { dg-additional-options "-lamdhip64" }
 
index cef592f492688f1123099349a121c9a57c32875f..d29a689de8959f802e5673204160bdf633ed2bc5 100644 (file)
@@ -1,3 +1,6 @@
+! { dg-do run { target { offload_device_nvptx } } }
+! { dg-do link { target { ! offload_device_nvptx } } }
+
 ! { dg-require-effective-target gomp_hipfort_module }
 ! { dg-require-effective-target openacc_cudart }
 ! { dg-require-effective-target openacc_cuda }
index c1ef29d70083f423af14fc7b0a7e0bc80db9ded1..20636103b732d58658a0550b3af9de21e1186f55 100644 (file)
@@ -1,3 +1,6 @@
+! { dg-do run { target { offload_device_nvptx } } }
+! { dg-do link { target { ! offload_device_nvptx } } }
+
 ! { dg-require-effective-target openacc_libcudart }
 ! { dg-require-effective-target openacc_libcuda }
 ! { dg-additional-options "-lcuda -lcudart" }