[all-commits] [llvm/llvm-project] d3921e: [OpenMP] Basic BumpAllocator for (AMD)GPUs (#69806)

Johannes Doerfert via All-commits all-commits at lists.llvm.org
Sat Oct 21 14:49:43 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d3921e467005733daa8e63df4b553052c8ec72c1
      https://github.com/llvm/llvm-project/commit/d3921e467005733daa8e63df4b553052c8ec72c1
  Author: Johannes Doerfert <johannes at jdoerfert.de>
  Date:   2023-10-21 (Sat, 21 Oct 2023)

  Changed paths:
    M openmp/docs/design/Runtimes.rst
    M openmp/libomptarget/DeviceRTL/CMakeLists.txt
    A openmp/libomptarget/DeviceRTL/include/Allocator.h
    A openmp/libomptarget/DeviceRTL/src/Allocator.cpp
    M openmp/libomptarget/DeviceRTL/src/Kernel.cpp
    M openmp/libomptarget/DeviceRTL/src/State.cpp
    M openmp/libomptarget/include/Environment.h
    M openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
    M openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp
    M openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.h
    M openmp/libomptarget/plugins-nextgen/cuda/src/rtl.cpp
    M openmp/libomptarget/plugins-nextgen/generic-elf-64bit/src/rtl.cpp
    M openmp/libomptarget/test/mapping/lambda_mapping.cpp
    A openmp/libomptarget/test/offloading/malloc.c
    A openmp/libomptarget/test/offloading/malloc_parallel.c

  Log Message:
  -----------
  [OpenMP] Basic BumpAllocator for (AMD)GPUs (#69806)

The patch contains a basic BumpAllocator for (AMD)GPUs to allow us to
run more tests. The allocator implements `malloc`, both internally and
externally, while we continue to default to the NVIDIA `malloc` when we
target NVIDIA GPUs. Once we have smarter or customizable allocators we
should consider this choice, for now, this allocator is better than
none. It traps if it is out of memory, making it easy to debug. Heap
size is configured via `LIBOMPTARGET_HEAP_SIZE` and defaults to 512MB.
It allows to track allocation statistics via
`LIBOMPTARGET_DEVICE_RTL_DEBUG=8` (together with
`-fopenmp-target-debug=8`). Two tests were added, and one was enabled.

This is the next step towards fixing
 https://github.com/llvm/llvm-project/issues/66708




More information about the All-commits mailing list