Skip to content

Commit 524886b

Browse files
committed
llama : mmap
ggml-ci
1 parent 8233c18 commit 524886b

10 files changed

+649
-592
lines changed

src/llama-adapter.h

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include <vector>
99
#include <map>
10+
#include <algorithm>
1011

1112
//
1213
// llama_adapter_vec

src/llama-arch.h

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
#include <map>
4+
#include <string>
45

56
//
67
// gguf constants (sync with gguf.py)

src/llama-batch.h

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#include "llama.h"
44

55
#include <vector>
6+
#include <cstring>
7+
#include <algorithm>
68

79
// very similar to llama_batch,
810
// but has more metadata about sequences

src/llama-context.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ static bool llama_state_load_file_internal(struct llama_context * ctx, const cha
799799

800800
// restore the context state
801801
{
802-
const size_t n_state_size_cur = file.size - file.tell();
802+
const size_t n_state_size_cur = file.size() - file.tell();
803803

804804
llama_data_read_file data_ctx(&file);
805805
const size_t n_read = llama_state_set_data_internal(ctx, data_ctx);
@@ -936,7 +936,7 @@ static size_t llama_state_seq_load_file_internal(struct llama_context * ctx, con
936936

937937
// restore the context state
938938
{
939-
const size_t state_size = file.size - file.tell();
939+
const size_t state_size = file.size() - file.tell();
940940
llama_data_read_file data_ctx(&file);
941941
const size_t nread = llama_state_seq_set_data_internal(ctx, data_ctx, dest_seq_id);
942942
if (!nread) {

src/llama-impl.h

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ LLAMA_ATTRIBUTE_FORMAT(2, 3)
2424
void llama_log_internal (ggml_log_level level, const char * format, ...);
2525
void llama_log_callback_default(ggml_log_level level, const char * text, void * user_data);
2626

27+
// TODO: rename to llama_format ?
2728
LLAMA_ATTRIBUTE_FORMAT(1, 2)
2829
std::string format(const char * fmt, ...);
2930

src/llama-kv-cache.h

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <set>
1010
#include <vector>
11+
#include <limits>
1112

1213
struct llama_kv_cell {
1314
llama_pos pos = -1;

0 commit comments

Comments
 (0)