Skip to content

Commit e03083c

Browse files
authored
Return the old value from atomic_fetch_op_explicit. (#640)
This matches the behavior of Metal's atomic_fetch_add_explicit and friends.
1 parent fd9e25e commit e03083c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/device/intrinsics/atomics.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ end
112112
cmp = old
113113
new = convert(T, op(old, val))
114114
old = atomic_compare_exchange_weak_explicit(ptr, cmp, new)
115-
isequal(old, cmp) && return new
115+
isequal(old, cmp) && return old
116116
end
117117
end
118118

0 commit comments

Comments
 (0)