Issue |
114657
|
Summary |
[mlir] Inconsistent results for tensor.from_elements
|
Labels |
mlir
|
Assignees |
|
Reporter |
wangyongj1a
|
I have the following MLIR program:
test.mlir:
```
module {
func.func @tensor_i1(%arg0: tensor<?xi1>) -> i1 {
%idx0 = index.constant 0
%idx1 = index.constant 1
%false = arith.constant false
%dim = tensor.dim %arg0, %idx0 : tensor<?xi1>
%0 = scf.for %arg1 = %idx0 to %dim step %idx1 iter_args(%arg2 = %false) -> (i1) {
%extracted = tensor.extract %arg0[%arg1] : tensor<?xi1>
vector.print %extracted : i1
%1 = arith.addi %arg2, %extracted : i1
scf.yield %1 : i1
}
return %0 : i1
}
func.func private @func1() -> f32{
%true_6 = arith.constant true
%false_7 = arith.constant false
%false_8 = arith.constant false
%false_9 = arith.constant false
%true_10 = arith.constant true
%from_elements = tensor.from_elements %true_6, %false_7, %false_8, %false_9, %true_10 : tensor<5xi1>
%cast_158 = tensor.cast %from_elements : tensor<5xi1> to tensor<?xi1>
%214 = call @tensor_i1(%cast_158) : (tensor<?xi1>) -> i1
%1 = arith.sitofp %214 : i1 to f32
vector.print %214 : i1
return %1 : f32
}
}
```
When I ran ```/data/tmp/v1102/llvm-project/build/bin/mlir-opt --test-linalg-decompose-ops=remove-dead-args-and-results --one-shot-bufferize="dialect-filter=tensor,linalg,bufferization" --canonicalize --one-shot-bufferize="dialect-filter=arith" --convert-arith-to-llvm --expand-strided-metadata --func-bufferize --one-shot-bufferize="dialect-filter=tensor" --convert-index-to-llvm --convert-vector-to-llvm --finalize-memref-to-llvm --convert-scf-to-cf --convert-func-to-llvm --reconcile-unrealized-casts test.mlir | /data/tmp/v1102/llvm-project/build/bin/mlir-cpu-runner -e func1 --shared-libs=/data/tmp/v1102/llvm-project/build/lib/libmlir_runner_utils.so,/data/tmp/v1102/llvm-project/build/lib/libmlir_c_runner_utils.so``` on the program, I got the result of:
```
1
0
0
0
1
0
0.000000e+00
```
However, when I ran ```/data/tmp/v1102/llvm-project/build/bin/mlir-opt --test-linalg-decompose-ops=remove-dead-args-and-results --one-shot-bufferize="dialect-filter=tensor,linalg,bufferization" --canonicalize --one-shot-bufferize="dialect-filter=arith" --convert-arith-to-llvm --test-linalg-transform-patterns=test-patterns --expand-strided-metadata --func-bufferize --one-shot-bufferize="dialect-filter=tensor" --convert-index-to-llvm --convert-vector-to-llvm --finalize-memref-to-llvm --convert-scf-to-cf --convert-func-to-llvm --reconcile-unrealized-casts test.mlir | /data/tmp/v1102/llvm-project/build/bin/mlir-cpu-runner -e func1 --shared-libs=/data/tmp/v1102/llvm-project/build/lib/libmlir_runner_utils.so,/data/tmp/v1102/llvm-project/build/lib/libmlir_c_runner_utils.so``` on the program, I got inconsistent results over multiple runs.
The above two results seem to be inconsistent. I'm not sure if there is any bug in my program or if the wrong usage of the above passes caused these results.
My git version is 33bdb53d864e3e244d8fd5649062f17b7d4c958d.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs