Repository navigation
Dxil/guard wave64 graphics cache - #1
Open
mokkamokacaffe wants to merge 585 commits into
Open
mokkamokacaffe wants to merge 585 commits into
mokkamokacaffe wants to merge 585 commits into
Conversation
mokkamokacaffe
force-pushed
the
dxil/guard-wave64-graphics-cache
branch
5 times, most recently
from
November 25, 2026 01:16
51738bb to
cf70b66
Compare
In the split wave64 form, an instruction the per-lane form lowers through xcl-dev#1426's semantics (a float compare, a carry-out, v_cmpx) builds its mask with Lw::write_mask. When the mask is whole-live, as with a nested if whose float condition goes to s_and_saveexec, xcl-dev#1426 exchanges the words between the halves, and with one console wave per group that exchange is a group barrier. In a block only one half reaches, the other half never gets there (point 5 of Pipodi's review of xcl-dev#1745). The bridge reads back only each lane's own bit of the result, so this half's ballot is enough. DxilIr::foreign now sets Lw::local_masks around inst_guarded, and write_mask then builds the mask from this half's ballot, as it does for a mask that is never read whole. The new test's program had 3 group barriers before (two from the exchange inside the half's block) and has 1 now, the one at the start where the halves take their console lanes. Only XCL_PER_LANE=1 reaches this code.
In `crates/xcl/src/gpu/dxil/lanes.rs`, `Lw::ballot` called plain `WaveActiveBallot` even in pixel shaders (`self.gfx` with `ps: Some(_)`). Under SM 6.6, `WaveActiveBallot` excludes helper lanes, whereas `Lw::rla` already uses quad reads for pixel shader helper lanes and the HLSL path uses `ballot_px` / `quad_bits` + `ballot_px_quad` (PR xcl-dev#134 / xcl-dev#105 item 1). After `s_wqm_b32`/`s_wqm_b64`, dropping helper-lane bits from compare masks corrupted `v_cndmask` / `s_and_saveexec` values read via DPP quad derivatives and caused `v_readfirstlane` waterfall loops to spin until the loop budget. Port both parts of xcl-dev#105 item 1 and xcl-dev#134 to the direct DXIL translator: - Split `Lw::ballot_ps_quad(q)` out of `Lw::ballot_ps(cond)` in `crates/xcl/src/gpu/dxil/lanes.rs`: four `WaveActiveBallot` passes spread each quad member's bit `p` from live lanes back to bit `4k + p`, preserving the wave32-in-wave64 `gfx_half` select, constant-false `(0, 0)` short-circuit, and live-lanes-only entry `EXEC` (`setup_pixel` calls `gfx_common_init` before setting `self.gfx`). Non-VOPC PS masks (such as `v_add_co_u32` carries) route through `ballot_ps` -> `ballot_ps_quad`. - In `crates/xcl/src/gpu/dxil/lower_valu.rs`, evaluate plain pixel-shader VOPC compares per quad member (`p in 0..4`) by quad-reading VGPR source operands with `QuadReadLaneAt` (leaving SGPRs such as `v_readfirstlane` results and constants wave-uniform) and feeding the 4-bit quad mask to `Lw::ballot_ps_quad`, avoiding `QuadReadAcross*` on compare predicates that crash AMD RDNA2/3/4 `amdxc64` (xcl-dev#134). Add CPU/DXIL-validator and CI-WARP-safe GPU draw regression tests in `lanes.rs` (384/1024 wrong pixels pre-fix on RTX 4060 -> 0/1024 post-fix for both wave64 and wave32 pixel shaders, with zero `dx.op.quadOp` in VOPC pixel shaders). Part of xcl-dev#1269 Assisted-by: Google Antigravity (Gemini 4 Neon)
The stream reader's payload table (subobject_payload) had no test: a wrong size or alignment silently mis-parses every pipeline stream. Pin each known type to the windows crate's constant and the header struct's own size and alignment, and pin that 23 is unknown - the console's mesh numbering puts AS there and mesh at 24 (the PC's AS), the shape real.rs takes as a mesh-only pipeline. Part of the validation line claimed on xcl-dev#1269. Co-Authored-By: Claude Code <noreply@anthropic.com>
When sparse UMA is exhausted, AllocateTitlePhysicalPages fell back to u.alloc in the committed coherent window without respecting the 96 MiB KEEP headroom in VirtualAlloc, and created non-lazy homes that cannot be decommitted when mapped elsewhere. Skip the coherent u.alloc fallback when u.has_sparse() is true so overflow goes straight to MEM_RESERVE plain memory (keeping u.alloc only for coherent-only layouts), and add synthetic unit tests. Part of xcl-dev#1566 Assisted-by: Antigravity (Gemini 4 Neon)
Updated Discord link and text in README.
It goes on from its menus into its 3D world with the NVIDIA integration branch (xcl-dev#2057): 14 fps on average over a 5-minute run on an RTX 5090 (4307 frames in 300 s), about 5 fps in its heaviest scene. The 65 % is an estimate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… works A banner, a card with the newer retail game's numbers and icons, drawn for this repository (assets/readme, SVG: no fonts, logos, game art or screenshots); links, the steps from a checkout to a running game, a diagram of how XCL works, and the long tables and switches folded. The text of the README is kept; the Discord link works again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
README: a front page, and the newer retail game's state (about 65 %, 14 fps on average)
A line that starts with "+" is a list item in Markdown: GitHub showed the rest of the requirements paragraph as a bullet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A compute program whose HLSL is longer than 8 MB is compiled by DXC at -O0 (the safety net in dxc::compile_here), and the unoptimised DXIL is left for the driver to optimise. A retail title's fully unrolled screen-probe passes (up to 88 863 RDNA2 instructions: one block of ~27 repeated ~3 280 times) become 15 - 30 MB of HLSL. On an RTX 3090 the NVIDIA driver did not finish building one: on main 6987e49 the 30 MB one was stopped at 23 GB after 451 s, and the title ran the machine out of memory (40 GB working set) when it bound the pipeline. -O1 is no way out: 10.5 min of DXC, 5 GB, still 14.7 MB of DXIL. The direct DXIL translator (gpu::dxil::kernel, opt-in with XCL_DIRECT_DXIL) translates the same programs in seconds, and with the compact form of xcl-dev#2034 two of them shrink to under 0.5 MB: ActivateProbes HLSL 30.3 MB -> 473 KB, driver 11 s, 1.6 GB ActivateProbesTarget HLSL 30.2 MB -> 432 KB, driver 11 s, 1.5 GB ActivateRays HLSL 15.0 MB -> 3.8 MB (plain form), 21 min, 8.3 GB So a compute program whose HLSL would be compiled unoptimised (dxc::UNOPTIMISED_ABOVE, now shared with compile_here) is translated by the direct translator; where that fails, the HLSL path goes on as before. Its translation-cache entry is kept under its own identity, which follows what the direct translator's output depends on (its version and sources, a forced compact form, the per-lane form), since the HLSL path's identity does not hash the gpu/dxil sources. TRANSLATION_GLUE_REVISION is bumped: an HLSL-path entry of such a program cached before this change would otherwise still be found. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NmY9ce9uQcXiFj5qSSBfmV
README: the requirements' DXC line is not a list item
…hex, and fssm export
A per-lane translator refusal is a skipped subcase, not missing mesh or wave64 hardware. Print the existing SKIPPED diagnostic directly so XCL_REQUIRE_GPU continues to guard hardware coverage without turning unsupported instructions into test failures. Part of xcl-dev#1651. Assisted-by: OpenAI Codex (GPT-6)
PC D3D12 does not allow submitting a command list whose previous execution the GPU has not finished (debug layer id 553: "the command queue fence has not advanced past previous executions of the command list"); a console lets a title do it. With the debug layer on, the retail title's world load shows id 553 from 85.8 s, then cross-queue waits that stop one signal short, then the device removal (xcl-dev#1452). alloc_pool::executed signalled a per-queue fence after submits of the lists it tracks (title lists). It now does so after every submit, so the PC lists behind console lists are covered too, and remembers each list's last submit (queue, fence value, recording number). note_resubmits, called before each ExecuteCommandLists chunk, logs a list whose previous submit is still running: whether it is the same recording and the same queue (the first 8, then at powers of two). The only change besides the log is that extra fence signal on submits of untracked lists. Part of xcl-dev#1452. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DIM 1D and 2D queries declared a Texture1D / Texture2D handle over the multisampled view an MSAA T# (TYPE 14 / 15) binds, so the level count was the host's: 1 on native D3D12, 3 for 4 samples on RADV through vkd3d-proton (log2(samples) + 1), which failed gpu_image_get_resinfo_dim_2d_of_an_msaa_tsharp on an RX 7900 XT. Both paths now branch on the T#'s TYPE and query an MSAA T# through Texture2DMS / Texture2DMSArray, giving (width, height, 0, 1), as RDNA2 does (AnyPS5 docs/dev/debt/shader.md, gfx1036: DIM 1D, 2D and 2D_MSAA on 2D MSAA and MSAA-array T#s). DIM 1D now reports the height there too. The test covers DIM 1D and 2D on a 4-sample T# and a 4-sample array T#. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Use xcl::gpu::recomp::runner::skip_test on the missing-GPU branch so XCL_REQUIRE_GPU enforces GPU presence and scripts/test.ps1 counts the skip. Write the two missing-debug-layer skip notices directly to stderr so scripts/test.ps1 captures them without breaking XCL_REQUIRE_GPU on GPUs lacking Graphics Tools. Assisted-by: Antigravity (Gemini 4)
…k exit status Use a TempDir RAII drop guard with a CARGO_TARGET_TMPDIR PID/timestamp/atomic-nonce helper across all e2e tests so parallel runs do not collide and temporary directories are always cleaned up on drop. Write debug-layer skip notices directly to std::io::stderr() so libtest output capture does not hide them from scripts/test.ps1, and assert out.status.success() with stderr included in failure messages. Assisted-by: Antigravity (Gemini 4)
…nd-heap-info Tests: compare GetResourceAllocationInfo and GetCustomHeapProperties against host D3D12 driver
…d-cmd-sig-parity-480 Tests: compare CreateQueryHeap and CreateCommandSignature against hos…
…esource-parity-480 Tests: compare CreatePlacedResource against the host D3D12 driver
…d-resource-parity-480 Tests: compare CreateCommittedResource against the host D3D12 driver
…or-heap-and-fence-parity-480 Tests: compare CreateDescriptorHeap, increment size and CreateFence a…
…objects-and-rootsig-parity-480 Tests: compare command objects and CreateRootSignature against host D…
…eap-descriptor-contract-185825 Tests: console descriptor heap slot/copy/unregister contract
…out-table-and-chain-invariants-181008 Tests: pin the generated D3D12 layout table invariants
…h-lock-poison Tests: a failed copy scratch check no longer aborts the lib test binary
…late-release Tests: wait for the late release before freeing the coherent buffer test's heap (xcl-dev#1487)
…pu-validation Tests: honor the selected adapter in the indirect argument test
…windows-only Tests: assert the refused depth-buffer UAV state on Windows only
Tests: pin the pipeline stream subobject table to the PC headers
…ed-resource Tests: compare CreateReservedResource against the host D3D12 driver
…-queue-parity Tests: verify D3D12.X console queue descriptor translation
…ard-thunks-and-game-caller-routin-164822 Tests: verify D3D12.X guard, split, and tracer thunks for game callers
The host-driver tests of xcl-dev#1612, xcl-dev#1578 and xcl-dev#1613 required the driver to refuse invalid descriptions. vkd3d-proton accepts some of them, and XCL answers as it does, so the tests failed under Wine on the driver's answer and not on XCL's. They now compare XCL with the driver, and still require the refusal on Windows. The null-description step of xcl-dev#1608 does not run under Wine, where vkd3d-proton dereferences it and the process ends. The console heap tests of xcl-dev#1687 returned in silence without unified memory; they report a skip now.
Tests: host comparisons take the driver's own answer under Wine
Tests: compare extra-page tiles when an unaligned va is placed again (xcl-dev#718)
Since 0829441 the chains of one PC list share a scratch, and all recordings together are bounded by XCL_SPLIT_SCRATCH_TOTAL_MB. Each dispatch put off to the submit records on a PC list of its own, so each made a new buffer: up to 256 MiB while the total had room, then 2 MiB each, past the bound. They stayed under the list's own allocator until the next submit that put a call off reset it. The segment recorded after another at the submit now goes on in its scratch, as a chain after a chain on one list does (with the UAV barrier that chain records), and the list's own allocator is reset at its next Reset once the GPU is done with it. Found by pvfreis, reading xcl-dev#2118 on main 68a284a. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ss_tests Tests: verify heap-window GPU equivalence and graphics validation
…rrectness Recompiler: load direct DXIL geometry ES inputs from the heap window
…efer D3D12.X: a dispatch waits for its pipeline at the submit, not in the bind
Recompiler: flatten direct DXIL root-UAV loads for compute
README: the switches for a bug report's diagnostics
DXC: compute programs are linked with their memory accessors (window switches no longer dominate DXC time)
fixgep
pushed a commit
that referenced
this pull request
Nov 28, 2026
Since the previous commit a stencil UAV of a depth buffer with unordered access is a view of the buffer's R8 twin, but the title still clears it with the depth buffer as the resource. The PC clear then gets a view and a resource that differ, an invalid pair, and the twin keeps what it held. list_x::clear_uav takes the GPU slot once, before uav_clear_handles. Behind depth_uav::any() (one atomic load: no twin alive, nothing changes), it asks depth_uav::clear_target with what the slot's UAV names in the shared heap (console_heap::names_of; None when the slot has no place there): - the view names a twin of the buffer: the PC clear gets the twin as its resource, counted as a clear of a twin; - the slot is not in the shared heap, or the handles are PC handles: what the view names is not known, so the clear is not done, and counted; - a null view, another resource, a buffer without a twin, or a resource XCL does not keep: as before. The decision is a pure function (clear_choice) over the Cell's twins. Console-recorded lists are not changed (a later commit). Tests: the_resource_of_a_uav_clear_is_what_the_view_names (no GPU: twin named, null view, another resource, slot outside the shared heap, buffer without a twin, a buffer not kept); gpu_clear_uav_of_a_stencil_uav_clears_ the_twin on WARP in a child process with XCL_DEPTH_UAV_TWIN=1 and the shared heap: a stencil UAV of a 16x16 console D24S8 buffer, then clear_uav_uint_x with the slot's console handles and the depth buffer as resource on an adopted list; one clear is counted on the twin and all 256 texels of the twin read back 0x5A. The child was also run directly: it made twin #1 and printed no SKIPPED. The child-process launcher and the device / heap / buffer / DSV setup of G1 became a shared fixture; G1's assertions are unchanged. cargo check -p xcl --tests: no new warnings. cargo test --release -p xcl --lib on the software adapter: depth_uav 9 passed, list_x 29 passed, real 80 passed, 0 failed, 0 ignored (56 tests that open the hardware GPU not run). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fixgep
pushed a commit
that referenced
this pull request
Nov 28, 2026
A ClearUnorderedAccessView* recorded on a console-recorded list (XCL_CONSOLE_LISTS) is replayed into the PC list when the list closes. The replay passed the title's resource, the depth buffer, together with the slot's PC UAV, which with XCL_DEPTH_UAV_TWIN=1 is a view of the buffer's twin: the invalid view/resource pair the direct list's clear no longer makes. The first run with the twins on would have met it on such a list, and the twin would have kept stale values. The direct list's rule moves into list_x::uav_clear_resource and the replay uses it as well: the twin when the slot's view names it, nothing (counted as skipped) when what the view names is not known. The plan left this to a later commit; it is taken now because that run uses the switch. The GPU test of the clear also checks what the PC method receives: it calls the console method on a stand-in of the list whose PC xcl-dev#49 notes its resource and goes on to the list's own. Before, it counted XCL's decision only, and the readback would pass with the depth buffer as the resource too, because the clear goes through the slot's descriptor. A clear through the buffer's depth-plane UAV, a null view, is not done and reaches nothing. Tested: real::depth_uav_twin_tests::gpu_clear_uav_of_a_stencil_uav_clears_the_twin (WARP, child process; run on its own it made twin #1 and printed no SKIPPED line). The replay itself is not driven by a test: a console list closes only with unified memory open on a GPU. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fixgep
pushed a commit
that referenced
this pull request
Nov 28, 2026
…tch off The tests of depth UAV twins made their buffer with CreateCommittedResource, which on WARP gave a committed PC resource with no title address. The path a console depth buffer most likely takes was not covered: CreatePlacedResourceX at a title address (the registration hooks in device_x::create_placed_resource_x, the key by vram::canonical_va) and a stencil UAV made by address (device xcl-dev#71), which is made on XCL's own object at that memory. Nor was it asserted in the library's process that with the switch off nothing is registered and a UAV stays a null view. - gpu_a_stencil_uav_by_address_is_a_view_of_the_placed_buffers_twin (WARP, child process): the title places a 16x16 D24S8 buffer with ALLOW_DEPTH_STENCIL | ALLOW_UNORDERED_ACCESS at an address in unified memory, in DEPTH_WRITE. It is kept under that address with that state; a xcl-dev#71 stencil UAV of the same memory, on a second object there, names the placed buffer's twin in the shared heap, and the state stays the title's. Run on its own, the buffer went to a video-memory arena, the view's object aliased it, and twin #1's line gave state 0x10. - the_switch_decides_whether_a_buffer_is_kept_and_its_uavs_redirected (no GPU): note_created keeps the buffer only when the switch is on; off, resolve_uav gives a null view with the reason "XCL_DEPTH_UAV_TWIN is off". Tested: the depth_uav tests, 13 passed, 0 failed, no SKIPPED line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is in it
Fixes xcl-dev#1895.
upper_lanesimplementation when a wave64 graphics shader reads data from lanes 32-63 that Direct DXIL cannot represent in a 32-lane wave.xcl shaders --direct, keeping coverage results consistent with runtime routing.XCL_DXIL_NO_OPTis set, so diagnostic, deliberately unoptimized DXIL cannot poison later normal runs.Tested
git diff --checkdirect_graphicsandneeds_upper_lanes.The current Linux workspace does not contain Cargo/Rust or the Windows D3D12/DXIL toolchain, so Rust unit tests and DXIL validation were not run here.
Regression run
Not run: this change needs the maintainer's Windows/GPU smoke pass on both this exact head commit and its
mainbase. Please applytest-onlyuntil those two matchingxcl-smoke v1blocks are available.Not tested
AI use
OpenAI Codex was used to inspect issue xcl-dev#1895 and current source, implement the routing/cache guard, add focused tests, and perform source-level validation. No generated test results or hardware claims are included.