Repository navigation
Conversation
|
Some thoughts on
The clamp is a reasonable stopgap while the source of the raw T# (#575) stays open; these are about making its fallback safe. AI-assisted (Claude Code), read-only review. |
c55352d to
d2fa766
Compare
|
Thanks – all three check out. (Drafted with Claude Code, Claude Opus 5.5.) |
|
Windows NVIDIA run of Tested
For completeness: in a first full AI-assisted (Claude Code). |
|
I tested head d2fa766 on Windows / RX 7900 XT in a local integration. The targeted gpu_image_with_no_heap_index_reads_zero_and_drops_writes test ran on the adapter and passed. For the title test I used the same saved player profile (anaconda), initial application caches, compact PSO preloading and 28 GiB job cap as the baseline. I regenerated both opt-in compute packages against this emitter. Both runs reached world-loading artwork. The baseline exited with DXGI_ERROR_DEVICE_HUNG and a DRED page fault at 0xd000 at 196.172 s. With this PR the same status and GPU VA returned at 166.311 s. Player selection happened at different times. The absolute timings do not establish a speed difference. Neither compact lighting shader had a recorded bind before either failure. The second run traced matching sequences of seven recorded dispatches on two partially completed command lists (6 of 20 operations, next breadcrumb Dispatch). Two of the six distinct programs in that sequence lower to 2D texture loads/samples. Four have no ResourceDescriptorHeap references in their conventional four-window translation. This narrows the inspection set; it does not identify which descriptor caused the fault or contradict the separate RADV result. One independent coverage issue: write_null_views currently creates only Texture2D null SRV/UAV descriptors, while the emitter can select those same indices for Texture3D or TextureCubeArray. Microsoft's null-descriptor rules require compatible view types. VIctory's review also found that descriptor creation and even a zero read on one GPU can pass with the wrong dimension. A test of the emitted slot selection plus a non-2D access under GPU-based validation would cover that path. The two textured candidates above use 2D views, so I am not attributing this particular crash to that dimension mismatch. https://learn.microsoft.com/en-us/windows/win32/direct3d12/descriptors-overview#null-descriptors |
d2fa766 to
550bcd0
Compare
|
Thanks to both. @crosettiremi – right: @upipibi – thanks for the NVIDIA run. Your comment's Linux / RX 9060 XT / Mesa 26.2.6 RADV / Proton Experimental, (Drafted with Claude Code, Claude Opus 5.5.) |
|
Follow-up on 550bcd0, Windows / RX 7900 XT. The expanded dimension-specific null-view GPU test passes on my local integration. There is also a separate in-range case. XCL's null-resource CreateShaderResourceViewX and CreateUnorderedAccessViewX paths write an all-zero guest texture descriptor. The upper-bound check interprets its word 0 as PC heap index zero. In the synthetic compute test I installed an ordinary Texture2D with red=1.25 at slot zero, then loaded through a zero T# and through a valid typed T# for the same index. With the upper-bound check alone the zero T# read 1.25 on lane 0. With a check for zero index and zero texture-type word, the zero T# reads 0 and the valid T# still reads 1.25. Both variants used the same 2D native view, so this is a deterministic alias test without an invalid native access. I am running the corrected emitter with freshly generated packages against the retail load. The isolated test establishes an aliasing defect; the recurring 0xd000 page fault is still under investigation. |
…vall#575) A T# that is still in the console encoding (word 0 = BASE_ADDRESS >> 8, not an XCL heap index) made ResourceDescriptorHeap[tw0] read gigabytes past the shader-visible view heap. On RADV that is an SQC page fault and the device is removed during a retail game's world loading: the faulting VAs were never covered by a BO (RADV_DEBUG=bo_history) and lie past the 1 000 000 x 32 B heap; as T# word 0 they are addresses in the title's own mappings. The shared view heap is now 1 000 000 descriptors on every device (the least a resource binding tier 3 GPU has, which SM 6.6 dynamic resources need), and its last 12 slots are null views that no console heap gets: a null SRV of each texture type recompiled shaders declare (1D, 2D, 3D, CubeArray, 1DArray, 2DArray, 2DMS) and a null UAV of each (1D, 2D, 3D, 1DArray, 2DArray), since D3D12 needs a null view's dimension to match the declaration. Image instructions use word 0 as the view index only below them and when word 3's TYPE is an image type (>= 8); otherwise the null view of the type they declare: such a T# reads 0 and its stores and atomics are dropped. The TYPE check covers the all-zero T# XCL writes for a null-resource CreateShaderResourceViewX / CreateUnorderedAccessViewX, whose word 0 would otherwise be the view at index 0. A 2DMS store or atomic is refused at translation (SM 6.6 has no RWTexture2DMS; DXC refused it before). The bound is a constant (gpu::desc::NULL_VIEWS), so a translation does not depend on the device or on whether the heap existed when it was made, and cached translations stay valid. Test runs with textures get the same heap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SobdMAZZmGnBr71QeZQsUz
550bcd0 to
61df188
Compare
|
@crosettiremi – confirmed: the null-resource Linux / RX 9060 XT / Mesa 26.2.6 RADV / Proton Experimental, (Drafted with Claude Code, Claude Opus 5.5.) |
|
Retail-title test of Tested
Not tested: a second run reaching the new fault, without AI use: T3 Code (Claude Opus 5.5) built both trees, ran the title and wrote this comment from XCL's logs and the kernel log; I checked it before posting. |
|
Regression run of Against the limits in CONTRIBUTING.md: 95 % 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 |
Image instructions in recompiled shaders index
ResourceDescriptorHeapwith T# word 0. When a T# is still in the console encoding (word 0 =BASE_ADDRESS >> 8, not a heap index), the read lands far past the shared view heap. On RADV that is an SQC page fault and the device is removed during a retail game's world loading (details in #575). Such an index now goes to a null SRV / null UAV of the declared texture type, kept at the end of the heap: it reads 0 and its writes are dropped. Where the raw T# comes from is still open (#575). Fixes #575.What is in it (one commit,
61df188)gpu/desc.rs:VIEW_HEAP_SIZE= 1 000 000 (the least a resource binding tier 3 GPU has, which SM 6.6 dynamic resources need). The last 12 slots (fromNULL_VIEWS= 999 988) are null views: an SRV of each texture type the emitter declares (1D, 2D, 3D, CubeArray, 1DArray, 2DArray, 2DMS) and a UAV of each (1D, 2D, 3D, 1DArray, 2DArray), because D3D12 needs a null view's dimension to match the declaration.null_srv(ty)/null_uav(ty)give their slots. Constants, so a translation does not depend on the device or on whether the heap existed yet, and cached translations stay valid.hle/d3d12x/console_heap.rs: the shared heap isVIEW_HEAP_SIZEon every device (no OPTIONS19 size, noGLOBAL_MAX);write_null_viewswrites the 12 null views, each with its dimension (the PC methods on an adopted device); console heaps get slots belowNULL_VIEWSonly.gpu/recomp/emit.rs: a T# is a view whentw0 < NULL_VIEWS - 1and word 3's TYPE is an image type (≥ 8, the testconsole_heap::copy_wordsanddesc::imageuse). MIMG sample / gather / resinfo / load then usetw0, otherwisenull_srv(type); store and atomicstw0 + 1, otherwisenull_uav(type), with the type of the declaration. The TYPE check covers the all-zero T# XCL writes for a null-resourceCreateShaderResourceViewX/CreateUnorderedAccessViewX, whose word 0 would be the view at index 0. A 2DMS store or atomic is refused at translation (SM 6.6 has noRWTexture2DMS; DXC refused it before).gpu/recomp/runner.rs: kernel test runs with textures get the same heap with its null views.gpu/recomp/tests.rs:gpu_image_with_no_heap_index_reads_zero_and_drops_writessamples, loads, stores and runs an atomic through a T# whose word 0 is a console address: it expects 0, and a real UAV next to it holding only its own stores. It fails without the index check (the stray store lands in the real texture). It also samples 3D and cube, loads a 2D array and stores 3D through that T#, and loads through an all-zero T# (expects 0) and a real T# of view 0 (expects the texture); without the TYPE check the all-zero load returns the texture.image_declarations_fall_back_to_the_null_view_of_their_typechecks the emitted null slot per type (fails when every type gets the 2D one).Tested
x86_64-pc-windows-gnu, release.maincb868b2+61df188), withXCL_DXC_DIR:cargo test --release --target x86_64-pc-windows-gnu -p xcl --lib -- --test-threads=4: 643 passed, 4 failed, 21 ignored, noSKIPPED. The failures aregpu_f64_math_random,gpu_f64_roots,gpu_nonfused_mad_and_mac_prevent_fma_contractionandhle::xaudio2::tests::xma2_source_voice_decodes_and_manages_lifetime; all 4 fail the same way onmainon this machine.gpu_image_with_no_heap_index_reads_zero_and_drops_writes: passes; fails with the rawtw0index (and that run faulted the GPU, as in D3D12.X: a T# that is no XCL view indexes ResourceDescriptorHeap with its address bits – RADV page fault (SQC data), device removed during world loading #575). RADV accepts a null view of the wrong dimension, so the per-type part is covered by the text test, not by this GPU run.d2fa766: RTX 3070 / Windows 11 (upipibi) and RX 7900 XT / Windows (crosettiremi): the GPU test passes. Not rerun on61df188.maina6f5f7a+ Linux: docs/linux.md, scripts/linux and Wine start-up checks for vkd3d-proton and DXVK (#154, #241) #257 + Title textures: detile levels a row at a time, not element by element #458 + D3D12.X: unmap sparse tiles after the work the title's queues were given #496 + D3D12.X: tolerate concurrent page decommits in title texture reads #484, with the first version of this PR (c55352d, clamp to the heap's last slot):f4ce27c+ Linux: docs/linux.md, scripts/linux and Wine start-up checks for vkd3d-proton and DXVK (#154, #241) #257 + D3D12.X: unmap sparse tiles after the work the title's queues were given #496 + Recompiler: structured form for programs that needed the pc chain #172 with it had none either. They stop later for other reasons (the title's watchdog during long first-bind shader compiles).Regression run
scripts/smoke.ps1needs Windows (see Not tested).Not tested
scripts/smoke.ps1blocks. Someone needs to run the regression on Windows before this can be merged.61df188itself (the null views replace the last-slot clamp the title runs had).61df188on NVIDIA and Windows AMD drivers (d2fa766passed the GPU test on both, see above). A device whose heap could hold more than 1 000 000 views now uses 1 000 000.AI use
bo_history, wrote the patch, the test, the review follow-up and this description, and ran the tests. I ran the title.🤖 Generated with Claude Code
https://claude.ai/code/session_01SobdMAZZmGnBr71QeZQsUz