Repository navigation
Conversation
refresh_direct_srvs merged only overlapping ranges. In the world most directly indexed SRVs are small and close together without overlapping, so each became its own Shadow::update with its own write-watch query: about 900,000 per world frame. Also merge 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, and update still leaves out ranges shaders may be writing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tle memory refresh_direct_srvs brought each merged range up to date with its own question for written pages, and the ranges are mostly in different, small host copies: one title buffer each, close together in title memory. That made hundreds of thousands of system calls per world frame, and under Wine each is a round trip. Sort the merged ranges of every host copy by address, group those less than 1 MiB apart into spans, and ask once per span (watch::writes_split, allocation by allocation where the kernel refuses the whole span). Each range is then brought up to date from that answer (Shadow::update_answered); the written pages also go to the shared journal. Spans are asked without guarding view memory, since a span covers memory between ranges that nobody copies now; a range in memory the kernel cannot answer for goes through Shadow::update as before. VICTORY_NO_SPAN_QUESTIONS=1 (diagnostics builds) goes back to one question per range, for comparing the two. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolves the overlap in refresh_direct_srvs: Marvisak#462's page-sharing merge condition in this branch's loop, and both PRs' tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@desplmfao Thanks for porting the cross-shadow batching and splitting out the Wine fix. Your matched report shows 110,864 → 4,112 write-watch questions and 662 → 22 ms per world frame from batching on top of the Wine fix. The 2.87 → 2.73 s frame interval is within the reported run spread. If you push the port, please point me to its exact head. I can review the shared reservation proof, clipped ranges, per-shadow journal observations, remaps and pending GPU writes, and test it independently on Windows. For the remaining frame cost, could we hold the scene, stack and presentation window fixed and add aggregate timings for direct-SRV range construction, actual fill and fallback bytes, total submit preparation, queue wait/GPU intervals and post-fence copyback? Separate runs for timing and for attribution would make the comparison easier to interpret. |
|
Thanks. The port is up as a PR against your branch: aycow#2 (head
On the remaining frame cost: agreed, and the first timing run already narrows it. With the port, per world frame the copies themselves ( AI-assisted (Claude Code). |
Status (2026-11-24): measured on the reworked #185; not pushed yet. This branch is built on #185's first two commits and #462 (closed). Ported locally onto #185 as it is now (head
1efd438), the same idea (ranges of several host copies in one private reservation share one write-watch question) needs a Wine fix inwatch::allocationfirst (aycow#1); with both, same machine and world window (26 lines, medians):So the questions are nearly gone but frame time does not follow; what remains of a world frame is elsewhere. I'll either replace this branch with the port (about 120 lines on top of #185) or close it, depending on whether that remaining time turns out to need it. The description below is for the old base.
Problem
#185's
refresh_direct_srvsbrings each merged range up to date with its own question for written pages. The ranges are mostly in different, small host copies (one title buffer each) that lie close together in title memory, so merging per host copy does not reduce them: in the world here about 170,000 questions per frame, 1.5–2.7 s of it, and under Wine each question is a round trip. That is also what the measurement on #462 shows during loading (about 6,100 questions per frame).Change
refresh_direct_srvscollects the merged ranges of every host copy andrefresh_by_addresssorts them by address, groups those less than 1 MiB apart into spans, and asks once per span.watch::writes_splitanswers a span: once if the kernel takes it, else allocation by allocation, with the parts it cannot answer for listed separately. The written pages go to the shared journal as before.Shadow::update_answeredbrings a range up to date from that answer (pending GPU writes left out, as inupdate).Shadow::updateas before.VICTORY_NO_SPAN_QUESTIONS=1(diagnostics builds) goes back to one question per range, for comparing the two; the per-frameshadow trafficline gainsspan_questionsandspan_partial.Measured
RTX 5080, Linux (proton-cachyos, vkd3d-proton 3.2.0), Series X 1.0.2.1, diagnostics build of
maind2a4bae+ #185 + #436, #462, #440, #515, #514, #493 (+#336), #431, #259, #177, #151, story mode byVICTORY_KEYS. Before: the same stack without this change.In the world, 90 % of spans (about 21,000 of 23,000 per frame) reach view memory (the title's big GPU heap of physical-page views, which cannot be write-watched), so most ranges there still ask one by one. Guarding view memory per span, but only the blocks the ranges cover, is the next step. Bytes copied whole (not watched) were 0.85–1.0 GB per world frame in this run against 1–81 MB in the run before; not explained yet.
Tests
New
directly_indexed_srvs_of_neighbouring_buffers_ask_once_per_submission: 8 title buffers side by side in one write-watched allocation, each with its own host copy and a view; one question per submission with this change, 8 without it (fails on #185 alone), and each view reads the title's latest value. #185's other coherency tests pass on the GPU (vkd3d-proton,VICTORY_PC_DXCset).cargo clippyreports nothing new.Related
watch::writes;writes_splitdoes the same for spans.Batchrefreshes (asking about the untouched middle of a big range).AI-assisted (Claude Code).
🤖 Generated with Claude Code