gcc/libgomp
Marcel Vollweiler 6c420193e8 libgomp: Add new runtime routines omp_target_memcpy_async and omp_target_memcpy_rect_async
This patch adds two new OpenMP runtime routines: omp_target_memcpy_async and
omp_target_memcpy_rect_async. Both functions are introduced in OpenMP 5.1 as
asynchronous variants of omp_target_memcpy and omp_target_memcpy_rect.

In contrast to the synchronous variants, the asynchronous functions have two
additional function parameters to allow the specification of task dependences:

	int depobj_count
	omp_depend_t *depobj_list

	integer(c_int), value :: depobj_count
	integer(omp_depend_kind), optional :: depobj_list(*)

The implementation splits the synchronous functions into two parts: (a) check
and (b) copy. Then (a) is used in the asynchronous functions for the sequential
part, and the actual copy process (b) is executed in a new created task. The
sequential part (a) takes into account the requirements for the return values:

"The routine returns zero if successful. Otherwise, it returns a non-zero
value." (omp_target_memcpy_async, OpenMP 5.1 spec, section 3.8.7)

"An application can determine the number of inclusive dimensions supported by an
implementation by passing NULL pointers (or C_NULL_PTR, for Fortran) for both
dst and src. The routine returns the number of dimensions supported by the
implementation for the specified device numbers. No copy operation is
performed." (omp_target_memcpy_rect_async, OpenMP 5.1 spec, section 3.8.8)

Due to asynchronicity an error is thrown if the asynchronous memcpy is not
successful (in contrast to the synchronous functions which use a return
value unequal to zero).

gcc/ChangeLog:

	* omp-low.cc (omp_runtime_api_call): Added target_memcpy_async and
	target_memcpy_rect_async to omp_runtime_apis array.

libgomp/ChangeLog:

	* libgomp.map: Added omp_target_memcpy_async and
	omp_target_memcpy_rect_async.
	* libgomp.texi: Both functions are now supported.
	* omp.h.in: Added omp_target_memcpy_async and
	omp_target_memcpy_rect_async.
	* omp_lib.f90.in: Added interfaces for both new functions.
	* omp_lib.h.in: Likewise.
	* target.c (ialias_redirect): Added for GOMP_task.
	(omp_target_memcpy): Restructured into check and copy part.
	(omp_target_memcpy_check): New helper function for omp_target_memcpy and
	omp_target_memcpy_async that checks requirements.
	(omp_target_memcpy_copy): New helper function for omp_target_memcpy and
	omp_target_memcpy_async that performs the memcpy.
	(omp_target_memcpy_async_helper): New helper function that is used in
	omp_target_memcpy_async for the asynchronous task.
	(omp_target_memcpy_async): Added.
	(omp_target_memcpy_rect): Restructured into check and copy part.
	(omp_target_memcpy_rect_check): New helper function for
	omp_target_memcpy_rect and omp_target_memcpy_rect_async that checks
	requirements.
	(omp_target_memcpy_rect_copy): New helper function for
	omp_target_memcpy_rect and omp_target_memcpy_rect_async that performs
	the memcpy.
	(omp_target_memcpy_rect_async_helper): New helper function that is used
	in omp_target_memcpy_rect_async for the asynchronous task.
	(omp_target_memcpy_rect_async): Added.
	* task.c (ialias): Added for GOMP_task.
	* testsuite/libgomp.c-c++-common/target-memcpy-async-1.c: New test.
	* testsuite/libgomp.c-c++-common/target-memcpy-async-2.c: New test.
	* testsuite/libgomp.c-c++-common/target-memcpy-rect-async-1.c: New test.
	* testsuite/libgomp.c-c++-common/target-memcpy-rect-async-2.c: New test.
	* testsuite/libgomp.fortran/target-memcpy-async-1.f90: New test.
	* testsuite/libgomp.fortran/target-memcpy-async-2.f90: New test.
	* testsuite/libgomp.fortran/target-memcpy-rect-async-1.f90: New test.
	* testsuite/libgomp.fortran/target-memcpy-rect-async-2.f90: New test.
2022-05-20 02:29:32 -07:00
..
config
plugin libgomp nvptx plugin: Only consider '--with-cuda-driver=[...]' when applicable 2022-05-13 14:01:01 +02:00
testsuite libgomp: Add new runtime routines omp_target_memcpy_async and omp_target_memcpy_rect_async 2022-05-20 02:29:32 -07:00
.gitattributes
acc_prof.h
acinclude.m4
aclocal.m4
affinity-fmt.c
affinity.c
alloc.c
allocator.c
atomic.c
barrier.c
ChangeLog Daily bump. 2022-05-19 00:16:32 +00:00
ChangeLog.graphite
config.h.in Refactor '-ldl' handling for libgomp proper and plugins 2022-05-12 15:11:30 +02:00
configure Refactor '-ldl' handling for libgomp proper and plugins 2022-05-12 15:11:30 +02:00
configure.ac
configure.tgt
critical.c
env.c
error.c
fortran.c
hashtab.h
icv-device.c
icv.c
iter_ull.c
iter.c
libgomp_f.h.in
libgomp_g.h
libgomp-plugin.c
libgomp-plugin.h
libgomp.h openmp: Add support for inoutset depend-kind 2022-05-17 15:40:27 +02:00
libgomp.map libgomp: Add new runtime routines omp_target_memcpy_async and omp_target_memcpy_rect_async 2022-05-20 02:29:32 -07:00
libgomp.spec.in
libgomp.texi libgomp: Add new runtime routines omp_target_memcpy_async and omp_target_memcpy_rect_async 2022-05-20 02:29:32 -07:00
lock.c
loop_ull.c libgomp: Fix up two non-GOMP_USE_ALIGNED_WORK_SHARES related issues [PR105358] 2022-04-26 08:57:17 +02:00
loop.c libgomp: Fix up two non-GOMP_USE_ALIGNED_WORK_SHARES related issues [PR105358] 2022-04-26 08:57:17 +02:00
Makefile.am Refactor '-ldl' handling for libgomp proper and plugins 2022-05-12 15:11:30 +02:00
Makefile.in libgomp nvptx plugin: Only consider '--with-cuda-driver=[...]' when applicable 2022-05-13 14:01:01 +02:00
oacc-async.c
oacc-cuda.c
oacc-host.c
oacc-init.c
oacc-int.h
oacc-mem.c
oacc-parallel.c
oacc-plugin.c
oacc-plugin.h
oacc-profiling.c
oacc-target.c
omp_lib.f90.in libgomp: Add new runtime routines omp_target_memcpy_async and omp_target_memcpy_rect_async 2022-05-20 02:29:32 -07:00
omp_lib.h.in libgomp: Add new runtime routines omp_target_memcpy_async and omp_target_memcpy_rect_async 2022-05-20 02:29:32 -07:00
omp.h.in libgomp: Add new runtime routines omp_target_memcpy_async and omp_target_memcpy_rect_async 2022-05-20 02:29:32 -07:00
openacc_lib.h
openacc.f90
openacc.h
ordered.c
parallel.c
priority_queue.c
priority_queue.h
scope.c
sections.c libgomp: Fix up two non-GOMP_USE_ALIGNED_WORK_SHARES related issues [PR105358] 2022-04-26 08:57:17 +02:00
secure_getenv.h
single.c
splay-tree.c
splay-tree.h
target.c libgomp: Add new runtime routines omp_target_memcpy_async and omp_target_memcpy_rect_async 2022-05-20 02:29:32 -07:00
task.c libgomp: Add new runtime routines omp_target_memcpy_async and omp_target_memcpy_rect_async 2022-05-20 02:29:32 -07:00
taskloop.c
team.c
teams.c
work.c libgomp: Fix up two non-GOMP_USE_ALIGNED_WORK_SHARES related issues [PR105358] 2022-04-26 08:57:17 +02:00