Skip the empty host-written texture lock on reads #24
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/24"
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?
Imported from DexNom/VIctory. Originally posted by Adika713 on 2026-11-25T19:08:40Z.
Skip the global texture lock when no host-written textures exist.
Every texture use checked
HOST_WRITTEN, a mutex-protected set. In the commoncase that set is empty, so the check took a global lock just to find nothing.
An
AtomicBoolnow records whether the set holds anything; readers returnimmediately while it is false and take the lock only when it is true. Writers
set and clear the flag while holding the same lock.
What is in it
HOST_WRITTEN_ANYatomic flag, kept in sync withHOST_WRITTENunder itsmutex.
is_host_written()used byhost_wrote()andupload_from().ignored CPU-only A/B benchmark.
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. BCPack format tables were installed locally withInitialize-FormatTables.ps1and were not committed.cargo test --release -p victory-gpu --lib host_written_check_fast_path -- --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_written_tests -- --test-threads=1:1 passed, 0 failed, 1 ignored, 191 filtered.
victory-gpulib, 20 serial runs: 0 failed; each 189 passed,0 failed, 4 ignored, 0 filtered.
cargo test --workspace --no-fail-fast --locked: 0 failed suites.Not tested
about frame rate.
is written only while the
HOST_WRITTENmutex is held.AI use
AI-assisted: OpenCode, model Big Pickle. No game data.
Imported from DexNom/VIctory. Originally posted by andrewDoing on 2026-11-26T23:21:58Z.
Independent native Windows / RTX 5070 check at
3bbb525: used two real committed textures with GPU resources for 10,000 barrier-synchronized rounds. One thread marked the new texture viahost_written()while another removed the previous sole member viaforget(); a third checked both memberships after each pair. All 20,000 checks passed, and both textures were absent after their final releases. This exercises the concurrent handoff identified as untested in the PR, but is not proof of all interleavings or a gameplay timing measurement.Verification was AI-assisted with GPT-6.2 Astra.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.