Bound heap refresh waits by command list closure #397

Open
andrewpozdnakov7-jpg wants to merge 1 commit from andrewpozdnakov7-jpg/Darner:assist/193-bound-heap-order-wait into Main
Contributor

Contributor role (optional)

  • Fluxer ID:

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

  • Tested revision: 67fa709a on f3840d73.
  • The synthetic queue check covered both an older pass that must still be awaited and a later pass that should no longer block submission. The focused Cargo check, asset policy and diff check passed.
  • Changes an enabled path: the wait cutoff applies where thin heap ordering is already in use. Neither ordering switch changes its default.
  • Independent A/B/B/A on the same RTX 4060 8 GB, NVIDIA 621.40, Series S 1080p, DLSS Quality, FG 2x, RT and HDR off, half textures. Both ordering switches and the 50 ms upload wait were held fixed. The tester built both exact revisions with cargo build --locked --offline -j 2 --profile fast --features diagnostics -p darner and compared the same opening from 45 to 120 seconds after the world marker. Full tester report
Measurement Main A1 Patch B1 Patch B2 Main A2
Heap wait, ms/s 54.51 0.44 0.20 49.93
Rendered P99, ms 333.1 166.5 122.5 201.3
Rendered FPS 14.38 14.68 15.99 14.99
Heap wait calls 681 9 5 633
  • The FPS ranges overlap. Flicker was still observed. The data covers one RTX 4060 opening. The original RTX 5080 city route has yet to be checked with this commit.
  • No full workspace gates were run for this change.

Checklist

  • The exact commit ran in the game in the independent test linked above.
  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched open and closed PRs for the issue and wait cutoff and checked open PRs that touch the changed files.
  • Related PRs: #274 changes retirement queues and #368 changes host logging. They address separate paths. CodeFloe #302 introduced thin-list ordering as discussed in #193.
  • Replaces or overlaps: no existing GTAHub PR for this cutoff found.
## Contributor role (optional) - Fluxer ID: <!-- 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 - Tested revision: `67fa709a` on `f3840d73`. - The synthetic queue check covered both an older pass that must still be awaited and a later pass that should no longer block submission. The focused Cargo check, asset policy and diff check passed. - Changes an enabled path: the wait cutoff applies where thin heap ordering is already in use. Neither ordering switch changes its default. - Independent A/B/B/A on the same RTX 4060 8 GB, NVIDIA 621.40, Series S 1080p, DLSS Quality, FG 2x, RT and HDR off, half textures. Both ordering switches and the 50 ms upload wait were held fixed. The tester built both exact revisions with `cargo build --locked --offline -j 2 --profile fast --features diagnostics -p darner` and compared the same opening from 45 to 120 seconds after the world marker. [Full tester report](https://git.gtahub.st/TrustNo1/Darner/issues/193#issuecomment-871506) | Measurement | Main A1 | Patch B1 | Patch B2 | Main A2 | |---|---:|---:|---:|---:| | Heap wait, ms/s | 54.51 | 0.44 | 0.20 | 49.93 | | Rendered P99, ms | 333.1 | 166.5 | 122.5 | 201.3 | | Rendered FPS | 14.38 | 14.68 | 15.99 | 14.99 | | Heap wait calls | 681 | 9 | 5 | 633 | - The FPS ranges overlap. Flicker was still observed. The data covers one RTX 4060 opening. The original RTX 5080 city route has yet to be checked with this commit. - No full workspace gates were run for this change. ## Checklist - [x] The exact commit ran in the game in the independent test linked above. - [x] This PR contains one change based on main. - [x] The diff follows docs/asset-policy.md. - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched open and closed PRs for the issue and wait cutoff and checked open PRs that touch the changed files. - Related PRs: #274 changes retirement queues and #368 changes host logging. They address separate paths. CodeFloe #302 introduced thin-list ordering as discussed in #193. - Replaces or overlaps: no existing GTAHub PR for this cutoff found.
When a translated list skipped a heap buffer pass, record the pass cutoff at list close. Keep waiting for passes that could have supplied the list and use the previous epoch wait for lists without a close mark. Continue claiming queued refreshes before submission.

Refs: #193
https://git.gtahub.st/andrewpozdnakov7-jpg
https://github.com/andrewpozdnakov7-jpg
Contributor

Test report for 67fa709 against main f3840d7 (release builds with bench-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 the thin heap order: five-second lines over each whole run.

The wait drops as described:

main (run 1) this PR main (run 2)
waits for passes 761 45 727
time waited 3,473 ms 380 ms 3,547 ms
per second of run 27.8 ms 3.2 ms 29.6 ms
timeouts (50 ms) 3 5 0

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=1 run 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 clippy x2, cargo test).

Test report for 67fa709 against main f3840d7 (release builds with `bench-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 the `thin heap order:` five-second lines over each whole run. **The wait drops as described:** | | main (run 1) | this PR | main (run 2) | |---|---|---|---| | waits for passes | 761 | 45 | 727 | | time waited | 3,473 ms | 380 ms | 3,547 ms | | per second of run | 27.8 ms | 3.2 ms | 29.6 ms | | timeouts (50 ms) | 3 | 5 | 0 | **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=1` run 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 clippy` x2, `cargo test`).
Contributor

Test report, together with #274: both merged on top of main f3840d7 with #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.

A: f3840d7 + #334 + #337 B: A + #274 (d21753c) + #397 (67fa709)
fps (median) 32 33
submitting thread, ms a frame 20.5 18.3
card time in the title's lists, ms a frame 23.2 25.9
card busy (host count) 83% 91%
seconds with a frame over 200 ms 5 6

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, together with #274: both merged on top of main f3840d7 with #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. | | A: f3840d7 + #334 + #337 | B: A + #274 (d21753c) + #397 (67fa709) | |---|---|---| | fps (median) | 32 | 33 | | submitting thread, ms a frame | 20.5 | 18.3 | | card time in the title's lists, ms a frame | 23.2 | 25.9 | | card busy (host count) | 83% | 91% | | seconds with a frame over 200 ms | 5 | 6 | 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.
Contributor

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 commit 67fa709 (applies cleanly). Release builds, cargo build --release --locked -p darner. DARNER_THIN_HEAP_ORDER as the launcher leaves it (on: the thin heap order line 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), plus DARNER_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.

run avg fps 1 % low fps frames over 50 ms draws a frame frame ms at 10,700 draws heap-order waits, ms a second (times in 180 s; longest)
A 1 22.37 15.72 24.5 % 10,576 45.11 78.2 (2,767; 50.8 ms)
A 2 22.89 16.77 19.5 % 10,761 43.64 66.4 (2,834; 24.0 ms)
B 1 24.17 17.10 13.5 % 10,053 42.87 6.1 (444; 15.3 ms)
B 2 22.00 15.95 24.8 % 11,299 44.33 4.3 (317; 11.3 ms)

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.

  • The waits: "waited for passes" in the thin heap order lines, 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.
  • Frame time: 43.60 ms mean at 10,700 draws against 44.54 for the five main runs. The two B runs are 1.5 ms apart, so this is inside the noise; I would not call it a gain from two runs. The two B windows also differ by 12 % in draws (10,053 and 11,299), which is why their plain fps are 2 apart.
  • 0 errors, no device loss, no timeouts in the thin heap order lines 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.

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 commit `67fa709` (applies cleanly). Release builds, `cargo build --release --locked -p darner`. `DARNER_THIN_HEAP_ORDER` as the launcher leaves it (on: the `thin heap order` line 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), plus `DARNER_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. | run | avg fps | 1 % low fps | frames over 50 ms | draws a frame | frame ms at 10,700 draws | heap-order waits, ms a second (times in 180 s; longest) | |---|---:|---:|---:|---:|---:|---| | A 1 | 22.37 | 15.72 | 24.5 % | 10,576 | 45.11 | 78.2 (2,767; 50.8 ms) | | A 2 | 22.89 | 16.77 | 19.5 % | 10,761 | 43.64 | 66.4 (2,834; 24.0 ms) | | B 1 | 24.17 | 17.10 | 13.5 % | 10,053 | 42.87 | 6.1 (444; 15.3 ms) | | B 2 | 22.00 | 15.95 | 24.8 % | 11,299 | 44.33 | 4.3 (317; 11.3 ms) | 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.** - The waits: "waited for passes" in the `thin heap order` lines, 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. - Frame time: 43.60 ms mean at 10,700 draws against 44.54 for the five main runs. The two B runs are 1.5 ms apart, so this is inside the noise; I would not call it a gain from two runs. The two B windows also differ by 12 % in draws (10,053 and 11,299), which is why their plain fps are 2 apart. - 0 errors, no device loss, no timeouts in the `thin heap order` lines 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.
First-time contributor

Integrated cleanly onto c8258f9, passed cargo xtask policy, clippy --all-features --all-targets -- -D warnings (0 warnings), and full unit tests (1,819 in darner-gpu, 219 in darner), 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 ms heap sync wait observed in the latest 30k-frame run) and zero crashes or regressions.

Integrated cleanly onto `c8258f9`, passed `cargo xtask policy`, `clippy --all-features --all-targets -- -D warnings` (0 warnings), and full unit tests (`1,819` in `darner-gpu`, `219` in `darner`), 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 ms` heap sync wait observed in the latest 30k-frame run) and zero crashes or regressions.
Contributor

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.

A (5 runs) B (2 runs)
frame time, ms (0-45 / 45-90 / 90-135 s) 31.0 / 33.6 / 34.1, 31.4 / 32.3 / 33.4, 31.5 / 33.3 / 33.5, 31.1 / 32.7 / 33.3, 30.8 / 33.3 / 33.5 29.8 / 30.1 / 30.3, 29.9 / 30.4 / 30.4
card busy 81-82% falling to 74-75% 85% falling to 81-82%
card idle the gap log could not place (unknown), ms a frame 1.2-1.7 0.1

How I got here: on main 9b288a7 Reflex boost ran about 3 ms a frame slower, and got slower over the first two minutes, than on an older local build on 47d21cd. Reverting #283 (merged as e9f2e65) 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.

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. | | A (5 runs) | B (2 runs) | |---|---|---| | frame time, ms (0-45 / 45-90 / 90-135 s) | 31.0 / 33.6 / 34.1, 31.4 / 32.3 / 33.4, 31.5 / 33.3 / 33.5, 31.1 / 32.7 / 33.3, 30.8 / 33.3 / 33.5 | 29.8 / 30.1 / 30.3, 29.9 / 30.4 / 30.4 | | card busy | 81-82% falling to 74-75% | 85% falling to 81-82% | | card idle the gap log could not place (`unknown`), ms a frame | 1.2-1.7 | 0.1 | How I got here: on main 9b288a7 Reflex boost ran about 3 ms a frame slower, and got slower over the first two minutes, than on an older local build on 47d21cd. Reverting #283 (merged as e9f2e65) 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.
First-time contributor

@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 main f3840d7 (A) and of 67fa709a (B), whose parent is f3840d7. 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's effective list confirms them). First an unscored 60 s run of B, then A B B A, then one reference run C: main with DARNER_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 45 thin heap order: lines of each run (about 225 s of log).

run build fps ms a frame p99 card busy heap-order waits time waited timeouts (50 ms) flicker / black
A1 main 26.2 38.2 78.3 ms 72 % 3,750 26.3 s 3 44 / 12
B1 67fa709a 27.6 36.2 73.8 ms 78 % 83 0.6 s 4 22 / 7
B2 67fa709a 26.95 37.1 77.2 ms 74 % 59 0.5 s 5 19 / 5
A2 main 26.0 38.5 74.7 ms 72 % 4,017 23.2 s 2 48 / 16
C main, HEAP_ORDER=0 29.25 34.2 80.7 ms 82 % (off) (off) (off) 42 / 15

Every 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.

  • Frame rate: main 26.1 fps on average (38.3 ms), the PR 27.3 (36.7 ms), heap ordering off 29.25 (34.2 ms). So the PR wins back about 1.6 ms of the 4.1 ms a frame that heap ordering costs here. The card goes from 72 % busy to 74-78 %, against 82 % with ordering off.
  • What's left: with the PR the logged waits come to 0.5-0.6 s per run, and 4-5 of those waits hit the 50 ms limit. That doesn't account for the other 2.5 ms a frame. My guess, not checked in the code: the heap passes themselves (about 5,000 a run, none with ordering off) cost the rest.
  • Flicker: the PR runs counted fewer events, 22 and 19, against 44 and 48 for main and 42 with ordering off. In the one dialogue scene where most of them fall (55-100 s into the window), it was 19 and 14, against 29 and 44, and 28 with ordering off. In the PR run I looked at, the kept frames are the same kind as on main: one character's clothes going dark for one frame (see #135). It's only two runs a side, and main's own count has ranged from 27 to 48 across my six default runs of this build, so I wouldn't call that an effect yet.

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 clippy x2, cargo test).

Logs attached: darner-pr397-4080-logs.zip, the six runs' logs and bench.ps1 summaries, with user and PC names replaced. The detector's kept frames aren't included: they're the game's pixels.

@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 main `f3840d7` (A) and of `67fa709a` (B), whose parent is `f3840d7`. **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's `effective` list confirms them). First an unscored 60 s run of B, then A B B A, then one reference run C: main with `DARNER_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 45 `thin heap order:` lines of each run (about 225 s of log). | run | build | fps | ms a frame | p99 | card busy | heap-order waits | time waited | timeouts (50 ms) | flicker / black | |---|---|---|---|---|---|---|---|---|---| | A1 | main | 26.2 | 38.2 | 78.3 ms | 72 % | 3,750 | 26.3 s | 3 | 44 / 12 | | B1 | `67fa709a` | 27.6 | 36.2 | 73.8 ms | 78 % | 83 | 0.6 s | 4 | 22 / 7 | | B2 | `67fa709a` | 26.95 | 37.1 | 77.2 ms | 74 % | 59 | 0.5 s | 5 | 19 / 5 | | A2 | main | 26.0 | 38.5 | 74.7 ms | 72 % | 4,017 | 23.2 s | 2 | 48 / 16 | | C | main, `HEAP_ORDER=0` | 29.25 | 34.2 | 80.7 ms | 82 % | (off) | (off) | (off) | 42 / 15 | Every 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. - **Frame rate:** main 26.1 fps on average (38.3 ms), the PR 27.3 (36.7 ms), heap ordering off 29.25 (34.2 ms). So the PR wins back about 1.6 ms of the 4.1 ms a frame that heap ordering costs here. The card goes from 72 % busy to 74-78 %, against 82 % with ordering off. - **What's left:** with the PR the logged waits come to 0.5-0.6 s per run, and 4-5 of those waits hit the 50 ms limit. That doesn't account for the other 2.5 ms a frame. My guess, not checked in the code: the heap passes themselves (about 5,000 a run, none with ordering off) cost the rest. - **Flicker:** the PR runs counted fewer events, 22 and 19, against 44 and 48 for main and 42 with ordering off. In the one dialogue scene where most of them fall (55-100 s into the window), it was 19 and 14, against 29 and 44, and 28 with ordering off. In the PR run I looked at, the kept frames are the same kind as on main: one character's clothes going dark for one frame (see #135). It's only two runs a side, and main's own count has ranged from 27 to 48 across my six default runs of this build, so I wouldn't call that an effect yet. 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 clippy` x2, `cargo test`). Logs attached: `darner-pr397-4080-logs.zip`, the six runs' logs and `bench.ps1` summaries, with user and PC names replaced. The detector's kept frames aren't included: they're the game's pixels.
First-time contributor

Test report for 67fa709 merged 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.

v2026.12.04.01 (4 runs) + #397 (2 runs)
fps (mean of runs) 38.52 (38.25-38.90) 38.79 (38.56 / 39.02)
CPU frame preparation, ms 8.68 8.86
frame time median / p95 / p99, ms 26.18 / 28.50 / 34.77 26.18 / 28.20 / 35.77
frames over 100 ms, per run 9.5 (6-13) 10.5 (11 / 10)
crashes 0 0

Heap pass waits, summed from the thin heap order: lines over each run:

v2026.12.04.01 (4 runs) + #397 (2 runs)
times waited, per run 386 / 734 / 477 / 558 278 / 311
time waited, per run 1.14 / 1.72 / 1.15 / 1.11 s 0.29 / 0.39 s
longest wait 52-67 ms 51 / 77 ms
timeouts, per run 2 / 2 / 3 / 0 3 / 4

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.

Test report for `67fa709` merged 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. | | v2026.12.04.01 (4 runs) | + #397 (2 runs) | |---|---|---| | fps (mean of runs) | 38.52 (38.25-38.90) | 38.79 (38.56 / 39.02) | | CPU frame preparation, ms | 8.68 | 8.86 | | frame time median / p95 / p99, ms | 26.18 / 28.50 / 34.77 | 26.18 / 28.20 / 35.77 | | frames over 100 ms, per run | 9.5 (6-13) | 10.5 (11 / 10) | | crashes | 0 | 0 | **Heap pass waits**, summed from the `thin heap order:` lines over each run: | | v2026.12.04.01 (4 runs) | + #397 (2 runs) | |---|---|---| | times waited, per run | 386 / 734 / 477 / 558 | 278 / 311 | | time waited, per run | 1.14 / 1.72 / 1.15 / 1.11 s | 0.29 / 0.39 s | | longest wait | 52-67 ms | 51 / 77 ms | | timeouts, per run | 2 / 2 / 3 / 0 | 3 / 4 | 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.
TrustNo1 changed title from [pr-performance][memory] Bound heap refresh waits by command list closure to Bound heap refresh waits by command list closure 2026-12-06 03:29:28 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'assist/193-bound-heap-order-wait:andrewpozdnakov7-jpg-assist/193-bound-heap-order-wait'
git switch 'andrewpozdnakov7-jpg-assist/193-bound-heap-order-wait'

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.

git switch 'Main'
git merge --no-ff 'andrewpozdnakov7-jpg-assist/193-bound-heap-order-wait'
git switch 'andrewpozdnakov7-jpg-assist/193-bound-heap-order-wait'
git rebase 'Main'
git switch 'Main'
git merge --ff-only 'andrewpozdnakov7-jpg-assist/193-bound-heap-order-wait'
git switch 'andrewpozdnakov7-jpg-assist/193-bound-heap-order-wait'
git rebase 'Main'
git switch 'Main'
git merge --no-ff 'andrewpozdnakov7-jpg-assist/193-bound-heap-order-wait'
git switch 'Main'
git merge --squash 'andrewpozdnakov7-jpg-assist/193-bound-heap-order-wait'
git switch 'Main'
git merge --ff-only 'andrewpozdnakov7-jpg-assist/193-bound-heap-order-wait'
git switch 'Main'
git merge 'andrewpozdnakov7-jpg-assist/193-bound-heap-order-wait'
git push origin 'Main'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
7 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
TrustNo1/Darner!397
No description provided.