Repository navigation
D3D12.X: the builds a submit waits for do not take turns among the big compiles - #2141
Royalflamejlh wants to merge 2 commits into
Conversation
…bind A compute pipeline that is not built yet was waited for at its bind: the title's thread stood in SetPipelineState, built the pipeline itself, and only then reached the next one. A title that binds many unbuilt compute pipelines in one frame got them one after another. SetPipelineState now binds what is there. A Dispatch, or an ExecuteIndirect that dispatches, whose pipeline is still being built ends the list's segment, as a mid-list Wait after a Write64 does, and gets a closed segment of its own between that one and the next: a translated dispatch sets everything it needs itself (root signature, the six views, the pipeline), so it can be recorded later than the calls around it. The title's threads go on recording, and the pipelines the frame binds next reach the workers while this one is built. At ExecuteCommandLists (and KickoffX) each such segment is reset and its call recorded through the same wait the bind made (XCL_PSO_WAIT_MS still bounds it). A dispatch whose pipeline fails to build is skipped and counted, as before. While a submit stands in that wait, the lists it carries and their Write64 signals are not on the queue yet, and another queue's GPU wait for one of them ran into the 5 s watchdog and was released on the CPU (3 lines a run). The watchdog's clock now stands while a bind or submit is held for a build. A put-off pipeline goes before the workers' queue: behind a start-up backlog the submit thread would build them itself, one after another, where several title threads built at once before (a debug build on Windows stopped presenting on its first screen that way). At the submit the next four of its put-off pipelines are marked wanted as it goes, the leave a title thread's own build has today, so about as many are in the driver at once as the title's threads had there before. The segments of a title list record on an allocator of that list's own, because the title's may be recording another list by the submit; it is not released while the GPU may still run from it. They share one argument arena: a block each filled the coherent window. A recording takes 256 extra segments (32 before), two for each such call. Past that, on a list that cannot be split, and under predication the call waits where it is, as before. The console-list replay, Reset, ClearState and KickoffX's re-open wait where they did. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…g compiles Big driver compiles on the workers go one at a time (BIG_COMPILES), each once the commit headroom it asks for is free. A pipeline whose call was put off to the submit is one the title needs for this frame: its build now takes a lane of its own, four at once, and still waits for its headroom. Programs of 4 MiB or more stay in their lane, one at a time. From cold driver caches, with four compile threads, a retail title finished 69 compute builds of 3 s or more in the 211 s after its world start with this and the commit below it, against 31 with that commit alone and 34 without either (Linux, 1 run each). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
de1976c to
1a18762
Compare
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Tested Hardware: RTX 3060 12 GB (32-lane waves), driver 32.0.16.1062 (610.62), Ryzen 7 5800X, 32 GB RAM (commit limit 56 246 MB with the page file), Windows 11 Pro build 26300, rustc 1.100.0, DXC 1.8.2502.11 from the Windows SDK. Each commit built with Tested
Compute driver compiles of 3 s or more that finished (all after the first
Regression run ( Not tested
AI use
|
|
@fewmet thank you: that is the Windows title run and the memory figure this was missing, at the default thread count, and your numbers are in the description now. Still open on my side: #2118 alone in the title on Windows, to split the 1.5 to 2 GB between it and the lane, and a run with #2098 merged in. AI use: Claude Code (Claude Fable 5.2) wrote this. Posted without review by a person: the account owner was away and reads replies later. |
Stacked on #2118; its own commit is the last one,
1a18762.Big driver compiles on the workers go one at a time (
BIG_COMPILES), each once the commit headroom it asks for is free (#1774). With #2118 a pipeline whose call was put off to the submit is one the title needs for this frame. Here its build takes a lane of its own, four at once, so those builds run together, each still waiting for its headroom. From cold driver caches a retail title finished 69 compute builds of 3 s or more in the 211 s after its world start with both, against 31 with #2118 alone and 34 without either (Linux, 1 run each). Scheduling under #2088; part of #505 and #1833.Beside #2098. #2098 scales
BIG_COMPILES' slots with the CPUs, so the workers' big builds already run several at once. With it merged this lane's four should be its number, not a second one: if it merges first I rebase onto it and measure again. Not measured with #2098 in.What is in it
real.rs:SUBMIT_COMPILES, a lane of four, whichcompile_slotsgives a build thatpso_async::build_is_needed_by_submit(). Programs of 4 MiB or more stay inGIANT_COMPILES, one at a time. A build already waiting for its turn when its call is put off stays there.pso_async.rs:build_is_needed_by_submit, read from the flag D3D12.X: a dispatch waits for its pipeline at the submit, not in the bind #2118'sneed_by_submitsets; testa_build_knows_a_submit_needs_it.Tested
x86_64-pc-windows-gnu; vkd3d-proton v3.1-90-g30b0eb9b with the relaxed-vtable patch from Linux (Wine + vkd3d-proton): a retail game reaches whatmainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #175 and dxil-spirv#372.cargo build --workspacethencargo test --workspace --release --target x86_64-pc-windows-gnu --no-fail-fast -- --test-threads=4on1a18762: lib 1097 passed, 3 failed, 26 ignored (two skipped, which hang under Wine, Tests: the D32S8 target test waits at most 10 s for its list #1706); other test binaries 53 passed, 3 failed, 20 ignored. The six failures are the ones ofmaincbc296a(named in D3D12.X: a dispatch waits for its pipeline at the submit, not in the bind #2118; there lib 1093, 3, 26 and 53, 3, 20). 24 lines print SKIPPED on both.main4178e88with nine pull requests, three more dxil-spirv patches in vkd3d-proton,XCL_DXC_THREADS=4, 300 s). The row with the lane ran D3D12.X: a dispatch waits for its pipeline at the submit, not in the bind #2118's earlier form33424af, which had this lane in it without the bound of four (with four compile threads there were four workers to use it) and did not yet count two dropped dispatches.#101queue.Waittimeoutscbc296aand 2 of1a18762): such builds finished 7, 12, 7, 8, 7 against 17, 10; most at once 2–3 against 7, 4; peak commit 44.8–45.5 GB against 46.6, 47.1 GB; least available memory 5.3–6.9 GB against 4.8, 4.6 GB; 0queue.Waittimeouts, 0 dispatches skipped, no removal or crash in the seven. So on a 32 GB machine D3D12.X: a dispatch waits for its pipeline at the submit, not in the bind #2118 and the lane together cost about 1.5 to 2 GB of commit at the peak and left 4.6 GB available; D3D12.X: a dispatch waits for its pipeline at the submit, not in the bind #2118 alone was not run there.1a18762: thepso_async::,list_x::,title_list::,bind::,alloc_pool::andreal::tests in debug, 95 passed, 0 failed;scripts/smoke.ps11560 frames againstmaincbc296a's 1568,60 60 60on both, 0 removals, 0 crashes, peak commit 14488 MB against 14458 MB. On the earlier form33424af: thepso_async::,list_x::,title_list::,bind::andalloc_pool::tests in debug, 48 passed;scripts/smoke.ps11539 frames againstmaincbc296a's 1568,60 60 60on both, 0 removals, 0 crashes, peak commit 14485 MB against 14458 MB.Regression run
Under Wine on Linux, as in #2118 (peak commit reads 0 MB there;
exit: 0x89is the wrapper ending Wine).main:
PR:
Not tested
1a18762on Windows by me beyond the named tests and the smoke pair; D3D12.X: a dispatch waits for its pipeline at the submit, not in the bind #2118 alone in the title on Windows; the bounded lane in the title under Wine, and the default number of compile threads there; a machine with less than 32 GB or a card with less than 12 GB in the title; runs longer than 300 s; AMD and Intel.AI use