[gcc/devel/omp/gcc-13] OpenMP/Fortran: 'target update' with strides + DT components
Kwok Yeung
kcy@gcc.gnu.org
Fri May 19 16:49:57 GMT 2023
https://gcc.gnu.org/g:2f3bdc6c68d9c104318c6b706f303064859a81d0
commit 2f3bdc6c68d9c104318c6b706f303064859a81d0
Author: Tobias Burnus <tobias@codesourcery.com>
Date: Wed Nov 2 09:06:28 2022 +0100
OpenMP/Fortran: 'target update' with strides + DT components
OpenMP 5.0 permits to use arrays with strides and derived
type components for the list items to the 'from'/'to' clauses
of the 'target update' directive.
Partially committed to mainline as:
6629444170f85 OpenMP/Fortran: 'target update' with DT components
This patch contains the differences to the mainline version.
gcc/fortran/ChangeLog:
* openmp.cc (resolve_omp_clauses): Apply to OpenMP target update.
libgomp/ChangeLog:
* testsuite/libgomp.fortran/target-13.f90: Update test.
Diff:
---
gcc/fortran/ChangeLog.omp | 4 ++++
gcc/fortran/openmp.cc | 9 +++++++--
libgomp/ChangeLog.omp | 4 ++++
libgomp/testsuite/libgomp.fortran/target-13.f90 | 13 ++++++++-----
4 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/gcc/fortran/ChangeLog.omp b/gcc/fortran/ChangeLog.omp
index 139e8f87775..b2f9e8d0257 100644
--- a/gcc/fortran/ChangeLog.omp
+++ b/gcc/fortran/ChangeLog.omp
@@ -1,3 +1,7 @@
+2022-11-02 Tobias Burnus <tobias@codesourcery.com>
+
+ * openmp.cc (resolve_omp_clauses): Apply to OpenMP target update.
+
2022-10-19 Tobias Burnus <tobias@codesourcery.com>
* trans-array.cc (non_negative_strides_array_p): Fix handling
diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc
index 02124a65031..6d4f1f99477 100644
--- a/gcc/fortran/openmp.cc
+++ b/gcc/fortran/openmp.cc
@@ -8487,8 +8487,11 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses,
Only raise an error here if we're really sure the
array isn't contiguous. An expression such as
arr(-n:n,-n:n) could be contiguous even if it looks
- like it may not be. */
+ like it may not be.
+ And OpenMP's 'target update' permits strides for
+ the to/from clause. */
if (code->op != EXEC_OACC_UPDATE
+ && code->op != EXEC_OMP_TARGET_UPDATE
&& list != OMP_LIST_CACHE
&& list != OMP_LIST_DEPEND
&& !gfc_is_simply_contiguous (n->expr, false, true)
@@ -8532,7 +8535,9 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses,
int i;
gfc_array_ref *ar = &lastslice->u.ar;
for (i = 0; i < ar->dimen; i++)
- if (ar->stride[i] && code->op != EXEC_OACC_UPDATE)
+ if (ar->stride[i]
+ && code->op != EXEC_OACC_UPDATE
+ && code->op != EXEC_OMP_TARGET_UPDATE)
{
gfc_error ("Stride should not be specified for "
"array section in %s clause at %L",
diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp
index 7c8e8e44f41..ed846531c36 100644
--- a/libgomp/ChangeLog.omp
+++ b/libgomp/ChangeLog.omp
@@ -1,3 +1,7 @@
+2022-11-02 Tobias Burnus <tobias@codesourcery.com>
+
+ * testsuite/libgomp.fortran/target-13.f90: Update test.
+
2022-10-25 Abid Qadeer <abidh@codesourcery.com>
* testsuite/libgomp.c++/usm-2.C: New test.
diff --git a/libgomp/testsuite/libgomp.fortran/target-13.f90 b/libgomp/testsuite/libgomp.fortran/target-13.f90
index 6aacc778449..e6334a5275f 100644
--- a/libgomp/testsuite/libgomp.fortran/target-13.f90
+++ b/libgomp/testsuite/libgomp.fortran/target-13.f90
@@ -76,7 +76,7 @@ var3a = var3
! ---------------
-!$omp target update from(var1%at(2:3))
+!$omp target update from(var1%at(::2))
if (var1a /= var1) error stop
if (any (var2a /= var2)) error stop
@@ -134,17 +134,20 @@ var1a%at(2)%a = var1a%at(2)%a * 7
var1a%at(3)%s = var1a%at(3)%s * (-3)
block
- integer, volatile :: i1,i2,i3,i4
+ integer, volatile :: i1,i2,i3,i4,i5,i6
i1 = 1
i2 = 2
i3 = 1
- i4 = 2
- !$omp target update from(var3(i1:i2)) from(var1%at(i3:i4))
+ i4 = 1
+ i5 = 2
+ i6 = 1
+ !$omp target update from(var3(i1:i2:i3)) from(var1%at(i4:i5:i6))
i1 = 3
i2 = 3
i3 = 1
i4 = 5
- !$omp target update from(var1%at(i1)%s) from(var1%at(i2)%a(i3:i4))
+ i5 = 1
+ !$omp target update from(var1%at(i1)%s) from(var1%at(i1)%a(i3:i4:i5))
end block
if (var1 /= var1) error stop
More information about the Gcc-cvs
mailing list