Skip to content

Commit

Permalink
avoid potential race condition HIP
Browse files Browse the repository at this point in the history
  • Loading branch information
tcclevenger committed Sep 11, 2023
1 parent 9081d36 commit 96bb26b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/src/HIP/Kokkos_HIP_ReduceScan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ struct HIPReductionsFunctor<FunctorType, false> {
int const lane_id =
(threadIdx.y * blockDim.x + threadIdx.x) % HIPTraits::WarpSize;
for (int delta = skip_vector ? blockDim.x : 1; delta < width; delta *= 2) {
if (lane_id + delta < HIPTraits::WarpSize) {
if (lane_id + delta < HIPTraits::WarpSize &&
(lane_id % (delta * 2) == 0)) {
functor.join(value, value + delta);
}
}
Expand Down

0 comments on commit 96bb26b

Please sign in to comment.