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: stencil bufferization polish #3001

Merged
merged 18 commits into from
Aug 17, 2024
Merged
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
115 changes: 115 additions & 0 deletions tests/filecheck/dialects/stencil/oec-kernels/fvtp2d_qi.mlir
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// RUN: XDSL_ROUNDTRIP
// RUN: xdsl-opt %s -p stencil-storage-materialization,stencil-shape-inference | filecheck %s --check-prefix SHAPE
// RUN: xdsl-opt %s -p stencil-storage-materialization,stencil-shape-inference,convert-stencil-to-ll-mlir | filecheck %s --check-prefix MLIR
// RUN: xdsl-opt %s -p stencil-storage-materialization,stencil-shape-inference,stencil-bufferize | filecheck %s --check-prefix BUFF

func.func @fvtp2d_qi(%arg0: !stencil.field<?x?x?xf64>, %arg1: !stencil.field<?x?x?xf64>, %arg2: !stencil.field<?x?x?xf64>, %arg3: !stencil.field<?x?x?xf64>, %arg4: !stencil.field<?x?x?xf64>, %arg5: !stencil.field<?x?x?xf64>, %arg6: !stencil.field<?x?x?xf64>) attributes {stencil.program} {
%0 = stencil.cast %arg0 : !stencil.field<?x?x?xf64> -> !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
Expand Down Expand Up @@ -547,3 +548,117 @@ func.func @fvtp2d_qi(%arg0: !stencil.field<?x?x?xf64>, %arg1: !stencil.field<?x?
// MLIR-NEXT: memref.dealloc %arg8 : memref<64x67x64xf64, strided<[4288, 64, 1], offset: 64>>
// MLIR-NEXT: func.return
// MLIR-NEXT: }

// BUFF: func.func @fvtp2d_qi(%arg0 : !stencil.field<?x?x?xf64>, %arg1 : !stencil.field<?x?x?xf64>, %arg2 : !stencil.field<?x?x?xf64>, %arg3 : !stencil.field<?x?x?xf64>, %arg4 : !stencil.field<?x?x?xf64>, %arg5 : !stencil.field<?x?x?xf64>, %arg6 : !stencil.field<?x?x?xf64>) attributes {"stencil.program"}{
// BUFF-NEXT: %0 = stencil.alloc : !stencil.field<[0,64]x[0,65]x[0,64]xf64>
// BUFF-NEXT: %1 = stencil.alloc : !stencil.field<[0,64]x[-1,65]x[0,64]xf64>
// BUFF-NEXT: %2 = stencil.alloc : !stencil.field<[0,64]x[-1,65]x[0,64]xf64>
// BUFF-NEXT: %3 = stencil.alloc : !stencil.field<[0,64]x[-1,65]x[0,64]xf64>
// BUFF-NEXT: %4 = stencil.alloc : !stencil.field<[0,64]x[-1,65]x[0,64]xf64>
// BUFF-NEXT: %5 = stencil.alloc : !stencil.field<[0,64]x[-1,66]x[0,64]xf64>
// BUFF-NEXT: %6 = stencil.cast %arg0 : !stencil.field<?x?x?xf64> -> !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// BUFF-NEXT: %7 = stencil.cast %arg1 : !stencil.field<?x?x?xf64> -> !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// BUFF-NEXT: %8 = stencil.cast %arg2 : !stencil.field<?x?x?xf64> -> !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// BUFF-NEXT: %9 = stencil.cast %arg3 : !stencil.field<?x?x?xf64> -> !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// BUFF-NEXT: %10 = stencil.cast %arg4 : !stencil.field<?x?x?xf64> -> !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// BUFF-NEXT: %11 = stencil.cast %arg5 : !stencil.field<?x?x?xf64> -> !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// BUFF-NEXT: %12 = stencil.cast %arg6 : !stencil.field<?x?x?xf64> -> !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// BUFF-NEXT: stencil.apply(%arg7 = %6 : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>) outs (%5 : !stencil.field<[0,64]x[-1,66]x[0,64]xf64>) {
// BUFF-NEXT: %cst = arith.constant 1.000000e+00 : f64
// BUFF-NEXT: %cst_1 = arith.constant 7.000000e+00 : f64
// BUFF-NEXT: %cst_2 = arith.constant 1.200000e+01 : f64
// BUFF-NEXT: %13 = arith.divf %cst_1, %cst_2 : f64
// BUFF-NEXT: %14 = arith.divf %cst, %cst_2 : f64
// BUFF-NEXT: %15 = stencil.access %arg7[0, -1, 0] : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// BUFF-NEXT: %16 = stencil.access %arg7[0, 0, 0] : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// BUFF-NEXT: %17 = arith.addf %15, %16 : f64
// BUFF-NEXT: %18 = stencil.access %arg7[0, -2, 0] : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// BUFF-NEXT: %19 = stencil.access %arg7[0, 1, 0] : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// BUFF-NEXT: %20 = arith.addf %18, %19 : f64
// BUFF-NEXT: %21 = arith.mulf %13, %17 : f64
// BUFF-NEXT: %22 = arith.mulf %14, %20 : f64
// BUFF-NEXT: %23 = arith.addf %21, %22 : f64
// BUFF-NEXT: %24 = stencil.store_result %23 : !stencil.result<f64>
// BUFF-NEXT: stencil.return %24 : !stencil.result<f64>
// BUFF-NEXT: } to <[0, -1, 0], [64, 66, 64]>
// BUFF-NEXT: stencil.apply(%arg7 = %6 : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>, %arg8 = %5 : !stencil.field<[0,64]x[-1,66]x[0,64]xf64>) outs (%4 : !stencil.field<[0,64]x[-1,65]x[0,64]xf64>, %3 : !stencil.field<[0,64]x[-1,65]x[0,64]xf64>, %2 : !stencil.field<[0,64]x[-1,65]x[0,64]xf64>, %1 : !stencil.field<[0,64]x[-1,65]x[0,64]xf64>) {
// BUFF-NEXT: %cst = arith.constant 0.000000e+00 : f64
// BUFF-NEXT: %cst_1 = arith.constant 1.000000e+00 : f64
// BUFF-NEXT: %13 = stencil.access %arg8[0, 0, 0] : !stencil.field<[0,64]x[-1,66]x[0,64]xf64>
// BUFF-NEXT: %14 = stencil.access %arg7[0, 0, 0] : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// BUFF-NEXT: %15 = arith.subf %13, %14 : f64
// BUFF-NEXT: %16 = stencil.access %arg8[0, 1, 0] : !stencil.field<[0,64]x[-1,66]x[0,64]xf64>
// BUFF-NEXT: %17 = arith.subf %16, %14 : f64
// BUFF-NEXT: %18 = arith.addf %15, %17 : f64
// BUFF-NEXT: %19 = arith.mulf %15, %17 : f64
// BUFF-NEXT: %20 = arith.cmpf olt, %19, %cst : f64
// BUFF-NEXT: %21 = arith.select %20, %cst_1, %cst : f64
// BUFF-NEXT: %22 = stencil.store_result %15 : !stencil.result<f64>
// BUFF-NEXT: %23 = stencil.store_result %17 : !stencil.result<f64>
// BUFF-NEXT: %24 = stencil.store_result %18 : !stencil.result<f64>
// BUFF-NEXT: %25 = stencil.store_result %21 : !stencil.result<f64>
// BUFF-NEXT: stencil.return %22, %23, %24, %25 : !stencil.result<f64>, !stencil.result<f64>, !stencil.result<f64>, !stencil.result<f64>
// BUFF-NEXT: } to <[0, -1, 0], [64, 65, 64]>
// BUFF-NEXT: stencil.apply(%arg7 = %6 : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>, %arg8 = %7 : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>, %arg9 = %4 : !stencil.field<[0,64]x[-1,65]x[0,64]xf64>, %arg10 = %3 : !stencil.field<[0,64]x[-1,65]x[0,64]xf64>, %arg11 = %2 : !stencil.field<[0,64]x[-1,65]x[0,64]xf64>, %arg12 = %1 : !stencil.field<[0,64]x[-1,65]x[0,64]xf64>) outs (%12 : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>) {
// BUFF-NEXT: %cst = arith.constant 0.000000e+00 : f64
// BUFF-NEXT: %cst_1 = arith.constant 1.000000e+00 : f64
// BUFF-NEXT: %13 = stencil.access %arg12[0, -1, 0] : !stencil.field<[0,64]x[-1,65]x[0,64]xf64>
// BUFF-NEXT: %14 = arith.cmpf oeq, %13, %cst : f64
// BUFF-NEXT: %15 = arith.select %14, %cst_1, %cst : f64
// BUFF-NEXT: %16 = stencil.access %arg12[0, 0, 0] : !stencil.field<[0,64]x[-1,65]x[0,64]xf64>
// BUFF-NEXT: %17 = arith.mulf %16, %15 : f64
// BUFF-NEXT: %18 = arith.addf %13, %17 : f64
// BUFF-NEXT: %19 = stencil.access %arg8[0, 0, 0] : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// BUFF-NEXT: %20 = arith.cmpf ogt, %19, %cst : f64
// BUFF-NEXT: %21 = "scf.if"(%20) ({
// BUFF-NEXT: %22 = stencil.access %arg10[0, -1, 0] : !stencil.field<[0,64]x[-1,65]x[0,64]xf64>
// BUFF-NEXT: %23 = stencil.access %arg11[0, -1, 0] : !stencil.field<[0,64]x[-1,65]x[0,64]xf64>
// BUFF-NEXT: %24 = arith.mulf %19, %23 : f64
// BUFF-NEXT: %25 = arith.subf %22, %24 : f64
// BUFF-NEXT: %26 = arith.subf %cst_1, %19 : f64
// BUFF-NEXT: %27 = arith.mulf %26, %25 : f64
// BUFF-NEXT: scf.yield %27 : f64
// BUFF-NEXT: }, {
// BUFF-NEXT: %28 = stencil.access %arg9[0, 0, 0] : !stencil.field<[0,64]x[-1,65]x[0,64]xf64>
// BUFF-NEXT: %29 = stencil.access %arg11[0, 0, 0] : !stencil.field<[0,64]x[-1,65]x[0,64]xf64>
// BUFF-NEXT: %30 = arith.mulf %19, %29 : f64
// BUFF-NEXT: %31 = arith.addf %28, %30 : f64
// BUFF-NEXT: %32 = arith.addf %cst_1, %19 : f64
// BUFF-NEXT: %33 = arith.mulf %32, %31 : f64
// BUFF-NEXT: scf.yield %33 : f64
// BUFF-NEXT: }) : (i1) -> f64
// BUFF-NEXT: %34 = arith.mulf %21, %18 : f64
// BUFF-NEXT: %35 = "scf.if"(%20) ({
// BUFF-NEXT: %36 = stencil.access %arg7[0, -1, 0] : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// BUFF-NEXT: %37 = arith.addf %36, %34 : f64
// BUFF-NEXT: scf.yield %37 : f64
// BUFF-NEXT: }, {
// BUFF-NEXT: %38 = stencil.access %arg7[0, 0, 0] : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// BUFF-NEXT: %39 = arith.addf %38, %34 : f64
// BUFF-NEXT: scf.yield %39 : f64
// BUFF-NEXT: }) : (i1) -> f64
// BUFF-NEXT: %40 = stencil.store_result %35 : !stencil.result<f64>
// BUFF-NEXT: stencil.return %40 : !stencil.result<f64>
// BUFF-NEXT: } to <[0, 0, 0], [64, 65, 64]>
// BUFF-NEXT: stencil.apply(%arg7 = %9 : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>, %arg8 = %12 : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>) outs (%0 : !stencil.field<[0,64]x[0,65]x[0,64]xf64>) {
// BUFF-NEXT: %13 = stencil.access %arg7[0, 0, 0] : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// BUFF-NEXT: %14 = stencil.access %arg8[0, 0, 0] : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// BUFF-NEXT: %15 = arith.mulf %13, %14 : f64
// BUFF-NEXT: %16 = stencil.store_result %15 : !stencil.result<f64>
// BUFF-NEXT: stencil.return %16 : !stencil.result<f64>
// BUFF-NEXT: } to <[0, 0, 0], [64, 65, 64]>
// BUFF-NEXT: stencil.apply(%arg7 = %6 : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>, %arg8 = %10 : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>, %arg9 = %0 : !stencil.field<[0,64]x[0,65]x[0,64]xf64>, %arg10 = %8 : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>) outs (%11 : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>) {
// BUFF-NEXT: %13 = stencil.access %arg7[0, 0, 0] : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// BUFF-NEXT: %14 = stencil.access %arg8[0, 0, 0] : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// BUFF-NEXT: %15 = arith.mulf %13, %14 : f64
// BUFF-NEXT: %16 = stencil.access %arg9[0, 0, 0] : !stencil.field<[0,64]x[0,65]x[0,64]xf64>
// BUFF-NEXT: %17 = stencil.access %arg9[0, 1, 0] : !stencil.field<[0,64]x[0,65]x[0,64]xf64>
// BUFF-NEXT: %18 = arith.subf %16, %17 : f64
// BUFF-NEXT: %19 = arith.addf %15, %18 : f64
// BUFF-NEXT: %20 = stencil.access %arg10[0, 0, 0] : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// BUFF-NEXT: %21 = arith.divf %19, %20 : f64
// BUFF-NEXT: %22 = stencil.store_result %21 : !stencil.result<f64>
// BUFF-NEXT: stencil.return %22 : !stencil.result<f64>
// BUFF-NEXT: } to <[0, 0, 0], [64, 64, 64]>
// BUFF-NEXT: func.return
// BUFF-NEXT: }
75 changes: 26 additions & 49 deletions tests/filecheck/transforms/stencil-bufferize.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -73,43 +73,43 @@ func.func @copy_1d(%0 : !stencil.field<?xf64>, %out : !stencil.field<?xf64>) {
// CHECK-NEXT: func.return
// CHECK-NEXT: }

func.func @copy_2d(%0 : !stencil.field<?x?xf64>) {
func.func @copy_2d(%0 : !stencil.field<?x?xf64>, %out : !stencil.field<[-4,68]x[-4,68]xf64>) {
%1 = stencil.cast %0 : !stencil.field<?x?xf64> -> !stencil.field<[-4,68]x[-4,68]xf64>
%2 = stencil.load %1 : !stencil.field<[-4,68]x[-4,68]xf64> -> !stencil.temp<[-1,64]x[0,68]xf64>
%3 = stencil.apply(%4 = %2 : !stencil.temp<[-1,64]x[0,68]xf64>) -> (!stencil.temp<[0,64]x[0,68]xf64>) {
%5 = stencil.access %4[-1, 0] : !stencil.temp<[-1,64]x[0,68]xf64>
stencil.return %5 : f64
}
stencil.store %3 to %out (<[0, 0], [64, 68]>) : !stencil.temp<[0,64]x[0,68]xf64> to !stencil.field<[-4,68]x[-4,68]xf64>
func.return
}

// CHECK: func.func @copy_2d(%0 : !stencil.field<?x?xf64>) {
// CHECK: func.func @copy_2d(%0 : !stencil.field<?x?xf64>, %out : !stencil.field<[-4,68]x[-4,68]xf64>) {
// CHECK-NEXT: %1 = stencil.cast %0 : !stencil.field<?x?xf64> -> !stencil.field<[-4,68]x[-4,68]xf64>
// CHECK-NEXT: %2 = stencil.alloc : !stencil.field<[0,64]x[0,68]xf64>
// CHECK-NEXT: stencil.apply(%3 = %1 : !stencil.field<[-4,68]x[-4,68]xf64>) outs (%2 : !stencil.field<[0,64]x[0,68]xf64>) {
// CHECK-NEXT: %4 = stencil.access %3[-1, 0] : !stencil.field<[-4,68]x[-4,68]xf64>
// CHECK-NEXT: stencil.return %4 : f64
// CHECK-NEXT: stencil.apply(%2 = %1 : !stencil.field<[-4,68]x[-4,68]xf64>) outs (%out : !stencil.field<[-4,68]x[-4,68]xf64>) {
// CHECK-NEXT: %3 = stencil.access %2[-1, 0] : !stencil.field<[-4,68]x[-4,68]xf64>
// CHECK-NEXT: stencil.return %3 : f64
// CHECK-NEXT: } to <[0, 0], [64, 68]>
// CHECK-NEXT: func.return
// CHECK-NEXT: }


func.func @copy_3d(%0 : !stencil.field<?x?x?xf64>) {
func.func @copy_3d(%0 : !stencil.field<?x?x?xf64>, %out : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>) {
%1 = stencil.cast %0 : !stencil.field<?x?x?xf64> -> !stencil.field<[-4,68]x[-4,70]x[-4,72]xf64>
%2 = stencil.load %1 : !stencil.field<[-4,68]x[-4,70]x[-4,72]xf64> -> !stencil.temp<[-1,64]x[0,64]x[0,69]xf64>
%3 = stencil.apply(%4 = %2 : !stencil.temp<[-1,64]x[0,64]x[0,69]xf64>) -> (!stencil.temp<[0,64]x[0,64]x[0,68]xf64>) {
%5 = stencil.access %4[-1, 0, 1] : !stencil.temp<[-1,64]x[0,64]x[0,69]xf64>
stencil.return %5 : f64
}
stencil.store %3 to %out (<[0, 0, 0], [64, 64, 68]>) : !stencil.temp<[0,64]x[0,64]x[0,68]xf64> to !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
func.return
}

// CHECK: func.func @copy_3d(%0 : !stencil.field<?x?x?xf64>) {
// CHECK: func.func @copy_3d(%0 : !stencil.field<?x?x?xf64>, %out : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>) {
// CHECK-NEXT: %1 = stencil.cast %0 : !stencil.field<?x?x?xf64> -> !stencil.field<[-4,68]x[-4,70]x[-4,72]xf64>
// CHECK-NEXT: %2 = stencil.alloc : !stencil.field<[0,64]x[0,64]x[0,68]xf64>
// CHECK-NEXT: stencil.apply(%3 = %1 : !stencil.field<[-4,68]x[-4,70]x[-4,72]xf64>) outs (%2 : !stencil.field<[0,64]x[0,64]x[0,68]xf64>) {
// CHECK-NEXT: %4 = stencil.access %3[-1, 0, 1] : !stencil.field<[-4,68]x[-4,70]x[-4,72]xf64>
// CHECK-NEXT: stencil.return %4 : f64
// CHECK-NEXT: stencil.apply(%2 = %1 : !stencil.field<[-4,68]x[-4,70]x[-4,72]xf64>) outs (%out : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>) {
// CHECK-NEXT: %3 = stencil.access %2[-1, 0, 1] : !stencil.field<[-4,68]x[-4,70]x[-4,72]xf64>
// CHECK-NEXT: stencil.return %3 : f64
// CHECK-NEXT: } to <[0, 0, 0], [64, 64, 68]>
// CHECK-NEXT: func.return
// CHECK-NEXT: }
Expand Down Expand Up @@ -140,20 +140,19 @@ func.func @offsets(%0 : !stencil.field<?x?x?xf64>, %1 : !stencil.field<?x?x?xf64
// CHECK: func.func @offsets(%0 : !stencil.field<?x?x?xf64>, %1 : !stencil.field<?x?x?xf64>, %2 : !stencil.field<?x?x?xf64>) {
// CHECK-NEXT: %3 = stencil.cast %0 : !stencil.field<?x?x?xf64> -> !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// CHECK-NEXT: %4 = stencil.cast %1 : !stencil.field<?x?x?xf64> -> !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// CHECK-NEXT: %5 = stencil.alloc : !stencil.field<[0,64]x[0,64]x[0,64]xf64>
// CHECK-NEXT: stencil.apply(%6 = %3 : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>) outs (%4 : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>, %5 : !stencil.field<[0,64]x[0,64]x[0,64]xf64>) {
// CHECK-NEXT: %7 = stencil.access %6[-1, 0, 0] : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// CHECK-NEXT: %8 = stencil.access %6[1, 0, 0] : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// CHECK-NEXT: %9 = stencil.access %6[0, 1, 0] : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// CHECK-NEXT: %10 = stencil.access %6[0, -1, 0] : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// CHECK-NEXT: %11 = stencil.access %6[0, 0, 0] : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// CHECK-NEXT: %12 = arith.addf %7, %8 : f64
// CHECK-NEXT: %13 = arith.addf %9, %10 : f64
// CHECK-NEXT: %14 = arith.addf %12, %13 : f64
// CHECK-NEXT: stencil.apply(%5 = %3 : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>) outs (%4 : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>) {
// CHECK-NEXT: %6 = stencil.access %5[-1, 0, 0] : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// CHECK-NEXT: %7 = stencil.access %5[1, 0, 0] : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// CHECK-NEXT: %8 = stencil.access %5[0, 1, 0] : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// CHECK-NEXT: %9 = stencil.access %5[0, -1, 0] : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// CHECK-NEXT: %10 = stencil.access %5[0, 0, 0] : !stencil.field<[-4,68]x[-4,68]x[-4,68]xf64>
// CHECK-NEXT: %11 = arith.addf %6, %7 : f64
// CHECK-NEXT: %12 = arith.addf %8, %9 : f64
// CHECK-NEXT: %13 = arith.addf %11, %12 : f64
// CHECK-NEXT: %cst = arith.constant -4.000000e+00 : f64
// CHECK-NEXT: %15 = arith.mulf %11, %cst : f64
// CHECK-NEXT: %16 = arith.addf %15, %14 : f64
// CHECK-NEXT: stencil.return %16, %15 : f64, f64
// CHECK-NEXT: %14 = arith.mulf %10, %cst : f64
// CHECK-NEXT: %15 = arith.addf %14, %13 : f64
// CHECK-NEXT: stencil.return %15 : f64
// CHECK-NEXT: } to <[0, 0, 0], [64, 64, 64]>
// CHECK-NEXT: func.return
// CHECK-NEXT: }
Expand Down Expand Up @@ -342,31 +341,9 @@ func.func @stencil_init_index_offset(%0 : !stencil.field<[0,64]x[0,64]x[0,64]xin
// CHECK-NEXT: func.return
// CHECK-NEXT: }

func.func @store_result_lowering(%arg0 : f64) {
%0, %1 = stencil.apply(%arg1 = %arg0 : f64) -> (!stencil.temp<[0,7]x[0,7]x[0,7]xf64>, !stencil.temp<[0,7]x[0,7]x[0,7]xf64>) {
%2 = stencil.store_result %arg1 : !stencil.result<f64>
%3 = stencil.store_result %arg1 : !stencil.result<f64>
stencil.return %2, %3 : !stencil.result<f64>, !stencil.result<f64>
}
%2 = stencil.buffer %1 : !stencil.temp<[0,7]x[0,7]x[0,7]xf64> -> !stencil.temp<[0,7]x[0,7]x[0,7]xf64>
%3 = stencil.buffer %0 : !stencil.temp<[0,7]x[0,7]x[0,7]xf64> -> !stencil.temp<[0,7]x[0,7]x[0,7]xf64>
func.return
}

// CHECK: func.func @store_result_lowering(%arg0 : f64) {
// CHECK-NEXT: %0 = stencil.alloc : !stencil.field<[0,7]x[0,7]x[0,7]xf64>
// CHECK-NEXT: %1 = stencil.alloc : !stencil.field<[0,7]x[0,7]x[0,7]xf64>
// CHECK-NEXT: stencil.apply(%arg1 = %arg0 : f64) outs (%0 : !stencil.field<[0,7]x[0,7]x[0,7]xf64>, %1 : !stencil.field<[0,7]x[0,7]x[0,7]xf64>) {
// CHECK-NEXT: %2 = stencil.store_result %arg1 : !stencil.result<f64>
// CHECK-NEXT: %3 = stencil.store_result %arg1 : !stencil.result<f64>
// CHECK-NEXT: stencil.return %2, %3 : !stencil.result<f64>, !stencil.result<f64>
// CHECK-NEXT: } to <[0, 0, 0], [7, 7, 7]>
// CHECK-NEXT: func.return
// CHECK-NEXT: }

func.func @if_lowering(%arg0 : f64, %b0 : !stencil.field<[0,7]x[0,7]x[0,7]xf64>, %b1 : !stencil.field<[0,7]x[0,7]x[0,7]xf64>) attributes {"stencil.program"}{
%0, %1 = stencil.apply(%arg1 = %arg0 : f64) -> (!stencil.temp<[0,7]x[0,7]x[0,7]xf64>, !stencil.temp<[0,7]x[0,7]x[0,7]xf64>) {
%true = "test.op"() : () -> i1
%true = "test.pureop"() : () -> i1
%2, %3 = "scf.if"(%true) ({
%4 = stencil.store_result %arg1 : !stencil.result<f64>
scf.yield %4, %arg1 : !stencil.result<f64>, f64
Expand All @@ -384,7 +361,7 @@ func.func @if_lowering(%arg0 : f64, %b0 : !stencil.field<[0,7]x[0,7]x[0,7]xf64>,

// CHECK: func.func @if_lowering(%arg0 : f64, %b0 : !stencil.field<[0,7]x[0,7]x[0,7]xf64>, %b1 : !stencil.field<[0,7]x[0,7]x[0,7]xf64>) attributes {"stencil.program"}{
// CHECK-NEXT: stencil.apply(%arg1 = %arg0 : f64) outs (%b0 : !stencil.field<[0,7]x[0,7]x[0,7]xf64>, %b1 : !stencil.field<[0,7]x[0,7]x[0,7]xf64>) {
// CHECK-NEXT: %true = "test.op"() : () -> i1
// CHECK-NEXT: %true = "test.pureop"() : () -> i1
// CHECK-NEXT: %0, %1 = "scf.if"(%true) ({
// CHECK-NEXT: %2 = stencil.store_result %arg1 : !stencil.result<f64>
// CHECK-NEXT: scf.yield %2, %arg1 : !stencil.result<f64>, f64
Expand Down
Loading
Loading