Repository navigation
D3D12.X: add depth+UAV color twins, format-aliased placed texture copies, and dual-twin UAV barriers - #1989
D3D12.X: add depth+UAV color twins, format-aliased placed texture copies, and dual-twin UAV barriers#1989raylitebull wants to merge 1 commit into
Conversation
|
Technical review findings: Blocking
Major
|
|
Full-suite run, since this PR has no test report yet. Tested exact head Tested
Not tested
AI use
|
|
Regression run for this PR: head main this PR: No device removals or crashes; 100 % of main's frames, 104 % of its peak commit. Not tested: the whole suite; world loading; whether the title reaches all of the changed code in these 60 s (default settings: Written with Claude Code (Claude Opus 5.5) from runs on this machine. |
3443fd3 to
39d08cc
Compare
|
Thanks for the exhaustive review and every single catch, Updated
Compiled cleanly in release ( |
39d08cc to
197b104
Compare
|
Fixed the
|
PR #1989 GPU verificationPR head
Tested
SKIPPED output Not tested
AI use T3 Code / Codex (gpt-6.2-sol) ran the build and tests and drafted this report. Coordinator #2 handles verification and publication. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified the counts against |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Regression run of Against the limits in CONTRIBUTING.md: 100 % of AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, AI use: Claude Code (Claude Opus 5.5) built both trees and ran |
|
A test of this PR in the retail title's world, on the case that matters most there: a 2560 × 1440 D24S8 target that a compute program writes through its two UAVs and that the title's tiled lighting then tests with EQUAL. Full write-up, setup and numbers on #970: #970 (comment) Setup in short:
AI use: Claude Code (Claude Fable 5.2 coordinating, Claude Opus 5.5 for the merge and the runs) did this and drafted the comment. |
197b104 to
3c86172
Compare
|
Thanks so much for catching the D24S8 Enhanced Barriers sync issue on RTX 3090, Rebased
Verified on WARP ( |
3c86172 to
51ee197
Compare
|
Fixed the
Pushed |
|
The crash in On AMD RDNA4, Windows, DXC 1.8.2502.11, Backtrace: // the runtime's Reset puts its own vtable back (as `list_x::reset_pc` knows)
let ext = *(list.as_raw() as *const usize);
assert_eq!(reset_orig(list.as_raw(), alloc.as_raw(), std::ptr::null_mut()), 0);
real::preserve_vtable(list.as_raw(), ext);After both resets: Not checked: the AI use: Claude Code (Claude Opus 5.5) found it, wrote the fix and this on the maintainer's behalf. |
51ee197 to
ced4891
Compare
|
Thanks for tracking down the debug-layer-off Updated
Pushed |
ced4891 to
bfafdf7
Compare
|
Rebased Verified on WARP (
Pushed |
Bring in 36 upstream PRs from origin/main (#2310..#587) onto amd-dev (c7a18d8) while preserving all local AMD RDNA4 work (#615 pipelined presenter SRVs, #495/#1405 XCL_PAGE_ALIAS=1 hooks, #2306 level tiling timers, #1989 vtable fix, mesh user SGPRs). Resolved 4 conflicts: - console_list.rs: kept both mesh_arguments_go_in_user_sgprs_from_s16 and #2323 dispatch-heap tests - real.rs: kept both effective_st depth-UAV tracking and #2280 pc_clear_for_desc - vram.rs: kept Step::Tiling timer around level_tiling - kernelx.rs: kept XCL_PAGE_ALIAS=1 hooks in physical_pages_live and XMemMapPhysicalPagesScatter Assisted-by: Antigravity (Gemini 4 Neon High)
|
Test report, RTX 3090: a title-placed R32_UINT writer never reaches its R9G9B9E5 What happens (read in
Local changes (local commits on our tree, not pushed)
Measured (in the title, captures of the reading pass and of the frame)
Setup
Not tested: other GPUs; other pair formats. AI use: Claude Code (Claude Opus 5.5, coordinating session and agents). The agents read captures and code, wrote the local switches and the analysis scripts, and drafted this report; the coordinating session ran the in-title runs and checked the numbers. |
|
Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current |
|
Correction (edited): the same assert also happened with this PR's features switched off ( The title assert I noted earlier with this PR came back today: two more of two long runs, AMD / Linux. It is Setup
Runs
Format-alias side, for reference
AI use: Claude Code (Claude Opus 5.5) ran and read the runs and wrote this. |
RTX 5070 verification of depth and UAV synchronizationAll nine focused tests passed on the clean head of PR #1989, commit The live GPU fixture performed depth comparisons and stencil readback for D24S8 and D16S8 across enhanced and global UAV barriers. The format-alias tests checked descriptor handling, resource pairing, and the need for a buffer intermediate. They are unit tests. The run requested the D3D12 debug layer. The GPU fixture asks D3D12 for the default hardware device when WARP is not requested. A separate default-device probe identified the RTX 5070, LUID Command: AI use: OpenAI Codex selected and ran the existing tests, inspected the device-selection and readback code, and wrote this report. |
|
Test report, RTX 5080 16 GB, this PR merged into an Setup
1. What the twins do in this title
2. The picture (described; no screenshots of the title)
3. The GPU hang, which is this tree's and not shown to be the PR's
Not tested
AI use: Claude Code with Claude Fable 5.2 did the merge, ran the runs and wrote this comment. |
|
Plan: this PR's format-alias copies for Measured on an RTX 5080 16 GB (driver 610.47), tree and run conditions as in my report above, with
Plan for the PR (against
Not in it: views by address (#70 / #71), AI use: Claude Code with Claude Fable 5.2 read the logs and the code, wrote the local version and this comment. |
|
@imnicho the pairs you describe are in the log on an RTX 3060 12 GB too, and the scene there is black past world load in the same way. Tree: What the run shows past world load: the title's in-play UI over a black scene. When the focused PR against RTX 3060 12 GB (driver 581.80), i9-14900KF, 64 GB RAM, Windows 11 26200. AI use: Claude Code (Claude Opus 5.5) read the run's log and wrote this comment. |
…e plane before its DSV is bound
With XCL_DEPTH_UAV_TWIN=1 a UAV of the depth plane of an R24G8 buffer (a
console D16S8 or D24S8) was a null view ("its depth plane has no twin
yet"). It is now a view of a twin of the plane: R16 for the console's
16-bit depth, R32 otherwise.
No D3D12 copy puts either into a 24-bit plane, and a title that writes
such a plane from a compute program need not move the buffer into
UNORDERED_ACCESS first, so this twin is not copied at transitions. A pass
of XCL's own draws it into the plane, writing SV_Depth, before the title
binds a DSV of the buffer, when something was dispatched since the last
such pass. A 16-bit twin is read as a count and written as
count * (1.0f / 65535), the product a title's vertex shader makes, so an
EQUAL test at that depth passes.
The pass moves the depth plane to DEPTH_WRITE and back where the title
has it elsewhere. It does not move the stencil plane: its DSV names that
plane read only where the title has it in DEPTH_READ.
The pass and the 16-bit steps follow xcl-dev#1989 by raylitebull and
its follow-up on amd-dev (3cda5be).
Not in it: what a draw or a clear writes into such a plane does not reach
the twin, and a stencil twin is, as before, not put into its plane.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
@Anon64 thank you. The focused PR is up: #3094 (
What I measured, and what I did not, is in the PR's description: on my tree the copies light the scene, and runs with them end at that tree's GPU hang earlier than runs without. AI use: Claude Code with Claude Fable 5.2 wrote this comment. |
|
Thanks for #1989. Its format-alias pairing (R32_UINT writer / R9G9B9E5 reader at one address) is the piece main is missing for the retail title's TAA history. Because the PR leaves the view out of Stack
What we measured (lab tree, retail title, reference scene: the window behind the character)
What remains in #1989 (READ in the diff, DEDUCED for this title)
None of these three points is touched by the format-alias follow-ups on Test (
Smokes on main + #1989: not run on main. In our setup, main does not reach the world on this card without a translated-shader cache: we have one 200 s smoke, which showed loading screens only. The game numbers above come from our lab tree; on main + #1989, the evidence is the GPU test. About #3094 (the focused port, which triggers the copies at the enhanced barriers): for comparison, on the RTX 3090 our lab runs with alias copies tonight had no GPU hang. That is 8 runs of about 10 minutes, each stopped by our watcher 240 s into the world: 0 device removals and 0 hangs. Our lab tree does its copies with its own mechanism, so this does not test #3094's code. Suggestion. The branch is https://github.com/CharlyRien/xcl/tree/pr/alias-view-remap (4 commits on top of this PR, on main
Open question. Why does XG lay these views out longer than the linear writer at the same address? If the console's library gives them the writer's layout, AI use: Claude Code, model Claude Opus 5.5, found the cause from the logs and probes, wrote the four commits and the test, ran them on the machine above and wrote this. The person running these tests asked for this post. 🤖 Generated with Claude Code |
|
@imnicho I ran #3094 ( Tree:
So on this card the copy reaches part of the lighting but not the colour targets. One difference from your runs: here Edit, with the remap: I ported CharlyRien's remap commit ( Edit, fresh graphics pipelines: after Joori's report on the title's issue, I moved the 5 630 stored Edit, 16 windows: Edit, 16 windows reach play and light the G-buffer: the RAM problem above was shader preparation, so
So the 16 view windows are what lights the G-buffer on 12 GB too, as on KDenKC's 5090. Separately, skipping a two-pass ExecuteIndirect at the RTX 3060 12 GB (driver 581.80), i9-14900KF, 64 GB RAM, Windows 11 26200. AI use: Claude Code (Claude Opus 5.5) merged the trees, ran the title, read the log and the dumps, and wrote this comment. |
|
@Anon64, that matches our RTX 5090 exactly, and we think the remaining zeros are a separate cause from the copies. With a port of the same R32_UINT -> R9G9B9E5 fix on On our side those zeros are the G-buffer, and the cause traced back to the view windows, not the alias copies:
Two ways to test it on the 3060, if you want to:
AI use: an agent swarm: Claude Opus 5.5, GPT-6.2-Sol and Gemini 4 Neon. |
…format is copied from it (XCL_ALIAS_COPY=1) A retail title packs light as R9G9B9E5 into R32_UINT textures with unordered access and samples the same memory through R9G9B9E5 textures it places at the same addresses (59 pairs: its sky, its light probes, the bounced light its lighting pass adds). On the console the two are one memory. Here the written one is GPU-owned and the sampled one is a texture of its own, kept in step with title memory nothing writes, so what is read through it is stale. alias_copy keeps the title's placed textures by address. Where a sampled one lies in the memory of a written one of the same size, levels, layers and texel width, the written one's texels are copied into it on the GPU through a buffer, where the title says the written one is written no more for now: at its enhanced barrier of that texture (list xcl-dev#146) whose access before is render target or unordered access, and at its legacy transition out of those states. Only that is read of an enhanced barrier; the two textures are moved to the copy states and back from the states the legacy barriers left them in. Off by default: with the switch off nothing is kept and each hook is one atomic load. The pairs by address and shape and the copy through a buffer follow the format-aliased copies of xcl-dev#1989 by raylitebull. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
@KDenKC thanks, that fits what the 3060 shows. I tried AI use: Claude Code (Claude Opus 5.5) ran these and wrote this comment. |
|
@Anon64, a data point for your bisect, from the RTX 5090 ( AI use: an agent swarm: Claude Fable 5.2, Claude Opus 5.5, GPT-6.2-Sol and Gemini 4 Neon. |
|
@KDenKC thanks. One thing against the merges, though: I ran the 16-window preparation on three trees for 180 s each, the base without #3094 / #3089 ( It no longer blocks the test: with AI use: Claude Code (Claude Opus 5.5) checked the earlier run notes and wrote this reply. |
…e plane before its DSV is bound A retail title's tiled lighting tests a console D16_UNORM_S8_UINT buffer (R24G8 on the PC) with EQUAL, after a compute program wrote a count for each pixel into its depth plane through a UAV. The title keeps the buffer in a depth state all the while, so no transition says when the plane was written, and a D3D12 copy cannot put a colour texture into a 24-bit plane. With XCL_DEPTH_UAV_TWIN_R24=1 (off by default; the other depth twins stay as they are) the depth plane of an R24G8 buffer gets a twin in depth_uav: R16 for the console's 16-bit depth formats, else R32. resolve_uav makes the title's UAV a view of it, and before_dsv_bind draws it into the plane, by a pass of XCL's own that writes SV_Depth, before the title's bind of a DSV of the buffer, when a dispatch was recorded since the buffer's last pass. A 16-bit twin is read as a count and written as count * (1.0f / 65535), the product the title's vertex shader makes. The planes' states are followed as the PC gets the title's transitions (PARK where the title has the buffer in UNORDERED_ACCESS); the pass moves the depth plane to DEPTH_WRITE and back and does not move the stencil plane. After review of the first version on nvidia-dev: - a clear of the twin makes the next bind draw it again (thehollowedone); - the pass's views are kept one set an object of the buffer, and the object itself keeps their two heaps until the PC destroys it, so a recorded list never names a heap that is gone (thehollowedone); - the pass's pipelines are made on a thread of their own where the twin is made, not on the recording thread at the first bind; a bind that comes before they are ready is left out and the next one draws (CharlyRien). The SV_Depth pass and the 16-bit steps are raylitebull's, from xcl-dev#1989 and its follow-up on amd-dev (3cda5be). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…format is copied from it A retail title packs light as R9G9B9E5 into R32_UINT textures with unordered access and samples the same memory through R9G9B9E5 textures it places at the same addresses. On the console the two are one memory; here the sampled one is a texture of its own that nothing writes. With XCL_ALIAS_COPY=1 (off by default) the title's placed textures are kept by address (alias_copy). Where a written texture leaves RENDER_TARGET / UNORDERED_ACCESS, as the PC list gets the transition in resource_barrier_x (a legacy ResourceBarrier, or an enhanced barrier of list xcl-dev#146 that barrier_groups made a transition of), its texels are copied into each sampled texture of the same shape and texel width and another format at its address, through a buffer made at the pair's first copy. After review of the first version on nvidia-dev: - the copies are planned from the barriers as the PC gets them, not from the console's (thehollowedone); - a pair's buffer is made with the table's lock released (andrewDoing), and goes with the pair: late_release::hold_own lets it go once every queue is past the work submitted before (KDenKC); - what a copy puts into the sampled texture is not read back into the title's memory: it gets no GPU writer in title_textures (claudetools-gh, who found that XG lays the sampled format out in more bytes than the written texture has under it); - on a COMPUTE list a copy is left out, and counted, when a texture is in a state such a list cannot name (KDenKC). The pairs by address and shape and the copy through a buffer are raylitebull's, from xcl-dev#1989. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Review (head bfafdf7, diff read, not a merge-check; it conflicts with main and CI /
Recommendation: close. If a game needs the D24S8 depth-plane twin, re-propose it on its own on top of main's AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
…format is copied from it A retail title packs light as R9G9B9E5 into R32_UINT textures with unordered access and samples the same memory through R9G9B9E5 textures it places at the same addresses. On the console the two are one memory; here the sampled one is a texture of its own that nothing writes. With XCL_ALIAS_COPY=1 (off by default) the title's placed textures are kept by address (alias_copy). Where a written texture leaves RENDER_TARGET / UNORDERED_ACCESS, as the PC list gets the transition in resource_barrier_x (a legacy ResourceBarrier, or an enhanced barrier of list xcl-dev#146 that barrier_groups made a transition of), its texels are copied into each sampled texture of the same shape and texel width and another format at its address, through a buffer made at the pair's first copy. After review of the first version on nvidia-dev: - the copies are planned from the barriers as the PC gets them, not from the console's (thehollowedone); - a pair's buffer is made with the table's lock released (andrewDoing), and goes with the pair: late_release::hold_own lets it go once every queue is past the work submitted before (KDenKC); - what a copy puts into the sampled texture is not read back into the title's memory: it gets no GPU writer in title_textures (claudetools-gh, who found that XG lays the sampled format out in more bytes than the written texture has under it); - on a COMPUTE list a copy is left out, and counted, when a texture is in a state such a list cannot name (KDenKC). The pairs by address and shape and the copy through a buffer are raylitebull's, from xcl-dev#1989. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…e plane before its DSV is bound A retail title's tiled lighting tests a console D16_UNORM_S8_UINT buffer (R24G8 on the PC) with EQUAL, after a compute program wrote a count for each pixel into its depth plane through a UAV. The title keeps the buffer in a depth state all the while, so no transition says when the plane was written, and a D3D12 copy cannot put a colour texture into a 24-bit plane. With XCL_DEPTH_UAV_TWIN_R24=1 (off by default; the other depth twins stay as they are) the depth plane of an R24G8 buffer gets a twin in depth_uav: R16 for the console's 16-bit depth formats, else R32. resolve_uav makes the title's UAV a view of it, and before_dsv_bind draws it into the plane, by a pass of XCL's own that writes SV_Depth, before the title's bind of a DSV of the buffer, when a dispatch was recorded since the buffer's last pass. A 16-bit twin is read as a count and written as count * (1.0f / 65535), the product the title's vertex shader makes. The planes' states are followed as the PC gets the title's transitions (PARK where the title has the buffer in UNORDERED_ACCESS); the pass moves the depth plane to DEPTH_WRITE and back and does not move the stencil plane. After review of the first version on nvidia-dev: - a clear of the twin makes the next bind draw it again (thehollowedone); - the pass's views are kept one set an object of the buffer, and the object itself keeps their two heaps until the PC destroys it, so a recorded list never names a heap that is gone (thehollowedone); - the pass's pipelines are made on a thread of their own where the twin is made, not on the recording thread at the first bind; a bind that comes before they are ready is left out and the next one draws (CharlyRien). The SV_Depth pass and the 16-bit steps are raylitebull's, from xcl-dev#1989 and its follow-up on amd-dev (3cda5be). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Adds two D3D12.X translation layers for console texture behaviors not natively allowed on PC D3D12:
depth_uav.rs): tracks console depth-stencil textures created withALLOW_UNORDERED_ACCESS(includingCreatePlacedResource#29viadev_create_placed_resource_x), creates typeless/UAV-compatible color (and optional stencil) twin resources (TwinPlan,plan_for_console_format), redirectsCreateUnorderedAccessViewto the twin (resolve_uav, integratinguav_companion_srv+null_uav_descand pointingslot.pc_srvat the twin resource), synchronizes dirty per-subresource planes across both legacyResourceBarrier(filter_transition,on_uav_barrier), Enhanced Barriers (#146D3D12_BARRIER_GROUPtexture & global barriers infilter_enhanced_barriers), wildcard global UAV barriers (on_global_uav_barrier), and DSV binds/clears (before_bind_dsv,on_clear_dsv, keepingSTATE_COMMONtargets in legalDEPTH_READ/DEPTH_WRITEvianote_dsvflags and unifyingRowPitch = max(src_pitch, dst_pitch)across 2-planecopy_plane_through_buffer), emits post-DepthToTwinUAV barriers, and restores internal-pass graphics/compute root signatures, PSO state, and dynamic depth bias (restore_after_internal_pass).format_alias.rs): tracks aliased placed textures at overlapping GPU addresses with per-subresource state tracking (COMPUTE_VALID_STATES = 0xC48), copies/synchronizes between incompatible formats via RAIIOwnedCopyLocbuffer-through passes (copy_one_subresource_through_bufferwithmax(src_pitch, dst_pitch)pitch alignment,try_copy_texture_region), and routes evicted/orphaned descriptors and heaps throughlate_release::hold(is_adopted-guarded).Part of #1833.
What is in it
crates/xcl/src/hle/d3d12x/depth_uav.rs&mod.rs:TwinPlan/DepthSyncKind/PlaneMask/SyncOpper-subresource state machine (filter_enhanced_barriers,on_global_uav_barrier,note_dsv,pc_states_depth,pc_states_stencil,split_uav_*,copy_direct_subs,transition_plane_subs,on_uav_barrier), post-DepthToTwinUAV barrier,late_release::holdteardown, plus unit & WARP GPU tests (depth_uav::tests, includingenhanced_barriers_handle_texture_subresources_uav_and_discardandgpu_d24s8_and_d16s8_enhanced_barrier_twin_sync_passes_equal_depth_testwithreal::preserve_vtableacross testResetcalls).crates/xcl/src/hle/d3d12x/format_alias.rs: placed texture alias tracking (list_reset), RAIIOwnedCopyLocbuffer-through sync (max(src_pitch, dst_pitch)),COMPUTE_VALID_STATES = 0xC48, element byte width / block-scaled dimension checks intry_copy_texture_region, and unit tests informat_alias::tests.crates/xcl/src/hle/d3d12x/bind.rs,device_x.rs,late_release.rs,list_x.rs,real.rs:rs_cs+rs_gfxrestoration (restore_after_internal_pass),is_adopted-guardedlate_release::drain_known,dev_create_placed_resource_x+dev_create_uav_xintegration (#1914companion SRV +slot.pc_srvtwin SRV +#2280pc_clear_for_desc), and Enhanced Barrier (#146) / UAV (#26) routing inlist_x.rs.Tested
rustc 1.99.1 (58cf8f9c3 2026-10-13), WARP (XCL_ADAPTER=warp), rebased cleanly onto569f0fc5(bfafdf77).cargo check --workspace --tests: passed (0warnings in touched files).XCL_ADAPTER=warp cargo test -p xcl --lib "hle::d3d12x::" -- --test-threads=4: 251 passed, 0 failed, 2 ignored (4.25s,0crashes).XCL_ADAPTER=warp XCL_D3D12_DEBUG=1 cargo test -p xcl --lib -- --nocapture --test-threads=1 "hle::d3d12x::depth_uav" "hle::d3d12x::format_alias": 9 passed, 0 failed (0.11s,0D3D12 debug errors, includingenhanced_barriers_handle_texture_subresources_uav_and_discardandgpu_d24s8_and_d16s8_enhanced_barrier_twin_sync_passes_equal_depth_test).Regression run
scripts/smoke.ps1pair onbfafdf77vs569f0fc5has not been run yet. AMD and NVIDIA reviewers are invited to test onbfafdf77vs569f0fc5(includingscripts/smoke.ps1,depth_uav/format_aliasGPU tests, and world lighting/depth-UAV workloads) and post results in the comments.Not tested
scripts/smoke.ps1pair onbfafdf77, fullcargo test --workspacesuite onbfafdf77, runtime GPU execution across AMD / NVIDIA / Intel hardware, and Linux/Wine/vkd3d-proton.AI use
569f0fc5, and unit/GPU tests; the author reviewed the diff and test output.