triton.language.atomic_xchg

triton.language.atomic_xchg(pointer, val, mask=None)

Performs an atomic exchange at the memory location specified by pointer.

Return the data stored at pointer before the atomic operation.

Parameters:
  • pointer (Block of dtype=triton.PointerDType) – The memory locations to compare-and-swap.

  • cmp (Block of dtype=`pointer.dtype.element_ty`) – The values expected to be found in the atomic object

  • val (Block of dtype=`pointer.dtype.element_ty`) – The values to copy in case the expected value matches the contained value.