Hi! On 2021-11-06T00:51:59+0800, Chung-Lin Tang <clt...@codesourcery.com> wrote: > On 2021/6/24 11:55 PM, Jakub Jelinek wrote: >> On Fri, May 14, 2021 at 09:20:25PM +0800, Chung-Lin Tang wrote: >>> + OMP_CLAUSE_MAP_IMPLICIT_P (clause) = 1;
>> As Thomas mentioned, there is now also OMP_CLAUSE_MAP_IMPLICIT that means >> something different: [...] >> Having OMP_CLAUSE_MAP_IMPLICIT and OMP_CLAUSE_MAP_IMPLICIT_P would be too >> confusing. [...] > > I have changed the name to OMP_CLAUSE_MAP_RUNTIME_IMPLICIT_P, [...] > --- a/gcc/tree.h > +++ b/gcc/tree.h > #define OMP_CLAUSE_MAP_IMPLICIT(NODE) \ > (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_MAP)->base.default_def_flag) > +/* Nonzero if this map clause is to be indicated to the runtime as > 'implicit', > + due to being created through implicit data-mapping rules in the > middle-end. > + NOTE: this is different than OMP_CLAUSE_MAP_IMPLICIT. */ > +#define OMP_CLAUSE_MAP_RUNTIME_IMPLICIT_P(NODE) \ > + (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_MAP)->base.deprecated_flag) > --- a/gcc/tree-pretty-print.c > +++ b/gcc/tree-pretty-print.c > @@ -971,6 +971,9 @@ dump_omp_clause (pretty_printer *pp, tree clause, int > spc, dump_flags_t flags) > + if (OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_MAP > + && OMP_CLAUSE_MAP_RUNTIME_IMPLICIT_P (clause)) > + pp_string (pp, "[implicit]"); Looking a dumps files, I recently got confused why '[implicit]' didn't match 'OMP_CLAUSE_MAP_IMPLICIT', and it took me a moment to realize that it actually means 'OMP_CLAUSE_MAP_RUNTIME_IMPLICIT_P'. OK to "Clarify 'OMP_CLAUSE_MAP_RUNTIME_IMPLICIT_P' in 'gcc/tree-pretty-print.cc:dump_omp_clause'", see attached? Grüße Thomas
>From 683edd4387b3888d176588758354ff43e46038b4 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge <tschwi...@baylibre.com> Date: Tue, 14 Jan 2025 12:58:08 +0100 Subject: [PATCH] Clarify 'OMP_CLAUSE_MAP_RUNTIME_IMPLICIT_P' in 'gcc/tree-pretty-print.cc:dump_omp_clause' In commit b7e20480630e3eeb9eed8b3941da3b3f0c22c969 "openmp: Relax handling of implicit map vs. existing device mappings", 'OMP_CLAUSE_MAP_RUNTIME_IMPLICIT_P' was added next to 'OMP_CLAUSE_MAP_IMPLICIT' with comment: "NOTE: this is different than OMP_CLAUSE_MAP_IMPLICIT". However, dumping it as '[implicit]' doesn't exactly help for telling the two apart; make that '[runtime_implicit]'. gcc/ * tree-pretty-print.cc (dump_omp_clause): Clarify 'OMP_CLAUSE_MAP_RUNTIME_IMPLICIT_P'. gcc/testsuite/ * c-c++-common/gomp/defaultmap-4.c: Adjust. * c-c++-common/gomp/defaultmap-5.c: Likewise. * c-c++-common/gomp/target-implicit-map-1.c: Likewise. * c-c++-common/gomp/target-implicit-map-2.c: Likewise. * gfortran.dg/gomp/defaultmap-8.f90: Likewise. * gfortran.dg/gomp/defaultmap-9.f90: Likewise. * gfortran.dg/gomp/map-subarray.f90: Likewise. * gfortran.dg/gomp/target-enter-exit-data.f90: Likewise. --- gcc/testsuite/c-c++-common/gomp/defaultmap-4.c | 4 ++-- gcc/testsuite/c-c++-common/gomp/defaultmap-5.c | 2 +- gcc/testsuite/c-c++-common/gomp/target-implicit-map-1.c | 2 +- gcc/testsuite/c-c++-common/gomp/target-implicit-map-2.c | 2 +- gcc/testsuite/gfortran.dg/gomp/defaultmap-8.f90 | 4 ++-- gcc/testsuite/gfortran.dg/gomp/defaultmap-9.f90 | 2 +- gcc/testsuite/gfortran.dg/gomp/map-subarray.f90 | 2 +- gcc/testsuite/gfortran.dg/gomp/target-enter-exit-data.f90 | 8 ++++---- gcc/tree-pretty-print.cc | 2 +- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/gcc/testsuite/c-c++-common/gomp/defaultmap-4.c b/gcc/testsuite/c-c++-common/gomp/defaultmap-4.c index b84f89b0c7c..14c0c1a97bf 100644 --- a/gcc/testsuite/c-c++-common/gomp/defaultmap-4.c +++ b/gcc/testsuite/c-c++-common/gomp/defaultmap-4.c @@ -20,5 +20,5 @@ foo (void) c[i] = a[i] + b[i]; } -/* { dg-final { scan-tree-dump "pragma omp target.*defaultmap\\(present:aggregate\\) map\\(force_present:c \\\[len: \[0-9\]+\\\]\\\[implicit\\\]\\) map\\(force_present:b \\\[len: \[0-9\]+\\\]\\\[implicit\\\]\\) map\\(force_present:a \\\[len: \[0-9\]+\\\]\\\[implicit\\\]\\)" "gimple" } } */ -/* { dg-final { scan-tree-dump "pragma omp target.*defaultmap\\(present:aggregate\\) map\\(force_present:b \\\[len: \[0-9\]+\\\]\\\[implicit\\\]\\) map\\(force_present:a \\\[len: \[0-9\]+\\\]\\\[implicit\\\]\\) map\\(from:c \\\[len: \[0-9\]+\\\]\\)" "gimple" } } */ +/* { dg-final { scan-tree-dump "pragma omp target.*defaultmap\\(present:aggregate\\) map\\(force_present:c \\\[len: \[0-9\]+\\\]\\\[runtime_implicit\\\]\\) map\\(force_present:b \\\[len: \[0-9\]+\\\]\\\[runtime_implicit\\\]\\) map\\(force_present:a \\\[len: \[0-9\]+\\\]\\\[runtime_implicit\\\]\\)" "gimple" } } */ +/* { dg-final { scan-tree-dump "pragma omp target.*defaultmap\\(present:aggregate\\) map\\(force_present:b \\\[len: \[0-9\]+\\\]\\\[runtime_implicit\\\]\\) map\\(force_present:a \\\[len: \[0-9\]+\\\]\\\[runtime_implicit\\\]\\) map\\(from:c \\\[len: \[0-9\]+\\\]\\)" "gimple" } } */ diff --git a/gcc/testsuite/c-c++-common/gomp/defaultmap-5.c b/gcc/testsuite/c-c++-common/gomp/defaultmap-5.c index cc1a77fadb3..340c1cb8e66 100644 --- a/gcc/testsuite/c-c++-common/gomp/defaultmap-5.c +++ b/gcc/testsuite/c-c++-common/gomp/defaultmap-5.c @@ -44,4 +44,4 @@ void f() /* { dg-final { scan-tree-dump-times "#pragma omp target.* defaultmap\\(firstprivate\\) firstprivate\\(mystruct1\\) firstprivate\\(ptr1\\) firstprivate\\(array1\\) firstprivate\\(scalar1\\)" 1 "gimple" } } */ /* { dg-final { scan-tree-dump-times "#pragma omp target.* defaultmap\\(firstprivate:all\\) firstprivate\\(mystruct1\\) firstprivate\\(ptr1\\) firstprivate\\(array1\\) firstprivate\\(scalar1\\)" 1 "gimple" } } */ -/* { dg-final { scan-tree-dump-times "#pragma omp target.* defaultmap\\(tofrom:all\\) map\\(tofrom:mystruct1 \\\[len: .\\\]\\\[implicit\\\]\\) map\\(tofrom:ptr1 \\\[len: .\\\]\\\[implicit\\\]\\) map\\(tofrom:array1 \\\[len: ..\\\]\\\[implicit\\\]\\) map\\(tofrom:scalar1 \\\[len: .\\\]\\\[implicit\\\]\\)" 1 "gimple" } } */ +/* { dg-final { scan-tree-dump-times "#pragma omp target.* defaultmap\\(tofrom:all\\) map\\(tofrom:mystruct1 \\\[len: .\\\]\\\[runtime_implicit\\\]\\) map\\(tofrom:ptr1 \\\[len: .\\\]\\\[runtime_implicit\\\]\\) map\\(tofrom:array1 \\\[len: ..\\\]\\\[runtime_implicit\\\]\\) map\\(tofrom:scalar1 \\\[len: .\\\]\\\[runtime_implicit\\\]\\)" 1 "gimple" } } */ diff --git a/gcc/testsuite/c-c++-common/gomp/target-implicit-map-1.c b/gcc/testsuite/c-c++-common/gomp/target-implicit-map-1.c index 52944fdc65a..58cd3bbcf86 100644 --- a/gcc/testsuite/c-c++-common/gomp/target-implicit-map-1.c +++ b/gcc/testsuite/c-c++-common/gomp/target-implicit-map-1.c @@ -34,6 +34,6 @@ main (void) /* { dg-final { scan-tree-dump {#pragma omp target enter data map\(alloc:array\[[^]]+\]\[0\] \[len: [0-9]+\]\)} "gimple" } } */ -/* { dg-final { scan-tree-dump {#pragma omp target num_teams.* firstprivate\(i\) map\(tofrom:array \[len: [0-9]+\]\[implicit\]\)} "gimple" } } */ +/* { dg-final { scan-tree-dump {#pragma omp target num_teams.* firstprivate\(i\) map\(tofrom:array \[len: [0-9]+\]\[runtime_implicit\]\)} "gimple" } } */ /* { dg-final { scan-tree-dump {#pragma omp target exit data map\(from:array\[[^]]+\]\[0\] \[len: [0-9]+\]\)} "gimple" } } */ diff --git a/gcc/testsuite/c-c++-common/gomp/target-implicit-map-2.c b/gcc/testsuite/c-c++-common/gomp/target-implicit-map-2.c index b3df466a774..b606cfeb99e 100644 --- a/gcc/testsuite/c-c++-common/gomp/target-implicit-map-2.c +++ b/gcc/testsuite/c-c++-common/gomp/target-implicit-map-2.c @@ -49,7 +49,7 @@ main (void) return 0; } -/* { dg-final { scan-tree-dump {#pragma omp target num_teams.* map\(tofrom:a \[len: [0-9]+\]\[implicit\]\)} "gimple" } } */ +/* { dg-final { scan-tree-dump {#pragma omp target num_teams.* map\(tofrom:a \[len: [0-9]+\]\[runtime_implicit\]\)} "gimple" } } */ /* { dg-final { scan-tree-dump {#pragma omp target num_teams.* map\(struct:a \[len: 1\]\) map\(alloc:a\.ptr \[len: [0-9]+\]\) map\(tofrom:\*_[0-9]+ \[len: [0-9]+\]\) map\(attach:a\.ptr \[bias: 0\]\)} "gimple" } } */ /* { dg-final { scan-tree-dump-not {map\(struct:a \[len: 1\]\) map\(alloc:a\.ptr \[len: 0\]\)} "gimple" } } */ diff --git a/gcc/testsuite/gfortran.dg/gomp/defaultmap-8.f90 b/gcc/testsuite/gfortran.dg/gomp/defaultmap-8.f90 index e26d1e004b1..dfccc9af6ff 100644 --- a/gcc/testsuite/gfortran.dg/gomp/defaultmap-8.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/defaultmap-8.f90 @@ -22,5 +22,5 @@ program main !$omp end target end program -! { dg-final { scan-tree-dump "pragma omp target.*defaultmap\\(present:aggregate\\).*map\\(force_present:c \\\[len: \[0-9\]+\\\]\\\[implicit\\\]\\) map\\(force_present:b \\\[len: \[0-9\]+\\\]\\\[implicit\\\]\\) map\\(force_present:a \\\[len: \[0-9\]+\\\]\\\[implicit\\\]\\)" "gimple" } } -! { dg-final { scan-tree-dump "pragma omp target.*map\\(force_present:b \\\[len: \[0-9\]+\\\]\\\[implicit\\\]\\) map\\(force_present:a \\\[len: \[0-9\]+\\\]\\\[implicit\\\]\\) map\\(from:c \\\[len: \[0-9\]+\\\]\\) defaultmap\\(present:aggregate\\)" "gimple" } } +! { dg-final { scan-tree-dump "pragma omp target.*defaultmap\\(present:aggregate\\).*map\\(force_present:c \\\[len: \[0-9\]+\\\]\\\[runtime_implicit\\\]\\) map\\(force_present:b \\\[len: \[0-9\]+\\\]\\\[runtime_implicit\\\]\\) map\\(force_present:a \\\[len: \[0-9\]+\\\]\\\[runtime_implicit\\\]\\)" "gimple" } } +! { dg-final { scan-tree-dump "pragma omp target.*map\\(force_present:b \\\[len: \[0-9\]+\\\]\\\[runtime_implicit\\\]\\) map\\(force_present:a \\\[len: \[0-9\]+\\\]\\\[runtime_implicit\\\]\\) map\\(from:c \\\[len: \[0-9\]+\\\]\\) defaultmap\\(present:aggregate\\)" "gimple" } } diff --git a/gcc/testsuite/gfortran.dg/gomp/defaultmap-9.f90 b/gcc/testsuite/gfortran.dg/gomp/defaultmap-9.f90 index b24fc95fc74..c031974f568 100644 --- a/gcc/testsuite/gfortran.dg/gomp/defaultmap-9.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/defaultmap-9.f90 @@ -68,4 +68,4 @@ end subroutine ! { dg-final { scan-tree-dump-times "#pragma omp target.* defaultmap\\(firstprivate:all\\) firstprivate\\(scalar\\) firstprivate\\(ptr2\\) firstprivate\\(ptr1\\) firstprivate\\(array\\) firstprivate\\(alloc2\\) firstprivate\\(alloc1\\) firstprivate\\(agg2\\) firstprivate\\(agg1\\)" 1 "gimple" } } -! { dg-final { scan-tree-dump-times "#pragma omp target.* defaultmap\\(tofrom:all\\) map\\(tofrom:scalar \\\[len: .\\\]\\\[implicit\\\]\\) map\\(tofrom:.*ptr2.data \\\[len: .*\\\]\\\[implicit\\\]\\) map\\(to:ptr2 \\\[pointer set, len: ..\\\]\\) map\\(always_pointer:.*ptr2.data \\\[pointer assign, bias: 0\\\]\\) map\\(tofrom:\\*ptr1 \\\[len: .\\\]\\\[implicit\\\]\\) map\\(alloc:ptr1 \\\[pointer assign, bias: 0\\\]\\) map\\(tofrom:array \\\[len: ..\\\]\\\[implicit\\\]\\) map\\(tofrom:.*alloc2.data \\\[len: .*\\\]\\\[implicit\\\]\\) map\\(to:alloc2 \\\[pointer set, len: ..\\\]\\) map\\(alloc:.*alloc2.data \\\[pointer assign, bias: 0\\\]\\) map\\(tofrom:\\*alloc1 \\\[len: .\\\]\\\[implicit\\\]\\) map\\(alloc:alloc1 \\\[pointer assign, bias: 0\\\]\\) map\\(tofrom:agg2 \\\[len: .\\\]\\\[implicit\\\]\\) map\\(tofrom:agg1 \\\[len: .\\\]\\\[implicit\\\]\\)" 1 "gimple" } } +! { dg-final { scan-tree-dump-times "#pragma omp target.* defaultmap\\(tofrom:all\\) map\\(tofrom:scalar \\\[len: .\\\]\\\[runtime_implicit\\\]\\) map\\(tofrom:.*ptr2.data \\\[len: .*\\\]\\\[runtime_implicit\\\]\\) map\\(to:ptr2 \\\[pointer set, len: ..\\\]\\) map\\(always_pointer:.*ptr2.data \\\[pointer assign, bias: 0\\\]\\) map\\(tofrom:\\*ptr1 \\\[len: .\\\]\\\[runtime_implicit\\\]\\) map\\(alloc:ptr1 \\\[pointer assign, bias: 0\\\]\\) map\\(tofrom:array \\\[len: ..\\\]\\\[runtime_implicit\\\]\\) map\\(tofrom:.*alloc2.data \\\[len: .*\\\]\\\[runtime_implicit\\\]\\) map\\(to:alloc2 \\\[pointer set, len: ..\\\]\\) map\\(alloc:.*alloc2.data \\\[pointer assign, bias: 0\\\]\\) map\\(tofrom:\\*alloc1 \\\[len: .\\\]\\\[runtime_implicit\\\]\\) map\\(alloc:alloc1 \\\[pointer assign, bias: 0\\\]\\) map\\(tofrom:agg2 \\\[len: .\\\]\\\[runtime_implicit\\\]\\) map\\(tofrom:agg1 \\\[len: .\\\]\\\[runtime_implicit\\\]\\)" 1 "gimple" } } diff --git a/gcc/testsuite/gfortran.dg/gomp/map-subarray.f90 b/gcc/testsuite/gfortran.dg/gomp/map-subarray.f90 index 197888a4336..74a2f9375ca 100644 --- a/gcc/testsuite/gfortran.dg/gomp/map-subarray.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/map-subarray.f90 @@ -18,7 +18,7 @@ tv%arr2 => arr tv%arr1(1) = tv%arr1(1) + 1 !$omp end target -! { dg-final { scan-tree-dump {(?n)#pragma omp target.* map\(struct:tv \[len: 1\]\) map\(to:tv\.arr1 \[pointer set, len: [0-9]+\]\) map\(tofrom:MEM <integer\(kind=4\)\[0:\]> \[\(integer\(kind=4\)\[0:\] \*\)_[0-9]+\] \[len: _[0-9]+\]\[implicit\]\) map\(attach:tv\.arr1\.data \[bias: 0\]\)} "gimple" } } +! { dg-final { scan-tree-dump {(?n)#pragma omp target.* map\(struct:tv \[len: 1\]\) map\(to:tv\.arr1 \[pointer set, len: [0-9]+\]\) map\(tofrom:MEM <integer\(kind=4\)\[0:\]> \[\(integer\(kind=4\)\[0:\] \*\)_[0-9]+\] \[len: _[0-9]+\]\[runtime_implicit\]\) map\(attach:tv\.arr1\.data \[bias: 0\]\)} "gimple" } } !$omp target map(tv%arr2) map(tv%arr2(1:10)) tv%arr2(1) = tv%arr2(1) + 1 diff --git a/gcc/testsuite/gfortran.dg/gomp/target-enter-exit-data.f90 b/gcc/testsuite/gfortran.dg/gomp/target-enter-exit-data.f90 index c14a11dacd9..2604912ae45 100644 --- a/gcc/testsuite/gfortran.dg/gomp/target-enter-exit-data.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/target-enter-exit-data.f90 @@ -23,17 +23,17 @@ allocate (var%arr(1:100)) !$omp target enter data map(to: var%arr) -! { dg-final { scan-tree-dump-times {(?n)#pragma omp target enter data map\(to:\*\(integer\(kind=[0-9]+\)\[0:\] \*\) var\.arr\.data \[len: D\.[0-9]+ \* [0-9]+\]\[implicit\]\) map\(to:var\.arr \[pointer set, len: [0-9]+\]\) map\(attach_detach:\(integer\(kind=[0-9]+\)\[0:\] \*\) var\.arr\.data \[bias: 0\]\)$} 1 "original" } } +! { dg-final { scan-tree-dump-times {(?n)#pragma omp target enter data map\(to:\*\(integer\(kind=[0-9]+\)\[0:\] \*\) var\.arr\.data \[len: D\.[0-9]+ \* [0-9]+\]\[runtime_implicit\]\) map\(to:var\.arr \[pointer set, len: [0-9]+\]\) map\(attach_detach:\(integer\(kind=[0-9]+\)\[0:\] \*\) var\.arr\.data \[bias: 0\]\)$} 1 "original" } } !$omp target exit data map(release: var%arr) -! { dg-final { scan-tree-dump-times {(?n)#pragma omp target exit data map\(release:\*\(integer\(kind=[0-9]+\)\[0:\] \*\) var\.arr\.data \[len: D\.[0-9]+ \* [0-9]+\]\[implicit\]\) map\(release:var\.arr \[pointer set, len: [0-9]+\]\) map\(attach_detach:\(integer\(kind=[0-9]+\)\[0:\] \*\) var\.arr\.data \[bias: 0\]\)$} 1 "original" } } +! { dg-final { scan-tree-dump-times {(?n)#pragma omp target exit data map\(release:\*\(integer\(kind=[0-9]+\)\[0:\] \*\) var\.arr\.data \[len: D\.[0-9]+ \* [0-9]+\]\[runtime_implicit\]\) map\(release:var\.arr \[pointer set, len: [0-9]+\]\) map\(attach_detach:\(integer\(kind=[0-9]+\)\[0:\] \*\) var\.arr\.data \[bias: 0\]\)$} 1 "original" } } !$omp target enter data map(alloc: var%arr) -! { dg-final { scan-tree-dump-times {(?n)#pragma omp target enter data map\(alloc:\*\(integer\(kind=[0-9]+\)\[0:\] \*\) var\.arr\.data \[len: D\.[0-9]+ \* [0-9]+\]\[implicit\]\) map\(to:var\.arr \[pointer set, len: [0-9]+\]\) map\(attach_detach:\(integer\(kind=[0-9]+\)\[0:\] \*\) var\.arr\.data \[bias: 0\]\)$} 1 "original" } } +! { dg-final { scan-tree-dump-times {(?n)#pragma omp target enter data map\(alloc:\*\(integer\(kind=[0-9]+\)\[0:\] \*\) var\.arr\.data \[len: D\.[0-9]+ \* [0-9]+\]\[runtime_implicit\]\) map\(to:var\.arr \[pointer set, len: [0-9]+\]\) map\(attach_detach:\(integer\(kind=[0-9]+\)\[0:\] \*\) var\.arr\.data \[bias: 0\]\)$} 1 "original" } } !$omp target exit data map(delete: var%arr) -! { dg-final { scan-tree-dump-times {(?n)#pragma omp target exit data map\(delete:\*\(integer\(kind=[0-9]+\)\[0:\] \*\) var\.arr\.data \[len: D\.[0-9]+ \* [0-9]+\]\[implicit\]\) map\(delete:var\.arr \[pointer set, len: [0-9]+\]\) map\(attach_detach:\(integer\(kind=[0-9]+\)\[0:\] \*\) var\.arr\.data \[bias: 0\]\)$} 1 "original" } } +! { dg-final { scan-tree-dump-times {(?n)#pragma omp target exit data map\(delete:\*\(integer\(kind=[0-9]+\)\[0:\] \*\) var\.arr\.data \[len: D\.[0-9]+ \* [0-9]+\]\[runtime_implicit\]\) map\(delete:var\.arr \[pointer set, len: [0-9]+\]\) map\(attach_detach:\(integer\(kind=[0-9]+\)\[0:\] \*\) var\.arr\.data \[bias: 0\]\)$} 1 "original" } } end diff --git a/gcc/tree-pretty-print.cc b/gcc/tree-pretty-print.cc index 18d698721c3..49cb777dd69 100644 --- a/gcc/tree-pretty-print.cc +++ b/gcc/tree-pretty-print.cc @@ -1172,7 +1172,7 @@ dump_omp_clause (pretty_printer *pp, tree clause, int spc, dump_flags_t flags) } if (OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_MAP && OMP_CLAUSE_MAP_RUNTIME_IMPLICIT_P (clause)) - pp_string (pp, "[implicit]"); + pp_string (pp, "[runtime_implicit]"); pp_right_paren (pp); break; -- 2.34.1