aboutsummaryrefslogtreecommitdiff
path: root/libgomp
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2022-10-13 15:54:17 +0200
committerMartin Liska <mliska@suse.cz>2022-10-13 15:54:17 +0200
commitbd21c04269deded2c7476ceca1100a26f28ea526 (patch)
tree197bf75eedac69362078a4ccc0afe5615c45c327 /libgomp
parentd9e7934d25da4a78ffef1f738206aa1d897911df (diff)
parent786e4c024f941671a233f5779d73a5d22f4e9588 (diff)
downloadgcc-bd21c04269deded2c7476ceca1100a26f28ea526.zip
gcc-bd21c04269deded2c7476ceca1100a26f28ea526.tar.gz
gcc-bd21c04269deded2c7476ceca1100a26f28ea526.tar.bz2
Merge branch 'master' into devel/sphinx
Diffstat (limited to 'libgomp')
-rw-r--r--libgomp/ChangeLog39
-rwxr-xr-xlibgomp/configure47
-rw-r--r--libgomp/fortran.c7
-rw-r--r--libgomp/libgomp.map6
-rw-r--r--libgomp/libgomp.texi6
-rw-r--r--libgomp/omp.h.in1
-rw-r--r--libgomp/omp_lib.f90.in6
-rw-r--r--libgomp/omp_lib.h.in2
-rw-r--r--libgomp/target.c15
-rw-r--r--libgomp/task.c25
-rw-r--r--libgomp/testsuite/libgomp.c-c++-common/task-in-explicit-1.c106
-rw-r--r--libgomp/testsuite/libgomp.c-c++-common/task-in-explicit-2.c26
-rw-r--r--libgomp/testsuite/libgomp.c-c++-common/task-in-explicit-3.c36
-rw-r--r--libgomp/testsuite/libgomp.c-c++-common/task-reduction-17.c36
-rw-r--r--libgomp/testsuite/libgomp.c-c++-common/task-reduction-18.c17
-rw-r--r--libgomp/testsuite/libgomp.c/task-7.c26
-rw-r--r--libgomp/testsuite/libgomp.c/task-8.c14
17 files changed, 404 insertions, 11 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 6779493..d06c05e 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,42 @@
+2022-10-12 Jakub Jelinek <jakub@redhat.com>
+
+ * libgomp.texi (OpenMP 5.2): Fix up allocator -> allocate directive
+ in deprecation bullet.
+
+2022-10-12 Jakub Jelinek <jakub@redhat.com>
+
+ * omp.h.in (omp_in_explicit_task): Declare.
+ * omp_lib.h.in (omp_in_explicit_task): Likewise.
+ * omp_lib.f90.in (omp_in_explicit_task): New interface.
+ * libgomp.map (OMP_5.2): New symbol version, export
+ omp_in_explicit_task and omp_in_explicit_task_.
+ * task.c (omp_in_explicit_task): New function.
+ * fortran.c (omp_in_explicit_task): Add ialias_redirect.
+ (omp_in_explicit_task_): New function.
+ * libgomp.texi (OpenMP 5.2): Mark omp_in_explicit_task as implemented.
+ * testsuite/libgomp.c-c++-common/task-in-explicit-1.c: New test.
+ * testsuite/libgomp.c-c++-common/task-in-explicit-2.c: New test.
+ * testsuite/libgomp.c-c++-common/task-in-explicit-3.c: New test.
+
+2022-10-12 Jakub Jelinek <jakub@redhat.com>
+
+ * task.c (gomp_create_artificial_team): Fix up handling of invocations
+ from within explicit task.
+ * target.c (GOMP_target_ext): Likewise.
+ * testsuite/libgomp.c/task-7.c: New test.
+ * testsuite/libgomp.c/task-8.c: New test.
+ * testsuite/libgomp.c-c++-common/task-reduction-17.c: New test.
+ * testsuite/libgomp.c-c++-common/task-reduction-18.c: New test.
+
+2022-10-12 Martin Liska <mliska@suse.cz>
+
+ * configure: Regenerate.
+
+2022-10-11 Olivier Hainque <hainque@adacore.com>
+ Olivier Hainque <hainque@adacore.com>
+
+ * configure: Regenerate.
+
2022-10-05 Tobias Burnus <tobias@codesourcery.com>
* libgomp.texi (OpenMP 5.1 Impl. Status): Mark 'assume' as 'Y'.
diff --git a/libgomp/configure b/libgomp/configure
index b11170e..35424d2 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -6173,6 +6173,11 @@ sysv4 | sysv4.3*)
tpf*)
lt_cv_deplibs_check_method=pass_all
;;
+vxworks*)
+ # Assume VxWorks cross toolchains are built on Linux, possibly
+ # as canadian for Windows hosts.
+ lt_cv_deplibs_check_method=pass_all
+ ;;
esac
fi
@@ -10953,6 +10958,25 @@ uts4*)
shlibpath_var=LD_LIBRARY_PATH
;;
+# Shared libraries for VwWorks, >= 7 only at this stage
+# and (fpic) still incompatible with "large" code models
+# in a few configurations. Only for RTP mode in any case,
+# and upon explicit request at configure time.
+vxworks7*)
+ dynamic_linker=no
+ case ${with_multisubdir}-${enable_shared} in
+ *large*)
+ ;;
+ *mrtp*-yes)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker="$host_os module_loader"
+ ;;
+ esac
+ ;;
*)
dynamic_linker=no
;;
@@ -11394,7 +11418,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11397 "configure"
+#line 11421 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11500,7 +11524,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11503 "configure"
+#line 11527 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -14587,6 +14611,25 @@ uts4*)
shlibpath_var=LD_LIBRARY_PATH
;;
+# Shared libraries for VwWorks, >= 7 only at this stage
+# and (fpic) still incompatible with "large" code models
+# in a few configurations. Only for RTP mode in any case,
+# and upon explicit request at configure time.
+vxworks7*)
+ dynamic_linker=no
+ case ${with_multisubdir}-${enable_shared} in
+ *large*)
+ ;;
+ *mrtp*-yes)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker="$host_os module_loader"
+ ;;
+ esac
+ ;;
*)
dynamic_linker=no
;;
diff --git a/libgomp/fortran.c b/libgomp/fortran.c
index d984ce5..72784ec 100644
--- a/libgomp/fortran.c
+++ b/libgomp/fortran.c
@@ -76,6 +76,7 @@ ialias_redirect (omp_get_ancestor_thread_num)
ialias_redirect (omp_get_team_size)
ialias_redirect (omp_get_active_level)
ialias_redirect (omp_in_final)
+ialias_redirect (omp_in_explicit_task)
ialias_redirect (omp_get_cancellation)
ialias_redirect (omp_get_proc_bind)
ialias_redirect (omp_get_num_places)
@@ -482,6 +483,12 @@ omp_in_final_ (void)
return omp_in_final ();
}
+int32_t
+omp_in_explicit_task_ (void)
+{
+ return omp_in_explicit_task ();
+}
+
void
omp_set_num_teams_ (const int32_t *num_teams)
{
diff --git a/libgomp/libgomp.map b/libgomp/libgomp.map
index 46d5f10..e76c126 100644
--- a/libgomp/libgomp.map
+++ b/libgomp/libgomp.map
@@ -234,6 +234,12 @@ OMP_5.1.1 {
omp_target_memcpy_rect_async;
} OMP_5.1;
+OMP_5.2 {
+ global:
+ omp_in_explicit_task;
+ omp_in_explicit_task_;
+} OMP_5.1.1;
+
GOMP_1.0 {
global:
GOMP_atomic_end;
diff --git a/libgomp/libgomp.texi b/libgomp/libgomp.texi
index 3efa228..4ff1fdb 100644
--- a/libgomp/libgomp.texi
+++ b/libgomp/libgomp.texi
@@ -360,8 +360,8 @@ to address of matching mapped list item per 5.1, Sect. 2.21.7.2 @tab N @tab
@multitable @columnfractions .60 .10 .25
@headitem Description @tab Status @tab Comments
-@item @code{omp_in_explicit_task} routine and @emph{implicit-task-var} ICV
- @tab N @tab
+@item @code{omp_in_explicit_task} routine and @emph{explicit-task-var} ICV
+ @tab Y @tab
@item @code{omp}/@code{ompx}/@code{omx} sentinels and @code{omp_}/@code{ompx_}
namespaces @tab N/A
@tab warning for @code{ompx/omx} sentinels@footnote{The @code{ompx}
@@ -387,7 +387,7 @@ to address of matching mapped list item per 5.1, Sect. 2.21.7.2 @tab N @tab
@item Extended list of directives permitted in Fortran pure procedures
@tab N @tab
@item New @code{allocators} directive for Fortran @tab N @tab
-@item Deprecation of @code{allocator} directive for Fortran
+@item Deprecation of @code{allocate} directive for Fortran
allocatables/pointers @tab N @tab
@item Optional paired @code{end} directive with @code{dispatch} @tab N @tab
@item New @code{memspace} and @code{traits} modifiers for @code{uses_allocators}
diff --git a/libgomp/omp.h.in b/libgomp/omp.h.in
index 925a650..bfa4e6a 100644
--- a/libgomp/omp.h.in
+++ b/libgomp/omp.h.in
@@ -244,6 +244,7 @@ extern int omp_get_team_size (int) __GOMP_NOTHROW;
extern int omp_get_active_level (void) __GOMP_NOTHROW;
extern int omp_in_final (void) __GOMP_NOTHROW;
+extern int omp_in_explicit_task (void) __GOMP_NOTHROW;
extern int omp_get_cancellation (void) __GOMP_NOTHROW;
extern omp_proc_bind_t omp_get_proc_bind (void) __GOMP_NOTHROW;
diff --git a/libgomp/omp_lib.f90.in b/libgomp/omp_lib.f90.in
index 7ba115f..04f32db 100644
--- a/libgomp/omp_lib.f90.in
+++ b/libgomp/omp_lib.f90.in
@@ -445,6 +445,12 @@
end interface
interface
+ function omp_in_explicit_task ()
+ logical (4) :: omp_in_explicit_task
+ end function omp_in_explicit_task
+ end interface
+
+ interface
function omp_get_cancellation ()
logical (4) :: omp_get_cancellation
end function omp_get_cancellation
diff --git a/libgomp/omp_lib.h.in b/libgomp/omp_lib.h.in
index 3626836..ecfb934 100644
--- a/libgomp/omp_lib.h.in
+++ b/libgomp/omp_lib.h.in
@@ -220,6 +220,8 @@
external omp_in_final
logical(4) omp_in_final
+ external omp_in_explicit_task
+ logical(4) omp_in_explicit_task
external omp_get_cancellation
logical(4) omp_get_cancellation
diff --git a/libgomp/target.c b/libgomp/target.c
index 5763483..73c99c7c 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -2813,6 +2813,7 @@ GOMP_target_ext (int device, void (*fn) (void *), size_t mapnum,
{
struct gomp_team *team = gomp_new_team (1);
struct gomp_task *task = thr->task;
+ struct gomp_task **implicit_task = &task;
struct gomp_task_icv *icv = task ? &task->icv : &gomp_global_icv;
team->prev_ts = thr->ts;
thr->ts.team = team;
@@ -2825,15 +2826,23 @@ GOMP_target_ext (int device, void (*fn) (void *), size_t mapnum,
thr->ts.static_trip = 0;
thr->task = &team->implicit_task[0];
gomp_init_task (thr->task, NULL, icv);
- if (task)
+ while (*implicit_task
+ && (*implicit_task)->kind != GOMP_TASK_IMPLICIT)
+ implicit_task = &(*implicit_task)->parent;
+ if (*implicit_task)
{
- thr->task = task;
+ thr->task = *implicit_task;
gomp_end_task ();
- free (task);
+ free (*implicit_task);
thr->task = &team->implicit_task[0];
}
else
pthread_setspecific (gomp_thread_destructor, thr);
+ if (implicit_task != &task)
+ {
+ *implicit_task = thr->task;
+ thr->task = task;
+ }
}
if (thr->ts.team
&& !thr->task->final_task)
diff --git a/libgomp/task.c b/libgomp/task.c
index 30cd046..a7e67e8 100644
--- a/libgomp/task.c
+++ b/libgomp/task.c
@@ -2465,6 +2465,7 @@ gomp_create_artificial_team (void)
struct gomp_task_icv *icv;
struct gomp_team *team = gomp_new_team (1);
struct gomp_task *task = thr->task;
+ struct gomp_task **implicit_task = &task;
icv = task ? &task->icv : &gomp_global_icv;
team->prev_ts = thr->ts;
thr->ts.team = team;
@@ -2477,17 +2478,25 @@ gomp_create_artificial_team (void)
thr->ts.static_trip = 0;
thr->task = &team->implicit_task[0];
gomp_init_task (thr->task, NULL, icv);
- if (task)
+ while (*implicit_task
+ && (*implicit_task)->kind != GOMP_TASK_IMPLICIT)
+ implicit_task = &(*implicit_task)->parent;
+ if (*implicit_task)
{
- thr->task = task;
+ thr->task = *implicit_task;
gomp_end_task ();
- free (task);
+ free (*implicit_task);
thr->task = &team->implicit_task[0];
}
#ifdef LIBGOMP_USE_PTHREADS
else
pthread_setspecific (gomp_thread_destructor, thr);
#endif
+ if (implicit_task != &task)
+ {
+ *implicit_task = thr->task;
+ thr->task = task;
+ }
}
/* The format of data is:
@@ -2678,6 +2687,16 @@ omp_in_final (void)
ialias (omp_in_final)
+int
+omp_in_explicit_task (void)
+{
+ struct gomp_thread *thr = gomp_thread ();
+ struct gomp_task *task = thr->task;
+ return task && task->kind != GOMP_TASK_IMPLICIT;
+}
+
+ialias (omp_in_explicit_task)
+
void
omp_fulfill_event (omp_event_handle_t event)
{
diff --git a/libgomp/testsuite/libgomp.c-c++-common/task-in-explicit-1.c b/libgomp/testsuite/libgomp.c-c++-common/task-in-explicit-1.c
new file mode 100644
index 0000000..a228d93
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c-c++-common/task-in-explicit-1.c
@@ -0,0 +1,106 @@
+/* { dg-do run } */
+
+#include <omp.h>
+#include <stdlib.h>
+
+int
+main ()
+{
+ if (omp_in_explicit_task ())
+ abort ();
+ #pragma omp task
+ if (!omp_in_explicit_task ())
+ abort ();
+ #pragma omp task final (1)
+ {
+ if (!omp_in_explicit_task ())
+ abort ();
+ #pragma omp task
+ if (!omp_in_explicit_task ())
+ abort ();
+ }
+ #pragma omp parallel
+ {
+ if (omp_in_explicit_task ())
+ abort ();
+ #pragma omp task if (0)
+ {
+ if (!omp_in_explicit_task ())
+ abort ();
+ #pragma omp task if (0)
+ if (!omp_in_explicit_task ())
+ abort ();
+ }
+ #pragma omp task final (1)
+ if (!omp_in_explicit_task ())
+ abort ();
+ #pragma omp barrier
+ if (omp_in_explicit_task ())
+ abort ();
+ #pragma omp taskloop num_tasks (24)
+ for (int i = 0; i < 32; ++i)
+ if (!omp_in_explicit_task ())
+ abort ();
+ #pragma omp masked
+ #pragma omp task
+ if (!omp_in_explicit_task ())
+ abort ();
+ #pragma omp barrier
+ if (omp_in_explicit_task ())
+ abort ();
+ }
+ #pragma omp target
+ {
+ if (omp_in_explicit_task ())
+ abort ();
+ #pragma omp task if (0)
+ if (!omp_in_explicit_task ())
+ abort ();
+ #pragma omp task
+ if (!omp_in_explicit_task ())
+ abort ();
+ }
+ #pragma omp target teams
+ {
+ #pragma omp distribute
+ for (int i = 0; i < 4; ++i)
+ if (omp_in_explicit_task ())
+ abort ();
+ else
+ {
+ #pragma omp parallel
+ {
+ if (omp_in_explicit_task ())
+ abort ();
+ #pragma omp task
+ if (!omp_in_explicit_task ())
+ abort ();
+ #pragma omp barrier
+ if (omp_in_explicit_task ())
+ abort ();
+ }
+ }
+ }
+ #pragma omp teams
+ {
+ #pragma omp distribute
+ for (int i = 0; i < 4; ++i)
+ if (omp_in_explicit_task ())
+ abort ();
+ else
+ {
+ #pragma omp parallel
+ {
+ if (omp_in_explicit_task ())
+ abort ();
+ #pragma omp task
+ if (!omp_in_explicit_task ())
+ abort ();
+ #pragma omp barrier
+ if (omp_in_explicit_task ())
+ abort ();
+ }
+ }
+ }
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c-c++-common/task-in-explicit-2.c b/libgomp/testsuite/libgomp.c-c++-common/task-in-explicit-2.c
new file mode 100644
index 0000000..44df596
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c-c++-common/task-in-explicit-2.c
@@ -0,0 +1,26 @@
+/* { dg-do run } */
+
+#include <omp.h>
+#include <stdlib.h>
+
+int
+main ()
+{
+ #pragma omp task
+ {
+ if (!omp_in_explicit_task ())
+ abort ();
+ #pragma omp task
+ {
+ if (!omp_in_explicit_task ())
+ abort ();
+ #pragma omp target nowait
+ if (omp_in_explicit_task ())
+ abort ();
+ if (!omp_in_explicit_task ())
+ abort ();
+ #pragma omp taskwait
+ }
+ }
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c-c++-common/task-in-explicit-3.c b/libgomp/testsuite/libgomp.c-c++-common/task-in-explicit-3.c
new file mode 100644
index 0000000..40eb94d
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c-c++-common/task-in-explicit-3.c
@@ -0,0 +1,36 @@
+/* { dg-do run } */
+
+#include <omp.h>
+#include <stdlib.h>
+
+int a;
+
+int
+main ()
+{
+ #pragma omp task
+ {
+ if (!omp_in_explicit_task ())
+ abort ();
+ #pragma omp task
+ {
+ if (!omp_in_explicit_task ())
+ abort ();
+ #pragma omp taskgroup task_reduction (+: a)
+ {
+ if (!omp_in_explicit_task ())
+ abort ();
+ #pragma omp task in_reduction (+: a)
+ {
+ ++a;
+ if (!omp_in_explicit_task ())
+ abort ();
+ }
+ }
+ if (!omp_in_explicit_task ())
+ abort ();
+ #pragma omp taskwait
+ }
+ }
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c-c++-common/task-reduction-17.c b/libgomp/testsuite/libgomp.c-c++-common/task-reduction-17.c
new file mode 100644
index 0000000..4a8d1e8
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c-c++-common/task-reduction-17.c
@@ -0,0 +1,36 @@
+/* { dg-do run } */
+
+#include <omp.h>
+#include <stdlib.h>
+
+int a;
+
+int
+main ()
+{
+ #pragma omp task final (1)
+ {
+ if (!omp_in_final ())
+ abort ();
+ #pragma omp task
+ {
+ if (!omp_in_final ())
+ abort ();
+ #pragma omp taskgroup task_reduction (+: a)
+ {
+ if (!omp_in_final ())
+ abort ();
+ #pragma omp task in_reduction (+: a)
+ {
+ ++a;
+ if (!omp_in_final ())
+ abort ();
+ }
+ }
+ if (!omp_in_final ())
+ abort ();
+ #pragma omp taskwait
+ }
+ }
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c-c++-common/task-reduction-18.c b/libgomp/testsuite/libgomp.c-c++-common/task-reduction-18.c
new file mode 100644
index 0000000..483f440
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c-c++-common/task-reduction-18.c
@@ -0,0 +1,17 @@
+/* { dg-do run } */
+
+int a;
+
+int
+main ()
+{
+ #pragma omp task
+ {
+ #pragma omp taskgroup task_reduction (+: a)
+ {
+ #pragma omp task in_reduction (+: a)
+ ++a;
+ }
+ }
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/task-7.c b/libgomp/testsuite/libgomp.c/task-7.c
new file mode 100644
index 0000000..0307575
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/task-7.c
@@ -0,0 +1,26 @@
+/* { dg-do run } */
+
+#include <omp.h>
+#include <stdlib.h>
+
+int
+main ()
+{
+ #pragma omp task final (1)
+ {
+ if (!omp_in_final ())
+ abort ();
+ #pragma omp task
+ {
+ if (!omp_in_final ())
+ abort ();
+ #pragma omp target nowait
+ if (omp_in_final ())
+ abort ();
+ if (!omp_in_final ())
+ abort ();
+ #pragma omp taskwait
+ }
+ }
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/task-8.c b/libgomp/testsuite/libgomp.c/task-8.c
new file mode 100644
index 0000000..f03aef6
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/task-8.c
@@ -0,0 +1,14 @@
+/* { dg-do run } */
+
+int
+main ()
+{
+ int i = 0;
+ #pragma omp task
+ {
+ #pragma omp target nowait private (i)
+ i = 1;
+ #pragma omp taskwait
+ }
+ return 0;
+}