Skip to content

Commit

Permalink
llama : mmap
Browse files Browse the repository at this point in the history
ggml-ci
  • Loading branch information
ggerganov committed Dec 22, 2024
1 parent 8233c18 commit 524886b
Show file tree
Hide file tree
Showing 10 changed files with 649 additions and 592 deletions.
1 change: 1 addition & 0 deletions src/llama-adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include <vector>
#include <map>
#include <algorithm>

//
// llama_adapter_vec
Expand Down
1 change: 1 addition & 0 deletions src/llama-arch.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <map>
#include <string>

//
// gguf constants (sync with gguf.py)
Expand Down
2 changes: 2 additions & 0 deletions src/llama-batch.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "llama.h"

#include <vector>
#include <cstring>
#include <algorithm>

// very similar to llama_batch,
// but has more metadata about sequences
Expand Down
4 changes: 2 additions & 2 deletions src/llama-context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ static bool llama_state_load_file_internal(struct llama_context * ctx, const cha

// restore the context state
{
const size_t n_state_size_cur = file.size - file.tell();
const size_t n_state_size_cur = file.size() - file.tell();

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

// restore the context state
{
const size_t state_size = file.size - file.tell();
const size_t state_size = file.size() - file.tell();
llama_data_read_file data_ctx(&file);
const size_t nread = llama_state_seq_set_data_internal(ctx, data_ctx, dest_seq_id);
if (!nread) {
Expand Down
1 change: 1 addition & 0 deletions src/llama-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ LLAMA_ATTRIBUTE_FORMAT(2, 3)
void llama_log_internal (ggml_log_level level, const char * format, ...);
void llama_log_callback_default(ggml_log_level level, const char * text, void * user_data);

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

Expand Down
1 change: 1 addition & 0 deletions src/llama-kv-cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <set>
#include <vector>
#include <limits>

struct llama_kv_cell {
llama_pos pos = -1;
Expand Down
Loading

0 comments on commit 524886b

Please sign in to comment.