diff options
author | Julian Brown <julian@codesourcery.com> | 2019-07-26 13:51:48 -0700 |
---|---|---|
committer | Thomas Schwinge <thomas@codesourcery.com> | 2020-03-03 12:50:41 +0100 |
commit | 291dfc7320dd954a5c36b63c6846065f6bf044df (patch) | |
tree | 3aa7e013b09b40828e08fda9f974727584db57f6 /libgomp | |
parent | 868d3ad10f2dfd532a494bfe1513200eb361a6de (diff) | |
download | gcc-291dfc7320dd954a5c36b63c6846065f6bf044df.zip gcc-291dfc7320dd954a5c36b63c6846065f6bf044df.tar.gz gcc-291dfc7320dd954a5c36b63c6846065f6bf044df.tar.bz2 |
[og9] Make OpenACC function-parameter explosion optional
* configure.ac (amdgcn*-*-*): Add target-libffi to noconfigdirs for AMD
GCN.
* configure: Regenerated.
gcc/
* builtin-types.def (BT_FN_VOID_INT_INT_OMPFN_SIZE_PTR_PTR_PTR_VAR):
Remove.
* config/i386/i386.c (ix86_goacc_explode_args): New.
(TARGET_GOACC_EXPLODE_ARGS): Define, using above function.
* doc/tm.texi: Regenerated.
* doc/tm.texi.in: Add TARGET_GOACC_EXPLODE_ARGS hook.
* fortran/types.def (BT_FN_VOID_INT_INT_OMPFN_SIZE_PTR_PTR_PTR_VAR):
Remove.
* omp-builtins.def (GOACC_parallel_keyed_v2): Remove.
* omp-expand.c (expand_omp_target): Use explode_args target hook.
Use GOMP_LAUNCH_ARGS_EXPLODED launch tag.
* omp-low.c (build_receiver_ref, build_sender_ref,
create_omp_child_function, scan_omp_target, lower_omp_target): Use
explode_args target hook.
* target.def (explode_args): New target hook.
* tree-ssa-structalias.c (target.h): Include.
(find_func_aliases_for_builtin_call): Conditionalise disabling of pass
for OpenACC parallel regions based on explode_args target hook. Remove
'params' from BUILT_IN_GOACC_PARALLEL arguments.
(find_func_clobbers): Likewise.
(ipa_pta_execute): Update for removed 'params' argument.
include/
* gomp-constants.h (GOMP_LAUNCH_ARGS_EXPLODED): Define.
libgomp/
* libgomp.map (GOMP_2.0.GOMP_4_BRANCH): Remove GOACC_parallel_keyed_v2.
* libgomp_g.h (GOACC_parallel_keyed_v2): Remove prototype.
* oacc-parallel.c (GOACC_parallel_keyed_internal): Rename to...
(GOACC_parallel_keyed): ...this. Handle GOMP_LAUNCH_ARGS_EXPLODED
launch tag. Remove previous wrapper functions.
(GOACC_parallel_keyed_v2): Remove.
(cherry picked from openacc-gcc-9-branch commit
d1a4d60a3bb42efaba6ac417af4116f053d32f93)
Diffstat (limited to 'libgomp')
-rw-r--r-- | libgomp/ChangeLog.omp | 9 | ||||
-rw-r--r-- | libgomp/libgomp.map | 1 | ||||
-rw-r--r-- | libgomp/libgomp_g.h | 2 | ||||
-rw-r--r-- | libgomp/oacc-parallel.c | 93 |
4 files changed, 48 insertions, 57 deletions
diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp index e6c81d4..c03f871 100644 --- a/libgomp/ChangeLog.omp +++ b/libgomp/ChangeLog.omp @@ -1,4 +1,13 @@ 2019-07-31 Julian Brown <julian@codesourcery.com> + + * libgomp.map (GOMP_2.0.GOMP_4_BRANCH): Remove GOACC_parallel_keyed_v2. + * libgomp_g.h (GOACC_parallel_keyed_v2): Remove prototype. + * oacc-parallel.c (GOACC_parallel_keyed_internal): Rename to... + (GOACC_parallel_keyed): ...this. Handle GOMP_LAUNCH_ARGS_EXPLODED + launch tag. Remove previous wrapper functions. + (GOACC_parallel_keyed_v2): Remove. + +2019-07-31 Julian Brown <julian@codesourcery.com> Andrew Stubbs <ams@codesourcery.com> * Makefile.am (libgomp_la_SOURCES): Add gomp_print.c. diff --git a/libgomp/libgomp.map b/libgomp/libgomp.map index 02596b0..0118761 100644 --- a/libgomp/libgomp.map +++ b/libgomp/libgomp.map @@ -522,7 +522,6 @@ GOACC_2.0.1 { GOACC_2.0.GOMP_4_BRANCH { global: GOMP_set_offload_targets; - GOACC_parallel_keyed_v2; } GOACC_2.0.1; diff --git a/libgomp/libgomp_g.h b/libgomp/libgomp_g.h index 410c6f4..4bf61d5 100644 --- a/libgomp/libgomp_g.h +++ b/libgomp/libgomp_g.h @@ -362,8 +362,6 @@ extern void GOMP_teams_reg (void (*) (void *), void *, unsigned, unsigned, extern void GOACC_parallel_keyed (int, void (*) (void *), size_t, void **, size_t *, unsigned short *, ...); -extern void GOACC_parallel_keyed_v2 (int, int, void (*) (void *), size_t, - void **, size_t *, unsigned short *, ...); extern void GOACC_parallel (int, void (*) (void *), size_t, void **, size_t *, unsigned short *, int, int, int, int, int, ...); extern void GOACC_data_start (int, size_t, void **, size_t *, diff --git a/libgomp/oacc-parallel.c b/libgomp/oacc-parallel.c index 6b08976..1bd0775 100644 --- a/libgomp/oacc-parallel.c +++ b/libgomp/oacc-parallel.c @@ -174,13 +174,14 @@ goacc_call_host_fn (void (*fn) (void *), size_t mapnum, void **hostaddrs, blocks to be copied to/from the device. Varadic arguments are keyed optional parameters terminated with a zero. */ -static void -GOACC_parallel_keyed_internal (int flags_m, int params, void (*fn) (void *), - size_t mapnum, void **hostaddrs, size_t *sizes, - unsigned short *kinds, va_list *ap) +void +GOACC_parallel_keyed (int flags_m, void (*fn) (void *), size_t mapnum, + void **hostaddrs, size_t *sizes, unsigned short *kinds, + ...) { int flags = GOACC_FLAGS_UNMARSHAL (flags_m); + va_list ap; struct goacc_thread *thr; struct gomp_device_descr *acc_dev; struct target_mem_desc *tgt; @@ -192,6 +193,7 @@ GOACC_parallel_keyed_internal (int flags_m, int params, void (*fn) (void *), int async = GOMP_ASYNC_SYNC; unsigned dims[GOMP_DIM_MAX]; unsigned tag; + bool args_exploded = false; #ifdef HAVE_INTTYPES_H gomp_debug (0, "%s: mapnum=%"PRIu64", hostaddrs=%p, size=%p, kinds=%p\n", @@ -259,31 +261,14 @@ GOACC_parallel_keyed_internal (int flags_m, int params, void (*fn) (void *), handle_ftn_pointers (mapnum, hostaddrs, sizes, kinds); - /* Host fallback if "if" clause is false or if the current device is set to - the host. */ - if (flags & GOACC_FLAG_HOST_FALLBACK) - { - prof_info.device_type = acc_device_host; - api_info.device_type = prof_info.device_type; - goacc_save_and_set_bind (acc_device_host); - goacc_call_host_fn (fn, mapnum, hostaddrs, params); - goacc_restore_bind (); - goto out_prof; - } - else if (acc_device_type (acc_dev->type) == acc_device_host) - { - goacc_call_host_fn (fn, mapnum, hostaddrs, params); - goto out_prof; - } - else if (profiling_p) - api_info.device_api = acc_device_api_cuda; - /* Default: let the runtime choose. */ for (i = 0; i != GOMP_DIM_MAX; i++) dims[i] = 0; + va_start (ap, kinds); + /* TODO: This will need amending when device_type is implemented. */ - while ((tag = va_arg (*ap, unsigned)) != 0) + while ((tag = va_arg (ap, unsigned)) != 0) { if (GOMP_LAUNCH_DEVICE (tag)) gomp_fatal ("device_type '%d' offload parameters, libgomp is too old", @@ -297,7 +282,7 @@ GOACC_parallel_keyed_internal (int flags_m, int params, void (*fn) (void *), for (i = 0; i != GOMP_DIM_MAX; i++) if (mask & GOMP_DIM_MASK (i)) - dims[i] = va_arg (*ap, unsigned); + dims[i] = va_arg (ap, unsigned); } break; @@ -307,7 +292,7 @@ GOACC_parallel_keyed_internal (int flags_m, int params, void (*fn) (void *), async = GOMP_LAUNCH_OP (tag); if (async == GOMP_LAUNCH_OP_MAX) - async = va_arg (*ap, unsigned); + async = va_arg (ap, unsigned); if (profiling_p) { @@ -321,16 +306,40 @@ GOACC_parallel_keyed_internal (int flags_m, int params, void (*fn) (void *), case GOMP_LAUNCH_WAIT: { unsigned num_waits = GOMP_LAUNCH_OP (tag); - goacc_wait (async, num_waits, ap); + goacc_wait (async, num_waits, &ap); break; } + case GOMP_LAUNCH_ARGS_EXPLODED: + args_exploded = true; + break; + default: gomp_fatal ("unrecognized offload code '%d'," " libgomp is too old", GOMP_LAUNCH_CODE (tag)); } } - + va_end (ap); + + /* Host fallback if "if" clause is false or if the current device is set to + the host. */ + if (flags & GOACC_FLAG_HOST_FALLBACK) + { + prof_info.device_type = acc_device_host; + api_info.device_type = prof_info.device_type; + goacc_save_and_set_bind (acc_device_host); + goacc_call_host_fn (fn, mapnum, hostaddrs, args_exploded); + goacc_restore_bind (); + goto out_prof; + } + else if (acc_device_type (acc_dev->type) == acc_device_host) + { + goacc_call_host_fn (fn, mapnum, hostaddrs, args_exploded); + goto out_prof; + } + else if (profiling_p) + api_info.device_api = acc_device_api_cuda; + if (!(acc_dev->capabilities & GOMP_OFFLOAD_CAP_NATIVE_EXEC)) { k.host_start = (uintptr_t) fn; @@ -392,7 +401,7 @@ GOACC_parallel_keyed_internal (int flags_m, int params, void (*fn) (void *), if (aq == NULL) { - if (params) + if (args_exploded) acc_dev->openacc.exec_params_func (tgt_fn, mapnum, hostaddrs, devaddrs, dims, tgt); else @@ -401,7 +410,7 @@ GOACC_parallel_keyed_internal (int flags_m, int params, void (*fn) (void *), } else { - if (params) + if (args_exploded) acc_dev->openacc.async.exec_params_func (tgt_fn, mapnum, hostaddrs, devaddrs, dims, tgt, aq); else @@ -452,30 +461,6 @@ GOACC_parallel_keyed_internal (int flags_m, int params, void (*fn) (void *), } } -void -GOACC_parallel_keyed (int flags_m, void (*fn) (void *), - size_t mapnum, void **hostaddrs, size_t *sizes, - unsigned short *kinds, ...) -{ - va_list ap; - va_start (ap, kinds); - GOACC_parallel_keyed_internal (flags_m, 0, fn, mapnum, hostaddrs, sizes, - kinds, &ap); - va_end (ap); -} - -void -GOACC_parallel_keyed_v2 (int flags_m, int args, void (*fn) (void *), - size_t mapnum, void **hostaddrs, size_t *sizes, - unsigned short *kinds, ...) -{ - va_list ap; - va_start (ap, kinds); - GOACC_parallel_keyed_internal (flags_m, args, fn, mapnum, hostaddrs, sizes, - kinds, &ap); - va_end (ap); -} - /* Legacy entry point, only provide host execution. */ void |