Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add func namespace in MLIR files #212

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
26 changes: 13 additions & 13 deletions test/canonicalization.mlir
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// RUN: sair-opt %s -canonicalize | FileCheck %s

func @use(%arg0: f32) {
func.func @use(%arg0: f32) {
return
}

// CHECK-LABEL: @deduplicate_map_input
func @deduplicate_map_input(%arg0: f32) {
func.func @deduplicate_map_input(%arg0: f32) {
sair.program {
// CHECK: %[[V0:.*]] = sair.from_scalar
%0 = sair.from_scalar %arg0 : !sair.value<(), f32>
Expand All @@ -25,7 +25,7 @@ func @deduplicate_map_input(%arg0: f32) {
}

// CHECK-LABEL: @deduplicate_map_input_instances
func @deduplicate_map_input_instances(%arg0: f32) {
func.func @deduplicate_map_input_instances(%arg0: f32) {
sair.program {
// CHECK: %[[V0:.*]] = sair.from_scalar
%0 = sair.from_scalar %arg0 : !sair.value<(), f32>
Expand All @@ -49,7 +49,7 @@ func @deduplicate_map_input_instances(%arg0: f32) {
}

// CHECK-LABEL: @deduplicate_map_output
func @deduplicate_map_output() {
func.func @deduplicate_map_output() {
%3, %4 = sair.program {
// CHECK: %[[V0:.*]] = sair.map
%0, %1 = sair.map {
Expand All @@ -67,7 +67,7 @@ func @deduplicate_map_output() {
}

// CHECK-LABEL: @fold_empty_proj
func @fold_empty_proj(%arg0: f32) {
func.func @fold_empty_proj(%arg0: f32) {
%n = arith.constant 8 : index
%0 = sair.program {
%sn = sair.from_scalar %n : !sair.value<(), index>
Expand All @@ -85,7 +85,7 @@ func @fold_empty_proj(%arg0: f32) {
}

// CHECK-LABEL: @fold_empty_fby
func @fold_empty_fby(%arg0: f32) {
func.func @fold_empty_fby(%arg0: f32) {
%n = arith.constant 8 : index
%0 = sair.program {
%sn = sair.from_scalar %n : !sair.value<(), index>
Expand All @@ -103,7 +103,7 @@ func @fold_empty_fby(%arg0: f32) {
}

// CHECK-LABEL: @merge_proj
func @merge_proj(%arg0: f32) {
func.func @merge_proj(%arg0: f32) {
%n = arith.constant 8 : index
%0 = sair.program {
%sn = sair.from_scalar %n : !sair.value<(), index>
Expand All @@ -123,7 +123,7 @@ func @merge_proj(%arg0: f32) {
}

// CHECK-LABEL: @remove_cyclic_fby
func @remove_cyclic_fby(%arg0: f32, %arg1: memref<?x?x?xf32>) {
func.func @remove_cyclic_fby(%arg0: f32, %arg1: memref<?x?x?xf32>) {
%n = arith.constant 8 : index
sair.program {
%sn = sair.from_scalar %n : !sair.value<(), index>
Expand All @@ -144,7 +144,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) {
func.func @remove_useless_dims_fby(%arg0: f32) {
%n = arith.constant 8 : index
%0 = sair.program {
%sn = sair.from_scalar %n : !sair.value<(), index>
Expand All @@ -166,7 +166,7 @@ func @remove_useless_dims_fby(%arg0: f32) {
}

// CHECK-LABEL: @remove_useless_dims_proj
func @remove_useless_dims_proj(%arg0: f32) {
func.func @remove_useless_dims_proj(%arg0: f32) {
%n = arith.constant 8 : index
%0 = sair.program {
%sn = sair.from_scalar %n : !sair.value<(), index>
Expand All @@ -188,7 +188,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) {
func.func @remove_useless_dims_proj_dependent(%arg0: f32, %arg1: index) {
%n = arith.constant 8 : index
%0 = sair.program {
%sn = sair.from_scalar %n : !sair.value<(), index>
Expand Down Expand Up @@ -216,7 +216,7 @@ func @remove_useless_dims_proj_dependent(%arg0: f32, %arg1: index) {
}

// CHECK-LABEL: @mappings
func @mappings(%arg0: f32) {
func.func @mappings(%arg0: f32) {
%n = arith.constant 8 : index
%0 = sair.program {
%sn = sair.from_scalar %n : !sair.value<(), index>
Expand All @@ -234,7 +234,7 @@ func @mappings(%arg0: f32) {
}

// CHECK-LABEL: @sequence
func @sequence(%arg0 : f32, %arg1 : index) {
func.func @sequence(%arg0 : f32, %arg1 : index) {
sair.program {
%0 = sair.from_scalar %arg0 : !sair.value<(), f32>
%1 = sair.from_scalar %arg1 : !sair.value<(), index>
Expand Down
4 changes: 2 additions & 2 deletions test/default_expansion.mlir
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: sair-opt -sair-assign-default-expansion %s | FileCheck %s

// CHECK-LABEL: @map
func @map() {
func.func @map() {
sair.program {
// CHECK: sair.map
// CHECK-SAME: expansion = "map"
Expand All @@ -16,7 +16,7 @@ func @map() {
}

// CHECK-LABEL: @copy
func @copy(%arg0: f32) {
func.func @copy(%arg0: f32) {
sair.program {
// CHECK: sair.from_scalar
%0 = sair.from_scalar %arg0 {
Expand Down
2 changes: 1 addition & 1 deletion test/default_expansion_invalid.mlir
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: sair-opt -sair-assign-default-expansion %s -split-input-file -verify-diagnostics

func @main() {
func.func @main() {
sair.program {
// expected-error @+1 {{not supported}}
sair.map_reduce reduce attributes {instances = [{}]} {
Expand Down
2 changes: 1 addition & 1 deletion test/default_loop_nest.mlir
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: sair-opt -sair-assign-default-loop-nest %s | FileCheck %s

func @default_loop_nest(%arg0: f32) {
func.func @default_loop_nest(%arg0: f32) {
sair.program {
%0 = sair.static_range : !sair.static_range<16>
%1 = sair.from_scalar %arg0 : !sair.value<(), f32>
Expand Down
26 changes: 13 additions & 13 deletions test/default_sequence.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

// CHECK-LABEL: @empty
// Shouldn't fail here.
func @empty() {
func.func @empty() {
sair.program {
sair.exit
}
return
}

// CHECK-LABEL: @simple_use_def
func @simple_use_def() {
func.func @simple_use_def() {
sair.program {
// CHECK: sair.alloc
// CHECK-SAME: sequence = 0
Expand All @@ -28,7 +28,7 @@ func @simple_use_def() {
}

// CHECK-LABEL: @simple_use_def_chain
func @simple_use_def_chain(%arg0: f32) {
func.func @simple_use_def_chain(%arg0: f32) {
sair.program {
%0 = sair.from_scalar %arg0 : !sair.value<(), f32>
// CHECK: sair.copy
Expand Down Expand Up @@ -62,7 +62,7 @@ func @simple_use_def_chain(%arg0: f32) {
// CHECK-LABEL: @use_def_graph
// Check that we deterministically prefer the original order of operations in
// absence of other criteria.
func @use_def_graph(%arg0: f32, %arg1: f32) {
func.func @use_def_graph(%arg0: f32, %arg1: f32) {
sair.program {
// CHECK: %[[V0:.*]] = sair.from_scalar
%0 = sair.from_scalar %arg0 : !sair.value<(), f32>
Expand Down Expand Up @@ -103,7 +103,7 @@ func @use_def_graph(%arg0: f32, %arg1: f32) {

// CHECK-LABEL: @use_def_graph_partial
// Check that pre-existent relative order is preserved.
func @use_def_graph_partial(%arg0: f32, %arg1: f32) {
func.func @use_def_graph_partial(%arg0: f32, %arg1: f32) {
sair.program {
// CHECK: %[[V0:.*]] = sair.from_scalar
%0 = sair.from_scalar %arg0 : !sair.value<(), f32>
Expand Down Expand Up @@ -144,7 +144,7 @@ func @use_def_graph_partial(%arg0: f32, %arg1: f32) {

// CHECK-LABEL: @fby
// Check that the pass is not confused by fby self-dependency.
func @fby(%arg0: f32) {
func.func @fby(%arg0: f32) {
sair.program {
%0 = sair.static_range : !sair.static_range<42>
%1 = sair.from_scalar %arg0 : !sair.value<(), f32>
Expand All @@ -168,7 +168,7 @@ func @fby(%arg0: f32) {
}

// CHECK-LABEL: @fby_many_compute
func @fby_many_compute(%arg0: f32) -> f32 {
func.func @fby_many_compute(%arg0: f32) -> f32 {
%out = sair.program {
%0 = sair.static_range : !sair.static_range<42>
%1 = sair.from_scalar %arg0 : !sair.value<(), f32>
Expand Down Expand Up @@ -205,7 +205,7 @@ func @fby_many_compute(%arg0: f32) -> f32 {
}

// CHECK-LABEL: @fby_two_cycles
func @fby_two_cycles(%arg0: f32) -> f32 {
func.func @fby_two_cycles(%arg0: f32) -> f32 {
%out = sair.program {
%0 = sair.static_range : !sair.static_range<42>
%1 = sair.from_scalar %arg0 : !sair.value<(), f32>
Expand Down Expand Up @@ -242,7 +242,7 @@ func @fby_two_cycles(%arg0: f32) -> f32 {
}

// CHECK-LABEL: @fby_then_different_source
func @fby_then_different_source(%arg0: f32) {
func.func @fby_then_different_source(%arg0: f32) {
sair.program {
%0 = sair.static_range : !sair.static_range<42>
%1 = sair.from_scalar %arg0 : !sair.value<(), f32>
Expand Down Expand Up @@ -271,7 +271,7 @@ func @fby_then_different_source(%arg0: f32) {
}

// CHECK-LABEL: @sequence_domain
func @sequence_domain(%arg0: index) {
func.func @sequence_domain(%arg0: index) {
sair.program {
%0 = sair.from_scalar %arg0 : !sair.value<(), index>
%1 = sair.dyn_range %0 : !sair.dyn_range
Expand All @@ -294,7 +294,7 @@ func @sequence_domain(%arg0: index) {
}

// CHECK-LABEL: @sequence_implicit_domain
func @sequence_implicit_domain(%arg0: index) {
func.func @sequence_implicit_domain(%arg0: index) {
sair.program {
%0 = sair.from_scalar %arg0 : !sair.value<(), index>
%1 = sair.dyn_range %0 : !sair.dyn_range
Expand Down Expand Up @@ -324,7 +324,7 @@ func @sequence_implicit_domain(%arg0: index) {
}

// CHECK-LABEL: @sequence_implicit_domain_partial
func @sequence_implicit_domain_partial(%arg0: index) {
func.func @sequence_implicit_domain_partial(%arg0: index) {
sair.program {
%0 = sair.from_scalar %arg0 : !sair.value<(), index>
%1 = sair.dyn_range %0 : !sair.dyn_range
Expand Down Expand Up @@ -360,7 +360,7 @@ func @sequence_implicit_domain_partial(%arg0: index) {
// It shouldn't be a problem to have a dynamic range for a rematerialized
// dimension to be defined after its used as long as there is no circular
// dependency introduced.
func @reordered_remat(%arg0: f32) {
func.func @reordered_remat(%arg0: f32) {
sair.program {
%0 = sair.from_scalar %arg0 : !sair.value<(), f32>
// CHECK: sair.copy
Expand Down
14 changes: 7 additions & 7 deletions test/default_storage.mlir
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: sair-opt %s -sair-assign-default-storage | FileCheck %s

// CHECK-LABEL: @memory_space_is_set
func @memory_space_is_set() {
func.func @memory_space_is_set() {
sair.program {
// CHECK: %{{.*}} = sair.map attributes {
// CHECK: storage = [{layout = #sair.named_mapping<[] -> ()>, space = "register"}]
Expand All @@ -16,7 +16,7 @@ func @memory_space_is_set() {
}

// CHECK-LABEL: @preserve_memory_space
func @preserve_memory_space() {
func.func @preserve_memory_space() {
sair.program {
// CHECK: %{{.*}} = sair.map attributes {
// CHECK: storage = [{layout = #sair.named_mapping<[] -> ()>, name = "A", space = "memory"}]
Expand All @@ -36,7 +36,7 @@ func @preserve_memory_space() {
}

// CHECK-LABEL: @multi_dim
func @multi_dim(%arg0: f32, %arg1: memref<8x8xf32>) {
func.func @multi_dim(%arg0: f32, %arg1: memref<8x8xf32>) {
%n = arith.constant 8 : index
sair.program {
%sn = sair.from_scalar %n : !sair.value<(), index>
Expand Down Expand Up @@ -79,7 +79,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>) {
func.func @to_memref_proj_fby(%arg0: f32, %arg1: memref<f32>) {
%n = arith.constant 8 : index
sair.program {
%sn = sair.from_scalar %n : !sair.value<(), index>
Expand Down Expand Up @@ -116,7 +116,7 @@ func @to_memref_proj_fby(%arg0: f32, %arg1: memref<f32>) {
}

// CHECK-LABEL: @propagate_storage
func @propagate_storage(%arg0: f32) {
func.func @propagate_storage(%arg0: f32) {
%n = arith.constant 8 : index
sair.program {
%sn = sair.from_scalar %n : !sair.value<(), index>
Expand All @@ -136,7 +136,7 @@ func @propagate_storage(%arg0: f32) {
}

// CHECK-LABEL: @non_rectangular
func @non_rectangular_shape(%arg0: f32, %arg1: index) {
func.func @non_rectangular_shape(%arg0: f32, %arg1: index) {
%n = arith.constant 8 : index
sair.program {
%sn = sair.from_scalar %n : !sair.value<(), index>
Expand Down Expand Up @@ -170,7 +170,7 @@ func @non_rectangular_shape(%arg0: f32, %arg1: index) {
}

// CHECK-LABEL: @buffer_reuse
func @buffer_reuse(%arg0: f32) {
func.func @buffer_reuse(%arg0: f32) {
%n = arith.constant 8 : index
sair.program {
%sn = sair.from_scalar %n : !sair.value<(), index>
Expand Down
10 changes: 5 additions & 5 deletions test/default_storage_invalid.mlir
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: sair-opt -sair-assign-default-storage -split-input-file -verify-diagnostics %s

func @expected_loop_nest(%arg0: f32) {
func.func @expected_loop_nest(%arg0: f32) {
sair.program {
%0 = sair.from_scalar %arg0 : !sair.value<(), f32>
// expected-error @+1 {{expected a loop-nest attribute}}
Expand All @@ -14,7 +14,7 @@ func @expected_loop_nest(%arg0: f32) {

// -----

func @index_to_memory(%arg0: index) {
func.func @index_to_memory(%arg0: index) {
sair.program {
%0 = sair.from_scalar %arg0 : !sair.value<(), index>
%1 = sair.dyn_range %0 : !sair.dyn_range
Expand All @@ -36,7 +36,7 @@ func @index_to_memory(%arg0: index) {

// -----

func @non_rectangular_shape(%arg0: f32, %arg1: index) {
func.func @non_rectangular_shape(%arg0: f32, %arg1: index) {
// expected-error @+1 {{unable to generate storage attributes}}
sair.program {
%0 = sair.from_scalar %arg0 : !sair.value<(), f32>
Expand Down Expand Up @@ -67,7 +67,7 @@ func @non_rectangular_shape(%arg0: f32, %arg1: index) {

// -----

func @incomplete_loop_nest(%arg0: memref<4xf32>, %arg1: index) {
func.func @incomplete_loop_nest(%arg0: memref<4xf32>, %arg1: index) {
%c = arith.constant 42.0 : f32
sair.program {
%n = sair.from_scalar %arg1 : !sair.value<(), index>
Expand All @@ -87,7 +87,7 @@ func @incomplete_loop_nest(%arg0: memref<4xf32>, %arg1: index) {

// -----

func @increase_external_buffer_rank(%arg0: memref<f32>, %arg1: index) {
func.func @increase_external_buffer_rank(%arg0: memref<f32>, %arg1: index) {
sair.program {
%n = sair.from_scalar %arg1 : !sair.value<(), index>
%r = sair.dyn_range %n : !sair.dyn_range
Expand Down
Loading