Advanced GPU Performance Modelling and Analysis
Analytical Modeling Frameworks
Setting Performance Ceilings
Before diving into complex simulations or writing a single line of code, it's incredibly useful to know the theoretical limits of your hardware. Analytical models provide a high-level view of performance, helping you understand the maximum possible throughput for a given GPGPU workload. They act as a reality check, telling you whether your performance goals are even possible and highlighting the primary bottlenecks you'll face.
The most widely used of these is the Roofline Model, a simple but powerful tool that visualises performance against two fundamental hardware limits: peak computational throughput and peak memory bandwidth. It helps answer a critical question: is my application limited by how fast it can compute, or by how fast it can fetch data?
Operational Intensity
To use the Roofline Model, we first need to characterise our specific workload. We do this with a metric called Operational Intensity, sometimes called Arithmetic Intensity. It’s the ratio of total floating-point operations (FLOPs) performed to the total bytes of data moved to and from main memory. Essentially, it measures how much computation you do for each byte of data you fetch.
A high operational intensity means a lot of number-crunching on a small amount of data (compute-bound), while a low intensity means data is mostly being moved around with little computation (memory-bound).
Building the Roofline
The Roofline plot sets a performance ceiling based on the hardware's capabilities. This ceiling is formed by two lines. The first is a flat horizontal line representing the GPU's peak theoretical floating-point performance (), measured in FLOPs per second. This is the absolute fastest the GPU can perform calculations, regardless of memory speed.
The second line is a diagonal one representing the peak memory bandwidth (), measured in bytes per second. This line shows that for workloads with low operational intensity, performance is limited by how quickly data can be supplied to the processors. The attainable performance in this region is the product of the memory bandwidth and the operational intensity ().
The point where these two lines intersect is called the ridge point. To the left of this point, performance is limited by memory bandwidth. To the right, it's limited by the computational power of the GPU cores. The goal of optimisation is often to push a kernel's operational intensity to the right of the ridge point, making better use of the GPU's powerful processing capabilities.
Accounting for Latency
The Roofline Model is excellent for understanding throughput, but it ignores a crucial factor: latency. Latency is the time delay in accessing data from memory. For kernels with very low operational intensity and not enough parallelism to hide this delay, latency can become the dominant bottleneck, preventing the application from even reaching the memory bandwidth roof.
To account for this, the extends the Roofline. It introduces a third bound: a vertical 'latency wall' on the left side of the plot. Performance can’t cross this wall, no matter how high the memory bandwidth is. The plot gets its name because the performance ceiling now resembles the hull of a boat, rising from the latency wall, following the bandwidth line, and then flattening at peak performance.
The Boat-Hull model shows that simply having high bandwidth isn't enough. If latency is high, performance will suffer on certain types of workloads.
Time to test your understanding of these performance models.
What is the primary purpose of analytical models like the Roofline model in GPGPU programming?
In the context of the Roofline model, what does 'Operational Intensity' measure?
These analytical models provide an essential first step in performance analysis. By calculating a few key numbers, you can form a strong hypothesis about what's limiting your GPGPU application before you even begin profiling. This allows you to focus your optimisation efforts where they will have the most impact.