Hardware ray tracing: empty sparse blocks of long-lived structures and give them back (VICTORY_HW_RT_PACK=1, off by default, on #323) #328
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/lobomfz--VIctory-xmem!328
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-328"
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?
@LOCKhart07 on GitHub · 2026-12-03 15:32 UTC · original
LOCKhart07:rt-pack→main· +21015 −137 · 31 files · 9 commits · openRelated pull requests
These depend on each other. Merge order: #262, then #274 and #306 in either order, then #323, then #328.
VICTORY_HW_RT=1). The base; merge first.VICTORY_HW_RT_LEAN_BUILDER=1). On #262.VICTORY_HW_RT_DEMOTE=1). On #306.VICTORY_HW_RT_PACK=1). On #323. (this one)All five together, current with main: #342.
Stacked on #323. Only the last commit is new here; it touches
crates/victory-gpu/src/hwrt.rsandcrates/victory-gpu/src/pool.rs. Off by default:VICTORY_HW_RT_PACK=1, and it only does anything withVICTORY_HW_RT=1.What is wrong
Long-lived bottom-level structures share 64 MiB blocks (#306), and a block goes back to the card only when nothing is left in it. When compaction or #323 shrinks what the blocks hold, the survivors stay spread over all of them.
At the end of one nine-minute play, 49 blocks (3,136 MB) held 1,648 MB, and none had emptied in the last four minutes. Later structures do land in the holes, so this is a high-water mark and not fragmentation. The card still does not get the memory back.
What this does
With the switch off nothing is marked or moved. Three things on shared paths change form but not result; the commit message lists them. The new report line prints with the switch off too.
Measured
RX 9070 XT, RADV (Mesa 26.3.1), 2560x1440, one play of 36 minutes on my local tree (this change, #323's switch, and a counting-only switch of mine that is not in this PR).
The moves came in two bursts of about half a minute each.
What it does not do, and what went wrong in that play
Tests
hwrt64 passed (7 new),pool18 passed (4 new). The copy on the card itself has no unit test; it needs a device. Only these two modules' tests were run.🤖 Generated with Claude Code
@pete842 on GitHub · 2026-12-03 17:29 UTC · original
Thanks for the HW RT work, the first minutes were the smoothest I've had here! I'm seeing the same BLAS growth you mention in the description, in case this helps:
Setup: RX 7900 XTX 24 GB, xmem main + #262/#306/#323, HW_RT + DEMOTE, 1440p.
Once the card is full, textures flicker and stutter triples.
Likely cause:
drop_built_overonly knew the range for 112890 of 766699 builds (it needs the exactTITLE_SIZESkey). 7.4 GB stays alive while known-size builds total only 3.6 GB, so the rest is never dropped when the title reuses that memory. Maybe the prebuild query uses different vertex/index counts than the build.Side note: texture blocks also reached 8.8 GB and were never given back (1.8 GB used after eviction).
@Luxuride on GitHub · 2026-12-04 12:02 UTC · original
This is the best increment in the stack — 919 lines, 11 tests, and a win that maps to the project's actual problem (1,088 MB of 3,136 MB returned) — but the risk is concentrated in the one place without evidence.
move_one(crates/victory-gpu/src/hwrt.rs:5226-5284) copies a structure into a new VA withCLONEand relies on every consumer reading the address through the ledger. A TLAS instance table where the title baked the old VA in is only fenced by the "no write of its address is tapped and not yet in card order" rule inmove_verdict(hwrt.rs:1309-1356). There is no parity test of the move path against a title-authored TLAS, anddocs/RT-PARITY.mditself still lists the capture exporter and matched GPU traces as outstanding.crates/victory-gpu/src/pool.rs:629-690), gives route throughgive_marked(:910) andstructure_moved(:923), and the new report line prints either way.VICTORY_HW_RT_PACKneedsdocs/SETTINGS.mdandrun.conf.default, like its siblings.What would make this reviewable: rebase, document the switches, and bring one clean 30-minute run with the move counters plus a TLAS-visual check.
@LOCKhart07 on GitHub · 2026-12-04 14:34 UTC · original
Split as asked:
rt-6-packon my fork, showing only its own change.VICTORY_HW_RT_PACKis documented in both files, including how its one measured play ended.Not done, and I will not claim otherwise: there is no parity test of the move path against a title-authored TLAS, and no clean 30-minute run with the move counters plus a TLAS check yet. I am not going to get to that run myself soon. If anyone here can do it: build
rt-6-packfrom my fork, play 30 minutes withVICTORY_HW_RT=1 VICTORY_HW_RT_PACK=1, and post the lasthardware RT sparse blocks of long-lived structures emptiedandhardware RT losseslines from the log, plus whether reflections and shadows stayed right after blocks were given back.@pete842: you were right about
drop_built_over. It drops only when the title asked the size of that exact build shape, which is a minority of builds. The fix is the reuse branch (rt-7-reuse, from #374), which takes each structure's extent from the header its builder wrote.This one can be closed.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.