Remove the deferred-work lock from host command lists #162
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!162
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-162"
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?
@Adika713 on GitHub · 2026-11-25 18:01 UTC · original
Adika713:perf/host-deferred-no-lock→main· +61 −16 · 1 files · 2 commits · openSTATUS: pending publication.
Remove the per-access deferred-work lock from host command lists.
Every
HostList::defer_*call and every submission-time read took the sameglobal-to-the-list mutex.
crate::listalready records one list on one threadand submits it only after recording ended; a reset moves recording to a new
list.
Deferrednow lives in anUnsafeCellunder that same invariant, anddeferred()returns&mut Deferreddirectly.What is in it
HostList::deferredisUnsafeCell<Deferred>;deferred()documents andperforms the single-thread access.
Send/Syncsafety comment now states that deferred work follows thelist-lifetime rule.
Tested
AMD Radeon RX 6950 XT (RDNA2), Ryzen 5 3600, 32 GB RAM, Windows 11,
rustc/cargo 1.98.1. No game data; the game was not run. Isolated
CARGO_TARGET_DIR.cargo test --release -p victory-gpu --lib deferred_access_without_lock -- --ignored --nocapture --test-threads=1,3 runs, median of 5 samples:
Correctness:
cargo check -p victory-gpu --lib --tests --locked: exit 0.cargo test -p victory-gpu --lib host:: -- --test-threads=1: 20 passed, 0 failed, 2 ignored, 94 filtered; 10 repeated runs, 0 failed.cargo test -p victory-gpu --lib draw:: -- --test-threads=1: 1 passed, 0 failed, 116 filtered.victory-gpulib, 20 serial runs with the pre-existing #102 flake skipped: 0 failed; each 110 passed, 0 failed, 5 ignored, 1 filtered.cargo test --workspace --no-fail-fast --locked: no new failures; known xmem, shader and policy failures remain.victory-gpu111 passed, 0 failed, 5 ignored.Not tested
about frame rate.
the existing
crate::listinvariant that this does not happen.Deferredand adrop(deferred)after a lockrelease; if both land, that hunk needs rebasing.
AI use
AI-assisted: OpenCode, model Big Pickle. No game data.
@KernelSmoker on GitHub · 2026-11-25 19:29 UTC · original
Independent verification on PR head
3f3764f(Bazzite Linux 45 x86_64, Intel Core i9-11900K, NVIDIA RTX 3090 driver 620.73.04, Rust 1.98.1,x86_64-pc-windows-gnuunder GE-Proton 10-34 / Wine 10.0 / vkd3d-proton 3.0.0):Release benchmark (
deferred_access_without_lock, 3 runs, median of 5 samples)Build & review notes
unused_mutwarnings incrates/victory-gpu/src/host.rs(lines 1628, 2268, 2292, 2316, 2328, 2448, 2576, 2632, 2645:let mut deferred = ...no longer needsmutsincedeferred()returns&mut Deferred), which will failcargo clippy -- -D warnings.fn deferred(&self) -> &mut Deferredis currently a safe function returning&mutfrom&selfviaUnsafeCell. Marking itunsafe fn(or exposing a closure helper with a debug re-entrancy guard and&Deferredfor read-only callers such asprewarm/run_deferred) prevents accidentally creating overlapping&mut Deferredborrows in future edits.reap_completed()runsfinish_submission()before advancingFINISHED_FENCE, soHostList::reset()waiting onlast_fenceremains synchronized underVICTORY_ASYNC_SUBMIT=1(now default onmain).In-game FPS was not measured here.
@MamaLeVrai on GitHub · 2026-11-26 05:11 UTC · original
Concurrency check on Windows/RDNA2 (RX 6950 XT, Windows 11 build 26300, Rust 1.98.1). I merged this PR (
3f3764f) ontomain4f62c2aplus #210, which fixeslist::tests::lists_are_cut_at_waits_that_follow_work, a test that fails in every release run onmain. Then I ran the releasevictory-gpulib test binary 10 times, with the default thread count:watch::tests::written_pages_are_reported_to_every_asker(#102), and 1 run died without a result line.No new failure, deadlock or hang showed up in these runs. Ten runs are a small sample for races. Not run in the game.
harness machine: rx6950xt-w11 | AMD Radeon RX 6950 XT (RDNA2), driver 32.0.21045.29003 | 32 GB RAM | Windows 11 build 26300
AI-assisted (Claude Code); no game data.
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.