Open MeeCreeps opened 1 month ago
@MeeCreeps Sir,can you please share more detailed steps for building with Vulkan&GPU backend?I can't build if I enabled Vulkan for Android,typically if I just build with Vulkan enabled(not for Android),it can work.
Build for Android with Vulkan backend enabled,error logs:
[ 1%] Built target build_info
[ 1%] Built target sha256
[ 2%] Built target xxhash
[ 3%] Built target sha1
[ 4%] Built target vulkan-shaders-gen
[ 5%] Generate vulkan shaders
/bin/sh: 1: vulkan-shaders-gen: not found
make[2]: *** [ggml/src/CMakeFiles/ggml.dir/build.make:123: ggml/src/ggml-vulkan-shaders.hpp] Error 127
make[1]: *** [CMakeFiles/Makefile2:1617: ggml/src/CMakeFiles/ggml.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
my build configuration:
cmake -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=latest -DCMAKE_C_FLAGS=-march=armv8.4a+dotprod -DGGML_VULKAN=1 ..
@MeeCreeps Sir,can you please share more detailed steps for building with Vulkan&GPU backend?I can't build if I enabled Vulkan for Android,typically if I just build with Vulkan enabled(not for Android),it can work.
Build for Android with Vulkan backend enabled,error logs:
[ 1%] Built target build_info [ 1%] Built target sha256 [ 2%] Built target xxhash [ 3%] Built target sha1 [ 4%] Built target vulkan-shaders-gen [ 5%] Generate vulkan shaders /bin/sh: 1: vulkan-shaders-gen: not found make[2]: *** [ggml/src/CMakeFiles/ggml.dir/build.make:123: ggml/src/ggml-vulkan-shaders.hpp] Error 127 make[1]: *** [CMakeFiles/Makefile2:1617: ggml/src/CMakeFiles/ggml.dir/all] Error 2 make: *** [Makefile:146: all] Error 2
my build configuration:
cmake -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=latest -DCMAKE_C_FLAGS=-march=armv8.4a+dotprod -DGGML_VULKAN=1 ..
you can first build the target vulkan-shaders-gen without android compile flags and set it in the environment
@MeeCreeps Sir,can you please share more detailed steps for building with Vulkan&GPU backend?I can't build if I enabled Vulkan for Android,typically if I just build with Vulkan enabled(not for Android),it can work. Build for Android with Vulkan backend enabled,error logs:
[ 1%] Built target build_info [ 1%] Built target sha256 [ 2%] Built target xxhash [ 3%] Built target sha1 [ 4%] Built target vulkan-shaders-gen [ 5%] Generate vulkan shaders /bin/sh: 1: vulkan-shaders-gen: not found make[2]: *** [ggml/src/CMakeFiles/ggml.dir/build.make:123: ggml/src/ggml-vulkan-shaders.hpp] Error 127 make[1]: *** [CMakeFiles/Makefile2:1617: ggml/src/CMakeFiles/ggml.dir/all] Error 2 make: *** [Makefile:146: all] Error 2
my build configuration:
cmake -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=latest -DCMAKE_C_FLAGS=-march=armv8.4a+dotprod -DGGML_VULKAN=1 ..
you can first build the target vulkan-shaders-gen without android compile flags and set it in the environment
can you tell me what's the variable should I set in environment for vulkan-shaders-gen
@MeeCreeps Sir,can you please share more detailed steps for building with Vulkan&GPU backend?I can't build if I enabled Vulkan for Android,typically if I just build with Vulkan enabled(not for Android),it can work. Build for Android with Vulkan backend enabled,error logs:
[ 1%] Built target build_info [ 1%] Built target sha256 [ 2%] Built target xxhash [ 3%] Built target sha1 [ 4%] Built target vulkan-shaders-gen [ 5%] Generate vulkan shaders /bin/sh: 1: vulkan-shaders-gen: not found make[2]: *** [ggml/src/CMakeFiles/ggml.dir/build.make:123: ggml/src/ggml-vulkan-shaders.hpp] Error 127 make[1]: *** [CMakeFiles/Makefile2:1617: ggml/src/CMakeFiles/ggml.dir/all] Error 2 make: *** [Makefile:146: all] Error 2
my build configuration:
cmake -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=latest -DCMAKE_C_FLAGS=-march=armv8.4a+dotprod -DGGML_VULKAN=1 ..
you can first build the target vulkan-shaders-gen without android compile flags and set it in the environment
can you tell me what's the variable should I set in environment for
vulkan-shaders-gen
In file "ggml/src/CMakeLists.txt", it has set (_ggml_vk_genshaders_cmd vulkan-shaders-gen)
, which will be called later to generate vulkan shaders, so you should let set the executable file vulkan-shaders-gen
in your os path, or you can set the variable _ggml_vk_genshaders_cmd
in CMakeLists to the path contains vulkan-shaders-gen
.
@MeeCreeps thank you sir! I have followed your instruction to set PATH which will include vulkan-shaders-gen
,now it can generate shaders but still can't build,errors like this:
mkdir build-android && cd build-android && cmake -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake -DANDROID_ABI=x86_64 -DANDROID_PLATFORM=latest -DGGML_VULKAN=1 .. && make -j4
-- Using latest available ANDROID_PLATFORM: 35.
-- The C compiler identification is Clang 18.0.1
-- The CXX compiler identification is Clang 18.0.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/franzkafka95/Desktop/android/ndk/android-ndk-r27/toolchains/llvm/prebuilt/linux-x86_64/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/franzkafka95/Desktop/android/ndk/android-ndk-r27/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: /usr/bin/git (found version "2.34.1")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE
-- Found OpenMP_C: -fopenmp=libomp
-- Found OpenMP_CXX: -fopenmp=libomp
-- Found OpenMP: TRUE
-- OpenMP found
-- Using llamafile
-- Found Vulkan: /home/franzkafka95/Desktop/android/ndk/android-ndk-r27/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/x86_64-linux-android/35/libvulkan.so
-- Vulkan found
-- Warning: ccache not found - consider installing it for faster compilation or disable this warning with GGML_CCACHE=OFF
-- CMAKE_SYSTEM_PROCESSOR: x86_64
-- x86 detected
-- Configuring done
-- Generating done
-- Build files have been written to: /home/franzkafka95/Desktop/llama/llama.cpp/build-android
[ 0%] Building CXX object ggml/src/vulkan-shaders/CMakeFiles/vulkan-shaders-gen.dir/vulkan-shaders-gen.cpp.o
[ 1%] Building CXX object common/CMakeFiles/build_info.dir/build-info.cpp.o
[ 2%] Building C object examples/gguf-hash/CMakeFiles/sha256.dir/deps/sha256/sha256.c.o
[ 3%] Building C object examples/gguf-hash/CMakeFiles/xxhash.dir/deps/xxhash/xxhash.c.o
[ 3%] Built target build_info
[ 4%] Building C object examples/gguf-hash/CMakeFiles/sha1.dir/deps/sha1/sha1.c.o
[ 4%] Built target sha256
[ 4%] Built target sha1
[ 4%] Built target xxhash
[ 5%] Linking CXX executable ../../../bin/vulkan-shaders-gen
[ 5%] Built target vulkan-shaders-gen
[ 6%] Generate vulkan shaders
ggml_vulkan: Generating and compiling shaders to SPIR-V
[ 6%] Building C object ggml/src/CMakeFiles/ggml.dir/ggml.c.o
[ 8%] Building C object ggml/src/CMakeFiles/ggml.dir/ggml-alloc.c.o
[ 8%] Building C object ggml/src/CMakeFiles/ggml.dir/ggml-backend.c.o
[ 8%] Building C object ggml/src/CMakeFiles/ggml.dir/ggml-quants.c.o
[ 9%] Building CXX object ggml/src/CMakeFiles/ggml.dir/ggml-vulkan.cpp.o
/home/franzkafka95/Desktop/llama/llama.cpp/ggml/src/ggml-vulkan.cpp:7:10: fatal error: 'vulkan/vulkan.hpp' file not found
7 | #include <vulkan/vulkan.hpp>
| ^~~~~~~~~~~~~~~~~~~
[ 9%] Building CXX object ggml/src/CMakeFiles/ggml.dir/ggml-vulkan-shaders.cpp.o
1 error generated.
make[2]: *** [ggml/src/CMakeFiles/ggml.dir/build.make:187: ggml/src/CMakeFiles/ggml.dir/ggml-vulkan.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
it shows that the build system didn't find the header vulkan.hpp
,while I use find cmd to get this:
$find . -name vulkan.hpp
./Desktop/android/ndk/android-ndk-r25c/sources/third_party/vulkan/src/include/vulkan/vulkan.hpp
And I noticed that ggml-vulkan.cpp
not only used vulkan.hpp
but also used vulakn_core.h
,I found my host have the vulkan_core.h
:
$find . -name vulkan_core.h
./Desktop/android/ndk/android-ndk-r27/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/vulkan/vulkan_core.h
./Desktop/android/ndk/android-ndk-r25c/sources/third_party/vulkan/src/include/vulkan/vulkan_core.h
./Desktop/android/ndk/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/vulkan/vulkan_core.h
it seems that the header vulkan.hpp
should be in my NDK sub dir toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/vulkan/
but it doesn't,it is so wired,can you help me for this problem?
I also tried to rename vulkan.hpp
to vulkan.h
,because I can find vulkan.h
in toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/vulkan/
,but I got more compile errors.
so where is vulkan.hpp
from ?
I found vulkan.hpp
from /usr/include/vulkan
,so this header is provided by my host while not NDK,is it right?
update:it seems that NDK‘s Vulkan headers are outdated,so I update Vulkan related headers in NDK,like these sub dir:
android-ndk-r27/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/vk_video
android-ndk-r27/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/vulkan
now it can build successfully,
@MeeCreeps Hello sir,sorry to bother you again.when I use these libraries in my Android APK,I still got these errors,here is the log:
08-10 16:06:07.269 30852 30926 I LLama-android: build info:tag:3400,commit:97bdd26e,support GPU acceleration:true
08-10 16:06:07.334 30852 30926 I LLama-android: llama_model_loader: loaded meta data with 20 key-value pairs and 290 tensors from /data/user/0/com.set.ai/files/ai_model.gguf (version GGUF V3 (latest))
08-10 16:06:07.334 30852 30926 I LLama-android: llama_model_loader: Dumping metadata keys/values. Note: KV overrides do not apply in this output.
08-10 16:06:07.334 30852 30926 I LLama-android: llama_model_loader: - kv 0: general.architecture str = qwen2
08-10 16:06:07.334 30852 30926 I LLama-android: llama_model_loader: - kv 1: general.name str = seres_model
08-10 16:06:07.334 30852 30926 I LLama-android: llama_model_loader: - kv 2: qwen2.block_count u32 = 24
08-10 16:06:07.334 30852 30926 I LLama-android: llama_model_loader: - kv 3: qwen2.context_length u32 = 32768
08-10 16:06:07.334 30852 30926 I LLama-android: llama_model_loader: - kv 4: qwen2.embedding_length u32 = 896
08-10 16:06:07.334 30852 30926 I LLama-android: llama_model_loader: - kv 5: qwen2.feed_forward_length u32 = 4864
08-10 16:06:07.334 30852 30926 I LLama-android: llama_model_loader: - kv 6: qwen2.attention.head_count u32 = 14
08-10 16:06:07.334 30852 30926 I LLama-android: llama_model_loader: - kv 7: qwen2.attention.head_count_kv u32 = 2
08-10 16:06:07.334 30852 30926 I LLama-android: llama_model_loader: - kv 8: qwen2.rope.freq_base f32 = 1000000.000000
08-10 16:06:07.334 30852 30926 I LLama-android: llama_model_loader: - kv 9: qwen2.attention.layer_norm_rms_epsilon f32 = 0.000001
08-10 16:06:07.334 30852 30926 I LLama-android: llama_model_loader: - kv 10: general.file_type u32 = 2
08-10 16:06:07.334 30852 30926 I LLama-android: llama_model_loader: - kv 11: tokenizer.ggml.model str = gpt2
08-10 16:06:07.334 30852 30926 I LLama-android: llama_model_loader: - kv 12: tokenizer.ggml.pre str = qwen2
08-10 16:06:07.362 30852 30926 I LLama-android: llama_model_loader: - kv 13: tokenizer.ggml.tokens arr[str,151936] = ["!", "\"", "#", "$", "", "&", "'", ...
08-10 16:06:07.371 30852 30926 I LLama-android: llama_model_loader: - kv 14: tokenizer.ggml.token_type arr[i32,151936] = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
08-10 16:06:07.402 30852 30926 I LLama-android: llama_model_loader: - kv 15: tokenizer.ggml.merges arr[str,151387] = ["Ġ Ġ", "ĠĠ ĠĠ", "i n", "Ġ t",...
08-10 16:06:07.402 30852 30926 I LLama-android: llama_model_loader: - kv 16: tokenizer.ggml.bos_token_id u32 = 151643
08-10 16:06:07.402 30852 30926 I LLama-android: llama_model_loader: - kv 17: tokenizer.ggml.eos_token_id u32 = 151645
08-10 16:06:07.402 30852 30926 I LLama-android: llama_model_loader: - kv 18: tokenizer.chat_template str = {-107732238428550025633549537852171948407976130944385741446622902831951351080628521997716918865536884607535372703052150861230582896697462443075202517321702951537854339417602815342824911808967527308411848461112923592282659498077075523239936.000000or message in messages }{ 0f lo...
08-10 16:06:07.402 30852 30926 I LLama-android: llama_model_loader: - kv 19: general.quantization_version u32 = 2
08-10 16:06:07.402 30852 30926 I LLama-android: llama_model_loader: - type f32: 121 tensors
08-10 16:06:07.402 30852 30926 I LLama-android: llama_model_loader: - type q4_0: 168 tensors
08-10 16:06:07.402 30852 30926 I LLama-android: llama_model_loader: - type q8_0: 1 tensors
08-10 16:06:07.562 30852 30926 I LLama-android: llm_load_vocab: special tokens cache size = 293
08-10 16:06:07.616 30852 30926 I LLama-android: llm_load_vocab: token to piece cache size = 0.9338 MB
08-10 16:06:07.616 30852 30926 I LLama-android: llm_load_print_meta: format = GGUF V3 (latest)
08-10 16:06:07.616 30852 30926 I LLama-android: llm_load_print_meta: arch = qwen2
08-10 16:06:07.616 30852 30926 I LLama-android: llm_load_print_meta: vocab type = BPE
08-10 16:06:07.616 30852 30926 I LLama-android: llm_load_print_meta: n_vocab = 151936
08-10 16:06:07.616 30852 30926 I LLama-android: llm_load_print_meta: n_merges = 151387
08-10 16:06:07.616 30852 30926 I LLama-android: llm_load_print_meta: vocab_only = 0
08-10 16:06:07.616 30852 30926 I LLama-android: llm_load_print_meta: n_ctx_train = 32768
08-10 16:06:07.616 30852 30926 I LLama-android: llm_load_print_meta: n_embd = 896
08-10 16:06:07.616 30852 30926 I LLama-android: llm_load_print_meta: n_layer = 24
08-10 16:06:07.616 30852 30926 I LLama-android: llm_load_print_meta: n_head = 14
08-10 16:06:07.616 30852 30926 I LLama-android: llm_load_print_meta: n_head_kv = 2
08-10 16:06:07.616 30852 30926 I LLama-android: llm_load_print_meta: n_rot = 64
08-10 16:06:07.616 30852 30926 I LLama-android: llm_load_print_meta: n_swa = 0
08-10 16:06:07.616 30852 30926 I LLama-android: llm_load_print_meta: n_embd_head_k = 64
08-10 16:06:07.616 30852 30926 I LLama-android: llm_load_print_meta: n_embd_head_v = 64
08-10 16:06:07.616 30852 30926 I LLama-android: llm_load_print_meta: n_gqa = 7
08-10 16:06:07.616 30852 30926 I LLama-android: llm_load_print_meta: n_embd_k_gqa = 128
08-10 16:06:07.616 30852 30926 I LLama-android: llm_load_print_meta: n_embd_v_gqa = 128
08-10 16:06:07.616 30852 30926 I LLama-android: llm_load_print_meta: f_norm_eps = 0.0e+00
08-10 16:06:07.616 30852 30926 I LLama-android: llm_load_print_meta: f_norm_rms_eps = 1.0e-06
08-10 16:06:07.616 30852 30926 I LLama-android: llm_load_print_meta: f_clamp_kqv = 0.0e+00
08-10 16:06:07.616 30852 30926 I LLama-android: llm_load_print_meta: f_max_alibi_bias = 0.0e+00
08-10 16:06:07.616 30852 30926 I LLama-android: llm_load_print_meta: f_logit_scale = 0.0e+00
08-10 16:06:07.616 30852 30926 I LLama-android: llm_load_print_meta: n_ff = 4864
08-10 16:06:07.616 30852 30926 I LLama-android: llm_load_print_meta: n_expert = 0
08-10 16:06:07.616 30852 30926 I LLama-android: llm_load_print_meta: n_expert_used = 0
08-10 16:06:07.617 30852 30926 I LLama-android: llm_load_print_meta: causal attn = 1
08-10 16:06:07.617 30852 30926 I LLama-android: llm_load_print_meta: pooling type = 0
08-10 16:06:07.617 30852 30926 I LLama-android: llm_load_print_meta: rope type = 2
08-10 16:06:07.617 30852 30926 I LLama-android: llm_load_print_meta: rope scaling = linear
08-10 16:06:07.617 30852 30926 I LLama-android: llm_load_print_meta: freq_base_train = 1000000.0
08-10 16:06:07.617 30852 30926 I LLama-android: llm_load_print_meta: freq_scale_train = 1
08-10 16:06:07.617 30852 30926 I LLama-android: llm_load_print_meta: n_ctx_orig_yarn = 32768
08-10 16:06:07.617 30852 30926 I LLama-android: llm_load_print_meta: rope_finetuned = unknown
08-10 16:06:07.617 30852 30926 I LLama-android: llm_load_print_meta: ssm_d_conv = 0
08-10 16:06:07.617 30852 30926 I LLama-android: llm_load_print_meta: ssm_d_inner = 0
08-10 16:06:07.617 30852 30926 I LLama-android: llm_load_print_meta: ssm_d_state = 0
08-10 16:06:07.617 30852 30926 I LLama-android: llm_load_print_meta: ssm_dt_rank = 0
08-10 16:06:07.618 30852 30926 I LLama-android: llm_load_print_meta: model type = 1B
08-10 16:06:07.618 30852 30926 I LLama-android: llm_load_print_meta: model ftype = Q4_0
08-10 16:06:07.618 30852 30926 I LLama-android: llm_load_print_meta: model params = 494.03 M
08-10 16:06:07.618 30852 30926 I LLama-android: llm_load_print_meta: model size = 330.17 MiB (5.61 BPW)
08-10 16:06:07.618 30852 30926 I LLama-android: llm_load_print_meta: general.name = ai_model
08-10 16:06:07.618 30852 30926 I LLama-android: llm_load_print_meta: BOS token = 151643 '<|endoftext|>'
08-10 16:06:07.618 30852 30926 I LLama-android: llm_load_print_meta: EOS token = 151645 '<|im_end|>'
08-10 16:06:07.618 30852 30926 I LLama-android: llm_load_print_meta: LF token = 148848 'ÄĬ'
08-10 16:06:07.618 30852 30926 I LLama-android: llm_load_print_meta: EOT token = 151645 '<|im_end|>'
08-10 16:06:07.618 30852 30926 I LLama-android: llm_load_print_meta: max token length = 256
08-10 16:06:07.624 30852 30926 D vulkan : searching for layers in '/data/app/~~OvYsMz18c3DQFfK8i-sPtQ==/com.set.ai-gU7EJsFpEOK5rgbEU08wQw==/lib/arm64'
08-10 16:06:07.624 30852 30926 D vulkan : searching for layers in '/data/app/~~OvYsMz18c3DQFfK8i-sPtQ==/com.set.ai-gU7EJsFpEOK5rgbEU08wQw==/base.apk!/lib/arm64-v8a'
08-10 16:06:07.627 30852 30926 W Adreno-AppProfiles: Could not find QSPM HAL service. Skipping adreno profile processing.
08-10 16:06:07.627 30852 30926 I AdrenoVK-0: ===== BEGIN DUMP OF OVERRIDDEN SETTINGS =====
08-10 16:06:07.627 30852 30926 I AdrenoVK-0: ===== END DUMP OF OVERRIDDEN SETTINGS =====
08-10 16:06:07.628 30852 30926 I AdrenoVK-0: QUALCOMM build : d44197479c, I2991b7e11e
08-10 16:06:07.628 30852 30926 I AdrenoVK-0: Build Date : 05/31/23
08-10 16:06:07.628 30852 30926 I AdrenoVK-0: Shader Compiler Version : E031.41.03.36
08-10 16:06:07.628 30852 30926 I AdrenoVK-0: Local Branch :
08-10 16:06:07.628 30852 30926 I AdrenoVK-0: Remote Branch :
08-10 16:06:07.628 30852 30926 I AdrenoVK-0: Remote Branch :
08-10 16:06:07.628 30852 30926 I AdrenoVK-0: Reconstruct Branch :
08-10 16:06:07.628 30852 30926 I AdrenoVK-0: Build Config : S P 14.1.4 AArch64
08-10 16:06:07.628 30852 30926 I AdrenoVK-0: Driver Path : /vendor/lib64/hw/vulkan.adreno.so
08-10 16:06:07.628 30852 30926 I AdrenoVK-0: Driver Version : 0676.32
08-10 16:06:07.628 30852 30926 I AdrenoVK-0: PFP : 0x01740158
08-10 16:06:07.628 30852 30926 I AdrenoVK-0: ME : 0x00000000
08-10 16:06:07.628 30852 30926 I AdrenoVK-0: Application Name : ggml-vulkan
08-10 16:06:07.628 30852 30926 I AdrenoVK-0: Application Version : 0x00000001
08-10 16:06:07.628 30852 30926 I AdrenoVK-0: Engine Name : (null)
08-10 16:06:07.628 30852 30926 I AdrenoVK-0: Engine Version : 0x00000000
08-10 16:06:07.628 30852 30926 I AdrenoVK-0: Api Version : 0x00402000
08-10 16:06:09.099 30852 30926 I AdrenoVK-0: Failed to link shaders.
08-10 16:06:09.099 30852 30926 I AdrenoVK-0: Pipeline create failed
08-10 16:06:09.108 30852 30926 E LLama-android: llama_model_load: error loading model: vk::Device::createComputePipeline: ErrorUnknown
08-10 16:06:09.108 30852 30926 E LLama-android: llama_load_model_from_file: failed to load model
08-10 16:06:09.132 30852 30926 E LLama-android: llama_new_context_with_model: model cannot be NULL
08-10 16:06:09.132 30852 30926 F libc : exiting due to SIG_DFL handler for signal 11, ucontext 0x7317ea5e20
it seems that these shaders can't be linked,any idea for this problem? the GPU device is Adreno 740
update:it seems that NDK‘s Vulkan headers are outdated,so I update Vulkan related headers in NDK,like these sub dir:
android-ndk-r27/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/vk_video android-ndk-r27/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/vulkan
now it can build successfully,
How to update Vulkan headers? upgrade NDK or other methods? I found there are lots of redefinition in 'sources/third_party/vulkan/src/include/vulkan/vulkan.hpp' .
update:it seems that NDK‘s Vulkan headers are outdated,so I update Vulkan related headers in NDK,like these sub dir:
android-ndk-r27/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/vk_video android-ndk-r27/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/vulkan
now it can build successfully,
How to update Vulkan headers? upgrade NDK or other methods? I found there are lots of redefinition in 'sources/third_party/vulkan/src/include/vulkan/vulkan.hpp' .
You can find more details in my BLOG
What happened?
I tried to run the tinyllama-1.1b model on a OnePlus CPH2573 (with Adreno™ 750). It works fine when I set --batch-size to less than 32, but a failure (vk::DeviceLostError) occurs when I set --batch-size to 33.
In issue #5186, it was mentioned that Adreno devices have a maximum allocated memory size of 1GB, but this doesn't seem to fully explain the behavior I'm experiencing. I also tried submitting the operator one by one (not in a whole command buffer, but submitting them individually), and it succeeded. Does Vulkan on Adreno devices have other constraints (like a maximum size for command buffers) that could explain the failure I'm encountering?
Name and Version
build = 3400 (97bdd26e) main: built with Android (11349228, +pgo, +bolt, +lto, -mlgo, based on r487747e) clang version 17.0.2 (https://android.googlesource.com/toolchain/llvm-project d9f89f4d16663d5012e5c09495f3b30ece3d2362) for x86_64-linux-gnu
What operating system are you seeing the problem on?
No response
Relevant log output