onnxruntime: [Mobile] React Native app crash with Fatal signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr 0x6f6d9217fc in tid 10411 (mqt_native_modu), pid 10224 (ReactNativeDemo)
Describe the issue
I can confirm that this error occurs when I run const “fetches = await session.run(feeds);”. As this is native crash, I have no idea how to fix it. Please help! The code works on pixel 4a emulator but not on my samsung note 10 lite.
To reproduce
Code crashed after running const fetches = await session.run(feeds); and upon setting breakpoint, the app crashing point is determined to be at OrtSession.java
OrtSession.java crashing point:
OnnxValue[] outputValues =
run(
OnnxRuntime.ortApiHandle,
nativeHandle,
allocator.handle,
inputNamesArray,
inputHandles,
inputNamesArray.length,
outputNamesArray,
outputNamesArray.length,
runOptionsHandle);
return new Result(outputNamesArray, outputValues);
My code crashing point:
export const predictModelfromUri = async (
session: ort.InferenceSession,
imageUri: string
): Promise<number> => {
const imageFloat32 = await convertImageToFloat32Array(imageUri);
const feeds: Record<string, ort.Tensor> = {};
feeds[session.inputNames[0]] = new ort.Tensor(
"float32",
imageFloat32!,
[1, 3, 224, 224]
);
const fetches = await session.run(feeds);
const output: object = fetches[session.outputNames[0]].data;
return findMaxId(Object.values(output));
};
Urgency
No response
Platform
Android
OS Version
13
ONNX Runtime Installation
Built from Source
Compiler Version (if ‘Built from Source’)
No response
Package Name (if ‘Released Package’)
None
ONNX Runtime Version or Commit ID
onnxruntime-react-native@1.15.1
ONNX Runtime API
Java/Kotlin
Architecture
ARM64
Execution Provider
Default CPU
Execution Provider Library Version
No response
About this issue
- Original URL
- State: closed
- Created 10 months ago
- Comments: 35 (17 by maintainers)
Commits related to this issue
- Fix illegal opcode error from mlas (#17885) ### Description <!-- Describe your changes. --> Use cpuinfo value when checking to dot product is available. Reading the ID_AA64ISAR0_EL1 register is un... — committed to microsoft/onnxruntime by skottmckay 9 months ago
- Fix illegal opcode error from mlas (#17885) ### Description <!-- Describe your changes. --> Use cpuinfo value when checking to dot product is available. Reading the ID_AA64ISAR0_EL1 register is un... — committed to snnn/onnxruntime by skottmckay 9 months ago
- Fix illegal opcode error from mlas (#17885) ### Description <!-- Describe your changes. --> Use cpuinfo value when checking to dot product is available. Reading the ID_AA64ISAR0_EL1 register is un... — committed to kleiti/onnxruntime by skottmckay 9 months ago
The tests ran as expected. Running onnxruntime_mlas_test_1.16.1 failed and onnxruntime_mlas_test_1.16.1_patch pass.
@chenfu these devices are pretty old. According to this the Nokia 8 has a Qualcomm Snapdragon 835 which according to this has ‘Kryo 280 (2.45 GHz Cortex-A73 + 1.9 GHz Cortex-A53)’ and according to this both of those Cortex chips are ARMv8-A and not ARMv8.2-A.
The latest version of the Samsung Galaxy 8 also used a Cortex-A73/Cortext-A53 according to this.
This is still a little muddy when combined with https://github.com/microsoft/onnxruntime/issues/17647#issuecomment-1738542003 for two reasons
Here are some potential tests we could do using the onnx_test_runner binary to take React Native out of the picture. This can be run on device using
adb.test 1: Attempt to run the resnet18 model from this issue
test 2 if test 1 fails: Attempt to run the ‘Reshape’ model Rachel mentioned above
test 3 if test 2 passes: build onnx_test_runner with flags that target ARMv8-A instead of ARMv8.2-A
We can provide a zip with the necessary onnx_test_runner binaries/models/input data and instructions to run them if someone is able to test this out on a device with the issue.
Regardless, we should consider changing the MLAS flags to target ARMv8-A rather than ARMv8.2-A for Android builds if we want to support old devices.
@bartproo Just to double check the model executes correctly with XNNPACK and we can say for sure that the ORT MLAS implementation is the issue?
@YUNQIUGUO Yes my crash happened on android 13 note 10 lite. The xiaomi is android 12. I tried running your model with the following code and it ran successfully
As far as I tested, it failed on Android 9 or older. It works fine on Android 10 or newer.
Just FYI, we are experiencing the same (?) crash on Android 9 devices, but only since version
1.16.0. Version1.15.1is working fine for us.Fatal signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr 0x6f291947fc in tid 13393In case I find any more information I will post it here.
Just realised that the access to the drive link is restricted. I have allowed access for anyone with the link now
Can you clarify where this is running? You’ve said the architecture is X64 but in the stack trace it’s using /lib/arm64/libonnxruntime.so.