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 Jun 19, 2024
1 parent 67e0a66 commit 1c7281a
Show file tree
Hide file tree
Showing 15 changed files with 58 additions and 0 deletions.
4 changes: 4 additions & 0 deletions 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 @@ -1039,3 +1041,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-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-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 @@ -2223,3 +2225,5 @@ bool ggml_backend_compare_graph_backend(ggml_backend_t backend1, ggml_backend_t

return true;
}

#endif
4 changes: 4 additions & 0 deletions 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 @@ -234,3 +236,5 @@ extern "C" {
#ifdef __cplusplus
}
#endif

#endif
4 changes: 4 additions & 0 deletions 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 @@ -3265,3 +3267,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-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 @@ -14295,3 +14297,5 @@ bool ggml_validate_row_data(enum ggml_type type, const void * data, size_t nbyte

return true;
}

#endif
3 changes: 3 additions & 0 deletions 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 @@ -131,3 +133,4 @@ void iq3xs_free_impl(int grid_size);
}
#endif

#endif
4 changes: 4 additions & 0 deletions 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 @@ -22504,3 +22506,5 @@ int ggml_cpu_has_matmul_int8(void) {
}

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

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

#define LLAMA_API_INTERNAL
#include "llama.h"

Expand Down Expand Up @@ -18932,3 +18934,5 @@ static void llama_log_callback_default(ggml_log_level level, const char * text,
fputs(text, stderr);
fflush(stderr);
}

#endif
4 changes: 4 additions & 0 deletions 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 @@ -1141,3 +1143,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 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 @@ -1030,3 +1032,5 @@ bool llamafile_sgemm(int64_t m, int64_t n, int64_t k, const void *A, int64_t lda
(void)Btype;
(void)Ctype;
}

#endif
3 changes: 3 additions & 0 deletions 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 @@ -7031,3 +7033,4 @@ const std::vector<range_nfd> unicode_ranges_nfd = { // start, last, nfd
{0x02FA1D, 0x02FA1D, 0x02A600},
};

#endif
4 changes: 4 additions & 0 deletions 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 unicode.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#if defined(__arm64__)

#include "unicode.h"
#include "unicode-data.h"

Expand Down Expand Up @@ -807,3 +809,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 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 @@ -61,3 +63,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 1c7281a

Please sign in to comment.