| Issue |
177946
|
| Summary |
mlir-opt crash on tensor with unknown rank during --tosa-infer-shapes pass
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
Subway2023
|
# Description
mlir-opt version: 22.1.0-rc1
mlir-opt crashes when running the --tosa-infer-shapes pass on IR containing a tensor with unknown rank (tensor<*xi32>), such as the output of tensor.cast from tensor<1xi32>.
# Reproduce
location: If the **tosa.avg_pool2d** is commented out, the crash no longer occurs.
```
module {
func.func @main() {
%0 = gpu.block_id x
%1 = "tosa.const"() <{values = dense<0> : tensor<1xi32>}> : () -> tensor<1xi32>
%2 = tosa.reduce_sum %1 {axis = 0 : i32} : (tensor<1xi32>) -> tensor<1xi32>
%3 = tosa.bitwise_or %2, %2 : (tensor<1xi32>, tensor<1xi32>) -> tensor<1xi32>
%4 = tensor.cast %3 : tensor<1xi32> to tensor<*xi32>
%5 = tosa.avg_pool2d %4, %1, %1 {acc_type = i32, kernel = array<i64: 1, 1>, pad = array<i64: 0, 0, 0, 0>, stride = array<i64: 1, 1>} : (tensor<*xi32>, tensor<1xi32>, tensor<1xi32>) -> tensor<*xi32>
return
}
}
```
```
mlir-opt --tosa-infer-shapes test.mlir
```
```
mlir-opt: /mnt/sdd1/mlir/tool/llvm-project-llvmorg-22.1.0-rc1/mlir/lib/Interfaces/InferTypeOpInterface.cpp:121: int64_t mlir::ShapeAdaptor::getDimSize(int) const: Assertion `hasRank()' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0. Program arguments: /mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt --tosa-infer-shapes /mnt/sdd1/sbw/mlir/data/genProgram_0125_filtered/genProgram_0125_valid/260220_81ad_5.mlir
#0 0x00005e0eba5d5e32 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x252fe32)
#1 0x00005e0eba5d25af llvm::sys::RunSignalHandlers() (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x252c5af)
#2 0x00005e0eba5d26fc SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x0000757b83845330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
#4 0x0000757b8389eb2c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
#5 0x0000757b8389eb2c __pthread_kill_internal ./nptl/pthread_kill.c:78:10
#6 0x0000757b8389eb2c pthread_kill ./nptl/pthread_kill.c:89:10
#7 0x0000757b8384527e raise ./signal/../sysdeps/posix/raise.c:27:6
#8 0x0000757b838288ff abort ./stdlib/abort.c:81:7
#9 0x0000757b8382881b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#10 0x0000757b8383b517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs