Skip to content

Help in running onnxruntime with SNPE as execution provider #13693

Open
@adjhawar

Description

@adjhawar

Describe the issue

I am unable to run onnxruntime with SNPE as execution provider on mobile devices. The build is successful but while running with SNPE I am getting the below crash:

11-17 22:30:07.235 17450 17472 I onnxruntime: [I:onnxruntime:, bfc_arena.cc:26 BFCArena] Creating BFCArena for SNPE with following configs: initial_chunk_size_bytes: 1048576 max_dead_bytes_per_chunk: 134217728 initial_growth_chunk_size_bytes: 2097152 memory limit: 18446744073709551615 arena_extend_strategy: 0
11-17 22:30:07.235 17450 17472 V onnxruntime: [V:onnxruntime:, bfc_arena.cc:62 BFCArena] Creating 21 bins of max chunk size 256 to 268435456
11-17 22:30:07.235 17450 17472 I onnxruntime: [I:onnxruntime:, inference_session.cc:1222 Initialize] Initializing session.
11-17 22:30:07.235 17450 17472 I onnxruntime: [I:onnxruntime:, inference_session.cc:1259 Initialize] Adding default CPU execution provider.
11-17 22:30:07.235 17450 17472 I onnxruntime: [I:onnxruntime:, bfc_arena.cc:26 BFCArena] Creating BFCArena for Cpu with following configs: initial_chunk_size_bytes: 1048576 max_dead_bytes_per_chunk: 134217728 initial_growth_chunk_size_bytes: 2097152 memory limit: 18446744073709551615 arena_extend_strategy: 0
11-17 22:30:07.235 17450 17472 V onnxruntime: [V:onnxruntime:, bfc_arena.cc:62 BFCArena] Creating 21 bins of max chunk size 256 to 268435456
11-17 22:30:07.235 17450 17472 I onnxruntime: [I:onnxruntime:, session_state.cc:31 SetupAllocators] Allocator already registered for OrtMemoryInfo:[name:Cpu id:0 OrtMemType:0 OrtAllocatorType:1 Device:[DeviceType:0 MemoryType:0 DeviceId:0]]. Ignoring allocator from CPUExecutionProvider
11-17 22:30:07.240 17450 17472 V onnxruntime: [V:onnxruntime:, session_state.cc:1010 VerifyEachNodeIsAssignedToAnEp] Node placements
11-17 22:30:07.240 17450 17472 V onnxruntime: [V:onnxruntime:, session_state.cc:1013 VerifyEachNodeIsAssignedToAnEp] All nodes placed on [SNPEExecutionProvider]. Number of nodes: 1
11-17 22:30:07.240 17450 17472 V onnxruntime: [V:onnxruntime:, session_state.cc:66 CreateGraphInfo] SaveMLValueNameIndexMapping
11-17 22:30:07.240 17450 17472 V onnxruntime: [V:onnxruntime:, session_state.cc:112 CreateGraphInfo] Done saving OrtValue mappings.
11-17 22:30:07.240 17450 17472 I onnxruntime: [I:onnxruntime:, session_state_utils.cc:199 SaveInitializedTensors] Saving initialized tensors.
11-17 22:30:07.240 17450 17472 I onnxruntime: [I:onnxruntime:, session_state_utils.cc:342 SaveInitializedTensors] Done saving initialized tensors
11-17 22:30:07.267 17450 17472 I onnxruntime: [I:onnxruntime:, snpe_runtime_options.cc:18 ParseOptions] Located user specified runtime target: DSP
11-17 22:30:07.267 17450 17472 I onnxruntime: [I:onnxruntime:, snpe_runtime_options.cc:20 ParseOptions] Runtime target: dsp_fixed8_tf
--------- beginning of crash
11-17 22:30:07.296 17450 17472 F libc : Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x7273e03ac8 in tid 17472 (binder:17450_3), pid 17450 (android.app.kfa)

Stacktrace:
11-17 22:30:09.098 18947 18947 F DEBUG : #00 pc 0000000000001ac8 /system/priv-app/ONNXRuntime_SNPE/ONNXRuntime_SNPE.apk
11-17 22:30:09.099 18947 18947 F DEBUG : #1 pc 00000000000eab24 /system/priv-app/ONNXRuntime_SNPE/ONNXRuntime_SNPE.apk!libc++_shared.so (BuildId: a59088f9640cd272bc9542d94dc84a0c88afd558)
11-17 22:30:09.099 18947 18947 F DEBUG : #2 pc 00000000000ea818 /system/priv-app/ONNXRuntime_SNPE/ONNXRuntime_SNPE.apk!libc++_shared.so (BuildId: a59088f9640cd272bc9542d94dc84a0c88afd558)
11-17 22:30:09.099 18947 18947 F DEBUG : #3 pc 00000000000e6e30 /system/priv-app/ONNXRuntime_SNPE/ONNXRuntime_SNPE.apk!libc++_shared.so (BuildId: a59088f9640cd272bc9542d94dc84a0c88afd558)
11-17 22:30:09.099 18947 18947 F DEBUG : #4 pc 00000000000e6cc0 /system/priv-app/ONNXRuntime_SNPE/ONNXRuntime_SNPE.apk!libc++_shared.so (__gxx_personality_v0+224) (BuildId: a59088f9640cd272bc9542d94dc84a0c88afd558)
11-17 22:30:09.099 18947 18947 F DEBUG : #5 pc 00000000007b78dc /system/priv-app/ONNXRuntime_SNPE/ONNXRuntime_SNPE.apk!libSNPE.so (BuildId: a862fb87a29f2675a73716160a62349c4d5ed3cb)
11-17 22:30:09.099 18947 18947 F DEBUG : #6 pc 00000000007b7de4 /system/priv-app/ONNXRuntime_SNPE/ONNXRuntime_SNPE.apk!libSNPE.so (BuildId: a862fb87a29f2675a73716160a62349c4d5ed3cb)
11-17 22:30:09.099 18947 18947 F DEBUG : #7 pc 0000000000112558 /system/priv-app/ONNXRuntime_SNPE/ONNXRuntime_SNPE.apk!libSNPE.so (BuildId: a862fb87a29f2675a73716160a62349c4d5ed3cb)
11-17 22:30:09.099 18947 18947 F DEBUG : #8 pc 00000000000ea82c /system/priv-app/ONNXRuntime_SNPE/ONNXRuntime_SNPE.apk!libSNPE.so (BuildId: a862fb87a29f2675a73716160a62349c4d5ed3cb)
11-17 22:30:09.099 18947 18947 F DEBUG : #9 pc 00000000000c530c /system/priv-app/ONNXRuntime_SNPE/ONNXRuntime_SNPE.apk!libSNPE.so (zdl::SNPE::SNPEFactory::isRuntimeAvailable(zdl::DlSystem::Runtime_t, zdl::DlSystem::RuntimeCheckOption_t)+252) (BuildId: a862fb87a29f2675a73716160a62349c4d5ed3cb)
11-17 22:30:09.099 18947 18947 F DEBUG : #10 pc 00000000003f2414 /system/priv-app/ONNXRuntime_SNPE/ONNXRuntime_SNPE.apk!libonnxruntime.so (BuildId: 6551e8af621f11d06c3e8d7e25934ec7c28c666c)

To reproduce

Model used was mobilenet_v1 - downloaded from tflite source
NDK Build version: 23.1.7779620

Urgency

Urgent

Platform

Android

OS Version

33

ONNX Runtime Installation

Built from Source

Compiler Version (if 'Built from Source')

No response

Package Name (if 'Released Package')

No response

ONNX Runtime Version or Commit ID

1.13.1

ONNX Runtime API

C++/C

Architecture

ARM64

Execution Provider

SNPE

Execution Provider Library Version

SNPE 1.66.0.3729 aarch64-android-clang8.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    ep:SNPEissues related to SNPE execution providerplatform:mobileissues related to ONNX Runtime mobile; typically submitted using template

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions