diff --git a/test/canonicalization.mlir b/test/canonicalization.mlir index 1ddac707..c8dbb9b9 100644 --- a/test/canonicalization.mlir +++ b/test/canonicalization.mlir @@ -14,7 +14,7 @@ func @deduplicate_map_input(%arg0: f32) { // CHECK: ^bb0(%[[V1:.*]]: f32): ^bb0(%arg1: f32, %arg2: f32): // CHECK: addf %[[V1]], %[[V1]] : f32 - %1 = addf %arg1, %arg2 : f32 + %1 = arith.addf %arg1, %arg2 : f32 call @use(%1) : (f32) -> () sair.return // CHECK: } : #sair.shape<()>, (f32) -> () @@ -39,7 +39,7 @@ func @deduplicate_map_input_instances(%arg0: f32) { ] } { ^bb0(%arg1: f32, %arg2: f32): - %1 = addf %arg1, %arg2 : f32 + %1 = arith.addf %arg1, %arg2 : f32 call @use(%1) : (f32) -> () sair.return } : #sair.shape<()>, (f32, f32) -> () @@ -54,8 +54,8 @@ func @deduplicate_map_output() { // CHECK: %[[V0:.*]] = sair.map %0, %1 = sair.map { ^bb0: - // CHECK: %[[V1:.*]] = constant - %2 = constant 1.0 : f32 + // CHECK: %[[V1:.*]] = arith.constant + %2 = arith.constant 1.0 : f32 // CHECK: sair.return %[[V1]] : f32 sair.return %2, %2 : f32, f32 // CHECK: #sair.shape<()>, () -> f32 @@ -68,7 +68,7 @@ func @deduplicate_map_output() { // CHECK-LABEL: @fold_empty_proj func @fold_empty_proj(%arg0: f32) { - %n = constant 8 : index + %n = arith.constant 8 : index %0 = sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> %1 = sair.from_scalar %arg0 : !sair.value<(), f32> @@ -86,7 +86,7 @@ func @fold_empty_proj(%arg0: f32) { // CHECK-LABEL: @fold_empty_fby func @fold_empty_fby(%arg0: f32) { - %n = constant 8 : index + %n = arith.constant 8 : index %0 = sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> %1 = sair.from_scalar %arg0 : !sair.value<(), f32> @@ -104,7 +104,7 @@ func @fold_empty_fby(%arg0: f32) { // CHECK-LABEL: @merge_proj func @merge_proj(%arg0: f32) { - %n = constant 8 : index + %n = arith.constant 8 : index %0 = sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> %1 = sair.from_scalar %arg0 : !sair.value<(), f32> @@ -124,7 +124,7 @@ func @merge_proj(%arg0: f32) { // CHECK-LABEL: @remove_cyclic_fby func @remove_cyclic_fby(%arg0: f32, %arg1: memref) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> %0 = sair.from_scalar %arg0 : !sair.value<(), f32> @@ -145,7 +145,7 @@ func @remove_cyclic_fby(%arg0: f32, %arg1: memref) { // CHECK-LABEL: @remove_useless_dims_fby func @remove_useless_dims_fby(%arg0: f32) { - %n = constant 8 : index + %n = arith.constant 8 : index %0 = sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> %0 = sair.from_scalar %arg0 : !sair.value<(), f32> @@ -167,7 +167,7 @@ func @remove_useless_dims_fby(%arg0: f32) { // CHECK-LABEL: @remove_useless_dims_proj func @remove_useless_dims_proj(%arg0: f32) { - %n = constant 8 : index + %n = arith.constant 8 : index %0 = sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> %0 = sair.from_scalar %arg0 : !sair.value<(), f32> @@ -189,7 +189,7 @@ func @remove_useless_dims_proj(%arg0: f32) { // CHECK-LABEL: @remove_useless_dims_proj_dependent func @remove_useless_dims_proj_dependent(%arg0: f32, %arg1: index) { - %n = constant 8 : index + %n = arith.constant 8 : index %0 = sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> %0 = sair.from_scalar %arg0 : !sair.value<(), f32> @@ -217,7 +217,7 @@ func @remove_useless_dims_proj_dependent(%arg0: f32, %arg1: index) { // CHECK-LABEL: @mappings func @mappings(%arg0: f32) { - %n = constant 8 : index + %n = arith.constant 8 : index %0 = sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> %0 = sair.from_scalar %arg0 : !sair.value<(), f32> diff --git a/test/default_expansion.mlir b/test/default_expansion.mlir index 54db9ad0..32e7859a 100644 --- a/test/default_expansion.mlir +++ b/test/default_expansion.mlir @@ -7,7 +7,7 @@ func @map() { // CHECK-SAME: expansion = "map" %0 = sair.map attributes {instances = [{}]} { ^bb0: - %c0 = constant 1.0 : f32 + %c0 = arith.constant 1.0 : f32 sair.return %c0 : f32 } : #sair.shape<()>, () -> (f32) sair.exit diff --git a/test/default_storage.mlir b/test/default_storage.mlir index 85101330..492091e1 100644 --- a/test/default_storage.mlir +++ b/test/default_storage.mlir @@ -7,7 +7,7 @@ func @memory_space_is_set() { // CHECK: storage = [{layout = #sair.named_mapping<[] -> ()>, space = "register"}] %0 = sair.map attributes {instances = [{loop_nest = []}]} { ^bb0: - %c1 = constant 1.0 : f32 + %c1 = arith.constant 1.0 : f32 sair.return %c1 : f32 } : #sair.shape<()>, () -> f32 sair.exit @@ -27,7 +27,7 @@ func @preserve_memory_space() { }] } { ^bb0: - %c1 = constant 1.0 : f32 + %c1 = arith.constant 1.0 : f32 sair.return %c1 : f32 } : #sair.shape<()>, () -> f32 sair.exit @@ -37,7 +37,7 @@ func @preserve_memory_space() { // CHECK-LABEL: @multi_dim func @multi_dim(%arg0: f32, %arg1: memref<8x8xf32>) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> %0 = sair.dyn_range %sn : !sair.dyn_range @@ -80,7 +80,7 @@ func @multi_dim(%arg0: f32, %arg1: memref<8x8xf32>) { // CHECK-LABEL: @to_memref_proj_fby func @to_memref_proj_fby(%arg0: f32, %arg1: memref) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> %0 = sair.dyn_range %sn : !sair.dyn_range @@ -117,7 +117,7 @@ func @to_memref_proj_fby(%arg0: f32, %arg1: memref) { // CHECK-LABEL: @propagate_storage func @propagate_storage(%arg0: f32) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> %0 = sair.from_scalar %arg0 : !sair.value<(), f32> @@ -137,7 +137,7 @@ func @propagate_storage(%arg0: f32) { // CHECK-LABEL: @non_rectangular func @non_rectangular_shape(%arg0: f32, %arg1: index) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> %0 = sair.from_scalar %arg0 : !sair.value<(), f32> @@ -171,7 +171,7 @@ func @non_rectangular_shape(%arg0: f32, %arg1: index) { // CHECK-LABEL: @buffer_reuse func @buffer_reuse(%arg0: f32) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> %0 = sair.from_scalar %arg0 : !sair.value<(), f32> diff --git a/test/default_storage_invalid.mlir b/test/default_storage_invalid.mlir index 11580fc4..0ed9e44f 100644 --- a/test/default_storage_invalid.mlir +++ b/test/default_storage_invalid.mlir @@ -68,7 +68,7 @@ func @non_rectangular_shape(%arg0: f32, %arg1: index) { // ----- func @incomplete_loop_nest(%arg0: memref<4xf32>, %arg1: index) { - %c = constant 42.0 : f32 + %c = arith.constant 42.0 : f32 sair.program { %n = sair.from_scalar %arg1 : !sair.value<(), index> %r = sair.dyn_range %n : !sair.dyn_range diff --git a/test/from_linalg.mlir b/test/from_linalg.mlir index f4fdce71..59d6bc44 100644 --- a/test/from_linalg.mlir +++ b/test/from_linalg.mlir @@ -38,7 +38,7 @@ func @pointwise(%arg0: memref<1x2x3xf32>, %arg1: memref<2x3x1xf32>) { outs(%arg1 : memref<2x3x1xf32>) { // CHECK: ^{{.*}}(%{{.*}}: index, %{{.*}}: index, %{{.*}}: index, %{{.*}}: f32, %{{.*}}: f32): ^bb(%a0: f32, %a1: f32): - %1 = addf %a0, %a1 : f32 + %1 = arith.addf %a0, %a1 : f32 // CHECK: sair.return %{{.*}} f32 linalg.yield %1 : f32 // CHECK: #sair.shape x d1:static_range<3> x d2:static_range<2>>, (f32, f32) -> f32 @@ -89,7 +89,7 @@ func @dynamic(%arg0: memref, %arg1: memref<2x?x?xf32>) { ins(%arg0 : memref) outs(%arg1 : memref<2x?x?xf32>) { ^bb(%a0: f32, %a1: f32): - %1 = addf %a0, %a1 : f32 + %1 = arith.addf %a0, %a1 : f32 linalg.yield %1 : f32 } @@ -139,8 +139,8 @@ func @reductions(%arg0: memref<2x3x4x5x6xf32>, %arg1: memref<2x4x6xf32>) { // Expecting the operands to be swapped because of block argument // reordering that places the partial reduction first to comply with Sair // conventions. - // CHECK: %[[v0:.*]] = addf %[[reduce]], %[[arg]] - %0 = addf %a1, %a0 : f32 + // CHECK: %[[v0:.*]] = arith.addf %[[reduce]], %[[arg]] + %0 = arith.addf %a1, %a0 : f32 // CHECK: sair.return %[[v0]] linalg.yield %0 : f32 // CHECK: } : #sair.shape x d1:static_range<4> x @@ -164,12 +164,12 @@ func @indices(%arg0: memref<1x2x3xf32>, %arg1: memref<2x3x1xf32>) { %0 = linalg.index 0 : index %1 = linalg.index 2 : index %2 = linalg.index 1 : index - // CHECK: = addi %[[I0]], %[[I2]] - // CHECK: = addi %{{.*}}, %[[I1]] - %3 = addi %0, %1 : index - %4 = addi %3, %2 : index - %5 = index_cast %4 : index to i32 - %6 = sitofp %5 : i32 to f32 + // CHECK: = arith.addi %[[I0]], %[[I2]] + // CHECK: = arith.addi %{{.*}}, %[[I1]] + %3 = arith.addi %0, %1 : index + %4 = arith.addi %3, %2 : index + %5 = arith.index_cast %4 : index to i32 + %6 = arith.sitofp %5 : i32 to f32 linalg.yield %6 : f32 } return diff --git a/test/from_linalg_invalid.mlir b/test/from_linalg_invalid.mlir index 2d261326..7f20f347 100644 --- a/test/from_linalg_invalid.mlir +++ b/test/from_linalg_invalid.mlir @@ -16,7 +16,7 @@ func @reductions(%arg0: memref<2x3x4x5x6xf32>, %arg1: memref<2x4x6xf32>) { ins(%arg0 : memref<2x3x4x5x6xf32>) outs(%arg1 : memref<2x4x6xf32>) { ^bb0(%a0: f32, %a1: f32): - %0 = addf %a1, %a0 : f32 + %0 = arith.addf %a1, %a0 : f32 linalg.yield %0 : f32 } @@ -39,7 +39,7 @@ func @shape_mismatch(%arg0: memref, %arg1: memref<2xf32>) { ins(%arg0 : memref) outs(%arg1 : memref<2xf32>) { ^bb(%a0: f32, %a1: f32): - %1 = addf %a0, %a1 : f32 + %1 = arith.addf %a0, %a1 : f32 linalg.yield %1 : f32 } return diff --git a/test/inline_trivial_sair_ops.mlir b/test/inline_trivial_sair_ops.mlir index aa169190..67500359 100644 --- a/test/inline_trivial_sair_ops.mlir +++ b/test/inline_trivial_sair_ops.mlir @@ -2,8 +2,8 @@ // CHECK-LABEL: @one_map func @one_map() -> f32 { - // CHECK: %[[v0:.*]] = constant 1.0 - %0 = constant 1.0 : f32 + // CHECK: %[[v0:.*]] = arith.constant 1.0 + %0 = arith.constant 1.0 : f32 // CHECK-NOT: sair.program %1 = sair.program { // CHECK-NOT: from_scalar @@ -11,8 +11,8 @@ func @one_map() -> f32 { // CHECK-NOT: sair.map %3 = sair.map %2 { ^bb0(%arg0: f32): - // CHECK: %[[v3:.*]] = addf %[[v0]], %[[v0]] - %4 = addf %arg0, %arg0 : f32 + // CHECK: %[[v3:.*]] = arith.addf %[[v0]], %[[v0]] + %4 = arith.addf %arg0, %arg0 : f32 // CHECK-NOT: sair.return sair.return %4 : f32 } : #sair.shape<()>, (f32) -> f32 @@ -25,8 +25,8 @@ func @one_map() -> f32 { // CHECK-LABEL: @sequence func @sequence() -> f32 { - // CHECK: %[[v0:.*]] = constant 1.0 - %0 = constant 1.0 : f32 + // CHECK: %[[v0:.*]] = arith.constant 1.0 + %0 = arith.constant 1.0 : f32 // CHECK-NOT: sair.program %6 = sair.program { // CHECK-NOT: from_scalar @@ -34,8 +34,8 @@ func @sequence() -> f32 { // CHECK-NOT: sair.map %2 = sair.map %1 { ^bb0(%arg0: f32): - // CHECK: %[[v3:.*]] = addf %[[v0]], %[[v0]] - %3 = addf %arg0, %arg0 : f32 + // CHECK: %[[v3:.*]] = arith.addf %[[v0]], %[[v0]] + %3 = arith.addf %arg0, %arg0 : f32 // CHECK-NOT: sair.return sair.return %3 : f32 } : #sair.shape<()>, (f32) -> f32 @@ -48,7 +48,7 @@ func @sequence() -> f32 { // CHECK-LABEL: @do_nothing func @do_nothing() { - %0 = constant 1.0 : f32 + %0 = arith.constant 1.0 : f32 sair.program { %1 = sair.static_range : !sair.static_range<8> %2 = sair.from_scalar %0 : !sair.value<(), f32> diff --git a/test/integration/sair_to_llvm.mlir b/test/integration/sair_to_llvm.mlir index 4f189315..278c9a6c 100644 --- a/test/integration/sair_to_llvm.mlir +++ b/test/integration/sair_to_llvm.mlir @@ -7,23 +7,23 @@ // Helper function that returns 1.0 if the two memrefs are equal and 0.0 // otherwise. func @check_memrefs_equal(%lhs: memref<8xi32>, %rhs: memref<8xi32>) -> f32 { - %c0 = constant 0 : index - %c1 = constant 1 : index - %c8 = constant 8 : index - %c0f = constant 0.0 : f32 - %c1f = constant 1.0 : f32 + %c0 = arith.constant 0 : index + %c1 = arith.constant 1 : index + %c8 = arith.constant 8 : index + %c0f = arith.constant 0.0 : f32 + %c1f = arith.constant 1.0 : f32 br ^bb0(%c0 : index) // Loop on the memrefs. ^bb0(%0: index): - %1 = cmpi slt, %0, %c8 : index + %1 = arith.cmpi slt, %0, %c8 : index // Return 1.0 if we reached the end without error. cond_br %1, ^bb1(%0 : index), ^bb2(%c1f : f32) ^bb1(%2: index): %4 = memref.load %lhs[%2] : memref<8xi32> %5 = memref.load %rhs[%2] : memref<8xi32> - %3 = addi %2, %c1 : index - %6 = cmpi eq, %4, %5 : i32 + %3 = arith.addi %2, %c1 : index + %6 = arith.cmpi eq, %4, %5 : i32 // Returns 0.0 if we found an error. cond_br %6, ^bb0(%3 : index), ^bb2(%c0f : f32) @@ -32,7 +32,7 @@ func @check_memrefs_equal(%lhs: memref<8xi32>, %rhs: memref<8xi32>) -> f32 { } func @from_scalar() -> f32 { - %0 = constant 1.0 : f32 + %0 = arith.constant 1.0 : f32 %2 = sair.program { %1 = sair.from_scalar %0 : !sair.value<(), f32> sair.exit %1 : f32 @@ -41,16 +41,16 @@ func @from_scalar() -> f32 { } func @from_to_memref() -> f32 { - %c0 = constant 0 : index - %c1 = constant 1 : index - %c8 = constant 8 : index + %c0 = arith.constant 0 : index + %c1 = arith.constant 1 : index + %c8 = arith.constant 8 : index // Create two memrefs such that %0[i] = 2*%1[i]. %0 = memref.alloca() : memref<8xi32> %1 = memref.alloca() : memref<8xi32> scf.for %i = %c0 to %c8 step %c1 { - %2 = index_cast %i : index to i32 - %3 = addi %2, %2 : i32 + %2 = arith.index_cast %i : index to i32 + %3 = arith.addi %2, %2 : i32 memref.store %2, %0[%i] : memref<8xi32> memref.store %3, %1[%i] : memref<8xi32> } @@ -64,7 +64,7 @@ func @from_to_memref() -> f32 { } : #sair.shape>, memref<8xi32> %4 = sair.map[d0:%2] %3(d0) { ^bb0(%arg0: index, %arg1: i32): - %5 = addi %arg1, %arg1 : i32 + %5 = arith.addi %arg1, %arg1 : i32 sair.return %5 : i32 } : #sair.shape>, (i32) -> i32 sair.to_memref %6 memref[d0:%2] %4(d0) { diff --git a/test/integration/sair_to_loop.mlir b/test/integration/sair_to_loop.mlir index a165d7b6..1f3f605f 100644 --- a/test/integration/sair_to_loop.mlir +++ b/test/integration/sair_to_loop.mlir @@ -16,9 +16,9 @@ func @empty_program() { func @copy_to_memref(%arg0: memref<8xf32>, %arg1: memref<8xf32>) { // CHECK-NOT: sair.program sair.program { - // CHECK-DAG: %[[C0:.*]] = constant 0 : index - // CHECK-DAG: %[[C1:.*]] = constant 1 : index - // CHECK-DAG: %[[C8:.*]] = constant 8 : index + // CHECK-DAG: %[[C0:.*]] = arith.constant 0 : index + // CHECK-DAG: %[[C1:.*]] = arith.constant 1 : index + // CHECK-DAG: %[[C8:.*]] = arith.constant 8 : index // CHECK: scf.for %[[V0:.*]] = %[[C0]] to %[[C8]] step %[[C1]] { %0 = sair.static_range : !sair.static_range<8> %1 = sair.from_scalar %arg0 : !sair.value<(), memref<8xf32>> @@ -44,11 +44,11 @@ func @copy_to_memref(%arg0: memref<8xf32>, %arg1: memref<8xf32>) { func @matmul(%arg0: memref<8x8xf32>, %arg1: memref<8x8xf32>, %arg2: memref<8x8xf32>) { - // CHECK-DAG: %[[CF0:.*]] = constant 0.0 - // CHECK-DAG: %[[C0:.*]] = constant 0 : index - // CHECK-DAG: %[[C1:.*]] = constant 1 : index - // CHECK-DAG: %[[C8:.*]] = constant 8 : index - %C0 = constant 0.0 : f32 + // CHECK-DAG: %[[CF0:.*]] = arith.constant 0.0 + // CHECK-DAG: %[[C0:.*]] = arith.constant 0 : index + // CHECK-DAG: %[[C1:.*]] = arith.constant 1 : index + // CHECK-DAG: %[[C8:.*]] = arith.constant 8 : index + %C0 = arith.constant 0.0 : f32 // CHECK-NOT: sair.program sair.program { %0 = sair.from_scalar %arg0 : !sair.value<(), memref<8x8xf32>> @@ -84,8 +84,8 @@ func @matmul(%arg0: memref<8x8xf32>, // CHECK-DAG: %[[V0:.*]] = memref.load %[[C]][%[[I]], %[[J]]] : memref<8x8xf32> // CHECK-DAG: %[[V1:.*]] = memref.load %[[A]][%[[I]], %[[K]]] : memref<8x8xf32> // CHECK-DAG: %[[V2:.*]] = memref.load %[[B]][%[[J]], %[[K]]] : memref<8x8xf32> - // CHECK: %[[V3:.*]] = mulf %[[V1]], %[[V2]] : f32 - // CHECK: %[[V4:.*]] = addf %[[V0]], %[[V3]] : f32 + // CHECK: %[[V3:.*]] = arith.mulf %[[V1]], %[[V2]] : f32 + // CHECK: %[[V4:.*]] = arith.addf %[[V0]], %[[V3]] : f32 // CHECK: memref.store %[[V4]], %[[C]][%[[I]], %[[J]]] : memref<8x8xf32> %9 = sair.map[d0:%3, d1:%3, d2:%3] %8(d0, d1, d2), %4(d0, d2), %5(d1, d2) attributes { instances = [{ @@ -101,8 +101,8 @@ func @matmul(%arg0: memref<8x8xf32>, }] } { ^bb0(%i: index, %j: index, %k : index, %c0: f32, %a: f32, %b: f32): - %c1 = mulf %a, %b : f32 - %c2 = addf %c0, %c1 : f32 + %c1 = arith.mulf %a, %b : f32 + %c2 = arith.addf %c0, %c1 : f32 sair.return %c2 : f32 } : #sair.shape x d1:static_range<8> x d2:static_range<8>>, (f32, f32, f32) -> (f32) diff --git a/test/introduce_loops.mlir b/test/introduce_loops.mlir index cb617efa..b20a7ed0 100644 --- a/test/introduce_loops.mlir +++ b/test/introduce_loops.mlir @@ -22,12 +22,12 @@ func @map(%arg0: index) { } { // CHECK: ^{{.*}}(%[[ARG1:.*]]: index): ^bb0(%arg1: index, %arg2: index): - // CHECK-DAG: %[[C0:.*]] = constant 0 : index - // CHECK-DAG: %[[C1:.*]] = constant 1 : index - // CHECK-DAG: %[[C8:.*]] = constant 8 : index + // CHECK-DAG: %[[C0:.*]] = arith.constant 0 : index + // CHECK-DAG: %[[C1:.*]] = arith.constant 1 : index + // CHECK-DAG: %[[C8:.*]] = arith.constant 8 : index // CHECK: scf.for %[[V1:.*]] = %[[C0]] to %[[C8]] step %[[C1]] { - // CHECK-DAG: %[[C2:.*]] = constant 0 : index - // CHECK-DAG: %[[C3:.*]] = constant 1 : index + // CHECK-DAG: %[[C2:.*]] = arith.constant 0 : index + // CHECK-DAG: %[[C3:.*]] = arith.constant 1 : index // CHECK: scf.for %[[V2:.*]] = %[[C2]] to %[[ARG1]] step %[[C3]] { // CHECK: call @foo(%[[V2]], %[[V1]]) : (index, index) -> () call @foo(%arg1, %arg2) : (index, index) -> () @@ -114,8 +114,8 @@ func @fuse(%arg0: f32) { // CHECK: scf.for %[[I1:.*]] = %{{.*}} to %{{.*}} // CHECK: call @foo(%[[I0]], %[[I1]]) call @foo(%arg1, %arg2) : (index, index) -> () - // CHECK: %[[V1:.*]] = constant - %4 = constant 1.0 : f32 + // CHECK: %[[V1:.*]] = arith.constant + %4 = arith.constant 1.0 : f32 sair.return %4 : f32 } : #sair.shape x d1:static_range<8>>, () -> (f32) // CHECK-NOT: sair.map @@ -179,8 +179,8 @@ func @fuse_reorder(%arg0: f32) { } { ^bb0(%arg1: index, %arg2: index, %arg3: f32): call @foo(%arg1, %arg2) : (index, index) -> () - %4 = constant 1.0 : f32 - %5 = addf %arg3, %4 : f32 + %4 = arith.constant 1.0 : f32 + %5 = arith.addf %arg3, %4 : f32 sair.return %5 : f32 } : #sair.shape x d1:static_range<16>>, (f32) -> (f32) %6 = sair.map[d0:%0, d1:%1] %2 attributes { @@ -206,8 +206,8 @@ func @fuse_reorder(%arg0: f32) { }] } { ^bb0(%arg1: index, %arg2: index): - %9 = index_cast %arg1 : index to i32 - %10 = sitofp %9 : i32 to f32 + %9 = arith.index_cast %arg1 : index to i32 + %10 = arith.sitofp %9 : i32 to f32 call @bar(%10) : (f32) -> f32 sair.return } : #sair.shape x d1:static_range<16>>, () -> () @@ -220,9 +220,9 @@ func @fuse_reorder(%arg0: f32) { func @dependent_dims() { sair.program { // CHECK: sair.map - // CHECK-DAG: %[[V0:.*]] = constant 0 - // CHECK-DAG: %[[V1:.*]] = constant 64 - // CHECK-DAG: %[[V2:.*]] = constant 8 + // CHECK-DAG: %[[V0:.*]] = arith.constant 0 + // CHECK-DAG: %[[V1:.*]] = arith.constant 64 + // CHECK-DAG: %[[V2:.*]] = arith.constant 8 // CHECK: scf.for %[[V3:.*]] = %[[V0]] to %[[V1]] step %[[V2]] { %0 = sair.static_range { instances = [{}] } : !sair.static_range<64, 8> %1, %2 = sair.map[d0:%0] attributes { @@ -235,13 +235,13 @@ func @dependent_dims() { }] } { ^bb0(%arg0: index): - // CHECK: %[[V4:.*]] = constant 8 - %4 = constant 8 : index - // CHECK: %[[V5:.*]] = addi %[[V3]], %[[V4]] - %5 = addi %arg0, %4 : index + // CHECK: %[[V4:.*]] = arith.constant 8 + %4 = arith.constant 8 : index + // CHECK: %[[V5:.*]] = arith.addi %[[V3]], %[[V4]] + %5 = arith.addi %arg0, %4 : index sair.return %arg0, %5 : index, index } : #sair.shape>, () -> (index, index) - // CHECK: %[[V6:.*]] = constant 1 + // CHECK: %[[V6:.*]] = arith.constant 1 %3 = sair.dyn_range[d0:%0] %1(d0), %2(d0) { instances = [{}] } : !sair.dyn_range> // CHECK: scf.for %[[V7:.*]] = %[[V3]] to %[[V5]] step %[[V6]] { sair.map[d0:%0, d1:%3] attributes { @@ -299,7 +299,7 @@ func @partial_unroll() { %0 = sair.static_range { instances = [{}] } : !sair.static_range<5> // CHECK: sair.map // CHECK-SAME: loop_nest = [] - // CHECK: %[[STEP:.*]] = constant 2 : index + // CHECK: %[[STEP:.*]] = arith.constant 2 : index // CHECK: scf.for %{{.*}} = %{{.*}} to %{{.*}} step %[[STEP]] { // CHECK-COUNT-2: call @baz() // CHECK: } diff --git a/test/introduce_loops_invalid.mlir b/test/introduce_loops_invalid.mlir index 63eb0431..c7607da1 100644 --- a/test/introduce_loops_invalid.mlir +++ b/test/introduce_loops_invalid.mlir @@ -43,7 +43,7 @@ func @proj_any_must_be_eliminated() { instances = [{loop_nest = [{name = "A", iter = #sair.mapping_expr}]}] } { ^bb0(%arg0: index): - %2 = constant 1.0 : f32 + %2 = arith.constant 1.0 : f32 sair.return %2 : f32 } : #sair.shape>, () -> f32 // expected-error @+1 {{sair.proj_any operations must be eliminated before introducing loops}} diff --git a/test/invalid.mlir b/test/invalid.mlir index 22d1c157..d617b9a7 100644 --- a/test/invalid.mlir +++ b/test/invalid.mlir @@ -415,7 +415,7 @@ func @map_wrong_terminator_operand() { // expected-error @+1 {{expects element types of results to match operand types of the body terminator}} sair.map { ^bb0: - %0 = constant 1.0 : f32 + %0 = arith.constant 1.0 : f32 // expected-note @+1 {{body terminator}} sair.return %0 : f32 } : #sair.shape<()>, () -> (i32) @@ -535,7 +535,7 @@ func @map_reduce_unexpected_shape() { // expected-error @+1 {{unexpected shape}} "sair.map_reduce"() ({ ^bb0: - %0 = constant 1.0 : f32 + %0 = arith.constant 1.0 : f32 sair.return %0 : f32 }) { mapping_array = [], @@ -551,7 +551,7 @@ func @map_reduce_unexpected_shape() { func @from_scalar_element_type() { // expected-note @+1 {{prior use here}} - %0 = constant 0 : index + %0 = arith.constant 0 : index sair.program { // expected-error @+1 {{expects different type}} sair.from_scalar %0 : !sair.value<(), f32> @@ -563,7 +563,7 @@ func @from_scalar_element_type() { // ----- func @from_scalar_element_type_generic_form() { - %0 = constant 0 : index + %0 = arith.constant 0 : index sair.program { // expected-error @+1 {{expects different type}} "sair.from_scalar" (%0) : (index) -> !sair.value<(), f32> @@ -578,7 +578,7 @@ func @sair_program_non_sair_op() { // expected-error @+1 {{expected only Sair operations in the body}} sair.program { // expected-note @+1 {{found}} - %0 = constant 0 : index + %0 = arith.constant 0 : index sair.exit } return @@ -606,7 +606,7 @@ func @sair_value_defined_outside_sair_program(%arg0: !sair.value<(), f32>) { // ----- func @sair_dimension_defined_outside_sair_program(%arg0: !sair.dyn_range) { - %0 = constant 1.0 : f32 + %0 = arith.constant 1.0 : f32 sair.program { %1 = sair.from_scalar %0 : !sair.value<(), f32> // expected-error @+1 {{sair dimensions must be defined in the region they are used}} @@ -639,7 +639,7 @@ func @sair_exit_wrong_num_operands() { // ----- func @sair_exit_wrong_type() { - %c0 = constant 1 : i32 + %c0 = arith.constant 1 : i32 %0 = sair.program { %1 = sair.from_scalar %c0 : !sair.value<(), i32> // expected-error @+1 {{sair.exit operands must match the return type of the sair.program: expected 'f32', found 'i32'}} @@ -1209,7 +1209,7 @@ func @alloc_dim_sizes_mismatch(%arg0: index) { // ----- func @loop_crosses_subdomain_boundaries(%arg0: f32) { - %c4 = constant 4 : index + %c4 = arith.constant 4 : index sair.program { %sc4 = sair.from_scalar %c4 : !sair.value<(), index> %0 = sair.static_range : !sair.static_range<4, 4> @@ -1833,7 +1833,7 @@ func @two_results_same_buffer() { }] } { ^bb0: - %c0 = constant 1.0 : f32 + %c0 = arith.constant 1.0 : f32 sair.return %c0, %c0 : f32, f32 } : #sair.shape<()>, () -> (f32, f32) sair.exit diff --git a/test/lower_map_reduce.mlir b/test/lower_map_reduce.mlir index dee58fa6..a4304e26 100644 --- a/test/lower_map_reduce.mlir +++ b/test/lower_map_reduce.mlir @@ -23,9 +23,9 @@ func @map_reduce(%r1: index, %r2: index, %in1: f32) { // CHECK: ^{{.*}} ^bb0(%arg0: index, %arg1: index, %arg2: f32, %arg3: f32, %arg4: f32): // CHECK: addf - %9 = addf %arg2, %arg3 : f32 + %9 = arith.addf %arg2, %arg3 : f32 // CHECK: mulf - %10 = mulf %arg2, %arg3 : f32 + %10 = arith.mulf %arg2, %arg3 : f32 sair.return %9, %10 : f32, f32 // CHECK: #sair.shape, (f32, f32, f32) -> (f32, f32) } : #sair.shape, (f32) -> (f32, f32) @@ -80,8 +80,8 @@ func @map_reduce_multi_instance(%r1: index, %r2: index, %in1: f32) { }] } { ^bb0(%arg0: index, %arg1: index, %arg2: f32, %arg3: f32, %arg4: f32): - %9 = addf %arg2, %arg3 : f32 - %10 = mulf %arg2, %arg3 : f32 + %9 = arith.addf %arg2, %arg3 : f32 + %10 = arith.mulf %arg2, %arg3 : f32 sair.return %9, %10 : f32, f32 } : #sair.shape, (f32) -> (f32, f32) diff --git a/test/lower_proj_any.mlir b/test/lower_proj_any.mlir index 9e948f7a..499238d9 100644 --- a/test/lower_proj_any.mlir +++ b/test/lower_proj_any.mlir @@ -2,7 +2,7 @@ // CHECK-LABEL: @eliminate func @eliminate(%arg0: f32) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> // CHECK: %[[V0:.*]] = sair.from_scalar %{{.*}} : !sair.value<(), f32> @@ -28,7 +28,7 @@ func @eliminate(%arg0: f32) { // CHECK-LABEL: @convert_to_proj_last func @convert_to_proj_last(%arg0: f32) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> // CHECK: %[[V0:.*]] = sair.from_scalar %{{.*}} : !sair.value<(), f32> diff --git a/test/lower_proj_any_invalid.mlir b/test/lower_proj_any_invalid.mlir index bd9649a2..83c4a0e6 100644 --- a/test/lower_proj_any_invalid.mlir +++ b/test/lower_proj_any_invalid.mlir @@ -1,7 +1,7 @@ // RUN: sair-opt -sair-lower-proj-any -split-input-file -verify-diagnostics %s func @source_not_normalized(%arg0: f32) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> %0 = sair.from_scalar %arg0 : !sair.value<(), f32> @@ -26,7 +26,7 @@ func @source_not_normalized(%arg0: f32) { // ----- func @result_not_normalized(%arg0: f32) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> %0 = sair.from_scalar %arg0 : !sair.value<(), f32> @@ -51,7 +51,7 @@ func @result_not_normalized(%arg0: f32) { // ----- func @cannot_lower(%arg0: f32) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> %0 = sair.from_scalar %arg0 : !sair.value<(), f32> diff --git a/test/lower_to_map.mlir b/test/lower_to_map.mlir index 7e58df18..506c6bb6 100644 --- a/test/lower_to_map.mlir +++ b/test/lower_to_map.mlir @@ -2,7 +2,7 @@ // CHECK-LABEL: @copy func @copy(%arg0 : memref) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> // CHECK: %[[V0:.*]] = sair.dyn_range @@ -26,7 +26,7 @@ func @copy(%arg0 : memref) { // CHECK-LABEL: @alloc func @alloc(%arg0: index) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> // CHECK: %[[D0:.*]] = sair.dyn_range @@ -96,8 +96,8 @@ func @load_from_memref(%arg0 : memref) { instances = [{expansion = "map"}] } { ^bb0(%arg1: index): - %c4 = constant 4 : index - %3 = addi %arg1, %c4 : index + %c4 = arith.constant 4 : index + %3 = arith.addi %arg1, %c4 : index sair.return %arg1, %3 : index, index } : #sair.shape>, () -> (index, index) %3 = sair.dyn_range[d0:%0] %1(d0), %2(d0) : !sair.dyn_range> @@ -105,7 +105,7 @@ func @load_from_memref(%arg0 : memref) { // CHECK: = sair.map[d0:%{{.*}}, d1:%{{.*}}, d2:%{{.*}}] %{{.*}}, %{{.*}}#0(d0), %{{.*}}#1(d0) // CHECK: ^{{.*}}(%[[ARG1:.*]]: index, %[[ARG2:.*]]: index, %[[ARG3:.*]]: index, %[[MEMREF:.*]]: memref, %[[ARG4:.*]]: index, %[[ARG5:.*]]: index): // CHECK: %[[I0:.*]] = affine.apply affine_map<(d0, d1, d2)[s0] -> (d2 - s0)>(%[[ARG1]], %[[ARG2]], %[[ARG3]])[%[[ARG4]]] - // CHECK: %[[C0:.*]] = constant 0 + // CHECK: %[[C0:.*]] = arith.constant 0 // CHECK: %[[I1:.*]] = affine.apply affine_map<(d0, d1, d2)[s0] -> ((d1 - s0) floordiv 2)>(%[[ARG1]], %[[ARG2]], %[[ARG3]])[%[[C0]]] // CHECK: %[[VALUE:.*]] = memref.load %[[MEMREF]][%[[I0]], %[[I1]]] : memref // CHECK: sair.return %[[VALUE]] : f32 @@ -132,9 +132,9 @@ func @store_to_memref(%arg0 : f32, %arg1 : memref) { // CHECK: sair.map[d0:%{{.*}}, d1:%{{.*}}, d2:%{{.*}}] %{{.*}}, %{{.*}}(d0, d1, d2) // CHECK: ^{{.*}}(%[[ARG1:.*]]: index, %[[ARG2:.*]]: index, %[[ARG3:.*]]: index, %[[MEMREF:.*]]: memref, %[[VALUE:.*]]: f32): - // CHECK: %[[C0_0:.*]] = constant 0 + // CHECK: %[[C0_0:.*]] = arith.constant 0 // CHECK: %[[I0:.*]] = affine.apply affine_map<(d0, d1, d2)[s0] -> (d2 - s0)>(%[[ARG1]], %[[ARG2]], %[[ARG3]])[%[[C0_0]]] - // CHECK: %[[C0_1:.*]] = constant 0 + // CHECK: %[[C0_1:.*]] = arith.constant 0 // CHECK: %[[I1:.*]] = affine.apply affine_map<(d0, d1, d2)[s0] -> (d1 - s0)>(%[[ARG1]], %[[ARG2]], %[[ARG3]])[%[[C0_1]]] // CHECK: memref.store %[[VALUE]], %[[MEMREF]][%[[I0]], %[[I1]]] // CHECK: sair.return diff --git a/test/lowering_annotation_roundtrip.mlir b/test/lowering_annotation_roundtrip.mlir index 5ff6e03a..24911cf5 100644 --- a/test/lowering_annotation_roundtrip.mlir +++ b/test/lowering_annotation_roundtrip.mlir @@ -2,12 +2,12 @@ // CHECK-LABEL: @memory_space func @memory_space() { - %c1 = constant 1.0 : f32 + %c1 = arith.constant 1.0 : f32 sair.program { // CHECK: sair.map attributes {memory_space = [0, unit]} sair.map attributes {memory_space = [0, unit]} { ^bb0: - %0 = constant 1.0 : f32 + %0 = arith.constant 1.0 : f32 sair.return %0, %0 : f32, f32 } : #sair.shape<()>, () -> (f32, f32) sair.exit diff --git a/test/materialize_buffers.mlir b/test/materialize_buffers.mlir index 0be18c02..a28b7083 100644 --- a/test/materialize_buffers.mlir +++ b/test/materialize_buffers.mlir @@ -2,7 +2,7 @@ // CHECK-LABEL: @from_to_memref func @from_to_memref(%arg0: memref, %arg1: memref) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n { instances = [{}] } : !sair.value<(), index> // CHECK: %[[M0:.*]] = sair.from_scalar %{{.*}} : !sair.value<(), memref> @@ -127,10 +127,10 @@ func @loop_nest(%arg0: f32) { // CHECK: } { // CHECK: ^{{.*}}(%[[ARG0:.*]]: index): // CHECK: %[[V1:.*]] = affine.apply affine_map<(d0) -> (d0)>(%[[ARG0]]) - // CHECK: %[[C4:.*]] = constant 4 - // CHECK: %[[V2:.*]] = addi %[[V1]], %[[C4]] - // CHECK: %[[C16:.*]] = constant 16 - // CHECK: %[[V3:.*]] = cmpi ult, %[[C16]], %[[V2]] + // CHECK: %[[C4:.*]] = arith.constant 4 + // CHECK: %[[V2:.*]] = arith.addi %[[V1]], %[[C4]] + // CHECK: %[[C16:.*]] = arith.constant 16 + // CHECK: %[[V3:.*]] = arith.cmpi ult, %[[C16]], %[[V2]] // CHECK: %[[V4:.*]] = select %[[V3]], %[[C16]], %[[V2]] // CHECK: %[[V5:.*]] = affine.apply affine_map<(d0, d1) -> (d1 - d0)> // CHECK: sair.return %[[V5]] : index diff --git a/test/normalize_loops.mlir b/test/normalize_loops.mlir index dd6a5cbf..82c93526 100644 --- a/test/normalize_loops.mlir +++ b/test/normalize_loops.mlir @@ -47,10 +47,10 @@ func @stripe() { // CHECK: loop_nest = [{iter = #sair.mapping_expr, name = "loopA"}] // CHECK: ^bb0(%[[ARG0:.*]]: index): // CHECK: %[[V1:.*]] = affine.apply affine_map<(d0) -> (d0)>(%arg0) - // CHECK: %[[V2:.*]] = constant 4 : index - // CHECK: %[[V3:.*]] = addi %[[V1]], %[[V2]] : index - // CHECK: %[[V4:.*]] = constant 62 : index - // CHECK: %[[V5:.*]] = cmpi ult, %[[V4]], %[[V3]] : index + // CHECK: %[[V2:.*]] = arith.constant 4 : index + // CHECK: %[[V3:.*]] = arith.addi %[[V1]], %[[V2]] : index + // CHECK: %[[V4:.*]] = arith.constant 62 : index + // CHECK: %[[V5:.*]] = arith.cmpi ult, %[[V4]], %[[V3]] : index // CHECK: %[[V6:.*]] = select %[[V5]], %[[V4]], %[[V3]] : index // CHECK: sair.return %[[V1]], %[[V6]] : index, index @@ -85,7 +85,7 @@ func @stripe() { // CHECK-LABEL: @unstripe func @unstripe(%arg0: f32) { - %c4 = constant 4 : index + %c4 = arith.constant 4 : index sair.program { %sc4 = sair.from_scalar %c4 { instances = [{}] } : !sair.value<(), index> // CHECK-DAG: %[[D0:.*]] = sair.static_range {instances = [{operands = []}]} : !sair.static_range<4> @@ -243,10 +243,10 @@ func @sequence_attr(%arg0: f32) { // CHECK-SAME: sequence = 0 // CHECK: ^{{.*}}(%[[ARG:.*]]: index): // CHECK: %[[V1:.*]] = affine.apply affine_map<(d0) -> (d0)>(%[[ARG]]) - // CHECK: %[[C4:.*]] = constant 4 - // CHECK: %[[V2:.*]] = addi %[[V1]], %[[C4]] - // CHECK: %[[C16:.*]] = constant 16 - // CHECK: %[[V3:.*]] = cmpi ult, %[[C16]], %[[V2]] + // CHECK: %[[C4:.*]] = arith.constant 4 + // CHECK: %[[V2:.*]] = arith.addi %[[V1]], %[[C4]] + // CHECK: %[[C16:.*]] = arith.constant 16 + // CHECK: %[[V3:.*]] = arith.cmpi ult, %[[C16]], %[[V2]] // CHECK: %[[V4:.*]] = select %[[V3]], %[[C16]], %[[V2]] // CHECK: sair.return %[[V1]], %[[V4]] // CHECK: %[[DYN:.*]] = sair.dyn_range[d0:%[[STATIC]]] %[[RANGE]]#0(d0), %[[RANGE]]#1(d0) diff --git a/test/regression/matmul.mlir b/test/regression/matmul.mlir index 58988f03..04d47740 100644 --- a/test/regression/matmul.mlir +++ b/test/regression/matmul.mlir @@ -1,8 +1,8 @@ // RUN: sair-opt %s -convert-sair-to-loop func @main(%arg0: memref<512x512xf32>, %arg1: memref<512x512xf32>, %arg2: memref<512x512xf32>) { - %c0 = constant 0 : index - %cst = constant 0.000000e+00 : f32 + %c0 = arith.constant 0 : index + %cst = arith.constant 0.000000e+00 : f32 sair.program { %3 = sair.from_scalar %arg0 { instances = [{}] } : !sair.value<(), memref<512x512xf32>> @@ -54,8 +54,8 @@ func @main(%arg0: memref<512x512xf32>, %arg1: memref<512x512xf32>, %arg2: memref }] } { ^bb0(%arg3: index, %arg4: index, %arg5: index, %arg6: f32, %arg7: f32, %arg8: f32): // no predecessors - %14 = mulf %arg7, %arg8 : f32 - %15 = addf %arg6, %14 : f32 + %14 = arith.mulf %arg7, %arg8 : f32 + %15 = arith.addf %arg6, %14 : f32 sair.return %15 : f32 } : #sair.shape x d1:static_range<512> x d2:static_range<512>>, (f32, f32, f32) -> f32 diff --git a/test/roundtrip.mlir b/test/roundtrip.mlir index 3e2be7b9..7baad3ee 100644 --- a/test/roundtrip.mlir +++ b/test/roundtrip.mlir @@ -36,8 +36,8 @@ func @sair_program() { // CHECK-LABEL: @sair_program_return_values func @sair_program_return_values() { - %c0 = constant 1.0 : f32 - %c1 = constant 1 : i32 + %c0 = arith.constant 1.0 : f32 + %c1 = arith.constant 1 : i32 // CHECK: %{{.*}}:2 = sair.program %0:2 = sair.program { // CHECK: %[[V0:.*]] = sair.from_scalar %{{.*}} : !sair.value<(), f32> @@ -53,7 +53,7 @@ func @sair_program_return_values() { // CHECK-LABEL: @dyn_range_op func @dyn_range_op() { - %c0 = constant 0 : index + %c0 = arith.constant 0 : index sair.program { // CHECK: %[[V0:.*]] = sair.from_scalar %0 = sair.from_scalar %c0 : !sair.value<(), index> @@ -177,7 +177,7 @@ func @copy_attributes(%arg0 : f32) { // CHECK-LABEL: @from_memref func @from_memref(%arg0 : memref) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> // CHECK: %[[D0:.*]] = sair.dyn_range @@ -196,7 +196,7 @@ func @from_memref(%arg0 : memref) { // CHECK-LABEL: @to_memref func @to_memref(%arg0 : f32, %arg1 : memref) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> // CHECK: %[[D0:.*]] = sair.dyn_range @@ -231,7 +231,7 @@ func @to_memref(%arg0 : f32, %arg1 : memref) { // CHECK-LABEL: @load_from_memref func @load_from_memref(%arg0 : memref) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> // CHECK: %[[D0:.*]] = sair.dyn_range @@ -251,7 +251,7 @@ func @load_from_memref(%arg0 : memref) { // CHECK-LABEL: @store_to_memref func @store_to_memref(%arg0 : f32, %arg1 : memref) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> // CHECK: %[[D0:.*]] = sair.dyn_range @@ -273,7 +273,7 @@ func @store_to_memref(%arg0 : f32, %arg1 : memref) { // CHECK-LABEL: @map func @map(%arg0 : f32, %arg1: i32) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> // CHECK: %[[D0:.*]] = sair.dyn_range @@ -300,7 +300,7 @@ func @map(%arg0 : f32, %arg1: i32) { // CHECK-LABEL: @map_noargs func @map_noargs() { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> // CHECK: %[[D0:.*]] = sair.dyn_range @@ -309,8 +309,8 @@ func @map_noargs() { sair.map[d0:%0, d1:%0] { // CHECK: ^{{.*}}(%{{.*}}: index, %{{.*}}: index): ^bb0(%arg0: index, %arg1: index): - %c0 = constant 0.0 : f32 - %c1 = constant 1 : i32 + %c0 = arith.constant 0.0 : f32 + %c1 = arith.constant 1 : i32 // CHECK: sair.return {{.*}} : f32, i32 sair.return %c0, %c1 : f32, i32 // CHECK: } : #sair.shape, () -> (f32, i32) @@ -335,7 +335,7 @@ func @return_noargs() { // CHECK-LABEL: @map_reduce func @map_reduce(%arg0 : f32, %arg1 : i32, %arg2 : f64) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> // CHECK: %[[D0:.*]] = sair.dyn_range @@ -369,8 +369,8 @@ func @map_reduce(%arg0 : f32, %arg1 : i32, %arg2 : f64) { // CHECK-LABEL: @from_scalar func @from_scalar() { - // CHECK: %[[V0:.*]] = constant 1 : index - %0 = constant 1 : index + // CHECK: %[[V0:.*]] = arith.constant 1 : index + %0 = arith.constant 1 : index sair.program { // CHECK: %{{.*}} sair.from_scalar %[[V0]] : !sair.value<(), index> %1 = sair.from_scalar %0 : !sair.value<(), index> @@ -381,7 +381,7 @@ func @from_scalar() { // CHECK-LABEL: @loop_nest_attr func @loop_nest_attr(%arg0: f32) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> %0 = sair.dyn_range %sn : !sair.dyn_range @@ -463,7 +463,7 @@ func @proj_last_different_shape(%arg0: f32) { // CHECK-LABEL: @fby func @fby(%arg0: f32) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> // CHECK: %[[V0:.*]] = sair.from_scalar %{{.*}} : !sair.value<(), f32> @@ -513,7 +513,7 @@ func @mapping_expr_attr() { } func @stripe_mined_loop() { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> %0 = sair.dyn_range %sn : !sair.dyn_range @@ -534,7 +534,7 @@ func @stripe_mined_loop() { } func @stripe_mapping(%arg0: f32) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> // CHECK: %[[D0:.*]] = sair.dyn_range @@ -544,8 +544,8 @@ func @stripe_mapping(%arg0: f32) { // CHECK: %[[I0:.*]]:2 = sair.map %2, %3 = sair.map[d0:%1] { ^bb0(%arg1: index): - %c2 = constant 2 : index - %4 = addi %arg1, %c2 : index + %c2 = arith.constant 2 : index + %4 = arith.addi %arg1, %c2 : index sair.return %arg1, %4 : index, index } : #sair.shape, () -> (index, index) // CHECK: %[[D2:.*]] = sair.dyn_range[d0:%[[D1]]] %[[I0]]#0(d0), %[[I0]]#1(d0) @@ -585,7 +585,7 @@ func @alloc_simple() { // CHECK-LABEL: @alloc func @alloc(%arg0: index) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> %0 = sair.dyn_range %sn : !sair.dyn_range @@ -602,7 +602,7 @@ func @alloc(%arg0: index) { // CHECK-LABEL: @alloc_nosize func @alloc_nosize(%arg0: index) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> %0 = sair.dyn_range %sn : !sair.dyn_range @@ -630,7 +630,7 @@ func @free_simple() { // CHECK-LABEL: @sair_free func @sair_free(%arg0: index) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> %0 = sair.dyn_range %sn : !sair.dyn_range @@ -648,7 +648,7 @@ func @sair_free(%arg0: index) { // CHECK-LABEL: @free_nosize func @free_nosize(%arg0: index) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> %0 = sair.dyn_range %sn : !sair.dyn_range @@ -666,7 +666,7 @@ func @free_nosize(%arg0: index) { // CHECK-LABEL: @storage_stripe func @storage_stripe(%arg0: f32) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> %0 = sair.from_scalar %arg0 : !sair.value<(), f32> @@ -690,7 +690,7 @@ func @storage_stripe(%arg0: f32) { // CHECK-LABEL: @storage_no_layout func @storage_no_layout(%arg0: f32) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> %0 = sair.from_scalar %arg0 : !sair.value<(), f32> @@ -708,7 +708,7 @@ func @storage_no_layout(%arg0: f32) { // CHECK-LABEL: @placeholder func @placeholder(%arg0: f32) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> %0 = sair.dyn_range %sn : !sair.dyn_range @@ -722,7 +722,7 @@ func @placeholder(%arg0: f32) { // CHECK-LABEL: @placeholder_with_loop_nest func @placeholder_with_loop_nest(%arg0: f32) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> %0 = sair.dyn_range %sn : !sair.dyn_range @@ -745,7 +745,7 @@ func @placeholder_with_loop_nest(%arg0: f32) { // CHECK-LABEL: @free_with_mapping func @free_with_mapping() { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> %0 = sair.dyn_range %sn : !sair.dyn_range diff --git a/test/storage.mlir b/test/storage.mlir index e66095a5..76582693 100644 --- a/test/storage.mlir +++ b/test/storage.mlir @@ -5,7 +5,7 @@ // map_reduce. // CHECK-LABEL: @from_memref_in_memory func @from_memref_in_memory(%arg0: memref, %arg1: f32) { - %n = constant 8 : index + %n = arith.constant 8 : index sair.program { %sn = sair.from_scalar %n : !sair.value<(), index> %0 = sair.from_scalar %arg0 : !sair.value<(), memref> diff --git a/transforms/introduce_loops.cc b/transforms/introduce_loops.cc index db4d6e48..b392e0a4 100644 --- a/transforms/introduce_loops.cc +++ b/transforms/introduce_loops.cc @@ -428,7 +428,7 @@ mlir::scf::ForOp CreateForOp(mlir::Location loc, mlir::Value lower_bound, llvm::ArrayRef results_pos, Driver &driver) { mlir::OpBuilder::InsertionGuard guard(driver); auto step_value = - driver.create(loc, step.getSExtValue()); + driver.create(loc, step.getSExtValue()); mlir::scf::ForOp for_op = driver.create( loc, lower_bound, upper_bound, step_value, iter_args_init); @@ -472,7 +472,7 @@ mlir::Value GetValueOfType(mlir::Location loc, mlir::Type type, mlir::emitError(loc) << "unable to create a default value of type " << type; return nullptr; } - return driver.create(loc, type, value); + return driver.create(loc, type, value); } // Updates users of a value after introducing a loop in the sair.map operation @@ -548,7 +548,7 @@ mlir::LogicalResult IntroduceLoop(SairMapOp op, driver.setInsertionPointToStart(&op.block()); auto materialize_bound = [&](const ValueOrConstant &bound) -> mlir::Value { if (bound.is_constant()) { - return driver.create(op.getLoc(), bound.constant()); + return driver.create(op.getLoc(), bound.constant()); } // Check that the value is stored in registers. auto bound_instance = ResultInstance::Unique(bound.value().value); diff --git a/transforms/lowering.cc b/transforms/lowering.cc index 0070ed4a..7fceb0ab 100644 --- a/transforms/lowering.cc +++ b/transforms/lowering.cc @@ -17,6 +17,7 @@ #include #include "mlir/Conversion/AffineToStandard/AffineToStandard.h" +#include "mlir/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.h" #include "mlir/Conversion/LLVMCommon/ConversionTarget.h" #include "mlir/Conversion/LLVMCommon/Pattern.h" #include "mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h" @@ -70,6 +71,7 @@ class LowerToLLVMPass : public LowerToLLVMBase { LLVMTypeConverter converter(&getContext()); populateMemRefToLLVMConversionPatterns(converter, patterns); populateStdToLLVMConversionPatterns(converter, patterns); + arith::populateArithmeticToLLVMConversionPatterns(converter, patterns); patterns.insert(converter); LLVMConversionTarget target(getContext()); diff --git a/util.cc b/util.cc index 76a9b676..d9bc64da 100644 --- a/util.cc +++ b/util.cc @@ -123,19 +123,19 @@ RangeParameters RangeParameterBuilder::Get(MappingStripeExpr expr) { // Compute the end index as `min(begin + size, operand_size)`. mlir::Type index_type = builder_.getIndexType(); - auto size_op = builder_.create( + auto size_op = builder_.create( loc_, index_type, builder_.getIndexAttr(size * operand_parameters.step)); auto uncapped_end = - builder_.create(loc_, index_type, begin, size_op); + builder_.create(loc_, index_type, begin, size_op); mlir::Value operand_end; if (operand_parameters.end.is()) { - operand_end = builder_.create( + operand_end = builder_.create( loc_, index_type, operand_parameters.end.get()); } else { operand_end = operand_parameters.end.get(); } - auto is_capped = builder_.create(loc_, CmpIPredicate::ult, - operand_end, uncapped_end); + auto is_capped = builder_.create( + loc_, arith::CmpIPredicate::ult, operand_end, uncapped_end); mlir::Value end = builder_.create( loc_, builder_.getIndexType(), is_capped, operand_end, uncapped_end); @@ -153,7 +153,8 @@ RangeParameters RangeParameterBuilder::Get(MappingUnStripeExpr expr) { mlir::Value Materialize(mlir::Location loc, mlir::OpFoldResult value, mlir::OpBuilder &builder) { if (value.is()) return value.get(); - return builder.create(loc, value.get()); + return builder.create(loc, + value.get()); } llvm::SmallVector GetRangeParameters(