Recompiler: guard direct DXIL window stores with bit tests #2278
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2288"
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?
Imported from ivall/xcl. Originally posted by coolpersonnn on 2026-11-25T12:27:42Z.
Part of #2088. Replace the dynamic direct DXIL raw-store switch with a one-hot guard per root UAV window. The mask clears for inactive lanes and out-of-range window indices.
What is in it
lower_mem.rsemits the window guards.core_tests.rschecks the DXIL and GPU readback in wave32 and wave64 across four windows, including inactive lanes and invalid indices.Tested
426a5a7→5e502c5. Median first-use NVIDIA pipeline build time fell 5.0–33.6% on four of five records. The fifth rose 0.47%. The driver caches stayed enabled. Same-layout warm replays took 0.892–3.341 ms. GPU readback passed and synthetic dispatch time fell in both wave modes. Measurements and cache controlscargo build --workspace --locked --offline -j 8passed.cargo test --workspace --locked --offline -j 8 --no-fail-fast -- --test-threads=4 --nocaptureon the RTX 5090 withXCL_SAMPLE_RPFand an isolatedXCL_DXIL_CACHEgave 1,240 passed, 4 failed, 46 ignored and 25 GPU skip notices. The same four fuzz seeds (70, 545, 1019, 1507) failed with0x8007000Eon the clean base.cargo test -p xcl --lib --locked --offline -j 8 raw_stores_in_root_windows_respect_exec_and_bounds -- --nocaptureon the RTX 5090 and Radeon iGPU gave 1 passed, 0 failed, 0 ignored and 0 GPU skips on each.cargo test -p xcl --lib --locked --offline -j 8 -- --test-threads=4 --nocaptureon WARP gave 1,175 passed, 0 failed, 26 ignored and 311 GPU skip notices.Regression run
After the push, both release builds ran
./scripts/smoke.ps1 -Game $RetailTitleFolder -Seconds 60 -Xcl $ReleaseExe -OutDir $SmokeArtifactswithXCL_ADAPTER=5090,XCL_DIRECT_DXIL=1,XCL_HEAP_WINDOWS=0,XCL_PSO_TRACE=1andXCL_FRAME_DUMP=300. Each started with empty XCL caches. NVIDIA implicit caches stayed enabled.Clean main
Clean head
Not tested
AI use
OpenAI Codex (GPT-6, exact variant unavailable) wrote the lowering and regression test, ran the benchmark, tests and smoke pair, and drafted this description.
upstream-sync referenced this pull request2026-11-25 14:08:43 +00:00
Imported from ivall/xcl. Originally posted by GustavoEllwanger on 2026-11-25T13:10:26Z.
Independent dual-GPU Windows verification on exact PR head
5e502c50805e27fa1df1e833e413841f7f122503(parent426a5a7).Tested
1.95.0 (59807616e 2026-04-14), DXC1.8.2502.11, debug build.32.0.16.1088, Blackwell / wave32 + split-wave64):XCL_ADAPTER=5060 cargo test -p xcl --lib gpu::dxil::core_tests::raw_stores_in_root_windows_respect_exec_and_bounds -- --nocapture: 1 passed, 0 failed, 0 ignored (0 skipped).XCL_ADAPTER=5060 cargo test -p xcl --lib gpu::dxil:: -- --test-threads=4: 148 passed, 0 failed, 3 ignored (0 skipped).XCL_ADAPTER=5060 cargo test --workspace -- --test-threads=4: 1244 passed, 0 failed, 46 ignored (27 runtimeSKIPPED: 20 native-wave64 tests on wave32 NVIDIA, 3 per-lane#1426refusals, 2 missing D3D12 debug layer, 1 Developer Mode cache-disable, 1 heap windows).32.0.21042.62, native wave64):XCL_ADAPTER=Radeon cargo test -p xcl --lib gpu::dxil::core_tests::raw_stores_in_root_windows_respect_exec_and_bounds -- --nocapture: 1 passed, 0 failed, 0 ignored (0 skipped; verifies both wave32 and native wave64 paths).XCL_ADAPTER=Radeon cargo test --workspace --no-fail-fast -- --test-threads=4: 1242 passed, 2 failed, 46 ignored (17 runtimeSKIPPED: 7 no mesh shaders, 6 per-lane#1426refusals, 2 missing D3D12 debug layer, 1 Developer Mode cache-disable, 1 heap windows). Both AMD failures are unrelated to this PR:gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1(seed 540: res[833] = 0x7, CPU 0x6) — independently reproduced identically on cleanorigin/main(1a0bbe3) on this AMD driver.gpu::recomp::tests::gpu_image_get_resinfo_past_last_level— this PR's parent426a5a7predatesea088a5(Recompiler: image_get_resinfo past the last level gives 0 sizes on AMD too); independently confirmed passing (1/1) onorigin/main(1a0bbe3) on this AMD adapter.Not tested
scripts/smoke.ps1), Intel GPUs, non-Windows hosts.AI use
5e502c5, ran the focused and full workspace suites on both GPUs, verified the two AMD baseline failures againstorigin/main(1a0bbe3), and drafted this comment from the raw logs.Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-25T13:30:49Z.
Independent Windows/RX 6800M check of exact PR head
5e502c50805e27fa1df1e833e413841f7f122503against its base426a5a745db4d5e4b037449ede0b70cb342f5192.Environment: Windows 11 build 26200; Ryzen 9 5980HX; Radeon RX 6800M driver
30.0.13002.13003; Rust 1.99.0 MSVC; DXC/DXIL 1.9.2609.5.XCL_ADAPTER=6800M,XCL_DIRECT_DXIL=1, and isolated Cargo targets. Both production worktrees are clean. No game data was copied or attached.Focused test:
cargo test --locked -p xcl --lib -j 2 raw_stores_in_root_windows_respect_exec_and_bounds -- --test-threads=1 --show-output, withXCL_REQUIRE_GPU=wave64, exited0xC0000005twice on the PR head before the test harness recorded a pass/fail. In a temporary test-only diagnostic run, the process reachedwave32 before dispatchand crashed inside the firstrunner::run_in_arena; it never reached wave64. Windows Application Error events nameamdxc64.dllversion30.0.13002.13003, fault offset0x43801, in all three runs. The integrated Radeon on this laptop could not serve as a control: this fixture reportedno wave32there underXCL_REQUIRE_GPU=wave64.Base control: I copied only the PR's 48-line fixture to a detached
426a5a7tree and disabled its two PR-specific DXIL-shape assertions so it could reach the same dispatch with the base's original lowering. It also exited0xC0000005; Windows logged the sameamdxc64.dlland0x43801fault. This establishes that the crash is present with the base production code on this driver. I restored both test-only edits afterward. It does not establish correct GPU readback on either revision.Release and owned-title regression run:
cargo build --locked --workspace --release -j 2passed on the clean PR head. Both runs usedXCL_ADAPTER=6800M,XCL_DIRECT_DXIL=1,XCL_HEAP_WINDOWS=0, default smoke script, the same owned title, separate fresh data/cache directories, and a 12-second duration. Neither hit my external process/memory guard.Base:
PR head:
Limits: The focused GPU fixture is blocked by this driver's pre-existing compiler crash, so I cannot confirm its value readback on this card. The brief title run does not show whether it exercised the changed root-window store path; frame counts are not a performance comparison. I did not run the full workspace suite on this head.
AI use: OpenAI Codex (GPT-6; exact variant not exposed in this session) ran the native Windows tests, inspected the Windows fault events, constructed and restored the test-only base control, monitored the paired title runs, and drafted this report. No game files were uploaded.
Imported from ivall/xcl. Originally posted by bielfreedom on 2026-11-25T16:14:39Z.
AMD Windows driver timing for #2288: on the RX 9070 XT, the direct-DXIL window-store guards are neutral in AMD's
CreateComputePipelineState(−0.7 %, within noise). That differs from #2191, the HLSL-path version of the same idea, which made the AMD driver 1.56× slower on this card (data).Setup
426a5a7;5e502c5.fnv64) and per-CreateComputePipelineStatetime.Method
XCL_DIRECT_DXIL=1,XCL_HEAP_WINDOWS=0(root windows, the form this PR changes),XCL_PIPELINE_THREADS=1.XCL_PSO_DISK_CACHE=0and a fresh exe name per run, because the AMD driver cache is keyed on the exe file name.84eee477d68b6fdf(CS_RaytracingResolve) and620491641aa9bad6.Results (means of 2 rounds; all 104 builds succeeded, 0 refused)
426a5a784eee477d68b6fdf: 63.0 → 60.1 s (−5 %);620491641aa9bad6: 19.9 → 18.6 s (−7 %);Tests on this card (
XCL_REQUIRE_GPU=1,XCL_ADAPTER=9070)raw_stores_in_root_windows_respect_exec_and_bounds: 1 passed, 0 failed, no SKIPPED notice. This is the native wave64 discrete-GPU run of it.Read / inference
Not tested
XCL_HEAP_WINDOWS=1.AI use: Claude Code (Claude Opus 5.5) ran the measurements and drafted this. Counts and timings only, no game data.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T17:17:37Z.
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!
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T07:44:02Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T07:45:06Z.
Triage (#1607) – head
5e502c5No open or merged PR makes the same change. Main's
with_mem_many_tysingpu/dxil/lower_mem.rsstill dispatches multi-window accesses with aswitch. #3283 (NaN handling in float min/max memory atomics) and #1439 (window switches in the HLSL path,recomp/emit.rs) change other code. The new path handles onlyout_tys.is_empty()(stores and atomics that return nothing). It applies thew < ncheck before testing the one-hot bits, so out-of-range windows cannot alias a valid bit. No problems found in the diff.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.