Recompiler: pixel shaders run through execz skips with EXEC 0 on NVIDIA #3591
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3591"
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 Royalflamejlh on 2026-12-01T17:29:52Z.
(Edited: head
f4413ddb3, onmain078358a0: a region that writes an SGPR chosen by M0 (s_movrelsd_2_b32) keeps its branch, from @fromthemoonx's merge-check. The whole suite and the smoke pair below are of this head.)On NVIDIA, a pixel wave whose pixels all skip a block by
s_cbranch_execzcan come out unwritten. Fixes #3574: there, the synthetic test below left 896 of 4,096 pixels at the clear colour on an RTX 4060 Ti under Wine + vkd3d-proton, and @imnicho saw the same 896 on an RTX 5080 on native Windows 10 (driver 610.47), and 784 with an explicit-level sample in the block. Waves with pixels on both sides of the branch draw right. This change goes around the fault on NVIDIA only; every other adapter keeps the skip, as the console takes it.What is in it
gpu/recomp/ps_masks.rs:flat_skips, the forwards_cbranch_execzskips of a pixel shader that can run with every lane masked instead: the region ends where the branch goes and branches only forward inside, writes no EXEC, exports nothing, ends no program (any instruction without a successor:s_endpgm,s_endpgm_saved,s_endpgm_ordered_ps_done), changes no float mode (s_round_mode,s_denorm_mode,s_setreg), writes no SGPR chosen by M0 (s_movrelsd_2_b32), runs nothing EXEC does not mask, and writes no SGPR or SCC that is read after it before being written again (SCC read as asrc_sccoperand included,lane_masks::reads_scc).gpu/dxil/kernel.rs,gpu/dxil/lower.rs: such a skip is not taken as a branch (its condition isfalse) whenps_skip_run_through()holds: on an NVIDIA adapter, by vendor id0x10DEor by name, since DXVK's dxgi reports NVIDIA cards as AMD's (0x1002) under Wine unlessdxgi.hideNvidiaGpuis off (gpu/adapter.rsis_nvidia; the adapter the device is made on, picked by the same rule,device_candidates), or forced byXCL_PS_SKIP_RUN_THROUGH=1/0. Every other skip is unchanged.gpu/recomp/pso.rs,shaders.rs: the decision is part of the translated cache's identity, and the switch is one of the warm settings, so a cache made one way is not loaded the other.gpu_direct_ps_waves_that_skip_a_branch_keep_the_other_branch_values, a wave64 if / else on a disc, each block skipped bys_cbranch_execz, drawn with the second block sampling byIMAGE_SAMPLEand byIMAGE_SAMPLE_LZ; unit tests of the analysis (a region with a backward branch or a program end keeps its branch), of the vendor decision and of the cache identity.In one retail pack's 12,101 pixel-shader programs, 125,815 of 255,127 such skips (in 7,984 programs) run through on NVIDIA (counted before program ends were refused). A region run through with EXEC 0 changes no result: every VGPR write and store is EXEC-guarded, implicit-LOD samples run with the heap index clamped and their results go unused, and other samples are not issued for inactive lanes. What it costs is those samples' fetches; a synthetic timing is under Tested. Its GPU time in the title is not measured.
Tested
f4413ddb3, native Windows: RTX 2070 SUPER 8 GB (driver 621.01), Ryzen 7 5700X3D, Windows 11 Pro 26200, Rust 1.100.0, debug:cargo test --workspace -- --test-threads=4: 3,016 passed, 0 failed, 52 ignored; SKIPPED 29 (22 no wave64, 2 no heap windows, 2 nod3d12SDKLayers.dll, 2 no D3D12 debug layer, 1 no GPU_UPLOAD heaps). The GPU test passed.f4413ddb3plus a timing test kept out of this PR, RTX 4060 Ti 16 GB (NVIDIA 615.71.09), Linux, Wine: a full-screen 2048×2048 draw of a wave64 pixel shader whoses_cbranch_execzregion holds N implicit-LOD samples. With no lane in the region in any wave, the run-through cost 0.001, 0.050 and 0.230 ms over the kept skip for 8, 16 and 32 samples (0.134 to 0.135 ms with the skip kept). With every lane in it, the draw took 0.315, 0.323 and 0.424 ms either way. Medians of 5 processes of 20 draws each. This is an upper bound: every wave of these draws skips the region.f4413ddb3, under Wine without a card (lavapipe):cargo test -p xcl --release --target x86_64-pc-windows-gnu --lib -- adapter ps_masks ps_skip lane_masks agility pso:: shaders:: d3d12x::real:: gpu::dxil: 706 passed, 8 failed, 5 ignored; the PR's base078358a0here: 697 passed, the same 8 failed, 5 ignored.execz_skips_over_a_relative_sgpr_move_keep_the_branchfails without thes_movrelsd_2_b32refusal.masterwith local patches, Rust 1.98.0,x86_64-pc-windows-gnu, release.ef570fa0a: passes; withlw.flat_skips = Default::default();atgpu/dxil/kernel.rs:815it fails, "IMAGE_SAMPLE: 896 pixels hold another branch's values, first (20, 16)", 1 run each. Not yet run at79dbb7065(the gate and switch).f6a07c872(the vendor taken from the device's adapter), under Wine without a card:adapter ps_masks ps_skip pso:: shaders:: d3d12x::real::: 323 passed, 6 failed (the same 6 asmain), withdevice_order_falls_back_to_every_adapter_when_none_matchesred against the old rule. The GPU test at this head on the RTX 4060 Ti: passes; withXCL_PS_SKIP_RUN_THROUGH=0it fails, "IMAGE_SAMPLE: 896 pixels hold another branch's values", 1 run each.79dbb7065, under Wine without a card:cargo test -p xcl --release --lib -- ps_masks gpu::dxil pso:: shaders::: 454 passed, 1 failed (round_tests::directed_reference_basics, which fails onmainhere too), 4 ignored. The new program-end test fails atef570fa0a's check (S_ENDPGM_SAVEDruns through).Regression run
RTX 2070 SUPER 8 GB (driver 621.01), Ryzen 7 5700X3D, Windows 11 Pro 26200, release builds by
scripts/smoke.ps1, the same retail title for 60 s each.main:this PR's head:
Not tested
AI use
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T20:38:45Z.
Review (head
ef570fa0, diff read, not a merge-check; checks red):flat_skipsis computed for every non-split pixel shader atgpu/dxil/kernel.rs~815 with no vendor gate or switch, so AMD, which does not have the fault, changes too. By the description's own count, 125,815 skips in 7,984 of 12,101 programs now run their region in waves that used to jump over it, and implicit-LOD samples in a pixel shader stay unguarded for derivatives (gpu/dxil/lower_image.rs~1271-1275), so those regions now fetch textures with no live lane. There are no smoke runs (the reason thePR descriptioncheck is red) and no GPU-time numbers.gpu/recomp/ps_masks.rs~488-490 excludes onlyS_ENDPGMby name. Terminators have no successors, sosucc[k].iter().all(..)holds vacuously forS_ENDPGM_SAVEDandS_ENDPGM_ORDERED_PS_DONE, whichgpu/dxil/cfg.rs~38 treats as program ends; a wave with EXEC 0 would end inside the region and skip the exports after it. CheckingF_TERMINATOR(or an emptysucc[k]) covers all three.Fine: the analysis refuses EXEC writes, exports, backward branches and SGPR/SCC values live after the region; VGPR writes and stores stay EXEC-guarded in the lowering (
write32,act()); unit tests cover accepted and refused shapes, and the GPU test reproduces the 896-pixel fault (it fails without the fix only on NVIDIA). #1834 also collapses forwards_cbranch_execzregions (incfg.rs, for compute), so expect an interaction if both land.AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-01T20:54:43Z.
@Foniass thank you; both points are fixed at
79dbb7065.s_endpgm_savedands_endpgm_ordered_ps_doneas well ass_endpgm. A unit test fails onS_ENDPGM_SAVEDagainstef570fa0's check.0x10DE);XCL_PS_SKIP_RUN_THROUGH=1or0forces it either way. The decision is part of the translated cache's identity and the switch is a warm setting. Every other adapter keeps the skip, as the console takes it.kernel.rs/lower.rswill conflict as text and large pixel shaders change on AMD through #1834.AI use: Claude Code (Claude Opus 5.5) checked both points, made the changes and drafted this reply.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T21:06:57Z.
Follow-up review (head
79dbb706, sinceef570fa0, diff read, not a merge-check; checks red):flat_skipsnow runs only whenps_skip_run_through()holds (gpu/dxil/kernel.rs~108-119, ~840): by default only on vendor0x10DE, withXCL_PS_SKIP_RUN_THROUGH=0/1to force it, so AMD and others keep the console's skip. It is still on by default on NVIDIA with no smoke runs (the reasonPR descriptionis red), no GPU-time numbers, and the GPU test not rerun at this head.ps_masks.rs~488 now requires!succ[k].is_empty(), which refusesS_ENDPGM,S_ENDPGM_SAVEDandS_ENDPGM_ORDERED_PS_DONE, andexecz_skips_over_a_program_end_keep_the_branchcovers all three.New:
adapter::vendor()(gpu/adapter.rs~153-157) takes the first adapter thatd3d12_adapter/XCL_ADAPTERmatches and returnsNonewhen none does, while the device code (hle/d3d12x/real.rs~989-1000) falls back toSelector::Autoand takes the first adapter that creates a device. AnXCL_ADAPTERvalue that matches nothing on an NVIDIA machine still gets an NVIDIA device but leaves the workaround off, and if the first match fails device creation the decision is made for a different GPU than the one in use.Fine: the decision is a process-wide
OnceLockand part of the translated cache identity (pso.rs~388, with a test); the switch is among the warm settings inshaders.rs; launch preparation passes the title's adapter to its child asXCL_ADAPTER, so the prepared cache and the runtime agree.AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-01T21:57:53Z.
@Foniass right; fixed at
f6a07c872.adapter::vendor()now walksadapter::device_candidates, which the device code inreal.rsuses too: the same match, the same fallback to every hardware adapter whenXCL_ADAPTERmatches nothing, and the first adapter that supports a device (asked with a null output pointer, so none is made).device_order_falls_back_to_every_adapter_when_none_matchesfails against the old rule. Under Wine on the CPU,adapter ps_masks ps_skip pso:: shaders:: d3d12x::real::: 323 passed, 6 failed, the same 6 asmainhere.Still owed at this head: the GPU test on a card (ours was busy), the smoke pair, and GPU time.
AI use: Claude Code (Claude Opus 5.5) made the change, ran the tests and drafted this reply.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T21:59:08Z.
Follow-up review (head
f6a07c87, since79dbb706, diff read, not a merge-check; checks red):0x10DEwithXCL_PS_SKIP_RUN_THROUGH=0/1to force it (gpu/dxil/kernel.rs~106-119), but that NVIDIA default still has noxcl-smokepair ("Owed"), no GPU-time numbers, and the GPU test has not been rerun at the gated heads.ps_masks.rs~488 andexecz_skips_over_a_program_end_keep_the_branch).adapter::device_order/device_candidates(gpu/adapter.rs~118-159) now hold the rule for both: the adaptersXCL_ADAPTER/d3d12_adaptermatch, every hardware adapter when none matches, nothing forwarp.real.rs~989-992 builds the device from that list, andvendor()(~172-180) takes the first entry whereagility::device_supported(gpu/agility.rs~349-363) can make a device at the same feature level and path;device_order_falls_back_to_every_adapter_when_none_matchestests the fallback.New: none.
Fine:
real.rsstill logs the no-match warning and falls back as before; the decision is still a process-wideOnceLockin the translated cache identity; withwarp, or no hardware adapter that can make a device,vendor()returnsNone, matching the WARP device.AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-01T22:04:30Z.
The GPU test at
f6a07c872, RTX 4060 Ti (NVIDIA 615.71.09) under Wine: passes; withXCL_PS_SKIP_RUN_THROUGH=0it fails with "IMAGE_SAMPLE: 896 pixels hold another branch's values", 1 run each. So the vendor decision picks the NVIDIA adapter here and the switch forces it off. The description says so.AI use: Claude Code (Claude Opus 5.5).
Imported from ivall/xcl. Originally posted by throny on 2026-12-02T04:13:26Z.
merge-check claim
head:
f6a07c8729Imported from ivall/xcl. Originally posted by throny on 2026-12-02T04:50:20Z.
merge-check
base:
1c8b55147(main)head:
f6a07c8729merge: clean trial merge into main
1c8b55147(merge_trial_suite.sh 3591).build:
cargo build --workspacepassed.tests:
cargo test --workspace --no-fail-fast -- --test-threads=4on the merged tree: 2916 passed, 0 failed, 51 ignored; 25 SKIPPED notices (no wave64, no heap windows, driver cache); 0 binaries ended abnormally. Passing at this head:ps_skips_run_through_on_nvidia_unless_switched,execz_skips_over_a_program_end_keep_the_branch,execz_skips_over_a_loop_keep_the_branch,execz_skips_run_through_when_nothing_after_reads_what_they_skip,translated_identity_tracks_the_ps_skip_run_through. The PR's GPU testgpu_direct_ps_waves_that_skip_a_branch_keep_the_other_branch_valueswas not found by name in the log lines I searched, so I do not claim it ran here.review: diff read (10 files, +385/-16). All points of the earlier reviews are fixed at this head and re-checked in the diff: run-through only on vendor 0x10DE (or by
XCL_PS_SKIP_RUN_THROUGH=1/0), program ends refused through!succ[k].is_empty(), the vendor picked by the samedevice_candidatesrule as the device. The analysis refuses EXEC writes, exports,V_WRITELANE,S_SENDMSG, scalar stores/atomics, indirect and backward branches, and SGPR/SCC values read after the region; the unit tests cover accepted and refused shapes. Remaining, not blockers: implicit-LOD samples now run in regions with no live lane on NVIDIA (a cost, not a result change); a text conflict with #1834 inkernel.rs/lower.rs, as the author says.performance: regression run in the description (retail title, 60 s, same title): main 1620 frames, this head 1628, 0 device removals, peak commit 15476 vs 15259 MB. The PR's GPU test, on an RTX 4060 Ti under Wine: passes; with
XCL_PS_SKIP_RUN_THROUGH=0it fails ("896 pixels hold another branch's values"), 1 run each. No GPU-time numbers; no in-world run of this head by us.verdict: safe to merge (NVIDIA-only by default, switchable, other vendors unchanged); GPU-time numbers are still owed by the author and are not a blocker.
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300; Claude Code, Claude Sonnet 5.5 ran the build and the suite and read the diff; Claude Opus 5.5 checked this report
Imported from ivall/xcl. Originally posted by Decodere on 2026-12-02T08:12:43Z.
merge-check
base:
1c8b551475head:
f6a07c8729merge: clean
build: cargo build --workspace -> ok; cargo build --release -p xcl -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2915 passed, 1 failed, 51 ignored; SKIPPED: 28 (22 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 2 no heap windows, 1 cannot disable the driver cache / Windows Developer Mode required); failing: tests/gpu_two_pass_cache_e2e.rs :: two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs (pre-existing on clean base
1c8b5514: 2908 passed, 1 failed, 51 ignored, identical 28 SKIPPED). All 7 new tests pass with 0 skips (+7 vs base), including explicit isolated runs of gpu::recomp::tests::gpu_direct_ps_waves_that_skip_a_branch_keep_the_other_branch_values with both default NVIDIA run-through (0.37 s) and XCL_PS_SKIP_RUN_THROUGH=0 (0.34 s).review: Full merged diff read (10 files, +385/-16). No blocking findings. ps_masks::flat_skips enforces strict forward-DAG bounds (no loops, no exits past t, no indirect jumps, !succ[k].is_empty() blocking all three S_ENDPGM* forms, no EXEC writes, no EXP/V_WRITELANE_B32/S_SENDMSG/SMEM store or atomic), and its forward liveness worklist conservatively rejects any region whose SGPR or SCC writes can be read after t before overwrite. adapter::device_candidates and adapter::vendor() match real::init_with_remap, ps_skip_tagged keys translated cache identity under Backend::DirectAll, and XCL_PS_SKIP_RUN_THROUGH is registered in semantic_pipeline_setting. Non-blocking observation: gpu_direct_ps_waves_that_skip_a_branch_keep_the_other_branch_values also passed with XCL_PS_SKIP_RUN_THROUGH=0 on this RTX 4060 (driver 621.40), so the #3574 miscompile itself did not trigger on this driver/card, though the default run-through path and cache/override plumbing were verified clean. Untested: AMD/Intel/native wave64 GPUs, D3D12 debug layer, and visual inspection of affected retail title surfaces.
performance: Default-on for NVIDIA direct-DXIL pixel shaders (switchable via XCL_PS_SKIP_RUN_THROUGH=0); waves with EXEC 0 still execute skipped forward regions (including texture fetches) instead of branching over them. Paired 60 s retail smoke (title 29640639, release) on RTX 4060: 1597 frames / 15484 MB peak commit (0 removals, 0 crashes) vs base
1c8b55141462 frames / 16043 MB (+9.2% frames, -3.5% commit; no regression).verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 4060 8 GB (driver 621.40), Intel Core i5-11400F, 32 GB RAM, Windows 11 Build 26200, Rust 1.100.1 MSVC, DXC 1.9.2602.17 / Antigravity (Gemini 4 Neon)
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T13:48:29Z.
Follow-up review (head
8ca2df9d, sincef6a07c87, diff read, not a merge-check; checks red):git range-diffshows the own commit changed only wheremainmoved under it (theXCL_WAVE64_IDIOMSwarm setting and cache tag now sit next to this PR's own inshaders.rs/kernel.rs); this push is a rebase.New: none.
AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T15:19:00Z.
Review: COMMENTED
Review of
8ca2df9d: 5 finding(s) (2 high, 3 medium), most severe first.crates/xcl/src/gpu/recomp/ps_masks.rs:492:flat_skipsdoesn't refuse a region that changes the float mode (s_round_mode, s_denorm_mode, s_setreg_b32 / s_setreg_imm32_b32 on HW_REG_MODE). (inline)crates/xcl/src/gpu/dxil/kernel.rs:890: The workaround exists only in the direct DXIL pixel path, so pixel shaders that go through the HLSL translator keep the plain execz branch NVIDIA miscompiles: direct DXIL'sdirect_fallbackon error,ps_debug, and XCL_DIRECT_DXIL=0/1. (inline)crates/xcl/src/gpu/recomp/ps_masks.rs:511: Reads of SCC after the region are found by instruction name only (reads_scc/ S_CBRANCH_SCC*), so a read through thesrc_sccoperand (code 253) is missed:scalar_codemaps 253 to no register andsgpr_usesdrops codes above 127, y.... (inline)crates/xcl/src/gpu/recomp/ps_masks.rs:517: Not certain about this one: the forward pending-read walk from the join follows only CFG successors and ignores the emitter's loop-budget (LOOP_GUARD) exits, whichx64_masksliveness models (what's live after a loop is live before each.... (inline)crates/xcl/src/gpu/adapter.rs:173: Not certain about this one:vendor()repeats the device-selection loop of real.rs init (new DXGI factory, adapter enumeration, a D3D12CreateDevice probe per candidate) instead of using the vendor init already stores in ADAPTER_VENDOR /.... (inline)These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T15:19:01Z.
Code review location:
crates/xcl/src/gpu/recomp/ps_masks.rs; line 492High:
flat_skipsdoesn't refuse a region that changes the float mode (s_round_mode, s_denorm_mode, s_setreg_b32 / s_setreg_imm32_b32 on HW_REG_MODE). The lowering keeps that mode in runtime state (mode_write, VAR_FP16_RM,denorm_mode), so running the region with EXEC 0 now changes rounding and denormal handling for everything after the join. Take a PS region guarded by s_cbranch_execz that holdss_round_mode 0x3ors_setreg_imm32_b32 hwreg(HW_REG_MODE,...)with no restore before the join. On NVIDIA (run-through on), a wave with EXEC 0 runs the setreg. The region writes no SGPR read later, so the skip is accepted, and every f32/f16 op after the join uses the wrong mode, where the console (branch taken) left it unchanged. Treating mode writes as region writes that block the run-through would fix it.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T15:19:01Z.
Code review location:
crates/xcl/src/gpu/dxil/kernel.rs; line 890High: The workaround exists only in the direct DXIL pixel path, so pixel shaders that go through the HLSL translator keep the plain execz branch NVIDIA miscompiles: direct DXIL's
direct_fallbackon error,ps_debug, and XCL_DIRECT_DXIL=0/1. On NVIDIA, any PS that direct DXIL rejects falls back to HLSL (pso.rs ~840), as does every PS with XCL_DIRECT_DXIL=1. A wave where every pixel skips a block still drops writes (the 896-pixel corruption from #3574), because the HLSL emitter lowers s_cbranch_execz unchanged. Applying the sameflat_skipsdecision in the HLSL emitter would cover the fallback too.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T15:19:01Z.
Code review location:
crates/xcl/src/gpu/recomp/ps_masks.rs; line 511Medium: Reads of SCC after the region are found by instruction name only (
reads_scc/ S_CBRANCH_SCC*), so a read through thesrc_sccoperand (code 253) is missed:scalar_codemaps 253 to no register andsgpr_usesdrops codes above 127, yet the lowering supports src_scc as an operand (lower.rs:872). If the region ends withs_cmp_eq_u32 s4, 0and after the joinv_mov_b32 v1, src_sccreads the pre-branch SCC, the skip is accepted, the region's s_cmp overwrites SCC with EXEC 0, and v1 gets the wrong value.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T15:19:01Z.
Code review location:
crates/xcl/src/gpu/recomp/ps_masks.rs; line 517Medium: Not certain about this one: the forward pending-read walk from the join follows only CFG successors and ignores the emitter's loop-budget (LOOP_GUARD) exits, which
x64_masksliveness models (what's live after a loop is live before each of its instructions). If the execz region sits inside a loop and writes s4, and on the normal CFG s4 is rewritten at the top of the body before any exit, the walk accepts the skip. When the iteration budget fires at the loop head, control goes straight to the exit, where code reads s4 holding the value the region computed with EXEC 0.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T15:19:01Z.
Code review location:
crates/xcl/src/gpu/adapter.rs; line 173Medium: Not certain about this one:
vendor()repeats the device-selection loop of real.rs init (new DXGI factory, adapter enumeration, a D3D12CreateDevice probe per candidate) instead of using the vendor init already stores in ADAPTER_VENDOR /driver_cache::note_vendor, and the two can disagree.ps_skip_run_through()is a OnceLock, so if it's first evaluated beforestate::set_boot(a worker or tool computingtranslation_cache_identityearly),state::config()gives the default config and the first adapter's vendor is used. Init later picks the configured adapter (e.g. d3d12_adapter=radeon on an NVIDIA+AMD box), so the run-through decision and cache identity follow the wrong GPU.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T15:19:05Z.
@Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.
Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-12-02T18:18:42Z.
merge-check
base:
16c2fd082ahead:
f4413ddb3bmerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 3022 passed, 0 failed, 56 ignored (base: 3012 passed, 0 failed, 56 ignored, counted on
395405e4; only docs and scripts changed since); SKIPPED: 25, the same as base (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps); failing: none. An earlier run ended with 0xc0000005 during the thread-dump test (#3586, on main too)review: rerun on the new head. Since
3632bfa6onlyS_MOVRELSD_2_B32was added to the refused instructions, with a test (read that change; the whole diff was read before). No open finding from my side.XCL_PS_SKIP_RUN_THROUGHunset, 0 and 1. The SCC ands_round_modecases are still right. All were drawn on the RTX 3060.XCL_PS_SKIP_RUN_THROUGH=0it fails 3 of 3 (IMAGE_SAMPLE_LZ: 784 pixels), so it still goes around a fault this card has.scripts/pr_check.pyaccepts the description.performance: on NVIDIA, waves that skipped a region now run it, texture fetches included. The GPU time of that is not measured, here or in the description. The smoke pair (RTX 2070 SUPER) shows no loss: 1551 frames against 1522.
verdict: safe to merge
hardware / tool and model: RTX 3060 12 GB (610.88), Ryzen 7 5700X, Windows 11 Pro 26300 / Claude Code (Claude Opus 5.5)
Earlier report on
3632bfa6merge-check
base:
395405e4c0head:
3632bfa692merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 3021 passed, 0 failed, 56 ignored (base: 3012 passed, 0 failed, 56 ignored); SKIPPED: 25, the same as base (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps); failing: none. The red CI job on this head (143838507638) is one of those #3743 lists for the thread-dump crash (#3586), not this PR
review: rerun on the new head; read the whole diff (11 files, +427 -17).
s_round_mode 3is 0x3F800001, the same as with the skip kept. Each fix has a test that fails when I take the fix out.XCL_PS_SKIP_RUN_THROUGH=0it fails 3 of 3 (IMAGE_SAMPLE_LZ: 784 pixels), so the NVIDIA fault is still there and this still goes around it.S_MOVRELSD_2_B32in the region. It writess[SDST + M0[25:16]], butwrites()treats onlyS_MOVRELD*as writing any SGPR. The shader below has 5 in s31, and its skipped region would write 7 there:XCL_PS_SKIP_RUN_THROUGHAdding
"S_MOVRELSD_2_B32"to thematches!list inflat_skipsgives 5 again; theps_maskstests and the PR's GPU test still pass with it. I have not seen a shader that uses this instruction here, so I would not hold the PR for it.4) Not tested: a retail title (none on this machine), AMD, Wine.
performance: on NVIDIA, waves that skipped a region now run it, texture fetches included. Not measured here.
verdict: not yet: the PR's smoke block is of
8ca2df9d, not of this head (PR descriptionis red for it). Nothing in the code blocks it from my sidehardware / tool and model: RTX 3060 12 GB (610.88), Ryzen 7 5700X, Windows 11 Pro 26300 / Claude Code (Claude Opus 5.5)
Earlier report on
8ca2df9dmerge-check
base:
817eb1fc9fhead:
8ca2df9d1dmerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 3011 passed, 0 failed, 52 ignored (base: 3004 passed, 0 failed, 52 ignored); SKIPPED: 25, the same as base (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps); failing: none. An earlier run of the same build ended with 0xc0000005 in the library tests while
eh::tests::thread_dumps_while_threads_run_and_exitwas running. Plain main did the same here once, so I do not count it against this PR.review: read the whole diff (10 files, +385 -16).
XCL_PS_SKIP_RUN_THROUGH=0it fails 3 of 3 (IMAGE_SAMPLE_LZ: 784 pixels, the number in the description).v_movonlys_cmp, SCC read later as an operand (src_scc)s_round_mode 3flat_skipsalso accepts regions withs_denorm_modeands_setreg_b32of MODE. M0 and VCC written in the region and read after it are refused correctly. I do not know how often real shaders do this.3) This closes both; with it the table's last column is right, the PR's GPU test and the
ps_maskstests still pass (I did not rerun the whole suite with it):performance: on NVIDIA, waves that skipped a region now run it, texture fetches included. Not measured here; the smoke pair in the description shows no loss.
verdict: not yet: a skipped region that changes the rounding mode, or an SCC later read as an operand, gives wrong pixels on NVIDIA by default; the small fix above closes both
hardware / tool and model: RTX 3060 12 GB (610.88), Ryzen 7 5700X, Windows 11 Pro 26300 / Claude Code (Claude Opus 5.5)
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T22:01:50Z.
Code review location:
crates/xcl/src/gpu/recomp/ps_masks.rs; line 492Right; fixed at
b33985709. A region withs_round_mode,s_denorm_modeor anys_setregnow keeps its branch (ps_masks.rs:491-493). The new testexecz_skips_over_a_float_mode_change_keep_the_branchfails without it. @fromthemoonx measured the wrong rounding on an RTX 3060 in his merge-check, and this is the fix he gave there.AI use: Claude Code (Claude Opus 5.5) checked the code, made the change and the runs, and wrote this reply.
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T22:01:52Z.
Code review location:
crates/xcl/src/gpu/dxil/kernel.rs; line 890Not changed: a run showed the HLSL path draws this shader right on NVIDIA. I ran the PR's disc shader through the HLSL translator and DXC on an RTX 2070 SUPER (driver 621.01, Windows 11), as a test kept out of the PR, 1 run each way. With the run-through off (
XCL_PS_SKIP_RUN_THROUGH=0, which the HLSL path does not read), the HLSL draw passed and the direct DXIL draw failed, with 868 pixels holding the other branch's values. With the run-through on, both passed. So the fault comes from the direct path's DXIL, and the HLSL emitter'ss_cbranch_execzneeds no change.AI use: Claude Code (Claude Opus 5.5) checked the code, made the change and the runs, and wrote this reply.
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T22:01:54Z.
Code review location:
crates/xcl/src/gpu/recomp/ps_masks.rs; line 511Right; fixed at
b33985709. After the region, the walk now also stops at any instruction that reads SCC as an operand:lane_masks::reads_scc(253 in SSRC0/1, SRC0-2 or SOFFSET, or an implicit SCC input), nowpub(super), used atps_masks.rs:512. A new case inexecz_skips_run_through_when_nothing_after_reads_what_they_skip(v_mov_b32 v1, src_sccafter a region withs_cmp) fails without it. @fromthemoonx showed SCC 0 instead of 1 on an RTX 3060.AI use: Claude Code (Claude Opus 5.5) checked the code, made the change and the runs, and wrote this reply.
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T22:01:56Z.
Code review location:
crates/xcl/src/gpu/recomp/ps_masks.rs; line 517Not changed: that exit does not happen in the path that uses
flat_skips. In the direct DXIL path, a loop that runs out of its budget does not branch to the loop's exit. It branches toend(gpu/dxil/kernel.rs:583,:596,:609), which is the program'sexitblock (:533) and ends the lane's program. No instruction after the loop runs, so nothing reads s4 there. The HLSL path'sbreakdoes go on after the loop, but that path does not useflat_skips.AI use: Claude Code (Claude Opus 5.5) checked the code, made the change and the runs, and wrote this reply.
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T22:01:58Z.
Code review location:
crates/xcl/src/gpu/adapter.rs; line 173Not changed: both choices see the same setting. In the title's process
host_maincallsstate::set_boot(host.rs:89) before shader preparation and before the device is made, and nothing is translated before then. The launch preparation also passes the configured adapter to its own device (shaders.rs:4135). The offline tools (xcl shaders,pso-precompile) set no boot record, soconfig().d3d12_adapteris the defaultautothere, andautois also what their own device uses (shaders.rs:2498). Reading the vendor off the title's device would leave those tools without an answer, and they need one, since the decision is part of the cache key they write.AI use: Claude Code (Claude Opus 5.5) checked the code, made the change and the runs, and wrote this reply.
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T22:02:07Z.
@fromthemoonx thank you; both are fixed at
b33985709, rebased ontomain5ad98adb. Your change went in, except that SCC read as an operand is found bylane_masks::reads_scc, which also checks SOFFSET and implicit SCC inputs. Each fix has a unit test that fails without it (execz_skips_over_a_float_mode_change_keep_the_branch, and asrc_scccase inexecz_skips_run_through_when_nothing_after_reads_what_they_skip). bmjask's other three points are answered inline: on an RTX 2070 SUPER the HLSL path draws the disc shader right with the run-through off. The whole suite and a smoke pair at the new head are running; the description will carry them.AI use: Claude Code (Claude Opus 5.5) made the change and wrote this reply.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T22:03:40Z.
Follow-up review of
b3398570, since8ca2df9d(code reading only, not a merge-check;PR descriptionred) · 1 mediumIn short: This push refuses two more things inside a region that a wave with EXEC 0 runs through: float-mode changes (
s_round_mode,s_denorm_mode,s_setreg*), and SCC read as asrc_sccoperand after the region. Both have tests. The earlier measurement point is narrower now: a smoke pair is in, for the previous head8ca2df9d, but the GPU time of the run-through regions is still not measured.Medium
0x10DE(kernel.rs~106-119), and the smoke pair shows no regression (1575 → 1612 frames, previous head). The description still says the GPU time of the forms it changes is not measured, and a region run through still fetches its implicit-LOD samples. A frame-time comparison on a scene with many such skips would settle it.Checked and fine
run(ps_masks.rs) now stops a region atS_ROUND_MODE,S_DENORM_MODEand anyS_SETREG*, so a wave with EXEC 0 never changes the float mode its live lanes later use.execz_skips_over_a_float_mode_change_keep_the_branchcovers all three.src_scc: the liveness check after the region now also useslane_masks::reads_scc, madepub(super). It coversOPR_SSRC_SPECIAL_SCCinputs and encoding 253 in the scalar and vector source fields. The new assertion refuses a region followed byv_mov_b32 v1, src_scc.!succ[k].is_empty()), and the vendor comes from the same adapter list as the device.Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T22:21:40Z.
Code review location:
crates/xcl/src/gpu/adapter.rs; line 179High: The gate relies on DXGI's
VendorId == 0x10DE, but under Proton/DXVK's dxgi NVIDIA GPUs are reported as AMD (0x1002) by default when NVAPI isn't enabled (dxgi.hideNvidiaGpu), so the workaround silently turns off on exactly the Wine/Proton NVIDIA setups where the bug was reported. On a Proton setup with an RTX card and no PROTON_ENABLE_NVAPI,vendor()returns Some(0x1002),ps_skip_run_through()is false,flat_skipsstays empty, and the black region from #3574 comes back with nothing logged. Detecting the vendor from the D3D12 device (or the Vulkan driver vkd3d-proton reports) rather than DXGI, and logging the decision, would make it reliable.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T22:21:40Z.
Code review location:
crates/xcl/src/gpu/agility.rs; line 350Medium: Not certain about this one, because it depends on when
vendor()is first reached:device_supportedcallsD3D12CreateDevice/factory.CreateDevicewithoutenable_dred_once(), unlikecreate_device, andvendor()reaches it lazily from thetranslated::identity()/ps_skip_run_throughOnceLocks, which can run beforereal::inithas set up DRED and the debug layer.warm_replay/warm_librarycomputetranslation_cache_identity()during launch preparation, before the first real device, so the probe creates devices before the DRED settings thatcreate_device's comment says must come before the process's first device. TheDRED_LATEguard is skipped, so XCL_DRED=1 or debug-layer setup can silently end up out of order. Callingenable_dred_once()before probing, or using the vendorreal::initalready records, would avoid it.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T22:21:40Z.
Review: COMMENTED
Review of
b3398570: 3 finding(s) (1 high, 2 medium), most severe first.crates/xcl/src/gpu/adapter.rs:179: The gate relies on DXGI'sVendorId == 0x10DE, but under Proton/DXVK's dxgi NVIDIA GPUs are reported as AMD (0x1002) by default when NVAPI isn't enabled (dxgi.hideNvidiaGpu), so the workaround silently turns off on exactly the Wine/Pr.... (inline)crates/xcl/src/gpu/recomp/emit.rs:1419: see below.crates/xcl/src/gpu/agility.rs:350: Not certain about this one, because it depends on whenvendor()is first reached:device_supportedcallsD3D12CreateDevice/factory.CreateDevicewithoutenable_dred_once(), unlikecreate_device, andvendor()reaches it laz.... (inline)On lines outside the diff:
crates/xcl/src/gpu/recomp/emit.rs:1419: The run-through exists only in the direct DXIL lowering (lower.rsbranch_cond). The HLSL emitter still lowers everys_cbranch_execzas a realmask_zero(126)branch, so NVIDIA pixel shaders that take the HLSL path still hit the #3574 fault. That includes a pixel shader whose direct translation fails (direct_fallbackin pso.rs ~838), and any PS run with XCL_DEBUG_LOD0 / XCL_DEBUG_PS_SUB / XCL_DEBUG_PS_EXPR, a debug colour, or XCL_DIRECT_DXIL=1. Their all-skipping waves still come out unwritten, while the cache identity is tagged as if the fix applied. Applying the same run-through in emit.rs (or tagging only direct translations) would keep them consistent.These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T22:30:47Z.
Code review location:
crates/xcl/src/gpu/adapter.rs; line 179Right, and it is the setup this was first seen on. Fixed at
3632bfa69. On an RTX 4060 Ti under Wine with DXVK'sdxgi.dllanddxgi.hideNvidiaGpuleft at its default, DXGI reports vendor0x1002and device0x73df, and the name stays "NVIDIA GeForce RTX 4060 Ti 8GB".adapter::is_nvidianow takes either the vendor id or a name containing "NVIDIA", and the decision is logged once ("pixel shaders' execz skips: run through / kept"). There, 1 run each: the PR's GPU test failed atb33985709(896 pixels) and passed at3632bfa69. WithXCL_PS_SKIP_RUN_THROUGH=0it failed again, as it should.ps_skips_run_through_on_nvidia_unless_switchedhas the spoofed case and fails against the old rule.AI use: Claude Code (Claude Opus 5.5) checked the code, made the change and the runs, and wrote this reply.
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T22:30:49Z.
Code review location:
crates/xcl/src/gpu/agility.rs; line 350Done at
3632bfa69:device_supportedcallsenable_dred_once()first, ascreate_devicedoes. A probe with a null out-pointer leaves no device behind, but whether D3D12 counts it as the process's first device is not documented, so it now keeps the same order either way.AI use: Claude Code (Claude Opus 5.5) made the change and wrote this reply.
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T22:30:51Z.
@bmjask on your second point (
emit.rs:1419, the HLSL path): answered in the thread onkernel.rs:890with a run. The disc shader drawn through the HLSL translator was right on an RTX 2070 SUPER with the run-through off, while the direct DXIL draw lost 868 pixels, so the HLSL emitter is not affected. The cache tag is applied only whenBackend::current() == Backend::DirectAll(pso.rs:388). A shader that falls back to HLSL there gets a tag for a change that does not touch it, which costs nothing. The other two points are fixed at3632bfa69(inline replies), rebased ontomain078358a0.AI use: Claude Code (Claude Opus 5.5) checked the code and wrote this reply.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T22:34:23Z.
Follow-up review of
3632bfa6, sinceb3398570(code reading only, not a merge-check;PR descriptionred) · 1 mediumIn short: This push recognises an NVIDIA card by its name as well as its vendor id, because under Wine DXVK's dxgi reports an NVIDIA card as AMD's (
0x1002) unlessdxgi.hideNvidiaGpuis off. The decision is logged once.device_supportednow sets up DRED before its probe, soXCL_DREDstill applies to the title's device. The GPU-time point is unchanged. The smoke pair names8ca2df9d.Medium
Checked and fine
adapter::is_nvidia(adapter.rs) is true for vendor0x10DEor a name containing "nvidia", in any case.device_adapterreturns the vendor and name from the samedevice_candidateslist as before. The test covers NVIDIA reported as NVIDIA and as AMD, a real AMD card and an Intel card.ps_skip_run_throughlogs "pixel shaders' execz skips: run through / kept" once, inside theOnceLock.XCL_PS_SKIP_RUN_THROUGH=0/1still force it either way.device_supported(agility.rs~350) callsenable_dred_once()before its probe, ascreate_devicedoes. The probe can run before the title's device is made, and DRED settings apply only to devices made after them.src_sccreads, program ends refused) are unchanged.Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T22:46:54Z.
Code review location:
crates/xcl/src/gpu/adapter.rs; line 174Medium:
device_adapterworks out the title's adapter again with a second enumeration and a device probe, instead of using the vendorreal::initalready records in ADAPTER_VENDOR, so the translation decision can disagree with the device actually used. If the NULL-pointer probe succeeds on the NVIDIA adapter butcreate_devicefails in init, the title falls back to another adapter or WARP while every PS was translated with skips run through, or the reverse. With the new name match, a DXVK-hidden NVIDIA card (VendorId 0x1002) is NVIDIA for the ps-skip gate but AMD for the ADAPTER_VENDOR-based paths (medium_compute_compile,driver_cachereference vendor), so one process makes contradictory vendor decisions. Deciding from the vendor recorded at device creation, and keying only pixel-shader cache entries on it, would keep them consistent.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T22:46:54Z.
Review: COMMENTED
Review of
3632bfa6: 1 finding(s) (1 medium), most severe first.Re-review at
3632bfa6. The Proton vendor-ID issue from theb3398570review is partly addressed: the adapter name now matches 'nvidia' too. Still open: the HLSL path keeps real execz branches, and the early device probe can run before the DRED/debug-layer setup. One new item below.crates/xcl/src/gpu/adapter.rs:174:device_adapterworks out the title's adapter again with a second enumeration and a device probe, instead of using the vendorreal::initalready records in ADAPTER_VENDOR, so the translation decision can disagree with the device actua.... (inline)These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T22:55:19Z.
Code review location:
crates/xcl/src/gpu/adapter.rs; line 174Not changed, for two reasons.
translation_cache_identity()(shaders/warm_replay.rs:117,warm_library.rs:74) beforereal::initstoresADAPTER_VENDOR(real.rs:1013), and the offline tools never make a title device. If the decision came fromADAPTER_VENDOR, the preparation would key its cache one way and the title the other. The probe follows the ruleinituses (device_candidates, first adapter that supports a device). The case where they part (the probe passes on the NVIDIA card andcreate_devicethen fails there) leaves a run-through on another adapter, which costs fetches but changes no result.medium_compute_compile(real.rs:5566) and the driver cache want the id DXGI reports. This gate wants the driver underneath, which under DXVK's spoof is still NVIDIA's. It is the NVIDIA driver that drops the writes: the GPU test fails under the spoof atb33985709. Making the gate agree with a spoofed0x1002would bring #3574 back on Wine. Whether those AMD-only paths should run on a hidden NVIDIA card is a question aboutmain, outside this PR.Also, on the summary: the DRED order is fixed at
3632bfa69(agility.rs,device_supportedcallsenable_dred_once()). The HLSL path was answered with a run in thekernel.rs:890thread: with the run-through off, it drew the disc shader right on an RTX 2070 SUPER, where the direct path lost 868 pixels.AI use: Claude Code (Claude Opus 5.5) checked the code and wrote this reply.
Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-12-03T03:33:52Z.
@Royalflamejlh reran on
3632bfa6: both fixes hold on the RTX 3060, and the suite is clean. What is left is the smoke pair on this head, plus one small case inflat_skips(S_MOVRELSD_2_B32, a one-word fix): https://github.com/xcl-dev/xcl/pull/3591#issuecomment-7354344974Imported from ivall/xcl. Originally posted by CharlyRien on 2026-12-03T07:38:08Z.
Test report from Windows with an RTX 3090 24 GB (driver 616.56), Ryzen 9 5950X, Windows 11 22631, release builds. Not a merge-check. This fixes a visible defect in the retail title, and a sweep over the title's pixel shaders shows what it fixes and what is left. Everything below was measured with this PR at
8ca2df9d; see the end for the current head.1. In game: the halo is gone
During a cinematic, an elliptic disc stayed frozen at the centre of the screen, covered by a regular dot grid, in every run (3 to 6 recorded frames per run). The pixel shader at fault is an edge-blur pre-pass with a vignette. Inside the ellipse, every lane of a wave takes the copy branch, so the wave skips the other block by
s_cbranch_execz. That is the shape of #3574. Bisected in game withXCL_HLSL_PS: the halo is gone when only this program goes through HLSL + DXC, and stays when the two other programs of the effect do.With this PR the detector counts 0 halo frames in two runs (469 and 306 recorded frames), against 3 to 6 per run before. There were no device removals, and the pace was 0.86 and 0.92 presents/s, against 0.77 to 0.98 for the same settings without the PR. In those two runs only this one program was translated again, though; the other pixel shaders came from an earlier cache. So this does not measure the GPU cost Foniass asks about.
2. Offline: three GPU tests
Each test draws both backends and counts the pixels left at the clear value (
main1c8b5514+8ca2df9d):XCL_PS_SKIP_RUN_THROUGH=0with this PRYour own tests and four existing PS mask / helper-lane GPU tests pass on that tree. The unwritten pixels come in whole waves: only the waves that straddle the ellipse's edge get written.
3. Sweep over the title's programs
A local offline probe (not upstream) translates each console program both ways, draws it with one triangle covering a 128×128 target on 3 synthetic input sets, and compares the direct DXIL output with the HLSL one. A first sweep without this PR found 119 programs (117 PS, 2 CS) where the direct path leaves pixels unwritten that HLSL writes. On those 119,
XCL_PS_SKIP_RUN_THROUGH=1against=0:flat_skipsis only used for pixel shaders).What is left is not a bug in this PR. A CPU probe that calls
flat_skipsthe waydxil/kernel.rsdoes, then replays its rules, shows that every skip it keeps in the remaining families is kept for one reason: the region writes EXEC (s_and_saveexec,v_cmpx,s_andn2 exec). No skip was refused for an export, a program end or a read after the region.switch, so none is taken.With EXEC 0 at the region's start, these writes leave EXEC at 0. As a local test, not for this PR as is, I widened the rule so that a region may write EXEC when each write can only narrow a zero EXEC (
v_cmpx,s_and_saveexec,s_andn1_saveexec,s_and,s_andn2ors_movof a zero mask;s_or_saveexecis still refused), and EXEC is zero at the region's end. The 17-program family then takes all 32 skips of each program and loses the whole-wave part of its holes (most go from 12,704 to 8,514 unwritten pixels). The other two families need more than that: a backward branch whose condition comes from a zero mask, and a kill branch that the rule cannot prove locally. That rule has had no independent review yet; I can share the patch if it is useful.The 8,514 pixels the 17-program family still loses are not #3574. They are single lanes, they depend on the input values, and they stay when every skip is run through. They are a separate NVIDIA problem, reported in #3772 (the same DXIL is right on WARP).
Current head
I have not run
3632bfa6. Since8ca2df9dthe PR refuses more regions (float-mode changes,src_sccread after the region) and also recognises NVIDIA by name. None of the 4 programs fixed above hass_setreg*,s_round_mode,s_denorm_modeors_movrel*(checked in an opcode census of the title's programs), so I expect the same result there. That is an inference, not a run.Setup
main493dbd3d+ #3528 + #3517 + local commits, with8ca2df9dcherry-picked.main1c8b5514+8ca2df9d+ our three GPU tests.main817eb1fc+ the local probe commits (tests only) +8ca2df9dcherry-picked, withXCL_PS_SKIP_RUN_THROUGH=1against=0; the direct path splits wave64 pixel shaders into two 32-lane halves. The widened rule is one more local commit on top.AI use: Claude Code (Claude Opus 5.5) wrote the tests and the probe, ran the bisection, the runs and the sweep, and wrote this comment; checked and posted by me.
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-03T07:46:16Z.
(Edited: the census sentence now says what it covered.)
@fromthemoonx thank you; point 3 is fixed at
f4413ddb3: a region withs_movrelsd_2_b32now keeps its branch, the way you suggested.execz_skips_over_a_relative_sgpr_move_keep_the_branchfails without it: it puts the move in the region and reads s31 after it. The smoke pair is of this head, on an RTX 2070 SUPER 8 GB (driver 621.01), the same title for 60 s:main395405e41,522 frames, peak commit 16,017 MB; this head 1,551 frames, 15,203 MB, 0 device removals, 0 crashes. The whole suite at this head on that card, debug: 3,016 passed, 0 failed, 52 ignored, 29 SKIPPED (22 no wave64); the PR's GPU test passed.@CharlyRien thank you for the runs and the sweep. Yes, please share the widened EXEC rule. We would take it as a follow-up pull request after this one rather than widen this one. This head refuses more regions than
8ca2df9d(float-mode changes,src_sccreads after the region, and nows_movrelsd_2_b32), and your census found no float-mode change and nos_movrel*in the 4 programs it fixed (src_sccreads were not in it). So I expect your result to hold at this head, but that is an inference, not a run.AI use: Claude Code (Claude Opus 5.5) made the change, ran the tests and wrote this reply.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-03T07:48:49Z.
Follow-up review of
f4413ddb, since3632bfa6(code reading only, not a merge-check) · 1 mediumIn short: This push refuses one more instruction inside a region that a wave with EXEC 0 runs through:
s_movrelsd_2_b32, whose destination SGPR is chosen by M0. A test covers it. The GPU-time point is unchanged.Medium
Checked and fine
s_movrelsd_2_b32writes an SGPR thatusescannot name statically, so refusing it by name inrun(ps_masks.rs~491) keeps a region from writing an SGPR that is live after it.execz_skips_over_a_relative_sgpr_move_keep_the_branchcovers it.S_MOVRELD_*was already counted as writing every SGPR (writes, ~70), so the M0-relative moves are now all covered.src_sccreads, program ends) and the NVIDIA detection by name are unchanged.Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-03T14:40:30Z.
@Foniass I measured the run-through's GPU cost with a synthetic draw, not in the title. On an RTX 4060 Ti, a skipped region run with EXEC 0 cost nothing measurable with 8 implicit-LOD samples in it, and up to 80 % of the same region's cost with every lane active when it held 32.
Setup:
f4413ddb3plus a timing test kept out of this PR. It is a full-screen 2048×2048 draw (65,536 64-pixel waves) of a wave64 pixel shader, translated as the PR's GPU test translates it. Itss_cbranch_execzregion holds Nimage_sample(implicit LOD, 1024² RGBA32F texture), summed into the exported colour. The region has no lane in any wave, or every lane in every wave.XCL_PS_SKIP_RUN_THROUGH=1and0ran in separate processes, 5 processes each. Each process gives the median of 20 timed draws; the table gives the median of those 5. The spread across processes was 0.001 ms or less, except one empty run-through at 8 samples (0.008 ms). RTX 4060 Ti 16 GB, NVIDIA 615.71.09, Linux, Wine, vkd3d-proton.Not tested: AMD (off there), other NVIDIA cards, this timing on Windows, and regions with explicit-LOD samples or loads.
AI use: Claude Code (Claude Opus 5.5) wrote the timing test, ran it and wrote this reply.
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.