Script.atomic.shared_exch

Script.atomic.shared_exch

Script.atomic.shared_exch(dst, values, *, sem='relaxed', scope='cta', output=None)[source]

Element-wise old = dst[i]; dst[i] = values[i] atomically (exchange).

Unlike the arithmetic ops, exch has no red.* counterpart in PTX, so output is effectively always bound. Callers that don’t need the old value should prefer a plain store.

See shared_add() for the full parameter description.

Notes

  • Thread group: Can be executed by any sized thread group.

  • Hardware: Requires compute capability 7.0+ (sm_70).

  • PTX: atom.{sem}.{scope}.shared.exch.s32.

Parameters:
Return type:

RegisterTensor | None