Lines Matching full:layout
1 # Data Layout Modeling
3 Data layout information allows the compiler to answer questions related to how a
9 The data layout subsystem is designed to scale to MLIR's open type and operation
12 * attribute interfaces that can be implemented by concrete data layout
14 * type interfaces that should be implemented by types subject to data layout;
16 as data layout scopes (e.g., modules);
17 * and dialect interfaces for data layout properties unrelated to specific
30 Following MLIR's nested structure, data layout properties are _scoped_ to
33 partially control the data layout properties and may have attributes that affect
34 them, typically organized in a data layout specification.
36 Types may have a different data layout in different scopes, including scopes
39 has fixed data layout properties. Types are also expected to have a default,
40 "natural" data layout in case they are used outside of any operation that
41 provides data layout scope for them. This ensures that data layout queries
46 The information necessary to compute layout properties can be combined from
47 nested scopes. For example, an outer scope can define layout properties for a
50 supported by the notion of data layout _compatibility_: the layout defined in a
58 Data layout compatibility is also relevant during IR transformation. Any
59 transformation that affects the data layout scoping operation is expected to
60 maintain data layout compatibility. It is under responsibility of the
65 Data layout property queries can be performed on the special object --
67 objects allow one to interface with the data layout infrastructure and query
85 the data layout properties are fixed in the scope, they will be computed only
89 caching, a `DataLayout` object returns valid results as long as the data layout
91 ancestor operations are modified in a way that affects data layout. After such a
98 Extensibility of the data layout modeling is provided through a set of MLIR
101 ### Data Layout Specifications
103 Data layout specification is an [attribute](LangRef.md/#attributes) that is
104 conceptually a collection of key-value pairs called data layout specification
105 _entries_. Data layout specification attributes implement the
109 specific types or dialects: when handling a data layout properties request, a
113 understand layout details of other types. Entry values are arbitrary attributes,
116 For example, a data layout specification may be an actual list of pairs with
129 We use the notion of _type class_ throughout the data layout subsystem. It
132 Instead, data layout entries contain specific _instances_ of a type class, for
135 handling a data layout property query, a type class will be supplied with _all_
140 data layout properties of _any_ specific type instance given properties of other
147 ### Data Layout Scoping Operations
149 Operations that define a scope for data layout queries, and that can be used to
152 data layout specification. The specification need not be necessarily attached to
155 custom handlers for data layout queries that provide results without forwarding
158 for scoping operations to (re)define data layout properties for types without
164 ### Types with Data Layout
166 Type classes that intend to handle data layout queries themselves are expected
168 hooks for each data layout query. Each of these hooks is supplied with the type
170 data layout queries relevant for the type class. It is expected to provide a
177 ### Dialects with Data Layout Identifiers
179 For data layout entries that are not related to a particular type class, the key
196 The overall flow of a data layout property query is as follows.
199 fetches the data layout specification and combines it with those of
204 4. Otherwise, the query is handed down by `DataLayout` to the closest layout
220 The default implementation of the data layout interfaces directly handles
253 [default data layout in LLVM](https://llvm.org/docs/LangRef.html#data-layout),
254 which MLIR assumed until the introduction of proper data layout modeling, and
262 e.g., `memref` operations. Its data layout is parameterized by a single integer
263 data layout entry that specifies its bitwidth. For example,
272 using 32-bit precision as well. All other layout properties of `index` match
288 The default data layout assumes 8-bit bytes.