[Openmp-commits] [openmp] [OpenMP][offload] Fix wave32 handling of xteam reductions (PR #233096)
Robert Imschweiler via Openmp-commits
openmp-commits at lists.llvm.org
Tue Oct 20 01:11:39 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 `Full` could also be a constexpr somewhere, but I guess that since it should be constant folded with __gpu_num_lanes anyway, it doesn't make a difference. And if it isn't constant-folded, the load from a location somewhere would probably be more expensive than computing, anyway...
https://github.com/llvm/llvm-project/pull/233096
More information about the Openmp-commits
mailing list