Shaders, GPU: one back edge per loop header, and a large stack for pipeline threads #1883
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1885"
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 Marvisak/VIctory. Originally posted by powplusplus on 2026-11-25T00:04:05Z.
Two hangs in vkd3d-proton's pipeline creation, both in its DXIL conversion (dxil-spirv), which runs on the thread that creates the pipeline.
Module::single_latches, before writing, sends the back edges of a header with several through one new block that joins their phi values.Found with a native dxil-spirv build under gdb on the DXIL vkd3d-proton dumped.
Results
No program changes whether it emits or validates (
translate --validateover shaders.rpf, identical to70564ae). On main the programs that hit this do not translate yet; with #1883 they do, and then, on an RTX 3080 under Proton, each pipeline created on its own with a 120 s limit:The second run stopped after 35 of the 45 (the machine ran short of memory, nothing to do with the run). Those 35 include 30 of the 35 that hung. Not run yet with this: the four
CS_RaytraceVBuffer_*ShaderBinning*passes andCS_RaytraceShadows_Shared, which hung before, and the fiveCS_Subdivision_*programs.Testing
cargo test -p victory-shader -p victory-gpuunder Proton (RTX 3080 and WARP): as on main (victory-shader 204 passed, victory-gpu 74 passed; the same 5 and 4 fail on main there).Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T00:32:44Z.
Review: COMMENTED
Mixed PR: shader/formats parts are macOS-tested in the batch; GPU/HLE parts are Windows-only statics.
One back edge per loop header + large-stack…: apps+gpu+shader mixed — shader part in batch.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T08:18:04Z.
Automated triage for the maintainers.
This pull request no longer merges cleanly into
main(conflicts incrates/victory-shader/src/emit/bitcode.rs). It will be reviewed once it is rebased onto the currentmain. The earlier verdict (needs work) was for an older state ofmain.Generated by Claude Code
upstream-sync referenced this pull request2026-11-25 11:05:06 +00:00
Imported from Marvisak/VIctory. Originally posted by sinan-cmyk on 2026-11-25T11:52:19Z.
Offline measurement on a retail dump
Result: no count change against
main.I merged head
5aa10e54ontomain940d32f(clean merge) and ranvictory translate --validate --listonshaders.rpf(1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result withmainprogram by program (25,889 programs). Validated: 23,918 onmain, 23,918 with this PR.No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right.
No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by desplmfao on 2026-11-25T15:43:05Z.
@powplusplus a coordination question from #2309, which carries one commit of yours (
364c1bc, one back edge per loop header) together with a follow-up for loops with several back edges per block. The triage asked that it not land twice. Would you rather it land here in #1885 (then #2309 drops it and keeps only its own commit on top), or in #2309 (with your credit kept in the commit)? Either is fine with me; I'll follow whatever you prefer.Imported from Marvisak/VIctory. Originally posted by Foxiquek on 2026-11-26T04:24:08Z.
Tested on Linux/Proton, and it fixes the stack overflow and the resulting
warmhang.Setup: RX 9070 XT (RADV), Linux Mint 22.3, GE-Proton11-14. Release build cross-compiled with
cargo xwin. Both commits were cherry-picked onto the copy of VIctory in LooperSalty/AnyXboxX (third_party/victory, Neptune 2026-11-25c base), not onto this repo'smain.5aa10e5conflicted there, so its two stack changes were applied by hand, and that tree'svictory warmworkers gotPIPELINE_STACKtoo.victory warm shaders.rpf, same environment, before and after:has overflowed its stackstd::thread::scopewaits forevera1b20bc47e3c9597,e8c962358d862e3f,559d9f0184e15fe3The three hashes are the ones that overflowed. They're the same three programs as #2754. A 64 MiB worker stack alone (no emitter change) still overflowed on all three, which fits the unbounded recursion described there. The emitter commit is what fixes it.
cargo test -p victory-shader --release: 185 passed, 0 failed, 2 ignored.Not tested yet: a game run with this, and Windows.
Imported from Marvisak/VIctory. Originally posted by Foxiquek on 2026-11-26T05:25:40Z.
I rebased this onto current
main(63bcca4), in case it helps it land: Foxiquek/VIctory@rebase/pr1885-one-back-edge (compare). The conflict was inemit/bitcode.rs.mainadded a freesuccessors(term)helper, sosingle_latchesand the new test use it instead of the secondsuccessorsmethod. Nothing else changed, and authorship is kept.Checked on the rebased branch:
cargo xwin build --release -p victorybuilds.clippyreports nothing in the PR's lines, andrustfmtshows no new differences frommain.victory-shadertests, run under GE-Proton11-14 on an RX 9070 XT: 301 passed, 2 failed, 3 ignored.maingets 300 passed with the same 2 failing (hosts_that_do_not_fuse_are_named,stub_pipeline_is_created). Both are Wine-host tests: no real WARP, and vkd3d accepts an unsigned stub.a_header_with_two_back_edges_gets_oneandwritten_bytes_unchangedpass.Not tested on Windows, or in game on this rebase. The in-game result in my comment above was the same two commits on AnyXboxX's tree.
Imported from Marvisak/VIctory. Originally posted by ColorMeBoom on 2026-11-29T17:36:32Z.
Linux + NVIDIA under Wine: #1885 tested, four programs still need dxil-spirv b540c8a; reaches gameplay with it
Tested #1885 on Linux with an NVIDIA GPU, running the title from first boot into gameplay. Short version: #1885 removes most of the overflows, but four compute programs still overflow the older dxil-spirv on any stack size. With vkd3d-proton built against dxil-spirv
b540c8athey all convert, and the title reaches gameplay with faces rendering.Setup
WINEDLLOVERRIDES="d3d12,d3d12core,dxgi=n")71cae091built locally (dxil-spirvb540c8a)mainat63bcca4+ #2723, #2118, #439, #2703, #2101, #2312, #2969, #1722, #2968, #1885, diagnostics build cross-compiled with clang-cl/lld-link1.
translate --pipelineswith #1885 and the older dxil-spirvFour compute programs still overflow, even with a 256 MB worker stack. Each overflows within about 50 ms:
vkd3d-proton's shader dump shows the DXIL reaching it and no SPIR-V coming out, so the recursion is inside dxil-spirv. Proton Experimental's vkd3d-proton (3.2.0, 20261123b) gives the same result as GE's.
Under Wine a stack overflow ends only the thread that overflowed, not the whole process. So the pre-build never finishes: it waits forever on jobs whose workers have died. I worked around that on my branch (happy to open PRs if they're wanted):
translate --pipelineshonoursVICTORY_SKIP_PIPELINESin diagnostics builds.With those four programs skipped, the pre-build finishes in about 15 minutes (23,441 pipelines made).
2. The same with dxil-spirv
b540c8aWith vkd3d-proton master (dxil-spirv
b540c8a) and no skip list, there are no overflows. All four programs convert, and the pre-build exits 0 in 18 minutes (23,443 made). This agrees with #2754:b540c8aor later is needed under Wine even with #1885.3. Running the title (headless, input scripted with
VICTORY_KEYS)skipped shader fdd56d97a806bccadropped 1–2 times per frame once in the world.b540c8a, nothing skipped: faces render in the opening cutscene. It got through to the first gameplay area (the prison yard) within 20 minutes.crashes.log. Peak usage was 33 GB committed memory, 22 GB RSS and 11.3 GB of GPU memory.Still open
mesh: no dynamic slots for root views. There were 1,013 log lines in the longer run, for example[mesh 3b408d7e675fddc5, pixel c5d4ff74b695d1f2]. In the prison yard the player character's head may be missing, possibly related. I haven't checked further.Screenshots and full logs are available if useful.
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.