diff mbox series

[committed] Add libgomp.oacc-fortran/acc_on_device-1-4.f (was: Fortran: Use OpenACC's acc_on_device builtin, fix OpenMP' __builtin_is_initial_device: Harmonize 'libgomp.oacc-fortran/acc_on_device-1-*')

Message ID eba065aa-e2a4-4a9c-b2de-971eaee74c01@baylibre.com
State New
Headers show
Series [committed] Add libgomp.oacc-fortran/acc_on_device-1-4.f (was: Fortran: Use OpenACC's acc_on_device builtin, fix OpenMP' __builtin_is_initial_device: Harmonize 'libgomp.oacc-fortran/acc_on_device-1-*') | expand

Commit Message

Tobias Burnus Oct. 16, 2024, 2:22 p.m. UTC
Fixed the following commit

Thomas Schwinge wrote:
> Pushed to trunk branch
> commit 9f549d216c9716e787aaa38593bc9f83195b60ae
> "Fortran: Use OpenACC's acc_on_device builtin, fix OpenMP' __builtin_is_initial_device: Harmonize 'libgomp.oacc-fortran/acc_on_device-1-*'",
> see attached.

by re-adding a testcase which actually tests the builtin.

Committed as r15-4388-gee4fdda70f1080.

Tobias
diff mbox series

Patch

commit ee4fdda70f1080bba5e49cadebc44333e19edeb4
Author: Tobias Burnus <tburnus@baylibre.com>
Date:   Wed Oct 16 16:15:40 2024 +0200

    Add libgomp.oacc-fortran/acc_on_device-1-4.f
    
    Kind of undoes r15-4315-g9f549d216c9716 by adding the original testcase back;
    namely, adding acc_on_device-1-3.f as acc_on_device-1-4.f with
    -fno-builtin-acc_on_device removed.
    
    libgomp/ChangeLog:
    
            * testsuite/libgomp.oacc-fortran/acc_on_device-1-4.f: New test;
            same as acc_on_device-1-3.f but using the builtin function.
---
 .../libgomp.oacc-fortran/acc_on_device-1-4.f       | 60 ++++++++++++++++++++++
 1 file changed, 60 insertions(+)

diff --git a/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-4.f b/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-4.f
new file mode 100644
index 00000000000..401d3a372b3
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-4.f
@@ -0,0 +1,60 @@ 
+! { dg-do run }
+! { dg-additional-options "-cpp" }
+
+! As acc_on_device-1-3.f, but using the acc_on_device builtin.
+
+! { dg-additional-options "-fopt-info-all-omp" }
+! { dg-additional-options "--param=openacc-privatization=noisy" }
+! { dg-additional-options "-foffload=-fopt-info-all-omp" }
+! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+! for testing/documenting aspects of that functionality.
+
+      IMPLICIT NONE
+      INCLUDE "openacc_lib.h"
+
+!Host.
+
+      IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NONE)) STOP 1
+      IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_HOST)) STOP 2
+      IF (ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) STOP 3
+      IF (ACC_ON_DEVICE (ACC_DEVICE_NVIDIA)) STOP 4
+      IF (ACC_ON_DEVICE (ACC_DEVICE_RADEON)) STOP 4
+
+
+!Host via offloading fallback mode.
+
+!$ACC PARALLEL IF(.FALSE.)
+! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } .-1 }
+!TODO Unhandled 'CONST_DECL' instances for constant arguments in 'acc_on_device' calls.
+      IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NONE)) STOP 5
+      IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_HOST)) STOP 6
+      IF (ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) STOP 7
+      IF (ACC_ON_DEVICE (ACC_DEVICE_NVIDIA)) STOP 8
+      IF (ACC_ON_DEVICE (ACC_DEVICE_RADEON)) STOP 8
+!$ACC END PARALLEL
+
+
+#if !ACC_DEVICE_TYPE_host
+
+! Offloaded.
+
+!$ACC PARALLEL
+! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target { ! openacc_host_selected } } .-1 }
+      IF (ACC_ON_DEVICE (ACC_DEVICE_NONE)) STOP 9
+      IF (ACC_ON_DEVICE (ACC_DEVICE_HOST)) STOP 10
+      IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) STOP 11
+#if ACC_DEVICE_TYPE_nvidia
+      IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NVIDIA)) STOP 12
+#else
+      IF (ACC_ON_DEVICE (ACC_DEVICE_NVIDIA)) STOP 13
+#endif
+#if ACC_DEVICE_TYPE_radeon
+      IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_RADEON)) STOP 14
+#else
+      IF (ACC_ON_DEVICE (ACC_DEVICE_RADEON)) STOP 15
+#endif
+!$ACC END PARALLEL
+
+#endif
+
+      END