[Openmp-commits] [openmp] [OpenMP][offload] Fix wave32 handling of xteam reductions (PR #233096)

Robert Imschweiler via Openmp-commits openmp-commits at lists.llvm.org
Sat Oct 17 09:30:47 PDT 2026


================
@@ -101,11 +101,14 @@ static uint32_t gpu_block_reduce(void *reduce_data, ShuffleReductFnTy shflFct,
   if constexpr (checkLiveness) {
     __kmpc_impl_lanemask_t Liveness = mapping::activemask();
     // Check for partial warp with non-contiguous lanes.
-    if (Liveness == lanes::All) {
+    // Consider that Liveness::ALL is a 64-bit value, so compare the actual
+    // number of set bits to handle 32bit waves correctly.
+    uint32_t NumLive = static_cast<uint32_t>(utils::popc(Liveness));
+    if (NumLive == mapping::getWarpSize()) {
----------------
ro-i wrote:

the issue is that `lanes::All` is a 64-bit ~0. And wave32 returns a 32-bit ~0.
Do you think there would be any alternatives?
I mean, we could also extend wave32 exec, maybe? Or we could check if wave32 or wave64 and then compare only the low 32 bits.

https://github.com/llvm/llvm-project/pull/233096


More information about the Openmp-commits mailing list