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

Open
Kalmarv wants to merge 1 commit from upstream-pr/3416 into main
Kalmarv commented 2026-11-29 14:45:52 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-29T14:45:52Z.


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.

<!-- greyfinch-sync:ivall/xcl:issue:5551820430 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3416). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-11-29T14:45:52Z. --- **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.
Foniass commented 2026-12-01 04:01:10 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:01:10Z.


merge-check
base: d0832e614f
head: 85d7fe0cfa
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 3b6a91ed, 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 d0832e61 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.

<!-- greyfinch-sync:ivall/xcl:comment:7300295246 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3416#issuecomment-7300295246). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T04:01:10Z. --- merge-check base: d0832e614fa7d6ae027bb4feb27ccb9121f54a8f head: 85d7fe0cfad4ff255d603cee38f932b27ed97899 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 3b6a91ed, 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 d0832e61 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.
bmjask commented 2026-12-02 14:14:16 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T14:14:16Z.


@Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.

<!-- greyfinch-sync:ivall/xcl:comment:7348212016 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3416#issuecomment-7348212016). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T14:14:16Z. --- @Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3416:upstream-pr/3416'
git switch 'upstream-pr/3416'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3416'
git switch 'upstream-pr/3416'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3416'
git switch 'upstream-pr/3416'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3416'
git switch 'main'
git merge --squash 'upstream-pr/3416'
git switch 'main'
git merge --ff-only 'upstream-pr/3416'
git switch 'main'
git merge 'upstream-pr/3416'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!3416
No description provided.