PERKS: a Locality-Optimized Execution Model for Iterative Memory-bound GPU Applications

Lingqi Zhang, Mohamed Wahib, Peng Chen, Jintao Meng, Xiao Wang, Toshio Endo, Satoshi Matsuoka

Abstract

Iterative memory-bound applications, such as stencil computations and linear solvers, are often limited by the "memory wall" on modern GPUs. Traditional execution models launch a new kernel for each iteration, discarding high-speed on-chip data. This paper introduces PERKS (PERsistent KernelS), an execution model that moves the iterative loop inside a single persistent GPU kernel. By leveraging grid-level synchronization and utilizing unused on-chip resources for caching, PERKS significantly reduces global memory traffic, achieving substantial speedups across various HPC benchmarks.

Introduction: The Memory Wall Challenge

Many critical High-Performance Computing (HPC) applications, including weather forecasting, fluid dynamics, and structural analysis, rely on iterative solvers like stencils or Conjugate Gradient (CG) methods. In a standard GPU implementation, the CPU host manages the "time loop," launching a fresh GPU kernel for every simulation step.

This approach suffers from a significant efficiency gap. Each kernel termination wipes the GPU's high-speed registers and shared memory. Consequently, the subsequent iteration must re-load the same data from the significantly slower global device memory (VRAM). As GPU compute capabilities continue to outpace memory bandwidth, this "memory wall" has become the primary bottleneck for scientific discovery.

The PERKS Execution Model

To address these inefficiencies, the authors propose PERKS (PERsistent KernelS). This model fundamentally alters the interaction between the host and the device.

PERKS transforms the traditional host-side time loop into a device-side persistent kernel, reducing launch overhead and enabling data persistence.

The PERKS model is built on four key pillars:

  1. Persistent Kernels: Instead of thousands of short-lived kernels, PERKS launches a single kernel that remains active throughout the simulation. The iterative loop is moved directly into the GPU device code.
  2. Grid-Wide Synchronization: To maintain data consistency across iterations without exiting the kernel, PERKS utilizes the grid.sync() API. This provides a device-wide barrier, ensuring all thread blocks have completed a step before any proceed to the next.
  3. On-Chip Caching: Since the kernel persists, developers can manually manage "leftover" registers and shared memory to cache domain data. This "recycles" resources that would otherwise sit idle.
  4. Orthogonality: PERKS is designed to complement, rather than replace, existing optimizations like spatial blocking. It acts as a wrapper that enhances the locality of already optimized kernels.

Increasing Operational Intensity

The primary theoretical benefit of PERKS is its ability to shift an application's position on the Roofline model. Most optimizations focus on moving "up" toward peak TFLOPS. PERKS, however, moves "right" by drastically reducing global memory traffic.

By eliminating redundant data transfers between time steps, PERKS increases the operational intensity (Flops/Byte), potentially moving memory-bound kernels into the compute-bound regime.

By caching data on-chip across iterations, the ratio of floating-point operations to bytes transferred from VRAM (Operational Intensity) increases. In some cases, this shift is sufficient to transform a memory-bound problem into a compute-bound one, allowing the application to reach much higher performance levels on the same hardware.

Evaluation and Key Results

The researchers evaluated PERKS against state-of-the-art libraries (including Ginkgo, PPCG, and SSAM) on NVIDIA A100 GPUs. The results demonstrate significant performance gains:

  • Iterative Stencils: 2D stencils saw a geometric mean speedup of 2.12x, while 3D stencils achieved 1.24x.
  • Linear Solvers: In Conjugate Gradient (CG) benchmarks, PERKS achieved a 4.86x speedup for smaller datasets that fit within the L2 cache. Even for large-scale sparse matrices, it maintained a 1.43x lead over the highly optimized Ginkgo library.
  • Architecture Synergy: The model is particularly effective on modern architectures like Ampere (A100), which feature larger L2 caches and register files, providing more "free" space for PERKS to utilize as a manual cache.

Conclusion and Future Directions

PERKS demonstrates that significant performance remains "on the table" by rethinking the traditional host-device execution boundary. By treating on-chip memory as a persistent cache rather than transient storage, PERKS effectively bypasses the memory wall for iterative applications. Future work includes addressing synchronization constraints that limit problem sizes and integrating PERKS into multi-GPU systems to optimize inter-GPU "halo" exchanges.

Summary updated

BibTeX
@inproceedings{zhang2023perks,
  author = {Lingqi Zhang and Mohamed Wahib and Peng Chen and Jintao Meng and Xiao Wang and Toshio Endo and Satoshi Matsuoka},
  title = {{PERKS: a Locality-Optimized Execution Model for Iterative Memory-bound GPU Applications}},
  booktitle = {ICS},
  year = {2023},
  doi = {10.1145/3577193.3593705},
}
Figure