Re: [gomp4] Avoiding predication for certain blocks
Hi! I cleaned up this remnant from an earlier OpenACC execution model implementation: On Fri, 29 May 2015 18:23:21 +0200, Bernd Schmidtwrote: > When predicating the code for OpenACC, we should avoid the entry block > in an offloaded region, which contains setup code that should be run in > every thread. The following patch adds a new marker statement that is > used to identify this block. Currently, predication doesn't happen > anyway due to an oversight in the algorithm, but I'll be fixing that in > a followup patch. > > Committed on gomp-4_0-branch. > --- gcc/gimple.def(revision 223867) > +++ gcc/gimple.def(working copy) > +/* GIMPLE_OMP_ENTRY_END marks the end of the unpredicated entry block > + into an offloaded region. */ > +DEFGSCODE(GIMPLE_OMP_ENTRY_END, "gimple_omp_entry_end", GSS_BASE) Committed to gomp-4_0-branch in r234822: commit af76e7c5279c0eb87b6b91b42d2568679ad6bbb9 Author: tschwinge Date: Fri Apr 8 06:30:08 2016 + Remove GIMPLE_OMP_ENTRY_END gcc/ * gimple.def: Remove GIMPLE_OMP_ENTRY_END. Remove all uses. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@234822 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog.gomp| 4 gcc/gimple-low.c | 1 - gcc/gimple-pretty-print.c | 4 gcc/gimple.c | 9 - gcc/gimple.def| 4 gcc/gimple.h | 2 -- gcc/omp-low.c | 15 +-- 7 files changed, 5 insertions(+), 34 deletions(-) diff --git gcc/ChangeLog.gomp gcc/ChangeLog.gomp index 3c9eed6..bffc261 100644 --- gcc/ChangeLog.gomp +++ gcc/ChangeLog.gomp @@ -1,3 +1,7 @@ +2016-04-08 Thomas Schwinge + + * gimple.def: Remove GIMPLE_OMP_ENTRY_END. Remove all uses. + 2016-03-11 Cesar Philippidis * config/nvptx/nvptx.c (nvptx_gen_shuffle): Add support for QImode diff --git gcc/gimple-low.c gcc/gimple-low.c index 13c0165..eb90d48 100644 --- gcc/gimple-low.c +++ gcc/gimple-low.c @@ -313,7 +313,6 @@ lower_stmt (gimple_stmt_iterator *gsi, struct lower_data *data) case GIMPLE_OMP_ATOMIC_LOAD: case GIMPLE_OMP_ATOMIC_STORE: case GIMPLE_OMP_CONTINUE: -case GIMPLE_OMP_ENTRY_END: break; case GIMPLE_CALL: diff --git gcc/gimple-pretty-print.c gcc/gimple-pretty-print.c index 50d61fa..e27214f 100644 --- gcc/gimple-pretty-print.c +++ gcc/gimple-pretty-print.c @@ -2304,10 +2304,6 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple *gs, int spc, int flags) pp_string (buffer, "GIMPLE_SECTIONS_SWITCH"); break; -case GIMPLE_OMP_ENTRY_END: - pp_string (buffer, "GIMPLE_OMP_ENTRY_END"); - break; - case GIMPLE_OMP_MASTER: case GIMPLE_OMP_TASKGROUP: case GIMPLE_OMP_SECTION: diff --git gcc/gimple.c gcc/gimple.c index ee2..b0e19d5 100644 --- gcc/gimple.c +++ gcc/gimple.c @@ -828,15 +828,6 @@ gimple_build_debug_source_bind_stat (tree var, tree value, } -/* Build a GIMPLE_OMP_ENTRY_END statement. */ - -gimple * -gimple_build_omp_entry_end (void) -{ - return gimple_alloc (GIMPLE_OMP_ENTRY_END, 0); -} - - /* Build a GIMPLE_OMP_CRITICAL statement. BODY is the sequence of statements for which only one thread can execute. diff --git gcc/gimple.def gcc/gimple.def index faf0166..2ff22b8 100644 --- gcc/gimple.def +++ gcc/gimple.def @@ -227,10 +227,6 @@ DEFGSCODE(GIMPLE_OMP_ATOMIC_STORE, "gimple_omp_atomic_store", iteration in partially lowered OpenMP code. */ DEFGSCODE(GIMPLE_OMP_CONTINUE, "gimple_omp_continue", GSS_OMP_CONTINUE) -/* GIMPLE_OMP_ENTRY_END marks the end of the unpredicated entry block - into an offloaded region. */ -DEFGSCODE(GIMPLE_OMP_ENTRY_END, "gimple_omp_entry_end", GSS_BASE) - /* GIMPLE_OMP_CRITICAL represents #pragma omp critical [name] diff --git gcc/gimple.h gcc/gimple.h index 22d2a07..6d15dab 100644 --- gcc/gimple.h +++ gcc/gimple.h @@ -1451,7 +1451,6 @@ gdebug *gimple_build_debug_bind_stat (tree, tree, gimple * MEM_STAT_DECL); gdebug *gimple_build_debug_source_bind_stat (tree, tree, gimple * MEM_STAT_DECL); #define gimple_build_debug_source_bind(var,val,stmt) \ gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO) -gimple *gimple_build_omp_entry_end (void); gomp_critical *gimple_build_omp_critical (gimple_seq, tree, tree); gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq); gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree); @@ -6061,7 +6060,6 @@ gimple_return_set_retbnd (gimple *gs, tree retval) case GIMPLE_OMP_ORDERED: \ case GIMPLE_OMP_CRITICAL: \ case GIMPLE_OMP_RETURN:\ -case GIMPLE_OMP_ENTRY_END: \ case GIMPLE_OMP_ATOMIC_LOAD: \ case
Re: [gomp4] Avoiding predication for certain blocks
Hi! On Mon, 01 Jun 2015 13:57:47 +0200, I wrote: On Mon, 1 Jun 2015 12:10:12 +0200, Tom de Vries tom_devr...@mentor.com wrote: On 29/05/15 18:23, Bernd Schmidt wrote: When predicating the code for OpenACC, we should avoid the entry block in an offloaded region, which contains setup code that should be run in every thread. The following patch adds a new marker statement that is used to identify this block. Currently, predication doesn't happen anyway due to an oversight in the algorithm, but I'll be fixing that in a followup patch. Committed on gomp-4_0-branch. this causes an ICE in kernels-eternal.c. (Belatedly) confirmed: [-PASS:-]{+FAIL: c-c++-common/goacc/kernels-eternal.c (internal compiler error)+} {+FAIL:+} c-c++-common/goacc/kernels-eternal.c (test for excess errors) [-PASS:-]{+FAIL: c-c++-common/goacc/kernels-eternal.c -std=c++11 (internal compiler error)+} {+FAIL:+} c-c++-common/goacc/kernels-eternal.c -std=c++11 (test for excess errors) [-PASS:-]{+FAIL: c-c++-common/goacc/kernels-eternal.c -std=c++14 (internal compiler error)+} {+FAIL:+} c-c++-common/goacc/kernels-eternal.c -std=c++14 (test for excess errors) [-PASS:-]{+FAIL: c-c++-common/goacc/kernels-eternal.c -std=c++98 (internal compiler error)+} {+FAIL:+} c-c++-common/goacc/kernels-eternal.c -std=c++98 (test for excess errors) The GIMPLE_OMP_ENTRY_END is removed the first time (!ssa) we call expand_omp_target. The second time we call expand_omp_target (ssa), it's no longer there, and we call 'gimple_code (NULL)' here: ... basic_block entry_succ_bb = single_succ (entry_bb); gsi = gsi_last_bb (entry_succ_bb); if (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_ENTRY_END) gsi_remove (gsi, true); ... This patch fixes that by not attempting to remove GIMPLE_OMP_ENTRY_END when in ssa. Committed to gomp-4_0-branch. I also observed -- and still do observe -- ICEs as follows. Tom, as you've fixed (thanks!) this already for c-c++-common/goacc/kernels-eternal.c, would you mind fixing it for these, too: [-PASS:-]{+FAIL: c-c++-common/goacc-gomp/nesting-1.c (internal compiler error)+} {+FAIL:+} c-c++-common/goacc-gomp/nesting-1.c (test for excess errors) [-PASS:-]{+FAIL: c-c++-common/gomp/nesting-1.c (internal compiler error)+} {+FAIL:+} c-c++-common/gomp/nesting-1.c (test for excess errors) [-PASS:-]{+FAIL: c-c++-common/goacc-gomp/nesting-1.c -std=c++11 (internal compiler error)+} {+FAIL:+} c-c++-common/goacc-gomp/nesting-1.c -std=c++11 (test for excess errors) [-PASS:-]{+FAIL: c-c++-common/goacc-gomp/nesting-1.c -std=c++14 (internal compiler error)+} {+FAIL:+} c-c++-common/goacc-gomp/nesting-1.c -std=c++14 (test for excess errors) [-PASS:-]{+FAIL: c-c++-common/goacc-gomp/nesting-1.c -std=c++98 (internal compiler error)+} {+FAIL:+} c-c++-common/goacc-gomp/nesting-1.c -std=c++98 (test for excess errors) [-PASS:-]{+FAIL: c-c++-common/gomp/nesting-1.c -std=c++11 (internal compiler error)+} {+FAIL:+} c-c++-common/gomp/nesting-1.c -std=c++11 (test for excess errors) [-PASS:-]{+FAIL: c-c++-common/gomp/nesting-1.c -std=c++14 (internal compiler error)+} {+FAIL:+} c-c++-common/gomp/nesting-1.c -std=c++14 (test for excess errors) [-PASS:-]{+FAIL: c-c++-common/gomp/nesting-1.c -std=c++98 (internal compiler error)+} {+FAIL:+} c-c++-common/gomp/nesting-1.c -std=c++98 (test for excess errors) Bernd fixed this as part of his gomp-4_0-branch commit r224073: »omp-low.c [...] (expand_omp_target): Only look for entry-end statement if offloaded«. Grüße, Thomas signature.asc Description: PGP signature
Re: [gomp4] Avoiding predication for certain blocks
Hi! On Mon, 1 Jun 2015 12:10:12 +0200, Tom de Vries tom_devr...@mentor.com wrote: On 29/05/15 18:23, Bernd Schmidt wrote: When predicating the code for OpenACC, we should avoid the entry block in an offloaded region, which contains setup code that should be run in every thread. The following patch adds a new marker statement that is used to identify this block. Currently, predication doesn't happen anyway due to an oversight in the algorithm, but I'll be fixing that in a followup patch. Committed on gomp-4_0-branch. this causes an ICE in kernels-eternal.c. (Belatedly) confirmed: [-PASS:-]{+FAIL: c-c++-common/goacc/kernels-eternal.c (internal compiler error)+} {+FAIL:+} c-c++-common/goacc/kernels-eternal.c (test for excess errors) [-PASS:-]{+FAIL: c-c++-common/goacc/kernels-eternal.c -std=c++11 (internal compiler error)+} {+FAIL:+} c-c++-common/goacc/kernels-eternal.c -std=c++11 (test for excess errors) [-PASS:-]{+FAIL: c-c++-common/goacc/kernels-eternal.c -std=c++14 (internal compiler error)+} {+FAIL:+} c-c++-common/goacc/kernels-eternal.c -std=c++14 (test for excess errors) [-PASS:-]{+FAIL: c-c++-common/goacc/kernels-eternal.c -std=c++98 (internal compiler error)+} {+FAIL:+} c-c++-common/goacc/kernels-eternal.c -std=c++98 (test for excess errors) The GIMPLE_OMP_ENTRY_END is removed the first time (!ssa) we call expand_omp_target. The second time we call expand_omp_target (ssa), it's no longer there, and we call 'gimple_code (NULL)' here: ... basic_block entry_succ_bb = single_succ (entry_bb); gsi = gsi_last_bb (entry_succ_bb); if (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_ENTRY_END) gsi_remove (gsi, true); ... This patch fixes that by not attempting to remove GIMPLE_OMP_ENTRY_END when in ssa. Committed to gomp-4_0-branch. I also observed -- and still do observe -- ICEs as follows. Tom, as you've fixed (thanks!) this already for c-c++-common/goacc/kernels-eternal.c, would you mind fixing it for these, too: [-PASS:-]{+FAIL: c-c++-common/goacc-gomp/nesting-1.c (internal compiler error)+} {+FAIL:+} c-c++-common/goacc-gomp/nesting-1.c (test for excess errors) [-PASS:-]{+FAIL: c-c++-common/gomp/nesting-1.c (internal compiler error)+} {+FAIL:+} c-c++-common/gomp/nesting-1.c (test for excess errors) [-PASS:-]{+FAIL: c-c++-common/goacc-gomp/nesting-1.c -std=c++11 (internal compiler error)+} {+FAIL:+} c-c++-common/goacc-gomp/nesting-1.c -std=c++11 (test for excess errors) [-PASS:-]{+FAIL: c-c++-common/goacc-gomp/nesting-1.c -std=c++14 (internal compiler error)+} {+FAIL:+} c-c++-common/goacc-gomp/nesting-1.c -std=c++14 (test for excess errors) [-PASS:-]{+FAIL: c-c++-common/goacc-gomp/nesting-1.c -std=c++98 (internal compiler error)+} {+FAIL:+} c-c++-common/goacc-gomp/nesting-1.c -std=c++98 (test for excess errors) [-PASS:-]{+FAIL: c-c++-common/gomp/nesting-1.c -std=c++11 (internal compiler error)+} {+FAIL:+} c-c++-common/gomp/nesting-1.c -std=c++11 (test for excess errors) [-PASS:-]{+FAIL: c-c++-common/gomp/nesting-1.c -std=c++14 (internal compiler error)+} {+FAIL:+} c-c++-common/gomp/nesting-1.c -std=c++14 (test for excess errors) [-PASS:-]{+FAIL: c-c++-common/gomp/nesting-1.c -std=c++98 (internal compiler error)+} {+FAIL:+} c-c++-common/gomp/nesting-1.c -std=c++98 (test for excess errors) Grüße, Thomas signature.asc Description: PGP signature
Re: [gomp4] Avoiding predication for certain blocks
On 06/01/2015 12:10 PM, Tom de Vries wrote: On 29/05/15 18:23, Bernd Schmidt wrote: When predicating the code for OpenACC, we should avoid the entry block in an offloaded region, which contains setup code that should be run in every thread. The following patch adds a new marker statement that is used to identify this block. Currently, predication doesn't happen anyway due to an oversight in the algorithm, but I'll be fixing that in a followup patch. Committed on gomp-4_0-branch. Hi Bernd, this causes an ICE in kernels-eternal.c. I don't see this test on my branch checkout - is it something you are using locally? Bernd
Re: [gomp4] Avoiding predication for certain blocks
On 29/05/15 18:23, Bernd Schmidt wrote: When predicating the code for OpenACC, we should avoid the entry block in an offloaded region, which contains setup code that should be run in every thread. The following patch adds a new marker statement that is used to identify this block. Currently, predication doesn't happen anyway due to an oversight in the algorithm, but I'll be fixing that in a followup patch. Committed on gomp-4_0-branch. Hi Bernd, this causes an ICE in kernels-eternal.c. The GIMPLE_OMP_ENTRY_END is removed the first time (!ssa) we call expand_omp_target. The second time we call expand_omp_target (ssa), it's no longer there, and we call 'gimple_code (NULL)' here: ... basic_block entry_succ_bb = single_succ (entry_bb); gsi = gsi_last_bb (entry_succ_bb); if (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_ENTRY_END) gsi_remove (gsi, true); ... This patch fixes that by not attempting to remove GIMPLE_OMP_ENTRY_END when in ssa. Committed to gomp-4_0-branch. Thanks, - Tom Fix GIMPLE_OMP_ENTRY_END handling in expand_omp_target for ssa 2015-06-01 Tom de Vries t...@codesourcery.com * omp-low.c (expand_omp_target): Fix GIMPLE_OMP_ENTRY_END handling for ssa. --- gcc/omp-low.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gcc/omp-low.c b/gcc/omp-low.c index a74a2bea..2634051 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -9486,9 +9486,12 @@ expand_omp_target (struct omp_region *region) } basic_block entry_succ_bb = single_succ (entry_bb); - gsi = gsi_last_bb (entry_succ_bb); - if (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_ENTRY_END) -gsi_remove (gsi, true); + if (!gimple_in_ssa_p (cfun)) +{ + gsi = gsi_last_bb (entry_succ_bb); + if (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_ENTRY_END) + gsi_remove (gsi, true); +} if (offloaded do_splitoff) -- 1.9.1