Arm Optimization Report

Available in Arm Compiler for Linux v19.3+


Overview How to use Arm Optimization Report Other resources

Introduction

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.

Warning:

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:

Unrolling

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.

Vectorization

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

Note:

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

Interleaving

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>

 

Annotations reference

The annotations Arm Optimization Report uses to annotate the source code are:

Annotation Description
I  A function was inlined.
U<N>  A loop was unrolled <N> times.
V<F, I>

 A loop has been vectorized. Each vector iteration performed has the equivalent of F*I scalar iterations.

Vectorization Factor, F, is the number of scalar elements processed in parallel.

Interleave count, I, is the number of times the vector loop was unrolled.

Next