GPU: preserve disjoint shadow refresh ranges #1818
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!1818
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1818"
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?
@aycow on GitHub · 2026-11-24 22:58 UTC · original
aycow:fix/disjoint-shadow-refresh-current→main· +320 −31 · 2 files · 6 commits · openWhat 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.
ccfb02996e' into maintenance/pr1818-ccfb029 9565b6b3fdf3578e386e' into maint/78ed-1818 68f6115ea5github-bot referenced this pull request2026-11-26 04:55:46 +00:00
@aycow on GitHub · 2026-11-24 23:22 UTC · original
@ruipedro-pinheiro Agreed on comparing the per-range cost in a matched world run. Each disjoint span does call
Shadow::updateseparately. The synthetic case confirms the copy-volume change from 192 KiB to 128 KiB and preserves the gap's dirty page for its later reader. It leaves world frame time unverified.I checked @Texbirds’ #1555 at
9fb81e1. It joins gaps of up to and including 64 KiB, so it would join the exact dirty 64 KiB gap in this fixture. #1818 merges touching ranges and leaves that gap for its reader. These are alternative policies in the same batch code. I agree that we should pick one after comparing both.@pablogonz12 If an authorized world run is available, could you compare
70564ae, #1818 at24a7d70, and #1555 at9fb81e1as separate warm-cache builds? Please hold the rest of the stack, adapter, scene, inputs and frame window fixed. Aggregate frame time, preparation and batch-flush time, bytes copied and watch queries from the diagnostics frame lines would show whether the saved copies outweigh the extra calls. Draw and submission counts help check that the windows match. Review · #1555AI-assisted using Codex.
@pablogonz12 on GitHub · 2026-11-24 23:31 UTC · original
Noted. A matched warm-cache world A/B of
70564ae, #1818 at24a7d70and #1555 at9fb81e1, as three separate builds, is on our list for the next free GPU slot; I will post the frame numbers here once it has run. Not tested yet, so no numbers today.@Melow-code on GitHub · 2026-11-25 01:03 UTC · original
Thanks — a matched warm-cache world A/B of main, #1818 and #1555 is exactly what the per-range question needs, and the synthetic case already shows the copy-volume change going the right way. I will read the frame numbers when they land. (Reply written with DeepSeek V4 Pro, OpenCode.)
@aycow on GitHub · 2026-11-25 01:26 UTC · original
Updated this branch to
ccfb029at254a67f. The disjoint-refresh implementation is unchanged by the follow-up. The regression now matches #1322: a declared UAV range refreshes CPU-written bytes before execution and updates its copyback snapshot. In the fixture, both requested spans refresh and the gap stays untouched. After the GPU changes one byte, copyback preserves a later CPU write to its neighbor.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.
@Marvisak on GitHub · 2026-11-25 06:30 UTC · original · edited 2026-11-26 01:24 UTC
Automated triage for the maintainers.
Needs work (kept). The new head only merges current
main(f3578e3) into the branch. The PR's own diff tocrates/victory-gpu/src/host.rs(Batch,RefreshRanges) andwatch.rsis identical to the one reviewed last time, and it merges cleanly.The open points from the last review are still open:
main'sBatchmodel ("what the title's threads write meanwhile is for later submissions"), the bounding range is not a correctness bug. The change is about copy volume, paid for with oneShadow::updateper disjoint span.main, this PR and #1555 on the same current baseline is still pending, and a maintainer needs those numbers to pick one.CI: passing (
check).Generated by Claude Code
@shortselow-byte on GitHub · 2026-11-25 13:35 UTC · original
Merged onto current
main(940d32f), this no longer compiles its tests, although GitHub shows it as mergeable. The branch is based onccfb029, one commit beforecd94d35("GPU: shaders mark the pages they write through views"), which gaveShadow::writinga third parameter:So
cargo test -p victory-gpu(and clippy--all-targets) would fail onmainafter the merge. Checked locally on Windows 11, Rust 1.98.1 MSVC, AMD Radeon RX 6900 XT, in an isolated target directory:copy.writing(busy, 4, false),disjoint_partial_refreshes_update_declared_write_snapshotspasses;true, it fails athost.rs:3250.So a rebase with
falsethere looks like all it needs. I only ran that one test with the fix, not the whole workspace.@Texbirds on GitHub · 2026-11-25 13:38 UTC · original
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
Shadow::update()calls, lock acquisitions and change-tracking overhead. In the three-page regression, assuming no intervening writes or invalidations, both approaches ultimately copy 192 KiB, but #1555 requires one update call instead of three.The findings in #2134 and #2136 further support investigating this overhead independently of copy volume.
Given the recently reported compilation issue against main (
940d32f) and the GPU write-tracking changes incd94d35, both PRs should be validated and benchmarked against the same updated baseline.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.
@aycow on GitHub · 2026-11-25 16:58 UTC · original
@shortselow-byte Thanks for isolating the compile error and checking both values of the new parameter. The merge at
4a191d8usesmarked=falsefor the declared-write fixture and preserves main's clean-shadow shortcut. All four disjoint tests passed on default hardware and WARP, including unmapped-page zeroing and preservation of the neighboring CPU byte.@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.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.