From 8725937362f31bce6cfa153355c2b6415e73025c Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Fri, 17 May 2024 15:47:44 +0300 Subject: [PATCH 1/4] android : use "ci-android" branch for CI --- examples/llama.android/app/src/main/cpp/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/llama.android/app/src/main/cpp/CMakeLists.txt b/examples/llama.android/app/src/main/cpp/CMakeLists.txt index 85139329aa082..7a4484f8b13e5 100644 --- a/examples/llama.android/app/src/main/cpp/CMakeLists.txt +++ b/examples/llama.android/app/src/main/cpp/CMakeLists.txt @@ -16,7 +16,7 @@ include(FetchContent) FetchContent_Declare( llama GIT_REPOSITORY https://github.com/ggerganov/llama.cpp - GIT_TAG master + GIT_TAG ci-android ) # Also provides "common" From 2117b3038050c07a443770b7f086c9681030ddbe Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Fri, 17 May 2024 15:47:56 +0300 Subject: [PATCH 2/4] ggml : disable SIMD exp and silu for 32-bit ARM ggml-ci --- ggml.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ggml.c b/ggml.c index 55152bce49ebe..a04c74ddd2cd6 100644 --- a/ggml.c +++ b/ggml.c @@ -2076,7 +2076,7 @@ inline static float ggml_silu_f32(float x) { return x/(1.0f + expf(-x)); } -#if defined(__ARM_NEON) +#if defined(__ARM_NEON) && defined(__aarch64__) // adapted from arm limited optimized routine // the maximum error is 1.45358 plus 0.5 ulps @@ -2288,7 +2288,7 @@ static void ggml_vec_silu_f32(const int n, float * y, const float * x) { for (; i + 3 < n; i += 4) { _mm_storeu_ps(y + i, ggml_v_silu(_mm_loadu_ps(x + i))); } -#elif defined(__ARM_NEON) +#elif defined(__ARM_NEON) && defined(__aarch64__) for (; i + 3 < n; i += 4) { vst1q_f32(y + i, ggml_v_silu(vld1q_f32(x + i))); } @@ -2335,7 +2335,7 @@ static ggml_float ggml_vec_soft_max_f32(const int n, float * y, const float * x, #endif sum += (ggml_float)_mm_cvtss_f32(val); } -#elif defined(__ARM_NEON) +#elif defined(__ARM_NEON) && defined(__aarch64__) for (; i + 3 < n; i += 4) { float32x4_t val = ggml_v_expf(vsubq_f32(vld1q_f32(x + i), vdupq_n_f32(max))); From 99d1e7eb8a97090f8478fc5596999a6df8739063 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Sat, 18 May 2024 09:32:24 +0300 Subject: [PATCH 3/4] android : do not fetch, use add_subdirectory instead --- .../app/src/main/cpp/CMakeLists.txt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/examples/llama.android/app/src/main/cpp/CMakeLists.txt b/examples/llama.android/app/src/main/cpp/CMakeLists.txt index 7a4484f8b13e5..89e785e3e0ae5 100644 --- a/examples/llama.android/app/src/main/cpp/CMakeLists.txt +++ b/examples/llama.android/app/src/main/cpp/CMakeLists.txt @@ -12,15 +12,17 @@ cmake_minimum_required(VERSION 3.22.1) # build script scope). project("llama-android") -include(FetchContent) -FetchContent_Declare( - llama - GIT_REPOSITORY https://github.com/ggerganov/llama.cpp - GIT_TAG ci-android -) +#include(FetchContent) +#FetchContent_Declare( +# llama +# GIT_REPOSITORY https://github.com/ggerganov/llama.cpp +# GIT_TAG ci-android +#) +# +## Also provides "common" +#FetchContent_MakeAvailable(llama) -# Also provides "common" -FetchContent_MakeAvailable(llama) +add_subdirectory(../../../../../../) # Creates and names a library, sets it as either STATIC # or SHARED, and provides the relative paths to its source code. From 007f2ece0a3e6ed45b02524c47540384e0fce0bc Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Sat, 18 May 2024 10:50:46 +0300 Subject: [PATCH 4/4] cmake : provide binary dir --- examples/llama.android/app/src/main/cpp/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/llama.android/app/src/main/cpp/CMakeLists.txt b/examples/llama.android/app/src/main/cpp/CMakeLists.txt index 89e785e3e0ae5..688a4750df3f7 100644 --- a/examples/llama.android/app/src/main/cpp/CMakeLists.txt +++ b/examples/llama.android/app/src/main/cpp/CMakeLists.txt @@ -22,7 +22,7 @@ project("llama-android") ## Also provides "common" #FetchContent_MakeAvailable(llama) -add_subdirectory(../../../../../../) +add_subdirectory(../../../../../../ please-work) # Creates and names a library, sets it as either STATIC # or SHARED, and provides the relative paths to its source code.