@@ -1184,40 +1184,23 @@ def LoadOp : MemRef_Op<"load",
1184
1184
DeclareOpInterfaceMethods<DestructurableAccessorOpInterface>]> {
1185
1185
let summary = "load operation";
1186
1186
let description = [{
1187
- The `load` op reads an element from a memref specified by an index list. The
1188
- output of load is a new value with the same type as the elements of the
1189
- memref. The arity of indices is the rank of the memref (i.e., if the memref
1190
- loaded from is of rank 3, then 3 indices are required for the load following
1191
- the memref identifier).
1192
-
1193
- In an `affine.if` or `affine.for` body, the indices of a load are restricted
1194
- to SSA values bound to surrounding loop induction variables,
1195
- [symbols](Affine.md/#dimensions-and-symbols), results of a
1196
- constant operations, or the result of an
1197
- `affine.apply` operation that can in turn take as arguments all of the
1198
- aforementioned SSA values or the recursively result of such an
1199
- `affine.apply` operation.
1187
+ The `load` op reads an element from a memref at the specified indices.
1188
+
1189
+ The number of indices must match the rank of the memref. The indices must
1190
+ be in-bounds: `0 <= idx < dim_size`
1191
+
1192
+ The single result of `memref.load` is a value with the same type as the
1193
+ element type of the memref.
1194
+
1195
+ A set `nontemporal` attribute indicates that this load is not expected to
1196
+ be reused in the cache. For details, refer to the
1197
+ [https://llvm.org/docs/LangRef.html#load-instruction](LLVM load instruction).
1200
1198
1201
1199
Example:
1202
1200
1203
1201
```mlir
1204
- %1 = affine.apply affine_map<(d0, d1) -> (3*d0)> (%i, %j)
1205
- %2 = affine.apply affine_map<(d0, d1) -> (d1+1)> (%i, %j)
1206
- %12 = memref.load %A[%1, %2] : memref<8x?xi32, #layout, memspace0>
1207
-
1208
- // Example of an indirect load (treated as non-affine)
1209
- %3 = affine.apply affine_map<(d0) -> (2*d0 + 1)>(%12)
1210
- %13 = memref.load %A[%3, %2] : memref<4x?xi32, #layout, memspace0>
1202
+ %0 = memref.load %A[%a, %b] : memref<8x?xi32, #layout, memspace0>
1211
1203
```
1212
-
1213
- **Context:** The `load` and `store` operations are specifically crafted to
1214
- fully resolve a reference to an element of a memref, and (in affine
1215
- `affine.if` and `affine.for` operations) the compiler can follow use-def
1216
- chains (e.g. through [`affine.apply`](Affine.md/#affineapply-affineapplyop)
1217
- operations) to precisely analyze references at compile-time using polyhedral
1218
- techniques. This is possible because of the
1219
- [restrictions on dimensions and symbols](Affine.md/#restrictions-on-dimensions-and-symbols)
1220
- in these contexts.
1221
1204
}];
1222
1205
1223
1206
let arguments = (ins Arg<AnyMemRef, "the reference to load from",
@@ -1817,32 +1800,20 @@ def MemRef_StoreOp : MemRef_Op<"store",
1817
1800
DeclareOpInterfaceMethods<DestructurableAccessorOpInterface>]> {
1818
1801
let summary = "store operation";
1819
1802
let description = [{
1820
- Store a value to a memref location given by indices. The value stored should
1821
- have the same type as the elemental type of the memref. The number of
1822
- arguments provided within brackets need to match the rank of the memref.
1823
-
1824
- In an affine context, the indices of a store are restricted to SSA values
1825
- bound to surrounding loop induction variables,
1826
- [symbols](Affine.md/#restrictions-on-dimensions-and-symbols), results of a
1827
- `constant` operation, or the result of an
1828
- [`affine.apply`](Affine.md/#affineapply-affineapplyop) operation that can in
1829
- turn take as arguments all of the aforementioned SSA values or the
1830
- recursively result of such an `affine.apply` operation.
1803
+ The `store` op stores an element into a memref at the specified indices.
1804
+
1805
+ The number of indices must match the rank of the memref. The indices must
1806
+ be in-bounds: `0 <= idx < dim_size`
1807
+
1808
+ A set `nontemporal` attribute indicates that this store is not expected to
1809
+ be reused in the cache. For details, refer to the
1810
+ [https://llvm.org/docs/LangRef.html#store-instruction](LLVM store instruction).
1831
1811
1832
1812
Example:
1833
1813
1834
1814
```mlir
1835
- memref.store %100 , %A[%1, 1023 ] : memref<4x?xf32 , #layout, memspace0>
1815
+ memref.store %val , %A[%a, %b ] : memref<8x?xi32 , #layout, memspace0>
1836
1816
```
1837
-
1838
- **Context:** The `load` and `store` operations are specifically crafted to
1839
- fully resolve a reference to an element of a memref, and (in polyhedral
1840
- `affine.if` and `affine.for` operations) the compiler can follow use-def
1841
- chains (e.g. through [`affine.apply`](Affine.md/#affineapply-affineapplyop)
1842
- operations) to precisely analyze references at compile-time using polyhedral
1843
- techniques. This is possible because of the
1844
- [restrictions on dimensions and symbols](Affine.md/#restrictions-on-dimensions-and-symbols)
1845
- in these contexts.
1846
1817
}];
1847
1818
1848
1819
let arguments = (ins AnyType:$value,
0 commit comments