Skip to content

Commit fe4b1b3

Browse files
committed
llama : fix llama_memory_t typedef
ggml-ci
1 parent 11b9074 commit fe4b1b3

File tree

4 files changed

+7
-13
lines changed

4 files changed

+7
-13
lines changed

include/llama.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ extern "C" {
6262
struct llama_context;
6363
struct llama_sampler;
6464

65-
typedef struct llama_memory * llama_memory_t;
65+
typedef struct llama_memory_i * llama_memory_t;
6666

6767
struct llama_kv_cache; // DEPRECATED (use llama_memory instead)
6868

src/llama-context.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ struct llama_model;
1717
class llama_io_read_i;
1818
class llama_io_write_i;
1919

20-
class llama_memory_i;
21-
class llama_memory_state_i;
20+
struct llama_memory_i;
21+
struct llama_memory_state_i;
2222

2323
struct llama_context {
2424
// init scheduler and compute buffers, reserve worst-case graphs

src/llama-graph.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ struct ggml_tensor;
1717
struct llama_ubatch;
1818
struct llama_cparams;
1919

20-
class llama_memory_state_i;
20+
struct llama_memory_state_i;
2121

2222
class llama_kv_cache_unified_state;
2323
class llama_kv_cache_unified_iswa_state;

src/llama-memory.h

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ llama_memory_status llama_memory_status_combine(llama_memory_status s0, llama_me
3939
// the only method that can mutate the memory and the memory state is llama_memory_i::apply()
4040
//
4141
// TODO: rename to llama_memory_context_i ?
42-
class llama_memory_state_i {
43-
public:
42+
struct llama_memory_state_i {
4443
virtual ~llama_memory_state_i() = default;
4544

4645
// consume the current ubatch from the state and proceed to the next one
@@ -65,8 +64,7 @@ using llama_memory_state_ptr = std::unique_ptr<llama_memory_state_i>;
6564

6665
// general concept of LLM memory
6766
// the KV cache is a type of LLM memory, but there can be other types
68-
class llama_memory_i {
69-
public:
67+
struct llama_memory_i {
7068
virtual ~llama_memory_i() = default;
7169

7270
// split the input batch into a set of ubatches and verify that they can fit into the cache
@@ -113,11 +111,7 @@ class llama_memory_i {
113111

114112
using llama_memory_ptr = std::unique_ptr<llama_memory_i>;
115113

116-
// TODO: how to avoid this shim?
117-
struct llama_memory : public llama_memory_i {
118-
};
119-
120114
// TODO: temporary until the llama_kv_cache is removed from the public API
121-
struct llama_kv_cache : public llama_memory {
115+
struct llama_kv_cache : public llama_memory_i {
122116
virtual ~llama_kv_cache() = default;
123117
};

0 commit comments

Comments
 (0)