]> gcc.gnu.org Git - gcc.git/commit
OpenMP 5.0: Implement relaxation of implicit map vs. existing device mappings
authorChung-Lin Tang <cltang@codesourcery.com>
Wed, 5 May 2021 15:11:19 +0000 (08:11 -0700)
committerKwok Cheung Yeung <kcy@codesourcery.com>
Mon, 10 May 2021 17:35:58 +0000 (10:35 -0700)
commit9a4a899134779cef4553f0c616e9577b379783ac
tree920132eeae936b0321ca937e7bae16b92ef51963
parentf290996b035c5739dde57e5e4a7f39b3c739b5c0
OpenMP 5.0: Implement relaxation of implicit map vs. existing device mappings

This patch implements relaxing the requirements when a map with the implicit
attribute encounters an overlapping existing map. As the OpenMP 5.0 spec
describes on page 320, lines 18-27 (and 5.1 spec, page 352, lines 13-22):

"If a single contiguous part of the original storage of a list item with an
 implicit data-mapping attribute has corresponding storage in the device data
 environment prior to a task encountering the construct that is associated with
 the map clause, only that part of the original storage will have corresponding
 storage in the device data environment as a result of the map clause."

Also tracked in the OpenMP spec context as issue #1463:
https://github.com/OpenMP/spec/issues/1463

2021-05-05  Chung-Lin Tang  <cltang@codesourcery.com>

include/ChangeLog:

* gomp-constants.h (GOMP_MAP_IMPLICIT): New special map kind bits value.
(GOMP_MAP_FLAG_SPECIAL_BITS): Define helper mask for whole set of
special map kind bits.
(GOMP_MAP_NONCONTIG_ARRAY_P): Adjust test for non-contiguous array map
kind bits to be more specific.
(GOMP_MAP_IMPLICIT_P): New predicate macro for implicit map kinds.

gcc/ChangeLog:

* tree.h (OMP_CLAUSE_MAP_IMPLICIT_P): New access macro for 'implicit'
bit, using 'base.deprecated_flag' field of tree_node.
* tree-pretty-print.c (dump_omp_clause): Add support for printing
implicit attribute in tree dumping.
* gimplify.c (gimplify_adjust_omp_clauses_1):
Set OMP_CLAUSE_MAP_IMPLICIT_P to 1 if map clause is implicitly created.
(gimplify_adjust_omp_clauses): Adjust place of adding implicitly created
clauses, from simple append, to starting of list, after non-map clauses.
* omp-low.c (lower_omp_target): Add GOMP_MAP_IMPLICIT bits into kind
values passed to libgomp for implicit maps.

gcc/testsuite/ChangeLog:

* c-c++-common/gomp/target-implicit-map-1.c: New test.
* c-c++-common/goacc/combined-reduction.c: Adjust scan test pattern.
* c-c++-common/goacc/firstprivate-mappings-1.c: Likewise.
* c-c++-common/goacc/mdc-1.c: Likewise.
        * c-c++-common/goacc/reduction-1.c: Likewise.
        * c-c++-common/goacc/reduction-2.c: Likewise.
        * c-c++-common/goacc/reduction-3.c: Likewise.
        * c-c++-common/goacc/reduction-4.c: Likewise.
        * c-c++-common/goacc/reduction-8.c: Likewise.
        * g++.dg/goacc/firstprivate-mappings-1.C: Likewise.
        * g++.dg/gomp/target-lambda-1.C: Likewise.
        * g++.dg/gomp/target-this-3.C: Likewise.
        * g++.dg/gomp/target-this-4.C: Likewise.
        * gfortran.dg/goacc/common-block-3.f90: Likewise.
        * gfortran.dg/goacc/loop-tree-1.f90: Likewise.
        * gfortran.dg/goacc/private-explicit-kernels-1.f95: Likewise.
* gfortran.dg/goacc/private-predetermined-kernels-1.f95: Likewise.

libgomp/ChangeLog:

* target.c (gomp_map_vars_existing): Add 'bool implicit' parameter, add
implicit map handling to allow a "superset" existing map as valid case.
(get_kind): Adjust to filter out GOMP_MAP_IMPLICIT bits in return value.
(get_implicit): New function to extract implicit status.
(gomp_map_fields_existing): Adjust arguments in calls to
gomp_map_vars_existing, and add uses of get_implicit.
(gomp_map_vars_internal): Likewise.

* testsuite/libgomp.c-c++-common/target-implicit-map-1.c: New test.
28 files changed:
gcc/ChangeLog.omp
gcc/gimplify.c
gcc/omp-low.c
gcc/testsuite/ChangeLog.omp
gcc/testsuite/c-c++-common/goacc/combined-reduction.c
gcc/testsuite/c-c++-common/goacc/firstprivate-mappings-1.c
gcc/testsuite/c-c++-common/goacc/mdc-1.c
gcc/testsuite/c-c++-common/goacc/reduction-1.c
gcc/testsuite/c-c++-common/goacc/reduction-2.c
gcc/testsuite/c-c++-common/goacc/reduction-3.c
gcc/testsuite/c-c++-common/goacc/reduction-4.c
gcc/testsuite/c-c++-common/goacc/reduction-8.c
gcc/testsuite/c-c++-common/gomp/target-implicit-map-1.c [new file with mode: 0644]
gcc/testsuite/g++.dg/goacc/firstprivate-mappings-1.C
gcc/testsuite/g++.dg/gomp/target-lambda-1.C
gcc/testsuite/g++.dg/gomp/target-this-3.C
gcc/testsuite/g++.dg/gomp/target-this-4.C
gcc/testsuite/gfortran.dg/goacc/common-block-3.f90
gcc/testsuite/gfortran.dg/goacc/loop-tree-1.f90
gcc/testsuite/gfortran.dg/goacc/private-explicit-kernels-1.f95
gcc/testsuite/gfortran.dg/goacc/private-predetermined-kernels-1.f95
gcc/tree-pretty-print.c
gcc/tree.h
include/ChangeLog.omp
include/gomp-constants.h
libgomp/ChangeLog.omp
libgomp/target.c
libgomp/testsuite/libgomp.c-c++-common/target-implicit-map-1.c [new file with mode: 0644]
This page took 0.075504 seconds and 6 git commands to generate.