Skip to content

vector.gather

← vector dialect

Gather a vector from per-lane signed logical offsets added to the last view axis of a full-rank view origin. Each result lane reads origin with the final coordinate adjusted by offsets[lane]; the offset vector shape matches the result shape.

Operation contract

Property Value
Semantic phase —
Interfaces CachePolicy, MemoryAccess
Memory effects read view

Signature

Kind Name Type Cardinality Description
Operand view view required Typed source 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 Gathered vector value.
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(view, result)
  • SameShape(offsets, result)

Examples

%v = vector.gather %view[%row, %col][%offsets] : view<[%m]x[%n]xf32, %layout>, vector<4xindex> -> vector<4xf32>