fix(gpu): close upload-ahead races and defer new pool flips #454
No reviewers
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!454
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-454"
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?
@matheusfrta on GitHub · 2026-11-27 02:45 UTC · original
matheusfrta:patch-1795747540→a-publier· +187 −47 · 2 files · 1 commits · openFixes three stability issues in the upload-ahead path: reserves the in-flight entry before staging so direct lists cannot race the copy queue, avoids marking textures uploaded or firing callbacks when a copy fails, and passes pool::begun_before into ahead flips so VICTORY_SHOW_NEW_LATER is respected.
@MamaLeVrai on GitHub · 2026-11-27 03:55 UTC · original
Tested on an RX 6950 XT (RDNA 2), driver 32.0.21045.29003, Windows 11 build 26300, Rust 1.98.1, release. At
a18f4a9:cargo test --release -p victory-gpu --lib398 passed, 0 failed, 34 ignored.AI-assisted (Claude Code); no game data.
@adrianmjim on GitHub · 2026-11-27 06:49 UTC · original
Tested on an RX 7900 XT (RDNA 3), driver 32.0.32029.2010, Windows 11 build 26300, Rust 1.98.1, release. Head
a18f4a9against basea-publier4eb6cfd.cargo clippy --release -p victory-gpu --all-targets -- -D warnings: no warnings.victory-gpu --lib, base and head interleaved, 3 runs each: base 396 passed, head 398 passed, 0 failed, 34 ignored on both.VICTORY_UPLOAD_AHEAD=1 VICTORY_SHOW_AFTER=1, 2 runs each: one head run failedwatch::tests::a_write_opens_the_view_it_goes_through. With the same env it passed 3/3 alone on base and 3/3 alone on head. That test is one of the flaky watch tests listed in #446.listed_waits_while_claim_is_startingandfailed_copy_leaves_texture_unuploaded_and_skips_callbacks, alone with 1 thread: 10/10 each.a_placed_texture_is_filled_ahead_of_the_listsalone: 10/10 on head and 10/10 on base. The threetexture::aheadtests together: 10/10.claim()does first (CASNONE -> PENDING, with no entry inON_THEIR_WAYyet). It then checks thatlisted()does not return within 50 ms. It failed 5/5 on base, becauselisted()returns at once. The existing ahead test passed 5/5 on the same binary.From reading the code:
(serial, None)push now run under oneON_THEIR_WAYlock.Starting::dropand a failedfinish()storeLISTEDbefore they remove the entry. A goodfinish()storesDONE. I found no window wherelisted()returns early, and no lost wakeup.texture_slot_show_ahead()->show_later()has already put the neutral texture in the slot. WithState::Failed, the job's callbacks are dropped, and that callback was the slot's only flip. draw.rs still treats the upload as handled. It callstexture_slot_done, or a recheck that ends there while the fingerprint is the same. So the slot keeps the neutral texture until the title rewrites the record or its bytes change. Base flipped to an unfilled texture instead. Impact is low, becauseWorker::copyonly fails on queue or allocator errors.Worker::copy: ifSignalorSetEventOnCompletionfails afterExecuteCommandLists,finish(ok = false)setsLISTEDand removes the entry. The copy may still be running on the copy queue at that point. A direct list can then record an upload into the same texture with nothing ordering it after that copy.wait_known()waits onLANDEDwith no timeout while the entry isNone. A second texture-pass thread asking for the same texture blocks for as long as the first thread'sstaging()takes.listed()still stops waiting after 1 s, as on base, so the race comes back ifstaging()is that slow. The only change there is a warning in the log.Not tested:
VICTORY_SHOW_NEW_LATER=1(thebegun_beforechange), the title, and RDNA 4.@gut0to on GitHub · 2026-11-27 15:06 UTC · original · reviewed
AI-assisted static review; I inspected the new wait protocol and its race tests. I did not run the test suite.
@ -140,0 +198,4 @@{let mut way = ON_THEIR_WAY.lock().unwrap_or_else(|e| e.into_inner());if let Some(entry) = way.iter_mut().find(|(serial, _)| *serial == job.copy.serial) {entry.1 = Some(job.clone());@gut0to on GitHub · 2026-11-27 15:06 UTC · original
AI-assisted review: the new race test covers
Starting::drop, but not the successfulNone -> Some(job) -> completion removes the serialtransition. Could a deterministic test block alistedwaiter on(serial, None), publishSome(job), then callfinishand remove the entry? It should verify that publishing the job alone does not let the drawing list proceed before the copy completes.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.