[llvm-bugs] [Bug 28126] New: SCoP detection fails on Julia version of PolyBench's `trmm` benchmark

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 14 08:08:37 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28126

            Bug ID: 28126
           Summary: SCoP detection fails on Julia version of PolyBench's
                    `trmm` benchmark
           Product: Polly
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Optimizer
          Assignee: polly-dev at googlegroups.com
          Reporter: matthias.j.reisinger at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 16540
  --> https://llvm.org/bugs/attachment.cgi?id=16540&action=edit
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:
https://groups.google.com/forum/#!topic/polly-dev/P2RZUlKRo0I
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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160614/1d0bf55f/attachment.html>


More information about the llvm-bugs mailing list