Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.

Commit c33970c

Browse files
committed
chore: bump llama.cpp
Signed-off-by: thxCode <thxcode0824@gmail.com>
1 parent 20b60cf commit c33970c

9 files changed

Lines changed: 40 additions & 40 deletions

File tree

llama-box/patches/llama.cpp/dynamic_link.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
diff --git a/ggml/src/ggml-cpu/ggml-cpu.cpp b/ggml/src/ggml-cpu/ggml-cpu.cpp
2-
index a98866a2..db2c980d 100644
2+
index c9daa4c3..26f219c4 100644
33
--- a/ggml/src/ggml-cpu/ggml-cpu.cpp
44
+++ b/ggml/src/ggml-cpu/ggml-cpu.cpp
5-
@@ -634,6 +634,18 @@ static void * ggml_backend_cpu_get_proc_address(ggml_backend_reg_t reg, const ch
5+
@@ -635,6 +635,18 @@ static void * ggml_backend_cpu_get_proc_address(ggml_backend_reg_t reg, const ch
66
if (strcmp(name, "ggml_backend_cpu_is_numa") == 0) {
77
return (void *)ggml_is_numa;
88
}

llama-box/patches/llama.cpp/ggml-cpu.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
diff --git a/ggml/src/ggml-cpu/ops.cpp b/ggml/src/ggml-cpu/ops.cpp
2-
index 8531baf6..75f80190 100644
2+
index 27586ed1..105a3673 100644
33
--- a/ggml/src/ggml-cpu/ops.cpp
44
+++ b/ggml/src/ggml-cpu/ops.cpp
5-
@@ -4812,7 +4812,9 @@ static void ggml_compute_forward_soft_max_f32(
5+
@@ -5299,7 +5299,9 @@ static void ggml_compute_forward_soft_max_f32(
66
ggml_vec_max_f32(nc, &max, wp);
77

88
ggml_float sum = ggml_vec_soft_max_f32(nc, dp, wp, max);

llama-box/patches/llama.cpp/ggml-metal.patch

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
diff --git a/ggml/src/ggml-metal/ggml-metal.m b/ggml/src/ggml-metal/ggml-metal.m
2-
index d8d30cc0..2cd6cefc 100644
2+
index 12a36695..6ace438d 100644
33
--- a/ggml/src/ggml-metal/ggml-metal.m
44
+++ b/ggml/src/ggml-metal/ggml-metal.m
5-
@@ -1571,6 +1571,7 @@ static bool ggml_backend_metal_buffer_rset_init(
5+
@@ -1595,6 +1595,7 @@ static bool ggml_backend_metal_buffer_rset_init(
66

77
[ctx->rset commit];
88
[ctx->rset requestResidency];
99
+ GGML_LOG_INFO("%s: residency set %p, n_buffers = %d, all_size = %zu\n", __func__, ctx->rset, ctx->n_buffers, ctx->all_size);
1010

1111
return true;
1212
}
13-
@@ -1587,8 +1588,10 @@ static void ggml_backend_metal_buffer_rset_free(struct ggml_backend_metal_buffer
13+
@@ -1611,8 +1612,10 @@ static void ggml_backend_metal_buffer_rset_free(struct ggml_backend_metal_buffer
1414
#if defined(GGML_METAL_HAS_RESIDENCY_SETS)
1515
if (@available(macOS 15.0, iOS 18.0, tvOS 18.0, visionOS 2.0, *)) {
1616
if (ctx->rset) {
@@ -21,7 +21,7 @@ index d8d30cc0..2cd6cefc 100644
2121
[ctx->rset release];
2222
}
2323
}
24-
@@ -1846,10 +1849,10 @@ static bool ggml_metal_encode_node(
24+
@@ -1904,10 +1907,10 @@ static bool ggml_metal_encode_node(
2525
} break;
2626
}
2727

@@ -36,7 +36,7 @@ index d8d30cc0..2cd6cefc 100644
3636

3737
ggml_metal_mem_pool_clear(mem_pool);
3838

39-
@@ -2854,7 +2857,21 @@ static bool ggml_metal_encode_node(
39+
@@ -2968,7 +2971,21 @@ static bool ggml_metal_encode_node(
4040

4141
// find the break-even point where the matrix-matrix kernel becomes more efficient compared
4242
// to the matrix-vector kernel
@@ -59,7 +59,7 @@ index d8d30cc0..2cd6cefc 100644
5959

6060
// first try to use small-batch mat-mv kernels
6161
// these should be efficient for BS [2, ~8]
62-
@@ -2863,13 +2880,8 @@ static bool ggml_metal_encode_node(
62+
@@ -2977,13 +2994,8 @@ static bool ggml_metal_encode_node(
6363
(
6464
(
6565
src0t == GGML_TYPE_F16 || // TODO: helper function
@@ -74,7 +74,7 @@ index d8d30cc0..2cd6cefc 100644
7474
) ||
7575
(
7676
(
77-
@@ -2888,7 +2900,7 @@ static bool ggml_metal_encode_node(
77+
@@ -3002,7 +3014,7 @@ static bool ggml_metal_encode_node(
7878
// my current hypothesis is that the work grid is not evenly divisible for different nsg
7979
// values and there can be some tail effects when nsg is high. need to confirm this
8080
//
@@ -83,7 +83,7 @@ index d8d30cc0..2cd6cefc 100644
8383
const int nxpsg = ne11 < 3 ? 16 : 8; // num threads along row per simdgroup
8484
const int nypsg = 32/nxpsg; // num threads along col per simdgroup (i.e. a simdgroup processes that many src0 rows at a time)
8585
const int r0ptg = nypsg*nsg; // num src0 rows per threadgroup
86-
@@ -3786,7 +3798,7 @@ static bool ggml_metal_encode_node(
86+
@@ -3961,7 +3973,7 @@ static bool ggml_metal_encode_node(
8787
} break;
8888
case GGML_OP_RMS_NORM:
8989
{

llama-box/patches/llama.cpp/max_devices.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/ggml/src/ggml-backend.cpp b/ggml/src/ggml-backend.cpp
2-
index b1050ad5..95152566 100644
2+
index 788861a3..2afb0a87 100644
33
--- a/ggml/src/ggml-backend.cpp
44
+++ b/ggml/src/ggml-backend.cpp
55
@@ -609,7 +609,7 @@ static bool ggml_is_view_op(enum ggml_op op) {

llama-box/patches/llama.cpp/model.patch

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/src/llama-arch.cpp b/src/llama-arch.cpp
2-
index 435e3b9b..702c9ad9 100644
2+
index aa21108a..907cd4b8 100644
33
--- a/src/llama-arch.cpp
44
+++ b/src/llama-arch.cpp
55
@@ -17,6 +17,7 @@ static const std::map<llm_arch, const char *> LLM_ARCH_NAMES = {
@@ -10,7 +10,7 @@ index 435e3b9b..702c9ad9 100644
1010
{ LLM_ARCH_BERT, "bert" },
1111
{ LLM_ARCH_NOMIC_BERT, "nomic-bert" },
1212
{ LLM_ARCH_NOMIC_BERT_MOE, "nomic-bert-moe" },
13-
@@ -465,6 +466,22 @@ static const std::map<llm_arch, std::map<llm_tensor, const char *>> LLM_TENSOR_N
13+
@@ -466,6 +467,22 @@ static const std::map<llm_arch, std::map<llm_tensor, const char *>> LLM_TENSOR_N
1414
{ LLM_TENSOR_FFN_UP, "blk.%d.ffn_up" },
1515
},
1616
},
@@ -34,7 +34,7 @@ index 435e3b9b..702c9ad9 100644
3434
LLM_ARCH_BERT,
3535
{
3636
diff --git a/src/llama-arch.h b/src/llama-arch.h
37-
index 9181ad05..01671138 100644
37+
index 0771ec3e..18de556c 100644
3838
--- a/src/llama-arch.h
3939
+++ b/src/llama-arch.h
4040
@@ -21,6 +21,7 @@ enum llm_arch {
@@ -46,10 +46,10 @@ index 9181ad05..01671138 100644
4646
LLM_ARCH_NOMIC_BERT,
4747
LLM_ARCH_NOMIC_BERT_MOE,
4848
diff --git a/src/llama-model.cpp b/src/llama-model.cpp
49-
index fc39195e..e76d37f2 100644
49+
index b15bf73c..20dea2bb 100644
5050
--- a/src/llama-model.cpp
5151
+++ b/src/llama-model.cpp
52-
@@ -740,6 +740,16 @@ void llama_model::load_hparams(llama_model_loader & ml) {
52+
@@ -741,6 +741,16 @@ void llama_model::load_hparams(llama_model_loader & ml) {
5353
default: type = LLM_TYPE_UNKNOWN;
5454
}
5555
} break;
@@ -66,15 +66,15 @@ index fc39195e..e76d37f2 100644
6666
case LLM_ARCH_NOMIC_BERT:
6767
case LLM_ARCH_NOMIC_BERT_MOE:
6868
{
69-
@@ -2183,6 +2193,7 @@ bool llama_model::load_tensors(llama_model_loader & ml) {
69+
@@ -2192,6 +2202,7 @@ bool llama_model::load_tensors(llama_model_loader & ml) {
7070
layer.ffn_up_b = create_tensor(tn(LLM_TENSOR_FFN_UP, "bias", i), {n_ff}, 0);
7171
}
7272
} break;
7373
+ case LLM_ARCH_NEW:
7474
case LLM_ARCH_BERT:
7575
case LLM_ARCH_NOMIC_BERT:
7676
case LLM_ARCH_NOMIC_BERT_MOE:
77-
@@ -2190,7 +2201,7 @@ bool llama_model::load_tensors(llama_model_loader & ml) {
77+
@@ -2199,7 +2210,7 @@ bool llama_model::load_tensors(llama_model_loader & ml) {
7878
tok_embd = create_tensor(tn(LLM_TENSOR_TOKEN_EMBD, "weight"), {n_embd, n_vocab}, 0);
7979
type_embd = create_tensor(tn(LLM_TENSOR_TOKEN_TYPES, "weight"), {n_embd, n_token_types}, TENSOR_NOT_REQUIRED);
8080

@@ -83,7 +83,7 @@ index fc39195e..e76d37f2 100644
8383
pos_embd = create_tensor(tn(LLM_TENSOR_POS_EMBD, "weight"), {n_embd, n_ctx_train}, 0);
8484

8585
cls = create_tensor(tn(LLM_TENSOR_CLS, "weight"), {n_embd, n_embd}, TENSOR_NOT_REQUIRED);
86-
@@ -2231,12 +2242,16 @@ bool llama_model::load_tensors(llama_model_loader & ml) {
86+
@@ -2240,12 +2251,16 @@ bool llama_model::load_tensors(llama_model_loader & ml) {
8787
layer.ffn_down_exps = create_tensor(tn(LLM_TENSOR_FFN_DOWN_EXPS, "weight", i), { n_ff, n_embd, n_expert}, 0);
8888
layer.ffn_gate_inp = create_tensor(tn(LLM_TENSOR_FFN_GATE_INP, "weight", i), {n_embd, n_expert}, 0);
8989
} else {
@@ -103,7 +103,7 @@ index fc39195e..e76d37f2 100644
103103
layer.ffn_down_b = create_tensor(tn(LLM_TENSOR_FFN_DOWN, "bias", i), {n_embd}, 0);
104104
} else {
105105
layer.ffn_gate = create_tensor(tn(LLM_TENSOR_FFN_GATE, "weight", i), {n_embd, n_ff}, 0);
106-
@@ -6138,7 +6153,7 @@ struct llm_build_bert : public llm_graph_context {
106+
@@ -6181,7 +6196,7 @@ struct llm_build_bert : public llm_graph_context {
107107
ggml_tensor * type_row0 = ggml_view_1d(ctx0, model.type_embd, n_embd, 0);
108108
inpL = ggml_add(ctx0, inpL, type_row0);
109109
}
@@ -112,7 +112,7 @@ index fc39195e..e76d37f2 100644
112112
inpL = ggml_add(ctx0, ggml_get_rows(ctx0, model.pos_embd, inp_pos), inpL);
113113
}
114114
cb(inpL, "inp_embd", -1);
115-
@@ -6197,7 +6212,7 @@ struct llm_build_bert : public llm_graph_context {
115+
@@ -6240,7 +6255,7 @@ struct llm_build_bert : public llm_graph_context {
116116
Vcur = ggml_reshape_3d(ctx0, Vcur, n_embd_head, n_head_kv, n_tokens);
117117

118118
// RoPE
@@ -121,7 +121,7 @@ index fc39195e..e76d37f2 100644
121121
Qcur = ggml_rope_ext(
122122
ctx0, Qcur, inp_pos, nullptr,
123123
n_rot, rope_type, n_ctx_orig, freq_base, freq_scale,
124-
@@ -6256,6 +6271,13 @@ struct llm_build_bert : public llm_graph_context {
124+
@@ -6299,6 +6314,13 @@ struct llm_build_bert : public llm_graph_context {
125125
0.0f,
126126
LLAMA_EXPERT_GATING_FUNC_TYPE_SOFTMAX, il);
127127
cb(cur, "ffn_moe_out", il);
@@ -135,23 +135,23 @@ index fc39195e..e76d37f2 100644
135135
} else if (model.arch == LLM_ARCH_BERT || model.arch == LLM_ARCH_NOMIC_BERT_MOE) {
136136
cur = build_ffn(cur,
137137
model.layers[il].ffn_up, model.layers[il].ffn_up_b, NULL,
138-
@@ -14266,6 +14288,7 @@ llama_memory_i * llama_model::create_memory(const llama_memory_params & params,
138+
@@ -14439,6 +14461,7 @@ llama_memory_i * llama_model::create_memory(const llama_memory_params & params,
139139
switch (arch) {
140140
// Models that need specific instantiation should be handled in the
141141
// switch statement
142142
+ case LLM_ARCH_NEW:
143143
case LLM_ARCH_BERT:
144144
case LLM_ARCH_JINA_BERT_V2:
145145
case LLM_ARCH_NOMIC_BERT:
146-
@@ -14390,6 +14413,7 @@ llm_graph_result_ptr llama_model::build_graph(
146+
@@ -14563,6 +14586,7 @@ llm_graph_result_ptr llama_model::build_graph(
147147
{
148148
llm = std::make_unique<llm_build_refact>(*this, params, gf);
149149
} break;
150150
+ case LLM_ARCH_NEW:
151151
case LLM_ARCH_BERT:
152152
case LLM_ARCH_JINA_BERT_V2:
153153
case LLM_ARCH_NOMIC_BERT:
154-
@@ -14792,6 +14816,7 @@ llama_rope_type llama_model_rope_type(const llama_model * model) {
154+
@@ -14970,6 +14994,7 @@ llama_rope_type llama_model_rope_type(const llama_model * model) {
155155
case LLM_ARCH_FALCON:
156156
case LLM_ARCH_GROK:
157157
case LLM_ARCH_DBRX:

llama-box/patches/llama.cpp/model_py.patch

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
diff --git a/convert_hf_to_gguf.py b/convert_hf_to_gguf.py
2-
index 4f2339a0..beec3508 100755
2+
index c2c55166..9a33ecbe 100755
33
--- a/convert_hf_to_gguf.py
44
+++ b/convert_hf_to_gguf.py
5-
@@ -4129,6 +4129,123 @@ class XLMRobertaModel(BertModel):
5+
@@ -4175,6 +4175,123 @@ class XLMRobertaModel(BertModel):
66
return super().modify_tensors(data_torch, name, bid)
77

88

@@ -127,7 +127,7 @@ index 4f2339a0..beec3508 100755
127127
class GemmaModel(TextModel):
128128
model_arch = gguf.MODEL_ARCH.GEMMA
129129
diff --git a/gguf-py/gguf/constants.py b/gguf-py/gguf/constants.py
130-
index fb75143b..41d4d675 100644
130+
index b5ba933c..3d5d53ec 100644
131131
--- a/gguf-py/gguf/constants.py
132132
+++ b/gguf-py/gguf/constants.py
133133
@@ -295,6 +295,7 @@ class MODEL_ARCH(IntEnum):
@@ -138,15 +138,15 @@ index fb75143b..41d4d675 100644
138138
BERT = auto()
139139
NOMIC_BERT = auto()
140140
NOMIC_BERT_MOE = auto()
141-
@@ -595,6 +596,7 @@ MODEL_ARCH_NAMES: dict[MODEL_ARCH, str] = {
141+
@@ -596,6 +597,7 @@ MODEL_ARCH_NAMES: dict[MODEL_ARCH, str] = {
142142
MODEL_ARCH.MPT: "mpt",
143143
MODEL_ARCH.STARCODER: "starcoder",
144144
MODEL_ARCH.REFACT: "refact",
145145
+ MODEL_ARCH.NEW: "new",
146146
MODEL_ARCH.BERT: "bert",
147147
MODEL_ARCH.NOMIC_BERT: "nomic-bert",
148148
MODEL_ARCH.NOMIC_BERT_MOE: "nomic-bert-moe",
149-
@@ -1076,6 +1078,20 @@ MODEL_TENSORS: dict[MODEL_ARCH, list[MODEL_TENSOR]] = {
149+
@@ -1078,6 +1080,20 @@ MODEL_TENSORS: dict[MODEL_ARCH, list[MODEL_TENSOR]] = {
150150
MODEL_TENSOR.FFN_DOWN,
151151
MODEL_TENSOR.FFN_UP,
152152
],

llama-box/patches/llama.cpp/mrope.patch

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
diff --git a/ggml/src/ggml-cpu/ops.cpp b/ggml/src/ggml-cpu/ops.cpp
2-
index 8531baf6..f9162daf 100644
2+
index 27586ed1..8ff3eced 100644
33
--- a/ggml/src/ggml-cpu/ops.cpp
44
+++ b/ggml/src/ggml-cpu/ops.cpp
5-
@@ -5235,10 +5235,6 @@ static void ggml_compute_forward_rope_f32(
5+
@@ -5722,10 +5722,6 @@ static void ggml_compute_forward_rope_f32(
66
const bool is_mrope = mode & GGML_ROPE_TYPE_MROPE; // ggml_rope_multi, multimodal rotary position embedding
77
const bool is_vision = mode == GGML_ROPE_TYPE_VISION;
88

@@ -13,7 +13,7 @@ index 8531baf6..f9162daf 100644
1313
if (is_vision) {
1414
GGML_ASSERT(n_dims == ne0/2);
1515
}
16-
@@ -5421,10 +5417,6 @@ static void ggml_compute_forward_rope_f16(
16+
@@ -5908,10 +5904,6 @@ static void ggml_compute_forward_rope_f16(
1717
const bool is_mrope = mode & GGML_ROPE_TYPE_MROPE;
1818
const bool is_vision = mode == GGML_ROPE_TYPE_VISION;
1919

@@ -40,10 +40,10 @@ index 18f691b2..f5a4da3a 100644
4040
GGML_ASSERT(n_dims == ne00/2);
4141
}
4242
diff --git a/ggml/src/ggml-metal/ggml-metal.m b/ggml/src/ggml-metal/ggml-metal.m
43-
index d8d30cc0..9bd117f3 100644
43+
index 12a36695..545048f3 100644
4444
--- a/ggml/src/ggml-metal/ggml-metal.m
4545
+++ b/ggml/src/ggml-metal/ggml-metal.m
46-
@@ -4049,7 +4049,6 @@ static bool ggml_metal_encode_node(
46+
@@ -4224,7 +4224,6 @@ static bool ggml_metal_encode_node(
4747
{
4848
GGML_ASSERT(ggml_is_contiguous(src0));
4949
GGML_ASSERT(ggml_is_contiguous(src1));

llama-box/patches/llama.cpp/tool_calling.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -861,10 +861,10 @@ index 38800010..a4bb355a 100644
861861
llm_chat_template tmpl,
862862
const std::vector<const llama_chat_message *> & chat,
863863
diff --git a/src/llama-model.cpp b/src/llama-model.cpp
864-
index fc39195e..a74a5291 100644
864+
index b15bf73c..53d7864a 100644
865865
--- a/src/llama-model.cpp
866866
+++ b/src/llama-model.cpp
867-
@@ -14686,6 +14686,10 @@ void llama_model_free(llama_model * model) {
867+
@@ -14863,6 +14863,10 @@ void llama_model_free(llama_model * model) {
868868
delete model;
869869
}
870870

llama.cpp

Submodule llama.cpp updated 47 files

0 commit comments

Comments
 (0)