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

transformations: (csl) use constants instead of params #3319

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 3 additions & 3 deletions tests/filecheck/dialects/csl/csl-wrapper-ops.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

builtin.module {
"csl_wrapper.module"() <{"width"=10 : i16, "height"=10: i16, "params" = [
#csl_wrapper.param<"z_dim" default=4: i16>, #csl_wrapper.param<"pattern" : i16>
#csl_wrapper.param<"z_dim" value=4: i16>, #csl_wrapper.param<"pattern" value=2: i16>
]}> ({
^0(%x: i16, %y: i16, %width: i16, %height: i16, %z_dim: i16, %pattern: i16):
%0 = arith.constant 0 : i16
Expand Down Expand Up @@ -40,7 +40,7 @@ builtin.module {


// CHECK: builtin.module {
// CHECK-NEXT: "csl_wrapper.module"() <{"width" = 10 : i16, "height" = 10 : i16, "params" = [#csl_wrapper.param<"z_dim" default=4 : i16>, #csl_wrapper.param<"pattern" : i16>]}> ({
// CHECK-NEXT: "csl_wrapper.module"() <{"width" = 10 : i16, "height" = 10 : i16, "params" = [#csl_wrapper.param<"z_dim" value=4 : i16>, #csl_wrapper.param<"pattern" value=2 : i16>]}> ({
// CHECK-NEXT: ^0(%x : i16, %y : i16, %width : i16, %height : i16, %z_dim : i16, %pattern : i16):
// CHECK-NEXT: %0 = arith.constant 0 : i16
// CHECK-NEXT: %1 = "csl.get_color"(%0) : (i16) -> !csl.color
Expand Down Expand Up @@ -71,7 +71,7 @@ builtin.module {


// CHECK-GENERIC: "builtin.module"() ({
// CHECK-GENERIC-NEXT: "csl_wrapper.module"() <{"width" = 10 : i16, "height" = 10 : i16, "params" = [#csl_wrapper.param<"z_dim" default=4 : i16>, #csl_wrapper.param<"pattern" : i16>]}> ({
// CHECK-GENERIC-NEXT: "csl_wrapper.module"() <{"width" = 10 : i16, "height" = 10 : i16, "params" = [#csl_wrapper.param<"z_dim" value=4 : i16>, #csl_wrapper.param<"pattern" value=2 : i16>]}> ({
// CHECK-GENERIC-NEXT: ^0(%x : i16, %y : i16, %width : i16, %height : i16, %z_dim : i16, %pattern : i16):
// CHECK-GENERIC-NEXT: %0 = "arith.constant"() <{"value" = 0 : i16}> : () -> i16
// CHECK-GENERIC-NEXT: %1 = "csl.get_color"(%0) : (i16) -> !csl.color
Expand Down
4 changes: 2 additions & 2 deletions tests/filecheck/transforms/csl-stencil-handle-async-flow.mlir
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: xdsl-opt %s -p "csl-stencil-handle-async-flow" | filecheck %s

"csl_wrapper.module"() <{"width" = 1022 : i16, "height" = 510 : i16, "params" = [#csl_wrapper.param<"z_dim" default=512 : i16>, #csl_wrapper.param<"pattern" default=2 : i16>, #csl_wrapper.param<"num_chunks" default=2 : i16>, #csl_wrapper.param<"chunk_size" default=255 : i16>, #csl_wrapper.param<"padded_z_dim" default=510 : i16>], "program_name" = "gauss_seidel_func"}> ({
"csl_wrapper.module"() <{"width" = 1022 : i16, "height" = 510 : i16, "params" = [#csl_wrapper.param<"z_dim" value=512 : i16>, #csl_wrapper.param<"pattern" value=2 : i16>, #csl_wrapper.param<"num_chunks" value=2 : i16>, #csl_wrapper.param<"chunk_size" value=255 : i16>, #csl_wrapper.param<"padded_z_dim" value=510 : i16>], "program_name" = "gauss_seidel_func"}> ({
^0(%0 : i16, %1 : i16, %2 : i16, %3 : i16, %4 : i16, %5 : i16, %6 : i16, %7 : i16, %8 : i16):
%9 = arith.constant 0 : i16
%10 = "csl.get_color"(%9) : (i16) -> !csl.color
Expand Down Expand Up @@ -67,7 +67,7 @@
}) : () -> ()


// CHECK: "csl_wrapper.module"() <{"width" = 1022 : i16, "height" = 510 : i16, "params" = [#csl_wrapper.param<"z_dim" default=512 : i16>, #csl_wrapper.param<"pattern" default=2 : i16>, #csl_wrapper.param<"num_chunks" default=2 : i16>, #csl_wrapper.param<"chunk_size" default=255 : i16>, #csl_wrapper.param<"padded_z_dim" default=510 : i16>], "program_name" = "gauss_seidel_func"}> ({
// CHECK: "csl_wrapper.module"() <{"width" = 1022 : i16, "height" = 510 : i16, "params" = [#csl_wrapper.param<"z_dim" value=512 : i16>, #csl_wrapper.param<"pattern" value=2 : i16>, #csl_wrapper.param<"num_chunks" value=2 : i16>, #csl_wrapper.param<"chunk_size" value=255 : i16>, #csl_wrapper.param<"padded_z_dim" value=510 : i16>], "program_name" = "gauss_seidel_func"}> ({
// CHECK-NEXT: ^0(%0 : i16, %1 : i16, %2 : i16, %3 : i16, %4 : i16, %5 : i16, %6 : i16, %7 : i16, %8 : i16):
// CHECK-NEXT: %9 = arith.constant 0 : i16
// CHECK-NEXT: %10 = "csl.get_color"(%9) : (i16) -> !csl.color
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: xdsl-opt -p csl-stencil-materialize-stores %s | filecheck %s

builtin.module {
"csl_wrapper.module"() <{"height" = 512 : i16, "params" = [#csl_wrapper.param<"z_dim" default=512 : i16>, #csl_wrapper.param<"pattern" default=2 : i16>, #csl_wrapper.param<"num_chunks" default=1 : i16>, #csl_wrapper.param<"chunk_size" default=510 : i16>, #csl_wrapper.param<"padded_z_dim" default=510 : i16>], "program_name" = "gauss_seidel", "width" = 1024 : i16}> ({
"csl_wrapper.module"() <{"height" = 512 : i16, "params" = [#csl_wrapper.param<"z_dim" value=512 : i16>, #csl_wrapper.param<"pattern" value=2 : i16>, #csl_wrapper.param<"num_chunks" value=1 : i16>, #csl_wrapper.param<"chunk_size" value=510 : i16>, #csl_wrapper.param<"padded_z_dim" value=510 : i16>], "program_name" = "gauss_seidel", "width" = 1024 : i16}> ({
^0(%arg0 : i16, %arg1 : i16, %arg2 : i16, %arg3 : i16, %arg4 : i16, %arg5 : i16, %arg6 : i16, %arg7 : i16, %arg8 : i16):
%0 = arith.constant 0 : i16
%1 = "csl.get_color"(%0) : (i16) -> !csl.color
Expand Down Expand Up @@ -65,7 +65,7 @@ builtin.module {
}

// CHECK-NEXT: builtin.module {
// CHECK-NEXT: "csl_wrapper.module"() <{"height" = 512 : i16, "params" = [#csl_wrapper.param<"z_dim" default=512 : i16>, #csl_wrapper.param<"pattern" default=2 : i16>, #csl_wrapper.param<"num_chunks" default=1 : i16>, #csl_wrapper.param<"chunk_size" default=510 : i16>, #csl_wrapper.param<"padded_z_dim" default=510 : i16>], "program_name" = "gauss_seidel", "width" = 1024 : i16}> ({
// CHECK-NEXT: "csl_wrapper.module"() <{"height" = 512 : i16, "params" = [#csl_wrapper.param<"z_dim" value=512 : i16>, #csl_wrapper.param<"pattern" value=2 : i16>, #csl_wrapper.param<"num_chunks" value=1 : i16>, #csl_wrapper.param<"chunk_size" value=510 : i16>, #csl_wrapper.param<"padded_z_dim" value=510 : i16>], "program_name" = "gauss_seidel", "width" = 1024 : i16}> ({
// CHECK-NEXT: ^0(%arg0 : i16, %arg1 : i16, %arg2 : i16, %arg3 : i16, %arg4 : i16, %arg5 : i16, %arg6 : i16, %arg7 : i16, %arg8 : i16):
// CHECK-NEXT: %0 = arith.constant 0 : i16
// CHECK-NEXT: %1 = "csl.get_color"(%0) : (i16) -> !csl.color
Expand Down
4 changes: 2 additions & 2 deletions tests/filecheck/transforms/csl-stencil-to-csl-wrapper.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func.func @gauss_seidel(%a : !stencil.field<[-1,1023]x[-1,511]xtensor<512xf32>>,
func.return
}

// CHECK: "csl_wrapper.module"() <{"width" = 1024 : i16, "height" = 512 : i16, "params" = [#csl_wrapper.param<"z_dim" default=512 : i16>, #csl_wrapper.param<"pattern" default=2 : i16>, #csl_wrapper.param<"num_chunks" default=2 : i16>, #csl_wrapper.param<"chunk_size" default=255 : i16>, #csl_wrapper.param<"padded_z_dim" default=510 : i16>], "program_name" = "gauss_seidel"}> ({
// CHECK: "csl_wrapper.module"() <{"width" = 1024 : i16, "height" = 512 : i16, "params" = [#csl_wrapper.param<"z_dim" value=512 : i16>, #csl_wrapper.param<"pattern" value=2 : i16>, #csl_wrapper.param<"num_chunks" value=2 : i16>, #csl_wrapper.param<"chunk_size" value=255 : i16>, #csl_wrapper.param<"padded_z_dim" value=510 : i16>], "program_name" = "gauss_seidel"}> ({
// CHECK-NEXT: ^0(%0 : i16, %1 : i16, %2 : i16, %3 : i16, %4 : i16, %5 : i16, %6 : i16, %7 : i16, %8 : i16):
// CHECK-NEXT: %9 = arith.constant 0 : i16
// CHECK-NEXT: %10 = "csl.get_color"(%9) : (i16) -> !csl.color
Expand Down Expand Up @@ -129,7 +129,7 @@ func.func private @timer_start() -> f64
func.func private @timer_end(f64) -> f64


// CHECK: "csl_wrapper.module"() <{"width" = 1024 : i16, "height" = 512 : i16, "params" = [#csl_wrapper.param<"z_dim" default=512 : i16>, #csl_wrapper.param<"pattern" default=2 : i16>, #csl_wrapper.param<"num_chunks" default=2 : i16>, #csl_wrapper.param<"chunk_size" default=255 : i16>, #csl_wrapper.param<"padded_z_dim" default=510 : i16>], "program_name" = "bufferized"}> ({
// CHECK: "csl_wrapper.module"() <{"width" = 1024 : i16, "height" = 512 : i16, "params" = [#csl_wrapper.param<"z_dim" value=512 : i16>, #csl_wrapper.param<"pattern" value=2 : i16>, #csl_wrapper.param<"num_chunks" value=2 : i16>, #csl_wrapper.param<"chunk_size" value=255 : i16>, #csl_wrapper.param<"padded_z_dim" value=510 : i16>], "program_name" = "bufferized"}> ({
// CHECK-NEXT: ^2(%43 : i16, %44 : i16, %45 : i16, %46 : i16, %47 : i16, %48 : i16, %49 : i16, %50 : i16, %51 : i16):
// CHECK-NEXT: %52 = arith.constant 0 : i16
// CHECK-NEXT: %53 = "csl.get_color"(%52) : (i16) -> !csl.color
Expand Down
16 changes: 8 additions & 8 deletions tests/filecheck/transforms/lower-csl-stencil.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
builtin.module {
// CHECK-NEXT: builtin.module {

"csl_wrapper.module"() <{"width" = 1022 : i16, "height" = 510 : i16, "params" = [#csl_wrapper.param<"z_dim" default=512 : i16>, #csl_wrapper.param<"pattern" default=2 : i16>, #csl_wrapper.param<"num_chunks" default=2 : i16>, #csl_wrapper.param<"chunk_size" default=255 : i16>, #csl_wrapper.param<"padded_z_dim" default=510 : i16>], "program_name" = "gauss_seidel_func"}> ({
"csl_wrapper.module"() <{"width" = 1022 : i16, "height" = 510 : i16, "params" = [#csl_wrapper.param<"z_dim" value=512 : i16>, #csl_wrapper.param<"pattern" value=2 : i16>, #csl_wrapper.param<"num_chunks" value=2 : i16>, #csl_wrapper.param<"chunk_size" value=255 : i16>, #csl_wrapper.param<"padded_z_dim" value=510 : i16>], "program_name" = "gauss_seidel_func"}> ({
^0(%0 : i16, %1 : i16, %2 : i16, %3 : i16, %4 : i16, %5 : i16, %6 : i16, %7 : i16, %8 : i16):
%9 = arith.constant 0 : i16
%10 = "csl.get_color"(%9) : (i16) -> !csl.color
Expand Down Expand Up @@ -62,7 +62,7 @@ builtin.module {
"csl_wrapper.yield"() <{"fields" = []}> : () -> ()
}) : () -> ()

// CHECK-NEXT: "csl_wrapper.module"() <{"width" = 1022 : i16, "height" = 510 : i16, "params" = [#csl_wrapper.param<"z_dim" default=512 : i16>, #csl_wrapper.param<"pattern" default=2 : i16>, #csl_wrapper.param<"num_chunks" default=2 : i16>, #csl_wrapper.param<"chunk_size" default=255 : i16>, #csl_wrapper.param<"padded_z_dim" default=510 : i16>], "program_name" = "gauss_seidel_func"}> ({
// CHECK-NEXT: "csl_wrapper.module"() <{"width" = 1022 : i16, "height" = 510 : i16, "params" = [#csl_wrapper.param<"z_dim" value=512 : i16>, #csl_wrapper.param<"pattern" value=2 : i16>, #csl_wrapper.param<"num_chunks" value=2 : i16>, #csl_wrapper.param<"chunk_size" value=255 : i16>, #csl_wrapper.param<"padded_z_dim" value=510 : i16>], "program_name" = "gauss_seidel_func"}> ({
// CHECK-NEXT: ^0(%0 : i16, %1 : i16, %2 : i16, %3 : i16, %4 : i16, %5 : i16, %6 : i16, %7 : i16, %8 : i16):
// CHECK-NEXT: %9 = arith.constant 0 : i16
// CHECK-NEXT: %10 = "csl.get_color"(%9) : (i16) -> !csl.color
Expand Down Expand Up @@ -126,7 +126,7 @@ builtin.module {
// CHECK-NEXT: }) : () -> ()


"csl_wrapper.module"() <{"height" = 512 : i16, "params" = [#csl_wrapper.param<"z_dim" default=512 : i16>, #csl_wrapper.param<"pattern" default=2 : i16>, #csl_wrapper.param<"num_chunks" default=1 : i16>, #csl_wrapper.param<"chunk_size" default=510 : i16>, #csl_wrapper.param<"padded_z_dim" default=510 : i16>], "program_name" = "loop", "width" = 1024 : i16}> ({
"csl_wrapper.module"() <{"height" = 512 : i16, "params" = [#csl_wrapper.param<"z_dim" value=512 : i16>, #csl_wrapper.param<"pattern" value=2 : i16>, #csl_wrapper.param<"num_chunks" value=1 : i16>, #csl_wrapper.param<"chunk_size" value=510 : i16>, #csl_wrapper.param<"padded_z_dim" value=510 : i16>], "program_name" = "loop", "width" = 1024 : i16}> ({
^0(%arg0 : i16, %arg1 : i16, %arg2 : i16, %arg3 : i16, %arg4 : i16, %arg5 : i16, %arg6 : i16, %arg7 : i16, %arg8 : i16):
%0 = arith.constant 0 : i16
%1 = "csl.get_color"(%0) : (i16) -> !csl.color
Expand Down Expand Up @@ -234,7 +234,7 @@ builtin.module {
"csl_wrapper.yield"() <{"fields" = []}> : () -> ()
}) : () -> ()

// CHECK-NEXT: "csl_wrapper.module"() <{"height" = 512 : i16, "params" = [#csl_wrapper.param<"z_dim" default=512 : i16>, #csl_wrapper.param<"pattern" default=2 : i16>, #csl_wrapper.param<"num_chunks" default=1 : i16>, #csl_wrapper.param<"chunk_size" default=510 : i16>, #csl_wrapper.param<"padded_z_dim" default=510 : i16>], "program_name" = "loop", "width" = 1024 : i16}> ({
// CHECK-NEXT: "csl_wrapper.module"() <{"height" = 512 : i16, "params" = [#csl_wrapper.param<"z_dim" value=512 : i16>, #csl_wrapper.param<"pattern" value=2 : i16>, #csl_wrapper.param<"num_chunks" value=1 : i16>, #csl_wrapper.param<"chunk_size" value=510 : i16>, #csl_wrapper.param<"padded_z_dim" value=510 : i16>], "program_name" = "loop", "width" = 1024 : i16}> ({
// CHECK-NEXT: ^2(%arg0_1 : i16, %arg1_1 : i16, %arg2 : i16, %arg3 : i16, %arg4 : i16, %arg5 : i16, %arg6 : i16, %arg7 : i16, %arg8 : i16):
// CHECK-NEXT: %50 = arith.constant 0 : i16
// CHECK-NEXT: %51 = "csl.get_color"(%50) : (i16) -> !csl.color
Expand Down Expand Up @@ -349,7 +349,7 @@ builtin.module {
// CHECK-NEXT: }) : () -> ()


"csl_wrapper.module"() <{"width" = 1022 : i16, "height" = 510 : i16, "params" = [#csl_wrapper.param<"z_dim" default=512 : i16>, #csl_wrapper.param<"pattern" default=2 : i16>, #csl_wrapper.param<"num_chunks" default=2 : i16>, #csl_wrapper.param<"chunk_size" default=255 : i16>, #csl_wrapper.param<"padded_z_dim" default=510 : i16>], "program_name" = "partial_access"}> ({
"csl_wrapper.module"() <{"width" = 1022 : i16, "height" = 510 : i16, "params" = [#csl_wrapper.param<"z_dim" value=512 : i16>, #csl_wrapper.param<"pattern" value=2 : i16>, #csl_wrapper.param<"num_chunks" value=2 : i16>, #csl_wrapper.param<"chunk_size" value=255 : i16>, #csl_wrapper.param<"padded_z_dim" value=510 : i16>], "program_name" = "partial_access"}> ({
^0(%0 : i16, %1 : i16, %2 : i16, %3 : i16, %4 : i16, %5 : i16, %6 : i16, %7 : i16, %8 : i16):
%9 = arith.constant 0 : i16
%10 = "csl.get_color"(%9) : (i16) -> !csl.color
Expand Down Expand Up @@ -406,7 +406,7 @@ builtin.module {
"csl_wrapper.yield"() <{"fields" = []}> : () -> ()
}) : () -> ()

// CHECK-NEXT: "csl_wrapper.module"() <{"width" = 1022 : i16, "height" = 510 : i16, "params" = [#csl_wrapper.param<"z_dim" default=512 : i16>, #csl_wrapper.param<"pattern" default=2 : i16>, #csl_wrapper.param<"num_chunks" default=2 : i16>, #csl_wrapper.param<"chunk_size" default=255 : i16>, #csl_wrapper.param<"padded_z_dim" default=510 : i16>], "program_name" = "partial_access"}> ({
// CHECK-NEXT: "csl_wrapper.module"() <{"width" = 1022 : i16, "height" = 510 : i16, "params" = [#csl_wrapper.param<"z_dim" value=512 : i16>, #csl_wrapper.param<"pattern" value=2 : i16>, #csl_wrapper.param<"num_chunks" value=2 : i16>, #csl_wrapper.param<"chunk_size" value=255 : i16>, #csl_wrapper.param<"padded_z_dim" value=510 : i16>], "program_name" = "partial_access"}> ({
// CHECK-NEXT: ^4(%101 : i16, %102 : i16, %103 : i16, %104 : i16, %105 : i16, %106 : i16, %107 : i16, %108 : i16, %109 : i16):
// CHECK-NEXT: %110 = arith.constant 0 : i16
// CHECK-NEXT: %111 = "csl.get_color"(%110) : (i16) -> !csl.color
Expand Down Expand Up @@ -477,7 +477,7 @@ builtin.module {
// CHECK-NEXT: "csl_wrapper.yield"() <{"fields" = []}> : () -> ()
// CHECK-NEXT: }) : () -> ()

"csl_wrapper.module"() <{"height" = 512 : i16, "params" = [#csl_wrapper.param<"z_dim" default=511 : i16>, #csl_wrapper.param<"pattern" default=2 : i16>, #csl_wrapper.param<"num_chunks" default=1 : i16>, #csl_wrapper.param<"chunk_size" default=510 : i16>, #csl_wrapper.param<"padded_z_dim" default=510 : i16>], "program_name" = "chunk_reduce_only", "width" = 1024 : i16}> ({
"csl_wrapper.module"() <{"height" = 512 : i16, "params" = [#csl_wrapper.param<"z_dim" value=511 : i16>, #csl_wrapper.param<"pattern" value=2 : i16>, #csl_wrapper.param<"num_chunks" value=1 : i16>, #csl_wrapper.param<"chunk_size" value=510 : i16>, #csl_wrapper.param<"padded_z_dim" value=510 : i16>], "program_name" = "chunk_reduce_only", "width" = 1024 : i16}> ({
^0(%arg0 : i16, %arg1 : i16, %arg2 : i16, %arg3 : i16, %arg4 : i16, %arg5 : i16, %arg6 : i16, %arg7 : i16, %arg8 : i16):
%0 = arith.constant 1 : i16
%1 = arith.constant 0 : i16
Expand Down Expand Up @@ -579,7 +579,7 @@ builtin.module {
"csl_wrapper.yield"() <{"fields" = []}> : () -> ()
}) : () -> ()

// CHECK-NEXT: "csl_wrapper.module"() <{"height" = 512 : i16, "params" = [#csl_wrapper.param<"z_dim" default=511 : i16>, #csl_wrapper.param<"pattern" default=2 : i16>, #csl_wrapper.param<"num_chunks" default=1 : i16>, #csl_wrapper.param<"chunk_size" default=510 : i16>, #csl_wrapper.param<"padded_z_dim" default=510 : i16>], "program_name" = "chunk_reduce_only", "width" = 1024 : i16}> ({
// CHECK-NEXT: "csl_wrapper.module"() <{"height" = 512 : i16, "params" = [#csl_wrapper.param<"z_dim" value=511 : i16>, #csl_wrapper.param<"pattern" value=2 : i16>, #csl_wrapper.param<"num_chunks" value=1 : i16>, #csl_wrapper.param<"chunk_size" value=510 : i16>, #csl_wrapper.param<"padded_z_dim" value=510 : i16>], "program_name" = "chunk_reduce_only", "width" = 1024 : i16}> ({
// CHECK-NEXT: ^6(%arg0_4 : i16, %arg1_4 : i16, %arg2_2 : i16, %arg3_2 : i16, %arg4_2 : i16, %arg5_2 : i16, %arg6_2 : i16, %arg7_2 : i16, %arg8_2 : i16):
// CHECK-NEXT: %158 = arith.constant 1 : i16
// CHECK-NEXT: %159 = arith.constant 0 : i16
Expand Down
Loading
Loading