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: service returns before any CUDA call while nothing has rung

architectds6b392641af56
diff --git a/src/core/verify.cpp b/src/core/verify.cpp
index ce9316258..3e9ec069a 100644
--- a/src/core/verify.cpp
+++ b/src/core/verify.cpp
@@ -3056,6 +3056,15 @@ bool Verifier::pl_launch(int T, const int32_t* tokens, int64_t pos0, std::string
int Verifier::service(PoolMultiFn pool, void* user, std::string& err) {
if (!fl_active_) return 1;
if (fl_k_ >= fl_total_) return 1;
+ // Nothing rang yet and neither the WDDM flush nor the timeout below is due: return before any CUDA call. The
+ // pipelined loop asks both stages' windows this millions of times a second while they wait on their doorbells,
+ // and the device switch (OnDevice: cudaGetDevice and two cudaSetDevice) made that a few driver calls each time:
+ // 919 million passes before the host stalled inside one of those cudaSetDevice calls with both stages waiting
+ // on it (0.1.41, Windows, an RTX 3060 + RTX 5070 Ti split). The same answer as the loop below gives.
+ if (!ar_on() && *(volatile uint32_t*) h_seq_ < (uint32_t) (fl_k_ + 1)) {
+ const double now = now_ms();
+ if (now - fl_flush_ms_ <= 2.0 && now - fl_since_ms_ <= 20000.0) return 0;
+ }
const OnDevice on_device(device_);
const ModelGeometry& g = *g_;
SessionState& ss = *ss_;