Intel® Advisor Roofline

What is a Roofline Model?

A Roofline chart is a visual representation of application performance in relation to hardware limitations, including memory bandwidth and computational peaks. It was first proposed by researchers at the University of California at Berkeley in the 2009 paper “Roofline: An Insightful Visual Performance Model for Multicore Architectures.” In 2013, this model was improved by researchers at the Technical University of Lisbon in a paper called “Cache-Aware Roofline Model: Upgrading the Loft.” Traditionally, Roofline charts have been calculated and plotted manually, but Intel® Advisor now automatically builds Roofline plots.

The Roofline provides insight into:

  • Where your performance bottlenecks are
  • How much performance is left on the table because of them
  • Which bottlenecks are possible to address, and which ones are worth addressing
  • Why these bottlenecks are most likely occurring
  • What your next steps should be

While the Roofline chart is not a conversion table that directly tells you exactly what changes need to be made in your code, it is an incredibly useful diagnosis tool. In the same way that a doctor uses a patient’s symptoms to determine what tests to run in order to diagnose the illness (and from there, what to prescribe), a developer can use the Roofline to guide them to what they should investigate next (and from there, what optimizations to make), using the rest of the tools provided in Intel® Advisor, ensuring that they can squeeze the maximum performance out of their code with minimal time and effort.

Understanding a Roofline Chart

Reading the Roofline

The Roofline is plotted with the X axis as Arithmetic Intensity (measured in FLOPs/Byte) and the Y axis as the performance in GFLOPs/Second, both in logarithmic scale. Before collecting data on your program, Intel® Advisor automatically runs some quick benchmarks to measure the hardware limitations of your machine, which it then plots as the lines on the chart, called roofs.

A screenshot of a roofline chart in Intel(R) Advisor 2017 Update 2

The horizontal lines represent the number of floating point computations of a given type your hardware can perform in a given span of time. The diagonal lines are representative of how many bytes of data a given memory subsystem can deliver per second.

Each dot is a loop or function in your program, with its position indicating its performance, which is affected by its optimization, and its Arithmetic Intensity. It is important to note that Intel® Advisor uses a cache-aware roofline model. In classic roofline, a kernel’s Arithmetic Intensity would change with problem size or cache usage optimization, because the byte count was based on DRAM traffic only. This is not so in cache-aware Roofline, where it is a fixed value tied to the algorithm itself – it only changes when the algorithm itself is altered, either by the programmer or occasionally by the compiler.

TIP: The Roofline chart in Intel® Advisor is highly customizable for maximum readability. You can show or hide specific roofs or alter the way loops/functions are displayed on the chart with the options menu accessible from the three horizontal lines in the upper right hand corner of the chart, as well as changing what data is displayed with Advisor's filter features.

Interpreting the Data

In general, the farther a dot is from the topmost roofs, the more room for improvement there is. In accordance with Amdahl’s Law, optimizing the loops that take the largest portion of the program’s total run time will lead to greater speedups than optimizing the loops that take a smaller portion of the run time.

A drawing of a roofline with several labeled example dots

The size and color of the dots in Intel® Advisor’s Roofline chart indicates how much of the total program time a loop or function takes. Small, green dots take up relatively little time, so are likely not worth optimizing. Large, red dots take up the most time, so the best candidates for optimization are the large, red dots with a large amount of space between them and the topmost roofs.

In this example image, loops A, G, and (to a lesser extent) B are the best candidates for optimization, while loops E, C, D, and H are poor candidates.

The roofs above a dot represent the restrictions preventing it from achieving a higher performance, although the roofs below can contribute somewhat. Each roof represents the maximum performance achievable without taking advantage of a particular optimization, which is associated with the next roof up. For example, the Scalar Add Peak represents the maximum possible performance without taking advantage of vectorization, as indicated by the next roof up being the Vector Add Peak.

Of course, this means that some algorithms are incapable of breaking certain roofs. For instance, if Loop A in the example above cannot be vectorized due to dependencies, it cannot break the Scalar Add Peak.

TIP: If you can’t break a memory roof, try to rework your algorithm for higher arithmetic intensity. This will move you to the right and give you more room to increase performance before hitting the memory bandwidth roof. This would be the appropriate approach to optimizing loop F in the example, as well as loop G if its cache usage cannot be improved.

These are generalizations and simplifications, of course. In reality, the position of a loop on the chart is not always a direct indicator of what optimization to make, but it does provide a very reliable guide to what you should investigate next. A loop near (as B) or under (as A) the Scalar Add Peak indicates that you should check whether the loop vectorized – if so, you should investigate the vector efficiency; if not, you should investigate whether it can be vectorized at all. Likewise, a loop that is under a memory roof, such as G in the example, should have its memory access patterns investigated.

For a more in-depth explanation of how to interpret the Roofline results, watch the Roofline tutorial video.

Where can I get Intel® Advisor with Rooflines?

Roofline is a feature of Intel® Advisor beginning officially with version 2017 Update 2. It is also available as a preview feature in Intel® Advisor 2017 Update 1. Intel® Advisor is part of the Parallel Studio XE suite (Cluster Edition and Professional Edition only).

If you already own Intel® Advisor under a license that qualifies you for an update that includes the Roofline analysis, visit the Registration Center to download and install your update.

For more information on getting started with Intel® Advisor Roofline, see the Getting Started Guide.

For more complete information about compiler optimizations, see our Optimization Notice.