GPU: refresh directly indexed SRVs that share a page as one range #462
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!462
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/462/head"
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?
@desplmfao on GitHub · 2026-11-24 03:43 UTC · original
desplmfao:fix/direct-srv-merge→main· +1569 −92 · 9 files · 3 commits · closed without mergingStacked on #185 (its two commits come first); review that first.
Problem
#185 refreshes the live directly indexed SRV ranges before each submission, merging only ranges that overlap. In the world most of them are small and close together but do not overlap, so each becomes its own
Shadow::update, with its own write-watch query: about 900,000 updates per world frame here, which took 7–8 s of each frame to prepare.Change
refresh_direct_srvsalso merges a range of the same buffer that starts in the page where the previous one ends (or at its end). The bytes between them are under a page;updatestill leaves out ranges shaders may be writing.Measured
RTX 5080, Linux (proton-cachyos, vkd3d-proton 3.2.0), Series X 1.0.2.1. Diagnostics build of
maind2a4bae+ #185 + #436 + #440 + #259, #177, #151 (needed to reach the world here), one run with and one without this change, Enter into story mode at about 35 s, first 1–2 min in the world:More bytes are copied: a merged range also covers the gaps between views, and a merged range whose write-watch query fails (it reaches uncommitted private memory) is copied whole. That case is a follow-up: the failing ranges start in reserved, uncommitted pages of otherwise watched buffers.
Related
refresh_direct_srvsresolved there.updatechecks.main.Tests
New
directly_indexed_srvs_in_one_page_refresh_as_one_rangein #185's coherency tests: 16 small SRVs in one page refresh as one range and each still reads its own value; it fails without the change (16 ranges). All 9 coherency tests pass on the GPU (vkd3d-proton,VICTORY_PC_DXCset).AI-assisted (Claude Code).
🤖 Generated with Claude Code
@desplmfao on GitHub · 2026-11-24 05:04 UTC · original
Thanks for measuring. One thing to separate: your comparison is #185 + this PR against neither, since this one is stacked on #185. The per-view watches you see come from #185's refresh of directly indexed SRVs, one write-watch question per range before every submission; this PR merges ranges that share a page, so it lowers that count rather than adding it.
With #185 in both builds (RTX 5080, proton-cachyos / vkd3d-proton 3.2.0, Series X, world frames), this PR took direct SRV ranges from 862,000–929,000 to 280,000–290,000 per frame and frames from 5.0–6.2 s to 2.4–4.2 s, as in the description.
What you measured is still real: under Wine each of those questions is expensive, so #185 makes loading and world frames much slower there. I'm working on that next: asking once per buffer and submission for the written pages over the span its ranges cover, instead of once per range. In a synthetic test (8 views into one watched buffer) that is 1 question per submission instead of 8, and #185's coherency tests still pass. It is being measured in the world now; I'll link it here with numbers once it holds up. Over several allocations it relies on #515 (asking per allocation when a span covers several).
AI-assisted (Claude Code).
@desplmfao on GitHub · 2026-11-24 05:21 UTC · original
Follow-up to the above: the per-range questions you measured are in draft #600 now. It asks once per span of title memory instead of once per range, across host copies (most ranges are in different small buffers, so per-buffer grouping alone did not help).
Same stack with and without it, write-watch questions per frame: menus about 3,500 → 223, loading 3,500–6,400 → 900–3,600, world 165,000–184,000 → 80,000–162,000. The world gains little so far because most of its ranges reach the title's GPU heap of physical-page views, which cannot be write-watched and still go one by one; that is the next step, described in the PR.
AI-assisted (Claude Code).
@desplmfao on GitHub · 2026-11-24 05:47 UTC · original
Closing in favour of #185 as it is now: its later commit
53e36e7builds the uncovered ranges per host copy and hands them over together, and skips ranges unchanged since the last submission, which covers what this PR did and more. Measured here (RTX 5080, Linux / proton-cachyos, world frames): old #185 + this and three other PRs 4.3 s per frame, new #185 alone 2.9 s.AI-assisted (Claude Code).
Pull request closed