google-ai-edge / mediapipe

Cross-platform, customizable ML solutions for live and streaming media.
https://ai.google.dev/edge/mediapipe
Apache License 2.0
27.69k stars 5.18k forks source link

Support of 16KB page sizes #5728

Open mimai-hen opened 1 week ago

mimai-hen commented 1 week ago

Android 15 will now offer support for 16KB page size. Then, all shared libraries shipped within Android apps must be recompiled to support 16KB page size. See documentation :

https://developer.android.com/guide/practices/page-sizes https://source.android.com/docs/core/architecture/16kb-page-size/16kb

I've checked ELF alignment of shared libraries in my project, and result shows that libmediapipe_tasks_vision_jni.so is not aligned : lib/arm64-v8a/libmediapipe_tasks_vision_jni.so: \e[31mUNALIGNED\e[0m (2**12)

This issue is to ask support for Android 16KB page size in mediapipe lib. Thanks

kuaashish commented 1 week ago

Hi @mimai-hen,

Could you please provide more details about your query regarding support for 16KB pages? We are having difficulties to understand it clearly.

Thank you!!

mimai-hen commented 1 week ago

Hi,

I’ll try to explain. In my Android project I use mediapipe task vision com.google.mediapipe:tasks-vision:0.10.18 for face detection.

When I launch my application on an Android 15 (with 16KB page size) emulator, it crashes when I try using face detection feature :

13:05:37.591 A Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x767d224a47f0 in tid 3371 (xxx.pro.debug), pid 3371 (frica.pro.debug) 13:05:38.007 A pid: 3371, tid: 3371, name: frica.pro.debug >>> xxx.pro.debug <<< 13:05:38.007 A #00 pc 0000000000bc47f0 /data/app/~~L48Lg1SFS4Btj8M5vE4IXw==/xxx.pro.debug-yimG5q0h5w9HtxLEz7xbSw==/lib/arm64/libmediapipe_tasks_vision_jni.so (BuildId: bca8e7908753794146dd5fbd3c1ea403) 13:05:38.007 A #01 pc 0000000000bbee84 /data/app/~~L48Lg1SFS4Btj8M5vE4IXw==/com.orange.money.africa.pro.debug-yimG5q0h5w9HtxLEz7xbSw==/lib/arm64/libmediapipe_tasks_vision_jni.so (BuildId: bca8e7908753794146dd5fbd3c1ea403)

When I launch my application on an Android 15 (with standard 4KB page size) face detection works fine, as well as previous android versions.

In order to make it work on Android 15 (with 16KB page size), some adaptations must be made to native shared libs (here libmediapipe_tasks_vision_jni.so)

Please read carefully android developers guidelines about 16KB memory page size support : https://developer.android.com/guide/practices/page-sizes?hl=en

I apologize if it’s not the right place to ask for this issue to be fixed (in that case, may be you can let me know where I should post this issue)

I hope it’s more clear. Kind regards,