[Polly] Fix parallelism check for reductions

Tobias Grosser tobias at grosser.es
Tue Jul 15 01:34:38 PDT 2014


On 15/07/2014 02:09, Johannes Doerfert wrote:
> r213019.
>
> "Final comments" inlined.
>
>>>        // The node is parallel only if reductions are ignored or
>>>           privatized.
>>>
>>> Reductions don't make a loop parallel, no?
> They can, or what would you say to:
> for (i)
>     sum += A[i];

You removed the the change I cited:

+
+  // The node is only parallel because of reductions

What you want to say is that the node is only parallel in case 
reductions are handled appropriately.

Your original sentence suggests that a reduction makes a loop parallel.
Assuming we have an arbitrary non-parallel loop:

for (i)
   A[0] *= A[0] // Not a reduction.

Just adding a reduction does not make this loop parallel

for (i)
   A[0] *= A[0] // Not a reduction.
   sum += i // Now a reduction.

I know that is not what you meant, but the original phrase is not very 
clear.

>>>> +  /// we can ignore them during the scheduling. This is the case
>>>> + since the order  /// in which the reduction statements are executed
>>>> + does not matter. However,  /// if they are executed in parallel we
>>>> + need to take additional measures  /// (e.g, privatization) to ensure
>>>> + a correct result. The (reverse) transitive  /// closure of the
>>>> + reduction dependences are used to check for parallel  /// executed
> reduction statements during code generation.
>>>> +  ///
>>>> +  /// FIXME: As soon as the code generation can handle reductions we
> can get
>>>> +  ///        rid of the current TYPE_RED dependences and rename the
> TYPE_TC_RED
>>>> +  ///        to TYPE_RED.
>>>
>>> I don't get this FIXME. What is needed in the code generation to remove
> TC_RED? (You can just remove it, if you don't want to discuss this now).
> I remove the fixme but the idea is that we won't need the current TYPE_RED
> anymore.

I understand, but you still did not explain _why_ TYPE_RED is not needed 
if you have special code generation support. I know you know this, but 
it is not obvious to me.

Tobias



More information about the llvm-commits mailing list