Skip to content

vector.atomic.rmw

vector dialect

Atomic read-modify-write at per-lane signed element offsets. Each lane atomically combines its value with origin + offsets[lane] and the result lane is the old memory value observed by that atomic operation.

Operation contract

Property Value
Semantic phase
Interfaces MemoryAccess
Memory effects readwrite view

Signature

Kind Name Type Cardinality Description
Operand value vector required Vector update value for each lane.
Operand view view required Typed destination view.
Operand offsets vector required Per-lane signed element offsets from the logical origin.
Operand indices index variadic Dynamic logical origin indices.
Result result vector required Old memory values read by the atomic operations.
Attribute kind enum AtomicKind required
Attribute ordering enum AtomicOrdering required Required atomic memory ordering.
Attribute scope enum AtomicScope required Required atomic synchronization scope.
Attribute cache_scope enum CacheScope optional Optional cache/coherency scope required by target lowering.
Attribute cache_temporal enum CacheTemporal optional Optional temporal cache policy required by target lowering.
Attribute static_indices i64_array required Static logical origin indices with INT64_MIN sentinels for dynamics.

Verification constraints

  • HasIndexOrNonI1IntegerElement(offsets)
  • SameElementType(value, view, result)
  • SameShape(offsets, value, result)
  • SameType(value, result)

Examples

%old = vector.atomic.rmw<addi> %v, %view[%row, %col][%offsets] {ordering = relaxed, scope = workgroup} : vector<4xi32>, view<[%m]x[%n]xi32, %layout>, vector<4xindex>