]> git.ipfire.org Git - thirdparty/gcc.git/commit
libgomp, nvptx: low-latency memory allocator
authorAndrew Stubbs <ams@codesourcery.com>
Fri, 3 Dec 2021 17:46:41 +0000 (17:46 +0000)
committerAndrew Stubbs <ams@codesourcery.com>
Wed, 22 Dec 2021 10:47:37 +0000 (10:47 +0000)
commit4da9ae405b0b6c6b08bb0d0605da0a96c02babb7
tree48c5f2038a1200bfc481b70269dc09dbebda87f4
parent5f702eb7ad1e50bc3ca37e247d8097a8b15d5606
libgomp, nvptx: low-latency memory allocator

This patch adds support for allocating low-latency ".shared" memory on
NVPTX GPU device, via the omp_low_lat_mem_space and omp_alloc.  The memory
can be allocated, reallocated, and freed using a basic but fast algorithm,
is thread safe and the size of the low-latency heap can be configured using
the GOMP_NVPTX_LOWLAT_POOL environment variable.

The use of the PTX dynamic_smem_size feature means that the minimum version
requirement is now bumped to 4.1 (still old at this point).

libgomp/ChangeLog:

* allocator.c (MEMSPACE_ALLOC): New macro.
(MEMSPACE_CALLOC): New macro.
(MEMSPACE_REALLOC): New macro.
(MEMSPACE_FREE): New macro.
(dynamic_smem_size): New constants.
(omp_alloc): Use MEMSPACE_ALLOC.
Implement fall-backs for predefined allocators.
(omp_free): Use MEMSPACE_FREE.
(omp_calloc): Use MEMSPACE_CALLOC.
Implement fall-backs for predefined allocators.
(omp_realloc): Use MEMSPACE_REALLOC.
Implement fall-backs for predefined allocators.
* config/nvptx/team.c (__nvptx_lowlat_heap_root): New variable.
(__nvptx_lowlat_pool): New asm varaible.
(gomp_nvptx_main): Initialize the low-latency heap.
* plugin/plugin-nvptx.c (lowlat_pool_size): New variable.
(GOMP_OFFLOAD_init_device): Read the GOMP_NVPTX_LOWLAT_POOL envvar.
(GOMP_OFFLOAD_run): Apply lowlat_pool_size.
* config/nvptx/allocator.c: New file.
* testsuite/libgomp.c/allocators-1.c: New test.
* testsuite/libgomp.c/allocators-2.c: New test.
* testsuite/libgomp.c/allocators-3.c: New test.
* testsuite/libgomp.c/allocators-4.c: New test.
* testsuite/libgomp.c/allocators-5.c: New test.
* testsuite/libgomp.c/allocators-6.c: New test.
libgomp/ChangeLog.omp
libgomp/allocator.c
libgomp/config/nvptx/allocator.c [new file with mode: 0644]
libgomp/config/nvptx/team.c
libgomp/plugin/plugin-nvptx.c
libgomp/testsuite/libgomp.c/allocators-1.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/allocators-2.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/allocators-3.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/allocators-4.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/allocators-5.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/allocators-6.c [new file with mode: 0644]