Stall report: name the prompt chunk and layer; mark a finished verify window (#251)

The #251 report stalled in "reading the prompt, from token 0" and printed the
previous request's verify window as if it were the stuck one.

- Verifier::diag says "(last window, not the current stage)" when the stage
  is not a verify window.
- The batched prompt read sets its stage per chunk (preparing, finishing) and
  per layer, with the chunk's first position (Progress::chunk, a third
  progress_at argument; every other call leaves it -1), so the stall report and
  the watchdog line read e.g. "reading the prompt (batched): layer 17 of the
  prompt chunk from token 8192".

Text only: nothing computed changes.
This commit is contained in:
Niko1221 committed 2026-09-30 21:03:36 +02:00
1 parent 50b4fadb08
commit b9f426713a
4 files changed
+25 -9

No files matched your search

+13 -5
View File
@@ -722,11 +722,19 @@ MemSample mem_sample() {
return m;
}
// the stage the watchdog names: "<where> <detail>", and the prompt chunk a batched read is in (#251)
std::string stage_text() {
const strata::core::Progress& p = strata::core::progress();
std::string s = std::string(p.where.load()) + " " + std::to_string((long long) p.detail.load());
if (const int64_t c = p.chunk.load(); c >= 0) s += " of the prompt chunk from token " + std::to_string((long long) c);
return s;
}
void stall_report(std::FILE* f, uint64_t layers_during) {
strata::core::Progress& p = strata::core::progress();
std::fprintf(f, "strata serve: stall report (engine %s): stage \"%s %lld\" for %lld s; %llu layers served since the "
"last finished step (0 = stopped, more = slow)\n", STRATA_VERSION, p.where.load(),
(long long) p.detail.load(), (long long) ((strata::core::progress_now_ms() - p.since_ms.load()) / 1000),
std::fprintf(f, "strata serve: stall report (engine %s): stage \"%s\" for %lld s; %llu layers served since the "
"last finished step (0 = stopped, more = slow)\n", STRATA_VERSION, stage_text().c_str(),
(long long) ((strata::core::progress_now_ms() - p.since_ms.load()) / 1000),
(unsigned long long) layers_during);
for (int pass = 0; pass < 2; ++pass) {
if (pass == 1) {
@@ -4102,9 +4110,9 @@ int main(int argc, char** argv) {
const uint64_t b = p.beats.load();
if (!p.busy.load() || b != last) { last = b; ticks_at = p.ticks.load(); since = now; continue; }
if (now - since < std::chrono::seconds(limit)) continue;
std::fprintf(stderr, "strata serve: no progress for %d s during a request (%s %lld) - stopping "
std::fprintf(stderr, "strata serve: no progress for %d s during a request (%s) - stopping "
"the engine so the server starts it again (issue #29)\n",
limit, p.where.load(), (long long) p.detail.load());
limit, stage_text().c_str());
stall_report(stderr, p.ticks.load() - ticks_at);
strata::core::release_gpu_waits(stderr); // #267: no spin kernel outlives the process
std::fflush(stderr);