D3D12.X: populate companion SRVs for all image UAV dimensions and preserve null image view slots #1914
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1914
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1914/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@certified-retart on GitHub · 2026-11-24 23:02 UTC · original
certified-retart:d3d12x/uav-companion-srv-and-null-image-views→main· +790 −34 · 1 files · 1 commits · merged 2026-11-25 10:55 UTCEvery console image descriptor slot in XCL pairs two adjacent PC descriptors:
slot.index(SRV) andslot.index + 1(UAV). Both the HLSL and Direct DXIL recompiler paths translateimage_load,image_sample_*, andimage_get_resinfotoResourceDescriptorHeap[t[0]](slot.index), whileimage_storeandimage_atomic_*indexResourceDescriptorHeap[t[0] + 1](slot.index + 1).Previously in
crates/xcl/src/hle/d3d12x/real.rs:dev_create_uav_xonly created the companion SRV atslot.pc_srvfordim == 4(Texture2D). ForTexture1D,Texture1DArray,Texture2DArray, andTexture3DUAVs,slot.pc_srvremained uninitialized (VA0x0), andCopyDescriptorsSimplecopied that uninitialized descriptor into destination/shared heaps, so reading any non-2D UAV viaimage_loadorimage_sample_*faulted the GPU at VA0x0(0x887A0006). WildcardArraySize == 0 | u32::MAXvalues on array UAVs were also not resolved,PlaneSlicewas dropped, andTexture3Dmip depth was not shifted bymip.dev_create_srv_xanddev_create_uav_xwrote[0; 8]into the console slot wheneverpResource == NULL(explicit D3D12 null image views or failedresource_at()lookups), discardingslot.indexso shaders indexedResourceDescriptorHeap[0]/[1](memory window 0/1 raw buffers or uninitialized descriptors) and preventingconsole_heap::copy_wordsfrom renumbering copied null views.Part of #675 and #1269.
What is in it
resolve_uav_array_size,null_uav_desc, anduav_companion_srvincrates/xcl/src/hle/d3d12x/real.rs.slot.pc_srvindev_create_uav_xfor all image UAV dimensions (Texture1D,Texture1DArray,Texture2D,Texture2DArray,Texture3D, includingdesc == NULLdefault UAVs), resolvingArraySize == 0 | u32::MAX, forwardingFirstArraySlice/PlaneSlice, handlingD3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCEvia a null SRV, matching the view dimension innull_uav_descforno_uav, and shiftingTexture3Ddepth bymip.xcl_image_for_view(slot.index, ...)) for null image SRVs (dev_create_srv_x) and null image UAVs (dev_create_uav_x), normalizingDXGI_FORMAT_UNKNOWNtoDXGI_FORMAT_R32_FLOATand publishing a matching null companion SRV for null image UAVs.uav_companion_srv_covers_all_image_dimensions_and_wildcards) and an end-to-end SM 6.6ResourceDescriptorHeapGPU test (gpu_uav_companion_srv_and_null_image_views) covering all 5 UAV dimensions,ArraySize = u32::MAX,Texture3Dmip 1, null image SRV/UAV isolation from slot 0, andCopyDescriptorsSimplefrom a CPU-only staging heap to a shader-visible heap.Tested
cargo test --workspace -- --test-threads=4: 0 failed (all unit, GPU, and integration tests pass, including both new tests inhle::d3d12x::real::uav_companion_srv_tests).scripts/smoke.ps1regression run (main vs PR head) below.Regression run
main:
PR:
Not tested
PlaneSlice > 0) UAV readback on hardware (unit-tested inuav_companion_srv_covers_all_image_dimensions_and_wildcards).AI use
cargo test --workspaceandscripts/smoke.ps1.@thehollowedone on GitHub · 2026-11-24 23:08 UTC · original
Independent check of 47e9356 on an RTX 3080 Ti (621.35), Windows 11 build 26300 with Graphics Tools, Rust 1.99.1 MSVC debug, DXC 1.8.2502.11.
cargo test --offline --locked -p xcl --lib uav_companion_srv -- --nocapture --test-threads=1: 2 passed, zero skips, with the D3D12 debug layer enabled in the GPU fixture. All ten readback words matched. The same GPU test passed with GPU-based validation enabled.R8G8_UINTview ofPlaneSlice=1. The companion SRV read back U=71 and V=211 after the UAV store, both directly and through a CPU-only staging descriptor copied into the shader-visible heap. The same GPU test passed 1/1 with GPU-based validation, and all 14 readback words matched.Each GPU run reported zero D3D12 errors and one warning (1328 for the fixture's buffer initial state). No device removal. The extensions were test-only and used synthetic inputs.
AI-assisted. Codex (GPT-6 family, exact variant unavailable) extended and ran the fixture and drafted this report.
@raylitebull on GitHub · 2026-11-25 00:56 UTC · original
Code review on
47e9356:uav_companion_srv,null_uav_desc,resolve_uav_array_size, andview_dim_to_image_typeincrates/xcl/src/hle/d3d12x/real.rscleanly populate companion SRVs acrossTexture1D,Texture1DArray,Texture2D,Texture2DArray, andTexture3D(handlingArraySize == 0 | u32::MAX,DENY_SHADER_RESOURCE, and null image views without aliasing slot0), andgpu_uav_companion_srv_and_null_image_viewsexercises readback andCopyDescriptorsSimplerenumbering on real SM 6.6 hardware.What is still needed before merge:
@Melow-code's question regarding the +700 MB peak commit increase in the 60 s smoke comparison.uav_companion_srv_tests+ smoke), since current coverage is NVIDIA-only (RTX 5070andRTX 3080 Ti).@JJAutoCompare on GitHub · 2026-11-25 01:49 UTC · original
PR #1914 GPU verification
PR head
47e9356c14a852a835b7c09b4bfa574945c80e95was fetched fromoriginviarefs/pull/1914/headand tested in a clean detached checkout. Fetchedorigin/mainwas3da2abb81606df622610e009f0430de99aa9881c.git merge-tree --write-tree origin/main HEADexited 0 and produced tree4cb1199246e366d7a39d1da67275d2f8a8c37cbc.Tested
26200.9974, AMD Ryzen 7 3800X, Intel Arc A770 16 GiB on driver32.0.101.9175(wave range 8–32,DoublePrecisionFloatShaderOps=0). DXC and DXIL1.9.2609.5.rustc 1.100.0 (0ef1bc386 2026-11-09). Unoptimized dev and test profiles with debug info and incremental compilation disabled.cargo build --workspaceandcargo test --workspace --no-runboth exited 0 outside the GPU lock.cargo test -p xcl --lib hle::d3d12x::real::uav_companion_srv_tests::uav_companion_srv_covers_all_image_dimensions_and_wildcards -- --exact --show-outputreturned 1 passed, 0 failed, 0 ignored, 0 skips.cargo test -p xcl --lib hle::d3d12x::real::uav_companion_srv_tests::gpu_uav_companion_srv_and_null_image_views -- --exact --show-outputreturned 1 passed, 0 failed, 0 ignored under the Arc lock. Running the same test directly withXCL_TEST_UAV_COMPANION_CHILD=1,XCL_UMA_MB=64, andXCL_COHERENT_MB=64exposed the child output and confirmed shader execution and readback, with 0 skips.cargo test --workspace --no-fail-fast -- --test-threads=4 --show-outputran once underL:/XclTooling/Invoke-ArcTest.ps1. Cargo exited 101. Across 19 test binaries and one doctest harness, libtest reported 952 passed, 25 failed, 45 ignored. The log contains 25 explicit skip messages including skipped subcases. Those subcases provide no coverage. Both PR tests passed in this run.Failures
CreateComputePipelineStatereturned0x80070057in 20 tests:gpu::dxil::fuzz_tests:fuzz_validate_and_gpu_0(seed 2),fuzz_validate_and_gpu_1(506),fuzz_validate_and_gpu_2(1003),fuzz_validate_and_gpu_3(1501).gpu::dxil::ops_tests:doubles_match_cpu,groupshared_barrier_and_atomics_run.gpu::dxil::round_tests:gpu_direct_f32_round_modes_dynamic_and_denormals,gpu_direct_f32_round_modes_static.gpu::recomp::lower_dxil::tests:f64_programs_on_the_gpu.gpu::recomp::tests:gpu_clamp_and_omod_per_instruction,gpu_f64_class_compare,gpu_f64_compares_with_nan,gpu_f64_literal_high_word,gpu_f64_math_random,gpu_f64_roots,gpu_f64_rounding_and_conversions,gpu_float_compares_random,gpu_frexp_f64_exp_and_mant,gpu_ldexp_f64,gpu_rndne_f64.gpu::recomp::tests::gpu_nonfused_mad_and_mac_prevent_fma_contractionfailed the fusedv_fma_f32overflow control.gpu::recomp::tests::gpu_ps_image_sample_offset_implicit_lod_between_mipsread25.609375at pixel(0,0)where it expected26.gpu::recomp::tests::gpu_valu_16_and_64_bitfailed the lane 0v_add_f16high-half preservation check.gpu::recomp::tests::gpu_wave64_ps_whole_wave_reductionsread[2, 217, 2]at pixel 0 where it expected[2, 216, 2].e2e::test_title_runs_and_game_folder_is_untouchedfailed theRSSetDepthBiasX(-1000.5)check. The top-right pixel was blue and the test expected green.Explicit skips
Not tested
mainand the PR head, failure reproduction onmain, other GPU vendors, and release builds. Game sample checks that returned early, includingXCL_SAMPLE_RPF,XCL_SAMPLE_TTPF, andXCL_SAMPLE_AWC, provided no game coverage.AI use
gpt-6.2-sol) ran the build and tests and drafted this report. Coordinator #2 (T3 Code / Antigravity,gemini-4-neon) verified the counts againstpr1914-suite.logand published this report.Full suite log
L:\XclTooling\sol-slot-10\tmp\pr1914-suite.log.@certified-retart on GitHub · 2026-11-25 01:53 UTC · original
Following up on @Melow-code's question and @raylitebull's review regarding the +707 MB peak commit delta in the initial 60 s smoke pair:
esolve_uav_array_size\ only computes the \u32\ \ArraySize\ field of a stack-local \D3D12_SHADER_RESOURCE_VIEW_DESC\ for an existing \ID3D12Resource\—it allocates no buffers, textures, or heaps.
689f2db\ vs exact PR head \47e9356, RTX 5070, \ itle: 6ca5cab7, \exit: 0x0, \device removals: 0, \crashes: 0, \60 60 60\ on every run):689f2db)47e9356)So the initial +707 MB difference was normal run-to-run variance in background streaming / compilation during the 60 s window, not memory growth from this PR. (I don't have AMD hardware locally for the AMD verification item.)
@raylitebull on GitHub · 2026-11-25 02:04 UTC · original
Thanks
@certified-retartfor the alternating 60 s comparison runs (15,907 MBmedian onmainvs15,728 MBon47e9356) confirming the earlier +707 MB difference was run-to-run background streaming variance with zero new heap allocations.Only remaining item before merge: An independent AMD GPU verification pass on
47e9356.@DavidM1911 on GitHub · 2026-11-25 02:24 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@SzczepanGrela on GitHub · 2026-11-25 04:41 UTC · original
Linux/RADV + Wine GPU test report on PR
#1914head47e9356(clean local merge406a280ontoorigin/maincbc296a,rustc 1.97.1, zero compiler warnings).Tested
7.3.0-5-cachyos), AMD Radeon RX 9070 (RADV GFX1201, device0x7550, native wave64, Mesa26.2.5-arch3.1, Vulkan1.4.354),GE-Proton11-12(wine-11.0 (Staging),vkd3d-proton v3.1-1-g8293130eb), DXC1.9.2602.17(21d28f72). Cross-builtx86_64-pc-windows-gnurelease (--libin 39.50 s, 7 integration binaries in 26.20 s) withXCL_REQUIRE_GPU=wave64 XCL_NETWORK=0.uav_companion_srv_covers_all_image_dimensions_and_wildcards --exact: 1 passed, 0 failed (0.00 s).gpu_uav_companion_srv_and_null_image_views --exact(tested in 4 runs: parent-to-child default, direct childXCL_TEST_UAV_COMPANION_CHILD=1, parent-to-childXCL_DIRECT_DXIL=all, direct childXCL_DIRECT_DXIL=all): 0 passed, 1 failed (exit 101 in all 4 runs). In the observed sequence,ID3D12Device15adoption ran beforedev_create_uav_x,dev_create_srv_x,dev_copy_descriptors_simple_x, T# descriptor assertions, DXCcs_6_6compilations,ID3D12CommandQueueadoption, andID3D12CommandAllocatoradoption, up toCreateCommandList, whereCreateCommandListpanicked withHRESULT(0x80070057)(Invalid parameter.) atcrates/xcl/src/hle/d3d12x/real.rs:7846:134(local merge406a280;7216:134on PR#1914head47e9356) afterDeviceandCommandAllocatoradoption.origin/maincbc296aruns show matchingCreateCommandListHRESULT(0x80070057)failures afterDeviceandCommandAllocatoradoption indma_list_release_cleans_up_list_state(fails in thehle::d3d12x::realsuite atreal.rs:6752:120oncbc296aandreal.rs:6979:120on local merge406a280, while passing solo in 0.07 s oncbc296aand 0.06 s on local merge406a280),d3d12_resource_and_sync(fence_and_command_queue_sync_timing_and_allocator_reset_match_host_and_consoleatd3d12_resource_and_sync.rs:481:118), andpredication_e2e(set_predication_buffer_state_and_kickoffatpredication_e2e.rs:308:14).hle::d3d12x::real --test-threads=1: 46 passed, 2 failed (1.15 s), vsorigin/maincbc296a45 passed, 1 failed (0.96 s); delta isuav_companion_srv_covers_all_image_dimensions_and_wildcardspassing andgpu_uav_companion_srv_and_null_image_viewsfailing atreal.rs:7846:134(local merge406a280;7216:134on PR#1914head47e9356).gpu::recomp::tests::gpu_ --test-threads=1 --skip gpu_sparse_vram_descriptors_buffers_and_xmem --skip gpu_uma_import_check_at_init --skip gpu_unified_memory_arena:origin/maincbc296a99 passed, 1 failed, 1 ignored (4.50 s); identical failuregpu_nonfused_mad_and_mac_prevent_fma_contraction.XCL_DIRECT_DXIL=all: 96 passed, 4 failed, 1 ignored (2.17 s), vsorigin/maincbc296a96 passed, 4 failed, 1 ignored (2.48 s); identical 4 failures (gpu_f64_math_random,gpu_f64_roots,gpu_image_get_resinfo_1d_array,gpu_nonfused_mad_and_mac_prevent_fma_contraction).406a280identical pass/fail toorigin/maincbc296a):console_dlls_e2e13 passed, 0 failed (0.00 s vs 0.00 s);d3d12_resource_and_sync2 passed, 1 failed (0.56 s vs 0.34 s);gpu_compute_e2e2 passed, 2 failed (1.49 s vs 1.14 s);predication_e2e0 passed, 1 failed (0.51 s vs 0.45 s);sparse_reinit0 passed, 1 failed (0.62 s vs 0.41 s);gpu_pso_e2e7 passed, 0 failed (0.29 s vs 0.28 s; 6 skipped withXCL_SAMPLE_RPF not set);texture_states1 passed, 0 failed (0.00 s vs 0.00 s; skipped due to missing D3D12 debug layer0x887A002D).Not tested
gpu_uav_companion_srv_and_null_image_views(crates/xcl/src/hle/d3d12x/real.rs:7849-7920on local merge406a280;7219-7290on PR#1914head47e9356) did not execute under Wine/vkd3d-proton v3.1becauseCreateCommandListpanicked atreal.rs:7846:134(local merge406a280;7216:134on PR#1914head47e9356).scripts/smoke.ps1(no retail game files locally), plus the 6XCL_SAMPLE_RPF-gated tests ingpu_pso_e2eandtexture_states(0x887A002D).gpu::recomp::tests::gpu_skippedgpu_sparse_vram_descriptors_buffers_and_xmem,gpu_uma_import_check_at_init, andgpu_unified_memory_arena(pre-existing Wine in-process COM vtable swap).--libmodules outsidehle::d3d12x::realandgpu::recomp::tests::gpu_(such asgpu::dxil), the remaining 10 integration test binaries incrates/xcl/tests/, andXCL_SPLIT_WAVE64=1were not run.AI use