diff options
Diffstat (limited to 'mlir/test/IR')
-rw-r--r-- | mlir/test/IR/affine-map.mlir | 228 | ||||
-rw-r--r-- | mlir/test/IR/core-ops.mlir | 68 | ||||
-rw-r--r-- | mlir/test/IR/invalid-affinemap.mlir | 66 | ||||
-rw-r--r-- | mlir/test/IR/invalid-ops.mlir | 58 | ||||
-rw-r--r-- | mlir/test/IR/invalid.mlir | 52 | ||||
-rw-r--r-- | mlir/test/IR/locations.mlir | 2 | ||||
-rw-r--r-- | mlir/test/IR/memory-ops.mlir | 24 | ||||
-rw-r--r-- | mlir/test/IR/opaque_locations.mlir | 2 | ||||
-rw-r--r-- | mlir/test/IR/parser.mlir | 128 | ||||
-rw-r--r-- | mlir/test/IR/pretty-locations.mlir | 2 | ||||
-rw-r--r-- | mlir/test/IR/print-op-local-scope.mlir | 4 |
11 files changed, 317 insertions, 317 deletions
diff --git a/mlir/test/IR/affine-map.mlir b/mlir/test/IR/affine-map.mlir index ebbd4735635..9ce4d8c0bfc 100644 --- a/mlir/test/IR/affine-map.mlir +++ b/mlir/test/IR/affine-map.mlir @@ -1,187 +1,187 @@ // RUN: mlir-opt %s | FileCheck %s // Identity maps used in trivial compositions in MemRefs are optimized away. -// CHECK-NOT: #map{{[0-9]+}} = (d0, d1) -> (d0, d1) -#map0 = (i, j) -> (i, j) +// CHECK-NOT: #map{{[0-9]+}} = affine_map<(d0, d1) -> (d0, d1)> +#map0 = affine_map<(i, j) -> (i, j)> -// CHECK-NOT: #map{{[0-9]+}} = (d0, d1)[s0] -> (d0, d1) -#map1 = (i, j)[s0] -> (i, j) +// CHECK-NOT: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0, d1)> +#map1 = affine_map<(i, j)[s0] -> (i, j)> -// CHECK: #map{{[0-9]+}} = () -> (0) +// CHECK: #map{{[0-9]+}} = affine_map<() -> (0)> // A map may have 0 inputs. // However, an affine.apply always takes at least one input. -#map2 = () -> (0) +#map2 = affine_map<() -> (0)> // All the maps in the following block are equivalent and are unique'd as one // map. Therefore there should be only one output and we explicitly CHECK-NOT // for the others. -// CHECK: #map{{[0-9]+}} = (d0, d1) -> (d0 + 1, d1 * 4 + 2) -#map3 = (i, j) -> (i+1, 4*j + 2) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1) -> (d0 + 1, d1 * 4 + 2)> +#map3 = affine_map<(i, j) -> (i+1, 4*j + 2)> // CHECK-NOT: #map3{{[a-z]}} -#map3a = (i, j) -> (1+i, 4*j + 2) -#map3b = (i, j) -> (2 + 3 - 2*2 + i, 4*j + 2) -#map3c = (i, j) -> (i +1 + 0, 4*j + 2) -#map3d = (i, j) -> (i + 3 + 2 - 4, 4*j + 2) -#map3e = (i, j) -> (1*i+3*2-2*2-1, 4*j + 2) -#map3f = (i, j) -> (i + 1, 4*j*1 + 2) -#map3g = (i, j) -> (i + 1, 2*2*j + 2) -#map3h = (i, j) -> (i + 1, 2*j*2 + 2) -#map3i = (i, j) -> (i + 1, j*2*2 + 2) -#map3j = (i, j) -> (i + 1, j*1*4 + 2) -#map3k = (i, j) -> (i + 1, j*4*1 + 2) +#map3a = affine_map<(i, j) -> (1+i, 4*j + 2)> +#map3b = affine_map<(i, j) -> (2 + 3 - 2*2 + i, 4*j + 2)> +#map3c = affine_map<(i, j) -> (i +1 + 0, 4*j + 2)> +#map3d = affine_map<(i, j) -> (i + 3 + 2 - 4, 4*j + 2)> +#map3e = affine_map<(i, j) -> (1*i+3*2-2*2-1, 4*j + 2)> +#map3f = affine_map<(i, j) -> (i + 1, 4*j*1 + 2)> +#map3g = affine_map<(i, j) -> (i + 1, 2*2*j + 2)> +#map3h = affine_map<(i, j) -> (i + 1, 2*j*2 + 2)> +#map3i = affine_map<(i, j) -> (i + 1, j*2*2 + 2)> +#map3j = affine_map<(i, j) -> (i + 1, j*1*4 + 2)> +#map3k = affine_map<(i, j) -> (i + 1, j*4*1 + 2)> // The following reduction should be unique'd out too but such expression // simplification is not performed for IR parsing, but only through analyses // and transforms. -// CHECK: #map{{[0-9]+}} = (d0, d1) -> (d1 - d0 + (d0 - d1 + 1) * 2 + d1 - 1, d1 + d1 + d1 + d1 + 2) -#map3l = (i, j) -> ((j - i) + 2*(i - j + 1) + j - 1 + 0, j + j + 1 + j + j + 1) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1) -> (d1 - d0 + (d0 - d1 + 1) * 2 + d1 - 1, d1 + d1 + d1 + d1 + 2)> +#map3l = affine_map<(i, j) -> ((j - i) + 2*(i - j + 1) + j - 1 + 0, j + j + 1 + j + j + 1)> -// CHECK: #map{{[0-9]+}} = (d0, d1) -> (d0 + 2, d1) -#map4 = (i, j) -> (3+3-2*2+i, j) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1) -> (d0 + 2, d1)> +#map4 = affine_map<(i, j) -> (3+3-2*2+i, j)> -// CHECK: #map{{[0-9]+}} = (d0, d1)[s0] -> (d0 + s0, d1) -#map5 = (i, j)[s0] -> (i + s0, j) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0 + s0, d1)> +#map5 = affine_map<(i, j)[s0] -> (i + s0, j)> -// CHECK: #map{{[0-9]+}} = (d0, d1)[s0] -> (d0 + s0, d1 + 5) -#map6 = (i, j)[s0] -> (i + s0, j + 5) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0 + s0, d1 + 5)> +#map6 = affine_map<(i, j)[s0] -> (i + s0, j + 5)> -// CHECK: #map{{[0-9]+}} = (d0, d1)[s0] -> (d0 + d1 + s0, d1) -#map7 = (i, j)[s0] -> (i + j + s0, j) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0 + d1 + s0, d1)> +#map7 = affine_map<(i, j)[s0] -> (i + j + s0, j)> -// CHECK: #map{{[0-9]+}} = (d0, d1)[s0] -> (d0 + d1 + s0 + 5, d1) -#map8 = (i, j)[s0] -> (5 + i + j + s0, j) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0 + d1 + s0 + 5, d1)> +#map8 = affine_map<(i, j)[s0] -> (5 + i + j + s0, j)> -// CHECK: #map{{[0-9]+}} = (d0, d1)[s0] -> (d0 + d1 + 5, d1) -#map9 = (i, j)[s0] -> ((i + j) + 5, j) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0 + d1 + 5, d1)> +#map9 = affine_map<(i, j)[s0] -> ((i + j) + 5, j)> -// CHECK: #map{{[0-9]+}} = (d0, d1)[s0] -> (d0 + d1 + 5, d1) -#map10 = (i, j)[s0] -> (i + (j + 5), j) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0 + d1 + 5, d1)> +#map10 = affine_map<(i, j)[s0] -> (i + (j + 5), j)> -// CHECK: #map{{[0-9]+}} = (d0, d1)[s0] -> (d0 * 2, d1 * 3) -#map11 = (i, j)[s0] -> (2*i, 3*j) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0 * 2, d1 * 3)> +#map11 = affine_map<(i, j)[s0] -> (2*i, 3*j)> -// CHECK: #map{{[0-9]+}} = (d0, d1)[s0] -> (d0 + (d1 + s0 * 3) * 5 + 12, d1) -#map12 = (i, j)[s0] -> (i + 2*6 + 5*(j+s0*3), j) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0 + (d1 + s0 * 3) * 5 + 12, d1)> +#map12 = affine_map<(i, j)[s0] -> (i + 2*6 + 5*(j+s0*3), j)> -// CHECK: #map{{[0-9]+}} = (d0, d1)[s0] -> (d0 * 5 + d1, d1) -#map13 = (i, j)[s0] -> (5*i + j, j) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0 * 5 + d1, d1)> +#map13 = affine_map<(i, j)[s0] -> (5*i + j, j)> -// CHECK: #map{{[0-9]+}} = (d0, d1)[s0] -> (d0 + d1, d1) -#map14 = (i, j)[s0] -> ((i + j), (j)) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0 + d1, d1)> +#map14 = affine_map<(i, j)[s0] -> ((i + j), (j))> -// CHECK: #map{{[0-9]+}} = (d0, d1)[s0] -> (d0 + d1 + 7, d1 + 3) -#map15 = (i, j)[s0] -> ((i + j + 2) + 5, (j)+3) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0 + d1 + 7, d1 + 3)> +#map15 = affine_map<(i, j)[s0] -> ((i + j + 2) + 5, (j)+3)> -// CHECK: #map{{[0-9]+}} = (d0, d1)[s0] -> (d0, 0) -#map16 = (i, j)[s1] -> (i, 0) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0, 0)> +#map16 = affine_map<(i, j)[s1] -> (i, 0)> -// CHECK: #map{{[0-9]+}} = (d0, d1)[s0] -> (d0, d1 * s0) -#map17 = (i, j)[s0] -> (i, s0*j) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0, d1 * s0)> +#map17 = affine_map<(i, j)[s0] -> (i, s0*j)> -// CHECK: #map{{[0-9]+}} = (d0, d1) -> (d0, d0 * 3 + d1) -#map19 = (i, j) -> (i, 3*i + j) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1) -> (d0, d0 * 3 + d1)> +#map19 = affine_map<(i, j) -> (i, 3*i + j)> -// CHECK: #map{{[0-9]+}} = (d0, d1) -> (d0, d0 + d1 * 3) -#map20 = (i, j) -> (i, i + 3*j) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1) -> (d0, d0 + d1 * 3)> +#map20 = affine_map<(i, j) -> (i, i + 3*j)> -// CHECK: #map{{[0-9]+}} = (d0, d1)[s0] -> (d0, d0 * ((s0 * s0) * 9) + 3) -#map18 = (i, j)[N] -> (i, 2 + N*N*9*i + 1) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0, d0 * ((s0 * s0) * 9) + 3)> +#map18 = affine_map<(i, j)[N] -> (i, 2 + N*N*9*i + 1)> -// CHECK: #map{{[0-9]+}} = (d0, d1) -> (1, d0 + d1 * 3 + 5) -#map21 = (i, j) -> (1, i + 3*j + 5) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1) -> (1, d0 + d1 * 3 + 5)> +#map21 = affine_map<(i, j) -> (1, i + 3*j + 5)> -// CHECK: #map{{[0-9]+}} = (d0, d1)[s0] -> (s0 * 5, d0 + d1 * 3 + d0 * 5) -#map22 = (i, j)[s0] -> (5*s0, i + 3*j + 5*i) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (s0 * 5, d0 + d1 * 3 + d0 * 5)> +#map22 = affine_map<(i, j)[s0] -> (5*s0, i + 3*j + 5*i)> -// CHECK: #map{{[0-9]+}} = (d0, d1)[s0, s1] -> (d0 * (s0 * s1), d1) -#map23 = (i, j)[s0, s1] -> (i*(s0*s1), j) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0, s1] -> (d0 * (s0 * s1), d1)> +#map23 = affine_map<(i, j)[s0, s1] -> (i*(s0*s1), j)> -// CHECK: #map{{[0-9]+}} = (d0, d1)[s0, s1] -> (d0, d1 mod 5) -#map24 = (i, j)[s0, s1] -> (i, j mod 5) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0, s1] -> (d0, d1 mod 5)> +#map24 = affine_map<(i, j)[s0, s1] -> (i, j mod 5)> -// CHECK: #map{{[0-9]+}} = (d0, d1)[s0, s1] -> (d0, d1 floordiv 5) -#map25 = (i, j)[s0, s1] -> (i, j floordiv 5) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0, s1] -> (d0, d1 floordiv 5)> +#map25 = affine_map<(i, j)[s0, s1] -> (i, j floordiv 5)> -// CHECK: #map{{[0-9]+}} = (d0, d1)[s0, s1] -> (d0, d1 ceildiv 5) -#map26 = (i, j)[s0, s1] -> (i, j ceildiv 5) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0, s1] -> (d0, d1 ceildiv 5)> +#map26 = affine_map<(i, j)[s0, s1] -> (i, j ceildiv 5)> -// CHECK: #map{{[0-9]+}} = (d0, d1)[s0, s1] -> (d0, d0 - d1 - 5) -#map29 = (i, j)[s0, s1] -> (i, i - j - 5) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0, s1] -> (d0, d0 - d1 - 5)> +#map29 = affine_map<(i, j)[s0, s1] -> (i, i - j - 5)> -// CHECK: #map{{[0-9]+}} = (d0, d1)[s0, s1] -> (d0, d0 - d1 * s1 + 2) -#map30 = (i, j)[M, N] -> (i, i - N*j + 2) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0, s1] -> (d0, d0 - d1 * s1 + 2)> +#map30 = affine_map<(i, j)[M, N] -> (i, i - N*j + 2)> -// CHECK: #map{{[0-9]+}} = (d0, d1)[s0, s1] -> (d0 * -5, d1 * -3, -2, -(d0 + d1), -s0) -#map32 = (i, j)[s0, s1] -> (-5*i, -3*j, -2, -1*(i+j), -1*s0) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0, s1] -> (d0 * -5, d1 * -3, -2, -(d0 + d1), -s0)> +#map32 = affine_map<(i, j)[s0, s1] -> (-5*i, -3*j, -2, -1*(i+j), -1*s0)> -// CHECK: #map{{[0-9]+}} = (d0, d1) -> (-4, -d0) -#map33 = (i, j) -> (-2+-5-(-3), -1*i) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1) -> (-4, -d0)> +#map33 = affine_map<(i, j) -> (-2+-5-(-3), -1*i)> -// CHECK: #map{{[0-9]+}} = (d0, d1)[s0, s1] -> (d0, d1 floordiv s0, d1 mod s0) -#map34 = (i, j)[s0, s1] -> (i, j floordiv s0, j mod s0) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0, s1] -> (d0, d1 floordiv s0, d1 mod s0)> +#map34 = affine_map<(i, j)[s0, s1] -> (i, j floordiv s0, j mod s0)> -// CHECK: #map{{[0-9]+}} = (d0, d1, d2)[s0, s1, s2] -> ((d0 * s1) * s2 + d1 * s1 + d2) -#map35 = (i, j, k)[s0, s1, s2] -> (i*s1*s2 + j*s1 + k) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1, d2)[s0, s1, s2] -> ((d0 * s1) * s2 + d1 * s1 + d2)> +#map35 = affine_map<(i, j, k)[s0, s1, s2] -> (i*s1*s2 + j*s1 + k)> // Constant folding. -// CHECK: #map{{[0-9]+}} = (d0, d1) -> (8, 4, 1, 3, 2, 4) -#map36 = (i, j) -> (5+3, 2*2, 8-7, 100 floordiv 32, 5 mod 3, 10 ceildiv 3) -// CHECK: #map{{[0-9]+}} = (d0, d1) -> (4, 11, 512, 15) -#map37 = (i, j) -> (5 mod 3 + 2, 5*3 - 4, 128 * (500 ceildiv 128), 40 floordiv 7 * 3) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1) -> (8, 4, 1, 3, 2, 4)> +#map36 = affine_map<(i, j) -> (5+3, 2*2, 8-7, 100 floordiv 32, 5 mod 3, 10 ceildiv 3)> +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1) -> (4, 11, 512, 15)> +#map37 = affine_map<(i, j) -> (5 mod 3 + 2, 5*3 - 4, 128 * (500 ceildiv 128), 40 floordiv 7 * 3)> -// CHECK: #map{{[0-9]+}} = (d0, d1) -> (d0 * 2 + 1, d1 + 2) -#map38 = (i, j) -> (1 + i*2, 2 + j) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1) -> (d0 * 2 + 1, d1 + 2)> +#map38 = affine_map<(i, j) -> (1 + i*2, 2 + j)> -// CHECK: #map{{[0-9]+}} = (d0, d1)[s0, s1] -> (d0 * s0, d0 + s0, d0 + 2, d1 * 2, s1 * 2, s0 + 2) -#map39 = (i, j)[M, N] -> (i*M, M + i, 2+i, j*2, N*2, 2 + M) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0, s1] -> (d0 * s0, d0 + s0, d0 + 2, d1 * 2, s1 * 2, s0 + 2)> +#map39 = affine_map<(i, j)[M, N] -> (i*M, M + i, 2+i, j*2, N*2, 2 + M)> -// CHECK: #map{{[0-9]+}} = (d0, d1)[s0] -> ((d0 * 5) floordiv 4, (d1 ceildiv 7) mod s0) -#map43 = (i, j) [s0] -> ( i * 5 floordiv 4, j ceildiv 7 mod s0) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> ((d0 * 5) floordiv 4, (d1 ceildiv 7) mod s0)> +#map43 = affine_map<(i, j) [s0] -> ( i * 5 floordiv 4, j ceildiv 7 mod s0)> -// CHECK: #map{{[0-9]+}} = (d0, d1) -> (d0 - d1 * 2, (d1 * 6) floordiv 4) -#map44 = (i, j) -> (i - 2*j, j * 6 floordiv 4) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1) -> (d0 - d1 * 2, (d1 * 6) floordiv 4)> +#map44 = affine_map<(i, j) -> (i - 2*j, j * 6 floordiv 4)> // Simplifications -// CHECK: #map{{[0-9]+}} = (d0, d1, d2)[s0] -> (d0 + d1 + d2 + 1, d2 + d1, (d0 * s0) * 8) -#map45 = (i, j, k) [N] -> (1 + i + 3 + j - 3 + k, k + 5 + j - 5, 2*i*4*N) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1, d2)[s0] -> (d0 + d1 + d2 + 1, d2 + d1, (d0 * s0) * 8)> +#map45 = affine_map<(i, j, k) [N] -> (1 + i + 3 + j - 3 + k, k + 5 + j - 5, 2*i*4*N)> -// CHECK: #map{{[0-9]+}} = (d0, d1, d2) -> (0, d1, d0 * 2, 0) -#map46 = (i, j, k) -> (i*0, 1*j, i * 128 floordiv 64, j * 0 floordiv 64) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1, d2) -> (0, d1, d0 * 2, 0)> +#map46 = affine_map<(i, j, k) -> (i*0, 1*j, i * 128 floordiv 64, j * 0 floordiv 64)> -// CHECK: #map{{[0-9]+}} = (d0, d1, d2) -> (d0, d0 * 4, 0, 0, 0) -#map47 = (i, j, k) -> (i * 64 ceildiv 64, i * 512 ceildiv 128, 4 * j mod 4, 4*j*4 mod 8, k mod 1) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1, d2) -> (d0, d0 * 4, 0, 0, 0)> +#map47 = affine_map<(i, j, k) -> (i * 64 ceildiv 64, i * 512 ceildiv 128, 4 * j mod 4, 4*j*4 mod 8, k mod 1)> // floordiv should resolve similarly to ceildiv and be unique'd out. // CHECK-NOT: #map48{{[a-z]}} -#map48 = (i, j, k) -> (i * 64 floordiv 64, i * 512 floordiv 128, 4 * j mod 4, 4*j*4 mod 8) +#map48 = affine_map<(i, j, k) -> (i * 64 floordiv 64, i * 512 floordiv 128, 4 * j mod 4, 4*j*4 mod 8)> // Simplifications for mod using known GCD's of the LHS expr. -// CHECK: #map{{[0-9]+}} = (d0, d1)[s0] -> (0, 0, 0, 1) -#map49 = (i, j)[s0] -> ( (i * 4 + 8) mod 4, 32 * j * s0 * 8 mod 256, (4*i + (j * (s0 * 2))) mod 2, (4*i + 3) mod 2) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (0, 0, 0, 1)> +#map49 = affine_map<(i, j)[s0] -> ( (i * 4 + 8) mod 4, 32 * j * s0 * 8 mod 256, (4*i + (j * (s0 * 2))) mod 2, (4*i + 3) mod 2)> // Floordiv, ceildiv divide by one. -// CHECK: #map{{[0-9]+}} = (d0, d1)[s0] -> (d0 * 2 + 1, d1 + s0) -#map50 = (i, j)[s0] -> ( (i * 2 + 1) ceildiv 1, (j + s0) floordiv 1) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0 * 2 + 1, d1 + s0)> +#map50 = affine_map<(i, j)[s0] -> ( (i * 2 + 1) ceildiv 1, (j + s0) floordiv 1)> // floordiv, ceildiv, and mod where LHS is negative. -// CHECK: #map{{[0-9]+}} = (d0) -> (-2, 1, -1) -#map51 = (i) -> (-5 floordiv 3, -5 mod 3, -5 ceildiv 3) +// CHECK: #map{{[0-9]+}} = affine_map<(d0) -> (-2, 1, -1)> +#map51 = affine_map<(i) -> (-5 floordiv 3, -5 mod 3, -5 ceildiv 3)> // Parenthesis elision. -// CHECK: #map{{[0-9]+}} = (d0) -> (d0 * 16 - (d0 + 1) + 15) -#map52 = (d0) -> (16*d0 + ((d0 + 1) * -1) + 15) +// CHECK: #map{{[0-9]+}} = affine_map<(d0) -> (d0 * 16 - (d0 + 1) + 15)> +#map52 = affine_map<(d0) -> (16*d0 + ((d0 + 1) * -1) + 15)> -// CHECK: #map{{[0-9]+}} = (d0) -> (d0 - (d0 + 1)) -#map53 = (d0) -> (d0 - (d0 + 1)) +// CHECK: #map{{[0-9]+}} = affine_map<(d0) -> (d0 - (d0 + 1))> +#map53 = affine_map<(d0) -> (d0 - (d0 + 1))> -// CHECK: #map{{[0-9]+}} = (d0)[s0] -> ((-s0) floordiv 4, d0 floordiv -1) -#map54 = (d0)[s0] -> (-s0 floordiv 4, d0 floordiv -1) +// CHECK: #map{{[0-9]+}} = affine_map<(d0)[s0] -> ((-s0) floordiv 4, d0 floordiv -1)> +#map54 = affine_map<(d0)[s0] -> (-s0 floordiv 4, d0 floordiv -1)> -// CHECK: #map{{[0-9]+}} = () -> () -#map55 = () -> () +// CHECK: #map{{[0-9]+}} = affine_map<() -> ()> +#map55 = affine_map<() -> ()> -// CHECK: #map{{[0-9]+}} = (d0, d1) -> (d0, d0 * 2 + d1 * 4 + 2, 1, 2, (d0 * 4) mod 8) -#map56 = (d0, d1) -> ((4*d0 + 2) floordiv 4, (4*d0 + 8*d1 + 5) floordiv 2, (2*d0 + 4*d1 + 3) mod 2, (3*d0 - 4) mod 3, (4*d0 + 8*d1) mod 8) +// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1) -> (d0, d0 * 2 + d1 * 4 + 2, 1, 2, (d0 * 4) mod 8)> +#map56 = affine_map<(d0, d1) -> ((4*d0 + 2) floordiv 4, (4*d0 + 8*d1 + 5) floordiv 2, (2*d0 + 4*d1 + 3) mod 2, (3*d0 - 4) mod 3, (4*d0 + 8*d1) mod 8)> // Single identity maps are removed. // CHECK: func @f0(memref<2x4xi8, 1>) diff --git a/mlir/test/IR/core-ops.mlir b/mlir/test/IR/core-ops.mlir index aac0dfc03a3..3590a28cd16 100644 --- a/mlir/test/IR/core-ops.mlir +++ b/mlir/test/IR/core-ops.mlir @@ -4,26 +4,26 @@ // Verify the generic form can be parsed. // RUN: mlir-opt -mlir-print-op-generic %s | mlir-opt | FileCheck %s -// CHECK: #map0 = (d0) -> (d0 + 1) +// CHECK: #map0 = affine_map<(d0) -> (d0 + 1)> -// CHECK: #map1 = ()[s0] -> (s0 + 1) +// CHECK: #map1 = affine_map<()[s0] -> (s0 + 1)> -// CHECK-DAG: #[[VIEW_MAP1:map[0-9]+]] = (d0, d1) -> (d0 * 4 + d1) -// CHECK-DAG: #[[VIEW_MAP2:map[0-9]+]] = (d0, d1)[s0, s1] -> (d0 * s1 + d1 + s0) -// CHECK-DAG: #[[VIEW_MAP3:map[0-9]+]] = (d0, d1)[s0] -> (d0 * s0 + d1) +// CHECK-DAG: #[[VIEW_MAP1:map[0-9]+]] = affine_map<(d0, d1) -> (d0 * 4 + d1)> +// CHECK-DAG: #[[VIEW_MAP2:map[0-9]+]] = affine_map<(d0, d1)[s0, s1] -> (d0 * s1 + d1 + s0)> +// CHECK-DAG: #[[VIEW_MAP3:map[0-9]+]] = affine_map<(d0, d1)[s0] -> (d0 * s0 + d1)> -// CHECK-DAG: #[[BASE_MAP0:map[0-9]+]] = (d0, d1, d2) -> (d0 * 64 + d1 * 4 + d2) -// CHECK-DAG: #[[BASE_MAP3:map[0-9]+]] = (d0, d1, d2)[s0, s1, s2, s3] -> (d0 * s1 + s0 + d1 * s2 + d2 * s3) -// CHECK-DAG: #[[SUBVIEW_MAP0:map[0-9]+]] = (d0, d1, d2)[s0, s1, s2, s3] -> (d0 * s1 + d1 * s2 + d2 * s3 + s0) +// CHECK-DAG: #[[BASE_MAP0:map[0-9]+]] = affine_map<(d0, d1, d2) -> (d0 * 64 + d1 * 4 + d2)> +// CHECK-DAG: #[[BASE_MAP3:map[0-9]+]] = affine_map<(d0, d1, d2)[s0, s1, s2, s3] -> (d0 * s1 + s0 + d1 * s2 + d2 * s3)> +// CHECK-DAG: #[[SUBVIEW_MAP0:map[0-9]+]] = affine_map<(d0, d1, d2)[s0, s1, s2, s3] -> (d0 * s1 + d1 * s2 + d2 * s3 + s0)> -// CHECK-DAG: #[[BASE_MAP1:map[0-9]+]] = (d0)[s0] -> (d0 + s0) -// CHECK-DAG: #[[SUBVIEW_MAP1:map[0-9]+]] = (d0)[s0, s1] -> (d0 * s1 + s0) +// CHECK-DAG: #[[BASE_MAP1:map[0-9]+]] = affine_map<(d0)[s0] -> (d0 + s0)> +// CHECK-DAG: #[[SUBVIEW_MAP1:map[0-9]+]] = affine_map<(d0)[s0, s1] -> (d0 * s1 + s0)> -// CHECK-DAG: #[[BASE_MAP2:map[0-9]+]] = (d0, d1) -> (d0 * 22 + d1) -// CHECK-DAG: #[[SUBVIEW_MAP2:map[0-9]+]] = (d0, d1)[s0, s1, s2] -> (d0 * s1 + d1 * s2 + s0) -// CHECK-DAG: #[[SUBVIEW_MAP3:map[0-9]+]] = (d0, d1, d2) -> (d0 * 16 + d1 * 4 + d2 + 8) -// CHECK-DAG: #[[SUBVIEW_MAP4:map[0-9]+]] = (d0, d1)[s0, s1, s2] -> (d0 * s1 + s0 + d1 * s2) -// CHECK-DAG: #[[SUBVIEW_MAP5:map[0-9]+]] = (d0, d1)[s0] -> (d0 * 8 + s0 + d1 * 2) +// CHECK-DAG: #[[BASE_MAP2:map[0-9]+]] = affine_map<(d0, d1) -> (d0 * 22 + d1)> +// CHECK-DAG: #[[SUBVIEW_MAP2:map[0-9]+]] = affine_map<(d0, d1)[s0, s1, s2] -> (d0 * s1 + d1 * s2 + s0)> +// CHECK-DAG: #[[SUBVIEW_MAP3:map[0-9]+]] = affine_map<(d0, d1, d2) -> (d0 * 16 + d1 * 4 + d2 + 8)> +// CHECK-DAG: #[[SUBVIEW_MAP4:map[0-9]+]] = affine_map<(d0, d1)[s0, s1, s2] -> (d0 * s1 + s0 + d1 * s2)> +// CHECK-DAG: #[[SUBVIEW_MAP5:map[0-9]+]] = affine_map<(d0, d1)[s0] -> (d0 * 8 + s0 + d1 * 2)> // CHECK-LABEL: func @func_with_ops(%arg0: f32) { func @func_with_ops(f32) { @@ -503,11 +503,11 @@ func @affine_apply() { %j = "std.constant"() {value = 1: index} : () -> index // CHECK: affine.apply #map0(%c0) - %a = "affine.apply" (%i) { map = (d0) -> (d0 + 1) } : + %a = "affine.apply" (%i) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) // CHECK: affine.apply #map1()[%c0] - %b = affine.apply ()[x] -> (x+1)()[%i] + %b = affine.apply affine_map<()[x] -> (x+1)>()[%i] return } @@ -631,27 +631,27 @@ func @memref_view(%arg0 : index, %arg1 : index, %arg2 : index) { // Test two dynamic sizes and dynamic offset. // CHECK: %{{.*}} = std.view %0[%arg2][%arg0, %arg1] : memref<2048xi8> to memref<?x?xf32, #[[VIEW_MAP2]]> %1 = view %0[%arg2][%arg0, %arg1] - : memref<2048xi8> to memref<?x?xf32, (d0, d1)[s0, s1] -> (d0 * s1 + d1 + s0)> + : memref<2048xi8> to memref<?x?xf32, affine_map<(d0, d1)[s0, s1] -> (d0 * s1 + d1 + s0)>> // Test two dynamic sizes and static offset. // CHECK: %{{.*}} = std.view %0[][%arg0, %arg1] : memref<2048xi8> to memref<?x?xf32, #[[VIEW_MAP3]]> %2 = view %0[][%arg0, %arg1] - : memref<2048xi8> to memref<?x?xf32, (d0, d1)[s0] -> (d0 * s0 + d1)> + : memref<2048xi8> to memref<?x?xf32, affine_map<(d0, d1)[s0] -> (d0 * s0 + d1)>> // Test one dynamic size and dynamic offset. // CHECK: %{{.*}} = std.view %0[%arg2][%arg1] : memref<2048xi8> to memref<4x?xf32, #[[VIEW_MAP2]]> %3 = view %0[%arg2][%arg1] - : memref<2048xi8> to memref<4x?xf32, (d0, d1)[s0, s1] -> (d0 * s1 + d1 + s0)> + : memref<2048xi8> to memref<4x?xf32, affine_map<(d0, d1)[s0, s1] -> (d0 * s1 + d1 + s0)>> // Test one dynamic size and static offset. // CHECK: %{{.*}} = std.view %0[][%arg0] : memref<2048xi8> to memref<?x4xf32, #[[VIEW_MAP1]]> %4 = view %0[][%arg0] - : memref<2048xi8> to memref<?x4xf32, (d0, d1) -> (d0 * 4 + d1)> + : memref<2048xi8> to memref<?x4xf32, affine_map<(d0, d1) -> (d0 * 4 + d1)>> // Test static sizes and static offset. // CHECK: %{{.*}} = std.view %0[][] : memref<2048xi8> to memref<64x4xf32, #[[VIEW_MAP1]]> %5 = view %0[][] - : memref<2048xi8> to memref<64x4xf32, (d0, d1) -> (d0 * 4 + d1)> + : memref<2048xi8> to memref<64x4xf32, affine_map<(d0, d1) -> (d0 * 4 + d1)>> return } @@ -660,29 +660,29 @@ func @memref_subview(%arg0 : index, %arg1 : index, %arg2 : index) { %c0 = constant 0 : index %c1 = constant 1 : index - %0 = alloc() : memref<8x16x4xf32, (d0, d1, d2) -> (d0 * 64 + d1 * 4 + d2)> + %0 = alloc() : memref<8x16x4xf32, affine_map<(d0, d1, d2) -> (d0 * 64 + d1 * 4 + d2)>> // CHECK: std.subview %0[%c0, %c0, %c0][%arg0, %arg1, %arg2][%c1, %c1, %c1] : memref<8x16x4xf32, #[[BASE_MAP0]]> to memref<?x?x?xf32, #[[SUBVIEW_MAP0]]> %1 = subview %0[%c0, %c0, %c0][%arg0, %arg1, %arg2][%c1, %c1, %c1] - : memref<8x16x4xf32, (d0, d1, d2) -> (d0 * 64 + d1 * 4 + d2)> to + : memref<8x16x4xf32, affine_map<(d0, d1, d2) -> (d0 * 64 + d1 * 4 + d2)>> to memref<?x?x?xf32, - (d0, d1, d2)[s0, s1, s2, s3] -> (d0 * s1 + d1 * s2 + d2 * s3 + s0)> + affine_map<(d0, d1, d2)[s0, s1, s2, s3] -> (d0 * s1 + d1 * s2 + d2 * s3 + s0)>> - %2 = alloc()[%arg2] : memref<64xf32, (d0)[s0] -> (d0 + s0)> + %2 = alloc()[%arg2] : memref<64xf32, affine_map<(d0)[s0] -> (d0 + s0)>> // CHECK: std.subview %2[%c1][%arg0][%c1] : memref<64xf32, #[[BASE_MAP1]]> to memref<?xf32, #[[SUBVIEW_MAP1]]> %3 = subview %2[%c1][%arg0][%c1] - : memref<64xf32, (d0)[s0] -> (d0 + s0)> to - memref<?xf32, (d0)[s0, s1] -> (d0 * s1 + s0)> + : memref<64xf32, affine_map<(d0)[s0] -> (d0 + s0)>> to + memref<?xf32, affine_map<(d0)[s0, s1] -> (d0 * s1 + s0)>> - %4 = alloc() : memref<64x22xf32, (d0, d1) -> (d0 * 22 + d1)> + %4 = alloc() : memref<64x22xf32, affine_map<(d0, d1) -> (d0 * 22 + d1)>> // CHECK: std.subview %4[%c0, %c1][%arg0, %arg1][%c1, %c0] : memref<64x22xf32, #[[BASE_MAP2]]> to memref<?x?xf32, #[[SUBVIEW_MAP2]]> %5 = subview %4[%c0, %c1][%arg0, %arg1][%c1, %c0] - : memref<64x22xf32, (d0, d1) -> (d0 * 22 + d1)> to - memref<?x?xf32, (d0, d1)[s0, s1, s2] -> (d0 * s1 + d1 * s2 + s0)> + : memref<64x22xf32, affine_map<(d0, d1) -> (d0 * 22 + d1)>> to + memref<?x?xf32, affine_map<(d0, d1)[s0, s1, s2] -> (d0 * s1 + d1 * s2 + s0)>> // CHECK: std.subview %0[][][] : memref<8x16x4xf32, #[[BASE_MAP0]]> to memref<4x4x4xf32, #[[SUBVIEW_MAP3]]> %6 = subview %0[][][] - : memref<8x16x4xf32, (d0, d1, d2) -> (d0 * 64 + d1 * 4 + d2)> to - memref<4x4x4xf32, (d0, d1, d2) -> (d0 * 16 + d1 * 4 + d2 + 8)> + : memref<8x16x4xf32, affine_map<(d0, d1, d2) -> (d0 * 64 + d1 * 4 + d2)>> to + memref<4x4x4xf32, affine_map<(d0, d1, d2) -> (d0 * 16 + d1 * 4 + d2 + 8)>> %7 = alloc(%arg1, %arg2) : memref<?x?xf32> // CHECK: std.subview {{%.*}}[][][] : memref<?x?xf32> to memref<4x4xf32, #[[SUBVIEW_MAP4]]> @@ -704,7 +704,7 @@ func @test_dimop(%arg0: tensor<4x4x?xf32>) { // CHECK: %0 = dim %arg0, 2 : tensor<4x4x?xf32> %0 = dim %arg0, 2 : tensor<4x4x?xf32> // use dim as an index to ensure type correctness - %1 = affine.apply (d0) -> (d0)(%0) + %1 = affine.apply affine_map<(d0) -> (d0)>(%0) return } diff --git a/mlir/test/IR/invalid-affinemap.mlir b/mlir/test/IR/invalid-affinemap.mlir index f13636238e3..741ad9a3dfd 100644 --- a/mlir/test/IR/invalid-affinemap.mlir +++ b/mlir/test/IR/invalid-affinemap.mlir @@ -2,102 +2,102 @@ // Check different error cases. // ----- -#hello_world = (i, j) -> ((), j) // expected-error {{no expression inside parentheses}} +#hello_world = affine_map<(i, j) -> ((), j)> // expected-error {{no expression inside parentheses}} // ----- -#hello_world = (i, j) -> (->, j) // expected-error {{expected affine expression}} +#hello_world = affine_map<(i, j) -> (->, j) // expected-error {{expected affine expression}} // ----- -#hello_world = (i, j) -> (:) // expected-error {{expected affine expression}} +#hello_world = affine_map<(i, j) -> (:) // expected-error {{expected affine expression}} // ----- -#hello_world = (i, j) -> (, j) // expected-error {{expected affine expression}} +#hello_world = affine_map<(i, j) -> (, j)> // expected-error {{expected affine expression}} // ----- -#hello_world (i, j) [s0] -> (i, j) // expected-error {{expected '=' in attribute alias definition}} +#hello_world affine_map<(i, j) [s0] -> (i, j)> // expected-error {{expected '=' in attribute alias definition}} // ----- -#hello_world = (i, j) [s0] -> (2*i*, 3*j*i*2 + 5) // expected-error {{missing right operand of binary op}} +#hello_world = affine_map<(i, j) [s0] -> (2*i*, 3*j*i*2 + 5)> // expected-error {{missing right operand of binary op}} // ----- -#hello_world = (i, j) [s0] -> (i+, i+j+2 + 5) // expected-error {{missing right operand of binary op}} +#hello_world = affine_map<(i, j) [s0] -> (i+, i+j+2 + 5)> // expected-error {{missing right operand of binary op}} // ----- -#hello_world = (i, j) [s0] -> ((s0 + i, j) // expected-error {{expected ')'}} +#hello_world = affine_map<(i, j) [s0] -> ((s0 + i, j)> // expected-error {{expected ')'}} // ----- -#hello_world = (i, j) [s0] -> (((s0 + (i + j) + 5), j) // expected-error {{expected ')'}} +#hello_world = affine_map<(i, j) [s0] -> (((s0 + (i + j) + 5), j)> // expected-error {{expected ')'}} // ----- -#hello_world = (i, j) [s0] -> i + s0, j) // expected-error {{expected '(' at start of affine map range}} +#hello_world = affine_map<(i, j) [s0] -> i + s0, j)> // expected-error {{expected '(' at start of affine map range}} // ----- -#hello_world = (i, j) [s0] -> (x) // expected-error {{use of undeclared identifier}} +#hello_world = affine_map<(i, j) [s0] -> (x)> // expected-error {{use of undeclared identifier}} // ----- -#hello_world = (i, j, i) [s0] -> (i) // expected-error {{redefinition of identifier 'i'}} +#hello_world = affine_map<(i, j, i) [s0] -> (i)> // expected-error {{redefinition of identifier 'i'}} // ----- -#hello_world = (i, j) [s0, s1, s0] -> (i) // expected-error {{redefinition of identifier 's0'}} +#hello_world = affine_map<(i, j) [s0, s1, s0] -> (i)> // expected-error {{redefinition of identifier 's0'}} // ----- -#hello_world = (i, j) [i, s0] -> (j) // expected-error {{redefinition of identifier 'i'}} +#hello_world = affine_map<(i, j) [i, s0] -> (j)> // expected-error {{redefinition of identifier 'i'}} // ----- -#hello_world = (i, j) [s0, s1] -> (+i, j) // expected-error {{missing left operand of binary op}} +#hello_world = affine_map<(i, j) [s0, s1] -> (+i, j)> // expected-error {{missing left operand of binary op}} // ----- -#hello_world = (i, j) [s0, s1] -> (i, *j) // expected-error {{missing left operand of binary op}} +#hello_world = affine_map<(i, j) [s0, s1] -> (i, *j)> // expected-error {{missing left operand of binary op}} // ----- -#hello_world = (i, j) [s0, s1] -> (floordiv i 2, j) // expected-error {{missing left operand of binary op}} +#hello_world = affine_map<(i, j) [s0, s1] -> (floordiv i 2, j)> // expected-error {{missing left operand of binary op}} // ----- -#hello_world = (i, j) [s0, s1] -> (ceildiv i 2, j) // expected-error {{missing left operand of binary op}} +#hello_world = affine_map<(i, j) [s0, s1] -> (ceildiv i 2, j)> // expected-error {{missing left operand of binary op}} // ----- -#hello_world = (i, j) [s0, s1] -> (mod i 2, j) // expected-error {{missing left operand of binary op}} +#hello_world = affine_map<(i, j) [s0, s1] -> (mod i 2, j)> // expected-error {{missing left operand of binary op}} // ----- -#hello_world = (i, j) [s0, s1] -> (-(), j) +#hello_world = affine_map<(i, j) [s0, s1] -> (-(), j)> // expected-error@-1 {{no expression inside parentheses}} // expected-error@-2 {{missing operand of negation}} // ----- -#hello_world = (i, j) [s0, s1] -> (i, *j+5) // expected-error {{missing left operand of binary op}} +#hello_world = affine_map<(i, j) [s0, s1] -> (i, *j+5)> // expected-error {{missing left operand of binary op}} // ----- -#hello_world = (i, j) [s0, s1] -> (i, floordiv j+5) // expected-error {{missing left operand of binary op}} +#hello_world = affine_map<(i, j) [s0, s1] -> (i, floordiv j+5)> // expected-error {{missing left operand of binary op}} // ----- -#hello_world = (i, j) [s0, s1] -> (i, ceildiv j+5) // expected-error {{missing left operand of binary op}} +#hello_world = affine_map<(i, j) [s0, s1] -> (i, ceildiv j+5)> // expected-error {{missing left operand of binary op}} // ----- -#hello_world = (i, j) [s0, s1] -> (i, mod j+5) // expected-error {{missing left operand of binary op}} +#hello_world = affine_map<(i, j) [s0, s1] -> (i, mod j+5)> // expected-error {{missing left operand of binary op}} // ----- -#hello_world = (i, j) [s0, s1] -> (i*j, j) // expected-error {{non-affine expression: at least one of the multiply operands has to be either a constant or symbolic}} +#hello_world = affine_map<(i, j) [s0, s1] -> (i*j, j)> // expected-error {{non-affine expression: at least one of the multiply operands has to be either a constant or symbolic}} // ----- -#hello_world = (i, j) [s0, s1] -> (i, j + j ceildiv 128 mod 16 * i - 4) // expected-error {{non-affine expression: at least one of the multiply operands has to be either a constant or symbolic}} +#hello_world = affine_map<(i, j) [s0, s1] -> (i, j + j ceildiv 128 mod 16 * i - 4)> // expected-error {{non-affine expression: at least one of the multiply operands has to be either a constant or symbolic}} // ----- -#hello_world = (i, j) [s0, s1] -> (i, j floordiv i) // expected-error {{non-affine expression: right operand of floordiv has to be either a constant or symbolic}} +#hello_world = affine_map<(i, j) [s0, s1] -> (i, j floordiv i)> // expected-error {{non-affine expression: right operand of floordiv has to be either a constant or symbolic}} // ----- -#hello_world = (i, j) [s0, s1] -> (i, i*2 ceildiv j*5) // expected-error {{non-affine expression: right operand of ceildiv has to be either a constant or symbolic}} +#hello_world = affine_map<(i, j) [s0, s1] -> (i, i*2 ceildiv j*5)> // expected-error {{non-affine expression: right operand of ceildiv has to be either a constant or symbolic}} // ----- -#hello_world = (i, j) [s0, s1] -> (i, i mod (2+i)) // expected-error {{non-affine expression: right operand of mod has to be either a constant or symbolic}} +#hello_world = affine_map<(i, j) [s0, s1] -> (i, i mod (2+i))> // expected-error {{non-affine expression: right operand of mod has to be either a constant or symbolic}} // ----- -#hello_world = (i, j) [s0, s1] -> (-1*i j, j) // expected-error {{expected ',' or ')'}} +#hello_world = affine_map<(i, j) [s0, s1] -> (-1*i j, j)> // expected-error {{expected ',' or ')'}} // ----- -#hello_world = (i, j) -> (i, 3*d0 + ) // expected-error {{use of undeclared identifier}} +#hello_world = affine_map<(i, j) -> (i, 3*d0 + )> // expected-error {{use of undeclared identifier}} // TODO(bondhugula): Add more tests; coverage of error messages emitted not complete // ----- -#ABC = (i,j) -> (i+j) -#ABC = (i,j) -> (i+j) // expected-error {{redefinition of attribute alias id 'ABC'}} +#ABC = affine_map<(i,j) -> (i+j)> +#ABC = affine_map<(i,j) -> (i+j)> // expected-error {{redefinition of attribute alias id 'ABC'}} diff --git a/mlir/test/IR/invalid-ops.mlir b/mlir/test/IR/invalid-ops.mlir index 67b8d4acb55..d96f646e60a 100644 --- a/mlir/test/IR/invalid-ops.mlir +++ b/mlir/test/IR/invalid-ops.mlir @@ -67,7 +67,7 @@ func @affine_apply_no_map() { func @affine_apply_wrong_operand_count() { ^bb0: %i = constant 0 : index - %x = "affine.apply" (%i) {map = (d0, d1) -> ((d0 + 1), (d1 + 2))} : (index) -> (index) // expected-error {{'affine.apply' op operand count and affine map dimension and symbol count must match}} + %x = "affine.apply" (%i) {map = affine_map<(d0, d1) -> ((d0 + 1), (d1 + 2))>} : (index) -> (index) // expected-error {{'affine.apply' op operand count and affine map dimension and symbol count must match}} return } @@ -77,7 +77,7 @@ func @affine_apply_wrong_result_count() { ^bb0: %i = constant 0 : index %j = constant 1 : index - %x = "affine.apply" (%i, %j) {map = (d0, d1) -> ((d0 + 1), (d1 + 2))} : (index,index) -> (index) // expected-error {{'affine.apply' op mapping must produce one value}} + %x = "affine.apply" (%i, %j) {map = affine_map<(d0, d1) -> ((d0 + 1), (d1 + 2))>} : (index,index) -> (index) // expected-error {{'affine.apply' op mapping must produce one value}} return } @@ -103,7 +103,7 @@ func @bad_alloc_wrong_dynamic_dim_count() { ^bb0: %0 = constant 7 : index // Test alloc with wrong number of dynamic dimensions. - %1 = alloc(%0)[%1] : memref<2x4xf32, (d0, d1)[s0] -> ((d0 + s0), d1), 1> // expected-error {{op 'std.alloc' dimension operand count does not equal memref dynamic dimension count}} + %1 = alloc(%0)[%1] : memref<2x4xf32, affine_map<(d0, d1)[s0] -> ((d0 + s0), d1)>, 1> // expected-error {{op 'std.alloc' dimension operand count does not equal memref dynamic dimension count}} return } @@ -113,7 +113,7 @@ func @bad_alloc_wrong_symbol_count() { ^bb0: %0 = constant 7 : index // Test alloc with wrong number of symbols - %1 = alloc(%0) : memref<2x?xf32, (d0, d1)[s0] -> ((d0 + s0), d1), 1> // expected-error {{operand count does not equal dimension plus symbol operand count}} + %1 = alloc(%0) : memref<2x?xf32, affine_map<(d0, d1)[s0] -> ((d0 + s0), d1)>, 1> // expected-error {{operand count does not equal dimension plus symbol operand count}} return } @@ -121,12 +121,12 @@ func @bad_alloc_wrong_symbol_count() { func @test_store_zero_results() { ^bb0: - %0 = alloc() : memref<1024x64xf32, (d0, d1) -> (d0, d1), 1> + %0 = alloc() : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 1> %1 = constant 0 : index %2 = constant 1 : index - %3 = load %0[%1, %2] : memref<1024x64xf32, (d0, d1) -> (d0, d1), 1> + %3 = load %0[%1, %2] : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 1> // Test that store returns zero results. - %4 = store %3, %0[%1, %2] : memref<1024x64xf32, (d0, d1) -> (d0, d1), 1> // expected-error {{cannot name an operation with no results}} + %4 = store %3, %0[%1, %2] : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 1> // expected-error {{cannot name an operation with no results}} return } @@ -141,7 +141,7 @@ func @test_store_zero_results2(%x: i32, %p: memref<i32>) { func @test_alloc_memref_map_rank_mismatch() { ^bb0: - %0 = alloc() : memref<1024x64xf32, (d0) -> (d0), 1> // expected-error {{memref affine map dimension mismatch}} + %0 = alloc() : memref<1024x64xf32, affine_map<(d0) -> (d0)>, 1> // expected-error {{memref affine map dimension mismatch}} return } @@ -729,7 +729,7 @@ func @invalid_view(%arg0 : index, %arg1 : index, %arg2 : index) { %0 = alloc() : memref<2048xi8> // expected-error@+1 {{incorrect number of operands for type}} %1 = view %0[][%arg0, %arg1] - : memref<2048xi8> to memref<?x?xf32, (d0, d1)[s0] -> (d0 * 4 + d1 + s0)> + : memref<2048xi8> to memref<?x?xf32, affine_map<(d0, d1)[s0] -> (d0 * 4 + d1 + s0)>> return } @@ -739,7 +739,7 @@ func @invalid_view(%arg0 : index, %arg1 : index, %arg2 : index) { %0 = alloc() : memref<2048xi8> // expected-error@+1 {{is not strided}} %1 = view %0[][%arg0, %arg1] - : memref<2048xi8> to memref<?x?xf32, (d0, d1)[s0] -> (d0, d1, s0)> + : memref<2048xi8> to memref<?x?xf32, affine_map<(d0, d1)[s0] -> (d0, d1, s0)>> return } @@ -749,18 +749,18 @@ func @invalid_view(%arg0 : index, %arg1 : index, %arg2 : index) { %0 = alloc() : memref<2048xf32> // expected-error@+1 {{must be 1D memref of 8-bit integer values}} %1 = view %0[][%arg0, %arg1] - : memref<2048xf32> to memref<?x?xf32, (d0, d1)[s0] -> (d0 * 4 + d1 + s0)> + : memref<2048xf32> to memref<?x?xf32, affine_map<(d0, d1)[s0] -> (d0 * 4 + d1 + s0)>> return } // ----- func @invalid_view(%arg0 : index, %arg1 : index, %arg2 : index) { - %0 = alloc() : memref<2048xi8, (d0) -> (d0 floordiv 8, d0 mod 8)> + %0 = alloc() : memref<2048xi8, affine_map<(d0) -> (d0 floordiv 8, d0 mod 8)>> // expected-error@+1 {{unsupported map for base memref}} %1 = view %0[][%arg0, %arg1] - : memref<2048xi8, (d0) -> (d0 floordiv 8, d0 mod 8)> to - memref<?x?xf32, (d0, d1)[s0] -> (d0 * 4 + d1 + s0)> + : memref<2048xi8, affine_map<(d0) -> (d0 floordiv 8, d0 mod 8)>> to + memref<?x?xf32, affine_map<(d0, d1)[s0] -> (d0 * 4 + d1 + s0)>> return } @@ -771,7 +771,7 @@ func @invalid_view(%arg0 : index, %arg1 : index, %arg2 : index) { // expected-error@+1 {{different memory spaces}} %1 = view %0[][%arg0, %arg1] : memref<2048xi8, 2> to - memref<?x?xf32, (d0, d1)[s0] -> (d0 * 4 + d1 + s0), 1> + memref<?x?xf32, affine_map<(d0, d1)[s0] -> (d0 * 4 + d1 + s0)>, 1> return } @@ -782,7 +782,7 @@ func @invalid_view(%arg0 : index, %arg1 : index, %arg2 : index) { // expected-error@+1 {{incorrect dynamic strides}} %1 = view %0[][%arg0, %arg1] : memref<2048xi8> to - memref<?x?x4xf32, (d0, d1, d2) -> (d0 * 777 + d1 * 4 + d2)> + memref<?x?x4xf32, affine_map<(d0, d1, d2) -> (d0 * 777 + d1 * 4 + d2)>> return } @@ -793,7 +793,7 @@ func @invalid_view(%arg0 : index, %arg1 : index, %arg2 : index) { // expected-error@+1 {{incorrect dynamic strides}} %1 = view %0[%arg0][] : memref<2048xi8> to - memref<16x4x?xf32, (d0, d1, d2) -> (d0 * 777 + d1 * 4 + d2)> + memref<16x4x?xf32, affine_map<(d0, d1, d2) -> (d0 * 777 + d1 * 4 + d2)>> return } @@ -804,40 +804,40 @@ func @multiple_offsets(%arg0: index) { // expected-error@+1 {{expects 0 or 1 offset operand}} %1 = view %0[%arg0, %arg0][%arg0] : memref<2048xi8> to - memref<?x?x4xf32, (d0, d1, d2) -> (d0 * 777 + d1 * 4 + d2)> + memref<?x?x4xf32, affine_map<(d0, d1, d2) -> (d0 * 777 + d1 * 4 + d2)>> return } // ----- func @invalid_subview(%arg0 : index, %arg1 : index, %arg2 : index) { - %0 = alloc() : memref<8x16x4xf32, (d0, d1, d2) -> (d0 * 64 + d1 * 4 + d2), 2> + %0 = alloc() : memref<8x16x4xf32, affine_map<(d0, d1, d2) -> (d0 * 64 + d1 * 4 + d2)>, 2> // expected-error@+1 {{different memory spaces}} %1 = subview %0[][%arg2][] - : memref<8x16x4xf32, (d0, d1, d2) -> (d0 * 64 + d1 * 4 + d2), 2> to - memref<8x?x4xf32, (d0, d1, d2)[s0] -> (d0 * s0 + d1 * 4 + d2)> + : memref<8x16x4xf32, affine_map<(d0, d1, d2) -> (d0 * 64 + d1 * 4 + d2)>, 2> to + memref<8x?x4xf32, affine_map<(d0, d1, d2)[s0] -> (d0 * s0 + d1 * 4 + d2)>> return } // ----- func @invalid_subview(%arg0 : index, %arg1 : index, %arg2 : index) { - %0 = alloc() : memref<8x16x4xf32, (d0, d1, d2) -> (d0 * 64 + d1 * 4 + d2)> + %0 = alloc() : memref<8x16x4xf32, affine_map<(d0, d1, d2) -> (d0 * 64 + d1 * 4 + d2)>> // expected-error@+1 {{is not strided}} %1 = subview %0[][%arg2][] - : memref<8x16x4xf32, (d0, d1, d2) -> (d0 * 64 + d1 * 4 + d2)> to - memref<8x?x4xf32, (d0, d1, d2)[s0] -> (d0 + s0, d1, d2)> + : memref<8x16x4xf32, affine_map<(d0, d1, d2) -> (d0 * 64 + d1 * 4 + d2)>> to + memref<8x?x4xf32, affine_map<(d0, d1, d2)[s0] -> (d0 + s0, d1, d2)>> return } // ----- func @invalid_subview(%arg0 : index, %arg1 : index, %arg2 : index) { - %0 = alloc() : memref<8x16x4xf32, (d0, d1, d2) -> (d0 + d1, d1 + d2, d2)> + %0 = alloc() : memref<8x16x4xf32, affine_map<(d0, d1, d2) -> (d0 + d1, d1 + d2, d2)>> // expected-error@+1 {{is not strided}} %1 = subview %0[][%arg2][] - : memref<8x16x4xf32, (d0, d1, d2) -> (d0 + d1, d1 + d2, d2)> to - memref<8x?x4xf32, (d0, d1, d2)[s0] -> (d0 * s0 + d1 * 4 + d2)> + : memref<8x16x4xf32, affine_map<(d0, d1, d2) -> (d0 + d1, d1 + d2, d2)>> to + memref<8x?x4xf32, affine_map<(d0, d1, d2)[s0] -> (d0 * s0 + d1 * 4 + d2)>> return } @@ -966,7 +966,7 @@ func @invalid_subview(%arg0 : index, %arg1 : memref<?x8x?xf32>) { // ----- func @invalid_memref_cast(%arg0 : memref<12x4x16xf32, offset:0, strides:[64, 16, 1]>) { - // expected-error@+1{{operand type 'memref<12x4x16xf32, (d0, d1, d2) -> (d0 * 64 + d1 * 16 + d2)>' and result type 'memref<12x4x16xf32, (d0, d1, d2) -> (d0 * 128 + d1 * 32 + d2 * 2)>' are cast incompatible}} + // expected-error@+1{{operand type 'memref<12x4x16xf32, affine_map<(d0, d1, d2) -> (d0 * 64 + d1 * 16 + d2)>>' and result type 'memref<12x4x16xf32, affine_map<(d0, d1, d2) -> (d0 * 128 + d1 * 32 + d2 * 2)>>' are cast incompatible}} %0 = memref_cast %arg0 : memref<12x4x16xf32, offset:0, strides:[64, 16, 1]> to memref<12x4x16xf32, offset:0, strides:[128, 32, 2]> return } @@ -974,7 +974,7 @@ func @invalid_memref_cast(%arg0 : memref<12x4x16xf32, offset:0, strides:[64, 16, // ----- func @invalid_memref_cast(%arg0 : memref<12x4x16xf32, offset:0, strides:[64, 16, 1]>) { - // expected-error@+1{{operand type 'memref<12x4x16xf32, (d0, d1, d2) -> (d0 * 64 + d1 * 16 + d2)>' and result type 'memref<12x4x16xf32, (d0, d1, d2) -> (d0 * 64 + d1 * 16 + d2 + 16)>' are cast incompatible}} + // expected-error@+1{{operand type 'memref<12x4x16xf32, affine_map<(d0, d1, d2) -> (d0 * 64 + d1 * 16 + d2)>>' and result type 'memref<12x4x16xf32, affine_map<(d0, d1, d2) -> (d0 * 64 + d1 * 16 + d2 + 16)>>' are cast incompatible}} %0 = memref_cast %arg0 : memref<12x4x16xf32, offset:0, strides:[64, 16, 1]> to memref<12x4x16xf32, offset:16, strides:[64, 16, 1]> return } diff --git a/mlir/test/IR/invalid.mlir b/mlir/test/IR/invalid.mlir index d0714d55a26..7d8ee567628 100644 --- a/mlir/test/IR/invalid.mlir +++ b/mlir/test/IR/invalid.mlir @@ -41,19 +41,19 @@ func @memrefs(memref<2x4xi8, i8>) // expected-error {{expected affine map in mem // ----- // Test non-existent map in map composition of memref type. -#map0 = (d0, d1) -> (d0, d1) +#map0 = affine_map<(d0, d1) -> (d0, d1)> func @memrefs(memref<2x4xi8, #map0, #map8>) // expected-error {{undefined symbol alias id 'map8'}} // ----- // Test multiple memory space error. -#map0 = (d0, d1) -> (d0, d1) +#map0 = affine_map<(d0, d1) -> (d0, d1)> func @memrefs(memref<2x4xi8, #map0, 1, 2>) // expected-error {{multiple memory spaces specified in memref type}} // ----- // Test affine map after memory space. -#map0 = (d0, d1) -> (d0, d1) -#map1 = (d0, d1) -> (d0, d1) +#map0 = affine_map<(d0, d1) -> (d0, d1)> +#map1 = affine_map<(d0, d1) -> (d0, d1)> func @memrefs(memref<2x4xi8, #map0, 1, #map1>) // expected-error {{expected memory space to be last in memref type}} @@ -61,13 +61,13 @@ func @memrefs(memref<2x4xi8, #map0, 1, #map1>) // expected-error {{expected memo // Test dimension mismatch between memref and layout map. // The error must be emitted even for the trivial identity layout maps that are // dropped in type creation. -#map0 = (d0, d1) -> (d0, d1) +#map0 = affine_map<(d0, d1) -> (d0, d1)> func @memrefs(memref<42xi8, #map0>) // expected-error {{memref affine map dimension mismatch}} // ----- -#map0 = (d0, d1) -> (d0, d1) -#map1 = (d0) -> (d0) +#map0 = affine_map<(d0, d1) -> (d0, d1)> +#map1 = affine_map<(d0) -> (d0)> func @memrefs(memref<42x42xi8, #map0, #map1>) // expected-error {{memref affine map dimension mismatch}} // ----- @@ -227,7 +227,7 @@ func @incomplete_for() { // ----- -#map0 = (d0) -> (d0 floordiv 4) +#map0 = affine_map<(d0) -> (d0 floordiv 4)> func @reference_to_iv_in_bound() { // expected-error@+2 {{region entry argument '%i0' is already in use}} @@ -257,7 +257,7 @@ func @non_operation() { func @invalid_if_conditional2() { affine.for %i = 1 to 10 { - affine.if (i)[N] : (i >= ) // expected-error {{expected '== 0' or '>= 0' at end of affine constraint}} + affine.if affine_set<(i)[N] : (i >= )> // expected-error {{expected '== 0' or '>= 0' at end of affine constraint}} } } @@ -265,7 +265,7 @@ func @invalid_if_conditional2() { func @invalid_if_conditional3() { affine.for %i = 1 to 10 { - affine.if (i)[N] : (i == 1) // expected-error {{expected '0' after '=='}} + affine.if affine_set<(i)[N] : (i == 1)> // expected-error {{expected '0' after '=='}} } } @@ -273,7 +273,7 @@ func @invalid_if_conditional3() { func @invalid_if_conditional4() { affine.for %i = 1 to 10 { - affine.if (i)[N] : (i >= 2) // expected-error {{expected '0' after '>='}} + affine.if affine_set<(i)[N] : (i >= 2)> // expected-error {{expected '0' after '>='}} } } @@ -281,7 +281,7 @@ func @invalid_if_conditional4() { func @invalid_if_conditional5() { affine.for %i = 1 to 10 { - affine.if (i)[N] : (i <= 0 ) // expected-error {{expected '== 0' or '>= 0' at end of affine constraint}} + affine.if affine_set<(i)[N] : (i <= 0)> // expected-error {{expected '== 0' or '>= 0' at end of affine constraint}} } } @@ -289,7 +289,7 @@ func @invalid_if_conditional5() { func @invalid_if_conditional6() { affine.for %i = 1 to 10 { - affine.if (i) : (i) // expected-error {{expected '== 0' or '>= 0' at end of affine constraint}} + affine.if affine_set<(i) : (i)> // expected-error {{expected '== 0' or '>= 0' at end of affine constraint}} } } @@ -297,13 +297,13 @@ func @invalid_if_conditional6() { // TODO (support affine.if (1)? func @invalid_if_conditional7() { affine.for %i = 1 to 10 { - affine.if (i) : (1) // expected-error {{expected '== 0' or '>= 0' at end of affine constraint}} + affine.if affine_set<(i) : (1)> // expected-error {{expected '== 0' or '>= 0' at end of affine constraint}} } } // ----- -#map = (d0) -> (% // expected-error {{invalid SSA name}} +#map = affine_map<(d0) -> (% // expected-error {{invalid SSA name}} // ----- @@ -524,7 +524,7 @@ func @undefined_function() { // ----- -#map1 = (i)[j] -> (i+j) +#map1 = affine_map<(i)[j] -> (i+j)> func @bound_symbol_mismatch(%N : index) { affine.for %i = #map1(%N) to 100 { @@ -535,7 +535,7 @@ func @bound_symbol_mismatch(%N : index) { // ----- -#map1 = (i)[j] -> (i+j) +#map1 = affine_map<(i)[j] -> (i+j)> func @bound_dim_mismatch(%N : index) { affine.for %i = #map1(%N, %N)[%N] to 100 { @@ -556,7 +556,7 @@ func @large_bound() { // ----- func @max_in_upper_bound(%N : index) { - affine.for %i = 1 to max (i)->(N, 100) { //expected-error {{expected non-function type}} + affine.for %i = 1 to max affine_map<(i)->(N, 100)> { //expected-error {{expected non-function type}} } return } @@ -572,17 +572,17 @@ func @step_typo() { // ----- func @invalid_bound_map(%N : i32) { - affine.for %i = 1 to (i)->(j)(%N) { //expected-error {{use of undeclared identifier}} + affine.for %i = 1 to affine_map<(i)->(j)>(%N) { //expected-error {{use of undeclared identifier}} } return } // ----- -#set0 = (i)[N, M] : )i >= 0) // expected-error {{expected '(' at start of integer set constraint list}} +#set0 = affine_set<(i)[N, M] : )i >= 0)> // expected-error {{expected '(' at start of integer set constraint list}} // ----- -#set0 = (i)[N] : (i >= 0, N - i >= 0) +#set0 = affine_set<(i)[N] : (i >= 0, N - i >= 0)> func @invalid_if_operands1(%N : index) { affine.for %i = 1 to 10 { @@ -590,7 +590,7 @@ func @invalid_if_operands1(%N : index) { // expected-error@-1 {{symbol operand count and integer set symbol count must match}} // ----- -#set0 = (i)[N] : (i >= 0, N - i >= 0) +#set0 = affine_set<(i)[N] : (i >= 0, N - i >= 0)> func @invalid_if_operands2(%N : index) { affine.for %i = 1 to 10 { @@ -598,7 +598,7 @@ func @invalid_if_operands2(%N : index) { // expected-error@-1 {{dim operand count and integer set dim count must match}} // ----- -#set0 = (i)[N] : (i >= 0, N - i >= 0) +#set0 = affine_set<(i)[N] : (i >= 0, N - i >= 0)> func @invalid_if_operands3(%N : index) { affine.for %i = 1 to 10 { @@ -842,7 +842,7 @@ func @invalid_tensor_literal() { func @invalid_affine_structure() { %c0 = constant 0 : index - %idx = affine.apply (d0, d1) (%c0, %c0) // expected-error {{expected '->' or ':'}} + %idx = affine.apply affine_map<(d0, d1)> (%c0, %c0) // expected-error {{expected '->' or ':'}} return } @@ -850,7 +850,7 @@ func @invalid_affine_structure() { func @missing_for_max(%arg0: index, %arg1: index, %arg2: memref<100xf32>) { // expected-error @+1 {{lower loop bound affine map with multiple results requires 'max' prefix}} - affine.for %i0 = ()[s]->(0,s-1)()[%arg0] to %arg1 { + affine.for %i0 = affine_map<()[s]->(0,s-1)>()[%arg0] to %arg1 { } return } @@ -859,7 +859,7 @@ func @missing_for_max(%arg0: index, %arg1: index, %arg2: memref<100xf32>) { func @missing_for_min(%arg0: index, %arg1: index, %arg2: memref<100xf32>) { // expected-error @+1 {{upper loop bound affine map with multiple results requires 'min' prefix}} - affine.for %i0 = %arg0 to ()[s]->(100,s+1)()[%arg1] { + affine.for %i0 = %arg0 to affine_map<()[s]->(100,s+1)>()[%arg1] { } return } diff --git a/mlir/test/IR/locations.mlir b/mlir/test/IR/locations.mlir index 9a2017eec73..b0039dde15e 100644 --- a/mlir/test/IR/locations.mlir +++ b/mlir/test/IR/locations.mlir @@ -1,7 +1,7 @@ // RUN: mlir-opt %s -mlir-print-debuginfo | FileCheck %s // This test verifies that debug locations are round-trippable. -#set0 = (d0) : (1 == 0) +#set0 = affine_set<(d0) : (1 == 0)> // CHECK-LABEL: func @inline_notation func @inline_notation() -> i32 { diff --git a/mlir/test/IR/memory-ops.mlir b/mlir/test/IR/memory-ops.mlir index 24ea180a9cd..c204bed16db 100644 --- a/mlir/test/IR/memory-ops.mlir +++ b/mlir/test/IR/memory-ops.mlir @@ -1,28 +1,28 @@ // RUN: mlir-opt %s | FileCheck %s -// CHECK: #map0 = (d0, d1)[s0] -> (d0 + s0, d1) +// CHECK: #map0 = affine_map<(d0, d1)[s0] -> (d0 + s0, d1)> // CHECK-LABEL: func @alloc() { func @alloc() { ^bb0: // Test simple alloc. // CHECK: %0 = alloc() : memref<1024x64xf32, 1> - %0 = alloc() : memref<1024x64xf32, (d0, d1) -> (d0, d1), 1> + %0 = alloc() : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 1> %c0 = "std.constant"() {value = 0: index} : () -> index %c1 = "std.constant"() {value = 1: index} : () -> index // Test alloc with dynamic dimensions. // CHECK: %1 = alloc(%c0, %c1) : memref<?x?xf32, 1> - %1 = alloc(%c0, %c1) : memref<?x?xf32, (d0, d1) -> (d0, d1), 1> + %1 = alloc(%c0, %c1) : memref<?x?xf32, affine_map<(d0, d1) -> (d0, d1)>, 1> // Test alloc with no dynamic dimensions and one symbol. // CHECK: %2 = alloc()[%c0] : memref<2x4xf32, #map0, 1> - %2 = alloc()[%c0] : memref<2x4xf32, (d0, d1)[s0] -> ((d0 + s0), d1), 1> + %2 = alloc()[%c0] : memref<2x4xf32, affine_map<(d0, d1)[s0] -> ((d0 + s0), d1)>, 1> // Test alloc with dynamic dimensions and one symbol. // CHECK: %3 = alloc(%c1)[%c0] : memref<2x?xf32, #map0, 1> - %3 = alloc(%c1)[%c0] : memref<2x?xf32, (d0, d1)[s0] -> (d0 + s0, d1), 1> + %3 = alloc(%c1)[%c0] : memref<2x?xf32, affine_map<(d0, d1)[s0] -> (d0 + s0, d1)>, 1> // Alloc with no mappings. // b/116054838 Parser crash while parsing ill-formed AllocOp @@ -37,10 +37,10 @@ func @alloc() { func @dealloc() { ^bb0: // CHECK: %0 = alloc() : memref<1024x64xf32> - %0 = alloc() : memref<1024x64xf32, (d0, d1) -> (d0, d1), 0> + %0 = alloc() : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 0> // CHECK: dealloc %0 : memref<1024x64xf32> - dealloc %0 : memref<1024x64xf32, (d0, d1) -> (d0, d1), 0> + dealloc %0 : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 0> return } @@ -48,16 +48,16 @@ func @dealloc() { func @load_store() { ^bb0: // CHECK: %0 = alloc() : memref<1024x64xf32, 1> - %0 = alloc() : memref<1024x64xf32, (d0, d1) -> (d0, d1), 1> + %0 = alloc() : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 1> %1 = constant 0 : index %2 = constant 1 : index // CHECK: %1 = load %0[%c0, %c1] : memref<1024x64xf32, 1> - %3 = load %0[%1, %2] : memref<1024x64xf32, (d0, d1) -> (d0, d1), 1> + %3 = load %0[%1, %2] : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 1> // CHECK: store %1, %0[%c0, %c1] : memref<1024x64xf32, 1> - store %3, %0[%1, %2] : memref<1024x64xf32, (d0, d1) -> (d0, d1), 1> + store %3, %0[%1, %2] : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 1> return } @@ -68,8 +68,8 @@ func @dma_ops() { %stride = constant 32 : index %elt_per_stride = constant 16 : index - %A = alloc() : memref<256 x f32, (d0) -> (d0), 0> - %Ah = alloc() : memref<256 x f32, (d0) -> (d0), 1> + %A = alloc() : memref<256 x f32, affine_map<(d0) -> (d0)>, 0> + %Ah = alloc() : memref<256 x f32, affine_map<(d0) -> (d0)>, 1> %tag = alloc() : memref<1 x f32> %num_elements = constant 256 : index diff --git a/mlir/test/IR/opaque_locations.mlir b/mlir/test/IR/opaque_locations.mlir index 557534d558e..3718d345197 100644 --- a/mlir/test/IR/opaque_locations.mlir +++ b/mlir/test/IR/opaque_locations.mlir @@ -1,7 +1,7 @@ // RUN: mlir-opt %s -test-opaque-loc -mlir-print-debuginfo | FileCheck %s // This test verifies that debug opaque locations can be printed. -#set0 = (d0) : (1 == 0) +#set0 = affine_set<(d0) : (1 == 0)> // CHECK: MyLocation: 0: 'foo' op // CHECK: nullptr: 'foo' op diff --git a/mlir/test/IR/parser.mlir b/mlir/test/IR/parser.mlir index 41e6d5cefcb..c6636b30a02 100644 --- a/mlir/test/IR/parser.mlir +++ b/mlir/test/IR/parser.mlir @@ -1,50 +1,50 @@ // RUN: mlir-opt %s | FileCheck %s -// CHECK-DAG: #map{{[0-9]+}} = (d0, d1, d2, d3, d4)[s0] -> (d0, d1, d2, d4, d3) -#map0 = (d0, d1, d2, d3, d4)[s0] -> (d0, d1, d2, d4, d3) +// CHECK-DAG: #map{{[0-9]+}} = affine_map<(d0, d1, d2, d3, d4)[s0] -> (d0, d1, d2, d4, d3)> +#map0 = affine_map<(d0, d1, d2, d3, d4)[s0] -> (d0, d1, d2, d4, d3)> -// CHECK-DAG: #map{{[0-9]+}} = (d0) -> (d0) -#map1 = (d0) -> (d0) +// CHECK-DAG: #map{{[0-9]+}} = affine_map<(d0) -> (d0)> +#map1 = affine_map<(d0) -> (d0)> -// CHECK-DAG: #map{{[0-9]+}} = (d0, d1, d2) -> (d0, d1, d2) -#map2 = (d0, d1, d2) -> (d0, d1, d2) +// CHECK-DAG: #map{{[0-9]+}} = affine_map<(d0, d1, d2) -> (d0, d1, d2)> +#map2 = affine_map<(d0, d1, d2) -> (d0, d1, d2)> -// CHECK-DAG: #map{{[0-9]+}} = (d0, d1, d2) -> (d1, d0, d2) -#map3 = (d0, d1, d2) -> (d1, d0, d2) +// CHECK-DAG: #map{{[0-9]+}} = affine_map<(d0, d1, d2) -> (d1, d0, d2)> +#map3 = affine_map<(d0, d1, d2) -> (d1, d0, d2)> -// CHECK-DAG: #map{{[0-9]+}} = (d0, d1, d2) -> (d2, d1, d0) -#map4 = (d0, d1, d2) -> (d2, d1, d0) +// CHECK-DAG: #map{{[0-9]+}} = affine_map<(d0, d1, d2) -> (d2, d1, d0)> +#map4 = affine_map<(d0, d1, d2) -> (d2, d1, d0)> -// CHECK-DAG: #map{{[0-9]+}} = ()[s0] -> (0, s0 - 1) -#inline_map_minmax_loop1 = ()[s0] -> (0, s0 - 1) +// CHECK-DAG: #map{{[0-9]+}} = affine_map<()[s0] -> (0, s0 - 1)> +#inline_map_minmax_loop1 = affine_map<()[s0] -> (0, s0 - 1)> -// CHECK-DAG: #map{{[0-9]+}} = ()[s0] -> (100, s0 + 1) -#inline_map_minmax_loop2 = ()[s0] -> (100, s0 + 1) +// CHECK-DAG: #map{{[0-9]+}} = affine_map<()[s0] -> (100, s0 + 1)> +#inline_map_minmax_loop2 = affine_map<()[s0] -> (100, s0 + 1)> -// CHECK-DAG: #map{{[0-9]+}} = (d0, d1)[s0] -> (d0 + d1 + s0) -#bound_map1 = (i, j)[s] -> (i + j + s) +// CHECK-DAG: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0 + d1 + s0)> +#bound_map1 = affine_map<(i, j)[s] -> (i + j + s)> -// CHECK-DAG: #map{{[0-9]+}} = (d0, d1) -> (d0 + d1) -#inline_map_loop_bounds2 = (d0, d1) -> (d0 + d1) +// CHECK-DAG: #map{{[0-9]+}} = affine_map<(d0, d1) -> (d0 + d1)> +#inline_map_loop_bounds2 = affine_map<(d0, d1) -> (d0 + d1)> -// CHECK-DAG: #map{{[0-9]+}} = (d0)[s0] -> (d0 + s0, d0 - s0) -#bound_map2 = (i)[s] -> (i + s, i - s) +// CHECK-DAG: #map{{[0-9]+}} = affine_map<(d0)[s0] -> (d0 + s0, d0 - s0)> +#bound_map2 = affine_map<(i)[s] -> (i + s, i - s)> // All maps appear in arbitrary order before all sets, in arbitrary order. // CHECK-NOT: Placeholder -// CHECK-DAG: #set{{[0-9]+}} = (d0)[s0, s1] : (d0 >= 0, -d0 + s0 >= 0, s0 - 5 == 0, -d0 + s1 + 1 >= 0) -#set0 = (i)[N, M] : (i >= 0, -i + N >= 0, N - 5 == 0, -i + M + 1 >= 0) +// CHECK-DAG: #set{{[0-9]+}} = affine_set<(d0)[s0, s1] : (d0 >= 0, -d0 + s0 >= 0, s0 - 5 == 0, -d0 + s1 + 1 >= 0)> +#set0 = affine_set<(i)[N, M] : (i >= 0, -i + N >= 0, N - 5 == 0, -i + M + 1 >= 0)> -// CHECK-DAG: #set{{[0-9]+}} = (d0, d1)[s0] : (d0 >= 0, d1 >= 0) -#set1 = (d0, d1)[s0] : (d0 >= 0, d1 >= 0) +// CHECK-DAG: #set{{[0-9]+}} = affine_set<(d0, d1)[s0] : (d0 >= 0, d1 >= 0)> +#set1 = affine_set<(d0, d1)[s0] : (d0 >= 0, d1 >= 0)> -// CHECK-DAG: #set{{[0-9]+}} = (d0) : (d0 - 1 == 0) -#set2 = (d0) : (d0 - 1 == 0) +// CHECK-DAG: #set{{[0-9]+}} = affine_set<(d0) : (d0 - 1 == 0)> +#set2 = affine_set<(d0) : (d0 - 1 == 0)> -// CHECK-DAG: [[SET_TRUE:#set[0-9]+]] = () : (0 == 0) +// CHECK-DAG: [[SET_TRUE:#set[0-9]+]] = affine_set<() : (0 == 0)> -// CHECK-DAG: #set{{[0-9]+}} = (d0)[s0] : (d0 - 2 >= 0, -d0 + 4 >= 0) +// CHECK-DAG: #set{{[0-9]+}} = affine_set<(d0)[s0] : (d0 - 2 >= 0, -d0 + 4 >= 0)> // CHECK: func @foo(i32, i64) -> f32 func @foo(i32, i64) -> f32 @@ -86,48 +86,48 @@ func @memrefs234(memref<2x4x8xi8, #map2, #map3, #map4, 3>) // Test memref inline affine map compositions, minding that identity maps are removed. // CHECK: func @memrefs3(memref<2x4x8xi8>) -func @memrefs3(memref<2x4x8xi8, (d0, d1, d2) -> (d0, d1, d2)>) +func @memrefs3(memref<2x4x8xi8, affine_map<(d0, d1, d2) -> (d0, d1, d2)>>) // CHECK: func @memrefs33(memref<2x4x8xi8, #map{{[0-9]+}}, 1>) -func @memrefs33(memref<2x4x8xi8, (d0, d1, d2) -> (d0, d1, d2), (d0, d1, d2) -> (d1, d0, d2), 1>) +func @memrefs33(memref<2x4x8xi8, affine_map<(d0, d1, d2) -> (d0, d1, d2)>, affine_map<(d0, d1, d2) -> (d1, d0, d2)>, 1>) // CHECK: func @memrefs_drop_triv_id_inline(memref<2xi8>) -func @memrefs_drop_triv_id_inline(memref<2xi8, (d0) -> (d0)>) +func @memrefs_drop_triv_id_inline(memref<2xi8, affine_map<(d0) -> (d0)>>) // CHECK: func @memrefs_drop_triv_id_inline0(memref<2xi8>) -func @memrefs_drop_triv_id_inline0(memref<2xi8, (d0) -> (d0), 0>) +func @memrefs_drop_triv_id_inline0(memref<2xi8, affine_map<(d0) -> (d0)>, 0>) // CHECK: func @memrefs_drop_triv_id_inline1(memref<2xi8, 1>) -func @memrefs_drop_triv_id_inline1(memref<2xi8, (d0) -> (d0), 1>) +func @memrefs_drop_triv_id_inline1(memref<2xi8, affine_map<(d0) -> (d0)>, 1>) // Identity maps should be dropped from the composition, but not the pair of // "interchange" maps that, if composed, would be also an identity. // CHECK: func @memrefs_drop_triv_id_composition(memref<2x2xi8, #map{{[0-9]+}}, #map{{[0-9]+}}>) func @memrefs_drop_triv_id_composition(memref<2x2xi8, - (d0, d1) -> (d1, d0), - (d0, d1) -> (d0, d1), - (d0, d1) -> (d1, d0), - (d0, d1) -> (d0, d1), - (d0, d1) -> (d0, d1)>) + affine_map<(d0, d1) -> (d1, d0)>, + affine_map<(d0, d1) -> (d0, d1)>, + affine_map<(d0, d1) -> (d1, d0)>, + affine_map<(d0, d1) -> (d0, d1)>, + affine_map<(d0, d1) -> (d0, d1)>>) // CHECK: func @memrefs_drop_triv_id_trailing(memref<2x2xi8, #map{{[0-9]+}}>) -func @memrefs_drop_triv_id_trailing(memref<2x2xi8, (d0, d1) -> (d1, d0), - (d0, d1) -> (d0, d1)>) +func @memrefs_drop_triv_id_trailing(memref<2x2xi8, affine_map<(d0, d1) -> (d1, d0)>, + affine_map<(d0, d1) -> (d0, d1)>>) // CHECK: func @memrefs_drop_triv_id_middle(memref<2x2xi8, #map{{[0-9]+}}, #map{{[0-9]+}}>) func @memrefs_drop_triv_id_middle(memref<2x2xi8, - (d0, d1) -> (d0, d1 + 1), - (d0, d1) -> (d0, d1), - (d0, d1) -> (d0 + 1, d1)>) + affine_map<(d0, d1) -> (d0, d1 + 1)>, + affine_map<(d0, d1) -> (d0, d1)>, + affine_map<(d0, d1) -> (d0 + 1, d1)>>) // CHECK: func @memrefs_drop_triv_id_multiple(memref<2xi8>) -func @memrefs_drop_triv_id_multiple(memref<2xi8, (d0) -> (d0), (d0) -> (d0)>) +func @memrefs_drop_triv_id_multiple(memref<2xi8, affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>>) // These maps appeared before, so they must be uniqued and hoisted to the beginning. // Identity map should be removed. // CHECK: func @memrefs_compose_with_id(memref<2x2xi8, #map{{[0-9]+}}>) -func @memrefs_compose_with_id(memref<2x2xi8, (d0, d1) -> (d0, d1), - (d0, d1) -> (d1, d0)>) +func @memrefs_compose_with_id(memref<2x2xi8, affine_map<(d0, d1) -> (d0, d1)>, + affine_map<(d0, d1) -> (d1, d0)>>) // CHECK: func @complex_types(complex<i1>) -> complex<f32> @@ -259,7 +259,7 @@ func @complex_loops() { func @triang_loop(%arg0: index, %arg1: memref<?x?xi32>) { %c = constant 0 : i32 // CHECK: %{{.*}} = constant 0 : i32 affine.for %i0 = 1 to %arg0 { // CHECK: affine.for %{{.*}} = 1 to %{{.*}} { - affine.for %i1 = (d0)[]->(d0)(%i0)[] to %arg0 { // CHECK: affine.for %{{.*}} = #map{{[0-9]+}}(%{{.*}}) to %{{.*}} { + affine.for %i1 = affine_map<(d0)[]->(d0)>(%i0)[] to %arg0 { // CHECK: affine.for %{{.*}} = #map{{[0-9]+}}(%{{.*}}) to %{{.*}} { store %c, %arg1[%i0, %i1] : memref<?x?xi32> // CHECK: store %{{.*}}, %{{.*}}[%{{.*}}, %{{.*}}] } // CHECK: } } // CHECK: } @@ -269,7 +269,7 @@ func @triang_loop(%arg0: index, %arg1: memref<?x?xi32>) { // CHECK: func @minmax_loop(%{{.*}}: index, %{{.*}}: index, %{{.*}}: memref<100xf32>) { func @minmax_loop(%arg0: index, %arg1: index, %arg2: memref<100xf32>) { // CHECK: affine.for %{{.*}} = max #map{{.*}}()[%{{.*}}] to min #map{{.*}}()[%{{.*}}] { - affine.for %i0 = max()[s]->(0,s-1)()[%arg0] to min()[s]->(100,s+1)()[%arg1] { + affine.for %i0 = max affine_map<()[s]->(0,s-1)>()[%arg0] to min affine_map<()[s]->(100,s+1)>()[%arg1] { // CHECK: "foo"(%{{.*}}, %{{.*}}) : (memref<100xf32>, index) -> () "foo"(%arg2, %i0) : (memref<100xf32>, index) -> () } // CHECK: } @@ -283,19 +283,19 @@ func @loop_bounds(%N : index) { // CHECK: affine.for %{{.*}} = %{{.*}} to %{{.*}} affine.for %i = %s to %N { // CHECK: affine.for %{{.*}} = #map{{[0-9]+}}(%{{.*}}) to 0 - affine.for %j = (d0)[]->(d0)(%i)[] to 0 step 1 { + affine.for %j = affine_map<(d0)[]->(d0)>(%i)[] to 0 step 1 { // CHECK: %{{.*}} = affine.apply #map{{.*}}(%{{.*}}, %{{.*}})[%{{.*}}] - %w1 = affine.apply(d0, d1)[s0] -> (d0+d1) (%i, %j) [%s] + %w1 = affine.apply affine_map<(d0, d1)[s0] -> (d0+d1)> (%i, %j) [%s] // CHECK: %{{.*}} = affine.apply #map{{.*}}(%{{.*}}, %{{.*}})[%{{.*}}] - %w2 = affine.apply(d0, d1)[s0] -> (s0+1) (%i, %j) [%s] + %w2 = affine.apply affine_map<(d0, d1)[s0] -> (s0+1)> (%i, %j) [%s] // CHECK: affine.for %{{.*}} = #map{{.*}}(%{{.*}}, %{{.*}})[%{{.*}}] to #map{{.*}}(%{{.*}}, %{{.*}})[%{{.*}}] { - affine.for %k = #bound_map1 (%w1, %i)[%N] to (i, j)[s] -> (i + j + s) (%w2, %j)[%s] { + affine.for %k = #bound_map1 (%w1, %i)[%N] to affine_map<(i, j)[s] -> (i + j + s)> (%w2, %j)[%s] { // CHECK: "foo"(%{{.*}}, %{{.*}}, %{{.*}}) : (index, index, index) -> () "foo"(%i, %j, %k) : (index, index, index)->() // CHECK: %{{.*}} = constant 30 : index %c = constant 30 : index // CHECK: %{{.*}} = affine.apply #map{{.*}}(%{{.*}}, %{{.*}}) - %u = affine.apply (d0, d1)->(d0+d1) (%N, %c) + %u = affine.apply affine_map<(d0, d1)->(d0+d1)> (%N, %c) // CHECK: affine.for %{{.*}} = max #map{{.*}}(%{{.*}})[%{{.*}}] to min #map{{.*}}(%{{.*}})[%{{.*}}] { affine.for %l = max #bound_map2(%i)[%u] to min #bound_map2(%k)[%c] { // CHECK: "bar"(%{{.*}}) : (index) -> () @@ -317,11 +317,11 @@ func @ifinst(%N: index) { %y = "add"(%x, %i) : (i32, index) -> i32 // CHECK: %{{.*}} = "add"(%{{.*}}, %{{.*}}) : (i32, index) -> i32 %z = "mul"(%y, %y) : (i32, i32) -> i32 // CHECK: %{{.*}} = "mul"(%{{.*}}, %{{.*}}) : (i32, i32) -> i32 } else { // CHECK } else { - affine.if (i)[N] : (i - 2 >= 0, 4 - i >= 0)(%i)[%N] { // CHECK affine.if (#set1(%{{.*}})[%{{.*}}]) { + affine.if affine_set<(i)[N] : (i - 2 >= 0, 4 - i >= 0)>(%i)[%N] { // CHECK affine.if (#set1(%{{.*}})[%{{.*}}]) { // CHECK: %{{.*}} = constant 1 : index %u = constant 1 : index // CHECK: %{{.*}} = affine.apply #map{{.*}}(%{{.*}}, %{{.*}})[%{{.*}}] - %w = affine.apply (d0,d1)[s0] -> (d0+d1+s0) (%i, %i) [%u] + %w = affine.apply affine_map<(d0,d1)[s0] -> (d0+d1+s0)> (%i, %i) [%u] } else { // CHECK } else { %v = constant 3 : i32 // %c3_i32 = constant 3 : i32 } @@ -356,7 +356,7 @@ func @attributes() { "foo"() {map1 = #map1} : () -> () // CHECK: "foo"() {map2 = #map{{[0-9]+}}} - "foo"() {map2 = (d0, d1, d2) -> (d0, d1, d2)} : () -> () + "foo"() {map2 = affine_map<(d0, d1, d2) -> (d0, d1, d2)>} : () -> () // CHECK: "foo"() {map12 = [#map{{[0-9]+}}, #map{{[0-9]+}}]} "foo"() {map12 = [#map1, #map2]} : () -> () @@ -365,7 +365,7 @@ func @attributes() { "foo"() {set1 = #set1} : () -> () // CHECK: "foo"() {set2 = #set{{[0-9]+}}} - "foo"() {set2 = (d0, d1, d2) : (d0 >= 0, d1 >= 0, d2 - d1 == 0)} : () -> () + "foo"() {set2 = affine_set<(d0, d1, d2) : (d0 >= 0, d1 >= 0, d2 - d1 == 0)>} : () -> () // CHECK: "foo"() {set12 = [#set{{[0-9]+}}, #set{{[0-9]+}}]} "foo"() {set12 = [#set1, #set2]} : () -> () @@ -565,12 +565,12 @@ func @funcattrwithblock() -> () } // CHECK-label func @funcsimplemap -#map_simple0 = ()[] -> (10) -#map_simple1 = ()[s0] -> (s0) -#map_non_simple0 = (d0)[] -> (d0) -#map_non_simple1 = (d0)[s0] -> (d0 + s0) -#map_non_simple2 = ()[s0, s1] -> (s0 + s1) -#map_non_simple3 = ()[s0] -> (s0 + 3) +#map_simple0 = affine_map<()[] -> (10)> +#map_simple1 = affine_map<()[s0] -> (s0)> +#map_non_simple0 = affine_map<(d0)[] -> (d0)> +#map_non_simple1 = affine_map<(d0)[s0] -> (d0 + s0)> +#map_non_simple2 = affine_map<()[s0, s1] -> (s0 + s1)> +#map_non_simple3 = affine_map<()[s0] -> (s0 + 3)> func @funcsimplemap(%arg0: index, %arg1: index) -> () { affine.for %i0 = 0 to #map_simple0()[] { // CHECK: affine.for %{{.*}} = 0 to 10 { @@ -789,7 +789,7 @@ func @type_alias() -> !i32_type_alias { // CHECK-LABEL: func @no_integer_set_constraints( func @no_integer_set_constraints() { // CHECK: affine.if [[SET_TRUE]]() { - affine.if () : () () { + affine.if affine_set<() : ()> () { } return } diff --git a/mlir/test/IR/pretty-locations.mlir b/mlir/test/IR/pretty-locations.mlir index da76ab94c5f..116bfa51233 100644 --- a/mlir/test/IR/pretty-locations.mlir +++ b/mlir/test/IR/pretty-locations.mlir @@ -1,6 +1,6 @@ // RUN: mlir-opt %s -mlir-print-debuginfo -mlir-pretty-debuginfo | FileCheck %s -#set0 = (d0) : (1 == 0) +#set0 = affine_set<(d0) : (1 == 0)> // CHECK-LABEL: func @inline_notation func @inline_notation() -> i32 { diff --git a/mlir/test/IR/print-op-local-scope.mlir b/mlir/test/IR/print-op-local-scope.mlir index 8fef248f4f1..b6f36052d70 100644 --- a/mlir/test/IR/print-op-local-scope.mlir +++ b/mlir/test/IR/print-op-local-scope.mlir @@ -1,5 +1,5 @@ // RUN: mlir-opt %s -mlir-print-local-scope | FileCheck %s --dump-input-on-failure -// CHECK: "foo.op"() : () -> memref<?xf32, (d0) -> (d0 * 2)> -"foo.op"() : () -> (memref<?xf32, (d0) -> (2*d0)>) +// CHECK: "foo.op"() : () -> memref<?xf32, affine_map<(d0) -> (d0 * 2)>> +"foo.op"() : () -> (memref<?xf32, affine_map<(d0) -> (2*d0)>>) |