Queue work may still be running when its submit returns: intermittent queue:: and query:: test failures #116
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Belobug--VIctory-Belobug-AMD#116
Loading…
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?
@ySKELLETONX on GitHub · 2026-11-25 14:33 UTC · original
Summary
Several
victory-gputests inqueue::testsandquery::testsfail intermittently. They all assume that a queue's work has run by the time the call that submitted it returns, which is whattimeline.rsdescribes ("Work runs on the thread that submits it, as long as nothing holds the queue back") and whatsignal2_xrelies on ("our submissions are complete when they return").That doesn't hold when another thread is running the same queue at that moment.
timeline::pump()steps every queue, not only the caller's, and it runs both on thevictory-queueswatcher thread and on every submitting thread. If another thread is inTimeline::stepfor a queue (busy), the submitter'sstepreturns at once, and the submit returns before its work has run.Data
RX 7600 XT, Windows 11 build 26300, Rust 1.98.1,
mainat01aadd1, thevictory_gputest binary run directly:cargo test -p victory-gpu --lib, 80 runspresent_runs_after_a_queues_waitx2 (queue.rs:833,completed(done)is 0,FRAMESalready moved),queries_not_run_keep_their_stand_in_valuesx1 (query.rs:597),occlusion_queries_around_draws_not_run_stay_visiblex1 (query.rs:533)victory_gpu-*.exe query:: queue::, 150 runspage_mappings_run_after_a_queues_wait38,present_runs_after_a_queues_wait34,queue_signals_complete_at_once9,work_after_a_wait_runs_once_the_other_queue_signals4,occlusion_queries_around_draws_not_run_stay_visible2,host_timestamps_are_on_the_title_clock1pump()disabled (temporary local change)query::alone, 150 runsIn the query failures the result buffer still holds the
0xeeee_eeee_eeee_eeeefill. Sorun(queue, list)returned before the list ran: the resolve hadn't been written yet. It hadn't been skipped.With the watcher off, the queue tests still fail because the tests' own threads pump each other's queues. Test A's
pump()takes test B's queue (busy). B'ssignal/presentreturns, and B checkscompleted/FRAMESbefore A has finished running B's work.Does it matter outside the tests?
Possibly. In a title run, the watcher pumps while any queue is held, and the title's submitting thread pumps too. A
SignalorExecuteCommandListscan then return before it has run, even though the queue was not held. Real D3D12 allows that, and titles wait on fences or events. But the code here documents and relies on the opposite. A frame-pacing or present path that reads a fence right after signalling it would see the old value now and then. I couldn't check this in the title.Possible fixes
pump(), a submitter that is not itself running queue work (thread-local flag, so work that submits doesn't wait on itself) waits until no queue isbusyon another thread, stepping queues itself in the meantime. The watcher already does this work, so the submitter only waits for what it would otherwise have run itself.Option 1 keeps the documented behaviour and fixes the race at its source, but it touches the core scheduling path. Option 2 is safe, but it accepts that a submit may return early. I can send a PR for either.
github-bot referenced this issue2026-11-26 03:36:22 +00:00