[Openmp-commits] [llvm] [openmp] [OpenMP][offload] Fix single-thread SPMD cross-team reductions (PR #231843)
Robert Imschweiler via Openmp-commits
openmp-commits at lists.llvm.org
Wed Oct 14 02:57:21 PDT 2026
ro-i wrote:
this is an alternative to https://github.com/llvm/llvm-project/pull/228216.
Note that this approach also changes the return value of omp_get_thread_limit() in such kernels.
The reason why we need handling is that we want to use all threads in Generic-SPMD mode for the final cross-team reduction *if those threads are available*. They are at this point, if there is a parallel region somewhere. So, even though the final inter-team reduction doesn't run in the parallel region itself, it can use the available threads.
If there is no parallel region in the kernel, though, then this mechanism fails because OpenMPOpt lets all the other threads (except the main thread) exit early, so we can't be smart and use them.
The distinction can either be made by checking, like in the other PR, or we can set the maxthreads in OpenMPOpt, like this PR does.
https://github.com/llvm/llvm-project/pull/231843
More information about the Openmp-commits
mailing list