Arm Optimization Report is a new, beta-quality feature of Arm Compiler for Linux version 19.3 that builds upon the
llvm-opt-report tool available in open-source LLVM. The new Arm Optimization Report feature makes it easier to see what optimization decisions the compiler is making, in-line with your source code.
Arm Optimization Report is a BETA feature that remains under development, and therefore is subject to ongoing changes. The information in this tutorial is accurate at the time of publication however, it might not be fully representative of the final product. Please contact your Arm representative if you experience unexpected results.
Arm Optimization Report helps answer questions regarding unrolling, vectorization, and interleaving:
To answer the questions: Was a loop unrolled? If so, what was the unroll factor?
Unrolling is when a scalar loop is transformed to perform multiple iterations at once, but still as scalar instructions.
The unroll factor is the number of iterations of the original loop that are performed at once. Sometimes, loops with known small iteration counts are completely unrolled, such that no loop structure remains. In completely unrolled cases, the unroll factor is the total scalar iteration count.
To answer the questions: Was a loop vectorized? If so, what was the vectorization factor?
Vectorization is when multiple iterations of a scalar loop are replaced by a single iteration of vector instructions.
The vectorization factor is the number of lanes in the vector unit, and corresponds to the number of scalar iterations performed by each vector instruction
The true vectorization factor is unknown at compile-time for SVE, because SVE supports scalable vectors.
For this reason, when SVE is enabled, Arm Optimization Report reports a vectorization factor that corresponds to a 128-bit SVE implementation.
If you are working with an SVE implementation with a larger vector width (for example, 256 or 512 bits), the number of scalar iterations performed by each vector instruction increases proportionally.
SVE scaling factor = <true SVE vector width> / 128
To answer the question: What was the interleave count?
Interleaving is a combination of vectorization followed by unrolling; multiple streams of vector instructions are performed in each iteration of the loop.
This combination of vectorization and unrolling information lets you know how many iterations of the original scalar loop are performed in each iteration of the generated code.
Number of scalar iterations = <unroll factor> x <vectorization factor> x <interleave count> x <SVE scaling factor>
The annotations Arm Optimization Report uses to annotate the source code are:
|| A function was inlined.
|| A loop was unrolled
A loop has been vectorized. Each vector iteration performed has the equivalent of