Fix-up for commit
7a8f98b48104ccf10c6dceccc51b70de69288eaa
"OpenMP: support for uses_allocators clause", which regressed libgomp build for
PTX < 4.1 configurations:
In file included from [...]/libgomp/config/nvptx/allocator.c:48:
[...]/libgomp/config/nvptx/allocator.c:47:28: error: ‘__nvptx_lowlat_realloc’ defined but not used [-Werror=unused-function]
47 | #define BASIC_ALLOC_PREFIX __nvptx_lowlat
| ^~~~~~~~~~~~~~
[...]/libgomp/config/nvptx/../../basic-allocator.c:63:27: note: in definition of macro ‘fn1’
63 | #define fn1(prefix, name) prefix ## _ ## name
| ^~~~~~
[...]/libgomp/config/nvptx/../../basic-allocator.c:69:29: note: in expansion of macro ‘fn’
69 | #define basic_alloc_realloc fn(BASIC_ALLOC_PREFIX,realloc)
| ^~
[...]/libgomp/config/nvptx/../../basic-allocator.c:69:32: note: in expansion of macro ‘BASIC_ALLOC_PREFIX’
69 | #define basic_alloc_realloc fn(BASIC_ALLOC_PREFIX,realloc)
| ^~~~~~~~~~~~~~~~~~
[...]/libgomp/config/nvptx/../../basic-allocator.c:257:1: note: in expansion of macro ‘basic_alloc_realloc’
257 | basic_alloc_realloc (char *heap, void *addr, size_t oldsize,
| ^~~~~~~~~~~~~~~~~~~
[...]/libgomp/config/nvptx/allocator.c:47:28: error: ‘__nvptx_lowlat_calloc’ defined but not used [-Werror=unused-function]
47 | #define BASIC_ALLOC_PREFIX __nvptx_lowlat
| ^~~~~~~~~~~~~~
[...]/libgomp/config/nvptx/../../basic-allocator.c:63:27: note: in definition of macro ‘fn1’
63 | #define fn1(prefix, name) prefix ## _ ## name
| ^~~~~~
[...]/libgomp/config/nvptx/../../basic-allocator.c:67:28: note: in expansion of macro ‘fn’
67 | #define basic_alloc_calloc fn(BASIC_ALLOC_PREFIX,calloc)
| ^~
[...]/libgomp/config/nvptx/../../basic-allocator.c:67:31: note: in expansion of macro ‘BASIC_ALLOC_PREFIX’
67 | #define basic_alloc_calloc fn(BASIC_ALLOC_PREFIX,calloc)
| ^~~~~~~~~~~~~~~~~~
[...]/libgomp/config/nvptx/../../basic-allocator.c:167:1: note: in expansion of macro ‘basic_alloc_calloc’
167 | basic_alloc_calloc (char *heap, size_t size)
| ^~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[7]: *** [Makefile:819: allocator.lo] Error 1
If, for PTX < 4.1, we're not proving OpenMP low-latency memory, just disable
the whole '__nvptx_lowlat_pool' machinery.
libgomp/
* config/nvptx/allocator.c [PTX < 4.1]: Fix build.
* config/nvptx/team.c [PTX < 4.1]: Disable the whole
'__nvptx_lowlat_pool' machinery.
#include "libgomp.h"
#include <stdlib.h>
+#if __PTX_ISA_VERSION_MAJOR__ > 4 \
+ || (__PTX_ISA_VERSION_MAJOR__ == 4 && __PTX_ISA_VERSION_MINOR >= 1)
+
#define BASIC_ALLOC_PREFIX __nvptx_lowlat
#include "../../basic-allocator.c"
express this magic extern sizeless array in C so use asm. */
asm (".extern .shared .u8 __nvptx_lowlat_pool[];\n");
+#endif
+
static void *
nvptx_memspace_alloc (omp_memspace_handle_t memspace, size_t size)
{
static void gomp_thread_start (struct gomp_thread_pool *);
+#if __PTX_ISA_VERSION_MAJOR__ > 4 \
+ || (__PTX_ISA_VERSION_MAJOR__ == 4 && __PTX_ISA_VERSION_MINOR__ >= 1)
+
/* There should be some .shared space reserved for us. There's no way to
express this magic extern sizeless array in C so use asm. */
asm (".extern .shared .u8 __nvptx_lowlat_pool[];\n");
/* Defined in basic-allocator.c via config/nvptx/allocator.c. */
void __nvptx_lowlat_init (void *heap, size_t size);
+#endif
+
/* This externally visible function handles target region entry. It
sets up a per-team thread pool and transfers control by calling FN (FN_DATA)
in the master thread or gomp_thread_start in other threads.
if (UNLIKELY (GOMP_INDIRECT_ADDR_MAP != NULL && block_id == 0))
build_indirect_map ();
+#if __PTX_ISA_VERSION_MAJOR__ > 4 \
+ || (__PTX_ISA_VERSION_MAJOR__ == 4 && __PTX_ISA_VERSION_MINOR__ >= 1)
/* Find the low-latency heap details .... */
uint32_t *shared_pool;
uint32_t shared_pool_size = 0;
asm ("cvta.shared.u64\t%0, __nvptx_lowlat_pool;" : "=r"(shared_pool));
-#if __PTX_ISA_VERSION_MAJOR__ > 4 \
- || (__PTX_ISA_VERSION_MAJOR__ == 4 && __PTX_ISA_VERSION_MINOR__ >= 1)
asm ("mov.u32\t%0, %%dynamic_smem_size;\n"
: "=r"(shared_pool_size));
-#endif
__nvptx_lowlat_init (shared_pool, shared_pool_size);
+#endif
/* Initialize the thread pool. */
struct gomp_thread_pool *pool = alloca (sizeof (*pool));