[Bug middle-end/90115] OpenACC: predetermined private levels for variables declared in blocks

2022-10-28 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90115

--- Comment #19 from CVS Commits  ---
The releases/gcc-12 branch has been updated by Thomas Schwinge
:

https://gcc.gnu.org/g:9b116c51a451995f1bae8fdac0748fcf3f06aafe

commit r12-8874-g9b116c51a451995f1bae8fdac0748fcf3f06aafe
Author: Julian Brown 
Date:   Wed Oct 12 20:44:57 2022 +

OpenACC: Don't gang-privatize artificial variables [PR90115]

This patch prevents compiler-generated artificial variables from being
treated as privatization candidates for OpenACC.

The rationale is that e.g. "gang-private" variables actually must be
shared by each worker and vector spawned within a particular gang, but
that sharing is not necessary for any compiler-generated variable (at
least at present, but no such need is anticipated either).  Variables on
the stack (and machine registers) are already private per-"thread"
(gang, worker and/or vector), and that's fine for artificial variables.

We're restricting this to blocks, as we still need to understand what it
means for a 'DECL_ARTIFICIAL' to appear in a 'private' clause.

Several tests need their scan output patterns adjusted to compensate.

2022-10-14  Julian Brown  

PR middle-end/90115
gcc/
* omp-low.cc (oacc_privatization_candidate_p): Artificial vars are
not
privatization candidates.

libgomp/
* testsuite/libgomp.oacc-fortran/declare-1.f90: Adjust scan output.
* testsuite/libgomp.oacc-fortran/host_data-5.F90: Likewise.
* testsuite/libgomp.oacc-fortran/if-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/print-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: Likewise.

Co-authored-by: Thomas Schwinge 
(cherry picked from commit 11e811d8e2f63667f60f73731bb934273f5882b8)

[Bug middle-end/90115] OpenACC: predetermined private levels for variables declared in blocks

2022-10-28 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90115

--- Comment #18 from CVS Commits  ---
The master branch has been updated by Thomas Schwinge :

https://gcc.gnu.org/g:11e811d8e2f63667f60f73731bb934273f5882b8

commit r13-3541-g11e811d8e2f63667f60f73731bb934273f5882b8
Author: Julian Brown 
Date:   Wed Oct 12 20:44:57 2022 +

OpenACC: Don't gang-privatize artificial variables [PR90115]

This patch prevents compiler-generated artificial variables from being
treated as privatization candidates for OpenACC.

The rationale is that e.g. "gang-private" variables actually must be
shared by each worker and vector spawned within a particular gang, but
that sharing is not necessary for any compiler-generated variable (at
least at present, but no such need is anticipated either).  Variables on
the stack (and machine registers) are already private per-"thread"
(gang, worker and/or vector), and that's fine for artificial variables.

We're restricting this to blocks, as we still need to understand what it
means for a 'DECL_ARTIFICIAL' to appear in a 'private' clause.

Several tests need their scan output patterns adjusted to compensate.

2022-10-14  Julian Brown  

PR middle-end/90115
gcc/
* omp-low.cc (oacc_privatization_candidate_p): Artificial vars are
not
privatization candidates.

libgomp/
* testsuite/libgomp.oacc-fortran/declare-1.f90: Adjust scan output.
* testsuite/libgomp.oacc-fortran/host_data-5.F90: Likewise.
* testsuite/libgomp.oacc-fortran/if-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/print-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: Likewise.

Co-authored-by: Thomas Schwinge 

[Bug middle-end/90115] OpenACC: predetermined private levels for variables declared in blocks

2022-03-17 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90115

--- Comment #17 from CVS Commits  ---
The master branch has been updated by Thomas Schwinge :

https://gcc.gnu.org/g:004fc4f2fc686d3366c9e1a2d8b9183796073866

commit r12-7684-g004fc4f2fc686d3366c9e1a2d8b9183796073866
Author: Thomas Schwinge 
Date:   Wed Mar 16 12:15:01 2022 +0100

Enhance further testcases to verify handling of OpenACC privatization level
[PR90115]

As originally introduced in commit 11b8286a83289f5b54e813f14ff56d730c3f3185
"[OpenACC privatization] Largely extend diagnostics and corresponding
testsuite
coverage [PR90115]".

PR middle-end/90115
gcc/testsuite/
* c-c++-common/goacc-gomp/nesting-1.c: Enhance.
* gfortran.dg/goacc/common-block-3.f90: Likewise.
libgomp/
* testsuite/libgomp.oacc-c-c++-common/acc_prof-kernels-1.c:
Enhance.
* testsuite/libgomp.oacc-fortran/if-1.f90: Likewise.

[Bug middle-end/90115] OpenACC: predetermined private levels for variables declared in blocks

2022-03-12 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90115

--- Comment #16 from CVS Commits  ---
The master branch has been updated by Thomas Schwinge :

https://gcc.gnu.org/g:2e53fa7bb2ae9fe1152c27e423be9e261da82ddc

commit r12-7625-g2e53fa7bb2ae9fe1152c27e423be9e261da82ddc
Author: Thomas Schwinge 
Date:   Fri Mar 11 15:10:59 2022 +0100

Enhance further testcases to verify handling of OpenACC privatization level
[PR90115]

As originally introduced in commit 11b8286a83289f5b54e813f14ff56d730c3f3185
"[OpenACC privatization] Largely extend diagnostics and corresponding
testsuite
coverage [PR90115]".

PR middle-end/90115
libgomp/
* testsuite/libgomp.oacc-c-c++-common/default-1.c: Enhance.
* testsuite/libgomp.oacc-c-c++-common/kernels-reduction-1.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/parallel-dims.c: Likewise.
* testsuite/libgomp.oacc-fortran/kernels-reduction-1.f90: Likewise.

[Bug middle-end/90115] OpenACC: predetermined private levels for variables declared in blocks

2022-03-10 Thread tschwinge at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90115

Thomas Schwinge  changed:

   What|Removed |Added

   Last reconfirmed||2022-03-10
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW

--- Comment #15 from Thomas Schwinge  ---
(In reply to Eric Gallager from comment #12)
> So, is it fixed now?

No, more work to be done here.

[Bug middle-end/90115] OpenACC: predetermined private levels for variables declared in blocks

2022-03-10 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90115

--- Comment #14 from CVS Commits  ---
The master branch has been updated by Thomas Schwinge :

https://gcc.gnu.org/g:7a5e036b61aa088e6b8564bc9383d37dfbb4801e

commit r12-7580-g7a5e036b61aa088e6b8564bc9383d37dfbb4801e
Author: Thomas Schwinge 
Date:   Mon Feb 14 16:56:35 2022 +0100

[OpenACC privatization] Analyze 'lookup_decl'-translated DECL [PR90115,
PR102330, PR104774]

... so that it matches what we analyze and what we action on.
Fix-up for commit 29a2f51806c5b30e17a8d0e9ba7915a3c53c34ff "openacc:
Add support for gang local storage allocation in shared memory [PR90115]".

PR middle-end/90115
PR middle-end/102330
PR middle-end/104774
gcc/
* omp-low.cc (oacc_privatization_candidate_p)
(oacc_privatization_scan_clause_chain)
(oacc_privatization_scan_decl_chain, lower_oacc_private_marker):
Analyze 'lookup_decl'-translated DECL.
gcc/testsuite/
* c-c++-common/goacc/kernels-decompose-pr104061-1-3.c: Adjust.
* c-c++-common/goacc/kernels-decompose-pr104061-1-4.c: Likewise.
* c-c++-common/goacc/kernels-decompose-pr104132-1.c: Likewise.
* c-c++-common/goacc/kernels-decompose-pr104133-1.c: Likewise.
* c-c++-common/goacc/kernels-decompose-pr104774-1.c: Likewise.
* c-c++-common/goacc/privatization-1-compute-loop.c: Likewise.
* c-c++-common/goacc/privatization-1-compute.c: Likewise.
* c-c++-common/goacc/privatization-1-routine_gang-loop.c:
Likewise.
* c-c++-common/goacc/privatization-1-routine_gang.c: Likewise.
* gfortran.dg/goacc-gomp/pr102330-1.f90: Likewise, and subsume...
* gfortran.dg/goacc-gomp/pr102330-2.f90: ... this file, and...
* gfortran.dg/goacc-gomp/pr102330-3.f90: ... this file.
* gfortran.dg/goacc/privatization-1-compute-loop.f90: Adjust.
* gfortran.dg/goacc/privatization-1-compute.f90: Likewise.
* gfortran.dg/goacc/privatization-1-routine_gang-loop.f90:
Likewise.
* gfortran.dg/goacc/privatization-1-routine_gang.f90: Likewise.
libgomp/
* testsuite/libgomp.oacc-c-c++-common/kernels-decompose-1.c:
Enhance.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-1.c:
Adjust.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-2.c:
Likewise.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-3.c:
Likewise.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-4.c:
Likewise.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-5.c:
Likewise.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-vector-1.c:
Likewise.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-vector-2.c:
Likewise.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-2.c:
Likewise.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-3.c:
Likewise.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-4.c:
Likewise.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-5.c:
Likewise.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-6.c:
Likewise.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-7.c:
Likewise.
* testsuite/libgomp.oacc-fortran/optional-private.f90: Likewise.
* testsuite/libgomp.oacc-fortran/privatized-ref-1.f95: Likewise.
* testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: Likewise.

[Bug middle-end/90115] OpenACC: predetermined private levels for variables declared in blocks

2022-03-10 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90115

--- Comment #13 from CVS Commits  ---
The master branch has been updated by Thomas Schwinge :

https://gcc.gnu.org/g:1d9dc3dd74eddd192bec1ac6f4d6548a81deb9a5

commit r12-7577-g1d9dc3dd74eddd192bec1ac6f4d6548a81deb9a5
Author: Thomas Schwinge 
Date:   Tue Mar 8 11:51:55 2022 +0100

Enhance further testcases to verify handling of OpenACC privatization level
[PR90115]

As originally introduced in commit 11b8286a83289f5b54e813f14ff56d730c3f3185
"[OpenACC privatization] Largely extend diagnostics and corresponding
testsuite
coverage [PR90115]".

PR middle-end/90115
gcc/testsuite/
* c-c++-common/goacc/nesting-1.c: Enhance.
* gcc.dg/goacc/nested-function-1.c: Likewise.
* gcc.dg/goacc/nested-function-2.c: Likewise.
* gfortran.dg/goacc/nested-function-1.f90: Likewise.
libgomp/
* testsuite/libgomp.oacc-fortran/routine-1.f90: Enhance.
* testsuite/libgomp.oacc-fortran/routine-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/routine-3.f90: Likewise.
* testsuite/libgomp.oacc-fortran/routine-9.f90: Likewise.

[Bug middle-end/90115] OpenACC: predetermined private levels for variables declared in blocks

2022-03-01 Thread egallager at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90115

Eric Gallager  changed:

   What|Removed |Added

 CC||egallager at gcc dot gnu.org

--- Comment #12 from Eric Gallager  ---
(In reply to CVS Commits from comment #11)
> The master branch has been updated by Thomas Schwinge
> :
> 
> https://gcc.gnu.org/g:3050a1a18276d7cdd8946e34cc1344e30efb7030
> 
> commit r12-996-g3050a1a18276d7cdd8946e34cc1344e30efb7030
> Author: Thomas Schwinge 
> Date:   Sat May 22 10:28:34 2021 +0200
> 
> [OpenACC privatization] Prune uninteresting/varying diagnostics in
> 'libgomp.oacc-fortran/privatized-ref-2.f90'
> 
> Minor fix-up for my recent commit
> 11b8286a83289f5b54e813f14ff56d730c3f3185
> "[OpenACC privatization] Largely extend diagnostics and corresponding
> testsuite
> coverage [PR90115]".
> 
> libgomp/
> PR testsuite/90115
> * testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: Prune
> uninteresting/varying diagnostics.
> 
> Reported-by: Sunil K Pandey 

So, is it fixed now?

[Bug middle-end/90115] OpenACC: predetermined private levels for variables declared in blocks

2021-05-22 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90115

--- Comment #11 from CVS Commits  ---
The master branch has been updated by Thomas Schwinge :

https://gcc.gnu.org/g:3050a1a18276d7cdd8946e34cc1344e30efb7030

commit r12-996-g3050a1a18276d7cdd8946e34cc1344e30efb7030
Author: Thomas Schwinge 
Date:   Sat May 22 10:28:34 2021 +0200

[OpenACC privatization] Prune uninteresting/varying diagnostics in
'libgomp.oacc-fortran/privatized-ref-2.f90'

Minor fix-up for my recent commit 11b8286a83289f5b54e813f14ff56d730c3f3185
"[OpenACC privatization] Largely extend diagnostics and corresponding
testsuite
coverage [PR90115]".

libgomp/
PR testsuite/90115
* testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: Prune
uninteresting/varying diagnostics.

Reported-by: Sunil K Pandey 

[Bug middle-end/90115] OpenACC: predetermined private levels for variables declared in blocks

2021-05-21 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90115

--- Comment #10 from CVS Commits  ---
The master branch has been updated by Thomas Schwinge :

https://gcc.gnu.org/g:325aa13996bafce0c4927876c315d1fa706d9881

commit r12-989-g325aa13996bafce0c4927876c315d1fa706d9881
Author: Thomas Schwinge 
Date:   Fri May 21 08:51:47 2021 +0200

[OpenACC privatization] Reject 'static', 'external' in blocks [PR90115]

gcc/
PR middle-end/90115
* omp-low.c (oacc_privatization_candidate_p): Reject 'static',
'external' in blocks.
gcc/testsuite/
PR middle-end/90115
* c-c++-common/goacc/privatization-1-compute-loop.c: Update.
* c-c++-common/goacc/privatization-1-compute.c: Likewise.
* c-c++-common/goacc/privatization-1-routine_gang-loop.c:
Likewise.
* c-c++-common/goacc/privatization-1-routine_gang.c: Likewise.
libgomp/
PR middle-end/90115
* testsuite/libgomp.oacc-c-c++-common/static-variable-1.c: Update.
* testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: Likewise.

[Bug middle-end/90115] OpenACC: predetermined private levels for variables declared in blocks

2021-05-21 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90115

--- Comment #9 from CVS Commits  ---
The master branch has been updated by Thomas Schwinge :

https://gcc.gnu.org/g:11b8286a83289f5b54e813f14ff56d730c3f3185

commit r12-988-g11b8286a83289f5b54e813f14ff56d730c3f3185
Author: Thomas Schwinge 
Date:   Thu May 20 16:11:37 2021 +0200

[OpenACC privatization] Largely extend diagnostics and corresponding
testsuite coverage [PR90115]

gcc/
PR middle-end/90115
* flag-types.h (enum openacc_privatization): New.
* params.opt (-param=openacc-privatization): New.
* doc/invoke.texi (openacc-privatization): Document it.
* omp-general.h (get_openacc_privatization_dump_flags): New
function.
* omp-low.c (oacc_privatization_candidate_p): Add diagnostics.
* omp-offload.c (execute_oacc_device_lower)
: Re-work diagnostics.
* target.def (goacc.adjust_private_decl): Add 'location_t'
parameter.
* doc/tm.texi: Regenerate.
* config/gcn/gcn-protos.h (gcn_goacc_adjust_private_decl): Adjust.
* config/gcn/gcn-tree.c (gcn_goacc_adjust_private_decl): Likewise.
* config/nvptx/nvptx.c (nvptx_goacc_adjust_private_decl):
Likewise.  Preserve it for...
(nvptx_goacc_expand_var_decl): ... use here.
gcc/testsuite/
PR middle-end/90115
* c-c++-common/goacc/privatization-1-compute-loop.c: New file.
* c-c++-common/goacc/privatization-1-compute.c: Likewise.
* c-c++-common/goacc/privatization-1-routine_gang-loop.c:
Likewise.
* c-c++-common/goacc/privatization-1-routine_gang.c: Likewise.
* gfortran.dg/goacc/privatization-1-compute-loop.f90: Likewise.
* gfortran.dg/goacc/privatization-1-compute.f90: Likewise.
* gfortran.dg/goacc/privatization-1-routine_gang-loop.f90:
Likewise.
* gfortran.dg/goacc/privatization-1-routine_gang.f90: Likewise.
* c-c++-common/goacc-gomp/nesting-1.c: Update.
* c-c++-common/goacc/private-reduction-1.c: Likewise.
* gfortran.dg/goacc/private-3.f95: Likewise.
libgomp/
PR middle-end/90115
* testsuite/libgomp.oacc-fortran/private-atomic-1-vector.f90: New
file.
* testsuite/libgomp.oacc-c-c++-common/firstprivate-1.c: Update.
* testsuite/libgomp.oacc-c-c++-common/host_data-7.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-decompose-1.c:
Likewise.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-1.c:
Likewise.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-2.c:
Likewise.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-3.c:
Likewise.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-4.c:
Likewise.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-5.c:
Likewise.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-1.c:
Likewise.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-2.c:
Likewise.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-3.c:
Likewise.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-4.c:
Likewise.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-5.c:
Likewise.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-6.c:
Likewise.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-vector-1.c:
Likewise.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-vector-2.c:
Likewise.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-1.c:
Likewise.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-2.c:
Likewise.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-3.c:
Likewise.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-4.c:
Likewise.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-5.c:
Likewise.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-6.c:
Likewise.
*
testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-7.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/loop-g-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/loop-g-2.c: Likewise.
  

[Bug middle-end/90115] OpenACC: predetermined private levels for variables declared in blocks

2021-05-21 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90115

--- Comment #8 from CVS Commits  ---
The master branch has been updated by Thomas Schwinge :

https://gcc.gnu.org/g:5a0fe1f6c4ad0e50bf4684e723ae2ba17d94c9e4

commit r12-986-g5a0fe1f6c4ad0e50bf4684e723ae2ba17d94c9e4
Author: Thomas Schwinge 
Date:   Thu May 20 15:55:18 2021 +0200

[OpenACC privatization] Explain OpenACC privatization candidate selection
[PR90115]

gcc/
PR middle-end/90115
* omp-low.c (oacc_privatization_candidate_p): New function.
(oacc_privatization_scan_clause_chain)
(oacc_privatization_scan_decl_chain): Use it.  Also
'gcc_checking_assert' that we're not seeing duplicates.

[Bug middle-end/90115] OpenACC: predetermined private levels for variables declared in blocks

2021-05-21 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90115

--- Comment #7 from CVS Commits  ---
The master branch has been updated by Thomas Schwinge :

https://gcc.gnu.org/g:ad4612cb048b261f6834e9155e41e40e9252c80b

commit r12-985-gad4612cb048b261f6834e9155e41e40e9252c80b
Author: Thomas Schwinge 
Date:   Thu May 20 15:45:06 2021 +0200

[OpenACC privatization] Skip processing if no work to be done [PR90115]

gcc/
PR middle-end/90115
* omp-offload.c (execute_oacc_device_lower): Skip processing if no
work to be done.

[Bug middle-end/90115] OpenACC: predetermined private levels for variables declared in blocks

2021-05-21 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90115

--- Comment #6 from CVS Commits  ---
The master branch has been updated by Thomas Schwinge :

https://gcc.gnu.org/g:21803fcaebeab36de0d7b6b8cf6abb9389f5e51f

commit r12-984-g21803fcaebeab36de0d7b6b8cf6abb9389f5e51f
Author: Thomas Schwinge 
Date:   Thu May 20 15:44:09 2021 +0200

[OpenACC privatization] Explain two different configurations [PR90115]

gcc/
PR middle-end/90115
* omp-offload.c (execute_oacc_device_lower): Explain.

[Bug middle-end/90115] OpenACC: predetermined private levels for variables declared in blocks

2021-05-21 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90115

--- Comment #5 from CVS Commits  ---
The master branch has been updated by Thomas Schwinge :

https://gcc.gnu.org/g:ff451ea723deb3fe8471eb96ac9381c063ec6533

commit r12-983-gff451ea723deb3fe8471eb96ac9381c063ec6533
Author: Thomas Schwinge 
Date:   Thu May 20 15:37:07 2021 +0200

[OpenACC privatization] Don't let unhandled 'IFN_UNIQUE_OACC_PRIVATE'
linger [PR90115]

Make sure they're all handled in 'execute_oacc_device_lower'.  Why we at
all
can have 'level == -1' cases is a separate bug to be fixed.

gcc/
PR middle-end/90115
* omp-offload.c (execute_oacc_device_lower)
: Diagnose and handle for 'level == -1'
case, too.
* internal-fn.c (expand_UNIQUE): Don't expect
'IFN_UNIQUE_OACC_PRIVATE'.

[Bug middle-end/90115] OpenACC: predetermined private levels for variables declared in blocks

2021-05-21 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90115

--- Comment #4 from CVS Commits  ---
The master branch has been updated by Thomas Schwinge :

https://gcc.gnu.org/g:3a285ebd0cf5ab762726018515d23280fa6dd445

commit r12-982-g3a285ebd0cf5ab762726018515d23280fa6dd445
Author: Thomas Schwinge 
Date:   Thu May 20 15:22:24 2021 +0200

[OpenACC privatization] Don't evaluate OpenMP 'for' clauses [PR90115]

gcc/
PR middle-end/90115
* omp-low.c (lower_omp_for): Don't evaluate OpenMP 'for' clauses.

[Bug middle-end/90115] OpenACC: predetermined private levels for variables declared in blocks

2021-05-21 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90115

--- Comment #3 from CVS Commits  ---
The master branch has been updated by Thomas Schwinge :

https://gcc.gnu.org/g:f6f45309d9fc140006886456b291e4ac24812cea

commit r12-981-gf6f45309d9fc140006886456b291e4ac24812cea
Author: Thomas Schwinge 
Date:   Thu May 20 15:08:38 2021 +0200

[OpenACC privatization, nvptx] Tighten some aspects [PR90115]

No functional change.

gcc/
PR middle-end/90115
* config/nvptx/nvptx.c (nvptx_goacc_adjust_private_decl)
(nvptx_goacc_expand_var_decl): Tighten.

[Bug middle-end/90115] OpenACC: predetermined private levels for variables declared in blocks

2021-05-21 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90115

--- Comment #2 from CVS Commits  ---
The master branch has been updated by Thomas Schwinge :

https://gcc.gnu.org/g:29a2f51806c5b30e17a8d0e9ba7915a3c53c34ff

commit r12-980-g29a2f51806c5b30e17a8d0e9ba7915a3c53c34ff
Author: Julian Brown 
Date:   Fri Feb 26 04:34:49 2021 -0800

openacc: Add support for gang local storage allocation in shared memory
[PR90115]

This patch implements a method to track the "private-ness" of
OpenACC variables declared in offload regions in gang-partitioned,
worker-partitioned or vector-partitioned modes. Variables declared
implicitly in scoped blocks and those declared "private" on enclosing
directives (e.g. "acc parallel") are both handled. Variables that are
e.g. gang-private can then be adjusted so they reside in GPU shared
memory.

The reason for doing this is twofold: correct implementation of OpenACC
semantics, and optimisation, since shared memory might be faster than
the main memory on a GPU. Handling of private variables is intimately
tied to the execution model for gangs/workers/vectors implemented by
a particular target: for current targets, we use (or on mainline, will
soon use) a broadcasting/neutering scheme.

That is sufficient for code that e.g. sets a variable in worker-single
mode and expects to use the value in worker-partitioned mode. The
difficulty (semantics-wise) comes when the user wants to do something like
an atomic operation in worker-partitioned mode and expects a worker-single
(gang private) variable to be shared across each partitioned worker.
Forcing use of shared memory for such variables makes that work properly.

In terms of implementation, the parallelism level of a given loop is
not fixed until the oaccdevlow pass in the offload compiler, so the
patch delays fixing the parallelism level of variables declared on or
within such loops until the same point. This is done by adding a new
internal UNIQUE function (OACC_PRIVATE) that lists (the address of) each
private variable as an argument, and other arguments set so as to be able
to determine the correct parallelism level to use for the listed
variables. This new internal function fits into the existing scheme for
demarcating OpenACC loops, as described in comments in the patch.

Two new target hooks are introduced: TARGET_GOACC_ADJUST_PRIVATE_DECL and
TARGET_GOACC_EXPAND_VAR_DECL.  The first can tweak a variable declaration
at oaccdevlow time, and the second at expand time.  The first or both
of these target hooks can be used by a given offload target, depending
on its strategy for implementing private variables.

This patch updates the TARGET_GOACC_ADJUST_PRIVATE_DECL target hook in
the AMD GCN backend to the current name and prototype. (An earlier
version of the hook was already present, but dormant.)

gcc/
PR middle-end/90115
* doc/tm.texi.in (TARGET_GOACC_EXPAND_VAR_DECL)
(TARGET_GOACC_ADJUST_PRIVATE_DECL): Add documentation hooks.
* doc/tm.texi: Regenerate.
* expr.c (expand_expr_real_1): Expand decls using the
expand_var_decl OpenACC hook if defined.
* internal-fn.c (expand_UNIQUE): Handle IFN_UNIQUE_OACC_PRIVATE.
* internal-fn.h (IFN_UNIQUE_CODES): Add OACC_PRIVATE.
* omp-low.c (omp_context): Add oacc_privatization_candidates
field.
(lower_oacc_reductions): Add PRIVATE_MARKER parameter.  Insert
before fork.
(lower_oacc_head_tail): Add PRIVATE_MARKER parameter.  Modify
private marker's gimple call arguments, and pass it to
lower_oacc_reductions.
(oacc_privatization_scan_clause_chain)
(oacc_privatization_scan_decl_chain, lower_oacc_private_marker):
New functions.
(lower_omp_for, lower_omp_target, lower_omp_1): Use these.
* omp-offload.c (convert.h): Include.
(oacc_loop_xform_head_tail): Treat private-variable markers like
fork/join when transforming head/tail sequences.
(struct var_decl_rewrite_info): Add struct.
(oacc_rewrite_var_decl, is_sync_builtin_call): New functions.
(execute_oacc_device_lower): Support rewriting gang-private
variables using target hook, and fix up addr_expr and var_decl
nodes afterwards.
* target.def (adjust_private_decl, expand_var_decl): New hooks.
* config/gcn/gcn-protos.h (gcn_goacc_adjust_gangprivate_decl):
Rename to...
(gcn_goacc_adjust_private_decl): ...this.
* config/gcn/gcn-tree.c (gcn_goacc_adjust_gangprivate_decl):
Rename to...
(gcn_goacc_adjust_private_decl): ...this. Add LEVEL parameter.
* config/gcn/gcn.c 

[Bug middle-end/90115] OpenACC: predetermined private levels for variables declared in blocks

2021-04-15 Thread tschwinge at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90115

Thomas Schwinge  changed:

   What|Removed |Added

 Blocks||90114

--- Comment #1 from Thomas Schwinge  ---
Very much related is privatization via the corresponding 'private' clauses, at
the respective level.  (Thus not filing a new PR for that.)

OpenACC 3.1, 2.5.12 "private clause" (similar 2.5.13 "firstprivate clause")
states that on compute constructs, "The 'private' clause [...] declares that a
copy of each item on the list will be created for each gang", and OpenACC 3.1,
2.9.10 "private clause" states:

| The 'private' clause on a 'loop' construct specifies that a copy of each item
in var-list will be created. If the body of the loop is executed in
'vector-partitioned' mode, a copy of the item is created for each thread
associated with each vector lane. If the body of the loop is executed in
'worker-partitioned' 'vector-single' mode, a copy of the item is created for
and shared across the set of threads associated with all the vector lanes of
each worker. Otherwise, a copy of the item is created for and shared across the
set of threads associated with all the vector lanes of all the workers of each
gang.


Also related is PR90114 "Predetermined private levels for variables declared in
OpenACC accelerator routines".


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90114
[Bug 90114] Predetermined private levels for variables declared in OpenACC
accelerator routines