Issue 97488
Summary [mlir][circt][pycde] compiler backend segfaults randomly
Labels mlir
Assignees
Reporter nes0
    I've been trialling pycde and have recently started seeing random segfaults from the compiler. This behaviour appears to be random in that I can run the same Python / pycde script repeatedly and see it crash in 50% of the runs and correct SystemVerilog output the other 50%. I see exactly the same behaviour across multiple build machines, Ubuntu 22.04 and Rocky Linux.

The prebuilt circt/mlir binaries I am using are from the PyCDE release package hosted at [PyPI](https://pypi.org/project/pycde/#history). I have tried the two most recent releases (0.4.0 and 0.3.1.dev1066) and see no difference between them.

Here is the annotated backtrace:
```#0 0x00007f99d4bfd5f8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/PROJECTDIR/venv/lib/python3.10/site-packages/pycde/circt/_mlir_libs/libPyCDE_CIRCTPythonCAPI.so+0x9fd5f8)
 #1 0x00007f99d4bf9fac SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f99d8442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00007f99d4eda4cb circt::esi::AppIDIndex::buildIndexFor(circt::hw::HWModuleLike)::'lambda'(mlir::Operation*)::operator()(mlir::Operation*) const AppID.cpp:0:0
 #4 0x00007f99d4eda850 mlir::WalkResult mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<mlir::WalkResult (mlir::Operation*)>, mlir::WalkOrder) (.constprop.0) AppID.cpp:0:0
 #5 0x00007f99d4eda824 mlir::WalkResult mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<mlir::WalkResult (mlir::Operation*)>, mlir::WalkOrder) (.constprop.0) AppID.cpp:0:0
 #6 0x00007f99d4edaa0f circt::esi::AppIDIndex::buildIndexFor(circt::hw::HWModuleLike) (/PROJECTDIR/venv/lib/python3.10/site-packages/pycde/circt/_mlir_libs/libPyCDE_CIRCTPythonCAPI.so+0xcdaa0f)
 #7 0x00007f99d4eda4b1 circt::esi::AppIDIndex::buildIndexFor(circt::hw::HWModuleLike)::'lambda'(mlir::Operation*)::operator()(mlir::Operation*) const AppID.cpp:0:0
 #8 0x00007f99d4eda850 mlir::WalkResult mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<mlir::WalkResult (mlir::Operation*)>, mlir::WalkOrder) (.constprop.0) AppID.cpp:0:0
 #9 0x00007f99d4eda824 mlir::WalkResult mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<mlir::WalkResult (mlir::Operation*)>, mlir::WalkOrder) (.constprop.0) AppID.cpp:0:0
#10 0x00007f99d4edaa0f circt::esi::AppIDIndex::buildIndexFor(circt::hw::HWModuleLike) (/PROJECTDIR/venv/lib/python3.10/site-packages/pycde/circt/_mlir_libs/libPyCDE_CIRCTPythonCAPI.so+0xcdaa0f)
#11 0x00007f99d4eda4b1 circt::esi::AppIDIndex::buildIndexFor(circt::hw::HWModuleLike)::'lambda'(mlir::Operation*)::operator()(mlir::Operation*) const AppID.cpp:0:0
#12 0x00007f99d4eda850 mlir::WalkResult mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<mlir::WalkResult (mlir::Operation*)>, mlir::WalkOrder) (.constprop.0) AppID.cpp:0:0
#13 0x00007f99d4eda824 mlir::WalkResult mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<mlir::WalkResult (mlir::Operation*)>, mlir::WalkOrder) (.constprop.0) AppID.cpp:0:0
#14 0x00007f99d4edaa0f circt::esi::AppIDIndex::buildIndexFor(circt::hw::HWModuleLike) (/PROJECTDIR/venv/lib/python3.10/site-packages/pycde/circt/_mlir_libs/libPyCDE_CIRCTPythonCAPI.so+0xcdaa0f)
#15 0x00007f99d4edb285 circt::esi::AppIDIndex::AppIDIndex(mlir::Operation*) (/PROJECTDIR/venv/lib/python3.10/site-packages/pycde/circt/_mlir_libs/libPyCDE_CIRCTPythonCAPI.so+0xcdb285)
#16 0x00007f99d4ba7b02 circtESIAppIDIndexGet (/PROJECTDIR/venv/lib/python3.10/site-packages/pycde/circt/_mlir_libs/libPyCDE_CIRCTPythonCAPI.so+0x9a7b02)
#17 0x00007f99d75ae6d3 (/PROJECTDIR/venv/lib/python3.10/site-packages/pycde/circt/_mlir_libs/_circt.cpython-310-x86_64-linux-gnu.so+0x416d3)
#18 0x00007f99d75959b3 _init (/PROJECTDIR/venv/lib/python3.10/site-packages/pycde/circt/_mlir_libs/_circt.cpython-310-x86_64-linux-gnu.so+0x289b3)
#19 0x000055bbbb52610e (/usr/bin/python3.10+0x15a10e)
#20 0x000055bbbb51ca7b _PyObject_MakeTpCall (/usr/bin/python3.10+0x150a7b)
#21 0x000055bbbb534c20 (/usr/bin/python3.10+0x168c20)
#22 0x000055bbbb531087 (/usr/bin/python3.10+0x165087)
#23 0x000055bbbb51ce2b (/usr/bin/python3.10+0x150e2b)
#24 0x00007f99d76749fb _init (/PROJECTDIR/venv/lib/python3.10/site-packages/pycde/circt/_mlir_libs/_mlir.cpython-310-x86_64-linux-gnu.so+0x749fb)
#25 0x000055bbbb51ca7b _PyObject_MakeTpCall (/usr/bin/python3.10+0x150a7b)
#26 0x000055bbbb515629 _PyEval_EvalFrameDefault (/usr/bin/python3.10+0x149629)
#27 0x000055bbbb5269fc _PyFunction_Vectorcall (/usr/bin/python3.10+0x15a9fc)
#28 0x000055bbbb50f45c _PyEval_EvalFrameDefault (/usr/bin/python3.10+0x14345c)
#29 0x000055bbbb5269fc _PyFunction_Vectorcall (/usr/bin/python3.10+0x15a9fc)
#30 0x000055bbbb50f45c _PyEval_EvalFrameDefault (/usr/bin/python3.10+0x14345c)
#31 0x000055bbbb50b9c6 (/usr/bin/python3.10+0x13f9c6)
#32 0x000055bbbb601256 PyEval_EvalCode (/usr/bin/python3.10+0x235256)
#33 0x000055bbbb62c108 (/usr/bin/python3.10+0x260108)
#34 0x000055bbbb6259cb (/usr/bin/python3.10+0x2599cb)
#35 0x000055bbbb62be55 (/usr/bin/python3.10+0x25fe55)
#36 0x000055bbbb62b338 _PyRun_SimpleFileObject (/usr/bin/python3.10+0x25f338)
#37 0x000055bbbb62af83 _PyRun_AnyFileObject (/usr/bin/python3.10+0x25ef83)
#38 0x000055bbbb61da5e Py_RunMain (/usr/bin/python3.10+0x251a5e)
#39 0x000055bbbb5f402d Py_BytesMain (/usr/bin/python3.10+0x22802d)
#40 0x00007f99d8429d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#41 0x00007f99d8429e40 call_init ./csu/../csu/libc-start.c:128:20
#42 0x00007f99d8429e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#43 0x000055bbbb5f3f25 _start (/usr/bin/python3.10+0x227f25)
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to