[performance][memory][RAYTRACING][NVIDIA] Hardware RT BLAS heaps are never given back: 2,048 MB of heaps for about 1,000 MB of live BLAS, card over its budget after 8 minutes #290

Open
opened 2026-12-04 11:32:15 +00:00 by tupacfan04 · 4 comments

What you see

With hardware ray tracing, the 64 MB heaps that BLAS buffers are placed in only ever grow. In a 9-minute play session they reached 2,048 MB while about 1,000 MB of BLAS were live, and the card went over its Windows budget in the same half minute in which the frame rate fell to 14 fps with 50 pauses a minute.

Session 1, default switches (BLAS budget 1,022 MB from the log), seconds after the world's first frame:

+5 s +125 s +269 s +502 s +529 s
BLAS heaps (64 MB each) 5 = 320 MB 13 = 832 19 = 1,216 29 = 1,856 32 = 2,048
units in use in them, MB 273 664 908 1,398 1,247
live BLAS, MB 131 482 676 1,026 965
card memory in use (DXGI local), MB 7,926 9,218 9,850 10,502 10,728
ledger sum, MB 6,762 7,386 7,558 7,579 7,585
unaccounted = used - sum, MB 1,164 1,833 2,292 2,923 3,142
  • Eviction started when live BLAS reached the budget at about +500 s (1,645 evicted, 153 MB), but the heaps stayed: the last line reads 32 heaps of 64 MB (1276 MB in use) next to budget 1022 MB, live 986 MB (7139 BLAS).
  • Budget at that point 10,227 MB, in use 10,716 MB. The last 31 s of world frames: median 69.9 ms (14.3 fps), 49.9 pauses over 150 ms a minute, card 57 % busy. The stretch before it, same area: 57.1 ms, 6.0 pauses a minute.
  • 157 lines "textures picked by index: the card has no room for more; they wait" and 78 lines "no card copy for a title buffer" over the session. Texture blocks stayed at 2,560 MB the whole time, so textures are not what grew.
  • The heaps look like the larger part of the ledger's unaccounted growth here (+1,728 MB of heaps against +1,978 MB unaccounted). I did not find an accel-structure entry of that size in the ledger's kinds line.

Session 2, same build and settings plus DARNER_HW_RT_BLAS_BUDGET_MB=512, 17 minutes (a drive into the city, then downtown by car and on foot):

session 1 (default) session 2 (512 MB)
BLAS heaps at minute 2 / 4 / 8 16 / 21 / 32 18 / 18 / 18, flat to minute 17 (1,152 MB)
live BLAS at minute 8 986 MB (7,139) 475 MB (3,491)
card in use / budget at minute 8 10,716 / 10,227 MB 9,843 / 10,259 MB; 10,043 / 10,292 at minute 17
"no room for more; they wait" lines 157 1
"no card copy for a title buffer" lines 78 89
BLAS evicted / rebuilt after eviction 1,645 / 18 36,427 (4,611 MB) / 888

So a lower budget works around it on a 12 GB card: fewer live BLAS means fewer heaps are ever made. Even then 18 heaps (1,152 MB) are held for 431-505 MB of live BLAS (last line: 18 heaps of 64 MB (506 MB in use)).

What this does not show:

  • No frame-rate claim for the 512 MB budget. The two sessions are different places (a mission near the start, against a drive into the city), and session 2 was slower overall (median 58.5 ms against 50.8 ms, 21.9 against 10.2 pauses a minute) with many more compiles in the world (451 shaders and 835 pipelines against 167 and 334). Same-scene pairs from one save are next; I will add them here.
  • In session 2 card memory still crept from 9,080 to 10,043 MB and unaccounted from 1,817 to 2,381 MB with the heaps flat. I don't know what that part is.
  • Both sessions are one person playing, not a scripted route.

Where it is in the code (f3840d7, crates/darner-gpu/src/hwrt.rs): the comment above BLAS_HEAP_BYTES says "Heaps are kept for the rest of the run"; blas_heaps() is a list that is only pushed to; take_units tries the newest heap first; evict_over_budget compares the live BLAS bytes with the budget, not the heap bytes.

Not the same as #111 (ray tracing off there, Proton, frame generation on). #19 is the wider topic.

GPU and driver

RTX 5070 12 GB, driver 621.40, NVIDIA profile from darner nv-profile --mb 2048

CPU, RAM and Windows version

i9-14900F, 32 GB, Windows 11 (page file 53 GB fixed in session 2; system-managed in session 1)

Darner release or commit

f3840d7 (diagnostics build)

Settings

Series X, 2560x1440, hardware ray tracing on, DLSS Quality, frame generation off, no fps cap, texture quality full. Session 2 adds DARNER_HW_RT_BLAS_BUDGET_MB=512. No device loss in either session, both exited normally.

Logs

Lines quoted above are from the two play logs (10:40-10:50 and 11:08-11:26 UTC, 2026-12-04). I can attach the full logs if they help.

Are you working on a fix?

Yes: a branch that releases a heap once all its units are free (keeping a couple of spares) and places new BLAS in the fullest heap first. It gets a pull request only if the three gates pass and a game run shows the heaps coming back down.

Written with an AI assistant (Claude); all figures are measured on this PC.

### What you see With hardware ray tracing, the 64 MB heaps that BLAS buffers are placed in only ever grow. In a 9-minute play session they reached 2,048 MB while about 1,000 MB of BLAS were live, and the card went over its Windows budget in the same half minute in which the frame rate fell to 14 fps with 50 pauses a minute. Session 1, default switches (BLAS budget 1,022 MB from the log), seconds after the world's first frame: | | +5 s | +125 s | +269 s | +502 s | +529 s | |---|---|---|---|---|---| | BLAS heaps (64 MB each) | 5 = 320 MB | 13 = 832 | 19 = 1,216 | 29 = 1,856 | 32 = 2,048 | | units in use in them, MB | 273 | 664 | 908 | 1,398 | 1,247 | | live BLAS, MB | 131 | 482 | 676 | 1,026 | 965 | | card memory in use (DXGI local), MB | 7,926 | 9,218 | 9,850 | 10,502 | 10,728 | | ledger sum, MB | 6,762 | 7,386 | 7,558 | 7,579 | 7,585 | | unaccounted = used - sum, MB | 1,164 | 1,833 | 2,292 | 2,923 | 3,142 | - Eviction started when live BLAS reached the budget at about +500 s (1,645 evicted, 153 MB), but the heaps stayed: the last line reads `32 heaps of 64 MB (1276 MB in use)` next to `budget 1022 MB, live 986 MB (7139 BLAS)`. - Budget at that point 10,227 MB, in use 10,716 MB. The last 31 s of world frames: median 69.9 ms (14.3 fps), 49.9 pauses over 150 ms a minute, card 57 % busy. The stretch before it, same area: 57.1 ms, 6.0 pauses a minute. - 157 lines "textures picked by index: the card has no room for more; they wait" and 78 lines "no card copy for a title buffer" over the session. Texture blocks stayed at 2,560 MB the whole time, so textures are not what grew. - The heaps look like the larger part of the ledger's unaccounted growth here (+1,728 MB of heaps against +1,978 MB unaccounted). I did not find an accel-structure entry of that size in the ledger's kinds line. Session 2, same build and settings plus `DARNER_HW_RT_BLAS_BUDGET_MB=512`, 17 minutes (a drive into the city, then downtown by car and on foot): | | session 1 (default) | session 2 (512 MB) | |---|---|---| | BLAS heaps at minute 2 / 4 / 8 | 16 / 21 / 32 | 18 / 18 / 18, flat to minute 17 (1,152 MB) | | live BLAS at minute 8 | 986 MB (7,139) | 475 MB (3,491) | | card in use / budget at minute 8 | 10,716 / 10,227 MB | 9,843 / 10,259 MB; 10,043 / 10,292 at minute 17 | | "no room for more; they wait" lines | 157 | 1 | | "no card copy for a title buffer" lines | 78 | 89 | | BLAS evicted / rebuilt after eviction | 1,645 / 18 | 36,427 (4,611 MB) / 888 | So a lower budget works around it on a 12 GB card: fewer live BLAS means fewer heaps are ever made. Even then 18 heaps (1,152 MB) are held for 431-505 MB of live BLAS (last line: `18 heaps of 64 MB (506 MB in use)`). What this does not show: - No frame-rate claim for the 512 MB budget. The two sessions are different places (a mission near the start, against a drive into the city), and session 2 was slower overall (median 58.5 ms against 50.8 ms, 21.9 against 10.2 pauses a minute) with many more compiles in the world (451 shaders and 835 pipelines against 167 and 334). Same-scene pairs from one save are next; I will add them here. - In session 2 card memory still crept from 9,080 to 10,043 MB and unaccounted from 1,817 to 2,381 MB with the heaps flat. I don't know what that part is. - Both sessions are one person playing, not a scripted route. Where it is in the code (f3840d7, `crates/darner-gpu/src/hwrt.rs`): the comment above `BLAS_HEAP_BYTES` says "Heaps are kept for the rest of the run"; `blas_heaps()` is a list that is only pushed to; `take_units` tries the newest heap first; `evict_over_budget` compares the live BLAS bytes with the budget, not the heap bytes. Not the same as #111 (ray tracing off there, Proton, frame generation on). #19 is the wider topic. ### GPU and driver RTX 5070 12 GB, driver 621.40, NVIDIA profile from `darner nv-profile --mb 2048` ### CPU, RAM and Windows version i9-14900F, 32 GB, Windows 11 (page file 53 GB fixed in session 2; system-managed in session 1) ### Darner release or commit f3840d7 (diagnostics build) ### Settings Series X, 2560x1440, hardware ray tracing on, DLSS Quality, frame generation off, no fps cap, texture quality full. Session 2 adds `DARNER_HW_RT_BLAS_BUDGET_MB=512`. No device loss in either session, both exited normally. ### Logs Lines quoted above are from the two play logs (10:40-10:50 and 11:08-11:26 UTC, 2026-12-04). I can attach the full logs if they help. ### Are you working on a fix? Yes: a branch that releases a heap once all its units are free (keeping a couple of spares) and places new BLAS in the fullest heap first. It gets a pull request only if the three gates pass and a game run shows the heaps coming back down. Written with an AI assistant (Claude); all figures are measured on this PC.

I found the likely ledger gap while checking this against f3840d7. take_units calls CreateHeap and then cardledger::retag, but retag only changes the kind of an allocation that already carries a ledger notice. The other direct heap allocators, such as alias_rt and pagebuf, register the new heap with cardledger::heap.

For your branch, calling cardledger::heap(&heap, cardledger::Kind::AccelStructure) at this allocation should count each 64 MiB heap until the host releases it. The placed BLAS buffers live inside that allocation, so registering the heap gives the physical total. This is from the allocation and ledger code. The total still needs a check on a hardware run.

I found the likely ledger gap while checking this against `f3840d7`. `take_units` calls `CreateHeap` and then `cardledger::retag`, but `retag` only changes the kind of an allocation that already carries a ledger notice. The other direct heap allocators, such as `alias_rt` and `pagebuf`, register the new heap with `cardledger::heap`. For your branch, calling `cardledger::heap(&heap, cardledger::Kind::AccelStructure)` at this allocation should count each 64 MiB heap until the host releases it. The placed BLAS buffers live inside that allocation, so registering the heap gives the physical total. This is from the allocation and ledger code. The total still needs a check on a hardware run.
Author

Same-save pairs, as promised, plus a negative result for the heap release.

Setup for every run: f3840d7 diagnostics build, RTX 5070 12 GB, driver 621.40, i9-14900F, 32 GB, Windows 11, Series X, 2560x1440, hardware RT on, DLSS Quality, frame generation off, 15 minutes in the world from one save (street at Key Lento).

Walking pairs (character on foot among traffic; a script steers from the screen, so the paths differ from run to run):

default a 512 a default b 512 b
median ms (from +30 s) 50.4 51.1 51.9 53.3
1 % low, fps 8.6 8.1 8.0 7.4
pauses over 150 ms a minute 2.7 3.5 4.0 6.5
median ms at 7000+ draws 58.0 59.0 58.7 61.9
BLAS heaps at the end 31 = 1,984 MB 17 = 1,088 MB 31 = 1,984 MB 19 = 1,216 MB
card in use / budget at the end, MB 10,473 / 10,684 9,692 / 10,684 10,478 / 10,652 9,566 / 10,663
device lost no no no no

So DARNER_HW_RT_BLAS_BUDGET_MB=512 keeps about 0.8-0.9 GB of card memory free here and does not make frames faster.

Device hangs seen in an earlier set from the same spot (a fixed key route; for about the last 5 of its 15 minutes the character circled in a car): both default runs ended with 0x887A0006 after 483 s and 539 s in the world (27-28 heaps, card within 240 MB of its budget, no page fault in the device-removed data). Both 512 runs completed. Counting the heap-release runs below too, 3 of 6 runs at the default budget hung in that set and 0 of 2 at 512. The walking pairs above had no hang in any run, so I can't say the budget prevents them; it is only a lead.

Heap release does not help on this scene. I tried a local branch that places new BLAS in the fullest heap and releases a heap once every unit in it is free (2 spares kept). In two 15-minute runs with it on, it gave back 0 heaps (28 and 26 heaps, with 1,263 and 1,209 MB of their units in use at the end): every heap kept at least one live BLAS. So emptying-then-releasing is not enough; getting the memory back would need BLASes moved (compaction into fewer heaps) or something like smaller heaps, neither of which I have tried. I am not opening a pull request for it.

@andrewpozdnakov7-jpg: yes, that is the gap. The same branch registers each heap with cardledger::heap, and in its runs "unaccounted" ended at about 1.1 GB, against about 2.8 GB on f3840d7 with a similar number of heaps. If it is useful on its own I can send just that part.

Written with an AI assistant (Claude); the figures are measured on this PC.

Same-save pairs, as promised, plus a negative result for the heap release. Setup for every run: f3840d7 diagnostics build, RTX 5070 12 GB, driver 621.40, i9-14900F, 32 GB, Windows 11, Series X, 2560x1440, hardware RT on, DLSS Quality, frame generation off, 15 minutes in the world from one save (street at Key Lento). **Walking pairs** (character on foot among traffic; a script steers from the screen, so the paths differ from run to run): | | default a | 512 a | default b | 512 b | |---|---|---|---|---| | median ms (from +30 s) | 50.4 | 51.1 | 51.9 | 53.3 | | 1 % low, fps | 8.6 | 8.1 | 8.0 | 7.4 | | pauses over 150 ms a minute | 2.7 | 3.5 | 4.0 | 6.5 | | median ms at 7000+ draws | 58.0 | 59.0 | 58.7 | 61.9 | | BLAS heaps at the end | 31 = 1,984 MB | 17 = 1,088 MB | 31 = 1,984 MB | 19 = 1,216 MB | | card in use / budget at the end, MB | 10,473 / 10,684 | 9,692 / 10,684 | 10,478 / 10,652 | 9,566 / 10,663 | | device lost | no | no | no | no | So `DARNER_HW_RT_BLAS_BUDGET_MB=512` keeps about 0.8-0.9 GB of card memory free here and does **not** make frames faster. **Device hangs seen in an earlier set from the same spot** (a fixed key route; for about the last 5 of its 15 minutes the character circled in a car): both default runs ended with `0x887A0006` after 483 s and 539 s in the world (27-28 heaps, card within 240 MB of its budget, no page fault in the device-removed data). Both 512 runs completed. Counting the heap-release runs below too, 3 of 6 runs at the default budget hung in that set and 0 of 2 at 512. The walking pairs above had no hang in any run, so I can't say the budget prevents them; it is only a lead. **Heap release does not help on this scene.** I tried a local branch that places new BLAS in the fullest heap and releases a heap once every unit in it is free (2 spares kept). In two 15-minute runs with it on, it gave back **0 heaps** (28 and 26 heaps, with 1,263 and 1,209 MB of their units in use at the end): every heap kept at least one live BLAS. So emptying-then-releasing is not enough; getting the memory back would need BLASes moved (compaction into fewer heaps) or something like smaller heaps, neither of which I have tried. I am not opening a pull request for it. @andrewpozdnakov7-jpg: yes, that is the gap. The same branch registers each heap with `cardledger::heap`, and in its runs "unaccounted" ended at about 1.1 GB, against about 2.8 GB on f3840d7 with a similar number of heaps. If it is useful on its own I can send just that part. Written with an AI assistant (Claude); the figures are measured on this PC.

Yes, the accounting change is useful on its own. The drop from about 2.8 GB to 1.1 GB in the unaccounted bucket with similar heap counts is a good check for the ledger. If you send that part, please include total card use alongside the before/after ledger breakdown so reviewers can distinguish reclassification from a change in usage.

The walking pairs give a clear tradeoff for this scene: the 512 MB budget kept card use about 0.8 to 0.9 GB lower while median frame times rose slightly. Thanks for reporting the runs with no hangs too.

Yes, the accounting change is useful on its own. The drop from about 2.8 GB to 1.1 GB in the unaccounted bucket with similar heap counts is a good check for the ledger. If you send that part, please include total card use alongside the before/after ledger breakdown so reviewers can distinguish reclassification from a change in usage. The walking pairs give a clear tradeoff for this scene: the 512 MB budget kept card use about 0.8 to 0.9 GB lower while median frame times rose slightly. Thanks for reporting the runs with no hangs too.
Author

DARNER_HW_RT_BLAS_BUDGET_MB=512 measured again, this time on the repeatable downtown route of the benchmark kit (cam-city, bench-base save), three flights each.

Setup: main f3840d7 plus PR #361, bench-remote release build, RTX 5070 12 GB, i9-14900F, 32 GB, Windows 11, driver 621.40, Series X, 2560x1440, hardware RT, DLSS Quality, frame generation off. Flights rotated default / 512. Figures are the two scored parts of each flight.

default 1 default 2 default 3 512 1 512 2 512 3
median frame, ms 94.3 86.0 81.7 83.6 90.8 80.8
p95, ms 186 152 127 153 136 121
BLAS heaps at the end 28 32 35 22 19 21
BLAS in use at the end, MB 1,195 1,208 1,213 570 572 553
video memory in use, median MB 10,062 10,276 10,553 9,653 9,586 9,632
device lost no no no no no no

Same conclusion as the walking runs above: 512 keeps roughly 0.4-0.9 GB of video memory free and makes no frame-time difference that I can separate from run-to-run spread (the three default medians alone span 81.7-94.3 ms). A flight is only about 3 minutes, so this says nothing about long sessions.

Written with an AI assistant (Claude); the figures are measured on this PC.

`DARNER_HW_RT_BLAS_BUDGET_MB=512` measured again, this time on the repeatable downtown route of the benchmark kit (cam-city, bench-base save), three flights each. **Setup:** `main` f3840d7 plus PR #361, `bench-remote` release build, RTX 5070 12 GB, i9-14900F, 32 GB, Windows 11, driver 621.40, Series X, 2560x1440, hardware RT, DLSS Quality, frame generation off. Flights rotated default / 512. Figures are the two scored parts of each flight. | | default 1 | default 2 | default 3 | 512 1 | 512 2 | 512 3 | |---|---|---|---|---|---|---| | median frame, ms | 94.3 | 86.0 | 81.7 | 83.6 | 90.8 | 80.8 | | p95, ms | 186 | 152 | 127 | 153 | 136 | 121 | | BLAS heaps at the end | 28 | 32 | 35 | 22 | 19 | 21 | | BLAS in use at the end, MB | 1,195 | 1,208 | 1,213 | 570 | 572 | 553 | | video memory in use, median MB | 10,062 | 10,276 | 10,553 | 9,653 | 9,586 | 9,632 | | device lost | no | no | no | no | no | no | Same conclusion as the walking runs above: 512 keeps roughly 0.4-0.9 GB of video memory free and makes **no frame-time difference that I can separate from run-to-run spread** (the three default medians alone span 81.7-94.3 ms). A flight is only about 3 minutes, so this says nothing about long sessions. Written with an AI assistant (Claude); the figures are measured on this PC.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
2 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#290
No description provided.