Merge branch 'f-140' into f-140-j

This commit is contained in:
Niko1221 committed 2026-10-05 13:24:21 +02:00
commit 0fff115dfd
52 files changed
+3698 -183

No files matched your search

+12 -4
View File
@@ -6388,6 +6388,11 @@ int main(int argc, char** argv) {
float req_min_p = 0.0f, req_penalty_repeat = 1.0f, req_penalty_freq = 0.0f, req_penalty_present = 0.0f;
int req_penalty_last_n = 0;
int req_cvec = 1; // cvec=0|1: a loaded control vector for this request (on when absent)
// ckpt=0: a one-shot call whose turn no later request extends. No checkpoint at its last turn boundary
// (so no split there) nor every --prompt-cache-every tokens, and its session is neither continued nor
// parked after it. It still resumes from a checkpoint it matches, and still saves the system-prompt root
// when that reaches --prompt-cache-root. Absent = checkpointed as before.
int req_ckpt = 1;
// tuning keys (setup's calibration measures settings without restarting the engine): the PCIe share of
// the missed experts and the draft-probability floor, for this request only
double req_pcie_frac = o.pcie_frac, req_spec_min_p = o.spec_min_p;
@@ -6404,6 +6409,7 @@ int main(int argc, char** argv) {
const std::string key = tok.substr(0, eq);
const float fv = std::strtof(tok.c_str() + eq + 1, nullptr);
if (key == "cvec") req_cvec = std::atoi(tok.c_str() + eq + 1);
else if (key == "ckpt") req_ckpt = std::atoi(tok.c_str() + eq + 1) != 0;
else if (key == "temperature") req_temperature = fv;
else if (key == "top_p") req_top_p = fv;
else if (key == "top_k") req_top_k = std::atoi(tok.c_str() + eq + 1);
@@ -6792,7 +6798,7 @@ int main(int argc, char** argv) {
pp_from = read_from;
pp_reached = read_from;
pp_t0 = r0;
pp_next_check = reread_to > 0 ? INT64_MAX : resume + o.prompt_cache_every;
pp_next_check = reread_to > 0 || !req_ckpt ? INT64_MAX : resume + o.prompt_cache_every; // ckpt=0: none
{
std::lock_guard<std::mutex> lk(part_mu);
part_at.clear();
@@ -7119,9 +7125,11 @@ int main(int argc, char** argv) {
// which the retention policy pins (conv_cache.hpp), so the next new chat reads only what comes after it.
// (PR #65, code-martin.) Only for a system prompt of --prompt-cache-root tokens or more: a small one
// is cheaper to read again than the extra part costs (~0.3 s).
const int64_t last_turn = turn_at; // ckpt=0 drops the split there, the root is still looked for before it
if (!req_ckpt) turn_at = -1;
int64_t root_at = -1;
if (o.prompt_cache > 0 && o.turn_token >= 0 && o.prompt_cache_root > 0 && (read_from == 0 || resumed_from0))
for (int64_t i = 1; i < turn_at; ++i)
for (int64_t i = 1; i < last_turn; ++i)
if (ids[(size_t) i] == o.turn_token) {
if (i >= o.prompt_cache_root) root_at = i;
break;
@@ -7393,10 +7401,10 @@ int main(int argc, char** argv) {
// (the checkpoints taken while reading it are still good)
live.swap(consumed);
live_imgs = imgs_below(req_imgs, (int64_t) live.size());
live_ok = o.prompt_cache > 0;
live_ok = o.prompt_cache > 0 && req_ckpt; // ckpt=0: nothing to continue or park (#830)
}
static const bool state_hash = std::getenv("STRATA_STATE_HASH") != nullptr;
if (state_hash && live_ok) {
if (state_hash && !cancelled && o.prompt_cache > 0) { // every finished request, ckpt=0 too (parity gates)
// DEBUG: a fingerprint of every part of the session over the positions it holds ([0, L)), and
// separately of what lies past them in the last KV page (stale cells, fine unless something reads them)
if (cudaDeviceSynchronize() != cudaSuccess) {