perf(texture): single-query zero-alloc write-watch/guard check in refresh_timed #296
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/readmet3xt-lab--foxhound!296
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-296"
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?
@leixner on GitHub · 2026-12-01 10:55 UTC · original
leixner:perf/texture-watch-single-query→main· +139 −18 · 2 files · 67 commits · closed without mergingSummary
Cuts texture refresh write-watch/guard overhead by ~78% (
3.70 -> 0.80 msmed,4.70 -> 1.30 msp90) by replacing the doublewatch::writes(..., false)+watch::writes(..., true)sequence intexture::refresh_timedwith a single zero-allocationwatch::writes_sincequery.Problem
On every refresh of a guarded view-memory texture,
texture::refresh_timedpreviously:watch::writes(start, start + size, false)first — acquiring the globalAsking::holdmutex across texture worker threads and issuing a doomedGetWriteWatch(kernel_written) syscall that always fails on view memory.watch::writes(start, start + size, true)— hittingpublished(start, end)and heap-allocating aVec<(usize, u64)>of written pages solely to checkwritten.iter().all(|&(_, w)| w <= last.asked).Changes
crates/victory-gpu/src/watch.rs:Journal::any_written_after(first, last, since)to check for writes newer thansincedirectly againstwritten_fast/writtenwithout allocating aVec.watch::writes_since(start, end, since, allow_guarded) -> Option<(u64, bool, bool)>returning(now, any_written, was_guarded): checksahead, thenallow_guarded && published(start, end)before acquiringAsking::holdor callingkernel_written, and handles both write-watched (was_guarded = false) and guarded view-memory (was_guarded = true) paths in one call.watch::ask_holds::journal_any_written_after_matches_written_in.crates/victory-gpu/src/texture.rs:Staging::refresh_timedto usewatch::writes_since(start, start + size, last.asked, allow_guard)in place of the two sequentialwatch::writescalls, preserving identical behavior for both write-watched and guarded textures (includingVICTORY_TEXTURE_GUARD=0).Verification
cargo test -p victory-gpu --lib watch— 52 passed, 0 failed.cargo test -p victory-gpu --lib texture— 32 passed, 0 failed.cargo xtask policy— 293 files ok.VICTORY_WIDE_THREADS=8, 199 gameplay windows, 0 errors):main)asking the write watch & guards)@Aniseto on GitHub · 2026-12-01 11:18 UTC · original
Ran the
watchandtexturetest groups at6de8a3caon an NVIDIA Blackwell desktop part with 16 GB of VRAM.Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.98.1 (48a229cea 2026-09-01), MSVC 14.44.35207, debug build, detached worktree at the exact PR head, own
CARGO_TARGET_DIR, no local patches.Both counts match the description, including
watch::ask_holds::journal_any_written_after_matches_written_in. The six ignored tests intexturecome from the wider filter. The description notes thatwatchfails randomly on its host with and without related changes; it passed here in one run, so no repeatability claim is made. No title run was done, so the cost of the write-watch query was not measured.Not tested: the full workspace suite, a retail title, a paired frame-time A/B, Wine, AMD adapters, release profile, game data.
AI-assisted (OpenCode), model: MiMo-V2.6-Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
@readmet3xt-lab on GitHub · 2026-12-01 12:16 UTC · original
Checked: nothing harmful in it, and it passes the lint check in both feature sets and the whole test suite (1,158 tests) on the batch branch. The release now in testing is frozen, so this is on the batch for the release after it, as one commit with you as its author. Nothing is needed from you now; the result of the run will be posted here.
Pull request closed