helion.language.atomic_xchg

helion.language.atomic_xchg(target, index, value, sem='relaxed')[source]

Atomically exchange (set) a value at target[index].

Parameters:
  • target (Tensor) – Tensor to update.

  • index (list[object]) – Indices selecting elements to update. Can include tiles.

  • value (Tensor | float | bool) – New value(s) to set.

  • sem (str) – Memory ordering semantics. One of "relaxed", "acquire", "release", "acq_rel". Defaults to "relaxed".

Returns:

The previous value(s) stored at target[index] before the update.

Return type:

torch.Tensor