triton.language.atomic_cas

triton.language.atomic_cas(pointer, cmp, val, builder=None)

Performs an atomic “compare-and-swap” and the memory locations specified by pointer.

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.

  • builder (triton.ir.builder, optional from within JIT'ed functions) – IR builder to generate code into