<html>
<head>
<base href="https://llvm.org/bugs/" />
</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 --- - SCoP detection fails on Julia version of PolyBench's `trmm` benchmark"
href="https://llvm.org/bugs/show_bug.cgi?id=28126">28126</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>SCoP detection fails on Julia version of PolyBench's `trmm` benchmark
</td>
</tr>
<tr>
<th>Product</th>
<td>Polly
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Optimizer
</td>
</tr>
<tr>
<th>Assignee</th>
<td>polly-dev@googlegroups.com
</td>
</tr>
<tr>
<th>Reporter</th>
<td>matthias.j.reisinger@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=16540" name="attach_16540" title="Julia's LLVM IR for `trmm`">attachment 16540</a> <a href="attachment.cgi?id=16540&action=edit" title="Julia's LLVM IR for `trmm`">[details]</a></span>
Julia's LLVM IR for `trmm`
I ported PolyBench's `trmm` benchmark to Julia to test Polly on the LLVM IR
that Julia produces when compiling it. The according Julia function that I used
for this purpose looks as follows:
@polly function kernel_trmm(alpha, A, B)
m,n = size(B)
for i = 1:m, j = 1:n
for k = (i+1):m
B[i,j] += A[k,i] * B[k,j]
end
B[i,j] = alpha * B[i,j]
end
end
The LLVM code that Julia emits for this function (when disabling bounds-checks
via `--check-bounds=no`) is attached as `kernel_trmm.ll`.
I invoked Polly the following way on this LLVM code:
$ opt -debug-only=polly-detect -polly-codegen -S llvm/kernel_trmm.ll >
/dev/null
This produces the following output:
Checking region: top => <Function Return>
Top level region is invalid
Checking region: top.split => L10
Non affine loop bound '({-2,+,-1}<%if> + %37)' in loop: if12
Checking region: if => L.L10_crit_edge
Non affine loop bound '({-2,+,-1}<%if> + %37)' in loop: if12
Checking region: if => L.loopexit
Non affine loop bound '({-2,+,-1}<%if> + %37)' in loop: if12
Checking region: if11 => L4.L.loopexit_crit_edge
Non affine loop bound '({-2,+,-1}<%if> + %37)' in loop: if12
Checking region: if11 => L7
Non affine loop bound '({-2,+,-1}<%if> + %37)' in loop: if12
Checking region: if12 => L5.L7_crit_edge
OK
Expanding if12 => L5.L7_crit_edge
Trying if12 => L7
to if12 => L7
Region can not profitably be optimized!
For computing loop bounds Julia emits `select` instructions and it seems that
they are the source of the problem. This issue has also been subject to
discussion on the polly-dev mailing list:
<a href="https://groups.google.com/forum/#!topic/polly-dev/P2RZUlKRo0I">https://groups.google.com/forum/#!topic/polly-dev/P2RZUlKRo0I</a>
The original C version of `trmm` however, when compiled via clang, can be
optimized by Polly without problems.
I am currently working on a solution and hope to come up with new findings as
soon as possible.</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>