KMA: A Dynamic Memory Manager for OpenCL

  • Authors:
  • Roy Spliet;Lee Howes;Benedict R. Gaster;Ana Lucia Varbanescu

  • Affiliations:
  • Delft University of Technology, The Netherlands;AMD, USA;AMD, USA;University of Amsterdam, The Netherlands

  • Venue:
  • Proceedings of Workshop on General Purpose Processing Using GPUs
  • Year:
  • 2014

Quantified Score

Hi-index 0.00

Visualization

Abstract

OpenCL is becoming a popular choice for the parallel programming of both multi-core CPUs and GPGPUs. One of the features missing in OpenCL, yet commonly required in irregular parallel applications, is dynamic memory allocation. In this paper, we propose KMA, a first dynamic memory allocator for OpenCL. KMA's design is based on a thorough analysis of a set of 11 algorithms, which shows that dynamic memory allocation is a necessary commodity, typically used for implementing complex data structures (arrays, lists, trees) that need constant restructuring at runtime. Taking into account both the survey findings and the status-quo of OpenCL, we design KMA as a two-layer memory manager that makes smart use of the patterns we identified in our application analysis: its basic functionality provides generic malloc() and free() APIs, while the higher layer provides support for building and efficiently managing dynamic data structures. Our experiments measure the performance and usability of KMA, using both microbenchmarks and a real-life case-study. Results show that when dynamic allocation is mandatory, KMA is a competitive allocator. We conclude that embedding dynamic memory allocation in OpenCL is feasible, but it is a complex, delicate task due to the massive parallelism of the platform and the portability issues between different OpenCL implementations.