Repository navigation
Conversation
|
Source review of current head
The #3521 review covers different destination-copy and postbuild-output paths. These findings are from source and the documented API contract; I did not run a build, GPU test, or title on #3522. AI use: Codex (GPT-6.2 Sol) checked the exact submit paths and contract; Codex (GPT-6.2 Astra) independently traced the mapping and allocation lifetimes. |
|
merge-check AI-written and posted by Foniass without a human check of each point. |
With XCL_SPARSE_LAZY=1 a tile the title commits has no video memory until the CPU's first bytes go up to it, or a placed buffer or a copy names it. XboxBvhBuilder.dll writes its acceleration structures with compute programs through the sparse windows, which none of those see: in a retail title the destination tiles of its builds and of every compaction copy had none, so the structures read as zeros and rays hit nothing. With the switch, the builder's batched and single build exports and its copy export are hooked when the title resolves them. Each build asks the builder's own GetRaytracingAccelerationStructurePrebuildInfo for the most it writes (XCL's prebuild_size underestimates some top levels) and gives that range to sparse::will_write, which maps it before the list runs; a clone or compacted copy writes as much as its source's build or the copy that made it, and a destination whose new size is unknown forgets its old one. A build's postbuild infos get the bytes of their type at their own DestBuffer, which can be on a tile of its own. The prebuild query is made before the size map's lock is taken. Without XCL_SPARSE_LAZY=1 nothing is hooked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The title maps physical pages over the scratch of XboxBvhBuilder's builds whose bytes XCL keeps at another address, so the scratch address stays reserved: no commit lists its tiles and no CPU view links them. With XCL_SPARSE_LAZY=1 the builder's scratch writes went nowhere in 256 of 256 builds checked in a retail title, and its passes read zeros back. sparse::will_write_unbacked asks, like will_write, for the next submit: the range's window tiles with no entry and no CPU view under them get video memory of their own, the pages the CPU has not committed holes (nothing goes up or comes back there). The builder hook asks it for the scratch range the builder's own prebuild query gives, and for its destinations and copies too (tiles already listed are left to will_write). A tile that already shows a CPU view not linked yet is not given a tile of its own: it is asked for as a mirror in the same submit, so the CPU's bytes there stay visible; a tile of its own that comes to show a CPU view later (a page mapped there) gives its tile up and is linked over it. When tiles of its own find no video memory the asks are kept and the submit returns RetryRequired, so a build never runs over scratch with nothing behind it. A PERFORM_UPDATE build's scratch is the UpdateScratchDataSizeInBytes of the ALLOW_UPDATE build (or copy) it updates, kept from that build's query; not known, the larger of the two scratch sizes the update's own query gives. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Stacked on #3521; only b46e9e3 belongs here. The 117 shared added lines are #3521's commit, so this is not a duplicate. No other open PR gives unbacked scratch tiles video memory. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
b46e9e3 to
5abd576
Compare
|
Re-review (head 5abd576; diff from b46e9e3, which I merge-checked, read). Not a merge-check:
AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
|
Thanks both. Updated to
Each new test fails with its fix reverted (the CPU-view one with both checks removed). Left as follow-ups, listed in the description: giving tiles of their own back when the address is released (Foniass 2; needs a release signal), and mirror tiles being bound by the per-submit fill budget. Tests and a new AI use: Claude Code (Claude Opus 5.5) made the changes, ran the tests and the regression run, and wrote this reply. |
|
merge-check |
Stacked on #3521; only the top commit (
5abd576b) belongs here.The second half of what XboxBvhBuilder.dll needs under
XCL_SPARSE_LAZY=1. The title maps physical pages over the scratch of its builds whose bytes XCL keeps at another address, so the scratch address stays reserved: no commit lists its tiles and no CPU view links them, and neitherwill_write(#3521) nor the mirror path gives them video memory. In a retail title, 256 of 256 builds checked had no video memory under their scratch when their submission ran, so the builder's passes read zeros back from it. Part of #505.What is in it (one commit,
5abd576b; updated after review and rebased on #3521's new head)crates/xcl/src/hle/d3d12x/sparse.rs:will_write_unbacked, asked likewill_writeand taken by the next submit. The range's window tiles with no entry and no CPU view under them get video memory of their own (State::give_own_tiles, throughensure_mapped, cleared if reused). The pages the CPU has not committed are holes, so nothing goes up or comes back there. Tiles already listed are left towill_write.take_asksinmap_mirrors), so what the CPU wrote there stays visible.remap_mirrors, or an ask:take_asks) gives its tile up (yield_own, parked and taken back bynew_mirror) and is linked over it.RetryRequired(give_own_asks), so a build never runs over scratch with nothing behind it. After the bounded retries oftitle_textures::refresh_forthe title is stopped with that error, as for any other failed preparation.crates/xcl/src/hle/d3d12x/bvh_builder.rs: a build also gives its scratch, for the size the builder's own prebuild query gives. APERFORM_UPDATEbuild gives theUpdateScratchDataSizeInBytesof theALLOW_UPDATEbuild it updates (kept from that build's query, carried through clones and compactions, and found for in-place updates); not known, the larger of the two scratch sizes the update's own query gives. Every range the hook gives goes through both asks.an_unbacked_gpu_write_gets_tiles_of_its_own;own_tiles_that_find_no_memory_hold_the_submit_back(NO_TILES: refused, asked again, refused again, then given and the submit goes on);a_scratch_write_never_hides_a_cpu_view_not_linked_yet(the first mirror ask and a partial scratch write in one submit; the CPU's bytes on the GPU after that submit and after a later remap);an_own_tile_gives_way_to_a_page_mapped_there_later;an_update_writes_the_update_scratch_of_the_structure_it_updates(both size orderings across a 64 KiB tile boundary, in place, of a copy, unknown).Tested
XCL_DIRECT_DXIL,XCL_HEAP_WINDOWS,XCL_HEAP_FLATandXCL_SPARSE_LAZYunset for the tests.cargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4on5abd576b: the 41 integration harnesses and binaries 148 passed, 0 failed, 20 ignored. The library harness ends early (0x80004005) on this PR and onmain9dfbe3eaalike: a test's title reachesend_title("sparse upload preparation still failed after bounded retries"). With--test-threads=1it ends duringbind::tests::gpu_two_pass_indirect_commands_keep_their_own_records, after the tests before it (that test passes inhle::d3d12x::bindalone). TheRetryRequiredthis PR adds is taken only whenXCL_SPARSE_LAZY=1asks for tiles, which no test outside the new ones does.cargo test -p xcl --lib <filters> -- --test-threads=4:hle::d3d12x::sparse hle::d3d12x::bvh_builder: 150 passed, 0 failed, 1 ignored, none skipped (145 on D3D12.X: XboxBvhBuilder builds give their destinations video memory #3521).hle::d3d12x::bind: 116 passed, 0 failed, 0 ignored.hle::d3d12x::list_x: 113 passed, 0 failed, 0 ignored (the same onmain9dfbe3ea).--skip hle::d3d12x::bind --skip hle::d3d12x::list_x) ends at the sameend_titleon this PR and onmain, so it has no count;gpu_direct_image_get_resinfo_d16fails in it on both.NO_TILEStest with the asks dropped, the give-way test withremap_mirrorsskipping every tile of the window's own, and the CPU-view test with both the check ingive_own_tilesand the one intake_asksremoved (with only the first removed it still passed, becausetake_askslinks the tile in the same submit; the test now also checks before the submit that no tile of its own was made, which was not run against that removal).SKIPPEDon this adapter before the library harness ended: 22 "no wave64",heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows). None is a test of this PR.Regression run
scripts/smoke.ps1 -Game <retail title> -Seconds 600, the release build of each commit, the same environment for both:XCL_DEVICE_TYPE=lockhart XCL_DIRECT_DXIL=1 XCL_DXC_THREADS=6 XCL_SPARSE_LAZY=1 XCL_SMALL_TEXTURES=1 XCL_TEXTURE_LEVEL_PAGES=1 XCL_COHERENT_HEAPS=sparse:1024 XCL_TWO_PASS_BATCH=1 XCL_TWO_PASS_MB=1536 XCL_HEAP_WINDOWS=1 XCL_UMA_WINDOWS=16 XCL_HEAP_FLAT=1 XCL_DEPTH_UAV_TWIN=1 XCL_FRAME_DUMP=300 XCL_DIRECT_COMPACT=0, scripted A presses (XCL_PRESS_A_AT), both run on 2026-12-01 (this PR's first, with the translation cache cold for this switch).Why
XCL_DIRECT_COMPACT=0: without it, this head's runs (twice) and7737e074(the first revision rebased on #3521's new head, without this revision's fixes) had the device removed (0x887a0006) at 120–132 s, around frame 1900, with no DRED breadcrumbs. Those runs reach frame ~1900 with 25–31 presents per 2 s, further and faster than any earlier run of this title here, and so reach a compute programmainbuilds in the direct DXIL compact form (cs 95cc13288a27a96e: 20,965 blocks, 226,680 B DXIL). #3261 let that program take the compact form; the removal it then causes on NVIDIA at the first world frame is what #3516 (open) fixes, andXCL_DIRECT_COMPACT=0avoids onmain. #3521's own run builds the same program at 150 s and ends its 600 s without a removal. With the compact form off, this head ran 600 s with no removal or crash.main:
this PR's head:
Not tested
tile_showsgaveNoView), so the CPU-view paths are covered by the tests only.main) and run on to 600 s: video memory is ~5 GB over this 8 GB card's budget there, onmainas well.RehydrateRaytracingAccelerationStructureBatched2Xis not hooked (D3D12.X: XboxBvhBuilder builds give their destinations video memory #3521).XCL_SPARSE_LAZY=1nothing changes and that path was not run.Follow-ups (from the reviews, left out of this PR to keep it under ~400 lines)
AI use
RetryRequiredwhen no video memory, update scratch sizes), ran the tests and the regression runs, and wrote this description.🤖 Generated with Claude Code