Repository navigation
D3D12.X: remap superseded targets bound through descriptor tables - #3179
Conversation
|
On an RTX 5070 12 GB (driver 616.92), a superseded render target became mapped again when its real SRV entered the descriptor-table scan. After remap, native shader loads through the two shared-heap SRVs distinguished the older target from the newer placement. I added a test-only fixture at head
This exercised the scan helper called by AI use: OpenAI Codex (GPT-6) prepared the fixture, ran these controls and wrote the report. |
|
I checked whether zero-based slot 256 from the earlier readback is outside the declared binding range. It can be inside: the Windows D3D12 root-signature serializer and deserializer accepted SRV ranges of 1, 256 and 257 descriptors and preserved each exact count. I fed each serialized RTS0 payload into the head's layout parser and SGPR packing code. All three yielded a four-byte root argument, In the guest path, the table command copies the base address into that argument; If extending this path, retaining the finite declared view ranges (including explicit offsets and APPEND) would let the scan cover slot 256 when declared and avoid unrelated neighbors in short tables. Unbounded ranges need a separate bounded strategy. This CPU check establishes serialization, XCL layout and argument packing. I did not execute a full guest shader dispatch at slot 256 or establish the fog title's range sizes. AI use: OpenAI Codex ran the D3D12 and XCL parser controls and traced the bind path. |
|
I tested a local range-aware candidate on
Fenced native shader reads after remapping returned 0.25 and 0.75 for the two distinct textures. One native test passed with zero skips. Three integrated CPU tests also passed for v1.0/v1.1 range layout, explicit offsets, APPEND across non-image ranges, sampler exclusion, malformed ranges and unbounded ranges. The candidate stores view intervals when parsing RTS0 and scans them in 256-descriptor chunks clipped to the remaining registered heap extent. The unbounded policy in this experiment scans up to 256 slots starting at that range’s declared offset. For copied tables with unknown owner extent it retains the original table-base 256-slot limit. Those policies leave wider unbounded or unregistered ranges unresolved. The fixture uses the parsed layout and production scan, followed by native shader readback; it does not dispatch a full guest command stream or measure the bind-time cost of large finite tables. I kept the candidate local to avoid a competing PR. AI use: OpenAI Codex implemented the candidate, ran the controls and prepared this follow-up. |
|
An early data point for this from an RTX 5090 (32 GB, driver 621.24), env-only, not yet a test of this head: Setup: the retail title, one run each, 600 s after the world entry,
What this does and doesn't say
This head itself in the title: see the second edit at the end. Edit: the whole suite of this head on an RTX 3090. We ran the whole suite of your head on an RTX 3090 against its base on the same machine: no failure the base doesn't have, and both new tests pass ( Tested:
Not tested on this card: a title run; a release build; AMD / Intel. Edit 2: this PR's commit itself in the title on the RTX 5090 (621.24, release, one run each, 600 s after the world entry).
AI use: an agent swarm: Claude Fable 5.2, Claude Opus 5.5, GPT-6.2-Sol and Gemini 4 Neon. |
|
A title data point for this head from an RTX 5070 Ti 16 GB (driver 621.24): with this change, several of GTA 6's intro cutscene shots that were black become lit. Setup: retail title, release,
Not tested: more than one or two runs per column; this head on its own without the other merged branches; the test suite; AMD. AI use: Claude Code with Claude Opus 5.5 ran the title on the machine above and wrote this. |
|
Rerun on the new head
Same RTX 3060 (driver 610.88), Rust 1.100.0, debug.
Tested:
Not tested: a title, a release build, AMD / Intel. AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report. |
|
merge-check claim Plus what this card can add for the dark picture (RTX 4080 16 GB, 621.40; our world runs on |
|
World runs for this PR on an RTX 4080 16 GB (621.40), as announced above. Short form: on this card's setup the PR runs without harm but does not change the dark picture; Tested
Not tested
AI use: Claude Code (Claude Fable 5.2) built the trees, made the runs and wrote this; Claude Haiku 5.5 described the three frames. Update, two more runs, now measured over the last 40 dumped frames of each run (every 15th presented frame, about the last four minutes in the world) instead of one frame:
The switch makes the picture brighter in both runs, but by very different amounts (median 38 % and 16 % against 5 %), so there is a second factor that differs from run to run. Runs 218 and 219 above have only their last frame left, so they are not in this table. |
|
merge-check |
|
Follow-up to the 256-slot limit noted in the merge check, on unchanged head The layout parser currently discards each table's range payload. Preserve its SRV/UAV intervals and walk only those intervals at bind time, resolving A focused regression should declare one SRV at offset 256, put different superseded targets in slots 0 and 256, run the actual binding scan, and assert that only the slot-256 target remaps. The PR's current |
A target superseded by a newer overlapping placement (5d00b39) had its tiles unmapped (D3D12_TILE_RANGE_FLAG_NULL) and was only remapped by placements::note_use on ResourceBarrier or Copy* calls. Compute and graphics passes that bind a UAV/SRV texture through descriptor tables without a per-resource barrier (e.g. global UAV barriers) left the target unmapped, silently dropping UAV writes and returning zeros on reads. Also avoid superseding a live target when a newer placement at the exact same VA has the same texels (e.g. an R9G9B9E5 sampled alias over an R32_UINT UAV target whose owned page range differs by a trailing page). In bind_abi, scan descriptor table slots and call placements::note_use only when placements::any_superseded() is true (single relaxed atomic load on the fast path). Assisted-by: Antigravity (Gemini 4 Neon)
63126a4 to
2c2bce3
Compare
|
merge-check claim Re-check of the head rebased onto main. |
|
merge-check |
|
merge-check
|
A target superseded by a newer overlapping placement (5d00b39) had its tiles unmapped (D3D12_TILE_RANGE_FLAG_NULL) and was only remapped by placements::note_use on ResourceBarrier or Copy* calls. Compute and graphics passes that bind a UAV/SRV texture through descriptor tables without a per-resource barrier (e.g. global UAV barriers) left the target unmapped, silently dropping UAV writes and returning zeros on reads. Also avoid superseding a live target when a newer placement at the exact same VA has the same texels (e.g. an R9G9B9E5 sampled alias over an R32_UINT UAV target whose owned page range differs by a trailing page). In bind_abi, scan descriptor table slots and call placements::note_use only when placements::any_superseded() is true (single relaxed atomic load on the fast path). From #3179 (merge b0b6169). Adapted: bind.rs conflicted (this tree's bind_abi is not split into bind_abi_with_root_resolved, and XCL_TRACE_SLOT's trace_table_slot sits where the new function went). note_superseded_in_tables is added beside it and called in bind_abi right after want_root_views, as upstream calls it there; a table outside the committed window is read with title_textures::copy_readable (pub(super) here; upstream's read_committed_into is private in this tree). placements.rs applied as is. (cherry picked from commit b0b6169) Assisted-by: Antigravity (Gemini 4 Neon) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A target superseded by a newer overlapping placement (5d00b39) had its tiles unmapped (D3D12_TILE_RANGE_FLAG_NULL) and was only remapped by placements::note_use on ResourceBarrier or Copy* calls. Compute and graphics passes that bind a UAV/SRV texture through descriptor tables without a per-resource barrier (e.g. global UAV barriers) left the target unmapped, silently dropping UAV writes and returning zeros on reads. Also avoid superseding a live target when a newer placement at the exact same VA has the same texels (e.g. an R9G9B9E5 sampled alias over an R32_UINT UAV target whose owned page range differs by a trailing page). In bind_abi, scan descriptor table slots and call placements::note_use only when placements::any_superseded() is true (single relaxed atomic load on the fast path). From xcl-dev#3179 (merge b0b6169). Adapted: bind.rs conflicted (this tree's bind_abi is not split into bind_abi_with_root_resolved, and XCL_TRACE_SLOT's trace_table_slot sits where the new function went). note_superseded_in_tables is added beside it and called in bind_abi right after want_root_views, as upstream calls it there; a table outside the committed window is read with title_textures::copy_readable (pub(super) here; upstream's read_committed_into is private in this tree). placements.rs applied as is. (cherry picked from commit b0b6169) Assisted-by: Antigravity (Gemini 4 Neon)
A superseded target bound through a descriptor table is remapped when a draw or dispatch binds the table (xcl-dev#3179), but only the first 256 slots of each table were read. A view further in – a bindless SRV range, or a range at an explicit offset past slot 256 – was never seen: the target kept no tiles, its writes were dropped and its reads returned zeros. The root signature's SRV and UAV ranges of each descriptor table (RTS0 1.0 and 1.1, appended and unbounded ones included) are now kept in the layout, and the scan reads those ranges and nothing else. An unbounded range ends with the view heap the table lies in (console_heap::view_heap_remaining_slots); outside any view heap it has no known extent and is not read. CBV and sampler ranges cannot name a placed target and are skipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A target superseded by a newer overlapping placement (
5d00b390,XCL_PLACE_RETIRE=1) had its tiles unmapped (D3D12_TILE_RANGE_FLAG_NULL) and was only remapped byplacements::note_useonResourceBarrierorCopy*calls.Two cases caused live UAV targets to remain unmapped and silently drop all writes (reading back as
0):R9G9B9E5sampled view over anR32_UINTUAV target whose owned page range differs by a trailing page) producedOverlap::Aroundinstead ofOverlap::Sameand superseded its own UAV target.ResourceBarrier(e.g. global UAV barriers) never triggeredplacements::note_use.In a retail title, both cases hit the volumetric fog upsample outputs (
480x272R32_UINT/R9G9B9E5inscatter and adjacentR10G10B10A2transmittance), causing the fog apply pass to multiply the scene by0.0transmittance and black out the 3D frame. With this fix (defaultXCL_PLACE_RETIRE=1, no workarounds), the superseded targets remap on bind and the 3D scene renders normally.What is in it
crates/xcl/src/hle/d3d12x/placements.rs:Desc::same_texelsand skip superseding whenp.desc.format != 0 && p.va == old.va && p.desc.same_texels(&old.desc).any_superseded()(single relaxed atomic load ofSUPERSEDED).same_address_same_texels_alias_pair_does_not_supersedeandsuperseded_target_remaps_on_use_again.crates/xcl/src/hle/d3d12x/bind.rs:bind_abi, whenplacements::any_superseded()is true, scan descriptor table slots (Param::Table) and callplacements::note_usefor named image descriptors.Tested
Hardware: Windows 11 x64, NVIDIA GeForce RTX 5070 Laptop GPU (8 GB, driver 617.71), Rust stable MSVC release.
cargo test --manifest-path C:\XCL-pr1\Cargo.toml --release --workspace -- --test-threads=1(xcl --lib):SKIPPEDforno wave64/#1426/XCL_HEAP_WINDOWS=1/ Developer Mode; all 4 failures are pre-existinggpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3; allhle::d3d12xtests includingplacements,bind,vram,title_textures, anduma_driverpassed).cargo test --manifest-path C:\XCL-pr1\Cargo.toml --release -p xcl --test '*' -- --test-threads=1:e2e.rshad 1 passed / 3 failed becausetesttitle.exewas not built intarget/debug.2c508222, defaultXCL_PLACE_RETIRE=1, 192 s): superseded targets (480x272transmittance, volumetric 3D textures, shadow maps) automatically remapped on bind and the 3D scene rendered in the presented frame.Regression run
main(b937fbab):Base (
nvidia-dev,fa204595):PR head (
2c2bce36):Not tested
e2e.rswith debugtesttitle.exe.AI use
Antigravity, Gemini 4 Neon — diagnosed root cause, implemented the
placements.rs/bind.rsfix and unit tests, ran tests and smoke regression runs, and opened the PR at the user's request.