Issue |
130025
|
Summary |
[MLIR] Inconsistent output when executing MLIR program with and without `-scf-for-loop-peeling=peel-front=true`
|
Labels |
mlir
|
Assignees |
|
Reporter |
Lambor24
|
My git version is [6311e3f](https://github.com/llvm/llvm-project/commit/6311e3fcc8539cf0f474b28f82a465e83013a792).
## Description:
I am experiencing an inconsistent result when executing the same MLIR program with and without the `-scf-for-loop-peeling=peel-front=true`.
## Steps to Reproduce:
### 1. **MLIR Program (test.mlir)**:
test.mlir:
```
module {
func.func private @printMemrefF32(tensor<*xf32>)
func.func @main() {
%0 = "tosa.const"() <{value = dense<-3.871940e+03> : tensor<3x3xf32>}> : () -> tensor<3x3xf32>
%1 = tosa.ceil %0 : (tensor<3x3xf32>) -> tensor<3x3xf32>
%cast = tensor.cast %1 : tensor<3x3xf32> to tensor<*xf32>
call @printMemrefF32(%cast) : (tensor<*xf32>) -> ()
return
}
}
```
### 2. **Command to Run Without `-scf-for-loop-peeling=peel-front=true`:**
```
/path/llvm-project/build/bin/mlir-opt test.mlir -pass-pipeline='builtin.module(func.func(tosa-to-linalg))' | \
/path/llvm-project/build/bin/mlir-opt -tosa-to-arith -sparsification-and-bufferization -convert-linalg-to-affine-loops -lower-affine -convert-scf-to-cf -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-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 `-scf-for-loop-peeling=peel-front=true`:**
```
[[-3871, -3871, -3871],
[-3871, -3871, -3871],
[-3871, -3871, -3871]]
```
### 4. **Command to Run With `-scf-for-loop-peeling=peel-front=true`:**
```
/path/llvm-project/build/bin/mlir-opt test.mlir -pass-pipeline='builtin.module(func.func(tosa-to-linalg))' | \
/path/llvm-project/build/bin/mlir-opt -tosa-to-arith -sparsification-and-bufferization -convert-linalg-to-affine-loops -lower-affine -scf-for-loop-peeling=peel-front=true -convert-scf-to-cf -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-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 `-scf-for-loop-peeling=peel-front=true`:**
```
[[-3871, 0, 0],
[-3871, -3871, -3871],
[-3871, -3871, -3871]]
```
I'm not sure if there is any bug in my program or if the wrong usage of the above passes caused this result.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs