Issue |
130016
|
Summary |
[MLIR] Inconsistent output when executing MLIR program with and without `-linalg-specialize-generic-ops`
|
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 `-linalg-specialize-generic-ops`.
## Steps to Reproduce:
### 1. **MLIR Program (test.mlir)**:
test.mlir:
```
module {
func.func private @printMemrefI64(tensor<*xi64>)
func.func @main() {
%0 = "tosa.const"() <{value = dense<false> : tensor<2x3xi1>}> : () -> tensor<2x3xi1>
%1 = tosa.clamp %0 {max_val = true, min_val = false} : (tensor<2x3xi1>) -> tensor<2x3xi1>
%2 = tosa.cast %1 : (tensor<2x3xi1>) -> tensor<2x3xi64>
%cast = tensor.cast %2 : tensor<2x3xi64> to tensor<*xi64>
call @printMemrefI64(%cast) : (tensor<*xi64>) -> ()
return
}
}
```
### 2. **Command to Run Without `-linalg-specialize-generic-ops`:**
```
/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-tensor -tosa-to-arith -sparsifier="vl=8" | \
/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 `-linalg-specialize-generic-ops`:**
```
[[1, 1, 1],
[1, 1, 1]]
```
### 4. **Command to Run With `-linalg-specialize-generic-ops`:**
```
/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-tensor -linalg-specialize-generic-ops -tosa-to-arith -sparsifier="vl=8" | \
/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 `-linalg-specialize-generic-ops`:**
```
[[0, 0, 0],
[0, 0, 0]]
```
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