[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
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
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:
32 heaps of 64 MB (1276 MB in use)next tobudget 1022 MB, live 986 MB (7139 BLAS).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):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:
Where it is in the code (
f3840d7,crates/darner-gpu/src/hwrt.rs): the comment aboveBLAS_HEAP_BYTESsays "Heaps are kept for the rest of the run";blas_heaps()is a list that is only pushed to;take_unitstries the newest heap first;evict_over_budgetcompares 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 2048CPU, 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_unitscallsCreateHeapand thencardledger::retag, butretagonly changes the kind of an allocation that already carries a ledger notice. The other direct heap allocators, such asalias_rtandpagebuf, register the new heap withcardledger::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.Same-save pairs, as promised, plus a negative result for the heap release.
Setup for every run:
f3840d7diagnostics 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):
So
DARNER_HW_RT_BLAS_BUDGET_MB=512keeps 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
0x887A0006after 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 onf3840d7with 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.
DARNER_HW_RT_BLAS_BUDGET_MB=512measured again, this time on the repeatable downtown route of the benchmark kit (cam-city, bench-base save), three flights each.Setup:
mainf3840d7plus PR #361,bench-remoterelease 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.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.