8000 llama : use aligned memory during ggml_init call from loading saved s… · CodeLinaro/llama.cpp@ba4e85a · GitHub
[go: up one dir, main page]

Skip to content

Commit ba4e85a

Browse files
authored
llama : use aligned memory during ggml_init call from loading saved sessions (ggml-org#1934)
* fixed issue: memory is not guaranteed to be aligned properly during ggml_init call from loading saved sessions * - removed commented out old code from fix - updated another instance of same issue below original
1 parent 23fc5c2 commit ba4e85a

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

llama.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3126,9 +3126,7 @@ size_t llama_copy_state_data(struct llama_context * ctx, uint8_t * dst) {
31263126
if (kv_size) {
31273127
const size_t elt_size = ggml_element_size(kv_self.k);
31283128

3129-
char buffer[4096];
3130-
3131-
ggml_context * cpy_ctx = ggml_init({ sizeof(buffer), buffer, /* no_alloc */ true });
3129+
ggml_context * cpy_ctx = ggml_init({ 4096, NULL, /* no_alloc */ true });
31323130
ggml_cgraph gf{};
31333131
gf.n_threads = 1;
31343132

@@ -3234,9 +3232,7 @@ size_t llama_set_state_data(struct llama_context * ctx, uint8_t * src) {
32343232

32353233
const size_t elt_size = ggml_element_size(kv_self.k);
32363234

3237-
char buffer[4096];
3238-
3239-
ggml_context * cpy_ctx = ggml_init({ sizeof(buffer), buffer, /* no_alloc */ true });
3235+
ggml_context * cpy_ctx = ggml_init({ 4096, NULL, /* no_alloc */ true });
32403236
ggml_cgraph gf{};
32413237
gf.n_threads = 1;
32423238

0 commit comments

Comments
 (0)
0