[ was: Re: [PATCH] update edge profile info in nvptx.c ]
On 07/13/2017 06:53 PM, Cesar Philippidis wrote:
The recent basic block profiling changes broke a couple of libgomp OpenACC execution tests involving reductions with nvptx offloading. For gang and worker reductions, the nvptx BE updates the original reduction variable using a lock-free atomic algorithm. This lock-free algorithm utilizes a polling loop to check the state of the variable being updated. This loop introduced a new basic block edge, but it wasn't assigned a branch probability.
Right, and the same problem occurs in nvptx_lockfull_update.
Because of the highly threaded nature of CUDA accelerators, I set the branch probability for that edge as even.
I don't have any experimental data to make a good estimation, so 50/50 sounds fine to me.
As before, the setting of the probability of the non-loop edge was missing. I've added that, and committed. Thanks, - Tom
Add missing probabilities in nvptx_lock{less,full}_update 2017-08-02 Tom de Vries <t...@codesourcery.com> Cesar Philippidis <ce...@codesourcery.com> * config/nvptx/nvptx.c (nvptx_lockless_update, nvptx_lockfull_update): Add missing edge probabilities. --- gcc/config/nvptx/nvptx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index 208b115..0d21eb1 100644 --- a/gcc/config/nvptx/nvptx.c +++ b/gcc/config/nvptx/nvptx.c @@ -5072,7 +5072,9 @@ nvptx_lockless_update (location_t loc, gimple_stmt_iterator *gsi, *gsi = gsi_for_stmt (gsi_stmt (*gsi)); post_edge->flags ^= EDGE_TRUE_VALUE | EDGE_FALLTHRU; + post_edge->probability = profile_probability::even (); edge loop_edge = make_edge (loop_bb, loop_bb, EDGE_FALSE_VALUE); + loop_edge->probability = profile_probability::even (); set_immediate_dominator (CDI_DOMINATORS, loop_bb, pre_bb); set_immediate_dominator (CDI_DOMINATORS, post_bb, loop_bb); @@ -5145,7 +5147,9 @@ nvptx_lockfull_update (location_t loc, gimple_stmt_iterator *gsi, /* Create the lock loop ... */ locked_edge->flags ^= EDGE_TRUE_VALUE | EDGE_FALLTHRU; - make_edge (lock_bb, lock_bb, EDGE_FALSE_VALUE); + locked_edge->probability = profile_probability::even (); + edge loop_edge = make_edge (lock_bb, lock_bb, EDGE_FALSE_VALUE); + loop_edge->probability = profile_probability::even (); set_immediate_dominator (CDI_DOMINATORS, lock_bb, entry_bb); set_immediate_dominator (CDI_DOMINATORS, update_bb, lock_bb);