Skip to content

view.subview

← view dialect

Form a logical subview from an existing view. Offsets select the logical origin; result type dimensions provide the subview extents. When those extents cannot independently preserve the source address function, a trailing encoding co-result captures the source physical layout and the result view type references it. The element-access alignment requirement is preserved; forming a subview makes no memory access or address-alignment promise.

Operation contract

Property Value
Semantic phase executable
Traits Pure, RefinableResultTypeRefs

Signature

Kind Name Type Cardinality Description
Operand source view required Source view.
Operand offsets index variadic Dynamic logical offsets.
Result result view required Subview over the same storage root.
Result physical_encoding any variadic Captured source address layout and storage schema.
Attribute static_offsets i64_array required Static logical offsets with INT64_MIN sentinels for dynamics.

Verification constraints

  • SameElementType(source, result)
  • RanksMatch(source, result)

Examples

%rows = view.subview %source[%row, 0] : view<[%M]x[%N]xf32> -> view<16x[%N]xf32>
%crop, %layout = view.subview %source[%row, 2] : view<[%M]x[%N]xf32> -> view<16x3xf32, %layout>