Skip to content

Commit

Permalink
Try restricting compilation to ARM64.
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMage committed Jul 24, 2024
1 parent bfbb11f commit 4f0cb20
Show file tree
Hide file tree
Showing 15 changed files with 60 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ggml/include/ggml-alloc.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#if defined(__arm64__)

#pragma once

#include "ggml.h"
Expand Down Expand Up @@ -74,3 +76,5 @@ GGML_API struct ggml_backend_buffer * ggml_backend_alloc_ctx_tensors(struct ggml
#ifdef __cplusplus
}
#endif

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

#pragma once

#include "ggml.h"
Expand Down Expand Up @@ -236,3 +238,5 @@ extern "C" {
#ifdef __cplusplus
}
#endif

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

#include "ggml-alloc.h"
#include "ggml-backend-impl.h"
#include "ggml.h"
Expand Down Expand Up @@ -1040,3 +1042,5 @@ ggml_backend_buffer_t ggml_backend_alloc_ctx_tensors_from_buft(struct ggml_conte
ggml_backend_buffer_t ggml_backend_alloc_ctx_tensors(struct ggml_context * ctx, ggml_backend_t backend) {
return ggml_backend_alloc_ctx_tensors_from_buft(ctx, ggml_backend_get_default_buffer_type(backend));
}

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

#include "ggml-backend-impl.h"
#include "ggml-alloc.h"
#include "ggml-impl.h"
Expand Down Expand Up @@ -2232,3 +2234,5 @@ bool ggml_backend_compare_graph_backend(ggml_backend_t backend1, ggml_backend_t

return true;
}

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

#import "ggml-metal.h"

#import "ggml-backend-impl.h"
Expand Down Expand Up @@ -3267,3 +3269,5 @@ GGML_CALL ggml_backend_t ggml_backend_reg_metal_init(const char * params, void *
GGML_UNUSED(params);
GGML_UNUSED(user_data);
}

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

#define GGML_COMMON_IMPL_C
#include "ggml-common.h"

Expand Down Expand Up @@ -14858,3 +14860,5 @@ bool ggml_validate_row_data(enum ggml_type type, const void * data, size_t nbyte

return true;
}

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

#pragma once

#define GGML_COMMON_DECL_C
Expand Down Expand Up @@ -130,3 +132,5 @@ void iq3xs_free_impl(int grid_size);
#ifdef __cplusplus
}
#endif

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

#define _CRT_SECURE_NO_DEPRECATE // Disables ridiculous "unsafe" warnings on Windows
#define _USE_MATH_DEFINES // For M_PI on MSVC

Expand Down Expand Up @@ -22042,3 +22044,5 @@ int ggml_cpu_has_matmul_int8(void) {
}

////////////////////////////////////////////////////////////////////////////////

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

// Copyright 2024 Mozilla Foundation
//
// Permission is hereby granted, free of charge, to any person obtaining
Expand Down Expand Up @@ -1025,3 +1027,5 @@ bool llamafile_sgemm(int64_t m, int64_t n, int64_t k, const void *A, int64_t lda
(void)Btype;
(void)Ctype;
}

#endif
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 @@ -1231,3 +1233,5 @@ llama_token llama_sample_token_with_rng(struct llama_context * ctx, llama_token_
#endif // LLAMA_API_INTERNAL

#endif // LLAMA_H

#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-grammar.h"
Expand Down Expand Up @@ -19209,3 +19211,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 @@ -7030,3 +7032,5 @@ const std::vector<range_nfd> unicode_ranges_nfd = { // start, last, nfd
{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::unordered_map<uint32_t, uint32_t> unicode_map_lowercase;
extern const std::unordered_map<uint32_t, uint32_t> unicode_map_uppercase;
extern const std::vector<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 @@ -816,3 +818,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 4f0cb20

Please sign in to comment.