Shaders: a translator panic is a refusal, and the translation switches are put back after one #2917
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!2917
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2917"
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?
@Proudnoob4 on GitHub · 2026-11-29 18:48 UTC · original
Proudnoob4:pr/translator-panics→main· +74 −55 · 6 files · 2 commits · openWhat it fixes
with_wide_fallback,with_last_resort,with_half_meets,with_pair_meetings,with_local_waves(_any),with_pixel_maskandwith_first_half_pairsset a thread-local flag, run the translation, then put the flag back, but not when the translation panics. The pipeline workers catch panics (make_with) and keep going, so the flag stays set for every later program on that thread. Seen while translating 2,680 programs in a row on one thread: after one program panicked in the wave-wide fallback, a program that translates fine on its own panicked too, in the form the leftover flag put it in.extern "system"), a panic isthread caused non-unwinding panic. aborting.We hit this on a 32-lane card (RTX 4080) with a wave64 compute program fromDeserializeComputePipelineStateX(0x218) in the wave-wide fallback (9bba2a20):forward reference outside a phi(bitcode.rs:948). Its plain container translates.How
lower::with_flagsets the flag and puts it back from a drop guard, so also on unwind. The eight switches go through it. (#2368 does the same forwith_program's hash and counts; the two don't touch the same files.)shader_cacheruns the translation undercatch_unwind: a panic becomes a refusal (the translator panicked), and the panic's message is still in the log.The wave-wide fallback's bad IR for that program is not fixed here; the program is refused now.
Tested
a_flag_is_put_back_when_the_translation_under_it_panics.cargo test -p victory-shader --lib --locked: 412 passed, 51 failed. Main gives 411 and the same 51 here, all for want of an SM 6.6 device (Windows 10, test binaries without the Agility SDK); none fails only with this change.crates/victory-loader/src/crash.rs:804(as on other open PRs, e.g. #2487), before it reaches this change.cargo clippy -p victory-gpu --no-depsflags nothing in the changed code (its oneshader_cache.rswarning, the unusedAtomicBoolimport at line 14, is on main too).AI-assisted.
@AimLogin on GitHub · 2026-11-29 19:48 UTC · original
Review note (read against
mainf889bb07, not run):Two thread-local switches are still set and reset by hand, so a panic inside them leaves them on for the next program on that thread:
with_folded(emit/lower.rs721-725,FOLDED.replace(true)…FOLDED.set(was)). The hunk at 726 convertswith_local_wavesright after it but not this one. It matters as soon asVICTORY_WAVE_FOLDED=1is set: one panic in a folded translation would lower every later program on that worker as folded.COUNTINGinemit/bitcode/census.rs73-75. This only affects the census, but it has the same pattern.Routing both through
with_flagwould cover them. A test like the one inlower/tests.rs, panicking insidewith_foldedand then checkingfolded()is false, would pin it.One more small point: a panic refusal becomes dropped work for that program, so a distinct, greppable reason in the log and in the census output (e.g.
refused (panic)) would make such programs easy to count across a corpus run.Review was AI-assisted.
@Proudnoob4 on GitHub · 2026-11-29 20:04 UTC · original
Thanks @AimLogin, both fixed in
e4e503ff:with_foldedand the census'scounting()now go throughwith_flag. A new test,folding_is_put_back_when_the_translation_under_it_panics, panics insidewith_foldedand checks thatFOLDEDis false afterwards.translation panicked: <the panic's text>, worded as the CLI'scontain_panic. In a precompile this catch now runs before that one, so the failure summary keeps the text, and the play log'sshader does not translateline carries it too.Option(emit/cost.rswith, and the test bodies inopt.rsandlds.rs), so I left them.New since the PR was opened: on main's v2026.11.29.02 hotfix (wave64 folding off by default since
5c262d7b), regular play hit a translator panic on a pipeline worker. This was an RTX 4080, with this PR and other open PRs applied: compute1aba2732fc75484f,forward reference outside a phi(bitcode.rs:1093), on threadvictory-pipelines-11. With this PR it was refused, and the 330 s run went on with a normal picture. None of eight runs before the hotfix (folding on) met a panic.Checked:
cargo test -p victory-shader --libgives 413 passed, both put-back tests among them. The 51 failures are the same as on main here (no SM 6.6 device). Clippy finds nothing in the changed lines;shader_cache.rs's one warning, the unusedAtomicBoolimport at line 14, is on main too.--all-featuresstops incopystat.rsandhost.rs, files this PR doesn't touch.AI-assisted.
@AimLogin on GitHub · 2026-11-29 20:40 UTC · original
Thanks. I checked
e4e503ff:with_foldedandcounting()now go throughwith_flag;folding_is_put_back_when_the_translation_under_it_panicscovers the case;Both points are resolved from my side (read, not run).
@dyshay on GitHub · 2026-11-29 20:46 UTC · original
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. A run on an RTX 4090 is queued (Series S with ray tracing, DLSS Quality). Frame times will follow here.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.