[all-commits] [llvm/llvm-project] 57a90e: [OpenMP][GPU][FIX] Enable generic barriers in sing...
Johannes Doerfert via All-commits
all-commits at lists.llvm.org
Tue May 20 19:34:15 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 57a90edacdf4ef14c6a95531681e8218cd23c4ab
https://github.com/llvm/llvm-project/commit/57a90edacdf4ef14c6a95531681e8218cd23c4ab
Author: Johannes Doerfert <johannes at jdoerfert.de>
Date: 2025-05-20 (Tue, 20 May 2025)
Changed paths:
M offload/DeviceRTL/src/Synchronization.cpp
A offload/test/offloading/single_threaded_for_barrier_hang_1.c
A offload/test/offloading/single_threaded_for_barrier_hang_2.c
Log Message:
-----------
[OpenMP][GPU][FIX] Enable generic barriers in single threaded contexts (#140786)
The generic GPU barrier implementation checked if it was the main thread
in generic mode to identify single threaded regions. This doesn't work
since inside of a non-active (=sequential) parallel, that thread becomes
the main thread of a team, and is not the main thread in generic mode.
At least that is the implementation of the APIs today.
To identify single threaded regions we now check the team size
explicitly.
This exposed three other issues; one is, for now, expected and not a
bug, the second one is a bug and has a FIXME in the
single_threaded_for_barrier_hang_1.c file, and the final one is also
benign as described in the end.
The non-bug issue comes up if we ever initialize a thread state.
Afterwards we will never run any region in parallel. This is a little
conservative, but I guess thread states are really bad for performance
anyway.
The bug comes up if we optimize single_threaded_for_barrier_hang_1 and
execute it in Generic-SPMD mode. For some reason we loose all the
updates to b. This looks very much like a compiler bug, but could also
be another logic issue in the runtime. Needs to be investigated.
Issue number 3 comes up if we have nested parallels inside of a target
region. The clang SPMD-check logic gets confused, determines SPMD (which
is fine) but picks an unreasonable thread count. This is all benign, I
think, just weird:
```
#pragma omp target teams
#pragma omp parallel num_threads(64)
#pragma omp parallel num_threads(10)
{}
```
Was launched with 10 threads, not 64.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list