Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 44fbcee408ecf53a7ee56963368642062715eca4 Mon Sep 17 00:00:00 2001
From 34be3b6d89d94ac218678e7f6ada201a1bcba4c1 Mon Sep 17 00:00:00 2001
From: Mesh-LLM CI <ci@mesh-llm.local>
Date: Fri, 26 Jun 2026 13:47:52 +1000
Subject: [PATCH 01/16] Add Skippy ABI and package writer foundation
Subject: [PATCH 01/45] Add Skippy ABI and package writer foundation

Squashes the initial Skippy ABI headers, model info entrypoints, single-stage runtime baseline, runtime-slice tensor filtering, activation-frame execution, GGUF slice writing, and package part composition.
---
Expand Down Expand Up @@ -444,10 +444,10 @@ index 7ed490ce..a7986a87 100644
enum llm_graph_type {
LLM_GRAPH_TYPE_DEFAULT,
diff --git a/src/llama-model-loader.cpp b/src/llama-model-loader.cpp
index 28f8bb79..f4310743 100644
index 43447f57..7f23dbbc 100644
--- a/src/llama-model-loader.cpp
+++ b/src/llama-model-loader.cpp
@@ -17,6 +17,16 @@ static const size_t kiB = 1024;
@@ -18,6 +18,16 @@ static const size_t kiB = 1024;
static const size_t MiB = 1024*kiB;
static const size_t GiB = 1024*MiB;

Expand All @@ -464,7 +464,7 @@ index 28f8bb79..f4310743 100644
const char * llama_file_version_name(llama_fver version) {
switch (version) {
case GGUF_FILE_VERSION_V1: return "GGUF V1 (support until nov 2023)";
@@ -1107,6 +1117,40 @@ struct ggml_tensor * llama_model_loader::create_tensor(
@@ -1094,6 +1104,40 @@ struct ggml_tensor * llama_model_loader::create_tensor(
throw std::runtime_error(format("missing tensor info mapping for %s", tn.str().c_str()));
}

Expand Down Expand Up @@ -506,7 +506,7 @@ index 28f8bb79..f4310743 100644
if (info.op == GGML_OP_NONE || (flags & TENSOR_SKIP)) {
const size_t nbytes = ggml_nbytes(t_meta);
diff --git a/src/llama-model-loader.h b/src/llama-model-loader.h
index c476026d..3fb84fdd 100644
index 75a3652d..92ad6430 100644
--- a/src/llama-model-loader.h
+++ b/src/llama-model-loader.h
@@ -20,6 +20,17 @@ using llama_buf_map = std::unordered_map<uint32_t, ggml_backend_buffer_t>;
Expand Down Expand Up @@ -2080,5 +2080,5 @@ index 00000000..26169320
+
+}
--
2.54.0 (Apple Git-157)
2.50.1 (Apple Git-155)

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From ce280251dfacfcf0f99307690fa0f0114665f572 Mon Sep 17 00:00:00 2001
From 0f00b168cc09677e844bf8822040aa3d71f304b5 Mon Sep 17 00:00:00 2001
From: Mesh-LLM CI <ci@mesh-llm.local>
Date: Fri, 26 Jun 2026 13:47:52 +1000
Subject: [PATCH 02/16] Add early staged model-family and chat support
Subject: [PATCH 02/45] Add early staged model-family and chat support

Squashes the first Qwen MoE staged-runtime support, native KV page basics, session reset, token EOG exposure, batched token verification, chat-template ABI, and the first wider model-family support pass.
---
Expand Down Expand Up @@ -32,7 +32,7 @@ Squashes the first Qwen MoE staged-runtime support, native KV page basics, sessi
create mode 100644 common/stage-chat.cpp

diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
index 4cf580a0..b06bfeda 100644
index 99688f53..3928ba17 100644
--- a/common/CMakeLists.txt
+++ b/common/CMakeLists.txt
@@ -98,6 +98,7 @@ add_library(${TARGET}
Expand All @@ -42,7 +42,7 @@ index 4cf580a0..b06bfeda 100644
+ stage-chat.cpp
speculative.cpp
speculative.h
unicode.cpp
trie.cpp
diff --git a/common/stage-chat.cpp b/common/stage-chat.cpp
new file mode 100644
index 00000000..39d6331a
Expand Down Expand Up @@ -455,7 +455,7 @@ index a7986a87..33d57061 100644
public:
llm_graph_input_pos(uint32_t n_pos_per_embd) : n_pos_per_embd(n_pos_per_embd) {}
diff --git a/src/llama-kv-cache.cpp b/src/llama-kv-cache.cpp
index e70583e6..e8be39b0 100644
index e25464c5..d7c7c220 100644
--- a/src/llama-kv-cache.cpp
+++ b/src/llama-kv-cache.cpp
@@ -4,6 +4,7 @@
Expand Down Expand Up @@ -863,10 +863,10 @@ index 531d99db..d9301c19 100644
// graph_build API
//
diff --git a/src/llama-model-loader.cpp b/src/llama-model-loader.cpp
index f4310743..4e43bfbc 100644
index 7f23dbbc..c94aca78 100644
--- a/src/llama-model-loader.cpp
+++ b/src/llama-model-loader.cpp
@@ -1095,13 +1095,6 @@ struct ggml_tensor * llama_model_loader::create_tensor(
@@ -1082,13 +1082,6 @@ struct ggml_tensor * llama_model_loader::create_tensor(
};

auto buft_for_tensor = [&](ggml_tensor * t_meta) -> ggml_backend_buffer_type_t {
Expand All @@ -880,7 +880,7 @@ index f4310743..4e43bfbc 100644
// some models use the token embedding tensor as the output, but since these are used in different layers and with different ops
// the tensor is duplicated
// to handle this, we check if the tensor is duplicated, and if so, we assume that it is being loaded as the output tensor
@@ -1135,22 +1128,38 @@ struct ggml_tensor * llama_model_loader::create_tensor(
@@ -1122,22 +1115,38 @@ struct ggml_tensor * llama_model_loader::create_tensor(
break;
}

Expand Down Expand Up @@ -929,10 +929,10 @@ index f4310743..4e43bfbc 100644
if (info.op == GGML_OP_NONE || (flags & TENSOR_SKIP)) {
const size_t nbytes = ggml_nbytes(t_meta);
diff --git a/src/llama-model.cpp b/src/llama-model.cpp
index 4c10e412..3c65b60e 100644
index b100f601..07d3f4f3 100644
--- a/src/llama-model.cpp
+++ b/src/llama-model.cpp
@@ -1393,13 +1393,13 @@ bool llama_model_base::load_tensors(llama_model_loader & ml) {
@@ -1398,13 +1398,13 @@ bool llama_model_base::load_tensors(llama_model_loader & ml) {
}

// MoE expert weight scales (per-expert, shape {n_expert})
Expand Down Expand Up @@ -2347,5 +2347,5 @@ index 26169320..50e25c8f 100644
const char * path,
struct skippy_model_info ** out_info,
--
2.54.0 (Apple Git-157)
2.50.1 (Apple Git-155)

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 0b214c33dd63bb1513d74f13e486d9648da1965d Mon Sep 17 00:00:00 2001
From ab8b97e2a7169c1f6081a27c49f6bc64959f79a1 Mon Sep 17 00:00:00 2001
From: Mesh-LLM CI <ci@mesh-llm.local>
Date: Fri, 26 Jun 2026 13:47:52 +1000
Subject: [PATCH 03/16] Add staged sampling, checkpoints, and part loading
Subject: [PATCH 03/45] Add staged sampling, checkpoints, and part loading

Squashes sampling configuration, batched verification frames, recurrent/native session checkpoints, logit bias, session trim, verification handoff fixes, split-metadata stripping, thinking toggle support, and ordered GGUF part loading.
---
Expand Down Expand Up @@ -49,10 +49,10 @@ index 39d6331a..60d53fc4 100644

for (size_t i = 0; i < message_count; ++i) {
diff --git a/include/llama.h b/include/llama.h
index a311ac20..4460a6a0 100644
index 9fab6931..e54b64dc 100644
--- a/include/llama.h
+++ b/include/llama.h
@@ -506,6 +506,13 @@ extern "C" {
@@ -514,6 +514,13 @@ extern "C" {
size_t n_paths,
struct llama_model_params params);

Expand Down Expand Up @@ -245,18 +245,18 @@ index 23a46e0f..4dd985da 100644
size_t output_text_capacity,
size_t * out_text_bytes,
diff --git a/src/llama-model-loader.cpp b/src/llama-model-loader.cpp
index 4e43bfbc..14f64c0f 100644
index c94aca78..ecafbdf2 100644
--- a/src/llama-model-loader.cpp
+++ b/src/llama-model-loader.cpp
@@ -531,6 +531,7 @@ llama_model_loader::llama_model_loader(
@@ -532,6 +532,7 @@ llama_model_loader::llama_model_loader(
void * set_tensor_data_ud,
const std::string & fname,
std::vector<std::string> & splits,
+ bool ordered_parts,
FILE * file,
bool use_mmap,
bool use_direct_io,
@@ -599,11 +600,50 @@ llama_model_loader::llama_model_loader(
llama_load_mode load_mode,
bool check_tensors,
@@ -588,11 +589,50 @@ llama_model_loader::llama_model_loader(
n_bytes += ggml_nbytes(cur);
weights_map.emplace(tensor_name, llama_tensor_weight(files.back().get(), 0, metadata, cur));
}
Expand Down Expand Up @@ -309,7 +309,7 @@ index 4e43bfbc..14f64c0f 100644
uint16_t idx = 0;
const std::string kv_split_no = llm_kv(LLM_KV_SPLIT_NO);
diff --git a/src/llama-model-loader.h b/src/llama-model-loader.h
index 3fb84fdd..d889c99d 100644
index 92ad6430..f73fa907 100644
--- a/src/llama-model-loader.h
+++ b/src/llama-model-loader.h
@@ -136,6 +136,7 @@ struct llama_model_loader {
Expand All @@ -318,46 +318,46 @@ index 3fb84fdd..d889c99d 100644
std::vector<std::string> & splits, // optional, only need if the split does not follow naming scheme
+ bool ordered_parts,
FILE * file,
bool use_mmap,
bool use_direct_io,
llama_load_mode load_mode,
bool check_tensors,
diff --git a/src/llama-quant.cpp b/src/llama-quant.cpp
index b66759b2..11ee5fa8 100644
index caf7733a..7a3d105a 100644
--- a/src/llama-quant.cpp
+++ b/src/llama-quant.cpp
@@ -881,7 +881,7 @@ static void llama_model_quantize_impl(const std::string & fname_inp, const std::
@@ -885,7 +885,7 @@ static void llama_model_quantize_impl(const std::string & fname_inp, const std::
const llama_model_kv_override * kv_overrides = params->kv_overrides;
std::vector<std::string> splits = {};
llama_model_loader ml(/*metadata*/ nullptr, /*set_tensor_data*/ nullptr, /*set_tensor_data_ud*/ nullptr,
- fname_inp, splits, /*file*/ nullptr, use_mmap, /*use_direct_io*/ false, /*check_tensors*/ true, /*no_alloc*/ false, kv_overrides, nullptr);
+ fname_inp, splits, /*ordered_parts*/ false, /*file*/ nullptr, use_mmap, /*use_direct_io*/ false, /*check_tensors*/ true, /*no_alloc*/ false, kv_overrides, nullptr);
- fname_inp, splits, /*file*/ nullptr, /*load_mode*/ load_mode, /*check_tensors*/ true, /*no_alloc*/ false, kv_overrides, nullptr);
+ fname_inp, splits, /*ordered_parts*/ false, /*file*/ nullptr, /*load_mode*/ load_mode, /*check_tensors*/ true, /*no_alloc*/ false, kv_overrides, nullptr);
ml.init_mappings(false); // no prefetching

auto mparams = llama_model_default_params();
diff --git a/src/llama.cpp b/src/llama.cpp
index 0de6048f..900a87f7 100644
index 11ac9656..48c578ee 100644
--- a/src/llama.cpp
+++ b/src/llama.cpp
@@ -277,9 +277,9 @@ static bool llama_prepare_model_devices(const llama_model_params & params, llama
@@ -299,9 +299,9 @@ static bool llama_prepare_model_devices(const llama_model_params & params, llama

// Returns 0 on success, -1 on error, and -2 on cancellation via llama_progress_callback
static std::pair<int, llama_model *> llama_model_load(struct gguf_context * metadata, llama_model_set_tensor_data_t set_tensor_data, void * set_tensor_data_ud,
- const std::string & fname, std::vector<std::string> & splits, FILE * file, llama_model_params & params) {
+ const std::string & fname, std::vector<std::string> & splits, bool ordered_parts, FILE * file, llama_model_params & params) {
try {
- llama_model_loader ml(metadata, set_tensor_data, set_tensor_data_ud, fname, splits, file, params.use_mmap, params.use_direct_io,
+ llama_model_loader ml(metadata, set_tensor_data, set_tensor_data_ud, fname, splits, ordered_parts, file, params.use_mmap, params.use_direct_io,
- llama_model_loader ml(metadata, set_tensor_data, set_tensor_data_ud, fname, splits, file, params.load_mode,
+ llama_model_loader ml(metadata, set_tensor_data, set_tensor_data_ud, fname, splits, ordered_parts, file, params.load_mode,
params.check_tensors, params.no_alloc, params.kv_overrides, params.tensor_buft_overrides);

ml.print_info();
@@ -344,6 +344,7 @@ static struct llama_model * llama_model_load_from_file_impl(
@@ -366,6 +366,7 @@ static struct llama_model * llama_model_load_from_file_impl(
void * set_tensor_data_ud,
const std::string & path_model,
std::vector<std::string> & splits,
+ bool ordered_parts,
FILE * file,
struct llama_model_params params) {
{
@@ -386,7 +387,7 @@ static struct llama_model * llama_model_load_from_file_impl(
@@ -408,7 +409,7 @@ static struct llama_model * llama_model_load_from_file_impl(
};
}

Expand All @@ -366,16 +366,16 @@ index 0de6048f..900a87f7 100644
GGML_ASSERT(status <= 0);
if (status < 0) {
if (status == -1) {
@@ -414,7 +415,7 @@ struct llama_model * llama_model_init_from_user(
@@ -436,7 +437,7 @@ struct llama_model * llama_model_init_from_user(
std::vector<std::string> splits = {};
params.use_mmap = false;
params.load_mode = LLAMA_LOAD_MODE_NONE;
params.use_extra_bufts = false;
- return llama_model_load_from_file_impl(metadata, set_tensor_data, set_tensor_data_ud, path_model, splits, /*file*/ nullptr, params);
+ return llama_model_load_from_file_impl(metadata, set_tensor_data, set_tensor_data_ud, path_model, splits, /*ordered_parts*/ false, /*file*/ nullptr, params);
}
// deprecated
struct llama_model * llama_load_model_from_file(
@@ -427,7 +428,7 @@ struct llama_model * llama_model_load_from_file(
@@ -449,7 +450,7 @@ struct llama_model * llama_model_load_from_file(
const char * path_model,
struct llama_model_params params) {
std::vector<std::string> splits = {};
Expand All @@ -384,7 +384,7 @@ index 0de6048f..900a87f7 100644
}

struct llama_model * llama_model_load_from_splits(
@@ -443,7 +444,27 @@ struct llama_model * llama_model_load_from_splits(
@@ -465,7 +466,27 @@ struct llama_model * llama_model_load_from_splits(
for (size_t i = 0; i < n_paths; ++i) {
splits.push_back(paths[i]);
}
Expand Down Expand Up @@ -413,7 +413,7 @@ index 0de6048f..900a87f7 100644
}

struct llama_model * llama_model_load_from_file_ptr(FILE * file, struct llama_model_params params) {
@@ -453,7 +474,7 @@ struct llama_model * llama_model_load_from_file_ptr(FILE * file, struct llama_mo
@@ -475,7 +496,7 @@ struct llama_model * llama_model_load_from_file_ptr(FILE * file, struct llama_mo
}
std::string path_model;
std::vector<std::string> splits = {};
Expand All @@ -422,7 +422,7 @@ index 0de6048f..900a87f7 100644
}

void llama_model_save_to_file(const struct llama_model * model, const char * path_model) {
@@ -578,4 +599,3 @@ const char * llama_print_system_info(void) {
@@ -600,4 +621,3 @@ const char * llama_print_system_info(void) {

return s.c_str();
}
Expand Down Expand Up @@ -1330,5 +1330,5 @@ index 50e25c8f..ab5a147c 100644
gguf_set_val_bool(out_ctx, "skippy.package.materialized", true);
gguf_set_val_u32(out_ctx, "skippy.package.part_count", static_cast<uint32_t>(input_count));
--
2.54.0 (Apple Git-157)
2.50.1 (Apple Git-155)

Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
From fdaad2b1c0571b49c42a215f9803b161a007398a Mon Sep 17 00:00:00 2001
From 59cdfb7bf5cf5e112f229ebec9a4e0fa3d954547 Mon Sep 17 00:00:00 2001
From: Mesh-LLM CI <ci@mesh-llm.local>
Date: Fri, 26 Jun 2026 13:47:52 +1000
Subject: [PATCH 04/16] Add lanes, external media, and chat grammar support
Subject: [PATCH 04/45] Add lanes, external media, and chat grammar support

Squashes Qwen3 MoE staged execution, KV cache type and generation signal ABI, backend device selection, external media prefill, shared execution lanes, batch/flash-attention config, tool-aware chat templates, and chat grammar sampling.
---
common/stage-chat.cpp | 230 ++++++++
include/skippy-signals.h | 44 ++
include/skippy.h | 165 +++---
src/llama-kv-cache.cpp | 361 +------------
src/llama-kv-cache.cpp | 356 +------------
src/llama-kv-cache.h | 19 -
src/models/qwen3moe.cpp | 18 +-
src/skippy.cpp | 1079 +++++++++++++++++++++++---------------
7 files changed, 1019 insertions(+), 897 deletions(-)
7 files changed, 1017 insertions(+), 894 deletions(-)
create mode 100644 include/skippy-signals.h

diff --git a/common/stage-chat.cpp b/common/stage-chat.cpp
Expand Down Expand Up @@ -573,7 +573,7 @@ index 4dd985da..3ffdb879 100644
const char * path,
struct skippy_model_info ** out_info,
diff --git a/src/llama-kv-cache.cpp b/src/llama-kv-cache.cpp
index e8be39b0..bbcd5b67 100644
index d7c7c220..f74bb495 100644
--- a/src/llama-kv-cache.cpp
+++ b/src/llama-kv-cache.cpp
@@ -196,12 +196,10 @@ llama_kv_cache::llama_kv_cache(
Expand All @@ -593,19 +593,7 @@ index e8be39b0..bbcd5b67 100644
}

// [TAG_V_CACHE_VARIABLE]
@@ -323,9 +321,8 @@ llama_kv_cache::llama_kv_cache(
ggml_is_quantized(type_k) &&
hparams.n_embd_head_k() % 64 == 0;

- // always create Hadamard rotation tensors for DeepSeek lightning indexers
- if ((model.arch == LLM_ARCH_DEEPSEEK32 || model.arch == LLM_ARCH_DEEPSEEK4) &&
- hparams.n_embd_head_k_full == hparams.indexer_head_size) {
+ // always create Hadamard rotation tensors for DeepSeek V3.2 DSA lightning indexer
+ if (model.arch == LLM_ARCH_DEEPSEEK32 && hparams.n_embd_head_k_full == hparams.indexer_head_size) {
attn_rot_k = true;
}

@@ -1225,352 +1222,6 @@ ggml_tensor * llama_kv_cache::get_k_storage(int32_t il) const {
@@ -1225,352 +1223,6 @@ ggml_tensor * llama_kv_cache::get_k_storage(int32_t il) const {
return layers[ikv].k;
}

Expand Down Expand Up @@ -2392,5 +2380,5 @@ index ab5a147c..e4d08ee4 100644
}

--
2.54.0 (Apple Git-157)
2.50.1 (Apple Git-155)

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 6ef5b5c66a88af43d7f4d853a848ce638d0db170 Mon Sep 17 00:00:00 2001
From 8d4cf568f56593d1fa8223ad12ca2965d680fee6 Mon Sep 17 00:00:00 2001
From: Mesh-LLM CI <ci@mesh-llm.local>
Date: Fri, 26 Jun 2026 13:47:52 +1000
Subject: [PATCH 05/16] Add resident prefix cache and session refinements
Subject: [PATCH 05/45] Add resident prefix cache and session refinements

Squashes resident prefix cache support, exact-prefix state restoration, borrowed prefix sessions, lazy generation signals, single-token allocation avoidance, server-like thread defaults, prefix cache borrowing, lane preservation, and recurrent-state remapping.
---
Expand Down Expand Up @@ -196,10 +196,10 @@ index 3ffdb879..deb5151e 100644
struct skippy_model * model,
const char * text,
diff --git a/src/llama-kv-cache.cpp b/src/llama-kv-cache.cpp
index bbcd5b67..539666f9 100644
index f74bb495..41a4e0de 100644
--- a/src/llama-kv-cache.cpp
+++ b/src/llama-kv-cache.cpp
@@ -1222,6 +1222,363 @@ ggml_tensor * llama_kv_cache::get_k_storage(int32_t il) const {
@@ -1223,6 +1223,363 @@ ggml_tensor * llama_kv_cache::get_k_storage(int32_t il) const {
return layers[ikv].k;
}

Expand Down Expand Up @@ -1569,5 +1569,5 @@ index e4d08ee4..f078f0b9 100644
struct skippy_session * session,
uint64_t * out_token_count,
--
2.54.0 (Apple Git-157)
2.50.1 (Apple Git-155)

Loading
Loading