This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] update edge profile info in nvptx.c


On 07/20/2017 06:04 AM, Tom de Vries wrote:
> On 07/13/2017 06:53 PM, Cesar Philippidis wrote:
>> Similarly, for nvptx vector reductions, when it comes time to initialize
>> the reduction variable, the nvptx BE constructs a branch so that only
>> vector lanes 1 to vector_length-1 are initialized the the default value
>> for a given reduction type, where vector lane 0 retains the original
>> value of the reduction variable. For similar reason to the gang and
>> worker reductions, I set the probability of the new edge introduced for
>> the vector reduction to even.
>>
> 
> Hi,
> 
> The problem that you describe in abstract term looks like this concretely:
> ....
> (gdb) call debug_bb_n (4)
> ;; basic block 4, loop depth 0, freq 662, maybe hot
> ;;  prev block 3, next block 16, flags: (VISITED)
> ;;  pred:       3 [always (guessed)]  (FALLTHRU,EXECUTABLE)
> # VUSE <.MEM_61>
> # PT = nonlocal unit-escaped null
> _18 = MEM[(const struct .omp_data_t.33D.1518 &).omp_data_i_9(D)
>           clique 1 base 1].s2D.1519;
> # VUSE <.MEMD.1540>
> # USE = anything
> _72 = GOACC_DIM_POS (2);
> if (_72 != 0)
>   goto <bb 16>; [100.00%] [count: INV]
> else
>   goto <bb 17>; [INV] [count: INV]
> ;;  succ:       16 [always]  (TRUE_VALUE)
> ;;              17 (FALSE_VALUE)
> ...
> 
> The edge to bb16 has probability 100%. The edge to bb17 has no
> probability set.

Is that with or without the patch?

>> @@ -5211,6 +5213,7 @@ nvptx_goacc_reduction_init (gcall *call)
>>                 /* Create false edge from call_bb to dst_bb.  */
>>         edge nop_edge = make_edge (call_bb, dst_bb, EDGE_FALSE_VALUE);
>> +      nop_edge->probability = profile_probability::even ();
>>           /* Create phi node in dst block.  */
>>         gphi *phi = create_phi_node (lhs, dst_bb);
>>
> 
> Setting the probability of the edge to bb17 to 50% LGTM.
> 
> But obviously having an accumulative outgoing edge probability of 150%
> is not a good idea.

Yeah, that doesn't seem correct. Would you like to take over this patch?
I saw that you started working on this issue (or a similar one to it) in
PR81442.

Cesar


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]