Bound heap refresh waits by command list closure #397
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
7 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
TrustNo1/Darner!397
Loading…
Reference in a new issue
No description provided.
Delete branch "andrewpozdnakov7-jpg/Darner:assist/193-bound-heap-order-wait"
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?
Contributor role (optional)
What it changes
Refs #193.
Thin-list heap ordering waits for every open refresh pass in an epoch when a submitted list skips its own refresh. That includes passes opened after this list was closed. Track the newest eligible refresh pass at command-list closure and wait only through that cutoff. Older relevant passes can still complete and queued refreshes are still claimed before submission. The epoch fallback remains for lists without a close mark.
How it was tested
67fa709aonf3840d73.cargo build --locked --offline -j 2 --profile fast --features diagnostics -p darnerand compared the same opening from 45 to 120 seconds after the world marker. Full tester reportChecklist
Checked for overlap
Test report for
67fa709against mainf3840d7(release builds withbench-remote), on the city route the description says is still unchecked.PC: RTX 5070 Ti 16 GB, NVIDIA driver 621.47, Ryzen 7 7800X3D, 31 GB RAM, Windows 11. Series X profile, 1080p upscaled to 1440p with DLSS Quality, DLSS frame generation 2x, hardware RT on,
DARNER_THIN=1(thin heap order on,limit_us=50000). A browser playing music stayed open during all runs.Method: automated camera flight over the city (
cam-city60, same save and route each run, both builds on one warm cache), main, PR, main. The figures below are summed from thethin heap order:five-second lines over each whole run.The wait drops as described:
Frame rate: no measurable change. Median 13.6 fps on main (13.0 to 14.2 across the two runs) against 13.7 on the PR; p99 120.5 ms against 123.8 ms. On this route the submitting thread is mostly busy preparing (about 84 % of a ~70 ms frame in a
DARNER_LONG_FRAMES=1run on main), so ~26 ms a second of waiting saved is worth about 0.3 fps at most, well under this route's run-to-run noise (about 1.5 fps). Memory peaks unchanged (VRAM 14.87 vs 14.78 GB, commit 56.1 vs 55.8 GB).One PR run only, so the timeouts (5 against 3 and 0) can't be told apart from noise. I did not look for the flicker. Not run: the three gates (
cargo clippyx2,cargo test).Test report, together with #274: both merged on top of main
f3840d7with #334 and #337, so these numbers can't tell the two apart.PC: RTX 4080 16 GB (driver 621.40), i7-13700K, 64 GB, Windows 11 26300. Series X profile, 1440p with DLSS Quality, frame generation off, hardware ray tracing on.
Method: the same manual route in one save every run (a drive, a cutscene, a river and city stretch), about 3.5 minutes each, one run per side; medians of per-second values from the host log.
f3840d7+ #334 + #337d21753c) + #397 (67fa709)The submitting thread's time fell by 2.2 ms a frame (-11%) and the card was kept busier; +1 fps. No device loss and nothing wrong on screen in this run. Not tested: each pull request on its own, more than one run per side, other hardware.
Test report from an 8-core PC. Short version: the waits this targets drop by more than ten times here; a frame-time gain is not separable from the noise in two runs.
System. Ryzen 7 5800X3D (8 cores, 16 threads), RTX 5080 16 GB (driver 621.47), 32 GB, Windows 11 26300, 2560x1440.
Builds. A = main
d91d8e4. B = A + this PR's commit67fa709(applies cleanly). Release builds,cargo build --release --locked -p darner.DARNER_THIN_HEAP_ORDERas the launcher leaves it (on: thethin heap orderline is in every log).Start and scene.
scripts\play-nvidia.ps1 -NoMenu -Build release -Dlss balanced -Fps 1000(Series X profile, DLSS balanced, no ray tracing, no frame generation), plusDARNER_DATA_DIR(a save copied fresh for every run),DARNER_SKIP_BINK=1,DARNER_BENCH_CSV. Standing still in the open world on a daytime save. One uncounted warm-up run per exe, then per run 30 s to settle and 180 s counted; the numbers are from the per-frame CSV over those 180 s. Order A B … B A, with arms for other PRs between. Other programs used 0.10 to 0.17 of a logical processor during the runs.The scene is CPU-limited here (about 13.3 of 16 logical processors busy, the card idle 13 to 16 ms of each frame), and its draw count cycles between about 6,700 and 14,600 a frame over a minute. So besides the plain numbers I give the frame time at equal draws: one-second means of frame time fitted against draws within each run, read at 10,700 draws.
Three more A runs of the same exe and settings the same morning: 44.16, 44.77 and 45.04 ms at 10,700 draws.
What I see.
thin heap orderlines, summed over the 180 s, are 66 to 78 ms a second on main (about 3 ms a frame) in about 2,800 waits, and 4 to 6 ms a second in 320 to 440 waits with this PR. So it does what it says.thin heap orderlines in either arm, and the picture at the end looks the same.Not measured. One PC, standing still only, two runs of B. The rendered-p99 case from the description (333 to 166 ms) does not occur in this scene: the longest frame of any run here is about 150 ms.
The per-frame CSVs and logs are kept; say so if you want them.
Integrated cleanly onto
c8258f9, passedcargo xtask policy,clippy --all-features --all-targets -- -D warnings(0 warnings), and full unit tests (1,819indarner-gpu,219indarner), and ran stably over 30,000+ frames of Series X gameplay on RTX 5070 Ti 16 GB / Core Ultra 7 265KF / 64 GB DDR5-6400 with bounded heap sync waits (0.06 msheap sync wait observed in the latest 30k-frame run) and zero crashes or regressions.Test report on today's main from a 24-thread Intel PC with Reflex boost: this PR keeps the frame time flat, about 3 ms a frame better by the second minute.
PC: i7-13700K (8P + 8E), 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 (the card waits on the submitting thread there),
DARNER_ALIAS_SHARE=1,DARNER_D3D12_BACKGROUND=0,DARNER_QUEUE_GAPS=1.Builds: A = main
9b288a7+ #303 + #457. B = A + this PR (merged cleanly). Same pipelines, warm.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.
unknown), ms a frameHow I got here: on main
9b288a7Reflex boost ran about 3 ms a frame slower, and got slower over the first two minutes, than on an older local build on47d21cd. Reverting #283 (merged ase9f2e65) did not change it. Adding this PR together with #337 brought it back, and this PR alone does the same. So on this PC a submitted list that skips its refresh waiting for passes opened after its closure seems to cost about 3 ms a frame once the scene is running; with Reflex off the card is the limit here and the difference does not show in the frame time.Not tested: Reflex off in detail, other CPUs, other scenes, the gates.
@andrewpozdnakov7-jpg, here's the A B B A you asked for on #193, on the same RTX 4080 and the same scene where heap ordering costs 3-4 fps. The waits go away almost completely with
67fa709a, and fps comes back part of the way: about 40 % of the frame time that heap ordering costs here. The rest stays even without the waits.PC: RTX 4080 16 GB (driver 32.0.16.1742), Ryzen 9 7900 (12 cores), 32 GB, Windows 11. Builds: diagnostics builds (
cargo build --profile diag -p darner --features diagnostics --locked) of mainf3840d7(A) and of67fa709a(B), whose parent isf3840d7. Settings: Series X, 4K output, DLSS Performance, frame generation 2x, ray tracing off.Method:
scripts/bench.ps1 -Flicker -RayTracing off -Dlss performance -FrameGen 2 -AllowMenuFile -Seconds 180 -Warmup 0, on the same copied save each run (the opening cinematic from its first frame, no input). Both ordering switches were set on in every run, with the upload wait fixed:DARNER_THIN_HEAP_ORDER=1,DARNER_THIN_UPLOAD_ORDER=1,DARNER_THIN_UPLOAD_WAIT_US=50000(each summary'seffectivelist confirms them). First an unscored 60 s run of B, then A B B A, then one reference run C: main withDARNER_THIN_HEAP_ORDER=0. fps is the median of the 5 s lines over 0-180 s after the world's first frame. The heap-order figures are summed from the 45thin heap order:lines of each run (about 225 s of log).67fa709a67fa709aHEAP_ORDER=0Every run claimed about 5,000 heap passes ahead of submission (4,959-5,318), except C, which queued none. Draws per frame (median) were 4,706-4,835 and the median of pipelines being made was 0 in every run, so the scene and the cache matched.
The timeouts, 4 and 5 against 3 and 2, are too few to tell apart. Nyutt's city route above saw no fps change because that route is limited by preparation; this cinematic is where heap ordering costs the most on this PC, which is why the gain shows here.
Not checked: the release build, other scenes, frame generation off, the three gates (
cargo clippyx2,cargo test).Logs attached:
darner-pr397-4080-logs.zip, the six runs' logs andbench.ps1summaries, with user and PC names replaced. The detector's kept frames aren't included: they're the game's pixels.Test report for
67fa709merged on top of release v2026.12.04.01, with ray tracing and frame generation off (the reports above have one or both on).Measured: release build of v2026.12.04.01 (4 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.
Heap pass waits, summed from the
thin heap order:lines over each run:On this route the time spent waiting drops to about a quarter (a smaller drop than the reports above); the longest wait and the timeouts don't change. Frame rate: no measurable difference, both PR runs are inside the base spread. No crashes and no new warnings.
PC: RTX 5070 Ti 16 GB, Ryzen 7 9800X3D, 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.
[pr-performance][memory] Bound heap refresh waits by command list closureto Bound heap refresh waits by command list closureView 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.