Repository navigation
Conversation
Keep the requested union through pending and completed preparation. Leave dirty gaps for later readers and retain one inline range for the common case. Reproduces the copy amplification reported by pablogonz12 on Marvisak#185 (Marvisak#185 (comment)) and carries forward the range behavior from 20ff80e on the current unified journal.
Exercise independent shadow observers, concurrent alias writes over three submissions, a same-address decommit and recommit, and a pending GPU-written dword next to partial CPU refreshes.
catminou4
left a comment
There was a problem hiding this comment.
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.
Disjoint shadow refresh ranges preserved: 18K gpu diff on shadow/refresh range tracking. Windows-only.
Melow-code
left a comment
There was a problem hiding this comment.
Union logic is correct — half-open ranges, dedup_by in the right order, covers only called after merge. Two disjoint ranges in one page are safe because Tracked::take keeps a partly-copied page as changed.
Two points before merge:
- Each disjoint range is now a separate update() call with its own locks. A frame-time measurement from a world scene would show if this matters.
- PR #1555 also changes how refreshes combine (joining nearby ones). The two change the same code — only one approach should land.
|
@ruipedro-pinheiro Agreed on comparing the per-range cost in a matched world run. Each disjoint span does call I checked @Texbirds’ #1555 at @pablogonz12 If an authorized world run is available, could you compare AI-assisted using Codex. |
Retain original author history and tests. Copy only the requested union, leaving interior dirty pages for their own readers. Verified the original patch ID, a portable exhaustive small-range model, and Windows MSVC workspace test compilation. No local Windows GPU run.
|
Updated this branch to All four disjoint tests passed with a required device on the default AMD adapter and WARP. The matched warm-cache comparison of main, #1818, and #1555 remains the evidence needed for the per-range performance question. The original comparison heads are still valid to reproduce the originally queued test. |
Adapted from Aydan (aycow) in Marvisak/VIctory#1818. Thanks to pablogonz12 for the original reproduction in Marvisak/VIctory#185.
Keep the union of overlapping and adjacent refresh ranges per shadow. Cover range normalization with CPU unit tests and preserve the WARP readback regression. Adapted from Aydan (aycow) in Marvisak/VIctory#1818. Thanks to pablogonz12 for the original reproduction in Marvisak/VIctory#185.
|
Automated triage for the maintainers. Needs work (kept). The new head only merges current The open points from the last review are still open:
CI: passing ( Generated by Claude Code |
Part of #32 (VIwork port). Adapted from Aydan (aycow) in Marvisak/VIctory#1818. Thanks to pablogonz12 for the original reproduction in Marvisak/VIctory#185. (cherry picked from commit 0d22b3808d0e5413dd845c771de5d6977cfbdc20) (cherry picked from commit 3cd984de3a3d6fc31e983e8120f941f5d6ad3565)
Melow-code
left a comment
There was a problem hiding this comment.
I read the union logic against Shadow::update and Tracked::take on main (70564ae). I found no correctness bug.
RefreshRanges::addandmergetreat the ranges as half-open. They join ranges that touch and keep ranges with a gap apart.- The
dedup_byclosure gets the later element first, soprevious.1 = max(...)extends the kept range. coversneeds sorted, disjoint ranges. Every path that writescurrentcallsmergefirst, so this holds.- A
debug_assert!on that order incoverswould protect later callers. - Two disjoint ranges in one page are safe.
Tracked::takekeeps a page that it copies only in part as changed. So the second range still copies its bytes.
Two points to check before merge:
- Cost. Each disjoint range is now one
updatecall, and each call takes thependingandchangedlocks and the guards. One copy with many small disjoint requests now makes many calls in place of one. A frame-time number from a world scene would show if this matters. - Overlap with #1555. That PR also changes how the batch combines refreshes (it joins nearby ones). The two change the same code, so only one approach should land.
The CloseHandle in the twin_views test helper is correct. The views keep the section alive.
Melow-code
left a comment
There was a problem hiding this comment.
I read the union logic against Shadow::update and Tracked::take on main (70564ae). I found no correctness bug.
RefreshRanges::addandmergetreat the ranges as half-open. They join ranges that touch and keep ranges with a gap apart.- The
dedup_byclosure gets the later element first, soprevious.1 = max(...)extends the kept range. coversneeds sorted, disjoint ranges. Every path that writescurrentcallsmergefirst, so this holds.- A
debug_assert!on that order incoverswould protect later callers. - Two disjoint ranges in one page are safe.
Tracked::takekeeps a page that it copies only in part as changed. So the second range still copies its bytes.
Two points to check before merge:
- Cost. Each disjoint range is now one
updatecall, and each call takes thependingandchangedlocks and the guards. One copy with many small disjoint requests now makes many calls in place of one. A frame-time number from a world scene would show if this matters. - Overlap with #1555. That PR also changes how the batch combines refreshes (it joins nearby ones). The two change the same code, so only one approach should land.
The CloseHandle in the twin_views test helper is correct. The views keep the section alive.
Melow-code
left a comment
There was a problem hiding this comment.
I read the union logic against Shadow::update and Tracked::take on main (70564ae). I found no correctness bug.
RefreshRanges::addandmergetreat the ranges as half-open. They join ranges that touch and keep ranges with a gap apart.- The
dedup_byclosure gets the later element first, soprevious.1 = max(...)extends the kept range. coversneeds sorted, disjoint ranges. Every path that writescurrentcallsmergefirst, so this holds.- A
debug_assert!on that order incoverswould protect later callers. - Two disjoint ranges in one page are safe.
Tracked::takekeeps a page that it copies only in part as changed. So the second range still copies its bytes.
Two points to check before merge:
- Cost. Each disjoint range is now one
updatecall, and each call takes thependingandchangedlocks and the guards. One copy with many small disjoint requests now makes many calls in place of one. A frame-time number from a world scene would show if this matters. - Overlap with #1555. That PR also changes how the batch combines refreshes (it joins nearby ones). The two change the same code, so only one approach should land.
The CloseHandle in the twin_views test helper is correct. The views keep the section alive.
|
Merged onto current So
So a rebase with |
|
Thanks for the implementation and regression coverage. As the author of #1555, I think minimizing copied bytes and minimizing preparation time are two different objectives. The 64 KiB coalescing threshold in #1555 intentionally reduces The findings in #2134 and #2136 further support investigating this overhead independently of copy volume. Given the recently reported compilation issue against main ( I also see potential in combining #1818's exact range tracking with #1555's batching strategy through shared locking. Ultimately, correctness, preparation time and actual frame time should determine which approach lands. Neither approach has demonstrated superior real-world performance yet. |
|
@shortselow-byte Thanks for isolating the compile error and checking both values of the new parameter. The merge at @Texbirds The current control measures copy volume at the first read. If the gap is eventually read with no intervening changes, both approaches can ultimately move the same number of bytes and the lock and query costs can decide the result. The matched title comparison on the same current-main baseline is still pending. This update makes no title frame-time claim. |
Adapted from Aydan (aycow) in Marvisak/VIctory#1818. Thanks to pablogonz12 for the original reproduction in Marvisak/VIctory#185. (cherry picked from commit 0d22b3808d0e5413dd845c771de5d6977cfbdc20)
What changed
Keep the union of requested refresh ranges through the pending and completed parts of a submission batch. The previous bounding range copied 192 KiB for two 64 KiB requests and consumed the dirty page in the gap before its reader. The fixture now copies 128 KiB for the two requests and 64 KiB when the gap is requested later. The common one-range case retains inline storage.
Thanks to @pablogonz12 for the original reproduction in #185. This carries the narrow range correction onto the current unified journal. It preserves the ranges supplied to the batch. Callers that pass a bounding range still request all of it. #1472 changes when the batch flushes around a GPU write. This PR retains the requested ranges without altering those flush points. Original report · Related flush work
Verification
All four disjoint refresh regressions passed on AMD Radeon Graphics and WARP at
4a191d8with native device creation required. The cases cover the gap's later reader, repeated reads after a physical alias write, decommit and remap at the same address, and partial refreshes of declared UAV writes. The last case exercises #1322's preparation contract and confirms copyback preserves a later CPU write to a neighboring byte. Strict diagnostics Clippy passed. The updated fixture also verifies that zeroing an unmapped page leaves the copied-byte count at zero.The copied-byte results are from the synthetic fixture. Title preparation and frame-time effects remain unverified.
AI-assisted using Codex. Generated test data only.