aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2022-11-02 09:06:28 +0100
committerSandra Loosemore <sloosemore@baylibre.com>2025-05-15 20:25:47 +0000
commitcc069acadd2723a6a5884251ebc946bd61a4dc44 (patch)
tree3d609d2e57afe09d2d6b2f5d008d331866891352
parent103758a6d5a021b8d703887bbdc990e2b6986c73 (diff)
downloadgcc-cc069acadd2723a6a5884251ebc946bd61a4dc44.zip
gcc-cc069acadd2723a6a5884251ebc946bd61a4dc44.tar.gz
gcc-cc069acadd2723a6a5884251ebc946bd61a4dc44.tar.bz2
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.
-rw-r--r--gcc/fortran/openmp.cc9
-rw-r--r--libgomp/testsuite/libgomp.fortran/target-13.f9013
2 files changed, 15 insertions, 7 deletions
diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc
index 1cf1a81..9f2bb79 100644
--- a/gcc/fortran/openmp.cc
+++ b/gcc/fortran/openmp.cc
@@ -9573,8 +9573,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)
@@ -9634,7 +9637,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/testsuite/libgomp.fortran/target-13.f90 b/libgomp/testsuite/libgomp.fortran/target-13.f90
index 6aacc77..e6334a5 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