Loader: speculative pipeline builds run below normal priority #14
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ThatRecompDev--five-star-recomp!14
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/14/head"
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?
@marquezinii on GitHub · 2026-11-24 21:33 UTC · original
marquezinii:loader/compile-thread-priority→main· +227 −8 · 11 files · 1 commits · closed without mergingThe driver's pipeline compiles run on the build threads, next to the game's own threads. The slow boot frames in d3d12x-shim.md were game threads standing Ready while the driver compiled. With this change, a build thread runs a creation below normal priority unless something is waiting for it:
Promote) has its thread raised to normal priority.RunNow) keeps that thread's priority.--normal-priority-buildskeeps every build at normal priority, for A/B runs.Scope. This first version also lowered the program workers. Rebased onto the compile host, it now covers only the driver's pipeline build threads, as discussed. Program compiles are untouched: lowered in-process dxc threads starved an urgent compile through the heap lock, and the compile host now runs them at the asking thread's priority. It sits on top of the half-the-threads cap for speculative creations: the speculative threads give way to the game, and urgent creations keep normal priority.
What to watch in the A/B. The NVIDIA compiler still allocates from the process heap, which game threads use too. If a lowered build thread holding that lock starves a game thread, it shows as the same
WaitOnAddressstalls, and the switch would show it. Also compare:built sincein the sample summary).I measured only a model (11 in-process DXC compile threads next to an 8-thread frame loop on a 12-thread Ryzen 5 5600X): about 19 fps with the compile threads at normal priority, 52 to 100 fps below normal. That was dxc, not the driver, so the real numbers have to come from the A/B. @danik1222 offered a 4-core run on #13 once a build boots there.
Tests:
WorkerPriorityTestscovers speculative, urgent and awaited creations, promotion while running, a creation the game thread runs itself, and the switch.@ThatRecompDev on GitHub · 2026-11-24 21:36 UTC · original
Thanks, this is a nice clean split, and the model numbers are convincing. I'd like to hold it for a bit though, for two reasons.
First, we tried lowering our compile threads ourselves today and it backfired: a small compute program compiled inline on one of the game's Subrender workers went from about 8 s to 17.7 s, and the story transition stalled for 25 s. The waiting thread sat in
WaitOnAddress, which looks like heap-lock contention between the in-process dxc threads, so a lowered thread holding that lock starved the urgent one. Your version only lowers speculative work, which is smarter, but in-process dxc threads still share that heap.Second, we're about to move program compiles into a separate compile host process (its own heap and GC, prefetch capped at half the workers, speculative pipeline builds capped at half the build threads), and it touches the same files as your change.
Once that lands, could you rebase onto it? Lowering the priority of the driver's pipeline build threads, which have no shared dxc heap, still sounds worthwhile, and I'd happily measure it on our side with
--normal-priority-buildsfor the A/B.@marquezinii on GitHub · 2026-11-24 21:55 UTC · original
Makes sense, holding it. I've marked it as a draft until the compile host lands.
Once it does, I'll rebase and cut this down to the driver's pipeline build threads, with
--normal-priority-buildskept for the A/B. One caveat for that measurement: the build threads have no dxc heap, but the NVIDIA compiler still allocates from the process heap, which game threads use too. If the sameWaitOnAddressstalls show up with lowered build threads, the cause would be the same, and that would rule out this change as well.@danik1222 offered on #13 to run the A/B on the 4-core i7-4770 once a build boots there. With your 4090 numbers that gives one machine at each end of the range.
(The Windows check fails here on
D3D12XBarrierTests.The_console_texture_copies_move_textures_from_their_home_states_and_back, the same failure as on main since the lane-present merge.)@marquezinii on GitHub · 2026-11-24 22:43 UTC · original
Rebased onto main now that the compile host is in, and cut down to the driver's pipeline build threads. The program workers are no longer touched. It is out of draft for your
--normal-priority-buildsA/B, and I've updated the description.Thanks for merging #15 and for the lazy windows.
@marquezinii on GitHub · 2026-11-25 01:04 UTC · original
A/B on real boots: RTX 5070 (12 GB), Ryzen 5 5600X (12 threads), 32 GB RAM, commit limit 72 GB, driver cache warm after one cold boot. Build: this branch on
9e8772a. Each run starts from the first-run screens with Space taps; the timeout is 400 s.Mean present interval per 600 presents:
[PRÓLOGO], move/camera hints)--normal-priority-builds)--normal-priority-builds)So the boot and story-load frame times are the same within noise on this machine. Every run is about 33 ms per present for the first 40 s. The 1201-1800 window is 48 and 37 ms default against 61 and 52 ms normal, but with two runs each that is not a result. The hangs hit both settings, so they are not caused by this change.
The hangs:
nvlddmkmevent 153.Presentfails with 0x887a0005 and the game breaks in its device-removed handler at RVA 0x2474606.One side effect worth knowing about: after a removal, the machine's free commit fell from about 25 GB to under 1 GB within seconds, probably WER collecting the 22 GB process. On a smaller machine that alone can push it to its commit limit.
I can rerun one of these with
--d3d12-debug(DRED) if the hang is new to you.@marquezinii on GitHub · 2026-11-25 04:30 UTC · original
Closing this one, since the case for it has gone away:
The branch stays on my fork (
loader/compile-thread-priority) if lowering the driver build threads is ever worth measuring again.Pull request closed