Skip to content

Commit

Permalink
Try restricting compilation to ARM64.
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/llama-impl.h
#	src/llama-sampling.h
#	src/llama-vocab.cpp
#	src/llama-vocab.h
#	src/unicode-data.h
  • Loading branch information
MrMage committed Nov 6, 2024
1 parent b11f9ba commit 419aa38
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/llama.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#if defined(__arm64__)

#ifndef LLAMA_H
#define LLAMA_H

Expand Down Expand Up @@ -1251,3 +1253,5 @@ extern "C" {
#endif

#endif // LLAMA_H

#endif
4 changes: 4 additions & 0 deletions src/llama-grammar.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#if defined(__arm64__)

#include "llama-grammar.h"

#include "llama-vocab.h"
Expand Down Expand Up @@ -1136,3 +1138,5 @@ void llama_grammar_accept_impl(struct llama_grammar & grammar, llama_token token
grammar.partial_utf8 = decoded.second;
GGML_ASSERT(!grammar.stacks.empty());
}

#endif
4 changes: 4 additions & 0 deletions src/llama-grammar.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#if defined(__arm64__)

#pragma once

#include "llama-impl.h"
Expand Down Expand Up @@ -142,3 +144,5 @@ void llama_grammar_apply_impl(
void llama_grammar_accept_impl(
struct llama_grammar & grammar,
llama_token token);

#endif
4 changes: 4 additions & 0 deletions src/llama-impl.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#if defined(__arm64__)

#pragma once

#include "llama.h"
Expand Down Expand Up @@ -179,3 +181,5 @@ struct ring_buffer {
size_t pos = 0;
std::vector<T> data;
};

#endif
4 changes: 4 additions & 0 deletions src/llama-sampling.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#if defined(__arm64__)

#include "llama-sampling.h"

#include "llama-vocab.h"
Expand Down Expand Up @@ -2342,3 +2344,5 @@ void llama_perf_sampler_reset(struct llama_sampler * chain) {

ctx->t_sample_us = ctx->n_sample = 0;
}

#endif
4 changes: 4 additions & 0 deletions src/llama-sampling.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#if defined(__arm64__)

#pragma once

// TODO: rename llama-sampling.h/.cpp to llama-sampler.h/.cpp ?
Expand Down Expand Up @@ -46,3 +48,5 @@ struct llama_sampler * llama_sampler_init_dry_testing(
int32_t dry_allowed_length,
int32_t dry_penalty_last_n,
const std::vector<std::vector<llama_token>>& seq_breakers);

#endif
4 changes: 4 additions & 0 deletions src/llama-vocab.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#if defined(__arm64__)

#include "llama-vocab.h"

#include "unicode.h"
Expand Down Expand Up @@ -1982,3 +1984,5 @@ std::string llama_detokenize(const struct llama_vocab & vocab, const std::vector
// NOTE: the original tokenizer decodes bytes after collecting the pieces.
return text;
}

#endif
4 changes: 4 additions & 0 deletions src/llama-vocab.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#if defined(__arm64__)

#pragma once

#include "llama-impl.h"
Expand Down Expand Up @@ -168,3 +170,5 @@ std::string llama_detokenize(
const struct llama_vocab & vocab,
const std::vector<llama_token> & tokens,
bool special);

#endif
4 changes: 4 additions & 0 deletions src/llama.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#if defined(__arm64__)

#include "llama-impl.h"
#include "llama-vocab.h"
#include "llama-sampling.h"
Expand Down Expand Up @@ -22035,3 +22037,5 @@ void llama_log_callback_default(ggml_log_level level, const char * text, void *
fputs(text, stderr);
fflush(stderr);
}

#endif
4 changes: 4 additions & 0 deletions src/unicode-data.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#if defined(__arm64__)

// generated with scripts/gen-unicode-data.py

#include "unicode-data.h"
Expand Down Expand Up @@ -7032,3 +7034,5 @@ const std::initializer_list<range_nfd> unicode_ranges_nfd = { // start, last, n
{0x02FA1C, 0x02FA1C, 0x009F3B},
{0x02FA1D, 0x02FA1D, 0x02A600},
};

#endif
4 changes: 4 additions & 0 deletions src/unicode-data.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#if defined(__arm64__)

#pragma once

#include <cstdint>
Expand All @@ -18,3 +20,5 @@ extern const std::unordered_set<uint32_t> unicode_set_whitespace;
extern const std::initializer_list<std::pair<uint32_t, uint32_t>> unicode_map_lowercase;
extern const std::initializer_list<std::pair<uint32_t, uint32_t>> unicode_map_uppercase;
extern const std::initializer_list<range_nfd> unicode_ranges_nfd;

#endif
4 changes: 4 additions & 0 deletions src/unicode.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#if defined(__arm64__)

#if defined(_MSC_VER)
#define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
#endif
Expand Down Expand Up @@ -824,3 +826,5 @@ std::vector<std::string> unicode_regex_split(const std::string & text, const std

return unicode_byte_encoding_process(bpe_words);
}

#endif
4 changes: 4 additions & 0 deletions src/unicode.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#if defined(__arm64__)

#pragma once

#include <cstdint>
Expand Down Expand Up @@ -65,3 +67,5 @@ uint8_t unicode_utf8_to_byte(const std::string & utf8);
uint32_t unicode_tolower(uint32_t cp);

std::vector<std::string> unicode_regex_split(const std::string & text, const std::vector<std::string> & regex_exprs);

#endif

0 comments on commit 419aa38

Please sign in to comment.