diff --git a/sycl/include/sycl/ext/intel/esimd/memory.hpp b/sycl/include/sycl/ext/intel/esimd/memory.hpp index ff93796bbd2c2..301eb99d321a4 100644 --- a/sycl/include/sycl/ext/intel/esimd/memory.hpp +++ b/sycl/include/sycl/ext/intel/esimd/memory.hpp @@ -841,8 +841,8 @@ __ESIMD_API simd atomic_update(Tx *p, simd offset, /// @tparam N The number of memory locations to update. /// @param p The USM pointer. /// @param offset The vector of 32-bit offsets in bytes. -/// @param src0 The first additional argument (expected value). -/// @param src1 The second additional argument (new value). +/// @param src0 The first additional argument (new value). +/// @param src1 The second additional argument (expected value). /// @param mask Operation mask, only locations with non-zero in the /// corresponding mask element are updated. /// @return A vector of the old values at the memory locations before the diff --git a/sycl/include/sycl/ext/intel/experimental/esimd/memory.hpp b/sycl/include/sycl/ext/intel/experimental/esimd/memory.hpp index 59725e7db8ecf..7297bf9dfc5d7 100644 --- a/sycl/include/sycl/ext/intel/experimental/esimd/memory.hpp +++ b/sycl/include/sycl/ext/intel/experimental/esimd/memory.hpp @@ -1458,9 +1458,9 @@ lsc_atomic_update(T *p, __ESIMD_NS::simd offsets, /// @tparam L3H is L3 cache hint. /// @param p is the base pointer. /// @param offsets is the zero-based offsets. -/// @param src0 is the first atomic operand. -/// @param src1 is the second atomic operand. -/// @param pred is predicates. +/// @param src0 is the first atomic operand (expected value). +/// @param src1 is the second atomic operand (new value). +/// @param pred predicates. /// template <__ESIMD_NS::atomic_op Op, typename T, int N, lsc_data_size DS = lsc_data_size::default_size, @@ -1695,8 +1695,11 @@ template __ESIMD_API simd atomic_update(T *p, simd offset, simd src0, simd src1, simd_mask mask) { + // 2-argument lsc_atomic_update arguments order matches the standard one - + // expected value first, then new value. But atomic_update uses reverse order, + // hence the src1/src0 swap. return __ESIMD_ENS::lsc_atomic_update(), T, N>( - p, offset, src0, src1, mask); + p, offset, src1, src0, mask); } } // namespace esimd