System Version / Image
| Item | Information |
|---|---|
| System | Bianbu 4.0.1 (Resolute Raccoon) |
| Kernel | 6.18.3-generic #1.0.2.4 SMP PREEMPT_DYNAMIC |
| Architecture | RISC-V 64 (rv64gc) |
| Related package | spacemit-tcm (includes libspine_gemm_bridge.so) |
| Python version | 3.14 |
Use Case or Test Objective
Use ONNX Runtime + SpacemiT EP to accelerate AI inference. libspine_gemm_bridge.so is part of the spacemit-tcm package and provides a bridge for GEMM (general matrix multiplication) acceleration on the A100 AI core.
When the AI inference module initializes, libspine_gemm_bridge.so initializes through the Python C API. The expected sequence is:
- ONNX Runtime loads SpacemiT EP
- EP calls
libspine_gemm_bridge.soduring initialization - The bridge library initializes the Python interpreter environment
Steps
1. Verify the Environment
bash
Check the Python version python3 --version # Output: Python 3.14.0 # Check whether the spacemit-tcm package is installed dpkg -l | grep spacemit-tcm # Locate the bridge library find /usr -name “libspine_gemm_bridge.so” 2>/dev/null
2. Trigger Initialization
When the AI inference module initializes, the bridge library is loaded and attempts to initialize the Python environment.
Results / Screenshots / Logs
Error Log
text
_ctypes undefined symbol: PyExc_SystemError
Root Cause Analysis
bash
Check the Python version linked by the bridge library ldd /usr/lib/libspine_gemm_bridge.so | grep python # Output: libpython3.14.so.1.0 => /usr/lib/riscv64-linux-gnu/libpython3.14.so.1.0 # Check the system Python version python3 --version # Output: Python 3.14.0 # Check whether the symbol exists nm -D /usr/lib/riscv64-linux-gnu/libpython3.14.so.1.0 | grep PyExc_SystemError # Output: … PyExc_SystemError
Key Findings
libspine_gemm_bridge.sois linked to Python 3.14- However, the bridge library fails to find the
PyExc_SystemErrorsymbol through_ctypesduring initialization - The symbol exists in Python 3.14’s
libpython3.14.so, but the bridge library’s initialization timing or dependency order is incorrect
Problem Encountered
Core issue: libspine_gemm_bridge.so is part of the spacemit-tcm package. It links to the system Python but does not handle the Python version dependency correctly, causing initialization to fail in a Python 3.14 environment.
| Check | Expected | Actual |
|---|---|---|
| Python version compatibility | ||
PyExc_SystemError symbol |
||
_ctypes symbol lookup |
Impact
- The AI inference module cannot initialize
- ONNX Runtime + SpacemiT EP cannot use the A100 AI core for acceleration
- Inference tasks are blocked
Your Assessment / Suggestions for Improvement
Assessment
- Incomplete version dependency:
libspine_gemm_bridge.solinks to the Python 3.14 library but fails to resolve the symbol correctly during_ctypesinitialization. This suggests that the bridge library’s initialization logic depends on Python internal state that has not been properly initialized. - Possible initialization order issue: The
_ctypesmodule itself cannot be used until the Python interpreter is fully initialized. If the bridge library attempts to call_ctypesbefore the Python interpreter is fully initialized, symbol lookup will fail. - Compatibility with Python 3.14: Python 3.14 is relatively new, and some internal APIs may have changed. The bridge library may not have been sufficiently tested against this version.