【Issue Overview】
When the application com.example.k3_depth_anything loads an ONNX model and performs the first Warmup/Session.Run, a native crash occurs in a WorkerThread inside the SpaceMIT ONNX Runtime EP. The crash signal is SIGSEGV(SEGV_MAPERR)@0x0000000000000078, initially assessed as a null pointer dereference. The crash occurs while libspacemit_ep.so.2 is compiling an ONNX Clip operator, not in the application’s JS/ArkTS layer.
【Environment】
Device: Spacemit K3-Pico
System: OpenHarmony 6.1.0.35
CpuAbi: riscv64
Application: com.example.k3_depth_anything 1.0.0, ReleaseType: debug
Process: Pid 16288, Uid 20010057
Crash time: 2026-11-04 15:32:17.575
Crash thread: Tid 25364, Name: WorkerThread
Related libraries:
/system/lib64/libspacemit_ep.so.2
/system/lib64/libonnxruntime.so.1
/data/storage/el1/bundle/libs/riscv64/libentry.so
【Model and Trigger Scenario】
Model path: /data/models/depthv3/da3_small_1view.fp16.onnx
Model size: 62447987 bytes
Input: images, shape 1x1x3x280x504, type 1 (FLOAT)
Outputs: depth / depth_conf / extrinsics / intrinsics
Application logs show:
- SpaceMIT EP enabled
- Using CPU inference
- Starting warmup, empty tensor 504 x 280
- Session.Run started: 504 x 280, 423360 elements
A SIGSEGV occurs approximately 118 ms later.
【Crash Stack】
Reason: Signal:SIGSEGV(SEGV_MAPERR)@0x0000000000000078 probably caused by NULL pointer dereference
Fault thread: Tid:25364, Name:WorkerThread
#00 pc 00000000002f2e3e /system/lib64/libspacemit_ep.so.2(onnxruntime::spacemit::OnnxTensorData::GetBufferRaw()+8)
#01 pc 0000000000369718 /system/lib64/libspacemit_ep.so.2(onnxruntime::spacemit::SpineUnaryOperator::Compile(onnxruntime::spacemit::SpineGraphExecutor&)+1444)
#02 pc 000000000036b4be /system/lib64/libspacemit_ep.so.2(onnxruntime::spacemit::RegisterSpineOperatorForClip()::$_0::__invoke(onnxruntime::spacemit::SpineGraphExecutor&, onnxruntime::spacemit::SpineNode&)+126)
#03 pc 00000000002f47f8 /system/lib64/libspacemit_ep.so.2(onnxruntime::spacemit::SpineOperatorManager::CreateOperator(onnxruntime::spacemit::SpineGraphExecutor&, onnxruntime::spacemit::SpineNode&)+98)
#04 pc 00000000003969a4 /system/lib64/libspacemit_ep.so.2(onnxruntime::spacemit::SpineGraphExecutor::AddKernels()+78)
#05 pc 00000000003b29f6 /system/lib64/libspacemit_ep.so.2
【Initial Analysis】
The crash occurs at OnnxTensorData::GetBufferRaw()+8, accessing address 0x78, which is characteristic of accessing a field at an offset from a null pointer or object. The call chain shows that the SpaceMIT EP is registering/creating an operator for a Clip node. SpineUnaryOperator::Compile calls GetBufferRaw() while compiling Clip, but the corresponding OnnxTensorData object is null. We suspect that the EP does not fully handle optional min/max inputs, constant inputs, or opset differences for ONNX Clip nodes, and does not check for null pointers. Instead of falling back to the CPU EP when an operation is unsupported, it crashes with SIGSEGV.
【Steps to Reproduce】
- Install com.example.k3_depth_anything on Spacemit K3-Pico / OpenHarmony 6.1.0.35.
- Use /data/models/depthv3/da3_small_1view.fp16.onnx.
- Enable the SpaceMIT EP, run DepthEngine::LoadModel(), then call Warmup()/the first Session.Run.
- The process crashes while the SpaceMIT EP is compiling the Clip operator.
【Investigation Completed / Confirmation Requested from Vendor】
- The device has approximately 13.5 GB of available memory and the process RSS is approximately 355 MB, ruling out OOM.
- The main thread is in epoll_wait, and the crashing thread is the EP WorkerThread, ruling out a main-thread ANR.
- Please confirm whether the versions of libspacemit_ep.so.2 and libonnxruntime.so.1 are compatible.
- Please confirm whether this EP supports optional min/max inputs for Clip opset 11+, inputs in initializer form, and mixed FLOAT/FP16 models.
- If needed, we can provide a minimal reproduction project, a dump of the model’s Clip nodes, and comparative logs from the CPU EP alone with the SpaceMIT EP disabled.