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

Open
github-bot wants to merge 9 commits from github-bot/gh-328 into main AGit
Owner

@⁠LOCKhart07 on GitHub · 2026-12-03 15:32 UTC · original
LOCKhart07:rt-pack → main · +21015 −137 · 31 files · 9 commits · open

These depend on each other. Merge order: #262, then #274 and #306 in either order, then #323, then #328.

  • #262: hardware ray tracing by ray queries and a builder tap (VICTORY_HW_RT=1). The base; merge first.
  • #274: run the title's structure builder only where its result is read (VICTORY_HW_RT_LEAN_BUILDER=1). On #262.
  • #306: card memory: send buffers used again, structures in shared blocks, textures placed tight. On #262.
  • #323: build idle updatable structures again as compact ones (VICTORY_HW_RT_DEMOTE=1). On #306.
  • #328: empty sparse blocks of long-lived structures and give them back (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.rs and crates/victory-gpu/src/pool.rs. Off by default: VICTORY_HW_RT_PACK=1, and it only does anything with VICTORY_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

  • Updatable structures get blocks of their own. They are never moved, so they no longer pin a block of the others.
  • At the card point at the start of a submission, every 250 ms, the emptiest blocks are marked to be emptied. That happens only while more than a quarter of the long-lived blocks' bytes is free, and only as many as the rest can take with 128 MB to spare. Nothing new is placed in a marked block while another has room.
  • Structures in marked blocks are copied (a clone) into the fullest block that stays, at most 8 MB and 32 structures a card point. The swap is an event in card order, like a compaction. Reads and copies tapped before it see the old structure; those after it see the new one.
  • A move never makes a block. No room is a skip, and it is counted.
  • A structure is moved only if it is not updatable, is 10 s old, was not moved in the last 60 s, has no compaction waiting, and has no write tapped that is not yet in card order.
  • The old structure is let go only after the submissions that may use it are done. A top-level structure built before the move keeps it until its next build.

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).

Blocks marked 31
Of those, empty after moves / by themselves 25 / 3
Blocks given back to the card 17 (1,088 MB)
Structures moved 4,080 (822 MB)
Tries that found no room 0
Time at the card points, all / longest 238 ms / 1.7 ms
Old places not yet free, at most 210 MB
Loss counters, the two of card order among them 0

The moves came in two bursts of about half a minute each.

What it does not do, and what went wrong in that play

  • The play ended in a device loss at minute 36. The card and the memory shared with it were both full, and structures had grown from 2.4 GB to 3.8 GB in the last quarter of an hour. The last move was 17 minutes before the loss, and the blocks were 98% full by then. I do not know the cause. It was my longest session on this stack, so I cannot say whether it happens without this switch.
  • This returns space that is free. It does not stop the growth of structures in a long session.
  • Updatable structures and structures with a compaction waiting are not moved.
  • The cost of the copies on the card is not measured; the bytes moved at a card point are bounded.
  • This branch itself was not run in play: the diagnostics build compiles and its tests pass. The play was on a tree that carries more.
  • One card and one driver.

Tests

hwrt 64 passed (7 new), pool 18 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

**@⁠LOCKhart07** on GitHub · 2026-12-03 15:32 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/328) `LOCKhart07:rt-pack` → `main` · +21015 −137 · 31 files · 9 commits · open ## Related pull requests These depend on each other. Merge order: #262, then #274 and #306 in either order, then #323, then #328. - #262: hardware ray tracing by ray queries and a builder tap (`VICTORY_HW_RT=1`). The base; merge first. - #274: run the title's structure builder only where its result is read (`VICTORY_HW_RT_LEAN_BUILDER=1`). On #262. - #306: card memory: send buffers used again, structures in shared blocks, textures placed tight. On #262. - #323: build idle updatable structures again as compact ones (`VICTORY_HW_RT_DEMOTE=1`). On #306. - #328: empty sparse blocks of long-lived structures and give them back (`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.rs` and `crates/victory-gpu/src/pool.rs`. Off by default: `VICTORY_HW_RT_PACK=1`, and it only does anything with `VICTORY_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 - Updatable structures get blocks of their own. They are never moved, so they no longer pin a block of the others. - At the card point at the start of a submission, every 250 ms, the emptiest blocks are marked to be emptied. That happens only while more than a quarter of the long-lived blocks' bytes is free, and only as many as the rest can take with 128 MB to spare. Nothing new is placed in a marked block while another has room. - Structures in marked blocks are copied (a clone) into the fullest block that stays, at most 8 MB and 32 structures a card point. The swap is an event in card order, like a compaction. Reads and copies tapped before it see the old structure; those after it see the new one. - A move never makes a block. No room is a skip, and it is counted. - A structure is moved only if it is not updatable, is 10 s old, was not moved in the last 60 s, has no compaction waiting, and has no write tapped that is not yet in card order. - The old structure is let go only after the submissions that may use it are done. A top-level structure built before the move keeps it until its next build. 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). | | | |---|---| | Blocks marked | 31 | | Of those, empty after moves / by themselves | 25 / 3 | | Blocks given back to the card | 17 (1,088 MB) | | Structures moved | 4,080 (822 MB) | | Tries that found no room | 0 | | Time at the card points, all / longest | 238 ms / 1.7 ms | | Old places not yet free, at most | 210 MB | | Loss counters, the two of card order among them | 0 | The moves came in two bursts of about half a minute each. ## What it does not do, and what went wrong in that play - **The play ended in a device loss at minute 36.** The card and the memory shared with it were both full, and structures had grown from 2.4 GB to 3.8 GB in the last quarter of an hour. The last move was 17 minutes before the loss, and the blocks were 98% full by then. I do not know the cause. It was my longest session on this stack, so I cannot say whether it happens without this switch. - This returns space that is free. It does not stop the growth of structures in a long session. - Updatable structures and structures with a compaction waiting are not moved. - The cost of the copies on the card is not measured; the bytes moved at a card point are bounded. - This branch itself was not run in play: the diagnostics build compiles and its tests pass. The play was on a tree that carries more. - One card and one driver. ## Tests `hwrt` 64 passed (7 new), `pool` 18 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](https://claude.com/claude-code)
The title's ray-tracing programs walk the console's structures in a loop
of their own. With VICTORY_HW_RT=1 the translator recognises each such
loop and writes a DXIL RayQuery in its place, keeping the title's own
hit tests, masks and ordering rules as the candidate and commit steps.
A loop it cannot prove equivalent stays as translated before.

Ported from VIctory-NVIDIA PR #3706 (GPL-3.0), with the lifter's
exactness rules of dakisback2/VIctory-Nvidia-Linux (85b0b11b, 5485daf7)
by way of Leslie-d-a/VIctory-NVIDIA-HWRT; see the header of
emit/rayquery.rs.

New here: the 14 loops those leave unlifted (6 programs, given a forced
miss there). The console compiler reuses three registers as loop scratch
on the lanes that run the loop and reads their old values on the lanes
that do not; the lane sets pass through mask joins the lifter could not
relate. Joins whose inputs are all one mask now collapse to it, and the
reading lanes are refuted against the loop's entry lanes by an exact
search (Bools::sat_with; out of budget refuses). All 64 ray-tracing
programs and their 397 loops lift and pass the DXIL validator.

Two fixes on the way, with the switch off too (translator version up):
the sign of zero in v_mad_legacy, and partial stores through a counter
view. Apart from those, the output with the switch off is unchanged.

`victory translate` names an emit panic per program and prints a
ray-tracing summary. A run refuses the switch until the host side is in.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The host side of the lifted ray queries. Started from VIctory-NVIDIA
PR #3706 (GPL-3.0) as ported to RADV by
MJ26gaming/victory-rdna4-linux-rt-MJ26 365fad515; see the header of
hwrt.rs for what was taken and what was left out.

The title's structure builder keeps running (a tap, not a replacement):
its build, refit and copy calls are passed on, and the same triangles
and instances go into host bottom- and top-level structures that the
lifted programs trace.

- Inputs follow the console builder's rules: only a NaN in X makes a
  triangle inactive; infinite and far positions pass through; indices
  and meshlets past the stated counts read the title's real bytes.
  Every departure is counted by what it changed, and bytes that cannot
  be read are a counted loss, never a silent zero.
- No budget evicts a structure and no instance is masked.
- Host work is recorded in the title's lists at the title's call, and a
  ledger keeps it in the card's order. Structures that are not refit
  are compacted exactly.
- Loss counters are printed with the frame-rate lines; all 0 over the
  check runs.
- VICTORY_RT_STAMPS=rt (diagnostics) stamps only the ray-tracing
  dispatches and the host builds. Over two 5 minute runs in the same
  place: trace passes 5.4 ms a frame as translated loops, 0.9 ms as
  ray queries, plus 0.5 ms for the host builds.
- A run takes VICTORY_HW_RT=1. Not yet checked hit for hit against the
  console's own walk on a captured frame.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
In free play the host structures grew past 7 GB in a few minutes and
kept growing. Measured by what each buffer holds, almost all of it was
structures kept at the driver's largest size:

- An updatable structure costs about four times a compacted one's bytes
  a triangle on RADV (its refit needs a fixed leaf region), and the
  title allows updates of many structures it never updates, or updates
  once. A structure is now built without ALLOW_UPDATE on the host, and
  becomes updatable only when the title updates it again within a
  second of its last update; an update short of that is built in full,
  the same triangles.
- Every structure built without ALLOW_UPDATE is compacted by the host
  once built, through the tickets the title's own COMPACT copies use:
  rehydrates (ready-made on the console, never copied by the title) and
  the title's builds it does not copy.
- Structures the title builds over are dropped: the builder's own
  prebuild sizes are tapped, and a structure kept at an address inside
  the bytes a new build was given goes, as with freed title memory.

The report says where the bytes are: alive by what they hold, in the
tap's map or outside it, updatable ones by their last update and by
how many updates they had, the host's own cost (buffers made,
compaction points), and the console's bytes next to the host's where
the console's are known. An event the card's order refuses is logged
with what the ledger held there.

Over a 3 minute drive: 7.3 GB and growing before; steady between 2.1
and 2.5 GB after, every loss counter 0.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Four files of the shader crate conflicted with #283, which fixed the same two things another way:

- legacy_fmad's zero addend: kept this branch's form, worked on the bits (-0 gives +0, and a NaN addend comes out quieted as the console's arithmetic gives it); main's comparison against zero covers the sign alone.
- the joined mask and number test, the image store test and the container hash test: kept this branch's, which check more (a full and a partial wave, every channel mask against the store of one, the validator's hash).

TRANSLATOR_VERSION 14: main's 13 is the legacy multiply, and this branch changes the legacy mad's NaN and partial stores through a counter view with the switch off.

Shader crate tests: 412 passed, 0 failed. The gpu crate's hardware ray-tracing tests: 43 passed.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Every submission in flight made an upload buffer of its own for what it sends up, sized to what was asked, and kept it until the submission was done. A buffer given back was used again only by a request of the same size, so most were made new: about 570 MB of them stood on the card at the end of a six minute run.

Now a buffer is made at the next power of two (64 KiB at least) and, once its submission is done, kept spare for the next request of that size. Spare buffers not taken for 10 s are let go, and so is what passes 768 MB of spare; both go through host::retire, as other memory the card may still read.

Measured on an RX 9070 XT (RADV), 2560x1440, six minutes with the camera turning, hardware ray tracing on: 3 buffers alive (0.9 MB), 6 made in the whole run, 3 let go by the trim, none for the cap. Three runs, no error line, no device loss.

Two report lines say it: what submissions send up (alive, in flight, spare, made, let go), and the host's buffers by who makes them.

Tests: host::send, 6 passed.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Every host bottom-level structure was a committed buffer of its own: 73,703 buffers made in 6.9 s of one play (the longest 73 ms), and 363 MB lost to their 64 KiB placement.

Now they are cut from 64 MiB blocks at 4 KiB (VICTORY_HW_RT_ARENA, on by default; =0 gives every structure its own buffer as before). Two sets of blocks, by how long a structure lives: one for those built in full and not updatable, which are compacted or replaced soon and go; one for updatable, copied and compacted ones, which stay. Mixed in one set, the short-lived left holes among the long-lived and no block ever emptied: 1,664 MB of blocks for 888 MB of structures. A piece is given back when the structure is dropped, which host::retire already does only after the lists that used it, so it rests no further and is free at once. Top-level structures keep their own buffers.

Measured on an RX 9070 XT (RADV), 2560x1440, six minutes with the camera turning: 32 structure buffers made in 11 ms (the longest 5 ms); 20 blocks (1,280 MB) for 1,023 MB of structures, nothing resting, 6 of the short-lived set's blocks made and 4 given back. Three runs, all loss counters 0, no error line. The gain is in the buffers no longer made; the bytes are about what the buffers took (a different scene from the 363 MB above, so not a pair).

Report lines with it, which the next changes are read from:
- the blocks of structures of each set (alive, held, resting, free, made, given back);
- the build memory (scratch, instances and sanitised copies): what lists hold now, asked for against handed out, buffers made and how long that took, the spare by size and how much of it was not taken lately;
- texture blocks by the tenth of them textures hold, their free space, and the textures' copy footprints against the pieces they lie in (what the pieces' rounding costs);
- the texture queue's slots held back for want of room on the card.

Tests: pool 13 passed, hwrt 47 passed.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Every texture cut from a texture block was asked at 64 KiB, so each took a multiple of 64 KiB. Most of the title's textures are small: their copy footprints came to 1,599 MB in 2,760 MB of pieces, 1,161 MB of rounding.

Now a texture is asked with D3D12_RESOURCE_FLAG_USE_TIGHT_ALIGNMENT where the host says it has it (D3D12_FEATURE_D3D12_TIGHT_ALIGNMENT, tier 1 or more), and its piece is the size at the alignment the host answers: 4 KiB multiples for a small one (256 bytes for the smallest), 64 KiB as before for a large one. The host is asked once and the texture is made with the description the size was asked for. A host without the tier is asked as before.

The earlier 4 KiB placement (VICTORY_POOL_SMALL, removed after two device losses on 2026-11-25) asked at 4 KiB and, refused, asked again at 0; the flag is never refused. What those losses were was not proven. The new test places 11 kinds of small texture three times over back to back from 0x6000 into a heap (the kind and place of those losses first), in each of the three ways of asking, writes every level with bytes of its own, reads them back by a copy and then by a shader through a view of the whole chain and one of each level, and compares with the same texture on a 64 KiB multiple: 500 reads compared, none differ, on an RX 9070 XT (RADV), where the driver lays such textures out at 4 KiB (so nothing is padded).

Measured there, 2560x1440, six minutes with the camera turning, against the run before it (not a pair: the scene streams): rounding 1,161 MB -> 108 MB (2,014 MB of footprints in 2,123 MB of pieces); texture blocks 64 -> 56; slots held back for want of room on the card 152 -> 0; host copies let go for room 6,495 MB -> 3,359 MB; card in use 13,326 -> 13,020 MB with 415 MB more of texture loaded. No error line, no device loss, the picture looked right.

Tests: pool 14 passed (the new one among them), resource 16, texture 11.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
A structure the title updates twice within a second is built with ALLOW_UPDATE from then on and stays so for good. Much of what earns that is updated for a while and then left alone (it is still read by the top level). On RADV an updatable structure keeps a fixed layout of about 177 bytes a triangle that compaction cannot shrink, against about 46 for a compacted one, so the idle ones hold most of the structure memory they do not need.

With the switch on:

- A build of an updatable structure keeps its inputs (the staged vertex, index and transform pieces and the geometry descriptions) with the structure, in pieces of its own. Inputs under 256 KiB, inputs decoded or staged in place, boxes and copies are not kept, and such a structure is left as it is.
- At the card point at the start of a submission, every 250 ms, structures not updated and not read as a refit source for 10 s are built again from the kept inputs without ALLOW_UPDATE, at most 16 MiB of them a pass, and then compacted by the path that exists. The swap is an event in card order like a compaction, so reads and copies tapped before it see the old structure and those after it the new one.
- An update of such a structure is never a refit: it is a full build, and the existing rule makes it updatable again if the title keeps updating it. The wait before it is put to sleep again doubles each time, up to 80 s.
- The old structure, its inputs and the scratch are let go only after the submissions that may use them are done, as elsewhere.

The kept inputs come from a pool of their own. Sharing the build pool made it overflow its 256 MB of spare pieces every frame (39,166 buffers made in five minutes); with their own pool none are let go past the bound.

This also changes the pool of build pieces itself, switch or no switch: a spare piece is picked by how lately it was used and one idle for 10 s is let go. That part alone was not shown to gain anything in play.

Measured on an RX 9070 XT (RADV, Mesa 26.3.1), 2560x1440, nine minutes of driving, one run: 448 structures put to sleep, 444 of them compacted, 1,695 MB -> 455 MB; none failed; 25 were updated afterwards and 24 became updatable again; inputs held at the end 129 MB; the card points took 387 ms in all, the longest 10.8 ms; 120 idle updatable structures left (25 MB: small ones and one staged in place). No error line, no device loss, every loss counter 0, the picture looked as before.

What it does not do: the freed bytes stay inside the 64 MiB structure blocks until a block empties (1,487 MB free in 49 blocks at the end), and the card still fills, because compacted structures nothing names any more are never let go. Buffers made for builds are more than without the switch (about 2,300 a minute against about 600), though the longest wait for one was shorter (57 ms against 203 ms). Other drivers and cards were not tried.

Tests: hwrt 57 passed (the verdict table, the swap at the card point, refits and copies tapped before the swap, an update after it not a refit, what is kept, the pick and the wait, the pool of kept pieces).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Long-lived bottom-level structures share 64 MiB blocks, and a block goes back to the card only when nothing is left in it. When compaction, or the rebuild of idle updatable structures, 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. The holes are used again by later structures, so this is a high-water mark rather than fragmentation, but the card does not get the memory back.

With the switch on:

- Updatable structures are cut from blocks of their own. They are never moved, and so no longer pin a block of the others.
- At the card point at the start of a submission, every 250 ms, while more than a quarter of the long-lived blocks' bytes is free (four blocks' worth at least), the emptiest blocks are marked to be emptied, as many as the free bytes of the rest can take with 128 MB to spare. Nothing new is cut from a marked block while another has room.
- Structures in marked blocks are copied (a clone) into the fullest block that stays, at most 8 MB and 32 structures a card point, and put in their place in card order as a compaction is: reads and copies tapped before see the one moved from, those after the one moved into. A move never makes a block; no room is a skip, counted.
- A structure is moved only if the tap and the ledger agree on it, it is not updatable, no write of its address is tapped and not yet in card order, no compaction waits at its address, it is 10 s old, and it was not moved in the last 60 s (the ledger's alias names one structure back).
- The one moved from is let go only after the submissions that may use it are done, as elsewhere. A top-level structure built before the move keeps it until its next build.

With the switch off nothing is marked or moved and updatable structures stay where they were. Three things on shared paths change form but not result: the texture report's count of blocks cut from again is kept per pool, a structure piece is given back through a function that also looks for a mark (there is none), and a compacted structure is stamped with when it was made. The new report line prints with the switch off too.

Measured on an RX 9070 XT (RADV, Mesa 26.3.1), 2560x1440, one play of 36 minutes on my local tree (this change with a counting-only switch of mine also on): 31 blocks marked, 25 empty after moves and 3 by themselves, 17 given back to the card (1,088 MB); 4,080 structures moved (822 MB) in two bursts of about half a minute; the card points' part 238 ms in all, the longest 1.7 ms; no try found no room; the old places not yet free came to 210 MB at most. Every loss counter 0, the two of card order among them (a write after a newer one at the same address, a refit or copy whose source is not the one assumed).

That play ended in a device loss at minute 36, with the card and the memory shared with it both full and structures grown from 2.4 GB to 3.8 GB in the last quarter of an hour. The last move was 17 minutes before it and the blocks were 98% full by then. What caused it is not known, and this change does not stop that growth: it returns space that is free, no more.

Not tried: this branch itself in play (the diagnostics build compiles and its tests pass), other cards or drivers, the cost of the copies on the card (not measured; the bytes a card point moves are bounded).

Tests: hwrt 64 passed (7 new: the verdict table, the swap, a compaction waiting, copies tapped before a move and two moves back, the pick, the blocks of updatable ones, the count of blocks), pool 18 passed (4 new: the marking, the destination, the fallback, an emptied marked block).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-03 15:37:26 +00:00
Author
Owner

@⁠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.

play time BLAS held card free
1 min 0.5 GB 13.6 GB
6 min 1.7 GB 7.0 GB
11 min 7.4 GB (14217 alive) 0.4 GB

Once the card is full, textures flicker and stutter triples.

Likely cause: drop_built_over only knew the range for 112890 of 766699 builds (it needs the exact TITLE_SIZES key). 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).

**@⁠pete842** on GitHub · 2026-12-03 17:29 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/328#issuecomment-7386606210) 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. | play time | BLAS held | card free | |---|---|---| | 1 min | 0.5 GB | 13.6 GB | | 6 min | 1.7 GB | 7.0 GB | | 11 min | 7.4 GB (14217 alive) | 0.4 GB | Once the card is full, textures flicker and stutter triples. Likely cause: `drop_built_over` only knew the range for 112890 of 766699 builds (it needs the exact `TITLE_SIZES` key). 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).
Author
Owner

@⁠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 with CLONE and 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 in move_verdict (hwrt.rs:1309-1356). There is no parity test of the move path against a title-authored TLAS, and docs/RT-PARITY.md itself still lists the capture exporter and matched GPU traces as outstanding.
  • The only full play measurement ended in a device loss at minute 36 (cause unknown; last move 17 minutes earlier, all loss counters 0), so the switch has no clean long-run evidence yet.
  • It changes shape with the switch off: the refill counter moves from a global static into the pool (crates/victory-gpu/src/pool.rs:629-690), gives route through give_marked (:910) and structure_moved (:923), and the new report line prints either way.
  • VICTORY_HW_RT_PACK needs docs/SETTINGS.md and run.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.

**@⁠Luxuride** on GitHub · 2026-12-04 12:02 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/328#issuecomment-7410897743) 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 with `CLONE` and 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 in `move_verdict` (`hwrt.rs:1309-1356`). There is no parity test of the move path against a title-authored TLAS, and `docs/RT-PARITY.md` itself still lists the capture exporter and matched GPU traces as outstanding. - The only full play measurement ended in a device loss at minute 36 (cause unknown; last move 17 minutes earlier, all loss counters 0), so the switch has no clean long-run evidence yet. - It changes shape with the switch off: the refill counter moves from a global static into the pool (`crates/victory-gpu/src/pool.rs:629-690`), gives route through `give_marked` (`:910`) and `structure_moved` (`:923`), and the new report line prints either way. - `VICTORY_HW_RT_PACK` needs `docs/SETTINGS.md` and `run.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.
Author
Owner

@⁠LOCKhart07 on GitHub · 2026-12-04 14:34 UTC · original

Split as asked: rt-6-pack on my fork, showing only its own change.

  • The refill counter's move into the pool is its own commit, before the feature.
  • VICTORY_HW_RT_PACK is documented in both files, including how its one measured play ended.
  • The test that failed with the switch set in the environment is fixed.

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-pack from my fork, play 30 minutes with VICTORY_HW_RT=1 VICTORY_HW_RT_PACK=1, and post the last hardware RT sparse blocks of long-lived structures emptied and hardware RT losses lines 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.

**@⁠LOCKhart07** on GitHub · 2026-12-04 14:34 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/328#issuecomment-7414542585) Split as asked: `rt-6-pack` on my fork, showing only its own change. - The refill counter's move into the pool is its own commit, before the feature. - `VICTORY_HW_RT_PACK` is documented in both files, including how its one measured play ended. - The test that failed with the switch set in the environment is fixed. 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-pack` from my fork, play 30 minutes with `VICTORY_HW_RT=1 VICTORY_HW_RT_PACK=1`, and post the last `hardware RT sparse blocks of long-lived structures emptied` and `hardware RT losses` lines 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.
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/descriptor/host.rs
  • crates/victory-gpu/src/host.rs
  • crates/victory-shader/src/lib.rs
  • crates/victory-shader/src/structure.rs
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.
git fetch -u origin '+refs/pull/328/head:github-bot/gh-328'
git switch 'github-bot/gh-328'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-328'
git switch 'github-bot/gh-328'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-328'
git switch 'github-bot/gh-328'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-328'
git switch 'main'
git merge --squash 'github-bot/gh-328'
git switch 'main'
git merge --ff-only 'github-bot/gh-328'
git switch 'main'
git merge 'github-bot/gh-328'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.