perf(watch): overlap guard_ahead with card_steps and deduplicate copy-span scans #291
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!291
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-291"
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:25 UTC · original
leixner:perf/overlap-guard-and-dedup-spans→main· +101 −45 · 2 files · 67 commits · closed without mergingSummary
Reduces submitting-thread write-watch overhead when
VICTORY_ASK_FIRST=1by overlappingguard_aheadwithcard_steps, eliminating duplicate copy-span scans per submission, and avoiding unnecessary lock acquisitions inask_more.Changes
guard_aheadwithcard_steps(crates/victory-gpu/src/watch.rs,crates/victory-gpu/src/host.rs)watch::ask_firstto accept bothranges(asked_ahead) andguarded(guarded_copy) so thevictory-askworker runsask_oncefollowed byguard_aheadwhile the submitting thread runscard_steps.AskedFirst::wait()returns whether the background round succeeded (bool). When it succeeds and no flight wait or sweep invalidated it:owndid not add a list, skip bothask_moreandguard_aheadon the submitting thread.ownadded a list, runask_moreand only guardown.list().crates/victory-gpu/src/host.rs)Batch::extend_copy_spans(&mut self, list: &HostList)out ofBatch::copy_spans.VICTORY_ASK_FIRST=1, scanrunsonce beforeask_firstto populatebatch.spansand derive bothrangesandguarded, then only callbatch.extend_copy_spans(own.list())aftercard_stepsifownis present (avoiding 2 redundant full scans of all ~200 lists per submission).published()lock for covered ranges inask_more(crates/victory-gpu/src/watch.rs)heldranges and check coverage via binary search (interval_contains/partition_point) before calling lock-acquiringpublished().watch::ask_holds::interval_contains_matches_sorted_merged_ranges.Verification
cargo test -p victory-gpu --lib watch— 52 passed, 0 failed.cargo xtask policy— 293 files ok.VICTORY_WIDE_THREADS=8, 246 gameplay windows, 0 errors):main)asking the write watch)ask_morefollow-ups / frame@Aniseto on GitHub · 2026-12-01 10:32 UTC · original
Ran the
watchtest group at9848925on 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.All 52
watchtests pass here, the same count as the description, includingask_holds::interval_contains_matches_sorted_merged_ranges. The description of #277 notes that this group fails randomly on its host with and without that other change; it passed here in this single run, so no claim about repeatability is made.Not tested: the full workspace suite, a title run, 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 10:50 UTC · original
Not merged for now, for a merge reason, not a quality one: the batch under test already carries #109, which does the first part of this differently (the view memory is guarded beside the asking, on a helper thread, and the submitting thread still calls
guard_aheadand finds the ranges published). The two change the same lines ofwatch::ask_firstand of the submission inhost.rs, and joining them by hand would mean choosing between the two designs in code that decides whether a write is seen.What would be welcome once that batch is on main: this pull request rebased on it, keeping parts 2 and 3 (one scan of the copy spans, and the check of held ranges before
published()), and part 1 only where it still saves something over #109. The lint check of this branch on main passes.@leixner on GitHub · 2026-12-01 10:59 UTC · original
Sounds good — thanks for the clear breakdown! Once that batch with #109 lands on
main, I'll rebase this PR onto it keeping parts 2 and 3 (single copy-span scan + held-range check beforepublished()), and re-measure whether any of part 1 is still additive on top of #109.@FIJI1299 on GitHub · 2026-12-01 11:11 UTC · original
Community Validation — PR #291 (
9848925)Verified locally on Windows 11 with an RTX 5070 (
perf(watch): overlap guard_ahead with card_steps and deduplicate copy-span scans).Environment
9848925d792e1758337008342ce34a42bf0f1a7a(pr-291)621.40.0(stock, no OC/tweaks)10.0.26300) — HAGS enabledResults
cargo clippy --workspace --all-targets --locked -- -D warnings: Passed cleanly (0 warnings, 0 errors).cargo test --workspace --locked: Passed across the entire workspace (1,116 passed, 0 failed, 48 ignored), including all 475 tests invictory-gpu(host.rs/watch.rs).— Compiled with Gemini
@readmet3xt-lab on GitHub · 2026-12-01 12:16 UTC · original
An update: parts 2 and 3 are now on the batch for the release after next, ported over #109 as one commit with you as its author (one walk of the copy steps where the asking is begun first; the held ranges joined and searched before
published()'s locks). Lint in both feature sets and the whole test suite pass.Three things differ from this branch, each for safety, and you may want them in your own version:
guard_aheadstay each step's own range. Here they came frombatch.spans, which is a copy's whole span (the hull of all its refreshes), so more view memory than is refreshed would be made read-only.A test shows the split walk gives the same spans, in the same order, as one walk. Part 1 (the guarding skipped on the submitting thread when the round on the asking thread succeeded) is not in yet; it will go in behind a switch, on top of #109's form, and be measured.
Pull request closed