Shaders: a skip around a loop stays only where lanes reach the scalars (#1914) #1952
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1952"
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 trustno1-coder/VIctory-NVIDIA. Originally posted by joeypercia on 2026-11-29T04:02:17Z.
Fixes #1914
What it changes
#888 (
90eb835, "retain empty-EXEC guards around a reachable loop") madewithout_skips'sstallskeep an empty-EXEC skip around every reachable cycle without a proven exit, and also whenever its search ran out of its 20,000-state budget. That covers the case #888 was for, a scalar loop whose exit depends on an inactive lane's old value brought in byv_readfirstlane, which can run as far as the watchdog. But it also takes the "without skips" forms away from every program with an ordinary loop behind a skip, and those are the forms that lower wave64 programs on 32-lane hosts. @matla00 bisected the swimming and boat buoyancy break to this commit and showed that reverting it alone fixes them (#1914).This keeps #888's protection where it applies and drops it where it can't:
water_shading:CS_TransmissionVolumetrics_Tiled's dark tiles, now run with #888's betterstep, which also decidess_cbranch_vccz/vccnzand treats anyv_cmpunder empty EXEC as an empty mask.v_readfirstlane/v_readlane). Without such a transfer, a loop whose exit isn't decided ends as the program's scalars say, the same with lanes as without, so it can't be kept turning by stale lane data.step's facts only grow compared with before #888: it decides more branches and never decides one differently. So every skip the pre-#888 check kept is still kept.How it was tested
VICTORY_HOST_WAVE=32 VICTORY_WAVE_WHY=1 victory translate shaders.rpfon the title's pack (26,084 programs),main568c5e5against this branch:main, 1,999 with this change;--list --jobs 1, 96 programs emit different DXIL. They include the water ones:water_compressed_simulation_rendertarget:CS_MinMax_*(3),RiverSimPacket:CS_HighDetailDeltas_SelectOutputPatches,water_micro_geom_renderer:CS_GenerateWaterPatches*(3),water_shading:*(6), and the water SSR / temporal-resolve passes. AlsoInstanceCulling(12),GpuParticleEmit(11),GpuParticleUpdate(6) and shadows.a_scalar_counted_loop_behind_a_skip_does_not_keep_it: a counted scalar loop (s_mov_b32 s6, 0…s_cbranch_scc0) behind a skip loses its skip in both modes. It fails onmain(the skip is kept) and passes here. #888'san_empty_wave_keeps_its_skip_around_a_loop_that_can_reach_the_watchdogpasses unchanged (its three cases: thevcczloop as a decided cycle, thev_readfirstlaneloop through the lane-read search, and thevccnzloop that exits).cargo testpassed for the crates it touches: yes,cargo test --locked -p victory-shader: 396 passed, 0 failed, 8 ignored.Not tested: in the game. @matla00, if you can, a swim and a boat on this branch would confirm it.
Checked for overlap
stalls. #1504 touchesir.rs(VGPR numbering only). I claimed #1914 before opening this.Written with Claude Code (Claude Opus 5.5): it found the change in #888, wrote the fix, the test and this description, and ran the tests and translations above.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Nosheboo on 2026-11-29T04:14:36Z.
Review: COMMENTED
This approach holds up against an independent check. I ran this PR's head (
7347259) and a value-tracking variant ofstalls(scalar dword values through mask algebra, comparisons, and induction counters) over the same 18 target shaders — spill-built wave64 programs fromshaders.rpfand the FidelityFX upscaler DLL,without_skipsin both modes, keep/remove pers_cbranch_execzsite:0x29f0, LocalLights0x4958, FrameStatistics0x1e30/0x1ec8, and the Submerged sets are identical except this PR additionally keeps0x1dc.0x0/0x1a4/0x1bc, SortRayTiles0x120/0x390, TAA-dual0x0, SSR0x338, cascade0xfa8, particles0x0/0x214. That is perf follow-up material, not a correctness gap — these match what the pre-90eb835check kept.0xc0is removed here but kept by the value-tracking variant, which could not prove that loop exits. If Trail still misbehaves, that site is worth a look either way.Verified fact: the keep sets agree on every previously identified stall. Judgment: the lane-read gate is the smaller, safer change versus value tracking, and it already restores the 32-lane forms. Same caveat as the PR body — no game run here, offline translation only.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Robotniq on 2026-11-29T08:50:01Z.
Tested in play on a 32-lane card: RTX 3070 Ti 8 GB, driver 621.40, Series S profile, DLSS Quality, ray tracing off;
568c5e5+ this PR.34992f2b65a789a5and71883e40620a567acome back,7168dd781ca7efb9and6b82bc7d22016cb5stay refused. Median frame rate 25.7 -> 25.1, VRAM peak about the same (6.50 -> 6.43 GB).7168dd781ca7efb9still dropped, glass, glasses, mirrors and bottles come out in glittering colours. Leaving34992f2b65a789a5and71883e40620a567aout again (VICTORY_SKIP_PIPELINES) removes it, and the water fix stays. On 32-lane hosts it may be worth keeping those two out until the third translates as well.Measured with AI assistance (Claude Code); the runs were made on my machine.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by MrEjecutor on 2026-11-29T16:59:21Z.
As asked on #888: offline
translate --liston this branch (7347259),VICTORY_HOST_WAVE=32,VICTORY_EARLY_DEPTH=1, against main568c5e5and main plus the retry from #888. Same files and switches for all three builds.568c5e57347259477b52e73ddeb6f2,8b437ab61d8008fe,17af85f170e66f30: emitted on this branch. On main they fail at0x218.5dc3b25986622949and6f225b641c5b0708: emitted, with the same short hashes (~d6a72e5f,~848b30db) on all three builds.So the retry PR is not needed for these three.
Not tested: in play (swimming, boats); emitted bytes compared beyond the short hashes the list prints; other cards (RTX 5060 Ti here).
AI-assisted (Claude Code): the builds, the runs and this text. No game files attached.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by dyshay on 2026-11-29T17:49:03Z.
Merged into our fork's integration branch for testing (dyshay/VIctory-NVIDIA, branch
janus-prs). I read the full diff first: no network access, process spawning, binaries, build or dependency changes, or game data. It builds with--profile diag --features diagnostics, and the CPU tests of the touched crates pass. Runs on an RTX 4090 are queued (Series S with ray tracing, and Series X, DLSS Quality). Frame times will follow here.