diff options
author | Alex Richardson <alexrichardson@google.com> | 2024-02-27 13:25:49 -0800 |
---|---|---|
committer | Alex Richardson <alexrichardson@google.com> | 2024-02-27 13:25:49 -0800 |
commit | 413077b8f719e969aba07bc24b5e631f3483842b (patch) | |
tree | 6bdd90085053dfd72ca5a480ee46e6d358337ac0 /openmp | |
parent | eba1687159247f1dcc185a68d7ebd67e49796b09 (diff) | |
parent | d82e93e7f129d9e8b72570efdf4a15d6ec3d4336 (diff) | |
download | llvm-users/arichardson/spr/main.compiler-rt-allow-running-tests-without-installing-first.zip llvm-users/arichardson/spr/main.compiler-rt-allow-running-tests-without-installing-first.tar.gz llvm-users/arichardson/spr/main.compiler-rt-allow-running-tests-without-installing-first.tar.bz2 |
[𝘀𝗽𝗿] changes introduced through rebaseusers/arichardson/spr/main.compiler-rt-allow-running-tests-without-installing-first
Created using spr 1.3.4
[skip ci]
Diffstat (limited to 'openmp')
-rw-r--r-- | openmp/runtime/src/kmp_runtime.cpp | 5 | ||||
-rw-r--r-- | openmp/runtime/test/barrier/llvm-issue-80664.c | 37 |
2 files changed, 39 insertions, 3 deletions
diff --git a/openmp/runtime/src/kmp_runtime.cpp b/openmp/runtime/src/kmp_runtime.cpp index fc5e840..7edb0b4 100644 --- a/openmp/runtime/src/kmp_runtime.cpp +++ b/openmp/runtime/src/kmp_runtime.cpp @@ -5708,9 +5708,8 @@ void __kmp_free_team(kmp_root_t *root, } #endif // first check if thread is sleeping - kmp_flag_64<> fl(&th->th.th_bar[bs_forkjoin_barrier].bb.b_go, th); - if (fl.is_sleeping()) - fl.resume(__kmp_gtid_from_thread(th)); + if (th->th.th_sleep_loc) + __kmp_null_resume_wrapper(th); KMP_CPU_PAUSE(); } } diff --git a/openmp/runtime/test/barrier/llvm-issue-80664.c b/openmp/runtime/test/barrier/llvm-issue-80664.c new file mode 100644 index 0000000..79aa228 --- /dev/null +++ b/openmp/runtime/test/barrier/llvm-issue-80664.c @@ -0,0 +1,37 @@ +// RUN: %libomp-compile +// RUN: env OMP_WAIT_POLICY=passive \ +// RUN: KMP_FORKJOIN_BARRIER_PATTERN='linear,linear' %libomp-run +// RUN: env OMP_WAIT_POLICY=passive \ +// RUN: KMP_FORKJOIN_BARRIER_PATTERN='tree,tree' %libomp-run +// RUN: env OMP_WAIT_POLICY=passive \ +// RUN: KMP_FORKJOIN_BARRIER_PATTERN='hyper,hyper' %libomp-run +// RUN: env OMP_WAIT_POLICY=passive \ +// RUN: KMP_FORKJOIN_BARRIER_PATTERN='dist,dist' %libomp-run +// +// LLVM ISSUE 80664: https://github.com/llvm/llvm-project/issues/80664 +// +// Distributed barrier + OMP_WAIT_POLICY=passive hangs in library termination +// Reason: the resume logic in __kmp_free_team() was faulty and, when checking +// for sleep status, didn't look at correct location for distributed barrier. + +#include <stdio.h> +#include <stdlib.h> + +int a = 0; + +void test_omp_barrier() { +#pragma omp parallel + { +#pragma omp task + { +#pragma omp atomic + a++; + } + } +} + +int main() { + test_omp_barrier(); + printf("a = %d\n", a); + return EXIT_SUCCESS; +} |