Skip to content

XNNPACK LLama demo docs not working #6300

@LandonPatmore

Description

@LandonPatmore

🐛 Describe the bug

Running step 4:

pushd examples/demo-apps/android/LlamaDemo
./gradlew :app:setup
popd

Produces the following output:

> Task :app:setup FAILED
++ [[ examples/demo-apps/android/LlamaDemo/../../../../build/build_android_llm_demo.sh == \e\x\a\m\p\l\e\s\/\d\e\m\o\-\a\p\p\s\/\a\n\d\r\o\i\d\/\L\l\a\m\a\D\e\m\o\/\s\e\t\u\p\.\s\h ]]
++ mktemp -d
+ BUILD_AAR_DIR=/var/folders/7f/qz4htn8x49j_jwh2jp_1b3n40000gn/T/tmp.MQlhFv6Ih1
+ export BUILD_AAR_DIR
+ build_jar
+ pushd extension/android
+ ./gradlew build
~/Development/executorch/extension/android ~/Development/executorch
> Task :compileJava UP-TO-DATE
> Task :processResources NO-SOURCE
> Task :classes UP-TO-DATE
> Task :jar UP-TO-DATE
> Task :assemble UP-TO-DATE
> Task :compileTestJava NO-SOURCE
> Task :processTestResources NO-SOURCE
> Task :testClasses UP-TO-DATE
> Task :test NO-SOURCE
> Task :check UP-TO-DATE
> Task :build UP-TO-DATE

BUILD SUCCESSFUL in 261ms
2 actionable tasks: 2 up-to-date
+ popd
~/Development/executorch
+ mkdir -p /var/folders/7f/qz4htn8x49j_jwh2jp_1b3n40000gn/T/tmp.MQlhFv6Ih1/libs
+ cp extension/android/build/libs/executorch.jar /var/folders/7f/qz4htn8x49j_jwh2jp_1b3n40000gn/T/tmp.MQlhFv6Ih1/libs/
+ build_android_native_library arm64-v8a
+ ANDROID_ABI=arm64-v8a
+ ANDROID_NDK=/Users/lpatmore/Library/Android/sdk/ndk/r26c
+ CMAKE_OUT=cmake-out-android-arm64-v8a
+ QNN_SDK_ROOT=
+ '[' -n '' ']'
+ EXECUTORCH_BUILD_QNN=OFF
examples/demo-apps/android/LlamaDemo/../../../../build/build_android_llm_demo.sh: line 29: NEURON_BUFFER_ALLOCATOR_LIB: unbound variable

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:setup'.
> Process 'command 'sh'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 734ms
1 actionable task: 1 executed

Ran it a couple times and cleaned out the gradle files, but nothing seems to work. I am using NDK r26c. It seems there is a missing exported variable?

I have also ran the optional script since the above was not working:

sh examples/demo-apps/android/LlamaDemo/setup.sh

But still does not work with:

++ [[ examples/demo-apps/android/LlamaDemo/../../../../build/build_android_llm_demo.sh == \e\x\a\m\p\l\e\s\/\d\e\m\o\-\a\p\p\s\/\a\n\d\r\o\i\d\/\L\l\a\m\a\D\e\m\o\/\s\e\t\u\p\.\s\h ]]
++ mktemp -d
+ BUILD_AAR_DIR=/var/folders/7f/qz4htn8x49j_jwh2jp_1b3n40000gn/T/tmp.qGwJto8dQZ
+ export BUILD_AAR_DIR
+ build_jar
+ pushd extension/android
~/Development/executorch/extension/android ~/Development/executorch
+ ./gradlew build

BUILD SUCCESSFUL in 320ms
2 actionable tasks: 2 up-to-date
+ popd
~/Development/executorch
+ mkdir -p /var/folders/7f/qz4htn8x49j_jwh2jp_1b3n40000gn/T/tmp.qGwJto8dQZ/libs
+ cp extension/android/build/libs/executorch.jar /var/folders/7f/qz4htn8x49j_jwh2jp_1b3n40000gn/T/tmp.qGwJto8dQZ/libs/
+ build_android_native_library arm64-v8a
+ ANDROID_ABI=arm64-v8a
+ ANDROID_NDK=/Users/lpatmore/Library/Android/sdk/ndk/r26c
+ CMAKE_OUT=cmake-out-android-arm64-v8a
+ QNN_SDK_ROOT=
+ '[' -n '' ']'
+ EXECUTORCH_BUILD_QNN=OFF
examples/demo-apps/android/LlamaDemo/../../../../build/build_android_llm_demo.sh: line 29: NEURON_BUFFER_ALLOCATOR_LIB: unbound variable

It seems either the docs are missing something or I am missing something? Thanks!

Versions

PyTorch version: 2.6.0.dev20241007
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: macOS 14.7 (arm64)
GCC version: Could not collect
Clang version: 16.0.0 (clang-1600.0.26.3)
CMake version: version 3.30.4
Libc version: N/A

Python version: 3.10.0 (default, Mar 3 2022, 03:54:28) [Clang 12.0.0 ] (64-bit runtime)
Python platform: macOS-14.7-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 Max

Versions of relevant libraries:
[pip3] executorch==0.5.0a0+2c8b14c
[pip3] numpy==1.26.4
[pip3] torch==2.6.0.dev20241007
[pip3] torchao==0.5.0+git0916b5b2
[pip3] torchaudio==2.5.0.dev20241007
[pip3] torchsr==1.0.4
[pip3] torchvision==0.20.0.dev20241007
[conda] executorch 0.5.0a0+2c8b14c pypi_0 pypi
[conda] numpy 1.26.4 pypi_0 pypi
[conda] torch 2.6.0.dev20241007 pypi_0 pypi
[conda] torchao 0.5.0+git0916b5b2 pypi_0 pypi
[conda] torchaudio 2.5.0.dev20241007 pypi_0 pypi
[conda] torchsr 1.0.4 pypi_0 pypi
[conda] torchvision 0.20.0.dev20241007 pypi_0 pypi

Metadata

Metadata

Assignees

Labels

module: androidIssues related to Android code, build, and executiontriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions