Skip to content

D3D12.X: do not transfer target supersession to same-view aliases on release - #3416

Open
Kalmarv wants to merge 1 commit into
xcl-dev:mainfrom
Kalmarv:fix/placements-release-same-view
Open

Kalmarv wants to merge 1 commit into
xcl-dev:mainfrom
Kalmarv:fix/placements-release-same-view

Conversation

@Kalmarv

@Kalmarv Kalmarv commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

What changed

  • Extracted a shared same_view(new, old) helper in crates/xcl/src/hle/d3d12x/placements.rs (new.desc.format != 0 && new.va == old.va && new.desc.same_texels(&old.desc)) used by both Registry::place and Registry::release.
  • In Registry::release, excluded same-view aliases (!same_view(q, &old)) when searching for another live overlapping placement to inherit a released placement's superseded target list.
  • Added unit test hle::d3d12x::placements::tests::releasing_transient_overlap_remaps_target_with_same_view_alias covering both creation orders (same-view SRV alias created before or after a transient overlap) and verifying that a second non-same-view overlap still keeps the target superseded without attaching the same-view alias.

Why

Commit 2c2bce36 excluded same-view aliases (e.g. a UAV target and a same-address/same-texels SRV view of it) from superseding each other in Registry::place, but Registry::release did not apply the same !same_view(q, &old) predicate when transferring a released placement's superseded list to remaining live overlaps. As a result, if a transient different-layout placement overlapped a UAV target and its same-view SRV alias and was later released or removed, Registry::release transferred the UAV target's supersession onto the same-view SRV alias instead of remapping the target. That left the UAV target permanently unmapped (superseded by its own SRV view) until the SRV alias itself was destroyed.

Tested

  • Pre-fix reproduction on origin/main (3b6a91ed): cargo test -p xcl --lib placements::tests failed at releasing_transient_overlap_remaps_target_with_same_view_alias (left: [], right: [1], same-view SRV alias kept UAV target superseded).
  • Post-fix cargo check --workspace --all-targets: passed with 0 errors and 0 new warnings.
  • Post-fix cargo test -p xcl --lib placements::tests -- --nocapture: 14 passed, 0 failed.
  • Post-fix cargo build --workspace and cargo build --release -p xcl: succeeded.
  • Post-fix cargo test --workspace -- --test-threads=4 (on RTX 5070 Ti with DXC 1.9.2609.5): xcl --lib 2582 passed, 29 ignored, 4 failed (all 4 are the pre-existing origin/main 3b6a91ed split-wave64 geometry test failures: gpu::dxil::geometry_tests::gpu_geometry_msg_gs_done_records, gpu::dxil::geometry_tests::msg_gs_done_emits_in_dxil, gpu::dxil::lower_geom::tests::gpu_epilogue_filters_oob_triangles_and_no_store_emits, gpu::dxil::lower_mem::stage_guard_tests::geometry_export_rejected); cargo test --workspace --exclude xcl -- --test-threads=4: 0 failed.
  • 150 s real-title xcl-smoke on NVIDIA GeForce RTX 5070 Ti:

Baseline (main ancestor):

xcl-smoke v1
commit: f0e8fdd5c3942ddd399d5ee11384c8595c5aacff
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 150
exit: 0x0
frames shown: 1695 (PresentX 1695)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 31546 MB

This PR:

xcl-smoke v1
commit: 85d7fe0cfad4ff255d603cee38f932b27ed97899
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 150
exit: 0x0
frames shown: 1607 (PresentX 1607)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 32818 MB

Not tested

  • Non-NVIDIA GPUs (tested on NVIDIA GeForce RTX 5070 Ti only).
  • The 4 pre-existing origin/main (3b6a91ed) geometry test failures listed above are untouched by this PR.

AI use

Used an AI coding assistant to audit crates/xcl/src/hle/d3d12x/placements.rs, write the causal regression test and fix, and run the build, test, and smoke verification steps.

…release

Registry::place skips superseding a live target when a newer placement at the same VA has the same texels (for example an R9G9B9E5 sampled view over an R32_UINT UAV target whose owned page range differs by a trailing page), but Registry::release omitted that check when scanning for remaining newer overlaps. Releasing a transient overlapping placement therefore transferred supersession of the target to its own live same-view alias instead of remapping it.

Share a single same_view helper across Registry::place and Registry::release so releasing or removing a transient overlap remaps the target whenever only same-view aliases remain.
@github-actions github-actions Bot added area:d3d12 D3D12.X runtime, command lists, resources, sparse memory gpu:both Code affects both AMD and NVIDIA GPUs (scope tag; see needs:*-test for remaining checks) labels Nov 29, 2026
@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

merge-check
base: d0832e6
head: 85d7fe0
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2891 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 (placements.rs, +58/-3). No correctness bug: release now uses the same same_view exclusion as place (same newer-then-older order, the format != 0 check on the newer placement only), takes no new lock, and still remaps through settle -> map_again. Read against main, the test fails without the fix, and case 3 still covers a genuine overlap taking the supersession. Findings: (1) the description overstates the impact: on main a superseded target is already mapped again on its next barrier, copy or descriptor-table bind (note_use -> use_again; bind.rs ~1333, list_x.rs ~7000, console_list.rs ~958), so it doesn't stay unmapped until the SRV alias is destroyed. It stays off the shared pages until the title next uses it that way, with the bind scan on meanwhile. (2) AI use names neither tool nor model. (3) Tested gives no SKIPPED count, and its 4 local failures differ from the 6 that fail in this PR's CI run. Those same 6 fail on main's own CI at the PR's base 3b6a91e, and the run here (above) is the check on current main. It merges cleanly alongside #3192, which touches other parts of placements.rs.
performance: 60 s smoke of a retail title, main d0832e6 vs this merge (f9b98fe1): 1516 -> 1666 frames shown (109 %; last presents per 2 s: 60 60 60), peak commit 18133 -> 17220 MB, 0 device removals, 0 crashes.
verdict: safe to merge (the description should name the AI model, add SKIPPED counts and narrow the impact claim)
hardware / 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:d3d12 D3D12.X runtime, command lists, resources, sparse memory gpu:both Code affects both AMD and NVIDIA GPUs (scope tag; see needs:*-test for remaining checks)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants