On 04/12/2023 16:04, Tobias Burnus wrote:
On 03.12.23 01:32, Andrew Stubbs wrote:
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.
...
LGTM, however, I about the following:
diff --git a/libgomp/libgomp.texi b/libgomp/libgomp.texi
index e5fe7af76af..39d0749e7b3 100644
--- a/libgomp/libgomp.texi
+++ b/libgomp/libgomp.texi
@@ -3012,11 +3012,14 @@ value.
@item omp_const_mem_alloc @tab omp_const_mem_space
@item omp_high_bw_mem_alloc @tab omp_high_bw_mem_space
@item omp_low_lat_mem_alloc @tab omp_low_lat_mem_space
-@item omp_cgroup_mem_alloc @tab --
-@item omp_pteam_mem_alloc @tab --
-@item omp_thread_mem_alloc @tab --
+@item omp_cgroup_mem_alloc @tab omp_low_lat_mem_space
(implementation defined)
+@item omp_pteam_mem_alloc @tab omp_low_lat_mem_space
(implementation defined)
+@item omp_thread_mem_alloc @tab omp_low_lat_mem_space
(implementation defined)
@end multitable
+The @code{omp_low_lat_mem_space} is only available on supported devices.
+See @ref{Offload-Target Specifics}.
+
Whether it would be clearer to have this wording not here for the
OMP_ALLOCATOR env, i.e.
https://gcc.gnu.org/onlinedocs/libgomp/OMP_005fALLOCATOR.html
but just a simple crossref like:
--- a/libgomp/libgomp.texi
+++ b/libgomp/libgomp.texi
@@ -3061,5 +3061,5 @@
OMP_ALLOCATOR=omp_low_lat_mem_space:pinned=true,partition=nearest
@item @emph{See also}:
@ref{Memory allocation}, @ref{omp_get_default_allocator},
-@ref{omp_set_default_allocator}
+@ref{omp_set_default_allocator}, @ref{Offload-Target Specifics}
@item @emph{Reference}:
And add your wording to:
https://gcc.gnu.org/onlinedocs/libgomp/Memory-allocation.html
As this sections mentions that "omp_low_lat_mem_space maps to
omp_default_mem_space" in general.
Hence, mentioning in this section in addition that
omp_low_lat_mem_space is honored on devices
seems to be the better location.
How about this?
--- a/libgomp/libgomp.texi
+++ b/libgomp/libgomp.texi
@@ -3012,9 +3012,9 @@ value.
@item omp_const_mem_alloc @tab omp_const_mem_space
@item omp_high_bw_mem_alloc @tab omp_high_bw_mem_space
@item omp_low_lat_mem_alloc @tab omp_low_lat_mem_space
-@item omp_cgroup_mem_alloc @tab --
-@item omp_pteam_mem_alloc @tab --
-@item omp_thread_mem_alloc @tab --
+@item omp_cgroup_mem_alloc @tab omp_low_lat_mem_space
(implementation defined)
+@item omp_pteam_mem_alloc @tab omp_low_lat_mem_space
(implementation defined)
+@item omp_thread_mem_alloc @tab omp_low_lat_mem_space
(implementation defined)
@end multitable
The predefined allocators use the default values for the traits,
@@ -3060,7 +3060,7 @@
OMP_ALLOCATOR=omp_low_lat_mem_space:pinned=true,partition=nearest
@item @emph{See also}:
@ref{Memory allocation}, @ref{omp_get_default_allocator},
-@ref{omp_set_default_allocator}
+@ref{omp_set_default_allocator}, @ref{Offload-Target Specific}
@item @emph{Reference}:
@uref{https://www.openmp.org, OpenMP specification v5.0}, Section 6.21
@@ -5710,7 +5710,8 @@ For the memory spaces, the following applies:
@itemize
@item @code{omp_default_mem_space} is supported
@item @code{omp_const_mem_space} maps to @code{omp_default_mem_space}
-@item @code{omp_low_lat_mem_space} maps to @code{omp_default_mem_space}
+@item @code{omp_low_lat_mem_space} is only available on supported devices,
+ and maps to @code{omp_default_mem_space} otherwise.
@item @code{omp_large_cap_mem_space} maps to @code{omp_default_mem_space},
unless the memkind library is available
@item @code{omp_high_bw_mem_space} maps to @code{omp_default_mem_space},
@@ -5766,6 +5767,9 @@ Additional notes regarding the traits:
@item The @code{sync_hint} trait has no effect.
@end itemize
+See also:
+@ref{Offload-Target Specifics}
+
@c ---------------------------------------------------------------------
@c Offload-Target Specifics
@c ---------------------------------------------------------------------
Tobias
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201,
80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer:
Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München;
Registergericht München, HRB 106955