[all-commits] [llvm/llvm-project] c836b8: [mlir][OpenACC] Atomicize contended shared array r...
Matsu via All-commits
all-commits at lists.llvm.org
Thu Jul 30 14:03:07 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: c836b82d088424baa8a60de63136747add192732
https://github.com/llvm/llvm-project/commit/c836b82d088424baa8a60de63136747add192732
Author: Matsu <47756807+khaki3 at users.noreply.github.com>
Date: 2026-07-30 (Thu, 30 Jul 2026)
Changed paths:
M mlir/lib/Dialect/OpenACC/Transforms/ACCCGToGPU.cpp
M mlir/test/Dialect/OpenACC/acc-cg-to-gpu-reduction-array-shared.mlir
Log Message:
-----------
[mlir][OpenACC] Atomicize contended shared array reduction updates (#212971)
Example:
```fortran
!$acc parallel loop gang reduction(+:a)
do i = 1, N
!$acc loop worker reduction(+:a)
do j = 1, M
a(i) = a(i) + b(j,i)
end do
end do
```
In this code, the worker accumulator is block-shared, so every worker
updates
the same element with a plain read-modify-write and all but one partial
is lost.
Fix: make in-place updates of a block-shared array accumulator atomic,
unless
the element index varies per thread, in which case each thread owns its
element
and the plain update is already race-free.
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply at anthropic.com>
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list