Repository navigation
Shaders: offline pipeline builds use the runtime workers' 64 MB stack - #2070
thisguyStan wants to merge 1 commit into
Conversation
`xcl shaders --measure-pso` called CreateComputePipelineState on the main thread, whose stack xcl.exe reserves at 1 MB, and `--precompile` (with `--pipelines`) on scoped threads with Rust's 2 MB default. The driver compiles on the calling thread, so a measurement of what a build costs could end on a stack limit of XCL's own thread instead: on RADV under Wine, `--measure-pso` of the flat compact form of the largest compute programs ended with "thread 'main' has overflowed its stack" (xcl-dev#1269). ClosetPie107 reported the `--pipelines` side there first. Name the stack of the runtime's pipeline workers (`pso_async::WORKER_STACK`, 64 MB) and run both offline paths on a thread with it, so they build as the workers do. The runtime itself is unchanged. A first-time compute build at a bind (`XCL_LAZY_PSO` on, no `XCL_PSO_WAIT_MS`) still runs on the title's thread, with the stack the title gave it. Part of xcl-dev#1269. Assisted-by: Claude Code (Claude Opus 5.5) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Full-suite run, since this PR has no test report yet. Tested exact head Tested
Not tested
AI use
|
|
NVIDIA RTX 3070 on native Windows, head Tested
Regression run ( PR head That is 97 % of the base's frames and 107 % of its peak commit. One run each; the Not tested
AI use
|
|
A run of the Tested
Not tested
AI use
|
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
xcl shaders --measure-psobuilds its pipeline on the main thread (1 MB stack inxcl.exe's PE header), and--precompile --pipelineson scoped threads with Rust's 2 MB default. The driver compiles on the calling thread, so a measurement of what a build costs can end on a stack limit of XCL's own thread. On RADV under Wine,--measure-psoof the flat compact form of the largest compute programs ended withthread 'main' has overflowed its stack, and those runs were used to compare forms in #1269 (#2018 / #2025 threshold). This runs both offline paths on the stack of the runtime's pipeline workers (64 MB), so they build as the workers do. @ClosetPie107 found the--pipelinesside in #1269 (comment, "Stack size of the offline tool"); this follows it. Part of #1269.What is in it
crates/xcl/src/hle/d3d12x/pso_async.rs: the workers' stack asWORKER_STACK(same 64 MB, no change at run time).crates/xcl/src/shaders.rs:--measure-psoruns on aWORKER_STACKthread (on_worker_stack), and the--precompilethreads, which also make the--pipelinesbuilds, are spawned with it. Two unit tests: the thread's stack reserve is at leastWORKER_STACK, and a panic on it reaches the caller.Not changed, and worth knowing for the RADV result
Only some runtime builds run on the 64 MB workers: pipelines an earlier run used (prebuilt at low priority), and builds after an
XCL_PSO_WAIT_MSbudget ran out. By default (XCL_LAZY_PSOon, noXCL_PSO_WAIT_MS) a compute pipeline is built at its first bind on the title's own thread (pso_async::resolve_wait_for), and XCL does not change the stack size of title threads. The title tested here defaults to 1 MB in its PE header, which answers the open question at the end of that comment. So the RADV overflow above may also happen in a title run under Wine, on a title thread. A bigger stack is not a cure-all either: a PSO worker overflowed its 64 MB on an unbounded recursion in dxil-spirv (comment). This PR does not change that; moving those builds off title threads is runtime work (#2001 goes in that direction).Tested
cargo test --workspace -- --test-threads=4onmain5ce558f+ this change: 1148 passed, 0 failed, 46 ignored. Windows Developer Mode on, soshaders::tests::pso_measurement_compiles_an_exact_synthetic_recordruns and passes.SKIPPED: 20 "no wave64", 3 per-lane form f16 refusals, 1 "no heap windows".xcl.exe's PE header reserves 1 MB for the main thread (SizeOfStackReserve), which is where--measure-psobuilt before.xcl shaders <pack> --measure-pso ef008c0f04b6261a --repeat 3(a 1.1 MB HLSL-path compute program), release,mainagainst this change on3da2abb: identical DXIL (1 121 012 B); driver median 139.1 s against 141.1 s (ranges 138.2–141.5 s and 139.1–143.4 s), within run-to-run spread.xcl shaders <pack> --precompile --only cs --pipelines --used-only(the 482 pipelines earlier title runs used here;XCL_PIPELINE_MAX_KB=512; an emptyXCL_DXIL_CACHEper run), release,main5ce558fagainst this change: both compiled 322, made 318 pipelines, refused 0, capped 4; 306 s against 275 s.--measure-pso ef008c0f04b6261a --repeat 3again on5ce558f: identical DXIL; driver median 136.0 s (main) against 132.9 s.Regression run
main5ce558f:0fd51f9:main's frames, 112.7 % of its peak commit, no device removal, no crash. The 60 s run does not reachxcl shaders, so it only shows the runtime is not broken by the shared constant.Not tested
AI use
🤖 Generated with Claude Code