Go to file
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
.github Minor formatting fix for newly-added file from previous commit 2023-11-01 19:28:56 -04:00
c++tools Daily bump. 2023-06-23 00:16:38 +00:00
config Daily bump. 2023-12-01 00:17:36 +00:00
contrib Daily bump. 2023-12-03 00:16:41 +00:00
fixincludes Daily bump. 2023-11-23 00:18:14 +00:00
gcc Fix c-c++-common/fhardened-[12].c test fails on hppa 2023-12-06 15:38:50 +00:00
gnattools Daily bump. 2023-04-26 00:17:46 +00:00
gotools Daily bump. 2023-11-04 00:16:45 +00:00
include Daily bump. 2023-12-02 00:16:54 +00:00
INSTALL
libada Daily bump. 2023-08-08 00:17:37 +00:00
libatomic Daily bump. 2023-11-14 12:23:39 +00:00
libbacktrace Daily bump. 2023-12-01 00:17:36 +00:00
libcc1 Daily bump. 2023-11-17 00:17:33 +00:00
libcody Daily bump. 2023-06-16 00:17:18 +00:00
libcpp Daily bump. 2023-11-29 00:17:27 +00:00
libdecnumber Daily bump. 2023-06-16 00:17:18 +00:00
libffi Daily bump. 2023-10-27 00:17:12 +00:00
libgcc libgcc: Avoid -Wbuiltin-declaration-mismatch warnings in emutls.c 2023-12-06 12:27:12 +01:00
libgfortran Daily bump. 2023-12-06 00:17:50 +00:00
libgm2 Daily bump. 2023-12-01 00:17:36 +00:00
libgo libgo: update configure.ac to upstream GCC 2023-11-30 13:23:53 -08:00
libgomp libgomp, nvptx: low-latency memory allocator 2023-12-06 16:48:57 +00:00
libiberty Daily bump. 2023-12-06 00:17:50 +00:00
libitm Daily bump. 2023-10-23 00:16:43 +00:00
libobjc Daily bump. 2023-10-23 00:16:43 +00:00
libphobos Daily bump. 2023-11-22 00:17:52 +00:00
libquadmath Daily bump. 2023-10-24 00:17:34 +00:00
libsanitizer Daily bump. 2023-11-29 00:17:27 +00:00
libssp Daily bump. 2023-10-23 00:16:43 +00:00
libstdc++-v3 c++: partial ordering of object parameter [PR53499] 2023-12-06 09:02:01 -05:00
libvtv Daily bump. 2023-10-23 00:16:43 +00:00
lto-plugin Daily bump. 2023-10-23 00:16:43 +00:00
maintainer-scripts Daily bump. 2023-11-14 12:23:39 +00:00
zlib Daily bump. 2023-10-23 00:16:43 +00:00
.dir-locals.el
.gitattributes
.gitignore *: add modern gettext 2023-11-14 00:47:11 +01:00
ABOUT-NLS
ar-lib
ChangeLog Daily bump. 2023-11-24 00:17:53 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
compile
config-ml.in LoongArch: Reimplement multilib build option handling. 2023-09-15 10:42:12 +08:00
config.guess
config.rpath
config.sub
configure *: add modern gettext 2023-11-14 00:47:11 +01:00
configure.ac *: add modern gettext 2023-11-14 00:47:11 +01:00
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.RUNTIME
depcomp
install-sh
libtool-ldflags
libtool.m4 Build: fix error in fixinclude configure 2023-11-22 11:54:33 +01:00
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS MAINTAINERS: Add myself to write after approval and DCO 2023-11-24 10:43:54 +11:00
Makefile.def *: add modern gettext 2023-11-14 00:47:11 +01:00
Makefile.in Makefile.tpl: Avoid race condition in generating site.exp from the top level 2023-11-19 11:07:09 -05:00
Makefile.tpl Makefile.tpl: Avoid race condition in generating site.exp from the top level 2023-11-19 11:07:09 -05:00
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
SECURITY.txt secpol: consistent indentation 2023-10-05 12:00:39 -04:00
symlink-tree
test-driver
ylwrap

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.