[llvm-bugs] [Bug 49499] New: llvm-mca for cortex-a57 gets thrown off by SIMD loads with dependencies (negative latency?)

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Mar 9 13:47:56 PST 2021


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

            Bug ID: 49499
           Summary: llvm-mca for cortex-a57 gets thrown off by SIMD loads
                    with dependencies (negative latency?)
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: AArch64
          Assignee: unassignedbugs at nondot.org
          Reporter: martin at martin.st
                CC: andrea.dibiagio at gmail.com,
                    arnaud.degrandmaison at arm.com,
                    llvm-bugs at lists.llvm.org, smithp352 at googlemail.com,
                    Ties.Stuij at arm.com

Given the following instruction series, llvm-mca seems to calculate a sensible
result:

$ cat test.S
    add  v0.16b,  v1.16b, v2.16b
    add  v1.16b,  v3.16b, v0.16b
    add  v2.16b,  v3.16b, v1.16b
$ llvm-mca --mtriple=aarch64-linux-gnu --mcpu=cortex-a57 test.S
Iterations:        100
Instructions:      300
Total Cycles:      903

However if the series is preceded by a SIMD load into the registers that are
used, the total cycle count ends up reduced:

$ cat test2.S
    ld1 {v0.16b, v1.16b, v2.16b, v3.16b}, [x0]
    add  v0.16b,  v1.16b, v2.16b
    add  v1.16b,  v3.16b, v0.16b
    add  v2.16b,  v3.16b, v1.16b
$ llvm-mca --mtriple=aarch64-linux-gnu --mcpu=cortex-a57 test2.S
Iterations:        100
Instructions:      400
Total Cycles:      416

Suddenly the total cycles has dropped in half  as if the load has negative
latency. If the load is into a different set of registers, it doesn't affect
the calculation in the same way:

$ cat test3.S
    ld1 {v16.16b, v17.16b, v18.16b, v19.16b}, [x0]
    add  v0.16b,  v1.16b, v2.16b
    add  v1.16b,  v3.16b, v0.16b
    add  v2.16b,  v3.16b, v1.16b
$ llvm-mca --mtriple=aarch64-linux-gnu --mcpu=cortex-a57 test3.S
Iterations:        100
Instructions:      400
Total Cycles:      904


This doesn't seem to happen for the A55 target though.

-- 
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/20210309/db6c629b/attachment.html>


More information about the llvm-bugs mailing list