Discussion:
SLP reduction: why there is only loop-aware SLP and no straight line?
Anton Youdkevitch
2018-10-23 12:49:03 UTC
Permalink
Looking at the examples for gcc SLP reduction I see
that the reduction variable is defined outside the
loop. It's OK to have this as an example, I thought.
However, looking at the actual implementation I found
out that this is the ONLY SLP reduction gcc does.

/* Detect SLP reduction of the form:

#a1 = phi <a5, a0>
a2 = operation (a1)
a3 = operation (a2)
a4 = operation (a3)
a5 = operation (a4)

#a = phi <a5>

PHI is the reduction phi node (#a1 = phi <a5, a0> above)
FIRST_STMT is the first reduction stmt in the chain
(a2 = operation (a1)).

Return TRUE if a reduction chain was detected. */

Is there any reasoning behind this other than that
the loop-aware one is generally more profitable?
--
Thanks,
Anton
Richard Biener
2018-10-23 14:12:37 UTC
Permalink
On Tue, Oct 23, 2018 at 2:49 PM Anton Youdkevitch
Post by Anton Youdkevitch
Looking at the examples for gcc SLP reduction I see
that the reduction variable is defined outside the
loop. It's OK to have this as an example, I thought.
However, looking at the actual implementation I found
out that this is the ONLY SLP reduction gcc does.
#a1 = phi <a5, a0>
a2 = operation (a1)
a3 = operation (a2)
a4 = operation (a3)
a5 = operation (a4)
#a = phi <a5>
PHI is the reduction phi node (#a1 = phi <a5, a0> above)
FIRST_STMT is the first reduction stmt in the chain
(a2 = operation (a1)).
Return TRUE if a reduction chain was detected. */
Is there any reasoning behind this other than that
the loop-aware one is generally more profitable?
The only reasoning is lack of a implementation ...
(read: time).

IIRC I tried to support the case of vector constructors
as additional sink but even that turned out to be non-trivial
(read: more than a few hours of work)

Richard.
Post by Anton Youdkevitch
--
Thanks,
Anton
Loading...