Repository navigation
Link victory.exe with a 16 MiB default thread stack - #151
ItsYusei99 wants to merge 1 commit into
Conversation
Threads created without a stack size take the executable's default reserve, 1 MiB from the linker. vkd3d-proton's and the driver's own threads compiling the title's large world shaders overflowed it under Wine on an RTX 4070 (four threads at one driver address during the world load). Reserve 16 MiB for MSVC targets; pages are committed only as used. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
An A/B test on Linux, with both runs on Setup: Arch (kernel 7.3.5), Proton Experimental
So the PR moves the failure from a silent exit to #144's driver fault. One caveat: the second run started with saved settings, so the two runs didn't take exactly the same path. AI use: Claude Code (Claude Opus 5.5) ran the builds and runs and wrote this comment. The results come from the runs described above. |
mercuryVM
left a comment
There was a problem hiding this comment.
Tested d77408b on Windows 11, RTX 5070, MSVC: cargo build -p victory succeeds. The built victory.exe has SizeOfStackReserve = 0x1000000 (16 MiB) in its optional header, so the linker argument takes effect. On this branch, cargo test --workspace fails to compile with E0428: the name tests is defined multiple times in crates/victory-gpu/src/host.rs. That is the duplicate test module #129 fixed on main after this branch was cut, not this change. Merged onto current main, the workspace tests pass.
- Safety screen: the new
build.rsonly printscargo:rustc-link-arg-bins=/STACK:16777216, gated onCARGO_CFG_TARGET_ENV == "msvc". It runs nothing, reads nothing and touches no network. -binskeeps it to binaries, so test harnesses and libraries are unaffected. As you say, it is a reservation, so only threads created with a 0 stack size get the larger default.- The reservation also applies to the title's own threads that pass 0. That is 16 MiB of address space each on 64-bit, which is harmless.
No issues found. A rebase onto main would let the branch test cleanly by itself.
AI-assisted (Claude Code).
…t thread stack Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merges Marvisak#115 Marvisak#151 Marvisak#238 Marvisak#353 Marvisak#378 Marvisak#476 Marvisak#482 Marvisak#535 Marvisak#649 Marvisak#664 Marvisak#1177 onto main (ffe310e), each head unchanged, no conflicts. One change of mine: Marvisak#378 turns the duplicate check in translate.rs into a nested `if !seen.insert(..) { if !list { .. } }`, which clippy::collapsible_if rejects under -D warnings; it is now one `if !seen.insert(..) && !list` (clippy --fix, same behaviour). cargo clippy --workspace --all-targets --locked -- -D warnings, with and without --all-features, is clean and cargo test --workspace --locked passes (354 passed, 6 ignored; main has 342 passed, 6 ignored). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Automated triage for the maintainers. Needs work: needs the maintainer's decision. This adds a new CI: no check runs on the head commit. Generated by Claude Code |
|
A data point for question (2) in the triage, from native Windows. On my machine this change stops the title at startup, and I haven't seen the overflow it guards against. Machine: RTX 5080 16 GB (driver 610.88), Ryzen 7 7800X3D, 32 GB, Windows 11 23H2, native D3D12, diagnostics builds. With the 16 MiB reserve, the title stops on its own breakpoint 1 to 3 s after start in 12 of 12 runs, with every setting I tried. Those runs used the Belobug fork, which carries this commit: 10 at 4cbe9d7 and 2 at 01aadd1. The call just before the stop is the title's reservation of about 185 MB that has to lie below 4 GB ( A map of the address space below 4 GB at that moment shows why. Only 19 MB is free, the largest free block is 11 MB, and there are 37 reservations of exactly 16 MiB. Those are the stacks of threads created without a size, and that includes the title's own threads: by thread start address and stack reserve, 55 threads start in the title image, all at the executable's default. Builds without this change have 37 reservations of 1 MiB at the same point, and the call succeeds. It is the reserve and not that fork's other changes:
Stack overflows on native Windows at 1 MiB: there are 131 logs of VIctory-family builds on this machine, all with the linker's 1 MiB default. 98 of them logged for 290 s or more, through the world load, some with a cold shader cache. None has a stack overflow ( On native Windows, then, the 16 MiB reserve takes low address space the title needs, and the case it fixes did not show up here. If the Wine case needs it, there are two ways to keep native Windows starting:
Fuller report, including what happens after the start: Belobug/VIctory-Belobug-AMD#121. (Runs and this note by Claude Code with Claude Opus 5.5, at the account owner's request. No title data.) |
Threads that are created without a stack size get the size the executable's header names, and the linker's default is 1 MiB. The host graphics stack creates such threads: vkd3d-proton's own threads and the driver's. When they compile the title's large world shaders, 1 MiB is not always enough.
Under Wine with vkd3d-proton on an RTX 4070 (driver 620.70.06), loading into the world overflowed the stack of four of those threads at once, all at the same Unix-side address in the driver. One of them was vkd3d-proton's pipeline-library disk thread:
apps/victory/build.rsnow passes/STACK:16777216to the linker for MSVC targets only. That is a reservation: pages are committed as they are used, so threads that stay shallow cost nothing extra. Threads that ask for an explicit size, such as Rust'sstd::threadwith its 2 MiB default, are unaffected.Tested
Linux, Wine 11.22, RTX 4070, Ryzen 7 9800X3D, title loaded by hand into the world. I checked the header field of the built exe (
SizeOfStackReserve= 16777216, release and diag).Caveat: the "after" run was on a newer
mainthat also includes #43. That PR fixes a stack overflow inside VIctory's shader lowering, which is a different place from the driver address above. I have not yet isolated the two with an A/B run on the same commit. The run then hit a separate driver fault invkCreateComputePipelines(0xc0000005), reported in #144.Not tested on native Windows. On Windows the same thread pools exist, so a larger reserve should be harmless there.
🤖 Generated with Claude Code