Skip to content

Commit 6c14ee3

Browse files
committed
Try restricting compilation to ARM64.
1 parent d6d24cd commit 6c14ee3

13 files changed

+51
-0
lines changed

include/llama.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#if defined(__arm64__)
2+
13
#ifndef LLAMA_H
24
#define LLAMA_H
35

@@ -1320,3 +1322,5 @@ extern "C" {
13201322
#endif
13211323

13221324
#endif // LLAMA_H
1325+
1326+
#endif

src/llama-grammar.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#if defined(__arm64__)
2+
13
#include "llama-grammar.h"
24

35
#include "llama-impl.h"
@@ -1137,3 +1139,5 @@ void llama_grammar_accept_impl(struct llama_grammar & grammar, llama_token token
11371139
grammar.partial_utf8 = decoded.second;
11381140
GGML_ASSERT(!grammar.stacks.empty());
11391141
}
1142+
1143+
#endif

src/llama-grammar.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#if defined(__arm64__)
2+
13
#pragma once
24

35
#include "llama.h"
@@ -141,3 +143,5 @@ void llama_grammar_apply_impl(
141143
void llama_grammar_accept_impl(
142144
struct llama_grammar & grammar,
143145
llama_token token);
146+
147+
#endif

src/llama-impl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#if defined(__arm64__)
2+
13
#pragma once
24

35
#include "ggml.h" // for ggml_log_level
@@ -59,3 +61,5 @@ std::string llama_format_tensor_shape(const std::vector<int64_t> & ne);
5961
std::string llama_format_tensor_shape(const struct ggml_tensor * t);
6062

6163
std::string gguf_kv_to_str(const struct gguf_context * ctx_gguf, int i);
64+
65+
#endif

src/llama-sampling.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#if defined(__arm64__)
2+
13
#include "llama-sampling.h"
24

35
#include "llama-impl.h"
@@ -2405,3 +2407,5 @@ void llama_perf_sampler_reset(struct llama_sampler * chain) {
24052407

24062408
ctx->t_sample_us = ctx->n_sample = 0;
24072409
}
2410+
2411+
#endif

src/llama-sampling.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#if defined(__arm64__)
2+
13
#pragma once
24

35
// TODO: rename llama-sampling.h/.cpp to llama-sampler.h/.cpp ?
@@ -30,3 +32,5 @@ struct llama_sampler * llama_sampler_init_dry_testing(
3032
int32_t dry_allowed_length,
3133
int32_t dry_penalty_last_n,
3234
const std::vector<std::vector<llama_token>>& seq_breakers);
35+
36+
#endif

src/llama-vocab.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#if defined(__arm64__)
2+
13
#include "llama-vocab.h"
24

35
#include "llama-impl.h"
@@ -3250,3 +3252,4 @@ int32_t llama_detokenize(
32503252
return vocab->detokenize(tokens, n_tokens, text, text_len_max, remove_special, unparse_special);
32513253
}
32523254

3255+
#endif

src/llama-vocab.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#if defined(__arm64__)
2+
13
#pragma once
24

35
#include "llama.h"
@@ -123,3 +125,5 @@ struct llama_vocab {
123125
struct impl;
124126
std::unique_ptr<impl> pimpl;
125127
};
128+
129+
#endif

src/llama.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#if defined(__arm64__)
2+
13
#include "llama-impl.h"
24

35
#include "llama-chat.h"
@@ -10111,3 +10113,5 @@ void llama_perf_context_reset(struct llama_context * ctx) {
1011110113
ctx->t_eval_us = ctx->n_eval = 0;
1011210114
ctx->t_p_eval_us = ctx->n_p_eval = 0;
1011310115
}
10116+
10117+
#endif

src/unicode-data.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#if defined(__arm64__)
2+
13
// generated with scripts/gen-unicode-data.py
24

35
#include "unicode-data.h"
@@ -7032,3 +7034,5 @@ const std::initializer_list<range_nfd> unicode_ranges_nfd = { // start, last, n
70327034
{0x02FA1C, 0x02FA1C, 0x009F3B},
70337035
{0x02FA1D, 0x02FA1D, 0x02A600},
70347036
};
7037+
7038+
#endif

src/unicode-data.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#if defined(__arm64__)
2+
13
#pragma once
24

35
#include <cstdint>
@@ -18,3 +20,5 @@ extern const std::unordered_set<uint32_t> unicode_set_whitespace;
1820
extern const std::initializer_list<std::pair<uint32_t, uint32_t>> unicode_map_lowercase;
1921
extern const std::initializer_list<std::pair<uint32_t, uint32_t>> unicode_map_uppercase;
2022
extern const std::initializer_list<range_nfd> unicode_ranges_nfd;
23+
24+
#endif

src/unicode.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#if defined(__arm64__)
2+
13
#if defined(_MSC_VER)
24
#define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
35
#endif
@@ -840,3 +842,5 @@ std::vector<std::string> unicode_regex_split(const std::string & text, const std
840842

841843
return unicode_byte_encoding_process(bpe_words);
842844
}
845+
846+
#endif

src/unicode.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#if defined(__arm64__)
2+
13
#pragma once
24

35
#include <cstdint>
@@ -64,3 +66,5 @@ uint8_t unicode_utf8_to_byte(const std::string & utf8);
6466
uint32_t unicode_tolower(uint32_t cpt);
6567

6668
std::vector<std::string> unicode_regex_split(const std::string & text, const std::vector<std::string> & regex_exprs);
69+
70+
#endif

0 commit comments

Comments
 (0)