[Openmp-commits] [openmp] [OpenMP] Sync the team task for serialized parallel (PR #85600)
via Openmp-commits
openmp-commits at lists.llvm.org
Mon Mar 18 12:05:22 PDT 2024
https://github.com/lwshanbd updated https://github.com/llvm/llvm-project/pull/85600
>From 34456f0b7cdd45e90587b25830e103ea4e6b339a Mon Sep 17 00:00:00 2001
From: Baodi Shan <lwshanbd at gmail.com>
Date: Mon, 18 Mar 2024 00:46:38 -0400
Subject: [PATCH 1/2] [OpenMP] Sync the team task for serialized parallel.
---
openmp/runtime/src/kmp_barrier.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/openmp/runtime/src/kmp_barrier.cpp b/openmp/runtime/src/kmp_barrier.cpp
index e9ab15f1723b66..aa4b9aab43340a 100644
--- a/openmp/runtime/src/kmp_barrier.cpp
+++ b/openmp/runtime/src/kmp_barrier.cpp
@@ -2043,7 +2043,7 @@ static int __kmp_barrier_template(enum barrier_type bt, int gtid, int is_split,
TRUE);
__kmp_task_team_wait(this_thr, team USE_ITT_BUILD_ARG(itt_sync_obj));
__kmp_task_team_setup(this_thr, team, 0);
-
+ __kmp_task_team_sync(this_thr, team);
#if USE_ITT_BUILD
if (__itt_sync_create_ptr || KMP_ITT_DEBUG)
__kmp_itt_barrier_finished(gtid, itt_sync_obj);
>From 71bf36184bca8a7730c366299c444f0aac3c1587 Mon Sep 17 00:00:00 2001
From: Baodi Shan <lwshanbd at gmail.com>
Date: Mon, 18 Mar 2024 15:04:48 -0400
Subject: [PATCH 2/2] Add test for #81488
---
openmp/runtime/test/tasking/bug_81488.c | 32 +++++++++++++++++++++++++
1 file changed, 32 insertions(+)
create mode 100644 openmp/runtime/test/tasking/bug_81488.c
diff --git a/openmp/runtime/test/tasking/bug_81488.c b/openmp/runtime/test/tasking/bug_81488.c
new file mode 100644
index 00000000000000..e10469615f2b86
--- /dev/null
+++ b/openmp/runtime/test/tasking/bug_81488.c
@@ -0,0 +1,32 @@
+// RUN: %libomp-compile-and-run
+// RUN: %libomp-compile && env OMP_NUM_THREADS='1' %libomp-run
+
+/*
+https://github.com/llvm/llvm-project/issues/81488
+
+Assertion failure at kmp_runtime.cpp(2460): master_th->th.th_task_team ==
+team->t.t_task_team[master_th->th.th_task_state].
+OMP: Error #13: Assertion failure at kmp_runtime.cpp(2460).
+
+The assertion fails with OMP_NUM_THREADS=1.
+
+*/
+
+#include <omp.h>
+
+#define Nz 8
+#define DEVICE_ID 0
+
+int main(void) {
+#pragma omp parallel
+ {
+#pragma omp single
+ {
+#pragma omp target teams distribute parallel for nowait device(DEVICE_ID)
+ for (int i = 0; i < Nz; ++i) {
+ }
+ }
+#pragma omp barrier
+ }
+ return 0;
+}
More information about the Openmp-commits
mailing list