mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1102] [CLOSED] fix: batch host paths honor refreshed residency (deadlocks the engine during a prompt loan) #3026
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#3026
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/1102
Author: @win10ogod
Created: 10/6/2026
Status: ❌ Closed
Base:
main← Head:fix/batch-ar-on-residency📝 Commits (1)
91d5afbfix: honor refreshed residency in batch host paths📊 Changes
1 file changed (+3 additions, -3 deletions)
View changed files
📝
src/core/verify.cpp(+3 -3)📄 Description
stage_batch()refreshes residency before every window (refresh_ar(),src/core/verify.cpp:2252), which maintainsar_off_: a prompt loan, a VRAM shrink or an adaptive swap marks some experts-1for a while, andverify.hpp:326-329documents that every window then runs the doorbell graph. The graph choice therefore usesar_on()=all_resident_ && !ar_off_(verify.hpp:331).The two batch host methods added by
affb999(#646) test the initialisation latchall_resident_instead:run_slot_rows()—src/core/verify.cpp:2356batch_poll()—src/core/verify.cpp:2526and:2531This is not theoretical: it deadlocks the engine in normal use. While a long prompt is being read, the prompt path lends its expert-cache slots to prefill, so
ar_off_becomes true and the doorbell graph is selected — but the host still skips the per-layer service loop, becauseall_resident_never changes.run_slot_rows()then blocks incudaStreamSynchronize(cs_)(:2362), the graph rings its first doorbell and waits for the host's plan, and neither side can move.Deadlock mechanism
read_part()(src/program/generate.cpp:8855) callsbatch_step()between prompt chunks while prefill holds borrowed slots.stage_batch()→refresh_ar()setsar_off_ = true; the selected graph needs host service.run_slot_rows():2356testsall_resident_, which is stilltruefrom initialisation → skips the service loop →cudaStreamSynchronize(cs_)at:2362.wait_flag_ge(m_flagA_, ring, cs)atsrc/core/verify.cpp:1257, withring = 1and A still zero (B is a later dependency).Neither
batch_fatalnor the decode-share budget can intervene: both are only checked afterbatch_step()returns.Minidump evidence (three occurrences, RTX PRO 6000 Blackwell, sm_120, Windows 11)
The engine's own stall watchdog writes every thread's stack before it halts the process. CDB recovered 38 threads in each dump; the three hosts are parked in the same place:
all_resident_ar_off_strata+0x110465nvcuda64!cuStreamSynchronizestrata+0x110465nvcuda64!cuStreamSynchronizestrata+0x110465nvcuda64!cuStreamSynchronizeThe two residency bytes are
01 01in every dump. The 15 pool workers wait inSleepConditionVariableSRW, consistent with the host never issuing their work. Strata has no matching PDB, so its frames were mapped through the release image's disassembly: the image timestamp, size and CodeView GUID/age match all three dumps.The matching engine log line is:
The GPU finishing in 20/18/18 ms once the watchdog releases the flags corroborates the missing handshake.
A/B verification on the same machine
Trigger conditions were kept present in both arms — the all-resident (zero-doorbell) graph initialised, and prefill borrowing its slots — deliberately without
--no-prefill-borrow, which would have removed the trigger."parallel": 8, 262144 contextno progress for 60 s during a request (reading the prompt (batched), done up to token 8192))Post-fix acceptance on the same server with the patch only (no environment workaround):
2, 3, 5, 7, 11reproduced identically twice, 228 / 286 tok/s, speculative drafts 12/12 acceptedTwo earlier readings this analysis corrects
VirtualLockor a memory touch, and the fault count is unchanged between the report's two 2-second samples. The printed commit figure is processPagefileUsage, not bytes currently in the page file. Earlier memory-pressure costs remain possible and are not addressed here.Verifier::diag()(src/core/verify.cpp:317) derives that label from the progress-stage string;stage_batch()resets A/B/served/sequence and updates the batch rows but leaves the sololast_pos0_field alone. The zero A/B values belong to the unserviced batch handshake, not to a previous completed window blocking the next chunk.The change
Three conditions, one file:
all_resident_→ar_on()at the sites above. It uses the same effective residency predicate the graph selection already uses, and only restores ordinary host servicing while experts are absent. The zero-doorbell fast path is untouched for the fully resident case.Other indefinite waits checked
Prefill staging waits (
prefill.cpp:387,391,429,441), issuer waits (:2040,2070) and join (:3213), PLE future/collection waits (:1848,ple_reader.cpp:491), CUDA stream/event waits, refill synchronisation and the input/checkpoint mutexes were each compared against the captured host call; none matches. The serial prompt-window path already refreshes residency and usesar_on()(verify.cpp:1689,1723). One rawall_resident_branch remains inservice()at:2730, but it belongs to the two-GPU pipelined path with a different graph-selection scheme — these single-GPU dumps do not establish a defect there, and it is left untouched.Not covered
Single NVIDIA GPU on Windows only. No multi-GPU or layer-split verification. The minidumps contain CPU stacks, so the GPU-side wait is identified from source and the reported flag state rather than from a captured kernel stack. Exact GPU instruction state and the earlier paging delays were not captured. Multi-chunk prompts beyond ~16k tokens and cancellation during admission were not separately exercised.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.