Atomics
cuTile offers atomics in three flavours, which differ in what they return and how strongly they order:
| Family | Returns | Ordering |
|---|---|---|
ct.atomic_cas, ct.atomic_xchg, ct.atomic_add and friends | the old value | configurable |
ct.atomic_store_* | nothing | fixed: relaxed, device-wide |
ct.@atomic | depends on form | configurable |
The read-modify-write atomic_* functions accept memory_order (default: ct.MemoryOrder.AcqRel) and memory_scope (default: ct.MemScope.Device) keyword arguments; see Memory Model. Their indices may be scalars or tiles.
View-based reductions
The atomic_store_* functions use Tile IR's view-based atomic reductions and require Tile IR bytecode v13.3 or newer. The destination may be a TileArray or a TiledView returned by eachtile; tile updates are broadcast to the selected window.
They cover fewer element types than the read-modify-write family, and BFloat16 addition additionally requires Hopper (sm_90) or newer; see Compatibility and atomic_store_add.
ct.@atomic
ct.@atomic provides statement and value forms:
ct.@atomic windows[i, j] += update
ct.@atomic counters[i] = max(counters[i], value)
old_new = ct.@atomic counters[i] + valueStatement forms return nothing and default to relaxed (:monotonic) ordering. Value forms return old => new and default to :acquire_release. The supported operators are +, -, max, min, &, |, and ⊻. An explicit leading order may be :monotonic, :acquire, :release, or :acquire_release; ordered statements and value forms require a TileArray, while TiledView reductions support only :monotonic.