gcc/libgomp
Andrew Stubbs 30486fab71 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 low-latency allocator
will not work with the PTX 3.1 multilib.

For now, the omp_low_lat_mem_alloc allocator also works, but that will change
when I implement the access traits.

libgomp/ChangeLog:

	* allocator.c (MEMSPACE_ALLOC): New macro.
	(MEMSPACE_CALLOC): New macro.
	(MEMSPACE_REALLOC): New macro.
	(MEMSPACE_FREE): New macro.
	(predefined_alloc_mapping): New array.  Add _Static_assert to match.
	(ARRAY_SIZE): New macro.
	(omp_aligned_alloc): Use MEMSPACE_ALLOC.
	Implement fall-backs for predefined allocators.  Simplify existing
	fall-backs.
	(omp_free): Use MEMSPACE_FREE.
	(omp_calloc): Use MEMSPACE_CALLOC. Implement fall-backs for
	predefined allocators.  Simplify existing fall-backs.
	(omp_realloc): Use MEMSPACE_REALLOC, MEMSPACE_ALLOC, and MEMSPACE_FREE.
	Implement fall-backs for predefined allocators.  Simplify existing
	fall-backs.
	* config/nvptx/team.c (__nvptx_lowlat_pool): New asm variable.
	(__nvptx_lowlat_init): New prototype.
	(gomp_nvptx_main): Call __nvptx_lowlat_init.
	* libgomp.texi: Update memory space table.
	* 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.
	* basic-allocator.c: New file.
	* config/nvptx/allocator.c: New file.
	* testsuite/libgomp.c/omp_alloc-1.c: New test.
	* testsuite/libgomp.c/omp_alloc-2.c: New test.
	* testsuite/libgomp.c/omp_alloc-3.c: New test.
	* testsuite/libgomp.c/omp_alloc-4.c: New test.
	* testsuite/libgomp.c/omp_alloc-5.c: New test.
	* testsuite/libgomp.c/omp_alloc-6.c: New test.

Co-authored-by: Kwok Cheung Yeung  <kcy@codesourcery.com>
Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
2023-12-06 16:48:57 +00:00
..
config libgomp, nvptx: low-latency memory allocator 2023-12-06 16:48:57 +00:00
plugin libgomp, nvptx: low-latency memory allocator 2023-12-06 16:48:57 +00:00
testsuite libgomp, nvptx: low-latency memory allocator 2023-12-06 16:48:57 +00:00
.gitattributes
acc_prof.h Update copyright years. 2023-01-16 11:52:17 +01:00
acinclude.m4 libgomp: fix typo in mold linker detection 2022-06-28 10:35:32 +02:00
aclocal.m4
affinity-fmt.c Update copyright years. 2023-01-16 11:52:17 +01:00
affinity.c Update copyright years. 2023-01-16 11:52:17 +01:00
alloc.c Update copyright years. 2023-01-16 11:52:17 +01:00
allocator.c libgomp, nvptx: low-latency memory allocator 2023-12-06 16:48:57 +00:00
atomic.c Update copyright years. 2023-01-16 11:52:17 +01:00
barrier.c Update copyright years. 2023-01-16 11:52:17 +01:00
basic-allocator.c libgomp, nvptx: low-latency memory allocator 2023-12-06 16:48:57 +00:00
ChangeLog Daily bump. 2023-12-01 00:17:36 +00:00
ChangeLog.graphite
config.h.in Refactor '-ldl' handling for libgomp proper and plugins 2022-05-12 15:11:30 +02:00
configure Config,Darwin: Allow for configuring Darwin to use embedded runpath. 2023-10-22 19:30:02 +01:00
configure.ac Config,Darwin: Allow for configuring Darwin to use embedded runpath. 2023-10-22 19:30:02 +01:00
configure.tgt LoongArch Port: libgomp 2022-03-29 17:43:35 +08:00
critical.c Update copyright years. 2023-01-16 11:52:17 +01:00
env.c x86: set spincount 1 for x86 hybrid platform 2023-10-12 12:47:17 +08:00
error.c Update copyright years. 2023-01-16 11:52:17 +01:00
fortran.c Update copyright years. 2023-01-16 11:52:17 +01:00
hashtab.h Update copyright years. 2023-01-16 11:52:17 +01:00
icv-device.c OpenMP: Set default-device-var with OMP_TARGET_OFFLOAD=mandatory 2023-06-14 07:53:02 +02:00
icv.c Update copyright years. 2023-01-16 11:52:17 +01:00
iter_ull.c Update copyright years. 2023-01-16 11:52:17 +01:00
iter.c Update copyright years. 2023-01-16 11:52:17 +01:00
libgomp_f.h.in Update copyright years. 2023-01-16 11:52:17 +01:00
libgomp_g.h openmp: Add support for the 'indirect' clause in C/C++ 2023-11-07 15:44:50 +00:00
libgomp-plugin.c libgomp: Simplify OpenMP reverse offload host <-> device memory copy implementation 2023-05-08 15:58:05 +02:00
libgomp-plugin.h openmp: Add support for the 'indirect' clause in C/C++ 2023-11-07 15:44:50 +00:00
libgomp.h openmp: Add support for the 'indirect' clause in C/C++ 2023-11-07 15:44:50 +00:00
libgomp.map openmp: Add support for the 'indirect' clause in C/C++ 2023-11-07 15:44:50 +00:00
libgomp.spec.in
libgomp.texi libgomp, nvptx: low-latency memory allocator 2023-12-06 16:48:57 +00:00
lock.c Update copyright years. 2023-01-16 11:52:17 +01:00
loop_ull.c Update copyright years. 2023-01-16 11:52:17 +01:00
loop.c Update copyright years. 2023-01-16 11:52:17 +01:00
Makefile.am openmp: Add support for the 'indirect' clause in C/C++ 2023-11-07 15:44:50 +00:00
Makefile.in openmp: Add support for the 'indirect' clause in C/C++ 2023-11-07 15:44:50 +00:00
oacc-async.c OpenACC: Remove 'acc_async_test' -> skip shortcut in 'libgomp/oacc-async.c:goacc_wait' 2023-03-10 15:37:47 +01:00
oacc-cuda.c Update copyright years. 2023-01-16 11:52:17 +01:00
oacc-host.c openmp: Add support for the 'indirect' clause in C/C++ 2023-11-07 15:44:50 +00:00
oacc-init.c Update copyright years. 2023-01-16 11:52:17 +01:00
oacc-int.h Update copyright years. 2023-01-16 11:52:17 +01:00
oacc-mem.c Update copyright years. 2023-01-16 11:52:17 +01:00
oacc-parallel.c Handle OpenACC 'self' clause for compute constructs in OpenACC 'kernels' decomposition 2023-10-25 11:30:36 +02:00
oacc-plugin.c Update copyright years. 2023-01-16 11:52:17 +01:00
oacc-plugin.h Update copyright years. 2023-01-16 11:52:17 +01:00
oacc-profiling.c Update copyright years. 2023-01-16 11:52:17 +01:00
oacc-target.c
omp_lib.f90.in omp_lib.f90.in: Deprecate omp_lock_hint_* for OpenMP 5.0 2023-10-20 10:56:39 +02:00
omp_lib.h.in Update copyright years. 2023-01-16 11:52:17 +01:00
omp.h.in Update copyright years. 2023-01-16 11:52:17 +01:00
openacc_lib.h Update copyright years. 2023-01-16 11:52:17 +01:00
openacc.f90 Update copyright years. 2023-01-16 11:52:17 +01:00
openacc.h Update copyright years. 2023-01-16 11:52:17 +01:00
ordered.c Update copyright years. 2023-01-16 11:52:17 +01:00
parallel.c Update copyright years. 2023-01-16 11:52:17 +01:00
priority_queue.c Update copyright years. 2023-01-16 11:52:17 +01:00
priority_queue.h Update copyright years. 2023-01-16 11:52:17 +01:00
scope.c Update copyright years. 2023-01-16 11:52:17 +01:00
sections.c Update copyright years. 2023-01-16 11:52:17 +01:00
secure_getenv.h Update copyright years. 2023-01-16 11:52:17 +01:00
single.c Update copyright years. 2023-01-16 11:52:17 +01:00
splay-tree.c Update copyright years. 2023-01-16 11:52:17 +01:00
splay-tree.h Update copyright years. 2023-01-16 11:52:17 +01:00
target-indirect.c Fix libgomp build on targets that are not Linux-based or accelerators 2023-11-07 22:20:53 +00:00
target.c openmp: Add support for the 'indirect' clause in C/C++ 2023-11-07 15:44:50 +00:00
task.c Update copyright years. 2023-01-16 11:52:17 +01:00
taskloop.c Update copyright years. 2023-01-16 11:52:17 +01:00
team.c amdgcn: add -march=gfx1030 EXPERIMENTAL 2023-10-20 12:40:25 +01:00
teams.c Update copyright years. 2023-01-16 11:52:17 +01:00
work.c Update copyright years. 2023-01-16 11:52:17 +01:00