diff options
author | Julian Brown <julian@codesourcery.com> | 2021-02-02 03:44:34 -0800 |
---|---|---|
committer | Julian Brown <julian@codesourcery.com> | 2021-02-04 15:06:22 -0800 |
commit | 9a4d32f85ccebc0ee4b24e6d9d7a4f11c04d7146 (patch) | |
tree | 9b47e00d20731fb47c9f61a1fdf40ca76843c091 /gcc/fortran/openmp.c | |
parent | f743fe231663e32d52db987650d0ec3381a777af (diff) | |
download | gcc-9a4d32f85ccebc0ee4b24e6d9d7a4f11c04d7146.zip gcc-9a4d32f85ccebc0ee4b24e6d9d7a4f11c04d7146.tar.gz gcc-9a4d32f85ccebc0ee4b24e6d9d7a4f11c04d7146.tar.bz2 |
openacc: Allow strided arrays in update directives
OpenACC 3.0 ("2.14.4. Update Directive") states:
Noncontiguous subarrays may appear. It is implementation-specific
whether noncontiguous regions are updated by using one transfer for
each contiguous subregion, or whether the non-contiguous data is
packed, transferred once, and unpacked, or whether one or more larger
subarrays (no larger than the smallest contiguous region that contains
the specified subarray) are updated.
This patch relaxes some conditions in the Fortran front-end so that
strided accesses are permitted for update directives.
gcc/fortran/
* openmp.c (resolve_omp_clauses): Omit OpenACC update in
contiguity check and stride-specified error.
gcc/testsuite/
* gfortran.dg/goacc/array-with-dt-2.f90: New test.
libgomp/
* testsuite/libgomp.oacc-fortran/array-stride-dt-1.f90: New test.
Diffstat (limited to 'gcc/fortran/openmp.c')
-rw-r--r-- | gcc/fortran/openmp.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index aab17f0..797f6c8 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -5192,7 +5192,8 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses, 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. */ - if (list != OMP_LIST_CACHE + if (code->op != EXEC_OACC_UPDATE + && list != OMP_LIST_CACHE && list != OMP_LIST_DEPEND && !gfc_is_simply_contiguous (n->expr, false, true) && gfc_is_not_contiguous (n->expr)) @@ -5230,7 +5231,7 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses, int i; gfc_array_ref *ar = &array_ref->u.ar; for (i = 0; i < ar->dimen; i++) - if (ar->stride[i]) + if (ar->stride[i] && code->op != EXEC_OACC_UPDATE) { gfc_error ("Stride should not be specified for " "array section in %s clause at %L", |