Issue |
145514
|
Summary |
[MLIR] Inconsistent output when executing MLIR program with and without `-tosa-layerwise-constant-fold`
|
Labels |
|
Assignees |
|
Reporter |
Lambor24
|
My git version is [e04c938](https://github.com/llvm/llvm-project/commit/e04c938cc08a90ae60440ce22d072ebc69d67ee8).
## Description:
I am experiencing an inconsistent result when executing the same MLIR program with and without the `-tosa-layerwise-constant-fold`.
## Steps to Reproduce:
### 1. **MLIR Program (test.mlir)**:
test.mlir:
```
module {
func.func private @printMemrefI64(tensor<*xi64>)
func.func @main() {
%0 = "tosa.const"() <{values = dense<true> : tensor<7xi1>}> : () -> tensor<7xi1>
%1 = tosa.reduce_any %0 {axis = 0 : i32} : (tensor<7xi1>) -> tensor<1xi1>
%2 = tosa.cast %1 : (tensor<1xi1>) -> tensor<1xi64>
%cast = tensor.cast %2 : tensor<1xi64> to tensor<*xi64>
call @printMemrefI64(%cast) : (tensor<*xi64>) -> ()
return
}
}
```
### 2. **Command to Run Without `-tosa-layerwise-constant-fold`:**
```
/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 -one-shot-bufferize="bufferize-function-boundaries" -convert-linalg-to-loops -expand-strided-metadata -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
```
### 3. **Output Without `-tosa-layerwise-constant-fold`:**
```
[[1]]
```
### 4. **Command to Run With `-tosa-layerwise-constant-fold`:**
```
/path/llvm-project/build/bin/mlir-opt test.mlir -tosa-layerwise-constant-fold | \
/path/llvm-project/build/bin/mlir-opt -pass-pipeline='builtin.module(func.func(tosa-to-linalg))' | \
/path/llvm-project/build/bin/mlir-opt -tosa-to-arith -one-shot-bufferize="bufferize-function-boundaries" -convert-linalg-to-loops -expand-strided-metadata -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
```
### 5. **Output With `-tosa-layerwise-constant-fold`:**
```
[[-1]]
```
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