From 0beac1db38855eae0f71fa982ed05069d3873a9c Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Wed, 28 Aug 2024 11:50:43 +0200 Subject: libgomp: Add interop types and routines to OpenMP's headers and module This commit adds OpenMP 5.1+'s interop enumeration, type and routine declarations to the C/C++ header file and, new in OpenMP TR13, also to the Fortran module and omp_lib.h header file. While a stub implementation is provided, only with foreign runtime support by the libgomp GPU plugins and with the 'interop' directive, this becomes really useful. libgomp/ChangeLog: * fortran.c (omp_get_interop_str_, omp_get_interop_name_, omp_get_interop_type_desc_, omp_get_interop_rc_desc_): Add. * libgomp.map (GOMP_5.1.3): New; add interop routines. * omp.h.in: Add interop typedefs, enum and prototypes. (__GOMP_DEFAULT_NULL): Define. (omp_target_memcpy_async, omp_target_memcpy_rect_async): Use it for the optional depend argument. * omp_lib.f90.in: Add paramters and interfaces for interop. * omp_lib.h.in: Likewise; move F90 '&' to column 81 for -ffree-length-80. * target.c (omp_get_num_interop_properties, omp_get_interop_int, omp_get_interop_ptr, omp_get_interop_str, omp_get_interop_name, omp_get_interop_type_desc, omp_get_interop_rc_desc): Add. * config/gcn/target.c (omp_get_num_interop_properties, omp_get_interop_int, omp_get_interop_ptr, omp_get_interop_str, omp_get_interop_name, omp_get_interop_type_desc, omp_get_interop_rc_desc): Add. * config/nvptx/target.c (omp_get_num_interop_properties, omp_get_interop_int, omp_get_interop_ptr, omp_get_interop_str, omp_get_interop_name, omp_get_interop_type_desc, omp_get_interop_rc_desc): Add. * testsuite/libgomp.c-c++-common/interop-routines-1.c: New test. * testsuite/libgomp.c-c++-common/interop-routines-2.c: New test. * testsuite/libgomp.fortran/interop-routines-1.F90: New test. * testsuite/libgomp.fortran/interop-routines-2.F90: New test. * testsuite/libgomp.fortran/interop-routines-3.F: New test. * testsuite/libgomp.fortran/interop-routines-4.F: New test. * testsuite/libgomp.fortran/interop-routines-5.F: New test. * testsuite/libgomp.fortran/interop-routines-6.F: New test. * testsuite/libgomp.fortran/interop-routines-7.F90: New test. --- libgomp/fortran.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'libgomp/fortran.c') diff --git a/libgomp/fortran.c b/libgomp/fortran.c index cfbea32..a76c33c 100644 --- a/libgomp/fortran.c +++ b/libgomp/fortran.c @@ -102,6 +102,10 @@ ialias_redirect (omp_set_default_allocator) ialias_redirect (omp_get_default_allocator) ialias_redirect (omp_display_env) ialias_redirect (omp_fulfill_event) +ialias_redirect (omp_get_interop_str) +ialias_redirect (omp_get_interop_name) +ialias_redirect (omp_get_interop_type_desc) +ialias_redirect (omp_get_interop_rc_desc) #endif #ifndef LIBGOMP_GNU_SYMBOL_VERSIONING @@ -793,6 +797,43 @@ omp_get_default_allocator_ () return (intptr_t) omp_get_default_allocator (); } +void +omp_get_interop_str_ (const char **res, size_t *res_len, + const omp_interop_t interop, + omp_interop_property_t property_id, + omp_interop_rc_t *ret_code) +{ + *res = omp_get_interop_str (interop, property_id, ret_code); + *res_len = *res ? strlen (*res) : 0; +} + +void +omp_get_interop_name_ (const char **res, size_t *res_len, + const omp_interop_t interop, + omp_interop_property_t property_id) +{ + *res = omp_get_interop_name (interop, property_id); + *res_len = *res ? strlen (*res) : 0; +} + +void +omp_get_interop_type_desc_ (const char **res, size_t *res_len, + const omp_interop_t interop, + omp_interop_property_t property_id) +{ + *res = omp_get_interop_type_desc (interop, property_id); + *res_len = *res ? strlen (*res) : 0; +} + +void +omp_get_interop_rc_desc_ (const char **res, size_t *res_len, + const omp_interop_t interop, + omp_interop_rc_t ret_code) +{ + *res = omp_get_interop_rc_desc (interop, ret_code); + *res_len = *res ? strlen (*res) : 0; +} + #ifndef LIBGOMP_OFFLOADED_ONLY void -- cgit v1.1