Repository navigation
Shaders: offline pipeline builds use the runtime workers' 64 MB stack - #2070
thisguyStan wants to merge 1 commit into
Conversation
|
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! |
0fd51f9 to
4772a13
Compare
|
Thank you @futurepro62, @Parakeet-Wheat, @DavidM1911 and @JoaoPauluu for testing across RTX 5070 Ti / an RDNA2 iGPU, RTX 3070, RTX 3060 Ti, and RTX 3060 under Wine with vkd3d-proton! Rebased onto
AI use: Claude Code (Claude Opus 5.5) made the changes, ran the tests and wrote this comment. |
`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 (`worker_thread`), so they build as the workers do. The threads `--pipelines` starts to build a split program's dispatch-chain pieces get it too. The threads are named (`xcl-measure-pso`, `xcl-precompile-{k}`, `xcl-pipeline-piece-{k}`): an overflow under Wine printed `thread '<unknown>'`, which could not be told apart from a driver's thread. 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>
4772a13 to
8cb4346
Compare
bmjask
left a comment
There was a problem hiding this comment.
No concrete source defect found. Shared 64 MiB worker stack is applied consistently and result/panic propagation is sound; tests cover reserve/name/unwind. Current official Windows CI is not visible, despite strong reported suite/smoke. The RADV/Wine recursion limitation is appropriately disclosed. A bounded deep-stack/large-build integration case would strengthen tests, but I found no blocker.
|
AMD RDNA3 on native Windows: full suite of Test report for head Tested
Not tested
AI use: this run and report were done by Claude Code (Claude Sonnet 5.5), driven by |
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: one helper,worker_thread, makes a named thread withWORKER_STACK.--measure-psoruns on one (on_worker_stack,xcl-measure-pso), and so do the--precompilethreads, which also make the--pipelinesbuilds (xcl-precompile-{k}), and the threads--pipelinesstarts for a split program's dispatch-chain pieces (xcl-pipeline-piece-{k}, from Shaders: prebuild split compute dispatch-chain pieces under --pipelines #2338). They had no name, so an overflow printedthread '<unknown>'. Three unit tests: the thread's stack reserve is at leastWORKER_STACK, a precompile thread gets the stack and its name, and a panic on the thread 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=4on this PR's head8cb4346(onmain2898511): 1366 passed, 0 failed, 46 ignored. Windows Developer Mode on, soshaders::tests::pso_measurement_compiles_an_exact_synthetic_recordruns and passes.SKIPPED(28): 21 "no wave64", 3 per-lane form refusals (V_CVT_F16_F32,V_PK_MUL_F16,V_MUL_F16), 2 "no d3d12SDKLayers.dll", 1 "no heap windows", 1 "no D3D12 debug layer".xcl shaders <pack> --precompile --only cs(XCL_NETWORK=0, an emptyXCL_DXIL_CACHE), release, this change onmain3f4495a(the same change as8cb4346before the rebases since, without the piece threads of Shaders: prebuild split compute dispatch-chain pieces under --pipelines #2338, which was not merged yet): all 26 503 shaders, compiled 2 689 compute programs, 0 errors, exit 0, 4 455 s. An earlier pass of the same kind on an older base had stopped with exit 1 and no message at about 23 000; this one went through.xcl.exe's PE header reserves 1 MB for the main thread (SizeOfStackReserve), which is where--measure-psobuilt before.xcl shaders <pack> --measure-pso <record> --repeat 3(one 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 <record> --repeat 3again, on the same program, on5ce558f: identical DXIL; driver median 136.0 s (main) against 132.9 s.Regression run
main2898511:8cb4346:main's frames, 102.4 % 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
--precompile --only cs --pipelinesoverflows its pipeline threads onmainand on this PR alike (@JoaoPauluu's run), so the stack does not help there. That is one of dxil-spirv's endless recursions, which all started inflatten_subgroup_shuffles()on the CFG before structurizing; dxil-spirv runs that pass after the structurizer since HansKristian-Work/dxil-spirv@694cc674, and vkd3d-protonmastercarries that since HansKristian-Work/vkd3d-proton@89439562. Nobody has rerun that case with it yet. On the HLSL path none of the 2 674 compute programs of the pack has the second back edge Direct DXIL: xcl pipelines workers overflow their 512 MB stack on big compute programs under Wine #1805 found on the direct path (checked fromdxc -dumpbin); since8dcc56dthe enormous ones take the direct route, where Recompiler: direct DXIL gives every loop head and block one back edge #1860 is the XCL-side fix.AI use
🤖 Generated with Claude Code