Repository navigation
GPU: share one write-watch question across host copies in a reservation - #2
Conversation
watch::allocation reads the Private bit from the flags of QueryVirtualMemoryInformation's region information. Wine fills no flags for any region, so under Wine every reservation looked like a view: the grouping by reservation in Shadow::update_ready never took the private path, and each range was asked about on its own. When the flags are all zero, take the allocation type from VirtualQuery (MEM_PRIVATE) instead. On Windows the flags are set and nothing changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Directly indexed SRV ranges are mostly in different, small host copies placed side by side in one private reservation, and update_ready groups only within one copy, so each copy still asked about its own ranges. refresh_direct_srvs now collects every copy's ready ranges (Shadow::ready, pending GPU writes already excluded) and refresh_across sorts them by address: ranges of several copies inside one live private reservation, less than 1 MiB apart, share one grouped_writes question, taken from the oldest of their copies (Shadow::floor), and each copy brings its ranges up to date from it (Shadow::answered). Anything else goes through each copy's update_ready as before. The last reservation looked up is reused while the next range is inside it. VICTORY_NO_SHARED_SPANS=1 (diagnostics builds) turns it off for comparing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@desplmfao Thanks for porting Marvisak#600. I'm reviewing The reported 776 → 22 ms of write-watch time is useful, and the frame-time change is within your run spread. For the remaining cost, could we compare warm-cache windows on the same stack with only |
|
On it: building exactly AI-assisted (Claude Code). |
|
@desplmfao I merged your exact On AMD Windows, nine optimized batches per condition measured 3.061 → 1.344 ms of CPU preparation per 80 submissions for dense views. The 1 MiB-spaced layout went 3.205 → 4.119 ms even as calls fell from 5,120 to 80. Its profiled observation took 3.904 ms, including 3.702 ms in native watch calls. With 2 MiB spacing, the sorter and grouping did work before the same per-shadow fallback. All readbacks matched. These numbers characterize the synthetic layouts. Thanks for starting the matched Proton run. Your reservation-lookup timing will complement the opt-in stage split and fixture. I kept the profiling changes separate from Marvisak#185 and left the draft open for exact-head title validation. |
|
Matched Proton run, as asked: one diagnostics binary (
The ranges per frame differ by about 10 % between the two processes even in the same window, so the frame-time difference (about 4 %) is within that. Write-watch drops from 684 to 23 ms, but direct SRV preparation stays about 2 s either way. Most of that is reservation lookups ( AI-assisted (Claude Code). |
|
@desplmfao Thanks for the matched warm-cache run and for reporting the range-count difference. The 684 → 23.1 ms watch result is clear. Direct-SRV preparation still takes about two seconds, and overall frame time remains within the workload variation you observed. I added the matched data to Marvisak#185. Your reservation cache addresses the next measured stage. I’ll review the separate PR against the current Marvisak#185 tree when it’s available. The remap/recommit and late-write controls will be useful for checking that a cache hit retains the reservation and journal proofs. |
Stacked on #1 (the Wine fix,
9e94c21, comes first; without it no reservation is private under Wine and this never triggers). The change here is9131c10. Follow-up to the discussion on Marvisak#600, which this replaces.Change
Directly indexed SRV ranges are mostly in different, small host copies placed side by side in one private reservation, and
update_readygroups only within one copy.Shadow::update_rangesis split intoready(clip, pending GPU writes excluded) andupdate_ready; newfloor(watch_floor) andanswered(update_watchedafter a shared answer).refresh_direct_srvscollects every copy's ready ranges;refresh_acrosssorts them by address, and ranges of several copies inside one live private reservation, less than 1 MiB apart, share onegrouped_writesquestion with the oldest floor among them. Everything else goes through each copy'supdate_readyunchanged. The last reservation lookup is reused while ranges stay inside it.VICTORY_NO_SHARED_SPANS=1(diagnostics builds) turns it off;shadow trafficgainsshared_spans/shared_ranges.Measured
RTX 5080, Linux (proton-cachyos, vkd3d-proton 3.2.0), Series X 1.0.2.1, diagnostics build of
maind2a4bae+ this branch + Marvisak#493 (+Marvisak#336) + Marvisak#259, Marvisak#177, Marvisak#151, story mode byVICTORY_KEYS. Same world window, 26 lines, medians:1efd438)Questions are nearly gone; frame time does not follow.
Where the frame time goes
Same stack (the
+ #1 + thisrun after a warm-up run of its binary), 28 world lines from entry, medians of the existing statistics lines (no extra timers). TheVICTORY_NO_SHARED_SPANS=1column of the same binary follows in a comment.1efd438)Direct SRV preparation is still about 2 s of the frame, while range building, copying, snapshots and materialization are each under 75 ms. A separate diagnostic build with per-stage timers (not part of this PR) puts the rest in reservation lookups: 546,415
watch::allocationcalls, 2,608 ms per world frame (about 4.8 µs each under Wine, two system calls with #1). Most come fromrefresh_acrossandupdate_readyasking per range. A cache of looked-up reservations, cleared by range on mapping changes, cut that to 152 ms (99.9 % hits), but its one run ended in the title's watchdog crash without a GPU fault, so it is not in this PR until that is understood. Keeping this as a draft until then.Tests
New
directly_indexed_srvs_of_neighbouring_copies_share_a_question: 8 title buffers side by side in one write-watched reservation, each its own host copy and view; at most one question per submission, and each view reads the latest value. Passes; fails withVICTORY_NO_SHARED_SPANS=1("one question for all copies"). All 12 coherency tests pass on vkd3d-proton withVICTORY_PC_DXCset.AI-assisted (Claude Code).
🤖 Generated with Claude Code