D3D12.X: a title buffer may run on into the next sparse window #3176
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3176"
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 ivall/xcl. Originally posted by Pipodi on 2026-11-28T16:08:21Z.
A buffer that a title places with CreatePlacedResourceX can run past the end of one sparse window and into the next. One did in a title run on a tree from before #2886, which keeps a reservation of one window or less inside a single window: 0x546000 bytes at 0x5fffd0000, going from sparse window 1 into window 2. This has not been reproduced on
54225f58, wheresparse_reservestill places across windows when no single window has room.title_buffer_windowreturned None as soon as a buffer passed the end of its window. Soplace_at_title_addressgave up, the buffer fell back to a committed DEFAULT buffer, and every view of it was an empty V#.The console gives CreatePlacedResourceX a plain GPU virtual address. XCL's 4 GiB windows have no console counterpart. A title reservation can already straddle sparse windows (
sparse_reservefalls back to placing across windows), andsparse::place_bufferchecks the windows of both ends and maps the tiles of each. So a buffer whose windows k..=last are all sparse is now accepted. A run into a window that is not sparse (a view, committed or empty window) is still refused.What is in it
crates/xcl/src/hle/d3d12x/real.rs:title_buffer_windowaccepts a buffer over a sparse window's end when every window it reaches is sparse.gpu_view_tests::a_buffer_may_run_on_into_the_next_sparse_window. Without the fix it fails (left None, right Some((1, true))). The existing assertion "across a sparse window's end" now expects Some((0, true)) instead of None.Tested
20fd55ccand on its base, nvidia-dev54225f58.cargo test -p xcl --lib --no-fail-fast -- --test-threads=2: the test binary aborted with exit code 0x7C10003 on both trees, after 1385 ok on this PR and 1384 on the base. This abort is already reported on nvidia-dev in https://github.com/xcl-dev/xcl/issues/3041#issuecomment-7237732888. The 393 tests that had not run were then run one at a time (--exact <name> --test-threads=1): 390 passed, 3 ignored, 0 failed, on both trees.title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels,stream_recheck_keeps_the_whole_upload_baseline_over_partial_uploads,stream_recheck_partial_upload_without_an_entry_queues_a_whole_upload,stream_recheck_schedule_catches_late_writes_and_resets_milestones.cargo test --workspacewith--test-threads=4; the other test binaries kept running after the lib aborted (exact cargo flags not recorded). All test binaries other than the lib: 132 passed, 0 failed, 20 ignored, on both trees.no wave64, plus three f16/f32 forms refused for #1426,no heap windowsand a driver-cache test that needs Developer Mode), and 1 outside it (heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows).Regression run
Both runs were made on the same retail title for 60 s with
XCL_PREPARE=0and the same scripted presses. The first block is from mainb937fbab(same title, 60 s,XCL_PREPARE=0, same presses, made the same day for #1448); the second is from nvidia-dev54225f58, the base of this PR, for a like-for-like comparison; the third is this PR's head.Not tested
AI use
Imported from ivall/xcl. Originally posted by andrewDoing on 2026-11-28T16:18:34Z.
On RTX 5070 12 GB / NVIDIA 616.92, I verified that a single placed buffer returns the expected bytes on both sides of the sparse window 1 → 2 boundary at head
20fd55ccf43a7b0a95d9f3a48d75cc06367eb678.The native fixture used XCL's actual 4 GiB sparse windows, with the boundary at
0x600000000. I committed the adjacent 64 KiB CPU tiles and filled them with different deterministic patterns. The fixture placed three resources through the productionplace_at_title_addresspath, supplied the two tiles' dirty pages tosparse::before_execute, and copied bytes from the resulting D3D12 resources into fenced readback buffers.The crossing placement began 128 bytes into the first tile and ended 128 bytes before the end of the second. XCL recorded a 128-byte native buffer offset, which the readback used. Two fresh processes produced identical counts, with zero skips and a healthy device in both. This exercises normal sparse placement and data upload for a known address. It did not exercise automatic reservation under fragmentation, shader V# sampling, or the retail sequence mentioned in the description.
AI use: OpenAI Codex (GPT-6) prepared the test-only fixture, ran the native checks and wrote this report.
Imported from ivall/xcl. Originally posted by throny on 2026-11-28T17:24:18Z.
merge-check claim
head:
20fd55ccf4Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-28T17:30:58Z.
merge-check
base:
54225f5884head:
20fd55ccf4merge: clean
build:
cargo build --offline --locked --workspace-> ok on the headtests:
cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --skip uma_driver::tests::a_refused_gpu_upload_segment_becomes_custom --skip uma_driver::tests::mixed_window_keeps_its_bytes_and_the_gpu_sees_every_segment --skip uma_driver::tests::failed_restore_stops_before_importing_an_unbacked_window --skip two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs-> head 1,906 passed, 1 failed, 48 ignored; base 1,905 passed, 1 failed, 48 ignored, across 40 binaries each. The sameconsole_mesh_caches_hlsl_compute_pass_in_memory_and_on_diskfailed withDXIL not compiled yeton both. Both printed 26SKIPPEDnotices (21 no wave64, 3 translation refusals, 2 no heap windows); these are not coverage. The extra head pass is this PR's new boundary test.review: no finding in the one-file diff or its placement path. The head's sole parent is the current
nvidia-devcommit.title_buffer_windowchecks the inclusive last byte and all crossed window kinds; the existingsparse::place_buffermaps tiles by their absolute addresses across windows. The new acceptance applies only when every crossed window is sparse. The independent native readback verifies the production placement's bytes on both sides of a boundary.performance: the additional window-kind walk runs only when a buffer crosses its starting window. No frame-time or title placement rate was measured here; the author's paired 60 s smoke blocks are in the PR description.
verdict: safe to merge
hardware / tool and model: RTX 3080 Ti / 621.35, Ryzen 7 9800X3D, Windows 11 build 26300, rustc 1.99.1 MSVC, debug. Codex (GPT-6.2 Sol) reviewed the change and ran the build and paired suites; Codex (GPT-6.2 Astra) independently traced the sparse placement path.
Tested: On the clean head,
cargo test --offline --locked -p xcl --lib gpu_view_tests -- --test-threads=1passed 4/4, including the new boundary selection test; these are helper tests, not native readbacks. My first whole-suite attempt stopped advancing intwo_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs; I interrupted that incomplete run and excluded that test in both completed runs. The threeuma_driverexclusions are documented branch-level fail-stop cases.Not tested: a title run at this head, automatic cross-window reservation under fragmentation, shader reads from the resulting view, AMD/Intel, and the four excluded tests.
Imported from ivall/xcl. Originally posted by throny on 2026-11-28T17:46:35Z.
merge-check
base:
54225f58(nvidia-dev)head:
20fd55ccf4merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 (no --skip) on nvidia-dev
54225f58+ #3187 + this PR -> 1905 passed, 6 failed, 48 ignored, 27 SKIPPED lines. #3187 is in the tree because without it the lib test binary is terminated on this card; the same tree without this PR gave 1904 passed and the same 6 failures (placed_title_textures_share_vram_and_preserve_pixels, three stream_recheck_* tests, two vram::tests). So: one more test passes, nothing new fails.review: no blocking finding; all hunks read. Before, a title buffer that ran past the end of its sparse window was refused and fell back to a committed buffer whose views were empty. Now it is accepted when the start window and every window up to the last one it touches are sparse; the end is computed with a checked add, a buffer over more than two windows works the same way, and a run into a view window, a committed window or no window is still refused. The placement code already checked the windows of both ends and maps tile by tile. Minor: the doc comment above the function still describes the old rule, and an older size sum a few lines on could still overflow for an absurd width (not new). Not verified: every other user of a placed buffer's range; the indirect-argument path refuses a range that crosses.
performance: none; no translator source.
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:41:07Z.
Triage (#1607) – head
20fd55cNo open or merged PR makes the same change (#2886, merged, keeps single-window
sparse_reserveallocations inside one window; this lets a placed buffer span adjacent sparse windows).title_buffer_windownow accepts a buffer over a sparse window's end when every window it reaches is sparse;sparse::place_bufferchecks both ends withwindow_indexand maps tiles per address, so a multi-window buffer is handled there. The existing assertion is flipped and a new test covers the next-window and non-sparse cases. No problems found in the diff.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T10:35:29Z.
merge-check
base:
493dbd3dd0head:
20fd55ccf4merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2901 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: read the whole diff (+20/-2).
title_buffer_windownow accepts a buffer that runs past a sparse window's end when every window it reaches is sparse. Findings: (1) Anything bound by GPU address still stops at the window end. Each window is its own buffer on the PC.pc_va_in(list_x.rs~5745) translates an address into window k's resource only, andview_bytes(~5755) says it outright: a view across a window's end runs into addresses nothing maps. Vertex and index buffers get clamped there, so the part in the next window reads as zeros. Root CBV / SRV / UAV and indirect arguments that cross go through the same translation (unverified each). Before this PR such a buffer fell back to a committed buffer, so this trades a slower whole buffer for one whose second part reads as zeros when bound by address. The flipped assertion hides that limit, and no test binds one by address. The MMU fault at 285 s the description mentions may be this (unverified). (2) The doc comment abovetitle_buffer_window(real.rs~1764-1767) still says buffers may not cross a window. (3) The PR is based onnvidia-dev54225f58, far behind main, but merges cleanly. Its red CI test,kernelx::tests::an_address_keeps_the_page_the_title_mapped_there_last, frees a reservation and expects mapping there to fail, which a parallel test can race; it isn't touched here. Fine: the windows are adjacent with no gaps and share one write-watched reservation,place_buffermakes one reserved resource per buffer and maps tiles by absolute address, and Map, copies and resource-based views are right. The new test fails without the change. Since #2886 a buffer crosses windows only when no single window has room, so the smoke run doesn't reach it; no smoke run here.performance: no smoke run (the default path doesn't reach this change); not measured.
verdict: not yet: a buffer that spans two sparse windows is still bound by GPU address into one window's resource (
pc_va_in/view_bytes), so its part in the next window reads as zeros where main fell back to a committed buffer (finding 1); handle address-based bindings across the boundary, or keep the fallback for buffers that are bound by addresshardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5
AI-written and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Pipodi on 2026-12-02T07:03:09Z.
Thank you, finding 1 is confirmed. On this head,
pc_va_in(list_x.rs:4210) translates an address into a single window's resource, andview_bytes(list_x.rs:4225) clamps a view at that window's end. So a buffer that spans two sparse windows and is bound by GPU address would read zeros past the first window. Main gives such a buffer a committed buffer, which is slower but correct. Since #2886 a buffer crosses windows only when no single window has room, so main's fallback is rarely taken. I am closing this PR rather than trading a correct path for a faster one that is wrong when the buffer is bound by address.AI use: Claude Code with Claude Opus 5.5 (checked the finding against the code, wrote this reply).
Pull request closed