https://gcc.gnu.org/g:f7b9c7e3a1dfbdf0689f45d57c09669ec5be94c4
commit r17-6519-gf7b9c7e3a1dfbdf0689f45d57c09669ec5be94c4 Author: Thomas Schwinge <[email protected]> Date: Wed Nov 11 14:11:01 2026 +0100 libgomp, OpenMP 'indirect' clause: Clean up '!USE_HASHTAB_LOOKUP', '!USE_HASHTAB_LOOKUP_FOR_INDIRECT' code Clean up the legacy '!USE_HASHTAB_LOOKUP', '!USE_HASHTAB_LOOKUP_FOR_INDIRECT' compile-time-conditional code for OpenMP 'indirect' clause support. libgomp/ * config/accel/target-indirect.c: Clean up '!USE_HASHTAB_LOOKUP' code. * plugin/plugin-gcn.c: Clean up '!USE_HASHTAB_LOOKUP_FOR_INDIRECT' code. * plugin/plugin-nvptx.c: Likewise. Diff: --- libgomp/config/accel/target-indirect.c | 30 ------------------------------ libgomp/plugin/plugin-gcn.c | 11 +---------- libgomp/plugin/plugin-nvptx.c | 11 +---------- 3 files changed, 2 insertions(+), 50 deletions(-) diff --git a/libgomp/config/accel/target-indirect.c b/libgomp/config/accel/target-indirect.c index 475cd528a49e..a5695b3790ff 100644 --- a/libgomp/config/accel/target-indirect.c +++ b/libgomp/config/accel/target-indirect.c @@ -30,10 +30,6 @@ void *GOMP_INDIRECT_ADDR_MAP = NULL; -#define USE_HASHTAB_LOOKUP - -#ifdef USE_HASHTAB_LOOKUP - #include <string.h> /* For memset. */ /* Use a hashtab to lookup the target address instead of using a linear @@ -118,29 +114,3 @@ build_indirect_map (void) *slot = element; } } - -#else - -void -build_indirect_map (void) -{ -} - -void * -GOMP_target_map_indirect_ptr (void *ptr) -{ - /* NULL pointers always resolve to NULL. */ - if (!ptr) - return ptr; - - assert (GOMP_INDIRECT_ADDR_MAP); - - for (void **map_entry = GOMP_INDIRECT_ADDR_MAP; *map_entry; - map_entry += 2) - if (*map_entry == ptr) - return (void *) *(map_entry + 1); - - return ptr; -} - -#endif diff --git a/libgomp/plugin/plugin-gcn.c b/libgomp/plugin/plugin-gcn.c index e89b424b2c9c..005ba22120df 100644 --- a/libgomp/plugin/plugin-gcn.c +++ b/libgomp/plugin/plugin-gcn.c @@ -57,11 +57,8 @@ /* Create hash-table for declare target's indirect clause on the host; see build-target-indirect-htab.h for details. */ -#define USE_HASHTAB_LOOKUP_FOR_INDIRECT -#ifdef USE_HASHTAB_LOOKUP_FOR_INDIRECT static void* create_target_indirect_map (size_t *, size_t, uint64_t *, uint64_t *); -#endif /* These probably won't be in elf.h for a while. */ #ifndef R_AMDGPU_NONE @@ -4263,13 +4260,11 @@ GOMP_OFFLOAD_load_image (int ord, unsigned version, const void *target_data, hsa_executable_symbol_t symbol; bool host_init_htab = true; - #ifdef USE_HASHTAB_LOOKUP_FOR_INDIRECT status = hsa_fns.hsa_executable_get_symbol_fn (agent->executable, NULL, XSTRING (GOMP_INDIRECT_ADDR_HMAP), agent->id, 0, &symbol); if (status != HSA_STATUS_SUCCESS) - #endif { host_init_htab = false; status = hsa_fns.hsa_executable_get_symbol_fn (agent->executable, NULL, @@ -4315,7 +4310,6 @@ GOMP_OFFLOAD_load_image (int ord, unsigned version, const void *target_data, GOMP_OFFLOAD_host2dev (agent->device_id, map_target_addr, (void*) ind_fn_map, sizeof (ind_fn_map)); } - #ifdef USE_HASHTAB_LOOKUP_FOR_INDIRECT else { /* FIXME: Handle multi-kernel load and unload, cf. PR 114690. */ @@ -4333,7 +4327,6 @@ GOMP_OFFLOAD_load_image (int ord, unsigned version, const void *target_data, GOMP_OFFLOAD_host2dev (agent->device_id, map_target_addr, host_map, host_map_size); } - #endif GCN_DEBUG ("Allocated indirect map at %p\n", map_target_addr); @@ -6012,8 +6005,6 @@ GOMP_OFFLOAD_openacc_destroy_thread_data (void *data) free (data); } -#ifdef USE_HASHTAB_LOOKUP_FOR_INDIRECT - #include "build-target-indirect-htab.h" -#endif +#include "build-target-indirect-htab.h" /* }}} */ diff --git a/libgomp/plugin/plugin-nvptx.c b/libgomp/plugin/plugin-nvptx.c index 62c43e7bd7a5..f3755d46feed 100644 --- a/libgomp/plugin/plugin-nvptx.c +++ b/libgomp/plugin/plugin-nvptx.c @@ -62,11 +62,8 @@ /* Create hash-table for declare target's indirect clause on the host; see build-target-indirect-htab.h for details. */ -#define USE_HASHTAB_LOOKUP_FOR_INDIRECT -#ifdef USE_HASHTAB_LOOKUP_FOR_INDIRECT static void* create_target_indirect_map (size_t *, size_t, uint64_t *, uint64_t *); -#endif /* An arbitrary fixed limit (128MB) for the size of the OpenMP soft stacks block to cache between kernel invocations. For soft-stacks blocks bigger @@ -1817,11 +1814,9 @@ GOMP_OFFLOAD_load_image (int ord, unsigned version, const void *target_data, CUdeviceptr varptr; size_t varsize; bool host_init_htab = true; - #ifdef USE_HASHTAB_LOOKUP_FOR_INDIRECT r = CUDA_CALL_NOCHECK (cuModuleGetGlobal, &varptr, &varsize, module, XSTRING (GOMP_INDIRECT_ADDR_HMAP)); if (r != CUDA_SUCCESS) - #endif { host_init_htab = false; r = CUDA_CALL_NOCHECK (cuModuleGetGlobal, &varptr, &varsize, @@ -1853,7 +1848,6 @@ GOMP_OFFLOAD_load_image (int ord, unsigned version, const void *target_data, GOMP_OFFLOAD_host2dev (ord, map_target_addr, (void *) ind_fn_map, sizeof (ind_fn_map)); } - #ifdef USE_HASHTAB_LOOKUP_FOR_INDIRECT else { /* FIXME: Handle multi-kernel load and unload, cf. PR 114690. */ @@ -1869,7 +1863,6 @@ GOMP_OFFLOAD_load_image (int ord, unsigned version, const void *target_data, map_target_addr = GOMP_OFFLOAD_alloc (ord, host_map_size); GOMP_OFFLOAD_host2dev (ord, map_target_addr, host_map, host_map_size); } - #endif GOMP_PLUGIN_debug (0, "Allocated indirect map at %p\n", map_target_addr); @@ -3230,6 +3223,4 @@ GOMP_OFFLOAD_run (struct gomp_offload_session *session, void *tgt_fn, void **arg /* TODO: Implement GOMP_OFFLOAD_async_run. */ -#ifdef USE_HASHTAB_LOOKUP_FOR_INDIRECT - #include "build-target-indirect-htab.h" -#endif +#include "build-target-indirect-htab.h"
