Skip to content

Commit fe28a7b

Browse files
committed
llama : clean-up
1 parent dae3cae commit fe28a7b

File tree

5 files changed

+20
-29
lines changed

5 files changed

+20
-29
lines changed

src/llama-impl.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,6 @@
33
#define LLAMA_API_INTERNAL
44
#include "llama.h"
55

6-
#ifdef __has_include
7-
#if __has_include(<unistd.h>)
8-
#include <unistd.h>
9-
#if defined(_POSIX_MAPPED_FILES)
10-
#include <sys/mman.h>
11-
#include <fcntl.h>
12-
#endif
13-
#if defined(_POSIX_MEMLOCK_RANGE)
14-
#include <sys/resource.h>
15-
#endif
16-
#endif
17-
#endif
18-
19-
// bump if necessary
20-
#define LLAMA_MAX_NODES 8192
21-
#define LLAMA_MAX_LAYERS 512
22-
#define LLAMA_MAX_EXPERTS 160 // DeepSeekV2
23-
246
#ifdef __GNUC__
257
#ifdef __MINGW32__
268
#define LLAMA_ATTRIBUTE_FORMAT(...) __attribute__((format(gnu_printf, __VA_ARGS__)))

src/llama-sampling.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ struct llama_sampling {
1818
}
1919
};
2020

21-
struct llama_sampling * llama_get_sampling(struct llama_context * ctx);
22-
2321
//
2422
// internal API
2523
//

src/llama-vocab.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ struct llama_vocab {
6262
};
6363

6464
const struct llama_vocab * llama_get_vocab(const struct llama_context * ctx);
65-
const struct llama_vocab * llama_get_vocab(const struct llama_model * model);
6665

6766
//
6867
// internal API

src/llama.cpp

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,19 @@
3636
// TODO: replace with ggml API call
3737
#define QK_K 256
3838

39+
#ifdef __has_include
40+
#if __has_include(<unistd.h>)
41+
#include <unistd.h>
42+
#if defined(_POSIX_MAPPED_FILES)
43+
#include <sys/mman.h>
44+
#include <fcntl.h>
45+
#endif
46+
#if defined(_POSIX_MEMLOCK_RANGE)
47+
#include <sys/resource.h>
48+
#endif
49+
#endif
50+
#endif
51+
3952
#if defined(_WIN32)
4053
#define WIN32_LEAN_AND_MEAN
4154
#ifndef NOMINMAX
@@ -87,6 +100,11 @@
87100
#pragma warning(disable: 4244 4267) // possible loss of data
88101
#endif
89102

103+
// bump if necessary
104+
#define LLAMA_MAX_NODES 8192
105+
#define LLAMA_MAX_LAYERS 512
106+
#define LLAMA_MAX_EXPERTS 160 // DeepSeekV2
107+
90108
//
91109
// helpers
92110
//
@@ -16794,14 +16812,6 @@ const struct llama_vocab * llama_get_vocab(const struct llama_context * ctx) {
1679416812
return &ctx->model.vocab;
1679516813
}
1679616814

16797-
const struct llama_vocab * llama_get_vocab(const struct llama_model * model) {
16798-
return &model->vocab;
16799-
}
16800-
16801-
struct llama_sampling * llama_get_sampling(struct llama_context * ctx) {
16802-
return &ctx->sampling;
16803-
}
16804-
1680516815
struct llama_grammar * llama_get_grammar(struct llama_context * ctx) {
1680616816
return &ctx->grammar;
1680716817
}

src/unicode.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#include <string>
55
#include <vector>
66

7+
// TODO: prefix all symbols with "llama_"
8+
79
struct codepoint_flags {
810
enum {
911
UNDEFINED = 0x0001,

0 commit comments

Comments
 (0)