From d01af01df327ac483eacd35883301453668733e2 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 12 Mar 2024 15:10:33 -0700 Subject: [PATCH] Build fix for Android (#2290) Summary: Pull Request resolved: https://github.com/pytorch/executorch/pull/2290 Reviewed By: manuelcandales Differential Revision: D54620005 Pulled By: kirklandsign --- examples/models/llama2/custom_ops/op_sdpa.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/models/llama2/custom_ops/op_sdpa.cpp b/examples/models/llama2/custom_ops/op_sdpa.cpp index 40b80bf5d0..450a7155e9 100644 --- a/examples/models/llama2/custom_ops/op_sdpa.cpp +++ b/examples/models/llama2/custom_ops/op_sdpa.cpp @@ -177,7 +177,8 @@ inline void fill_stub(scalar_t* data, scalar_t val, int64_t size) { for (; d < size - (size % Vec::size()); d += Vec::size()) { data_vec.store(data + d); } -#if !defined(_MSC_VER) && !defined(COMPILING_FOR_MIN_SIZE) +#if !defined(_MSC_VER) && !defined(COMPILING_FOR_MIN_SIZE) && \ + !defined(__ANDROID__) #pragma unroll #endif for (; d < size; d++) { @@ -249,7 +250,7 @@ void cpu_flash_attention( ET_CHECK_MSG( attn_mask.value().size(1) == kvSize, "attn_mask shape mismatch" - "attn_mask.size(1)=%ld kvSize=%" PRId64, + "attn_mask.size(1)=%zd kvSize=%" PRId64, attn_mask.value().size(1), kvSize); } @@ -578,7 +579,7 @@ bool validate_cache_params( "start_post + seq_length must be less than max seq length supported by key cache." "start pos: %" PRId64 ", seq_length: %" PRId64 "." - "key cache size: %ld", + "key cache size: %zd", start_pos, seq_length, k_cache.size(2)); @@ -588,7 +589,7 @@ bool validate_cache_params( "start_post + seq_length must be less than max seq length supported by key cache." "start pos: %" PRId64 ", seq_length: %" PRId64 "." - "value cache size: %ld", + "value cache size: %zd", start_pos, seq_length, v_cache.size(2));