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

Joseph Huber via Openmp-commits openmp-commits at lists.llvm.org
Sat Oct 17 08:32:30 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()) {
----------------
jhuber6 wrote:

So, `lanes::All` wasn't the proper predicate? This seems fine but I'm just checking because doing a popcount unconditionally does have non-zero overhead in the uniform case.

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


More information about the Openmp-commits mailing list