Unified Shared Memory: Friend or Foe? Understanding the Implications of Unified Memory on Managed Heaps

Juan Fumero Alfonso, Florin-Gabriel Blanaru, Athanasios Stratikopoulos, Steve Dohrmann, Sandhya Viswanathan, Christos-Efthymios Kotselidis

Research output: Contribution to conferencePaperpeer-review

78 Downloads (Pure)

Abstract

Adopting heterogeneous execution on GPUs and FPGAs in managed runtime systems, such as Java, is a challenging task due to the complexities of the underlying virtual machine. The majority of the current work has been focusing on compiler toolchains to solve the challenge of transparent just-in-time compilation of different code segments onto the accelerators. However, apart from providing automatic code generation, another paramount challenge is the seamless interoperability between the host memory manager and the Garbage Collector (GC). Currently, heterogeneous programming models that run on top of managed runtime systems, such as Aparapi and TornadoVM, need to block the GC when running native code (e.g, JNI code) in order to prevent the GC from moving data while the native code is still running on the hardware accelerator.

To tackle the inefficacy of locking the GC while the GPU operates, this paper proposes a novel Unified Memory (UM) memory allocator for heterogeneous programming frameworks for managed runtime systems. In this paper, we show how, by providing small changes to a Java runtime system, automatic memory management can be enhanced to perform object reclamation not only on the host, but also on the device. This is done by allocating the Java Virtual Machine's object heap in unified memory which is visible to all hardware accelerators. In this manner -although explicit data synchronization between the host and the device is still required to ensure data consistency- we enable transparent page migration of Java heap-allocated objects between the host and the accelerator, since our UM system is aware of pointers and object migration due to GC collections.
This technique has been implemented in the context of MaxineVM, an open source research VM for Java written in Java.

We evaluated our approach on a discrete and an integrated GPU, showcasing under which conditions UM can benefit execution across different benchmarks and configurations. We concluded that when hardware acceleration is not employed, UM does not pose significant overheads unless memory intensive workloads are encountered which can exhibit up to 12% (worst case) and 2% (average) slowdowns. In addition, if hardware acceleration is used, UM can achieve up to 9.3x speedup compared to the non-UM baseline implementation for integrated GPUs.
Original languageEnglish
Publication statusPublished - Oct 2023

Keywords

  • CUDA
  • Data Transfers
  • GPUs
  • JVM
  • Level Zero
  • Memory Management
  • Unified Shared Memory
  • Virtual Machines

Fingerprint

Dive into the research topics of 'Unified Shared Memory: Friend or Foe? Understanding the Implications of Unified Memory on Managed Heaps'. Together they form a unique fingerprint.

Cite this