Coalesce dirty page parts into copy ranges #2971
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2971"
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?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Brazzo978 on 2026-11-29T19:08:30Z.
What it changes
Build shadow copy ranges from consecutive dirty parts of each 64 KiB page. The previous shadow loop tested all 16 bits and merged adjacent 4 KiB pieces one at a time. This change reports contiguous runs directly, skips unset parts, and uses a fast path for isolated set bits. The other write-watch range builder uses the same iterator. Range clipping and the merge across page boundaries stay in their existing callers.
How it was tested
cargo test --locked --profile diag -p victory-gpu --lib parts_testspassed on Windows 10 22H2 with Rust 1.98.1 (MSVC target). The new test reconstructs every 16-bit mask from the emitted ranges and checks that they are ordered and maximal. The existing shadow test covers partial ranges and a run crossing a page boundary.by_partsimplementations, compiled with-C opt-level=3. Each sample split 256 pages 1,000 times. The two implementations ran in alternating order for ten samples per process, and five processes were measured. Each pattern was also checked for identical output.0x0040)0x1FFE)0x5555)The table shows the median of the five process medians. These figures describe the CPU-side splitter. Frame times in the title remain unmeasured for this patch.
Checked for overlap
by_parts. #2647 changes submission write-watch work. This patch changes how the splitter visits parts within a page.Codex helped implement and review the change.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by icdmkg2 on 2026-11-29T20:43:06Z.
On an RTX 5060 Laptop GPU (8 GB, driver 621.24), Ryzen 7 H 260, Windows 11, this PR loses the device shortly after the game reaches the world. It happened in every run I made with it, and in none without it.
Builds:
mainat55d06914with launcher defaults, plusVICTORY_LEVELS_ON_DEMAND=0andVICTORY_COMMIT_FLOOR_MB=1024(see #1411). Release build, Series S, DLSS performance, the prologue's cell, a script driving it.main+ #3109 + #3104 + #3103 + #2971main+ #2971 alonemain+ #3109 alone / #3104 alone / #3103 alonemain+ #2549 + #2783 + #2647 + #2665 + #2795 (another set I'm running)The log at the loss, the same in each run:
So it's
DXGI_ERROR_DEVICE_REMOVED(invalid command), not a hang or a timeout. A guess, not checked: coalescing dirty parts across a boundary a copy must not cross (a page-mapping or placed-resource edge) could produce a copy range the device rejects. I haven't runVICTORY_D3D12_DEBUG=1yet. I can if that would help pin the command.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by icdmkg2 on 2026-11-30T07:16:53Z.
Follow-up to my earlier report: the crash is still there on
mainat41adb551, which includes this PR as merged.Laptop, 8 GB NVIDIA, Series S profile, DLSS Performance. I ran 5 back-to-back runs (1 warm-up + 4 measured). Run 3 died after about 26 s in the world:
The other 4 runs were fine: median 17.1–18.9 fps. The same harness on
55d06914+ #2549/#2783/#2647/#2665/#2795, without this PR, has not hit 0x887A0006 in this scene. Earlier I bisected this crash to9780f5c4alone.I can run a diagnostics build with
VICTORY_D3D12_DEBUG=1and post the named command if that helps.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by icdmkg2 on 2026-11-30T07:42:47Z.
Correction to my two comments above: this PR is not the cause.
part_runsgives exactly the runs the old loops built, and both callers already merged touching ranges, so the output is the same. The same 0x887A0006 shows up in my logs from builds that never had this change, about 1 run in 15. My bisect caught a random crash. Sorry for the false alarm. I'm tracking the real crash in #3796.