Repository navigation
Conversation
Co-authored-by: borosf <borosf@users.noreply.github.com>
DrDarkDK
left a comment
There was a problem hiding this comment.
I reproduced a missed refresh at 6ce364e on native Windows with an RTX 4070 Ti and WARP. In one Batch, I requested and flushed pages 0, 2, and 1 separately, in that order.
- Parent
940d32f: each flush copied 65,536 bytes. 6ce364e: the flushes copied 65,536, 65,536, and 0 bytes. A directShadow::updateof page 1 then copied all 65,536 bytes, confirming it was still dirty.
flush() uses the same one-page gap coalescing for current as for pending. After the first two flushes, current covers page 1 even though neither flush copied it. Could current merge only overlapping or touching ranges, while pending keeps the one-page coalescing?
Synthetic test only. No game data used.
AI-assisted with Codex.
Co-authored-by: borosf <borosf@users.noreply.github.com>
|
Confirmed and fixed in 2b30d3e — exactly as you diagnosed: Your pages-0-2-1 sequence is now the regression test CI is green on 2b30d3e, and verified after the fix on Arc B580: @DrDarkDK Can you recheck on your local machine? |
DrDarkDK
left a comment
There was a problem hiding this comment.
Rechecked 2b30d3e on native Windows with the RTX 4070 Ti (driver 621.01) and WARP. Flushing pages 0, 2, and 1 separately copied 65,536 bytes each time on both adapters. In my original review of 6ce364e, the third flush copied 0 bytes.
The batch tests returned 7 passed and 1 benchmark ignored on each adapter. I also reran the regression with a required D3D12 buffer and verified the expected bytes on page 1 after the third flush. This resolves my earlier changes request. The test used synthetic data and covered refresh correctness.
AI-assisted with Codex.
|
Reviewed — the disjoint/pending split is right and fixes the reported miss:
The two pure tests pin both invariants, and the pool tests exercise the reported ordering on a host. CI green. |
catminou4
left a comment
There was a problem hiding this comment.
Third duplicate of the disjoint-refresh rewrite: identical comment text as #2419, which itself duplicates #2349. Whichever merges first wins; suggest closing two of the three. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1.
|
Follow-up from #2473/#2474: this PR's |
|
A heads-up from #2473 / #2474. In |
|
Automated triage for the maintainers.
Notes for the maintainer:
Generated by Claude Code |
…n the next commit Co-authored-by: borosf <borosf@users.noreply.github.com>
Co-authored-by: borosf <borosf@users.noreply.github.com>
|
Rebased as a merge of current main plus a re-application, since main moved the whole Batch area (texture uploads left the batch, the shadow.clean() gate landed). The disjoint-range change now sits on main's current shape: their clean-shadow shortcut stays first, and everything behind it — pending ranges coalescing within a page, coverage merging only where flushes meet — is unchanged from the reviewed semantics, with all four tests back in place (the pages-0-2-1 ordering test included). CI green on the merge head. Re-verified after the re-application on the same Intel Arc B580 (the card that caught the coverage bug): the full victory-gpu suite passes — 197 passed, the only two failures being the known (#1744 / #1943) heap-cap tests that pristine main also fails on this card, and every one of the batch tests including the reviewer-reported ordering case green on hardware. @Marvisak Please check it out when you have the time :) |
Co-authored-by: borosf <borosf@users.noreply.github.com>
Co-authored-by: borosf <borosf@users.noreply.github.com>
Co-authored-by: borosf <borosf@users.noreply.github.com>
Co-authored-by: borosf <borosf@users.noreply.github.com>
|
Implemented at 3a2279f: current joins only where the ranges' intersection contains a whole page — max(a, from).div_ceil(PAGE) <= min(b, to) / PAGE, exactly as @kotekompotek wrote on #2474. My first take joined at any page-boundary touch but still merged overlaps whose intersection held no whole page, which could union two page-flanking flushes into a whole-page claim — this rules that out too. push_range(.., 0, ..) is gone from flush in favor of a separate push_copied. The pure test now pins all four cases — a page apart, meeting inside a page, overlapping without a whole page, and meeting across a boundary / overlapping by a whole page — and a_page_copied_in_two_halves_is_refreshed_whole runs the #2473 ordering on a host: the halves each copy their bytes, neither guards the page, and a later whole-page request in the same submission still refreshes. CI green on 3a2279f. Happy for #2474 to rebase onto this if it lands first — with both sides on the same rule the rebase should be a no-op for the join logic. |
A submission's refreshes were merged per host copy into the one range that covers them, so two distant refreshes of a big copy brought up everything between. Ranges now stay disjoint: what overlaps, or lies within a 64 KiB page of another range, joins it (one copy is cheaper than two across a page's gap). Distant ranges are brought up apart. handed_ready, which reasons about what a flush brings up, now looks at the same disjoint ranges instead of the span. The write-watch asking ahead (ask_once) and stale_under_flights keep the span, which still covers every range. Port of upstream Marvisak/VIctory#2428 (borosf; 8da658a, 3a2279f) onto the fork's Batch, which has no `current` skip list, so the copied-range join rules of #2473/#2474 are not needed here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017V7WBBU55HJVgqSgZRhMqc
…he ranges asked only, GPU upload heaps said in the log - VICTORY_REFRESH_RANGES=1: a submission's refreshes of a host copy are the ranges its lists asked for, joined only where within 64 KiB (past 256 ranges, their envelope), not one range from the lowest to the highest (upstream Marvisak#2349 dcb4ac3/7cfd3912, Marvisak#2428 3a2279f, read only). Run cpuframe (2026-11-26 00:19): 8.5 GB of refresh ranges asked of the write watch a frame (the 174 MB heap's envelope at every flush), 33 ms, for ~130 MB copied. Tests for the joining. - VICTORY_BACK_BLOCKS=1: what shaders wrote goes back into title memory by 1 KiB block, only the blocks the merge changed, not the span from the first changed byte to the last (upstream Marvisak#2242/Marvisak#2280 without their shader marks); never writes the title's newer bytes over with older ones there. - VICTORY_FAST_TITLE_WRITE=1: those writes by rep movsb (the caller opened our guards), through the kernel only if a fault fails it: hundreds of pieces a frame were each a kernel call. - A log line says whether the card offers GPU upload heaps (resizable BAR); an ignored test asks this PC's card: the RX 7600 does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…disjoint, not their span From Marvisak/VIctory#2428 (opened by borosf; original commits and authors kept). Not yet merged upstream. Measured here in the title: preparing 255 to 221 ms a frame, median frame 482 to 455 ms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Measured in the title: preparing 255 → 221 ms a frame (AMD RDNA4 under Wine) Setup: RX 9070 XT (RDNA4), RADV / Mesa 26.3, Wine 11.22 with vkd3d-proton 3.1-83 from GE-Proton11-14. Diag builds on
No fault, device loss or kernel message in either run. The heavy band is only a few lines per run, so read its drop loosely. The preparing and copies drops held across the run. Both runs had the same local changes: queues on a worker thread (local, opt-in), #3071, and a wineserver that keeps memory views in a tree. Merged for Wine: #2913, #2919, #2723, #2977, #2703, #1722, #2101, #2249; and #2644 and #454, their switches on. The "with" run also had #2705 merged, switched off. AI-assisted (Claude Code); numbers from my own runs. |
fuzeofficlal
left a comment
There was a problem hiding this comment.
Reviewed and verified at head 3a2279fd and merged onto origin/main (63bcca43) on Windows 11 (RTX 5090 + WARP, VICTORY_D3D12_DEBUG=1):
- Design & correctness:
Batch::add/flush/title_written(crates/victory-gpu/src/host.rs:2381-2434) cleanly separate pending coalescing (push_rangewithCOALESCE = PAGE,:2438-2461) from flushed coverage (push_copied,:2475-2489). Becausependingstays sorted with pairwise gaps> COALESCE, a single left-to-right sweep inpush_rangenever misses transitive merges.push_copied's join predicatelo.div_ceil(PAGE) <= hi / PAGEholds iff the intersection contains a page boundary, guaranteeing that every whole 64 KiB page inside a joinedcurrentrange was covered whole by a singleShadow::updateand therefore guarded—closing both the pages-0-2-1 gap bug and the#2473split-page hole.covered(:2464-2466) conservatively requires containment within one range,title_written()still flushes and clearscurrent, and coalescing up to one page acrosspendinginteracts safely withShadow::update/shadow.pending(strictly narrower thanmain's[min, max]span).- Minor non-blocking doc nit: the comment on
push_copied(host.rs:2474) says "intersection contains a whole page", whereas the condition tests for a page boundary (which is the exact necessary and sufficient condition).
- Verification:
- Clean
git merge-treeagainstorigin/main(63bcca43);cargo xtask policy(184 files ok);cargo clippy -p victory-gpu --all-targets -- -D warningsclean with default features and--all-features(both at3a2279fdand merged onto63bcca43). - At
3a2279fd: RTX 5090 (default)batch::6/6 passed; RTX 5090 +VICTORY_D3D12_DEBUG=1batch::+draw::tests17/17 passed; WARP (VICTORY_D3D12_WARP=1) +VICTORY_D3D12_DEBUG=1batch::+memory::tests+draw::tests22/22 passed. - Merged onto
origin/main(63bcca43) withVICTORY_D3D12_DEBUG=1: RTX 5090batch::+draw::tests26/26 passed; WARPbatch::+memory::tests14/14 passed.
- Clean
LGTM.
… ranges disjoint, not their span
… ranges disjoint, not their span
Summary
Batchmerged every refresh of a buffer copy across a submission into one[min, max]span, so lists asking for distant small parts of one copy (constant buffers through the bindless hulls, heap table ranges, recordedStep::Refreshes) copied everything between them out of title memory. The dossier counts this line as most ofpreparing(~860 ms of a ~1,900 ms Series S world frame; copies ~270 MB ≈ 440 ms).current) is a disjoint set too, so ranges already brought up to date are skipped more often than before.push_range), model-checked against a brute-force coalescer over thousands of random range sequences; unit tests cover the coalescing/bridging rules, and an integration test shows two distant refreshes of one watched copy stay apart.Numbers
Model (no game data; per-frame equivalents of the submission pattern the dossier describes):
Real-world confirmation needs the diagnostics frame log (
preparingMB/ms before/after) on hardware that runs the game.Verification
cargo test -p victory-gpu --libon Intel Arc B580: 143 passed, 2 failed with only the two known Intel heap-cap failures pristine main also has, 2 benchmarks ignored. Includes the newranges_of_a_copy_stay_disjoint,distant_refreshes_of_a_copy_are_copied_apart, and the existing refresh-semantics tests unchanged.claiming: PREPARING-DISJOINT-RANGES (the dirty-range half of H-2.1; per the ledger the adjacent lanes NEW-48 / NEW-53 / GPU-SNAPSHOT-COST are correctness or copy-back redesign, not this).