GPU: a refresh takes the whole pages it touches #3289
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!3289
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3289"
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?
@QalityDev on GitHub · 2026-11-26 16:02 UTC · original
QalityDev:pr/refresh-whole-pages→main· +138 −2 · 3 files · 2 commits · openA refresh of a range that cuts a 64 KiB page copied that part and left the page changed (
Tracked::take), so every later refresh reaching it copied it again, whether or not the title had written it since. GTA VI refreshes small ranges inside its 174 MB GPU-heap buffer dozens of times per frame: on an RTX 4060 Ti, 410-550 MB of the 550-690 MB copied per frame came from such partial pages.Shadow::updatenow widens the range to the whole pages it touches (cut to the copy). Taken whole, a page is guarded and copied again only once the title writes it. Ranges whose shaders' writes stay in the copy (keep_writes) are remembered and the widening stops short of them; ranges shaders are writing still go through the busy split. This generalises what #2172 does for marked UAV refreshes to every refresh.Measured in the intro cutscene (diagnostics build):
New test
a_partial_refresh_takes_the_whole_page; the copy-stats line reports bytes taken from whole and partial pages. On main63bcca4: victory-gpu lib tests 230 passed (dynamic_slots_are_held_until_releasedandlists_share_a_table_and_copies_keep_their_viewsfail on main as well on this RTX 4060 Ti); clippy clean with and withoutdiagnostics.@Dukestar69 on GitHub · 2026-11-26 16:08 UTC · original · approved these changes
Reviewed the diff and verified locally on Windows 11 x64 (RTX 5090):
Shadow::widento 64 KiB page boundaries (clamped to the buffer and stopping short ofShadow::keptranges, withbusyranges still subtracted afterward) cleanly lets touched pages be taken whole and guarded instead of repeatedly re-copying partial pages, withTakenWholeBytes/TakenPartBytesdiagnostics counters matching.cargo test -p victory-gpu --lib shadow:: -- --test-threads=1(RTX 5090): 11 passed, 0 failed (includinga_partial_refresh_takes_the_whole_page).cargo test -p victory-gpu --lib draw:: -- --test-threads=1(RTX 5090): 20 passed, 0 failed.cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo clippy -p victory-gpu --features diagnostics --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@oni-swr on GitHub · 2026-11-26 16:42 UTC · original
WARP verification report (test report only, no code changes)
d99e868f63bcca43(control); WARP software adapter forced withVICTORY_WARP=1 VICTORY_D3D12_WARP=1,--features diagnostics, d3d10warp.dll 10.0.26100.9818; dxil.dll 1.8.2502.11 (Windows Kit 10.0.26100.0, viaVICTORY_DXIL). No physical GPU. Synthetic tests only, no game data.cargo test -p victory-gpu --lib --features diagnostics --no-run -j 4, then the test binary with--exact <name> --test-threads 1per test, then the whole lib suite.shadow::tests::a_partial_refresh_takes_the_whole_page: passes on the PR (1 passed, 0.22 s).the written page, whole(left 16, right 65536): the refresh copies the 16 bytes asked for, not the page.victory-gpulib suite: PR 246 passed, 1 failed, 1 ignored; main plus the test 245 passed, 2 failed, 1 ignored (the new test and the failure below).frame::tests::waits_end_on_ticks_and_count_frames(left: 0, right: 1at frame.rs:231). It also fails alone in its own process on the PR and on main, so it is not caused by this PR.AI use: Claude Code (Claude Sonnet 5.5)
@Venom2054 on GitHub · 2026-11-26 17:17 UTC · original
I tested a port of
d99e868on an RTX 5070 Ti with a tuned Series S profile. Two fresh launches used the same executable, save and warmed pipeline library. Only whole-page refresh changed. The port avoids widening across ranges previously written by a GPU shader because this fork can retain those writes.At the stationary prison window, median copy volume fell from 75.0 to 55.4 MB per frame. The partial-page counter fell from 26.72 to 0.03 MB per frame. Write-watch time fell from 27.51 to 23.28 ms with 2,251 and 2,271 queries per frame, respectively. The runs issued 4,424 and 4,488 draws per frame.
Seven complete presentation batches per run covered 35.3 and 35.4 seconds. Presentation rate rose from 9.88 to 11.35 FPS (349 and 402 presents). Median frame time went from 101 to 85 ms and p90 from 142 to 120 ms. This is one pair of launches. A separate in-process toggle reproduced the reduction in copy volume. Disabling the change did not immediately restore the original volume because already refreshed pages stayed current.
Codex assisted with the port and measurements.
@andrewpozdnakov7-jpg on GitHub · 2026-11-26 17:21 UTC · original
I checked a scaling case for the kept-write lookup on
d99e868. Repeated overlapping declarations kept 131 entries for two disjoint regions, andwidenwalked the full set for each refresh. Follow-up6d3e953keeps the union of overlapping and adjacent ranges. Each lookup uses the nearest kept ranges to find the same boundaries.The new regression gets two records, preserves both clipping boundaries, and keeps a request that overlaps a GPU write narrow. The original WARP kept-texel and whole-page tests pass. Full diagnostics on verified app-local Agility 1.620.2/WARP 1.0.22 had 249 passed, 0 failed, 1 ignored, including runtime identity. Strict Clippy in both configurations and asset policy passed.
I also built an optimized isolated benchmark from the two exact
widenimplementations. It first checked 2,500 mixed overlap insertions/lookups and 16,384 matching lookup results per disjoint-set size, then alternated nine timed runs. Median lookup time stayed at 19 ns with zero kept regions, went from 215 to 101 ns with 64 disjoint regions, and from 12.8 to 0.163 microseconds with 4,096. These are CPU lookup timings on synthetic ranges; a title trace would show how often a real buffer reaches those counts.@QalityDev this is one commit directly on your head if the follow-up fits. Please retain its Git author on cherry-pick or rebase, or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if folding it into another commit. AI-assisted with Codex.@QalityDev on GitHub · 2026-11-26 18:14 UTC · original
Thanks @andrewpozdnakov7-jpg — reviewed and added as-is:
6d3e953is now on the branch with your authorship. Checked here on an RTX 4060 Ti:shadow::/watch::tests 27 passed (includingoverlapping_kept_writes_remember_their_union), strict Clippy clean with and withoutdiagnostics.@borosf on GitHub · 2026-11-26 19:03 UTC · original
Independent local verification on Windows 11 x64, Intel Arc B580 12 GB (12 cores), at this PR's head
6d3e953:Result: victory-gpu lib: 2 known baseline failures only; the new a_partial_refresh_takes_the_whole_page test passed.
Both clippy runs exit 0 (-D warnings, both feature sets). The B580 baseline failures pristine main also hits are: victory-gpu descriptor::host::tests::dynamic_slots_are_held_until_released + memory::tests::lists_share_a_table_and_copies_keep_their_views (#1744/#1829); victory-shader emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros + emit::valu_tests::fspx_programs_run_with_the_hardwares_dot_products. No PR regressions.
Synthetic tests only; no game data used. Full log kept locally. — borosf
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.