d3d12 hwrt: driving on an RTX 5090 is host-bound; the 1.5 GB BLAS cap causes multi-second stalls (#3113 helps) #3135

Open
opened 2026-12-02 13:11:38 +00:00 by x2Tweek · 1 comment
x2Tweek commented 2026-12-02 13:11:38 +00:00 (Migrated from github.com)
Contributor

Imported from ubiquitarianism/leonida. Originally posted by x2Tweek on 2026-12-02T13:11:38Z.


What happens

With -HardwareRT, city driving on an RTX 5090 at 4K output drops to about 16 fps, with stalls of up to 3 s. The
GPU is idle the whole time ("on the GPU" is 0.0 ms median); the host side and BLAS churn set the frame.

Two things helped, measured over about 5 minutes of city driving each:

  1. The BLAS budget is capped at 1.5 GB (BLAS_BUDGET_MOST in hwrt.rs), even on a 32 GB card. AS memory sat
    at 1.46 GB, with constant eviction and rehydration. With the cap raised to 6 GB (a local env override,
    LEONIDA_HW_RT_BLAS_MB=6144), AS memory grew to about 2.8 GB, and the multi-second stalls were gone.
  2. Open PR #3113 (page-wise readable checks in place of VirtualQuery walks) on top of that cut host
    preparation from 32 to 25 ms per frame, and raised the slowest 10 % of frames from 11.8 to 16.5 fps. So #3113
    also holds on a 5090 at 4K.
City driving, ~5 min stock (1.5 GB cap) 6 GB cap 6 GB cap + #3113
fps median / p10 / p90 16.2 / 11.5 / 22.5 18.7 / 11.8 / 25.5 20.1 / 16.5 / 30.9
worst frame 3084 ms (also 720 ms) 132 ms 75 ms
"preparing" ms (median) 33.8 32.0 24.9
"BLAS prep" share of wall time 18 % 21 % 15 %
GPU ms (median) 0.0 0.0 0.0

Caveat: the last drive was a little lighter (5.6k draws per frame median, against 7.0k and 7.6k), so part of its
median gain is the scene. The p10 and the worst frame are the clearer signal.

Remaining cost while driving: about 150 BLAS builds a second (around 50k in 5 min, with about 16k rehydrated and
8k evicted). execute_blas_batch runs them one by one on the recording thread, at 15 % of wall time even with
#3113. Copies stay at 65–90 MB a frame.

Suggestions:

  • scale BLAS_BUDGET_MOST with the card's local budget (or expose a switch);
  • consider preparing BLAS geometry off the recording thread.

Happy to run A/B builds on this machine.

Commit

a917c54d6 (upstream main, 2026-12-02), diag build, plus a local env override of the BLAS budget and #3113
merged for the last column.

System

RTX 5090 32 GB, driver 621.40; i9-14900KS; 64 GB DDR5; Windows 11 build 26300.

Where

In the world, driving through the city at night (on foot: 32–44 fps).

Command and steps

scripts/play-d3d12.ps1 -HardwareRT -SmoothMotion -PrecompileAll -Log, with the Series X profile,
LEONIDA_OUTPUT=3840x2160, LEONIDA_RENDER_SCALE=0.6667, the title's upscaler and LEONIDA_REAPER=0 (from the
F1 menu file). Drive about 5 minutes; the numbers are from the frame log's 5 s lines.

Output

The last "hardware RT" line of the stock run, 15 minutes in:

BLAS live 9444 (built 92283, refit 321086, refit->rebuild 843, rehydrated 29849), TLAS live 5 (builds 85813),
TLAS asked 1972396 found / 153 misses, copies 28491, evicted 11030,
quant24 VB 162101 / meshlet IB 173256 decoded (2655 MB), BLAS prep 115291 ms, TLAS prep 30137 ms, AS memory 1461 MB

Also: "ray queries: lifted shaders 14, partly 0, fell back 0 (software)". In the stock run,
host memory pressure ... available_commit_mib=3846 at 12:20.

A separate observation, not yet compared without HW RT: some car headlights do not seem to light.


AI-assisted: the measurements, the log analysis and the write-up were done with Claude Opus 5.5 (Claude Code). The
numbers come from the runtime's own frame log on the hardware above.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:6745558356 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/issues/3135). Originally posted by [x2Tweek](https://github.com/x2Tweek) on 2026-12-02T13:11:38Z. --- ### What happens With `-HardwareRT`, city driving on an RTX 5090 at 4K output drops to about 16 fps, with stalls of up to 3 s. The GPU is idle the whole time ("on the GPU" is 0.0 ms median); the host side and BLAS churn set the frame. Two things helped, measured over about 5 minutes of city driving each: 1. **The BLAS budget is capped at 1.5 GB** (`BLAS_BUDGET_MOST` in `hwrt.rs`), even on a 32 GB card. AS memory sat at 1.46 GB, with constant eviction and rehydration. With the cap raised to 6 GB (a local env override, `LEONIDA_HW_RT_BLAS_MB=6144`), AS memory grew to about 2.8 GB, and the multi-second stalls were gone. 2. **Open PR #3113** (page-wise readable checks in place of `VirtualQuery` walks) on top of that cut host preparation from 32 to 25 ms per frame, and raised the slowest 10 % of frames from 11.8 to 16.5 fps. So #3113 also holds on a 5090 at 4K. | City driving, ~5 min | stock (1.5 GB cap) | 6 GB cap | 6 GB cap + #3113 | |---|---|---|---| | fps median / p10 / p90 | 16.2 / 11.5 / 22.5 | 18.7 / 11.8 / 25.5 | **20.1 / 16.5 / 30.9** | | worst frame | 3084 ms (also 720 ms) | 132 ms | **75 ms** | | "preparing" ms (median) | 33.8 | 32.0 | **24.9** | | "BLAS prep" share of wall time | 18 % | 21 % | **15 %** | | GPU ms (median) | 0.0 | 0.0 | 0.0 | Caveat: the last drive was a little lighter (5.6k draws per frame median, against 7.0k and 7.6k), so part of its median gain is the scene. The p10 and the worst frame are the clearer signal. Remaining cost while driving: about 150 BLAS builds a second (around 50k in 5 min, with about 16k rehydrated and 8k evicted). `execute_blas_batch` runs them one by one on the recording thread, at 15 % of wall time even with #3113. Copies stay at 65–90 MB a frame. **Suggestions:** - scale `BLAS_BUDGET_MOST` with the card's local budget (or expose a switch); - consider preparing BLAS geometry off the recording thread. Happy to run A/B builds on this machine. ### Commit `a917c54d6` (upstream main, 2026-12-02), diag build, plus a local env override of the BLAS budget and #3113 merged for the last column. ### System RTX 5090 32 GB, driver 621.40; i9-14900KS; 64 GB DDR5; Windows 11 build 26300. ### Where In the world, driving through the city at night (on foot: 32–44 fps). ### Command and steps `scripts/play-d3d12.ps1 -HardwareRT -SmoothMotion -PrecompileAll -Log`, with the Series X profile, `LEONIDA_OUTPUT=3840x2160`, `LEONIDA_RENDER_SCALE=0.6667`, the title's upscaler and `LEONIDA_REAPER=0` (from the F1 menu file). Drive about 5 minutes; the numbers are from the frame log's 5 s lines. ### Output The last "hardware RT" line of the stock run, 15 minutes in: ``` BLAS live 9444 (built 92283, refit 321086, refit->rebuild 843, rehydrated 29849), TLAS live 5 (builds 85813), TLAS asked 1972396 found / 153 misses, copies 28491, evicted 11030, quant24 VB 162101 / meshlet IB 173256 decoded (2655 MB), BLAS prep 115291 ms, TLAS prep 30137 ms, AS memory 1461 MB ``` Also: "ray queries: lifted shaders 14, partly 0, fell back 0 (software)". In the stock run, `host memory pressure ... available_commit_mib=3846` at 12:20. A separate observation, not yet compared without HW RT: some car headlights do not seem to light. --- AI-assisted: the measurements, the log analysis and the write-up were done with Claude Opus 5.5 (Claude Code). The numbers come from the runtime's own frame log on the hardware above.
MoonEyes commented 2026-12-02 21:27:03 +00:00 (Migrated from github.com)
Author
Contributor

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T21:27:03Z.


Open PR #3225 raises the BLAS budget cap up to 6 GiB with VRAM pressure throttling, which targets the 1.5 GB cap reported here. AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7359297738 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/issues/3135#issuecomment-7359297738). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T21:27:03Z. --- Open PR #3225 raises the BLAS budget cap up to 6 GiB with VRAM pressure throttling, which targets the 1.5 GB cap reported here. AI-assisted (Claude Code).
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy#3135
No description provided.