The prelude worker follows the helpers' priority, like the other threads the submitting thread waits for #322
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
hle
input
INTEL
lighting
linux-proton
memory
MULDER
needs-info
needs-logs
needs-rebase
NVIDIA
performance
post-merge
pr-diagnostics
pr-docs
pre-merge
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
relevance
high
relevance
low
relevance
medium
relevance
very-high
rendering
report
roadmap-proposal
saves
series-s
shaders
startup
status
blocked-by-rework
status
needs-test-report
status
needs-triage
status
ready-for-review
status
stale
status
superseded
status
wip
tools
ui
upstream
wontfix
No milestone
No project
No assignees
6 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
TrustNo1/Darner!322
Loading…
Reference in a new issue
No description provided.
Delete branch "iridiumlotus/Darner:prelude-raised"
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?
What it changes
DARNER_TIMELINE, diagnostics build of mainf3840d7plus #216) on an 8-core CPU, standing still in the open world: the submitting thread waits 7.7 ms a frame fordarner-preludein ten waits (WaitOnAddress at host::Host::submit < host::Host::send_late, ended bydarner-prelude), while that thread runs only 4.4 ms a frame. On the chain each frame's present came out of,darner-preludestands "woken, not running yet" for about 3.9 ms a frame (15.6 ms in the four frames sampled), more than half of the chain's 6.8 ms a frame of "woken, not running yet".DARNER_ASYNC_PRELUDES(on by default) records a submission's preludes on a worker thread, and the submitting thread joins it before it sends. The submitting thread runs above normal priority (or asDARNER_SUBMIT_PRIORITYsays, or highest on a core of its own), and the other threads it waits for are raised as well by the helpers' priority policy (DARNER_HELPERS_RAISED, on by default: above normal, or the number inDARNER_HELPER_PRIORITY;darner-wide, thelandpools,darner-heap-sync,darner-aside, ...). The prelude worker was started at normal priority, so on a CPU where the title's threads and the list translators keep every core busy it waits for a processor while the submitting thread waits for it. That is the caseDARNER_HELPERS_RAISEDwas made for (its comment incores.rsdescribes it on a 6-core CPU); this thread was not on its list.This gives the prelude worker a
cores::Priority, kept before each batch of preludes like the other helpers, so it follows the same policy they do: withDARNER_HELPERS_RAISEDon (the default) above normal, or the number inDARNER_HELPER_PRIORITYif one is given; with it off, normal. The submitting thread's own priority (DARNER_SUBMIT_PRIORITY, highest on a dedicated core) is not copied. Five lines inhost.rsplus the comment there; thehelpers_raisedcomment lists the thread and the measurement.Not in this PR: keeping the worker on the fast cores of a hybrid CPU (
keep_on_fast_cores), which the other helpers also ask for. I have no hybrid CPU to measure it on.How it was tested
Update, 2026-12-05 (UTC): rebased onto main
c8258f9(headda1db11);git range-diffshows both commits unchanged. On the rebased treecargo clippy -p darner-gpu --all-targets --locked -- -D warningspassed andcargo test -p darner-gpu --lockedpassed (1,805 passed, 0 failed, 81 ignored). The workspace-wide gates and the game runs below are from before the rebase and were not repeated on it.Tested revision:
d0bd297(this branch, on mainf3840d7) for the clippy gates and the policy check; the tests ran on its parent6ffc294(the head only rewords a code comment, after the review comment below). In the game: a release build of270e8bf, the same code (the later commits differ only in comments and in the commit message), withscripts\play-nvidia.ps1 -NoMenu -Dlss ultraperformance: loaded the save and stood in the world for the 2 minutes of the run, 0 errors; read from outside the process 150 s after the start,darner-preludeis at thread priority 1, asdarner-submit,darner-aside,darner-wide-0,darner-late-wait,darner-relayanddarner-list-0are.Commands and results: the A/B below; gates further down.
Changes a default: yes, for everyone with
DARNER_ASYNC_PRELUDESandDARNER_HELPERS_RAISEDat their defaults (both on). It changes one thread's priority. Expected to matter where the CPU is fully busy (8 cores or fewer) and to do nothing where a core is free for the worker anyway.A/B result: in-run A/B with
DARNER_AB(same run, same scene, the switch flipped every 7 or 10 seconds).DARNER_ABcan only flipDARNER_HELPERS_RAISEDfor all helpers at once, so these numbers are from an experiment build: mainf3840d7plus #216 plus this change behind a temporary switch of its own (not in this PR), built with--release --features ab. In it the worker's priority read from outside flips between 0 and 1 with the phases while the other threads stay at 1. Ryzen 7 5800X3D (8 cores, 16 threads), RTX 5080, 32 GB, Windows 11;scripts\play-nvidia.ps1 -NoMenu -Dlss ultraperformance(Series X profile, 2560x1440 output, scene 853x480, no ray tracing, no frame generation; the launcher setsDARNER_HELPER_PRIORITY=1, and the submitting thread is at 1 as well: no dedicated core, noDARNER_SUBMIT_PRIORITY), standing still in the open world on a daytime save, copied fresh from a backup for each run; 13.4 of the 16 logical processors busy. The scene's draw count moves between 6,700 and 14,600 a frame in a 60-second cycle, so each phase's mean frame time is fitted asa + b * draws + effect(A = the fit's value with the worker at normal priority; B - A = the effect):DARNER_ASYNC_PRELUDESas the second switch, 29 phasesRun 1 is the one to go by: it has every other thread as the launcher sets it. In runs 2 to 5 the experiment build also held
darner-late-waitanddarner-relayat priority 0 (the launcher'sDARNER_HELPER_PRIORITY=1has them at 1; a sixth run that flipped those two showed nothing: +0.8 ms +-0.8 and -0.5 ms +-0.8). With 10 s phases the A/B cycle is in step with the scene's 60-second cycle, so the busy stretch fell on the same side every time and the fit over draws has to carry that; runs 1 and 2 have 7 s phases for that reason. In run 5,DARNER_ASYNC_PRELUDES=0is -0.5 ms +-0.7 against the worker at normal priority.Also tried and left out because it adds nothing on top of the raise: the submitting thread recording the preludes itself when the worker has not begun them (-1.5 ms +-0.5 alone).
Gates run (the three in AGENTS.md; there is no CI):
cargo clippy --workspace --all-targets --locked -- -D warningspassed; the same with--all-featurespassed;cargo xtask policypassed (555 files ok); those three ond0bd297.cargo test --workspace --locked --no-fail-faston6ffc294did not pass as a whole on this PC: every package passes except three tests outside this change (it toucheshost.rsand a comment incores.rs, both in darner-gpu):watch::tests::ask_once_by_res_splits_reservations_without_refusals. It orwatch::watch_pipe_epoch_tests::ask_once_delta_reask_direct_carves_refreshes_and_updates_page_epochsfails in most full runs of the package here, on mainf3840d7without this change as well (3 full runs of 3 on main; 3 of 4 on this branch, the fourth all passed), and the first passes when run alone (3 of 3).emit::waterfall_tests::sampled_marks_restore_early_depth_only_when_safe_in_pixel_shaders(the fixture #227 fixes; it fails on main here too, see #216).oracle64::legacy_mul_forms_are_exactdid not finish: it goes through every float in a debug build; I stopped it after 25 minutes and ran the rest of the package without it.Gameplay, when relevant: RTX 5080, Series X profile, 2560x1440, DLSS ultra performance, no frame generation, no ray tracing.
Shader wave sizes tested, when relevant: not relevant.
Hardware dependence: may depend on the CPU. Measured on 8 cores / 16 threads. Untested on CPUs with more cores, on hybrid CPUs, and with the submitting thread on a dedicated core (dual-CCD V-Cache CPUs), where it runs at highest priority and the worker stays at the helpers' priority.
Coverage gaps: one scene (standing still, daytime), one PC. Not measured while driving or in cutscenes. Not measured with
DARNER_SUBMIT_PRIORITYorDARNER_HELPER_PRIORITYset to anything but the launcher's values. The frame times are from the experiment build described above, not from this exact commit; this commit's exe is not comparable run against run yet (it is a new build here, and its first runs still made pipelines).Checklist
main.docs/asset-policy.md.Checked for overlap
prelude,ASYNC_PRELUDES,HELPERS_RAISEDor thread priority (open and closed, 2026-12-04). #274 also changeshost.rs, in another place (the retirement queues).The implementation makes
darner-preludefollow the existing helper priority policy. The submitting thread still readsDARNER_SUBMIT_PRIORITYand can use highest priority when it has a dedicated core. Could the title and the worker comment say that the prelude now follows the other helpers? That would describe the behavior under those overrides as well as the default used for the A/B.WIP: [pr-performance] The prelude worker runs at the submitting thread's priority, like the other threads it waits forto [pr-performance] The prelude worker follows the helpers' priority, like the other threads the submitting thread waits forThanks, you are right. The worker follows the helpers' priority policy (
cores::Priority:DARNER_HELPERS_RAISED, and the number inDARNER_HELPER_PRIORITYif one is given); the submitting thread's own priority (DARNER_SUBMIT_PRIORITY, highest on a dedicated core) is not copied.Changed: the worker's comment in
host.rssays so now (d0bd297, comment only), and so do the title and the description. The A/B ran on the launcher's defaults, where the submitting thread and the helpers are both at 1; the description's coverage gaps now say that those overrides and a dedicated submit core were not measured.Test report on an Intel hybrid CPU: no measurable change here.
PC: i7-13700K (8P + 8E, 24 threads), RTX 4080 16 GB (driver 621.40), 64 GB, Windows 11 26300. Series X profile, 1440p with DLSS Quality, frame generation off, hardware ray tracing on, Reflex boost,
DARNER_D3D12_BACKGROUND=0.Builds: A = main
47d21cd+ #334, #337, #457, #274, #397, #312, #304. B = A + this PR (d0bd297).Method: the opening scene of one save, entered the same way every run (no input after the start screen); medians of per-second values from the host log in three 45-second windows from the moment the world appears; warm pipelines; one run of B, A twice.
DARNER_QUEUE_GAPS=1), ms a frameWithin the run-to-run spread (about 0.3 ms). No errors in the log, and the picture 60 s in matches A. A diagnostics timeline of a similar build (
f3840d7with the same PRs) had the submitting thread waiting ondarner-preludeinHost::submitfor about 16 ms per 470 ms of trace, so the wait is there on this CPU too; with 24 logical processors the prelude worker seems to get a core either way.Not tested: more than one run of B, other scenes, a CPU with fewer cores (where the PR's numbers come from).
Thanks for testing submitter takeover alongside the priority change. Did you also compare p95 frame time? In a separate experiment on a 5800X3D and RTX 5080, average FPS barely changed, but the slow frames improved in both short runs.
Both local builds were based on
f3840d73and already queued independent prelude work early. At the final join, the submitter could take the pending batch under the queue lock only if no worker was active. It recorded outside the lock and appended results after the completed prefix in submission order. One instrumented pass averaged about 9.6 takeovers per frame.Two warmed 20.5 s walking replays per build, Series X, hardware RT, DLSS Quality (3413×960 to 5120×1440), frame generation off. No counted dropped draws or dispatches in these windows. Traffic can vary. One pass per build had extra timing enabled.
These runs did not test #322 or establish a gain on top of raised priority. If you still have the takeover variant, comparing p95 and the share over 50 ms at fixed raised priority might be worthwhile.
Test report for
d0bd297merged on top of release v2026.12.04.01, on an 8-core CPU (the report above is from a 24-thread one).Measured: release build of v2026.12.04.01 (6 runs) against the same release + this PR (2 runs), each build after an uncounted warm-up run. Same save every run (the prison start, the cut to the plane, the first part on the boat) with recorded controller input, about 6.5 minutes a run. Launcher defaults for priorities (no
DARNER_SUBMIT_PRIORITY/DARNER_HELPER_PRIORITYset).Both PR runs have CPU preparation about 1 ms (12%) lower than every base run; the other builds measured on this release the same day (three other PRs and one switch, 8 runs) stayed between 8.37 and 9.10 ms, so this looks tied to the PR. p95 and p99 are also below every base run, by a little (about 0.6 and 0.8 ms on the means). Frame rate: no measurable difference: on this route the frame time is not set by the CPU side, so the lower preparation time does not show up as fps. Frames over 100 ms: no change. No crashes, in one PR run a single "placed texture lies inside the memory of a texture the host writes" warning (
resource.rs), which also showed up once in a release-only run of v2026.12.03.02. Only 2 PR runs, so the spread on the PR side is not known yet.PC: RTX 5070 Ti 16 GB, Ryzen 7 9800X3D (8 cores / 16 threads), 32 GB, Windows 11;
scripts\build-darner.ps1 -Build release, Series X profile, 1440p native, DLSS Quality, no frame generation, fullscreen, no fps cap.Measured unattended on a replay bench (same save, recorded controller input); numbers and text prepared with Claude.
d0bd297820toda1db11e3cI had only compared means at the time, so I measured it now.
Builds: one exe for both arms: main
c8258f9+ this PR + the variant behind a temporary switch (release build). A = this PR as it is (the submitting thread waits for the worker at the join). B = at the join the submitting thread takes the batch and records it itself when the worker has not begun it.Method: a recorded 320-second walk through the city at night (same save, same controller input), per-frame times from
DARNER_BENCH_CSV, order A B B A A B. Ryzen 7 5800X3D + RTX 5080, Series S, DLSS Performance to 2560x1440, frame generation and ray tracing off,DARNER_ASYNC_PRELUDES=1, six list-translation threads.In B the submitting thread took 4.6 to 5.3 of the 15 to 17 submissions' batches a frame.
Reading: p95 is about 1.4 ms (3 %) lower in every B run than in every A run, and the share over 50 ms a little lower. The mean at equal draws is 0.5 ms lower, which is inside the run-to-run spread here (about 0.4 ms), and two B runs had slightly lighter traffic. So a small gain in the slow frames on this scene, far from your 68 to 57 ms; this walk has few frames over 50 ms to begin with (1.4 %), yours had 22 %.
Not tested: Series X, ray tracing on, your resolution, more than three runs per arm. It stays out of this PR (one change per PR). If you open yours, I can run it on this bench.
[pr-performance] The prelude worker follows the helpers' priority, like the other threads the submitting thread waits forto The prelude worker follows the helpers' priority, like the other threads the submitting thread waits forTest needed — commit
da1db11e; what to check:DARNER_TIMELINE, diagnostics build of mainf3840d7plus #216) on an 8-core CPU, standing still in the open world: the submitting thread waits 7.7 ms a frame fordarner-preludein ten waits (WaitOnAddress at host::Host::submit < host::Host::send_late, ended bydarner-prelude), while that thread runs only 4.4 ms a frame. On the chain each frame's present came out of,darner-preludestands "woken, not running yet" for about 3.9 ms a frame (15.6 ms in the four frames sampled), more than half of the chain's 6.8 ms a frame of "woken, not running yet".DARNER_ASYNC_PRELUDES(on by default) records a submission's preludes on a worker thread, and the submitting thread joins it before it sends. The submitting thread runs above normal priority (or asDARNER_SUBMIT_PRIORITYsays, or highest on a core of its own), and the other threads it waits for are raised as well by the helpers' priority policy (DARNER_HELPERS_RAISED, on by default: above normal, or the number inDARNER_HELPER_PRIORITY;darner-wide, thelandpools,darner-heap-sync,darner-aside, ...). The prelude worker was started at normal priority, so on a CPU wheEvidence to post: card + driver, settings, commit tested, before/after (switch off vs on, two runs each), fps median and p99, and one line saying you looked at the picture.
Reply
testingto take this run; it's free again after 24 h with no results.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.