Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions test/canonicalization.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -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) -> ()
Expand All @@ -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) -> ()
Expand All @@ -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
Expand All @@ -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>
Expand All @@ -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>
Expand All @@ -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>
Expand All @@ -124,7 +124,7 @@ func @merge_proj(%arg0: f32) {

// CHECK-LABEL: @remove_cyclic_fby
func @remove_cyclic_fby(%arg0: f32, %arg1: memref<?x?x?xf32>) {
%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>
Expand All @@ -145,7 +145,7 @@ func @remove_cyclic_fby(%arg0: f32, %arg1: memref<?x?x?xf32>) {

// 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>
Expand All @@ -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>
Expand All @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion test/default_expansion.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions test/default_storage.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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<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
Expand Down Expand Up @@ -117,7 +117,7 @@ func @to_memref_proj_fby(%arg0: f32, %arg1: memref<f32>) {

// 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>
Expand All @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion test/default_storage_invalid.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 10 additions & 10 deletions test/from_linalg.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -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<d0:static_range<1> x d1:static_range<3> x d2:static_range<2>>, (f32, f32) -> f32
Expand Down Expand Up @@ -89,7 +89,7 @@ func @dynamic(%arg0: memref<?x2x?xf32>, %arg1: memref<2x?x?xf32>) {
ins(%arg0 : memref<?x2x?xf32>)
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
}

Expand Down Expand Up @@ -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<d0:static_range<2> x d1:static_range<4> x
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/from_linalg_invalid.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -39,7 +39,7 @@ func @shape_mismatch(%arg0: memref<?xf32>, %arg1: memref<2xf32>) {
ins(%arg0 : memref<?xf32>)
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
Expand Down
18 changes: 9 additions & 9 deletions test/inline_trivial_sair_ops.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

// 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
%2 = sair.from_scalar %0 : !sair.value<(), 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
Expand All @@ -25,17 +25,17 @@ 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
%1 = sair.from_scalar %0 : !sair.value<(), 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
Expand All @@ -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>
Expand Down
30 changes: 15 additions & 15 deletions test/integration/sair_to_llvm.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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
Expand All @@ -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>
}
Expand All @@ -64,7 +64,7 @@ func @from_to_memref() -> f32 {
} : #sair.shape<d0:static_range<8>>, 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<d0:static_range<8>>, (i32) -> i32
sair.to_memref %6 memref[d0:%2] %4(d0) {
Expand Down
Loading