Revert "Recompiler: eliminate local array and branches in pixel-shader PRELUDE::rla()" (#2247) #2929
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2929"
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 Decodere on 2026-11-27T00:29:43Z.
Clean revert of #2247 (
5081dc8b6e22fc74f6fe7d31de333182e8f7ec92, merged in2898511), restoring the exact pre-#2247PRELUDE::rla()implementation incrates/xcl/src/gpu/recomp/emit.rs.Reverts #2247
Related to #1452
In #1452#issuecomment-7205972665,
@SergeAxbisected 140 first-parent merges onmain(568e7db..b49be18) on an RTX 5080 (NVIDIA driver 621.14, Windows 10 22H2) and isolated #2247 (2898511) as the first commit introducing0x887a0005(DEVICE_REMOVAL_PROCESS_NOT_AT_FAULT) during retail world load (f9f6d49/ #2257:0/4removals;2898511/ #2247: removed). Confirmation onb49be18+ #1435 hit6/7device removals with5081dc8bpresent versus0/5removals with only5081dc8breverted.Note on branch ancestry:
5081dc8bis also an ancestor oforigin/nvidia-dev(ecc0bb57) andorigin/amd-dev(bf7c82ee), so maintainers may want to cherry-pick or merge this revert into those branches once landed onmain.What is in it
git revert 5081dc8b6e22fc74f6fe7d31de333182e8f7ec92(crates/xcl/src/gpu/recomp/emit.rs,+6/-127lines):xcl_lv[min(h >> 5, 3u)], scalar?:forq/r, and theif (nib != 0u && ...)/if ((l >> 2) == ...)guards in pixel-shaderPRELUDE::rla().#2247-specific branchless-rla()unit tests added by5081dc8b, leaving all otheremit::tests::andgpu::recomp::tests intact.Tested
rustc 1.100.0(stable-x86_64-pc-windows-msvc), DXC1.9.2609.5, debug (WARP) and release (RTX 4060).cargo clippy --all-targets -- -A clippy::approx_constant: exit 0, 0 new warnings and 0 errors incrates/xcl/src/gpu/recomp/emit.rs.XCL_WARP=1):cargo test -p xcl --lib -- gpu::recomp::emit::tests:: --nocapture --test-threads=1: 1 passed, 0 failed, 0 ignored (0 skipped).cargo test -p xcl --lib -- gpu::recomp:: --test-threads=4: 398 passed, 0 failed, 20 ignored (23 expectedSKIPPEDnotices: 20 wave64, 3 per-lane refusals).cargo test --release -p xcl --lib -- gpu::recomp::emit::tests:: --nocapture --test-threads=1: 1 passed, 0 failed, 0 ignored (0 skipped).cargo test --release -p xcl --lib -- gpu::recomp:: --test-threads=4: 398 passed, 0 failed, 20 ignored (23 expectedSKIPPEDnotices: 20 wave64, 3 per-lane refusals).cargo build --release --workspace && cargo test --release --workspace --no-fail-fast -- --test-threads=4: 1439 passed, 0 failed, 47 ignored across 37 top-level test targets (29 expectedSKIPPEDnotices: 21 wave64, 3 per-lane refusals, 3 D3D12 debug layer, 1 heap-window fallback, 1 Windows driver-cache toggle).git merge-tree --write-tree origin/main HEADexits0against liveorigin/main(8b957bec).Regression run
Paired quiet 60 s release runs (
scripts/smoke.ps1 -Seconds 60,XCL_NETWORK=0, default flags, RTX 4060 8 GB, driver 621.14) on exact parent onmain(e120925e, ancestor of8b957bec) and revert head (a87d3c2a):Exact parent on
main(e120925e, ancestor of8b957bec):PR (
a87d3c2a):Not tested
@SergeAx's RTX 5080 (Blackwell, Win10 22H2) world-load0x887a0005removal from #1452 (#1452#issuecomment-7205972665already verified0/5removals with5081dc8breverted vs6/7without it).d3d12SDKLayers.dllnot installed), and Linux / Wine / vkd3d-proton.AI use
5081dc8bbranch ancestry (main,nvidia-dev,amd-dev), prepared the cleangit revertcommit offe120925e, ran clippy, Debug WARP + Release RTX 4060 unit/recompiler/workspace suites and paired 60 s retail smokes on the hardware above, and drafted this PR description.Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-27T01:00:40Z.
Tested
Clean PR head
a87d3c2ac52bac1e7d2df4e6050171fb2dee0887and parente120925e3abc9956a8b9bae631969d32e8ccd43con Intel Arc A770 driver 32.0.101.9175, Windows 11 build 26200, Ryzen 7 3800X, Rust 1.100.0 MSVC and DXC/DXIL 1.9.2602.17. Built withcargo test -j 2 --locked -p xcl --lib --test console_shaders --no-run --message-format=jsonusing separate target directories,CARGO_PROFILE_TEST_DEBUG=0andCARGO_INCREMENTAL=0.With
XCL_ADAPTER=A770, ran the libtest executable with--exact --nocapture --test-threads=1for each of the following checked-in synthetic tests under the shared Arc mutex.gpu::recomp::tests::gpu_ps_masks_hold_helper_lanes_on_triangle_edgesgpu::recomp::tests::gpu_ps_readfirstlane_loop_on_a_primitive_edge_endsgpu::recomp::tests::gpu_ps_mask_loop_on_a_primitive_edge_endsgpu::recomp::tests::gpu_ps_helper_lanes_see_ballots_and_quads_are_lanes_4kAll four passed on both revisions, with zero failures, ignores or skips. The derivative and loop cases reported no pixel mismatches. The ballot/quad test matched the expected layout across 1,024 pixels and ballot values in the tested helper neighbors. The parent-only
gpu::recomp::emit::tests::gpu_rla_pixel_shader_matches_reference_including_helper_lanesalso passed all 1,024 pixel assertions.Not tested
Retail crash, performance, native wave64 hardware, full workspace suite and retail smoke.
AI use
T3 Code / Codex (
gpt-6.2-solfor the worker run) built and ran the fixtures. Codex in the coordinator session reran the four shared GPU tests and the parent-only control and drafted this report.Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-27T01:03:49Z.
AMD and RTX 3060 run, moved here since #2930 closed as a duplicate. Its diff is byte-identical to this one (
a87d3c2), so the results apply here.Tested: pass, the diff applied on
main8b957be, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, DXC 1.9.2602.17,XCL_DIRECT_DXILunset (the HLSL path), card picked withXCL_ADAPTER.cargo test -p xcl --lib -- gpu:: --test-threads=4 --nocapture,mainand the revert one after the other on each card:main708 passed, 2 failed, 6 SKIPPED; revert 705 passed, 2 failed, 6 SKIPPED. The 2 failures arefuzz_validate_and_gpu_1and_3(#2115), the same onmain.main710 passed, 0 failed, 24 SKIPPED; revert 707 passed, 0 failed, 24 SKIPPED.On both cards the only differences are the three #2247 tests the revert removes. The SKIPPED sets are the same. This doesn't touch the Blackwell world-load removal; I have no RTX 50 card.
Not tested: a title run, an RTX 50 card, Windows 10, release, Intel.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
Imported from ivall/xcl. Originally posted by throny on 2026-11-27T01:48:25Z.
Testing this now on
nvidia-dev(ecc0bb57+ #684 + #2794, RTX 4080 16 GB, driver 621.40): the revert applies cleanly there, shaders are being re-translated for it, then two world runs against two runs of the same build without it. On this head our device losses (0x887a0005, no DRED breadcrumbs) came 147 s and 588 s after the first frame; details in https://github.com/xcl-dev/xcl/issues/2688#issuecomment-7207394587. I will post the four results here and on #1452. AI use: Claude Code (Claude Fable 5.2).Imported from ivall/xcl. Originally posted by SergeAx on 2026-11-27T01:49:04Z.
Test report:
a87d3c2aon the RTX 5080 from #1452: no device removal in 5 of 5 runs. All of them passed the world-load step at 99–128 s and ran to 240 s without a crash.Tested
a87d3c2awith #1435's14c8a2dcherry-picked (461eddc8; #1435 only changeshle/xg.rs, for the title's crash at ~98 s in #662),cargo build --release -p xclXCL_PRESS_A_AT=20,24,…,140 XCL_DRED=1 XCL_NETWORK=0, warm caches:mainb49be18with #1435 lost the device after the step in 6 of 7 runs.b49be18with #1435 and this revert, whoseemit.rsis identical toa87d3c2a's, lost it in 0 of 5.Not tested
e120925e(this PR's base) with #1435 but without the revert; the removal rate above is fromb49be18, 3 merges olderAlso on
nvidia-dev, which still contains #2247:ecc0bb57+ this PR's commit + #1435's14c8a2d(9ff0bc8a), same machine, release.XCL_PREPARE=0 XCL_DRED=1 XCL_NETWORK=0and the same presses: 1800, 600, 1800, 240 and 240 s, the two short ones withXCL_PAGE_MAPPINGS=0orXCL_DISPATCH_LOOP_BUDGET=0.mainruns above, and less than in @throny's runs here, which kept drawing withXCL_GFX_PSO_WAIT_MS=200and still lost the device with the revert. These runs do not contradict that.XCL_GFX_PSO_WAIT_MS=200is going now; I will add how it ends.nvidia-devwithout this commit on this card.AI use: Claude Code (Claude Opus 5.5) built the tree, ran the title unattended, read the logs and wrote this report.
Imported from ivall/xcl. Originally posted by throny on 2026-11-27T03:34:55Z.
Result on
nvidia-dev(ecc0bb57+ #684 + #2794), RTX 4080 16 GB, driver 621.40, Windows 11 26300, 64 GB RAM without a page file - same save,XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_GFX_PSO_WAIT_MS=200 XCL_TEXTURE_LEVEL_PAGES=1 XCL_CS_PSO_WAIT_MS=200, up to 700 s from the first game frame, shaders re-translated for the revert (12,101 pixel shader records in 26 min, 0 errors):So with the revert the title lived more than twice as long in both runs, but one of the two still lost the device (again without DRED breadcrumbs, see #2920, and without an Aftermath dump). Two runs a side is thin: it agrees with the bisect in #1452 in direction, and it shows that on this card the revert alone is not the whole story. In the longer runs the next limit is commit: 45.6 GB at 352 s and 51.7 GB at 265 s, against about 40 GB at 150 s in the runs without it.
I can add runs if a larger sample helps the decision here; say how many. Numbers are from the logs of these runs. AI use: Claude Code (Claude Fable 5.2) ran the tests and wrote this.
Imported from ivall/xcl. Originally posted by throny on 2026-11-27T04:55:59Z.
More runs, same setup as the table above: without the revert a third run lost the device at 146 s (so 147, 156, 146 s). With the revert, two further runs on
a5e2d851that also carried a portedXCL_CHAIN_WHOLE=1prototype lost it at 212 s and 202 s (so 352 s, not within 265 s, 212 s, 202 s). The revert still roughly doubles the time to the loss here and does not remove it; the last two differ from the first two by the extra switch and the newer base, so they are not a clean repeat. AI use: Claude Code (Claude Fable 5.2).Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-11-27T16:12:38Z.
Tested on AMD / Linux:
a87d3c2a(RX 9070 16 GB, RDNA4, Mesa 26.3.1 RADV; Ryzen 5 9600X, 32 GB; CachyOS; Proton Experimentalexperimental-11.0-20261112with vkd3d-proton masterec207194plus a local patch dropping thelpVtblchecks of command allocators and lists; DXC 1.9.2609.5; Rust 1.96.0,x86_64-pc-windows-gnudebug build, tests run under Wine)The head as it is (base
e120925e), withmainf9a0cb80the same session as the baseline.Tests (
XCL_REQUIRE_GPU=wave64)cargo test -p xcl --lib -- gpu::recomp::emit::tests:: --test-threads=1: 1 passed, 0 failed, 0 ignored.cargo test -p xcl --lib -- gpu::recomp:: --test-threads=1: 395 passed, 3 failed, 20 ignored; the 3 (f32_programs_on_the_gpu,f64_programs_on_the_gpu,gpu_nonfused_mad_and_mac_prevent_fma_contraction) fail onmainhere too.cargo test --workspace --no-fail-fast -- --test-threads=4with--skip compositor_blends_ui_plane_over_scene_plane --skip failed_restore_stops_before_importing_an_unbacked_window --skip grooming_leaves_a_window_under_1_gib_only_its_hole(here the first loses the RADV device, the other two run out of memory under Wine): lib 1303 passed, 8 failed, 27 ignored;mainf9a0cb80lib (--test-threads=1, same skips): 1323 passed, 9 failed, 27 ignored. All failures are amongmain's. The other binaries fail the same 3 tests as onmain(e2e,pls_quota,predication_e2e).d3d12_resource_and_sync: its fence and queue test ended the process here, as it does onmainand most other trees in this setup.Not tested
AI use
Imported from ivall/xcl. Originally posted by throny on 2026-11-27T16:21:06Z.
Update to my test above, relevant to whether this revert is needed: on my card the removal was the shader-heap limit (#2403), not #2247. After the NVIDIA profile for
xcl.exewent from a 1 GiB to a 2 GiB shader heap, builds without this revert stopped losing the device here:nvidia-devwithout the revert, 5 runs (the ones above)nvidia-dev3f39671d/d1be8103without the revert, 9 runs of 420-600 sWith DRED working (#2967) every one of the 1 GiB removals read the same: device state 0, no page fault, no list in flight, and the amount of pipeline code built at the removal was the same whether it came after 145 s or 588 s (details on #2688 and #2403). So my earlier "the revert doubles the time to the loss" is better explained by the revert changing how fast pipeline code accumulates than by #2247 causing a fault. I have no evidence on this machine that #2247 is wrong.
Two things for whoever decides on the merge: the revert undoes #2247's removal of a local array and branches in the pixel shaders that call
rla()(its message says 7,634 of 12,056 in this title), with no measurement here of what that costs; and it changes a translator source, so every tester re-translates all shaders afterwards. @SergeAx's bisect on the RTX 5080 was on driver 621.14 and, as far as I can see, without a raised shader heap: a rerun of the bad commit with a 2 GiB profile (xcl nvprofile install --mb 2048from #2590) would show whether it is the same limit there.Numbers are from the logs of these runs. AI use: Claude Code (Claude Fable 5.2) ran the tests and wrote this; a Claude Sonnet 5.5 sub-agent compared the revert with the original commit (it is exact).
Imported from ivall/xcl. Originally posted by throny on 2026-11-27T16:25:23Z.
Merge status (I have been asked to prepare merges of PRs with several independent tests; the bar is: no open critical finding or performance regression, a fresh check of the merge result against today's
main, and green required checks. Each merge is still confirmed by a person.)Not proposing this one for merging at the moment, for the reasons in my comment above: on the machine where I measured it, the removal turned out to be the shader-heap limit and is gone without the revert, and the revert undoes an optimisation in most pixel shaders without a measurement of the cost. The revert itself is exact (compared line by line with
5081dc8b). What would change my reading: a rerun of the bisect's bad commit with the 2 GiB profile that still loses the device, or frame-time numbers showing the revert costs nothing.AI use: Claude Code (Claude Fable 5.2).
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T16:28:38Z.
Thanks @throny for running
#2967DRED and isolating the1 GiB -> 2 GiB#2403shader-heap ceiling.Agreed — holding
#2929(do not merge) pending @SergeAx's RTX 5080 retest withxcl nvprofile install --mb 2048. If raising the shader-heap cap to2 GiBresolves the issue there cleanly without regressing#2247or shader caches, we will happily close#2929.AI-assisted response (
Decodere): engineering decision/comment reviewed by maintainer-directed testing context.Imported from ivall/xcl. Originally posted by SergeAx on 2026-11-27T20:50:45Z.
Retest on the RTX 5080 with a 2 GiB shader heap: no device removal in 7 of 7 runs of the bisect's bad tree without this revert. So here, too, the removal was the #2403 limit, not #2247. As @throny suggested above.
Setup: the same machine, title and runs as in the bisect.
b49be18+ #1435 (9336fbab), without this revert, release.XCL_PRESS_A_AT=20,24,…,140 XCL_DRED=1 XCL_NETWORK=0and warm caches.xcl nvprofile install --mb 2048from #2590 (2f131757), run once in an elevated prompt.xcl nvprofile statusread the driver's default 512 MB, so the bisect ran at 512 MB, not 1 GiB.b49be18+ #1435 (bisect)b49be18+ #1435A correction to my
nvidia-devaddendum above: a later run ofnvidia-dev+ this revert + #1435 did lose the device.XCL_PREPARE=0and the default heap.nvidia-devthe revert didn't prevent it here either.Not tested:
nvidia-devwith the 2 GiB heap.AI use: Claude Code (Claude Opus 5.5) built the trees, read #2590's NVAPI code against NVIDIA's headers, ran the runs (unattended; I ran the elevated install), read the logs and wrote this.
Imported from ivall/xcl. Originally posted by Aniseto on 2026-11-28T08:07:45Z.
Ran the recompiler suite at
a87d3c2aon an NVIDIA Blackwell desktop part:Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build.
All 398 tests pass with 20 ignored. There were 23
SKIPPEDnotices: 20no wave64, two for per-lane f16/f32 forms refused, and one for a const-mask wave64 form; these are expected on a 32-lane-only card and are not counted as coverage. The thread has runs on RTX 5080, RTX 4080, RTX 3060 and AMD, but no 5070 Ti; this adds a second Blackwell datapoint with driver 32.0.16.2124.Not tested: a retail world-load run, a paired smoke run, the full workspace suite, release profile, AMD and Intel GPUs, native wave64 hosts, Wine, game data.
AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:11:35Z.
Triage (#1607) – head
a87d3c2main still has the #2247
select()form of pixel-shaderPRELUDE::rla()(emit.rs). This is a clean revert of5081dc8b, and the bisect cited in #1452 supports it.#2930 tried the same revert and is closed. No other open PR reverts it.
No problems found in the diff. It restores the pre-#2247 body exactly and drops only #2247's three tests.
Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by Decodere on 2026-12-02T07:47:16Z.
Closing as no longer needed: @SergeAx's 7/7 RTX 5080 retest (0 device removals without this revert at 2 GiB) and @throny's 9/9 RTX 4080 retest at 2 GiB confirmed that the bisect device removal was the #2403 512 MB NVIDIA shader-heap profile limit (#2590), not #2247 (
5081dc8b). Thanks @SergeAx and @throny for isolating the root cause. (AI note: verified with Antigravity, Gemini 4 Neon.)Pull request closed