Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

verify batch: service the doorbell graph per-window (ar_on), not per-process (#1118)

wOvAN7ef55e19599f
diff --git a/src/core/verify.cpp b/src/core/verify.cpp
index 0acea637d..6cb77fb29 100644
--- a/src/core/verify.cpp
+++ b/src/core/verify.cpp
@@ -2358,7 +2358,10 @@ bool Verifier::run_slot_rows(const int* rows, int S, const int32_t* tokens, cons
// ("verify batch: layer K never rang (graph finished)" - K is that stage's first layer), and with it the graph
// sits on the PLE wait until the 20 s timeout. As run() does: raise the PLE flag the graph's first wait reads,
// let the graph run to the end, and skip the host's per-layer service (there is nothing to serve).
- if (all_resident_) {
+ // #646 + #871: the skip is per-window (ar_on), not per-process (all_resident_): a stage that was 100%
+ // resident at init takes the doorbell graph while a prompt loan/shrink/swap is in flight (ar_off_), and that
+ // graph waits on host doorbells the skipped service never raises (GPU at 100%, host in the sync below).
+ if (ar_on()) {
if (ss_->ple.ready() && ple_stage()) {
std::atomic_thread_fence(std::memory_order_seq_cst);
_mm_sfence();
@@ -2527,13 +2530,14 @@ int Verifier::batch_poll(PoolMultiFn pool, void* user, std::string& err) {
const int S = last_t_;
// #646: an all-resident stage's graph raises no host doorbells (see run_slot_rows): nothing to serve per layer,
// so the poll is just "has the graph finished" - except the PLE flag, which the graph's first wait reads and
- // only the host can raise (the same raise run_slot_rows makes).
- if (all_resident_ && ss_->ple.ready() && ple_stage()) {
+ // only the host can raise (the same raise run_slot_rows makes). Per-window (ar_on): with a loan in flight the
+ // doorbell graph needs the per-layer service below.
+ if (ar_on() && ss_->ple.ready() && ple_stage()) {
std::atomic_thread_fence(std::memory_order_seq_cst);
_mm_sfence();
*h_flag_ = 1;
}
- while (!all_resident_ && b_k_ < b_steps_) {
+ while (!ar_on() && b_k_ < b_steps_) {
const uint32_t want = (uint32_t) (b_k_ + 1);
if (*seq < want) {
const auto now = Clock::now();
@@ -2732,7 +2736,8 @@ int Verifier::service(PoolMultiFn pool, void* user, std::string& err) {
ms_host += ms_since(tp);
return true;
};
- if (all_resident_) { // the zero-doorbell graph never rings: it waits only for flag 1 (stage 0's PLE rows)
+ if (ar_on()) { // the zero-doorbell graph never rings: it waits only for flag 1 (stage 0's PLE rows).
+ // Per-window: with a loan in flight (ar_off_) the doorbell graph needs the per-layer service below.
if (!gather_ple()) return -1;
*(volatile uint32_t*) h_flag_ = 1;
fl_k_ = fl_total_;