[PR #1741] [CLOSED] verify: service returns before any CUDA call while nothing has rung (#1740) #3641

Closed
opened 2026-11-07 15:29:45 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/1741
Author: @architectds
Created: 10/9/2026
Status: ❌ Closed

Base: main ← Head: fix/pl-service-fastpath


📝 Commits (1)

  • 462a79d verify: service returns before any CUDA call while nothing has rung

📊 Changes

1 file changed (+9 additions, -0 deletions)

View changed files

📝 src/core/verify.cpp (+9 -0)

📄 Description

Title

Issue: #1740 (the stall this addresses; one stall in ~50 requests cannot prove it gone quickly)

Summary

The pipelined decode loop asks both stages' windows for service on every pass. While a window waits on its doorbell,
Verifier::service still switched the device - OnDevice: cudaGetDevice and two cudaSetDevice - before finding
nothing to do: a few driver calls a pass, about a billion passes in a long session. In #1740 the serving thread
blocked inside one of those cudaSetDevice calls while both stages' windows waited on it, and Strata was down until the
engine restarted.

Now service returns 0 before any CUDA call when nothing has rung and neither the WDDM flush (2 ms) nor the timeout
(20 s) is due - the answer the loop below gives in that case - so the waiting loop calls the driver only to serve a
layer, to flush, or to time out.

Measured on the PC of the issue (RTX 3060 + RTX 5070 Ti, layers 0-11 / 12-47, IQ3_S, --pipeline-windows 2,
STRATA_PREFILL_CPU_SHARE=auto): a coding agent's recorded conversation (a 100K-token start, then 8 turns of 1-6K tokens
of code, 128 tokens written a turn), A B A B in one window: 130.7 / 128.6 s before, 128.0 / 128.3 s with this; writing
69.2 / 70.5 against 70.8 / 69.7 tok/s. With STRATA_PREFILL_CPU_SHARE=auto the answers are not repeatable from run to
run (the share is balanced by measured times), before and after alike; all four runs' answers read normally.

What changed

  • src/core/verify.cpp, Verifier::service: the early return above, before the OnDevice guard.

Extra Notes

  • Nothing else changes: when something has rung, or a flush or the timeout is due, the code below runs as before.
  • Not proven: the stall came once in 51 requests here. If it comes back, the flush's cudaEventQuery /
    cudaStreamQuery every 2 ms is the driver call left in the waiting loop.
  • Tested: Windows 11, CUDA 13.0, sm_86 + sm_120. Not tested: Linux, HIP.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/1741 **Author:** [@architectds](https://github.com/architectds) **Created:** 10/9/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/pl-service-fastpath` --- ### 📝 Commits (1) - [`462a79d`](https://github.com/Niko1221/Strata/commit/462a79df354d9597be6de521043f2ec3e55f7f34) verify: service returns before any CUDA call while nothing has rung ### 📊 Changes **1 file changed** (+9 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/core/verify.cpp` (+9 -0) </details> ### 📄 Description ## Title Issue: #1740 (the stall this addresses; one stall in ~50 requests cannot prove it gone quickly) ## Summary The pipelined decode loop asks both stages' windows for service on every pass. While a window waits on its doorbell, `Verifier::service` still switched the device - `OnDevice`: `cudaGetDevice` and two `cudaSetDevice` - before finding nothing to do: a few driver calls a pass, about a billion passes in a long session. In #1740 the serving thread blocked inside one of those `cudaSetDevice` calls while both stages' windows waited on it, and Strata was down until the engine restarted. Now `service` returns 0 before any CUDA call when nothing has rung and neither the WDDM flush (2 ms) nor the timeout (20 s) is due - the answer the loop below gives in that case - so the waiting loop calls the driver only to serve a layer, to flush, or to time out. Measured on the PC of the issue (RTX 3060 + RTX 5070 Ti, layers 0-11 / 12-47, IQ3_S, `--pipeline-windows 2`, `STRATA_PREFILL_CPU_SHARE=auto`): a coding agent's recorded conversation (a 100K-token start, then 8 turns of 1-6K tokens of code, 128 tokens written a turn), A B A B in one window: 130.7 / 128.6 s before, 128.0 / 128.3 s with this; writing 69.2 / 70.5 against 70.8 / 69.7 tok/s. With `STRATA_PREFILL_CPU_SHARE=auto` the answers are not repeatable from run to run (the share is balanced by measured times), before and after alike; all four runs' answers read normally. ## What changed - `src/core/verify.cpp`, `Verifier::service`: the early return above, before the `OnDevice` guard. ## Extra Notes - Nothing else changes: when something has rung, or a flush or the timeout is due, the code below runs as before. - Not proven: the stall came once in 51 requests here. If it comes back, the flush's `cudaEventQuery` / `cudaStreamQuery` every 2 ms is the driver call left in the waiting loop. - Tested: Windows 11, CUDA 13.0, sm_86 + sm_120. Not tested: Linux, HIP. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:29:45 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#3641
No description provided.