Algorithmic restructuring is where the gains lie once performance analysis shows the kernel is already close to a hardware ceiling. That ceiling might be memory bandwidth, the dominant compute pipeline, or the rate at which the load/store path can issue requests. Near the bandwidth limit, adding in-flight requests or occupancy will not help. Reducing data movement or redundant work changes where the kernel sits on the roofline itself. NVIDIA’s Nsight Compute triage guide says it plainly: if a memory-dominated kernel is close to practical peak bandwidth, further gains may require algorithmic change, not micro-tuning. Tuning is still the better investment when the structure already fits the hardware or the kernel is latency-bound, running well below peak throughput.
Performance Analysis Starts with Which Limit Binds
AMD’s HIP documentation sorts GPU kernel bottlenecks into three classes. A compute-bound kernel is limited by arithmetic throughput. A memory-bound kernel is limited by how fast data moves between high-bandwidth memory and on-chip caches. An overhead-bound kernel is limited by latency from host-side scheduling, kernel launches or very small operations. The same documentation describes the usual loop: find the bottleneck, raise it until it stops limiting, then repeat on the next one.
The roofline model makes the compute-versus-memory split visual. Williams, Waterman and Patterson defined operational intensity as operations per byte of DRAM traffic. They showed that a kernel’s intensity decides whether it hits the flat compute roof or the sloped memory roof. Kernels left of the ridge point are memory-bound and kernels to the right are compute-bound. The paper also notes that when a kernel sits left of the ridge, raising operational intensity improves performance by increasing locality.
The two sides call for different kinds of fix. On the memory side, NVIDIA’s roofline guidance says the most important thing to look at is the memory access pattern, so you avoid spending time on parts of the kernel that will not substantively change runtime. Horace He’s well-known explainer makes the same point from the other direction: if you are bandwidth-bound, more FLOPS will not help, and if you are compute-bound, rewriting the logic in C++ to cut overhead will not help either. His quick test for overhead is to double the data size. If runtime does not rise in proportion, the workload is likely overhead-bound.
Best practices such as “avoid branches” only make sense in context, and that context comes from profiling. Our guide to profiling GPU kernels to find the real bottleneck covers the tooling side.
How Do You Tell from a Profile That You Need a Different Algorithm, Not a Faster Kernel?
The signal to look for is saturation of a hardware limit. The Nsight Compute triage guide puts throughput below about 60% of peak in a latency-risk regime and above about 80% in a near-limit regime. When both compute and memory throughput are high, its next question is whether you are close to the hardware limits for this algorithm.
Several readings in that guide point to restructuring rather than tuning:
| Profile reading | What it means | Where the gain lies |
|---|---|---|
| Achieved DRAM bandwidth close to practical peak, stalls mostly long-scoreboard waits | The kernel is past the saturation knee | Algorithmic redesign (less data, better reuse), not more in-flight requests |
| High occupancy and high SM pipeline utilisation | The SM is saturated | Reduce instruction count on the busiest pipeline or restructure the algorithm; more occupancy is irrelevant |
| Dominant pipeline has plateaued | The dominant pipeline is the limiter | Algorithm-level restructuring such as phase splitting or library offload |
| High LSU wavefront utilisation while DRAM throughput is below peak | Wavefront-bound, not bandwidth-bound | Change the access pattern: vectorise, tile, reorganise threads |
| Reported memory throughput around 90% | A max-over-subsystems figure that can mislead | Expand the breakdown to see whether DRAM, L2, L1 or wavefronts is the real limiter |
| Both throughputs below about 60% | Latency-bound | Latency hiding and stall analysis: tuning territory |
Two cautions apply when reading this table. First, the same guide says to validate every change against absolute kernel duration. Speed-of-light percentages can drop while the kernel gets faster, for example when total work goes down, so duration is the ground truth. A restructuring that removes work can lower the utilisation figures while making the kernel faster.
Second, reaching a roofline limit does not mean you are finished. The Alya finite element study (Barcelona Supercomputing Center collaborators, 2024) argues for looking at new optimisation strategies once a classical roofline limit such as memory bandwidth utilisation is reached, rather than stopping there. The authors found that code which scores well on standard metrics, including a high share of the roofline limit, can still have considerable headroom. Bandwidth saturation points away from micro-tuning. It does not tell you to stop optimising.
Why Kernel Tuning Hits a Ceiling on Memory-Bound or Poorly Parallel Algorithms
A kernel fusion study on video analysis separates fusion clearly from kernel tuning. Tuning manages the data and resources one kernel uses on its own, while overall data utilisation across several kernels depends on the algorithms’ access patterns, and that needs a different technique.
The Jasper work on GPU approximate nearest-neighbour search (ANNS) shows this ceiling. Each vector element is read once, used for a single multiply-add and discarded, so the workload is memory-bound by construction. Roofline analysis found current ANNS kernels already running close to the memory-bandwidth limit. The authors conclude that future gains will mainly come from reducing data movement. Their chunked loading scheme gave up to a 14% speedup, and only at small beam widths, where search was memory-latency-bound.
FlashAttention-2 shows the limits from the tuning side. Larger block sizes reduce shared-memory traffic but need more registers and shared memory. Beyond a certain size, register spilling causes a significant slowdown, or the kernel cannot run at all; the authors hand-tune among essentially four block sizes.
A two-stage kernel tuner study draws this conclusion from its results. When the base structure matches a shape’s parallelism and memory-access characteristics, parameter tuning is more likely to have a higher gain ceiling. When structural bottlenecks dominate, tuning parameters alone can hardly deliver gains of the same size.
Restructurings That Move the Ceiling Instead of Approaching It
We group the wins in these sources into four families. Each one changes what is computed or moved, not just how the same steps run.
Reducing data movement. Operator fusion avoids writing intermediate results to global memory only to read them back. Horace He calls it the most important optimisation in deep learning compilers. In the video-analysis fusion study, fusing kernels cut global memory usage by 33% and 44% for the two fusion levels and ran 2 to 3 times faster than sequential execution. On transformers, one study found data movement to be the key training bottleneck. A global data-movement recipe cut that movement by up to 22.91% and gave a 1.30x improvement on a BERT encoder layer. For unstructured meshes, Reguly and colleagues (2018) used element reordering, shared memory as a managed cache, and partitioning-based block formation. In one configuration, hierarchical colouring cut global read and write transactions by roughly 60% and tripled performance.
Changing work decomposition. Profiling showed that the original FlashAttention reached only 25-40% of theoretical peak FLOPs/s on GEMM-heavy work because of suboptimal partitioning between thread blocks and warps. FlashAttention-2 parallelised across the sequence length, split work between warps to reduce shared-memory communication, and cut non-matmul FLOPs. Together these gave about a 2x speedup and 50-73% of theoretical peak on A100. On A100, a non-matmul FLOP costs about 16 times as much as a matmul FLOP. That is why FlashAttention-2 aims to spend as much time as possible on matmul FLOPs.
Avoiding redundant computation. In the Alya assembly kernel, specialising for tetrahedral elements and removing redundant computations cut floating-point operations by 4x and loads and stores by 6x. Combined with better cache effectiveness, this gave a 20x speedup over the baseline. The Jasper authors found the square root took over 40% of Euclidean distance computation time, and dropped it by comparing squared distances. FlashAttention-2 skips blocks that a causal mask makes irrelevant, roughly half of them at long sequence lengths, for a 1.7-1.8x speedup over attention without the causal mask.
Raising arithmetic intensity by trading bytes for compute. AMD’s documentation describes compressing data in global memory, or recomputing activations through gradient checkpointing, as ways to cut memory traffic in exchange for extra arithmetic. Jasper’s RaBitQ quantization raised operational intensity from about 0.7-0.95 to 5.0-6.2 FLOP/byte. That moved the kernel off the bandwidth roof towards the compute roof.
Our position is that the biggest performance gains are usually algorithmic, which is why we ask a lot of questions about what a computation is for before touching its code: computing the same thing the same way is often too strong a constraint.
Worked Example: A Profile That Moved the Bottleneck Twice
An NVIDIA Nsight Compute walkthrough shows the full profile-and-fix cycle on a single kernel. It averages a set of vectors and then performs a matrix-vector multiply.
- First restructuring, decomposition. The original kernel processed independent data sets in a single block. Spreading them across many blocks cut duration from 2.92 seconds to 0.0789 seconds. This was a change in how the work was decomposed, not a launch-parameter tweak.
- Re-profile. Nsight Compute then showed low compute and memory utilisation, with warps stalled on the load/store instruction queue. Source-level analysis found an 8:1 transaction inefficiency on the averaging line, which pointed to uncoalesced global loads. The cause was the one-thread-per-element strategy. Adjacent threads read adjacent vector elements that were not adjacent in memory.
- Second restructuring, access pattern. Rewriting the averaging phase with warp-stride and block-stride loops brought duration down to 0.0216 seconds.
- Re-profile again. The bottleneck had moved to compute. The LSU pipe was now the most heavily used, and shared-memory pressure from the reduction loop was causing warp stalls. At this point the profiler’s own advice was to check whether any computation was redundant.
Each step was a structural change, chosen because the latest profile showed which limit bound at that moment. The walkthrough also shows why a single profile is never the end of the analysis: each fix exposes the next limiter.
When Kernel Tuning Is Still the Better Investment
Tuning still pays under the conditions below.
- The structure already fits. In the two-stage tuner study, a fused operator had a fixed compute and memory structure and a clear dominant bottleneck. There, refactoring had already captured most of the available gain, and parameter search added small but consistent incremental improvements.
- The kernel is latency-bound, not saturated. NVIDIA’s profiler flags throughput below 60% of peak as typically indicating latency problems. In that regime, latency-hiding work such as instruction-level parallelism, prefetching and pipeline interleaving is the relevant fix. Unrolling so that each thread has several independent loads in flight is a classic example.
- The optimum depends on the workload’s shape. In Jasper, the best block size was 32 threads for low-dimensional, memory-bound datasets and 128-256 threads for high-dimensional, compute-heavy ones. No single fixed size was best across all datasets. Matching configuration to shape is real tuning work, and it pays.
- The kernel is a small share of total runtime. In the LULESH case, a 49% kernel speedup over the two-step implementation, on a kernel taking 37% of application time, gave about 11% on the whole application. For the getacc_scatter kernel in the same mesh study, a 1.15x speedup at 83% of peak stream bandwidth gave about 1% for the whole application. When the hot kernel does not dominate, a cheap tuning pass may be the proportionate effort, and an expensive restructuring may not pay back.
The triage guide’s closing criterion applies to both kinds of work: stop when expected gains are small relative to complexity and risk. Restructuring usually carries more risk than tuning, because it changes numerics, data layouts and code that other parts of the system rely on. Not every restructuring helps, either. Reguly and colleagues found a trade-off between data reuse and the synchronisation that extra thread colours bring, and performance suffers on either side of the optimum.
Reading the Whole System, Not Just the Kernel
The Amdahl cases point to a wider lesson. A kernel-level verdict is only as useful as that kernel’s share of the time the user waits. The triage guide notes that dispatch orchestration across a range of kernels can be the main limiter even when each kernel looks healthy. It recommends fixing those idle windows before going deeper into kernel-level tuning. Before choosing between tuning and restructuring a kernel, confirm the GPU is the limit at all, a point our piece on GPUs as part of a larger system develops.
For a step-by-step version of the profile-first workflow, see how to improve GPU performance with a profiling-first approach. For the execution model behind the tuning knobs discussed here, see how a CUDA kernel’s thread hierarchy and execution work.