Merge f-022-engfix: #3465 NaN retry reads the prompt batched, #3441/#3075 tool-call envelopes, #3503 cuda12 package keeps Pascal/Volta, #3480 queue priming respects GPU_MAX_HW_QUEUES

This commit is contained in:
Niko1221 committed 2026-10-21 01:48:02 +02:00
commit e0cfb80f53
13 files changed
+363 -17

No files matched your search

+26 -1
View File
@@ -2234,7 +2234,7 @@ static double ple_direct_rows_per_s(strata::kernels::PleTable& t) {
// it is the fast one). Streams are destroyed again; the runtime keeps the queues.
// Two queues are enough (R9700, "nn": 0 slow of 32 fresh starts, unprimed 10 of 32); five (nnnnh) fixed the starts too but cost
// decode 2 to 3.6% and two expert slots, four normal ones did not even fix the starts.
// STRATA_HIP_QUEUE_PRIME unset: gfx1200 / gfx1201 on Linux only, "nn"; "0": off; any other string is a spec
// STRATA_HIP_QUEUE_PRIME unset: gfx1200 / gfx1201 on Linux only, "nn" (not when GPU_MAX_HW_QUEUES is 1 or 2, #3480); "0": off; any other string is a spec
// ('n' = a stream at the default priority, 'h' = at the highest) for experiments on other cards.
static void prime_hw_queues() {
const char* env = std::getenv("STRATA_HIP_QUEUE_PRIME");
@@ -2253,6 +2253,16 @@ static void prime_hw_queues() {
(void) cudaGetLastError();
return;
}
// #3480: with the runtime capped to two hardware queues (GPU_MAX_HW_QUEUES=1 or 2, the user's own setting) the two
// primed queues are all of them: the high-priority draft stream and the side stream share them and a 4K prompt
// reads 39% slower (RX 9060 XT, 681-753 against 1188-1238 tok/s). Not primed then; a spec in
// STRATA_HIP_QUEUE_PRIME still is.
const char* cap = std::getenv("GPU_MAX_HW_QUEUES");
if (cap != nullptr && std::atoi(cap) >= 1 && std::atoi(cap) <= 2) {
std::fprintf(stderr, "strata generate: GPU queues not primed: GPU_MAX_HW_QUEUES=%s leaves none for the draft stream "
"(STRATA_HIP_QUEUE_PRIME=nn primes them anyway)\n", cap);
return;
}
spec = "nn";
#endif
}
@@ -9216,6 +9226,10 @@ int main(int argc, char** argv) {
bool live_ok = false;
// #879: a window met non-finite logits: the next request drops every cached state first and reads from token 0
bool nan_flush = false;
// #3465: the non-finite logits came in a window that reads the PROMPT's tail (the last few tokens, read through
// the verify windows after the batched part). The retry reads that tail batched (--short-read 0 for one request):
// a reporter's prompts failed there every time and passed with --short-read 0.
bool nf_prompt_windows = false, short_read_off_once = false;
std::vector<ConvCheckpoint> checks;
// STRATA_CKPT_POOL: the dropped checkpoints' storage, reused. STRATA_SLOT_CKPT_MOVE turns it on too: a moved
// checkpoint frees nothing at the next prune, so every save would fault in fresh pages (17 -> 40-60 ms)
@@ -9502,6 +9516,7 @@ int main(int argc, char** argv) {
std::fflush(stderr);
nf_hit = true;
nan_flush = true;
if (std::strcmp(what, "prompt") == 0) nf_prompt_windows = true;
return true;
};
auto imgs_below = [&](const std::vector<ImgKey>& all, int64_t L) {
@@ -12380,6 +12395,10 @@ int main(int argc, char** argv) {
// conversation and every idle batch slot go, and this prompt is read from token 0 (resume == 0 below)
if (nan_flush) {
nan_flush = false;
if (nf_prompt_windows) {
nf_prompt_windows = false;
short_read_off_once = o.short_read > 0;
}
const size_t n_checks = checks.size();
live_ok = false;
checks.clear();
@@ -12888,6 +12907,12 @@ int main(int argc, char** argv) {
// STRATA_CKPT_REREAD compares a restored checkpoint with a batched re-read, so it keeps every read batched.
static const bool no_short = std::getenv("STRATA_CKPT_REREAD") != nullptr;
int64_t req_short_read = o.short_read; // STRATA_PIPELINE_SWITCH may set it per request (short_read=)
if (short_read_off_once) { // #3465: the request after non-finite logits in a prompt window
short_read_off_once = false;
req_short_read = 0;
std::fprintf(stderr, "strata serve: after non-finite logits in a prompt window (#3465): this request reads its "
"whole prompt through the batched path, none of it through the verify windows\n");
}
auto windows_ok = [&](int64_t a, int64_t b) -> bool {
if (no_short || b - a > req_short_read) return false;
if (sp.embd_rows != nullptr)