aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorTobias Burnus <tburnus@baylibre.com>2024-09-24 10:53:59 +0200
committerTobias Burnus <tburnus@baylibre.com>2024-09-24 10:53:59 +0200
commitb752eed3e3f2f27570ea89b7c2339468698472a8 (patch)
treef09990037b25102e5e209a062d8cf13bea5e3f01 /gcc/cp
parent7e560ffd7562cbd1a51ae6298c515b89ebed1363 (diff)
downloadgcc-b752eed3e3f2f27570ea89b7c2339468698472a8.zip
gcc-b752eed3e3f2f27570ea89b7c2339468698472a8.tar.gz
gcc-b752eed3e3f2f27570ea89b7c2339468698472a8.tar.bz2
OpenMP: Add support for 'self_maps' to the 'require' directive
'self_maps' implies 'unified_shared_memory', except that the latter also permits that explicit maps copy data to device memory while self_maps does not. In GCC, currently, both are handled identical. gcc/c/ChangeLog: * c-parser.cc (c_parser_omp_requires): Handle self_maps clause. gcc/cp/ChangeLog: * parser.cc (cp_parser_omp_requires): Handle self_maps clause. gcc/fortran/ChangeLog: * gfortran.h (enum gfc_omp_requires_kind): Add OMP_REQ_SELF_MAPS. (gfc_namespace): Enlarge omp_requires bitfield. * module.cc (enum ab_attribute, attr_bits): Add AB_OMP_REQ_SELF_MAPS. (mio_symbol_attribute): Handle it. * openmp.cc (gfc_check_omp_requires, gfc_match_omp_requires): Handle self_maps clause. * parse.cc (gfc_parse_file): Handle self_maps clause. gcc/ChangeLog: * lto-cgraph.cc (output_offload_tables, omp_requires_to_name): Handle self_maps clause. * omp-general.cc (struct omp_ts_info, omp_context_selector_matches): Likewise for the associated trait. * omp-general.h (enum omp_requires): Add OMP_REQUIRES_SELF_MAPS. * omp-selectors.h (enum omp_ts_code): Add OMP_TRAIT_IMPLEMENTATION_SELF_MAPS. include/ChangeLog: * gomp-constants.h (GOMP_REQUIRES_SELF_MAPS): #define. libgomp/ChangeLog: * plugin/plugin-gcn.c (GOMP_OFFLOAD_get_num_devices): Accept self_maps clause. * plugin/plugin-nvptx.c (GOMP_OFFLOAD_get_num_devices): Likewise. * libgomp.texi (TR13 Impl. Status): Set to 'Y'. * target.c (gomp_requires_to_name, GOMP_offload_register_ver, gomp_target_init): Handle self_maps clause. * testsuite/libgomp.fortran/self_maps.f90: New test. gcc/testsuite/ChangeLog: * c-c++-common/gomp/declare-variant-1.c: Add self_maps test. * c-c++-common/gomp/requires-4.c: Likewise. * gfortran.dg/gomp/declare-variant-3.f90: Likewise. * c-c++-common/gomp/requires-2.c: Update dg-error msg. * gfortran.dg/gomp/requires-2.f90: Likewise. * gfortran.dg/gomp/requires-self-maps-aux.f90: New. * gfortran.dg/gomp/requires-self-maps.f90: New.
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/parser.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index dbc6070..35c2666 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -50244,6 +50244,8 @@ cp_parser_omp_requires (cp_parser *parser, cp_token *pragma_tok)
this_req = OMP_REQUIRES_UNIFIED_ADDRESS;
else if (!strcmp (p, "unified_shared_memory"))
this_req = OMP_REQUIRES_UNIFIED_SHARED_MEMORY;
+ else if (!strcmp (p, "self_maps"))
+ this_req = OMP_REQUIRES_SELF_MAPS;
else if (!strcmp (p, "dynamic_allocators"))
this_req = OMP_REQUIRES_DYNAMIC_ALLOCATORS;
else if (!strcmp (p, "reverse_offload"))
@@ -50316,6 +50318,7 @@ cp_parser_omp_requires (cp_parser *parser, cp_token *pragma_tok)
{
error_at (cloc, "expected %<unified_address%>, "
"%<unified_shared_memory%>, "
+ "%<self_maps%>, "
"%<dynamic_allocators%>, "
"%<reverse_offload%> "
"or %<atomic_default_mem_order%> clause");