Skip to content

vector.gather.mask

vector dialect

Masked vector gather from per-lane signed logical offsets added to the last view axis. True mask lanes read the adjusted coordinate, while false mask lanes do not access memory and take the corresponding passthrough lane.

Operation contract

Property Value
Semantic phase
Interfaces 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 mask vector required i1 vector mask selecting gathered lanes.
Operand passthrough vector required Value used for masked-off lanes.
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

  • HasI1Element(mask)
  • HasIndexOrNonI1IntegerElement(offsets)
  • SameElementType(view, passthrough, result)
  • SameShape(offsets, mask, passthrough, result)
  • SameType(passthrough, result)

Examples

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