android : use "ci-android" branch for CI (#7341)

* android : use "ci-android" branch for CI

* ggml : disable SIMD exp and silu for 32-bit ARM

ggml-ci

* android : do not fetch, use add_subdirectory instead

* cmake : provide binary dir
This commit is contained in:
Georgi Gerganov 2024-05-18 13:40:39 +03:00 committed by GitHub
parent 133d99c599
commit 511182eabb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 11 deletions

View File

@ -12,15 +12,17 @@ cmake_minimum_required(VERSION 3.22.1)
# build script scope). # build script scope).
project("llama-android") project("llama-android")
include(FetchContent) #include(FetchContent)
FetchContent_Declare( #FetchContent_Declare(
llama # llama
GIT_REPOSITORY https://github.com/ggerganov/llama.cpp # GIT_REPOSITORY https://github.com/ggerganov/llama.cpp
GIT_TAG master # GIT_TAG ci-android
) #)
#
## Also provides "common"
#FetchContent_MakeAvailable(llama)
# Also provides "common" add_subdirectory(../../../../../../ please-work)
FetchContent_MakeAvailable(llama)
# Creates and names a library, sets it as either STATIC # Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code. # or SHARED, and provides the relative paths to its source code.

6
ggml.c
View File

@ -2076,7 +2076,7 @@ inline static float ggml_silu_f32(float x) {
return x/(1.0f + expf(-x)); return x/(1.0f + expf(-x));
} }
#if defined(__ARM_NEON) #if defined(__ARM_NEON) && defined(__aarch64__)
// adapted from arm limited optimized routine // adapted from arm limited optimized routine
// the maximum error is 1.45358 plus 0.5 ulps // 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) { for (; i + 3 < n; i += 4) {
_mm_storeu_ps(y + i, ggml_v_silu(_mm_loadu_ps(x + i))); _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) { for (; i + 3 < n; i += 4) {
vst1q_f32(y + i, ggml_v_silu(vld1q_f32(x + i))); 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 #endif
sum += (ggml_float)_mm_cvtss_f32(val); sum += (ggml_float)_mm_cvtss_f32(val);
} }
#elif defined(__ARM_NEON) #elif defined(__ARM_NEON) && defined(__aarch64__)
for (; i + 3 < n; i += 4) { for (; i + 3 < n; i += 4) {
float32x4_t val = ggml_v_expf(vsubq_f32(vld1q_f32(x + i), float32x4_t val = ggml_v_expf(vsubq_f32(vld1q_f32(x + i),
vdupq_n_f32(max))); vdupq_n_f32(max)));