[pr-fix][performance][memory] Lower the default DARNER_MEMORY_FLOOR_MB from 1024 to 512 #110

Open
CRCODE22 wants to merge 3 commits from CRCODE22/Darner:fix/issue-70-memory-floor-512 into main
First-time contributor

Summary

The default soft floor of 1024 MB serialised first-seen pipelines into multi-second freezes on a 32 GB PC (the title commits ~17 GB; the driver's compiler takes several more; free RAM sits near 1 GB in a world load). 140 of 141 compilemem lines said pressured=true; the PC ended with 20 MB free; full-screen passes waited 1.4 to 7.2 s for their pipeline.

Lower the soft physical floor to 512 MB. Compiles still go one at a time under it, but the 4096 MB commit floor remains the hard limit that keeps the process from ending in ptxas fatal: Memory allocation failure.

Testing

  • cargo test -p darner-gpu --lib memguard — 6 passed
  • cargo test -p darner-gpu --lib compilemem — 13 passed
  • Needs: like-for-like A/B on the same PC, same route, both values (1024 and 512), to confirm the freezes go away without new out-of-memory crashes.

Fixes #70

## Summary The default soft floor of 1024 MB serialised first-seen pipelines into multi-second freezes on a 32 GB PC (the title commits ~17 GB; the driver's compiler takes several more; free RAM sits near 1 GB in a world load). 140 of 141 compilemem lines said pressured=true; the PC ended with 20 MB free; full-screen passes waited 1.4 to 7.2 s for their pipeline. Lower the soft physical floor to 512 MB. Compiles still go one at a time under it, but the 4096 MB commit floor remains the hard limit that keeps the process from ending in ptxas fatal: Memory allocation failure. ## Testing - cargo test -p darner-gpu --lib memguard — 6 passed - cargo test -p darner-gpu --lib compilemem — 13 passed - **Needs**: like-for-like A/B on the same PC, same route, both values (1024 and 512), to confirm the freezes go away without new out-of-memory crashes. ## Related Fixes #70
The default soft floor of 1024 MB serialised first-seen pipelines into
multi-second freezes on a 32 GB PC (the title commits ~17 GB; the driver's
compiler takes several more; free RAM sits near 1 GB in a world load).
140 of 141 compilemem lines said pressured=true; the PC ended with 20 MB
free; full-screen passes waited 1.4 to 7.2 s for their pipeline.

Lower the soft physical floor to 512 MB. Compiles still go one at a time
under it, but the 4096 MB commit floor remains the hard limit that keeps
the process from ending in 'ptxas fatal: Memory allocation failure'.

This is a default change and needs a like-for-like A/B: same PC, same
route, both values (1024 and 512), to confirm the freezes go away without
new out-of-memory crashes.

Fixes #70
Contributor

Startup A/B on RTX 4060

I ran four starts in ABBA order for #70 using the same Darner executable at 57dea7f236. For this change, explicitly setting the memory floor exercises the same production admission logic as the proposed default on 54405dab32. The two admission source files are identical between the benchmarked revision and 140980dd65.

Windows 11 Pro 26300, Ryzen 7 5800X, 32 GiB RAM, RTX 4060 8 GiB, driver 621.40. Series X, 1440p preset, DLSS Quality, AUTO with active DLSS frame generation at 2×, and ray tracing off. Each run started from a clone of the same isolated profile and warm Darner cache, at the same point with no scripted movement. The driver cache was shared across runs. The effective settings differed only in DARNER_MEMORY_FLOOR_MB. The commit floor was 4096 MiB throughout.

The window ran from launch through 65 seconds after the first world marker. The largest gap is the maximum reported by the presentation smoothness log across that window. Available RAM is the sampled system value. Waited and deferred are cumulative compile counts from the last memory sample.

Run Physical floor (MiB) World marker (s) Largest gap (s) Lowest sampled available RAM (MiB) Compiles waited / deferred
A1 1024 69.91 18.27 636 384 / 105
B1 512 50.50 10.14 402 277 / 6
B2 512 50.40 10.37 299 291 / 11
A2 1024 51.21 5.62 453 225 / 2

The 512 MiB runs both reached the world sooner than the first control and had smaller gaps. The final 1024 MiB control reached it in 51.21 s and had the shortest gap of all four runs. With two starts per value and that control spread, the effect on presentation stalls is inconclusive on this system. Available RAM reached 299 MiB at 512 MiB versus 453 MiB across the two 1024 MiB runs. All four runs reached the timed cutoff with active DLSS FG and zero logged crashes, device-loss or out-of-memory markers.

Admission replay

I separately replayed all seven compile-memory samples from an earlier 35.9 s gap on the same baseline. The checked-in admission code was compiled directly from 140980dd65 and 54405dab32 in a dependency-free harness. With the sample figures held fixed and the recent-allocation-refusal input clear, 140980dd65 throttled all seven requests for another compile. The PR allowed one more in two samples and two more in the other five before throttling again. Both versions still throttled with a recent allocation refusal and returned the same verdict below the 4096 MiB adjusted commit floor. The sampled log's pressured flag comes from the residency manager. The compile gate reads live figures at each attempt.

cargo +1.98.1 test --locked --offline -j 1 -- --nocapture passed 3 tests. cargo +1.98.1 test --locked --offline -j 1 --features pr110 -- --nocapture passed the same 3 tests for the PR revision.

### Startup A/B on RTX 4060 I ran four starts in ABBA order for #70 using the same Darner executable at `57dea7f236`. For this change, explicitly setting the memory floor exercises the same production admission logic as the proposed default on `54405dab32`. The two admission source files are identical between the benchmarked revision and `140980dd65`. Windows 11 Pro 26300, Ryzen 7 5800X, 32 GiB RAM, RTX 4060 8 GiB, driver 621.40. Series X, 1440p preset, DLSS Quality, AUTO with active DLSS frame generation at 2×, and ray tracing off. Each run started from a clone of the same isolated profile and warm Darner cache, at the same point with no scripted movement. The driver cache was shared across runs. The effective settings differed only in `DARNER_MEMORY_FLOOR_MB`. The commit floor was 4096 MiB throughout. The window ran from launch through 65 seconds after the first world marker. The largest gap is the maximum reported by the presentation smoothness log across that window. Available RAM is the sampled system value. Waited and deferred are cumulative compile counts from the last memory sample. | Run | Physical floor (MiB) | World marker (s) | Largest gap (s) | Lowest sampled available RAM (MiB) | Compiles waited / deferred | |---|---:|---:|---:|---:|---:| | A1 | 1024 | 69.91 | 18.27 | 636 | 384 / 105 | | B1 | 512 | 50.50 | 10.14 | 402 | 277 / 6 | | B2 | 512 | 50.40 | 10.37 | 299 | 291 / 11 | | A2 | 1024 | 51.21 | 5.62 | 453 | 225 / 2 | The 512 MiB runs both reached the world sooner than the first control and had smaller gaps. The final 1024 MiB control reached it in 51.21 s and had the shortest gap of all four runs. With two starts per value and that control spread, the effect on presentation stalls is inconclusive on this system. Available RAM reached 299 MiB at 512 MiB versus 453 MiB across the two 1024 MiB runs. All four runs reached the timed cutoff with active DLSS FG and zero logged crashes, device-loss or out-of-memory markers. ### Admission replay I separately replayed all seven compile-memory samples from an earlier 35.9 s gap on the same baseline. The checked-in admission code was compiled directly from `140980dd65` and `54405dab32` in a dependency-free harness. With the sample figures held fixed and the recent-allocation-refusal input clear, `140980dd65` throttled all seven requests for another compile. The PR allowed one more in two samples and two more in the other five before throttling again. Both versions still throttled with a recent allocation refusal and returned the same verdict below the 4096 MiB adjusted commit floor. The sampled log's `pressured` flag comes from the residency manager. The compile gate reads live figures at each attempt. `cargo +1.98.1 test --locked --offline -j 1 -- --nocapture` passed 3 tests. `cargo +1.98.1 test --locked --offline -j 1 --features pr110 -- --nocapture` passed the same 3 tests for the PR revision.
Owner

Reading the ABBA: A1 (1,024 MiB) at 69.9 s with 105 deferred compiles looks like a cold first run. Without it, both floors land at about 50-51 s. 512 MiB does not start faster, and it takes the lowest available RAM down to 299-402 MiB against 453-636 MiB on a 32 GB PC. On this data the PR doesn't improve start time, and it leaves less RAM free. A second warm pair on a 16 GB PC would show whether it helps where #70 was reported.

Reading the ABBA: A1 (1,024 MiB) at 69.9 s with 105 deferred compiles looks like a cold first run. Without it, both floors land at about 50-51 s. 512 MiB does not start faster, and it takes the lowest available RAM down to 299-402 MiB against 453-636 MiB on a 32 GB PC. On this data the PR doesn't improve start time, and it leaves less RAM free. A second warm pair on a 16 GB PC would show whether it helps where #70 was reported.
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 'fix/issue-70-memory-floor-512:CRCODE22-fix/issue-70-memory-floor-512'
git switch 'CRCODE22-fix/issue-70-memory-floor-512'

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 'CRCODE22-fix/issue-70-memory-floor-512'
git switch 'CRCODE22-fix/issue-70-memory-floor-512'
git rebase 'main'
git switch 'main'
git merge --ff-only 'CRCODE22-fix/issue-70-memory-floor-512'
git switch 'CRCODE22-fix/issue-70-memory-floor-512'
git rebase 'main'
git switch 'main'
git merge --no-ff 'CRCODE22-fix/issue-70-memory-floor-512'
git switch 'main'
git merge --squash 'CRCODE22-fix/issue-70-memory-floor-512'
git switch 'main'
git merge --ff-only 'CRCODE22-fix/issue-70-memory-floor-512'
git switch 'main'
git merge 'CRCODE22-fix/issue-70-memory-floor-512'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
3 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!110
No description provided.