<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - [SLPVectorizer] 2-way parallel vectorization hurts perf on x86"
href="https://bugs.llvm.org/show_bug.cgi?id=36280">36280</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[SLPVectorizer] 2-way parallel vectorization hurts perf on x86
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Transformation Utilities
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>spatel+llvm@rotateright.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=19830" name="attach_19830" title="himeno.c source file">attachment 19830</a> <a href="attachment.cgi?id=19830&action=edit" title="himeno.c source file">[details]</a></span>
himeno.c source file
This is a reduction from the Himeno benchmark (attached). In the actual
benchmark, we lose 6% performance on AMD Jaguar when using SLP vectorization
because the extra insert/extract ops cost more than the savings from combining
2 scalar loads and 2 scalar fmul.
(p[1] * x) + z + (p[2] * y)
---------------------------------------------------------------------------
target triple = "x86_64-unknown-unknown"
define float @jacobi(float* %p, float %x, float %y, float %z) {
%gep1 = getelementptr float, float* %p, i64 1
%gep2 = getelementptr float, float* %p, i64 2
%p1 = load float, float* %gep1
%p2 = load float, float* %gep2
%mul1 = fmul float %p1, %x
%mul2 = fmul float %p2, %y
%add1 = fadd float %mul1, %z
%add2 = fadd float %mul2, %add1
ret float %add2
}
$ ./opt -slp-vectorizer minnn.ll -S
define float @jacobi(float* %p, float %x, float %y, float %z) {
%gep1 = getelementptr float, float* %p, i64 1
%gep2 = getelementptr float, float* %p, i64 2
%1 = bitcast float* %gep1 to <2 x float>*
%2 = load <2 x float>, <2 x float>* %1, align 4
%3 = insertelement <2 x float> undef, float %x, i32 0
%4 = insertelement <2 x float> %3, float %y, i32 1
%5 = fmul <2 x float> %4, %2
%6 = extractelement <2 x float> %5, i32 0
%add1 = fadd float %6, %z
%7 = extractelement <2 x float> %5, i32 1
%add2 = fadd float %7, %add1
ret float %add2
}
-----------------------------------------------------------------------
The x86 AVX code looks like this without SLP:
vmulss 4(%rdi), %xmm0, %xmm0
vmulss 8(%rdi), %xmm1, %xmm1
vaddss %xmm2, %xmm0, %xmm0
vaddss %xmm0, %xmm1, %xmm0
And this with SLP:
vmovsd 4(%rdi), %xmm3 # xmm3 = mem[0],zero
vinsertps $16, %xmm1, %xmm0, %xmm0 # xmm0 =
xmm0[0],xmm1[0],xmm0[2,3]
vmulps %xmm3, %xmm0, %xmm0
vaddss %xmm2, %xmm0, %xmm1
vmovshdup %xmm0, %xmm0 # xmm0 = xmm0[1,1,3,3]
vaddss %xmm1, %xmm0, %xmm0</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>