Closed
Description
My git version is ea44647.
Description:
I am experiencing an inconsistent result when executing the same MLIR program with and without the -test-loop-fusion=test-loop-fusion-transformation
.
Steps to Reproduce:
1. MLIR Program (test.mlir):
test.mlir:
module {
func.func private @printMemrefI64(tensor<*xi64>)
func.func @main() -> () {
%arg0 = "tosa.const"() {value = dense<20> : tensor<36x2x3xi64>} : () -> tensor<36x2x3xi64>
%0 = tosa.reduce_sum %arg0 {axis = 0 : i32} : (tensor<36x2x3xi64>) -> tensor<1x2x3xi64>
%rtn1 = tensor.cast %0 : tensor<1x2x3xi64> to tensor<*xi64>
call @printMemrefI64(%rtn1) : (tensor<*xi64>) -> ()
return
}
}
2. Command to Run Without -test-loop-fusion=test-loop-fusion-transformation
:
/path/llvm-project/build/bin/mlir-opt test.mlir -pass-pipeline='builtin.module(func.func(tosa-to-linalg-named,tosa-to-linalg))' | \
/path/llvm-project/build/bin/mlir-opt -tosa-to-arith -one-shot-bufferize="bufferize-function-boundaries" -convert-linalg-to-affine-loops -lower-affine -convert-scf-to-cf -expand-strided-metadata -convert-cf-to-llvm -convert-arith-to-llvm -finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | \
/path/llvm-project/build/bin/mlir-cpu-runner -e main -entry-point-result=void \
-shared-libs=/path/llvm-project/build/lib/libmlir_runner_utils.so \
-shared-libs=/path/llvm-project/build/lib/libmlir_c_runner_utils.so \
-shared-libs=/path/llvm-project/build/lib/libmlir_async_runtime.so
3. Output Without -test-loop-fusion=test-loop-fusion-transformation
:
[[[720, 720, 720],
[720, 720, 720]]]
4. Command to Run With -test-loop-fusion=test-loop-fusion-transformation
:
/path/llvm-project/build/bin/mlir-opt test.mlir -pass-pipeline='builtin.module(func.func(tosa-to-linalg-named,tosa-to-linalg))' | \
/path/llvm-project/build/bin/mlir-opt -tosa-to-arith -one-shot-bufferize="bufferize-function-boundaries" -convert-linalg-to-affine-loops -test-loop-fusion=test-loop-fusion-transformation -lower-affine -convert-scf-to-cf -expand-strided-metadata -convert-cf-to-llvm -convert-arith-to-llvm -finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | \
/path/llvm-project/build/bin/mlir-cpu-runner -e main -entry-point-result=void \
-shared-libs=/path/llvm-project/build/lib/libmlir_runner_utils.so \
-shared-libs=/path/llvm-project/build/lib/libmlir_c_runner_utils.so \
-shared-libs=/path/llvm-project/build/lib/libmlir_async_runtime.so
5. Output With -test-loop-fusion=test-loop-fusion-transformation
:
[[[20, 20, 20],
[20, 20, 20]]]
I'm not sure if there is any bug in my program or if the wrong usage of the above passes caused this result.