-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Mobile] OpenCV assertion failure on MediaTek devices (SM-A137F): Missing CPU baseline features #22780
Comments
ONNX Runtime doesn't use opencv AFAIK so not clear where that error is coming from. OpenCV was until very recently used in onnxruntime-extensions for some custom image processing operators, but your model doesn't use any of those operators. Did you by any chance enable the extensions? |
Hi @skottmckay - thanks for the quick reply. I upgraded to 1.20.0, which should include latest extension, where OpenCV should have been removed from according to change logs(?) Anyways, I found it was not directly related: 1. nnapi EP ❌
2. nnapi EP (no runtime extensions) ❌
3. cpu EP (default params) ❌
4. cpu EP + 5. cpu EP + ConclusionsSomething is happening inside onnx-react-nativewhen graphOptimizationLevels are turned on, raising a SIGBUS. After getting ONNX running, we found another native library also causing a SIGBUS. We worked with the team, and it turns out its caused by unaligned access/reads:
I believe it could be the same compatibility if onnx relies on unaligned access anywhere in it's internals, specifically in the code related to graph optimizations, but I cannot verify. What do you think @skottmckay ? |
If you don't need ORT extensions (AFAICS you do not) it would be simpler to not enable them at all. We don't rely on unaligned access but it's possible there's a bug on 32-bit ARM. It would be helpful to know what optimizer is causing the issue. If you set the session log severity to VERBOSE does it provide any hints as to which optimizer is running at the time? |
@skottmckay ORT extensions I can disable for sure. With regards to the graph operations (set to basic), this is where it fails:
|
Thanks for the output. I don't think the ConstantSharing optimizer is to blame - no suspicious casts there and it's pointing multiple usages of the same initializer values to a single location so the data alignment should be unchanged. I believe the following optimizer is the issue. onnxruntime/onnxruntime/core/optimizer/graph_transformer_utils.cc Lines 232 to 233 in bc2b1b5
There are a few places where the CommonSubexpressionElimination optimizer onnxruntime/onnxruntime/core/optimizer/common_subexpression_elimination.cc Lines 185 to 193 in bc2b1b5
and onnxruntime/onnxruntime/core/optimizer/common_subexpression_elimination.cc Lines 244 to 255 in bc2b1b5
The latter appears to be the issue with your model. This has been seen before in the ONNX shape inferencing, so I think we need the same fix here of calling onnx::ParseData instead of casting. |
Describe the issue
Issue Description
When attempting to initialize an ONNX Runtime inference session on a Samsung A13 (SM-A137F) with MediaTek MT6833 Dimensity 700 processor (ARM32 - armeabi-v7a), the app crashes with an OpenCV assertion error regarding missing CPU baseline features. This happens in even when using minimal CPU-only configuration options or any other set of options.
Error Message
Expected Behavior
The inference session should initialize successfully with fallback to basic CPU features when advanced CPU features are not available.
Additional Context
To reproduce
We are using the embedding model
jina-embeddings-v2-small-en-quantized
(available on HF)Urgency
No response
Platform
Android
OS Version
14
ONNX Runtime Installation
Released Package
Compiler Version (if 'Built from Source')
No response
Package Name (if 'Released Package')
onnxruntime-react-native
ONNX Runtime Version or Commit ID
1.17.0
ONNX Runtime API
Java/Kotlin
Architecture
ARM32
Execution Provider
Default CPU
Execution Provider Library Version
No response
The text was updated successfully, but these errors were encountered: