Open YuHayring opened 2 months ago
cc @kirklandsign
This IC4 XNNPACK model runs on linux x86_64 xnn_executor_runner, but not on android arm64-v8a. Something specific to android arm64-v8a
cc @mcr229 @digantdesai
@kirklandsign do you have a repro binary/file to test with?
Export model
python3 -m examples.xnnpack.aot_compiler --model_name="ic4" --delegate
export ANDROID_ABI=arm64-v8a
export ANDROID_NDK=<path-to-ndk>
export CMAKE_OUT="cmake-out-android-${ANDROID_ABI}"
cmake . -DCMAKE_INSTALL_PREFIX="${CMAKE_OUT}" \
-DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" \
-DANDROID_ABI="${ANDROID_ABI}" \
-DANDROID_PLATFORM=android-23 \
-DEXECUTORCH_ENABLE_LOGGING=ON \
-DEXECUTORCH_LOG_LEVEL=Info \
-DEXECUTORCH_BUILD_XNNPACK=ON \
-DEXECUTORCH_XNNPACK_SHARED_WORKSPACE=ON \
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
-DEXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL=ON \
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
-B"${CMAKE_OUT}"
cmake --build "${CMAKE_OUT}" -j 10 --target install
And you will find cmake-out-android-arm64-v8a/backends/xnnpack/xnn_executor_runner
adb push cmake-out-android-arm64-v8a/backends/xnnpack/xnn_executor_runner /data/local/tmp
adb shell chmod +x /data/local/tmp/xnn_executor_runner
adb push ic4_xnnpack_fp32.pte /data/local/tmp
adb shell /data/local/tmp/xnn_executor_runner --model_path /data/local/tmp/ic4_xnnpack_fp32.pte
FP32 only. Not Q8
🐛 Describe the bug
I built the .so file and .pte file, put them into corrent path. And then I edited the AndroidManifest.xml. Moved the main-intent-filter from MainActivity to ClassificationActivity that the app will launch into ClassificationActivity. I clicked the Run button after the image of the dog was loaded. And after 1s the app crashed.
This is the log of android console loged after crashed:
This is the top 10 backtrace which was the output of using addr2line program in NDK
This is my build script which is user to generate .pte file:
This is my build script which is used to build .so file:
Versions
PyTorch version: 2.5.0.dev20240901 Is debug build: False CUDA used to build PyTorch: None ROCM used to build PyTorch: N/A
OS: macOS 14.6.1 (arm64) GCC version: Could not collect Clang version: 15.0.0 (clang-1500.3.9.4) CMake version: version 3.30.2 Libc version: N/A
Python version: 3.12.4 | packaged by Anaconda, Inc. | (main, Jun 18 2024, 10:07:17) [Clang 14.0.6 ] (64-bit runtime) Python platform: macOS-14.6.1-arm64-arm-64bit Is CUDA available: False CUDA runtime version: No CUDA CUDA_MODULE_LOADING set to: N/A GPU models and configuration: No CUDA Nvidia driver version: No CUDA cuDNN version: No CUDA HIP runtime version: N/A MIOpen runtime version: N/A Is XNNPACK available: True
CPU: Apple M3
Versions of relevant libraries: [pip3] executorch==0.4.0a0+32d83b0 [pip3] numpy==1.26.4 [pip3] torch==2.5.0.dev20240901 [pip3] torchaudio==2.5.0.dev20240901 [pip3] torchsr==1.0.4 [pip3] torchvision==0.20.0.dev20240901 [conda] executorch 0.4.0a0+32d83b0 pypi_0 pypi [conda] numpy 1.26.4 pypi_0 pypi [conda] torch 2.5.0.dev20240901 pypi_0 pypi [conda] torchaudio 2.5.0.dev20240901 pypi_0 pypi [conda] torchsr 1.0.4 pypi_0 pypi [conda] torchvision 0.20.0.dev20240901 pypi_0 pypi