Skip to content

Commit

Permalink
Added all domain split unit tests but one
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Müller committed Feb 8, 2021
1 parent 91a80a4 commit b5982ac
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 80 deletions.
59 changes: 59 additions & 0 deletions test/Dialect/Stencil/domain-split-canonicalize.mlir
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// RUN: oec-opt %s --stencil-domain-split --canonicalize | oec-opt | FileCheck %s

// CHECK-LABEL: func @split_apply_multiple_results
func @split_apply_multiple_results(%arg0: !stencil.field<?x?x?xf64>, %arg1: !stencil.field<?x?x?xf64>) attributes {stencil.program} {
%0 = stencil.cast %arg0([-4, -4, -4] : [68, 68, 68]) : (!stencil.field<?x?x?xf64>) -> !stencil.field<72x72x72xf64>
%1 = stencil.cast %arg1([-4, -4, -4] : [132, 132, 132]) : (!stencil.field<?x?x?xf64>) -> !stencil.field<136x136x136xf64>
// CHECK: [[VAL2:%.*]] = stencil.apply -> !stencil.temp<?x?x?xf64> {
// CHECK: %cst = constant 1.000000e+00 : f64
// CHECK: [[VAL3:%.*]] = stencil.apply -> !stencil.temp<?x?x?xf64> {
// CHECK: %cst = constant 2.000000e+00 : f64
%2:2 = stencil.apply -> (!stencil.temp<?x?x?xf64>, !stencil.temp<?x?x?xf64>) {
%one = constant 1.000000e+00 : f64
%two = constant 2.000000e+00 : f64
%3 = stencil.store_result %one : (f64) -> !stencil.result<f64>
%4 = stencil.store_result %two : (f64) -> !stencil.result<f64>
stencil.return %3, %4 : !stencil.result<f64>, !stencil.result<f64>
}
// CHECK: stencil.store [[VAL2]] to %0([0, 0, 0] : [64, 64, 64]) : !stencil.temp<?x?x?xf64> to !stencil.field<72x72x72xf64>
stencil.store %2#0 to %0([0, 0, 0] : [64, 64, 64]) : !stencil.temp<?x?x?xf64> to !stencil.field<72x72x72xf64>
// CHECK: stencil.store [[VAL3]] to %1([0, 0, 0] : [128, 128, 128]) : !stencil.temp<?x?x?xf64> to !stencil.field<136x136x136xf64>
stencil.store %2#1 to %1([0, 0, 0] : [128, 128, 128]) : !stencil.temp<?x?x?xf64> to !stencil.field<136x136x136xf64>
return
}


// -----

// CHECK-LABEL: func @split_rhombus_multiple_results
func @split_rhombus_multiple_results(%arg0: !stencil.field<?x?x?xf64>, %arg1: !stencil.field<?x?x?xf64>, %arg100: !stencil.field<?x?x?xf64>, %arg101: !stencil.field<?x?x?xf64>) attributes {stencil.program} {
%0 = stencil.cast %arg0([-4, -4, -4] : [68, 68, 68]) : (!stencil.field<?x?x?xf64>) -> !stencil.field<72x72x72xf64>
%1 = stencil.cast %arg1([-4, -4, -4] : [132, 132, 132]) : (!stencil.field<?x?x?xf64>) -> !stencil.field<136x136x136xf64>
%100 = stencil.cast %arg100([-4, -4, -4] : [132, 132, 132]) : (!stencil.field<?x?x?xf64>) -> !stencil.field<136x136x136xf64>
%101 = stencil.cast %arg101([-4, -4, -4] : [132, 132, 132]) : (!stencil.field<?x?x?xf64>) -> !stencil.field<136x136x136xf64>
%2:3 = stencil.apply -> (!stencil.temp<?x?x?xf64>, !stencil.temp<?x?x?xf64>, !stencil.temp<?x?x?xf64>) {
%cst = constant 1.000000e+00 : f64
%6 = stencil.store_result %cst : (f64) -> !stencil.result<f64>
stencil.return %6, %6, %6 : !stencil.result<f64>, !stencil.result<f64>, !stencil.result<f64>
}
%3:3 = stencil.apply(%arg2 = %2#0 : !stencil.temp<?x?x?xf64>, %arg3 = %2#1 : !stencil.temp<?x?x?xf64>, %arg4 = %2#2 : !stencil.temp<?x?x?xf64>) -> (!stencil.temp<?x?x?xf64>, !stencil.temp<?x?x?xf64>, !stencil.temp<?x?x?xf64>) {
%cst = constant 2.000000e+00 : f64
%6 = stencil.store_result %cst : (f64) -> !stencil.result<f64>
stencil.return %6, %6, %6 : !stencil.result<f64>, !stencil.result<f64>, !stencil.result<f64>
}
%4:3 = stencil.apply(%arg2 = %2#0 : !stencil.temp<?x?x?xf64>, %arg3 = %2#1 : !stencil.temp<?x?x?xf64>, %arg4 = %2#2 : !stencil.temp<?x?x?xf64>) -> (!stencil.temp<?x?x?xf64>, !stencil.temp<?x?x?xf64>, !stencil.temp<?x?x?xf64>) {
%cst = constant 3.000000e+00 : f64
%6 = stencil.store_result %cst : (f64) -> !stencil.result<f64>
stencil.return %6, %6, %6 : !stencil.result<f64>, !stencil.result<f64>, !stencil.result<f64>
}
%5:3 = stencil.apply(%arg2 = %3#0 : !stencil.temp<?x?x?xf64>, %arg3 = %3#1 : !stencil.temp<?x?x?xf64>, %arg4 = %3#2 : !stencil.temp<?x?x?xf64>, %arg5 = %4#0 : !stencil.temp<?x?x?xf64>, %arg6 = %4#1 : !stencil.temp<?x?x?xf64>, %arg7 = %4#2 : !stencil.temp<?x?x?xf64>) -> (!stencil.temp<?x?x?xf64>, !stencil.temp<?x?x?xf64>, !stencil.temp<?x?x?xf64>) {
%cst = constant 4.000000e+00 : f64
%6 = stencil.store_result %cst : (f64) -> !stencil.result<f64>
stencil.return %6, %6, %6 : !stencil.result<f64>, !stencil.result<f64>, !stencil.result<f64>
}
stencil.store %5#0 to %0([0, 0, 0] : [64, 64, 64]) : !stencil.temp<?x?x?xf64> to !stencil.field<72x72x72xf64>
stencil.store %5#0 to %1([0, 0, 0] : [128, 128, 128]) : !stencil.temp<?x?x?xf64> to !stencil.field<136x136x136xf64>
stencil.store %5#1 to %100([0, 0, 0] : [128, 128, 128]) : !stencil.temp<?x?x?xf64> to !stencil.field<136x136x136xf64>
stencil.store %5#2 to %101([0, 0, 0] : [128, 128, 128]) : !stencil.temp<?x?x?xf64> to !stencil.field<136x136x136xf64>
return
}
Loading

0 comments on commit b5982ac

Please sign in to comment.