]> git.ipfire.org Git - thirdparty/gcc.git/commit
openmp: -foffload-memory=pinned
authorAndrew Stubbs <ams@codesourcery.com>
Fri, 11 Mar 2022 12:58:38 +0000 (12:58 +0000)
committerKwok Cheung Yeung <kcy@codesourcery.com>
Tue, 28 Jun 2022 20:55:23 +0000 (13:55 -0700)
commit842df187487f5b16ae29bbe7e9acd79661a9df48
treed939366ebafbafefef4e8c5b3943fa5a39dd9a21
parent54c2d861ac62e30ebf34a4e62ee0d55478a742b9
openmp: -foffload-memory=pinned

Implement the -foffload-memory=pinned option such that libgomp is
instructed to enable fully-pinned memory at start-up.  The option is
intended to provide a performance boost to certain offload programs without
modifying the code.

This feature only works on Linux, at present, and simply calls mlockall to
enable always-on memory pinning.  It requires that the ulimit feature is
set high enough to accommodate all the program's memory usage.

In this mode the ompx_pinned_memory_alloc feature is disabled as it is not
needed and may conflict.

Backport of the patch posted at
https://gcc.gnu.org/pipermail/gcc-patches/2022-March/591354.html

gcc/ChangeLog:

* omp-low.cc (omp_enable_pinned_mode): New function.
(execute_lower_omp): Call omp_enable_pinned_mode.

libgomp/ChangeLog:

* config/linux/allocator.c (always_pinned_mode): New variable.
(GOMP_enable_pinned_mode): New function.
(linux_memspace_alloc): Disable pinning when always_pinned_mode set.
(linux_memspace_calloc): Likewise.
(linux_memspace_free): Likewise.
(linux_memspace_realloc): Likewise.
* libgomp.map (GOMP_5.1.1): New version space with
GOMP_enable_pinned_mode.
* testsuite/libgomp.c/alloc-pinned-7.c: New test.

gcc/testsuite/ChangeLog:

* c-c++-common/gomp/alloc-pinned-1.c: New test.
gcc/ChangeLog.omp
gcc/omp-low.cc
gcc/testsuite/ChangeLog.omp
gcc/testsuite/c-c++-common/gomp/alloc-pinned-1.c [new file with mode: 0644]
libgomp/ChangeLog.omp
libgomp/config/linux/allocator.c
libgomp/libgomp.map
libgomp/testsuite/libgomp.c/alloc-pinned-7.c [new file with mode: 0644]