<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/118264>118264</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
mlir-cpu-runner crash
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
axeabc
</td>
</tr>
</table>
<pre>
I have the following MLIR program:
tosa.mlir
```
module {
func.func private @printMemrefI32(tensor<*xi32>)
func.func private @printMemrefF32(tensor<*xf32>)
func.func @main() {
%0 = "tosa.const"() <{value = dense<2> : tensor<1x30x1xi32>}> : () -> tensor<1x30x1xi32>
%6 = "tosa.const"() <{value = dense<11> : tensor<1x30x1xi32>}> : () -> tensor<1x30x1xi32>
%7 = "tosa.const"() <{value = dense<55> : tensor<1x30x1xi32>}> : () -> tensor<1x30x1xi32>
%8 = "tosa.const"() <{value = dense<17> : tensor<1x30x1xi32>}> : () -> tensor<1x30x1xi32>
%11 = tosa.logical_right_shift %0, %8 : (tensor<1x30x1xi32>, tensor<1x30x1xi32>) -> tensor<1x30x1xi32>
%25 = tosa.bitwise_and %6, %7 : (tensor<1x30x1xi32>, tensor<1x30x1xi32>) -> tensor<1x30x1xi32>
%32 = tosa.logical_right_shift %11, %0 : (tensor<1x30x1xi32>, tensor<1x30x1xi32>) -> tensor<1x30x1xi32>
%42 = tosa.logical_left_shift %32, %25 : (tensor<1x30x1xi32>, tensor<1x30x1xi32>) -> tensor<1x30x1xi32>
%48 = tosa.bitwise_not %11 : (tensor<1x30x1xi32>) -> tensor<1x30x1xi32>
%55 = tosa.int_div %48, %42 : (tensor<1x30x1xi32>, tensor<1x30x1xi32>) -> tensor<1x30x1xi32>
%cast = tensor.cast %6 : tensor<1x30x1xi32> to tensor<*xi32>
call @printMemrefI32(%cast) : (tensor<*xi32>) -> ()
return
}
}
```
I want to use the following options to print the result of the above program:
`/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt tosa.mlir -pass-pipeline="builtin.module(func.func(tosa-to-linalg))" | /data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt -tosa-to-arith -convert-math-to-llvm -one-shot-bufferize="bufferize-function-boundaries" -finalize-memref-to-llvm -convert-linalg-to-loops -convert-scf-to-cf -convert-arith-to-llvm -finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | /data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-cpu-runner -e main -entry-point-result=void --shared-libs=/data/szy/MLIR/llvm-release/llvm-project/build/lib/libmlir_c_runner_utils.so --shared-libs=/data/szy/MLIR/llvm-release/llvm-project/build/lib/libmlir_runner_utils.so
`
However the mlir-cpu-runner will crash:
```
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-cpu-runner -e main -entry-point-result=void --shared-libs=/data/szy/MLIR/llvm-release/llvm-project/build/lib/libmlir_c_runner_utils.so --shared-libs=/data/szy/MLIR/llvm-release/llvm-project/build/lib/libmlir_runner_utils.so
#0 0x0000558c1cdfa9f8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-cpu-runner+0xe069f8)
#1 0x0000558c1cdf850e llvm::sys::RunSignalHandlers() (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-cpu-runner+0xe0450e)
#2 0x0000558c1cdfb34d SignalHandler(int) Signals.cpp:0:0
#3 0x00007fdd8d385420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007fdd8d3df305
#5 0x00007fdd8d3df3dd
#6 0x0000558c1d2ffb19 compileAndExecute((anonymous namespace)::Options&, mlir::Operation*, llvm::StringRef, (anonymous namespace)::CompileAndExecuteConfig, void**, std::unique_ptr<llvm::TargetMachine, std::default_delete<llvm::TargetMachine>>) JitRunner.cpp:0:0
#7 0x0000558c1d2fd122 compileAndExecuteVoidFunction((anonymous namespace)::Options&, mlir::Operation*, llvm::StringRef, (anonymous namespace)::CompileAndExecuteConfig, std::unique_ptr<llvm::TargetMachine, std::default_delete<llvm::TargetMachine>>) JitRunner.cpp:0:0
#8 0x0000558c1d2fb42a mlir::JitRunnerMain(int, char**, mlir::DialectRegistry const&, mlir::JitRunnerConfig) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-cpu-runner+0x130742a)
#9 0x0000558c1cbc45c7 main (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-cpu-runner+0xbd05c7)
#10 0x00007fdd8c9a3083 __libc_start_main /build/glibc-LcI20x/glibc-2.31/csu/../csu/libc-start.c:342:3
#11 0x0000558c1cbc41ee _start (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-cpu-runner+0xbd01ee)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsmF9v2zgSwD8N_UJIoCjJkh_84Do1NocWV6SLexUoaiTzliJ1JOU4--kPpOQ_cdJ20auBfbjAUUyTnPnNcIYzMbNWdApgjfIPKH9YsNHttVmzI7CaL2rdvKwf8Z4dALs94FZLqZ-F6vDnT49PeDC6M6xH6QYR_3LasriXwmA_XpL5RTa9bkYJGBUfENlg3I6Kx_6BByMOzAFGGRmMUO4z9Abax5QiWjpQVhuUbhHdHEVKUfoR0ZUX8KP9u7f72-v9VwJQRnomFKIloqsTIKI5wSh9wIjSYBPXyjpE6WlZukXFhwOTI4RlDSgLKN16FRilG3xWnRxTckxO9MXDacEsKPLjbyz2nNijLH8GJUnuwlL8DEue34Wl_Cm_FHdhSZKgJZBI3QnOZGVEt3eV3YvWhYhCdHvCDsK_IZNuv6Xtr8LQ_AJTC_csLFRMNSGWZoji7hAp_aFHkmSmIXenyd6hkdBewfgrY3v23p1pyrcHpLQ7B9J3tf9FHflVEAjlqkYcJtWzmcEj9zWTM-smiLAwnsbThfat_MNO4_cu_kkoZ1K-WytmbVP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