Open
Description
git version: adf892d
system: Ubuntu 18.04.6 LTS
Description:
I am experiencing an inconsistent result when executing the same MLIR program with and without the --scf-for-loop-peeling="peel-front"
.
Steps to Reproduce:
1. MLIR Program (a.mlir):
a.mlir:
module {
func.func private @printMemrefI32(tensor<*xi32>)
func.func private @printMemrefF32(tensor<*xf32>)
func.func @main() {
%0 = "tosa.const"() <{value = dense<3380> : tensor<1x6x6xi32>}> : () -> tensor<1x6x6xi32>
%1 = tosa.cast %0 : (tensor<1x6x6xi32>) -> tensor<1x6x6xf32>
%2 = tosa.erf %1 : (tensor<1x6x6xf32>) -> tensor<1x6x6xf32>
%cast = tensor.cast %2 : tensor<1x6x6xf32> to tensor<*xf32>
call @printMemrefF32(%cast) : (tensor<*xf32>) -> ()
return
}
}
2. Command to Run Without --scf-for-loop-peeling="peel-front"
:
/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt a.mlir -pass-pipeline="builtin.module(func.func(tosa-to-linalg))" | /data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt -tosa-to-arith -test-math-polynomial-approximation -convert-arith-to-llvm -convert-math-to-llvm -one-shot-bufferize="bufferize-function-boundaries" -convert-linalg-to-loops -finalize-memref-to-llvm -convert-scf-to-cf -convert-arith-to-llvm -convert-cf-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | /data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-cpu-runner -e main -entry-point-result=void --shared-libs=/data/szy/MLIR/llvm-release/llvm-project/build/lib/libmlir_c_runner_utils.so --shared-libs=/data/szy/MLIR/llvm-release/llvm-project/build/lib/libmlir_runner_utils.so --shared-libs=/data/szy/MLIR/llvm-release/llvm-project/build/lib/libmlir_async_runtime.so
3. Output without --scf-for-loop-peeling="peel-front"
::
[[[1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1]]]
4. Command to Run With --scf-for-loop-peeling="peel-front"
::
/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt a.mlir -pass-pipeline="builtin.module(func.func(tosa-to-linalg))" | /data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt -tosa-to-arith -test-math-polynomial-approximation -convert-arith-to-llvm -convert-math-to-llvm -one-shot-bufferize="bufferize-function-boundaries" -convert-linalg-to-loops -finalize-memref-to-llvm --scf-for-loop-peeling="peel-front" -convert-scf-to-cf -convert-arith-to-llvm -convert-cf-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | /data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-cpu-runner -e main -entry-point-result=void --shared-libs=/data/szy/MLIR/llvm-release/llvm-project/build/lib/libmlir_c_runner_utils.so --shared-libs=/data/szy/MLIR/llvm-release/llvm-project/build/lib/libmlir_runner_utils.so --shared-libs=/data/szy/MLIR/llvm-release/llvm-project/build/lib/libmlir_async_runtime.so
5. Output with --scf-for-loop-peeling="peel-front"
::
[[[1, 3.07879e-41, 0, 0, -2.17439e-08, 3.07879e-41],
[1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1]]]