```mlir {.mlir}
// Affine map out-of-line definition and usage example.
-#affine_map42 = (d0, d1)[s0] -> (d0, d0 + d1 + floordiv(s0,2))
+#affine_map42 = (d0, d1)[s0] -> (d0, d0 + d1 + s0 floordiv 2)
// Use an affine mapping definition in an alloc operation, binding the
// SSA value %N to the symbol s0.
%a = alloc()[%N] : memref<4x4xf32, #affine_map42>
// Same thing with an inline affine mapping definition.
-%b = alloc()[%N] : memref<4x4xf32, (d0, d1)[s0] -> (d0, d0 + d1 + floordiv(s0,2))>
+%b = alloc()[%N] : memref<4x4xf32, (d0, d1)[s0] -> (d0, d0 + d1 + s0 floordiv 2)>
```
### Semi-affine maps
| semi-affine-expr `+` semi-affine-expr
| semi-affine-expr `-` semi-affine-expr
| symbol-or-const `*` semi-affine-expr
- | `ceildiv` `(` semi-affine-expr `,` symbol-or-const `)`
- | `floordiv` `(` semi-affine-expr `,` symbol-or-const `)`
+ | semi-affine-expr `ceildiv` symbol-or-const
+ | semi-affine-expr `floordiv` symbol-or-const
| semi-affine-expr `mod` symbol-or-const
| bare-id
| `-`? integer-literal
```mlir {.mlir}
// A example two-dimensional integer set with two symbols.
#set42 = (d0, d1)[s0, s1]
- : d0 >= 0, -d0 + s0 - 1 >= 0, d1 >= 0, -d1 + s1 - 1 >= 0
+ : (d0 >= 0, -d0 + s0 - 1 >= 0, d1 >= 0, -d1 + s1 - 1 >= 0)
// Inside a Region
affine.if #set42(%i, %j)[%M, %N] {
Example:
```mlir {.mlir}
-#map10 = (d0, d1) -> (floordiv(d0,8) + floordiv(d1,128))
+#map10 = (d0, d1) -> (d0 floordiv 8 + d1 floordiv 128)
...
%1 = affine.apply #map10 (%s, %t)
tensor-memref-element-type ::= vector-element-type | vector-type
// memref requires a known rank, but tensor does not.
-dimension-list ::= dimension-list-ranked | `*` `x`
+dimension-list ::= dimension-list-ranked | (`*` `x`)
dimension-list-ranked ::= (dimension `x`)*
dimension ::= `?` | decimal-literal
```
TODO: MLIR will eventually have target-dialects which allow symbolic use of
memory hierarchy names (e.g. L3, L2, L1, ...) but we have not spec'd the details
of that mechanism yet. Until then, this document pretends that it is valid to
-refer to these memories by `bare_id`.
+refer to these memories by `bare-id`.
The notionally dynamic value of a memref value includes the address of the
buffer allocated, as well as the symbols referred to by the shape, layout map,
#layout_map_row_major = (i, j) [M, N] -> (i, j) size (M, N)
// MxN matrix stored in column major layout in memory:
-#layout_map_col_major = (i, j), [M, N] -> (j, i) size (M, N)
+#layout_map_col_major = (i, j) [M, N] -> (j, i) size (M, N)
```
##### Affine Map Composition
Example:
```mlir {.mlir}
- sparse<tensor<3x4xi32>, [[0, 0], [1, 2]], [1, 5]>
+ sparse<[[0, 0], [1, 2]], [1, 5]> : tensor<3x4xi32>
// This represents the following tensor:
/// [[1, 0, 0, 0],
Syntax:
``` {.ebnf}
-float-attribute ::= float-literal (`:` float-type)?
- | hexadecimal-literal `:` float-type
+float-attribute ::= (float-literal (`:` float-type)?)
+ | (hexadecimal-literal `:` float-type)
```
A float attribute is a literal attribute that represents a floating point value