Hardware ray tracing: drop host structures of console structures the title wrote over (VICTORY_HW_RT_REUSE=1, off by default, on #342) #374

Open
github-bot wants to merge 14 commits from github-bot/gh-374 into main AGit
Owner

@⁠LOCKhart07 on GitHub · 2026-12-03 21:08 UTC · original
LOCKhart07:rt-reuse → main · +26462 −140 · 38 files · 14 commits · draft

Draft, on #342. The diff against main holds all of #342; what this adds on top is one commit plus the merge (git diff rt-all...rt-reuse: 7 files, about 4,900 lines, most of it counters).

The problem

The title frees no memory when it is done with a bottom-level structure. It writes the next one over its bytes. The layer dropped a host structure only when the title freed the memory under it, or when a later build's asked size covered it, so the host structure of a written-over one stayed for good, keyed by an address nothing names any more. This is the pile #342 notes under "Long sessions still fill the card": host structures grew to about 2.5 GB in ten minutes of driving.

The change (VICTORY_HW_RT_REUSE=1, off by default)

  • After the commands of each BLAS write (build, refit, rehydrate, copy), the list copies the 8-byte header the title's builder wrote at that address into a slot that is read back. That is the header as it stands at that place in the card's order, whatever is written there later. It gives the bytes the structure has on the console.
  • The ledger numbers the title's writes in the card's order (Placed::wrote).
  • At the next submission, before its lists' steps, a structure whose bytes share a byte with those of one written later goes from the ledger and from the tap's map (reuse_step, Reuse::landed, Ledger::drop_write). Its memory goes as with freed title memory, once nothing in flight holds it.
  • Never judged: a copy over its own source, and a structure whose header was not read or is no structure's header.

Reading the header from the CPU a moment later does not work: the title's builder writes it on the card, and short-lived memory already holds other bytes by then. Sizes read that way gave a few structures of 40 MB and more, and wrong verdicts.

What a wrong drop would look like

  • An instance naming a dropped structure gets mask 0 and a null address in the remap, and is counted on the losses line ("instances naming a BLAS with no host one"). The new report line says whether the first such address was one dropped here.
  • An update of a dropped structure is planned as a full build (the picture stays right) and is counted.
  • A copy of a dropped structure gets no host structure and is counted.

Measured

One session of 11 minutes of driving, hardware ray tracing on, 2560x1440, same machine as #342, with VICTORY_HW_RT_DEMOTE=1 and VICTORY_HW_RT_PACK=1:

  • Headers asked for 261,866, landed 261,737, none without a structure's header.
  • Structures dropped 35,118.
  • Host structure memory 483 MB early, 695 MB at the end. The session before it, without the switch, went from 1,088 MB to 2,548 MB over the same time (another drive, so not a controlled comparison).
  • Instances naming a BLAS with no host one: 0 of 72,287,095. Copies and updates asked of a dropped structure: 0 and 0. Every other count on the losses line: 0.
  • The step: 197 ms in all, longest 5.4 ms.

Also in the diff

  • VICTORY_HW_RT_NAMED=1 and VICTORY_HW_RT_NAMED_DUMP=1: counters only, the measuring that led here (which structures the top-level ones still name, and which are written over). Nothing reads them but the report.
  • VICTORY_SHARED_LEDGER=1: counters only, what of the memory shared with the card is the layer's own.

Checked

  • victory-gpu tests after the merge with #342's branch: hwrt:: 94 passed (4 new for this change), host:: 89 passed and 4 ignored, pool:: 18 passed. No warnings.
  • Merge conflicts: hwrt.rs keeps this branch's side, descriptor/host.rs keeps main's walk of the due slots.

Not done

  • The merged build has not been run in play. The session above ran on this change before the merge with #342's branch.
  • One session only. A second one somewhere else on the map would make "no structure in use is dropped" a stronger claim.
  • That session had one frame of 325 ms near its end, 256 ms of it on the submitting thread in the lists' steps. reuse_step is timed apart and was not it; frames like it are in sessions without the switch too. Which step it was is not known yet.
  • The card still fills. It is at about 14 of 15 GB two minutes in with or without this, and the shared memory still climbs through a session. This removes one cause, not the problem.
  • docs/SETTINGS.md has no row for the switch.

🤖 Generated with Claude Code

**@⁠LOCKhart07** on GitHub · 2026-12-03 21:08 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/374) `LOCKhart07:rt-reuse` → `main` · +26462 −140 · 38 files · 14 commits · draft Draft, on #342. The diff against `main` holds all of #342; what this adds on top is one commit plus the merge (`git diff rt-all...rt-reuse`: 7 files, about 4,900 lines, most of it counters). ## The problem The title frees no memory when it is done with a bottom-level structure. It writes the next one over its bytes. The layer dropped a host structure only when the title freed the memory under it, or when a later build's asked size covered it, so the host structure of a written-over one stayed for good, keyed by an address nothing names any more. This is the pile #342 notes under "Long sessions still fill the card": host structures grew to about 2.5 GB in ten minutes of driving. ## The change (`VICTORY_HW_RT_REUSE=1`, off by default) - After the commands of each BLAS write (build, refit, rehydrate, copy), the list copies the 8-byte header the title's builder wrote at that address into a slot that is read back. That is the header as it stands at that place in the card's order, whatever is written there later. It gives the bytes the structure has on the console. - The ledger numbers the title's writes in the card's order (`Placed::wrote`). - At the next submission, before its lists' steps, a structure whose bytes share a byte with those of one written later goes from the ledger and from the tap's map (`reuse_step`, `Reuse::landed`, `Ledger::drop_write`). Its memory goes as with freed title memory, once nothing in flight holds it. - Never judged: a copy over its own source, and a structure whose header was not read or is no structure's header. Reading the header from the CPU a moment later does not work: the title's builder writes it on the card, and short-lived memory already holds other bytes by then. Sizes read that way gave a few structures of 40 MB and more, and wrong verdicts. ## What a wrong drop would look like - An instance naming a dropped structure gets mask 0 and a null address in the remap, and is counted on the losses line ("instances naming a BLAS with no host one"). The new report line says whether the first such address was one dropped here. - An update of a dropped structure is planned as a full build (the picture stays right) and is counted. - A copy of a dropped structure gets no host structure and is counted. ## Measured One session of 11 minutes of driving, hardware ray tracing on, 2560x1440, same machine as #342, with `VICTORY_HW_RT_DEMOTE=1` and `VICTORY_HW_RT_PACK=1`: - Headers asked for 261,866, landed 261,737, none without a structure's header. - Structures dropped 35,118. - Host structure memory 483 MB early, 695 MB at the end. The session before it, without the switch, went from 1,088 MB to 2,548 MB over the same time (another drive, so not a controlled comparison). - Instances naming a BLAS with no host one: 0 of 72,287,095. Copies and updates asked of a dropped structure: 0 and 0. Every other count on the losses line: 0. - The step: 197 ms in all, longest 5.4 ms. ## Also in the diff - `VICTORY_HW_RT_NAMED=1` and `VICTORY_HW_RT_NAMED_DUMP=1`: counters only, the measuring that led here (which structures the top-level ones still name, and which are written over). Nothing reads them but the report. - `VICTORY_SHARED_LEDGER=1`: counters only, what of the memory shared with the card is the layer's own. ## Checked - `victory-gpu` tests after the merge with #342's branch: `hwrt::` 94 passed (4 new for this change), `host::` 89 passed and 4 ignored, `pool::` 18 passed. No warnings. - Merge conflicts: `hwrt.rs` keeps this branch's side, `descriptor/host.rs` keeps main's walk of the due slots. ## Not done - **The merged build has not been run in play.** The session above ran on this change before the merge with #342's branch. - One session only. A second one somewhere else on the map would make "no structure in use is dropped" a stronger claim. - That session had one frame of 325 ms near its end, 256 ms of it on the submitting thread in the lists' steps. `reuse_step` is timed apart and was not it; frames like it are in sessions without the switch too. Which step it was is not known yet. - The card still fills. It is at about 14 of 15 GB two minutes in with or without this, and the shared memory still climbs through a session. This removes one cause, not the problem. - `docs/SETTINGS.md` has no row for the switch. 🤖 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]>
With hardware ray tracing nothing of ours reads what the title's
structure builder writes: every traversal loop is a ray query on the
host's structures, and those are built from the title's inputs. The
title reads one result of it: the compacted size a build is asked for,
which is the node count of the tree that build made, read back a frame
or two later to size the copy. No other program can give that number.

With the switch (only with VICTORY_HW_RT=1) each request of a tapped
call is kept or skipped:

- A bottom-level build that carries postbuild descriptions is kept:
  the builder runs it as ever and the title reads its own size. A copy
  of a structure a kept build made is kept too.
- Every other build, update, top-level build, rehydrate and copy is
  skipped. The title's export is still called, so its checks and
  results stay its own, between two marks in the list: the builder's
  dispatches recorded between them are dropped when the list is
  translated, before anything is bound. A batch is given to the export
  as runs, in its order.
- A request that asks a size and cannot be kept (a top-level build, an
  update of a structure no kept build made) is skipped, counted and
  logged as an error. None was seen.

The builder's stages run all or none, so whole calls are kept or
skipped, and a kept stage reads only what a kept one wrote.

A report line counts requests kept, skipped by kind, copies, losses
and dispatches dropped; an error is logged if a dispatch reads title
memory by address while the switch is on (a program not lifted).

By the builder's own stamps, standing still: 2.05 ms of card time a
frame before, 0.1 ms with the switch (98 dispatches dropped a frame).
Driving: 1.4 ms mean. Losses 0 in both, every hardware ray-tracing
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]>
Brings the lifted ray queries and host structures (VICTORY_HW_RT=1), the
structure blocks, the send-memory and texture-block changes, and the two
structure-memory switches (VICTORY_HW_RT_DEMOTE=1, VICTORY_HW_RT_PACK=1)
up to main. All of these switches stay off by default.

Two files conflicted:

- crates/victory-gpu/src/descriptor/host.rs, TextureQueue::scan. Main
  now walks only the due front of `by_due` and reads the kinds of slots
  from counts kept as slots change; this side had added, to the old walk
  of every slot, the count of slots held back for want of room on the
  card (QUEUE_HELD). Kept main's walk and counts, and put the held-back
  count before it: it walks `held` alone, not every slot.

- crates/victory-shader/src/lib.rs, TRANSLATOR_VERSION. Main went from
  13 to 19, this side from 13 to 14 for two fixes that change
  translations with the switches off (the sign of zero in
  v_mad_legacy, partial stores through a counter view). Both sets of
  changes are in, so the version is 20: translations cached by either
  side are made again.

Nothing else needed a change: the other files merged as they were, and
the 64 ray-tracing programs still lift whole on main's translator (397
of 397 loops, all 64 validated).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Brings VICTORY_HW_RT_LEAN_BUILDER=1 (off by default; only with
VICTORY_HW_RT=1): the title's structure builder runs only where the
title reads its result.

Nothing conflicted. The change to the work a title list runs at a place
of its own (it is now given the draw state too) merged with the
hardware ray-tracing operations recorded the same way, and the report
line is called from the hardware ray-tracing report as before.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The title frees no memory when it is done with a bottom-level structure: it writes the next one over its bytes. The host structure of the first stayed for good. With VICTORY_HW_RT_REUSE=1 (off by default) each BLAS write is followed in its list by a copy back of the 8-byte header the title's builder wrote, so the bytes the structure has on the console are known as of that place in the card's order. At the next submission a structure whose bytes share a byte with those of one written later goes from the ledger and the tap's map. A copy over its own source and a structure with no header read are never judged.

Measured in one 11 minute session: structure memory 483 to 695 MB where it grew to 2548 MB before; 35118 structures dropped; instances naming a BLAS with no host one 0 of 72 million, copies and updates asked of a dropped one 0; the step 197 ms in all, longest 5.4 ms.

This commit also carries the rest of the uncommitted memory work of this branch that the same files hold: the opt-in switches VICTORY_HW_RT_DEMOTE, VICTORY_HW_RT_PACK, VICTORY_HW_RT_NAMED (counters only, with VICTORY_HW_RT_NAMED_DUMP), VICTORY_SHARED_LEDGER (counters only) and VICTORY_POOL_MOVE, the structure arena, and their tests.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Conflicts: hwrt.rs keeps this branch's side (the stack's side lacks only the counters of VICTORY_HW_RT_NAMED and the new switch); descriptor/host.rs keeps main's walk of the due slots.

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

@⁠DrArroway on GitHub · 2026-12-03 22:28 UTC · original

40-minute real-play validation of the merged build on RDNA 2, directly comparing against our 47-minute #342 run without VICTORY_HW_RT_REUSE on the same machine and settings.

Setup & build

  • GPU / System: AMD Radeon RX 6900 XT (1002:73bf) (RDNA 2, 16 GB VRAM), Ryzen 9 7900X (12C/24T), 62 GiB RAM, CachyOS kernel 7.3.7-1-cachyos, GE-Proton11-15-x86_64, repo-patched Mesa (deps/mesa-inst) + vkd3d-proton.
  • Build: main (95858c5) + #342 + #374 merged cleanly with 0 conflicts (56.5 s incremental release build, 0 warnings; existing #342 shader/pipeline caches stayed valid).
  • Settings: VICTORY_OUTPUT=2560x1440, VICTORY_FSR_4K=quality, VICTORY_FIDELITYFX_FRAMEGEN=1, VICTORY_FIDELITYFX_FRAMEGEN_DIRECT=1, VICTORY_UI_PLANE=3840x2160, VICTORY_HW_RT=1, VICTORY_HW_RT_DEMOTE=1, VICTORY_HW_RT_PACK=1, VICTORY_HW_RT_REUSE=1, VICTORY_SHARED_LEDGER=1, VICTORY_PLACED_COPIED=1, VICTORY_PARTS_ONE_CALL=1, VICTORY_KEEP_HOST_BUFFERS=1, VICTORY_SKIP_BINK=1 (VICTORY_HW_RT_LEAN_BUILDER left off so the title's builder writes every console BVH header).

Before vs After (#342 alone vs #342 + #374)

Metric #342 alone (47 min) #342 + #374 (VICTORY_HW_RT_REUSE=1) (40 min)
Host RT structure memory Climbed 0 -> 10,490 MB (20,999 compacted BLASes) Flat 510–928 MB (853 MB end, 1,410 MB peak; 10,089 compacted = 679 MB)
Card VRAM (vram) Spilled past 16 GB at 14m (22,046 MB peak) Never overflowed: steady 13,472–14,140 MB (15,028 MB peak / 15.5–15.8 GB budget)
GPU / kernel errors 0x887A0005 + SQC (data) page fault at 47m 0 GPU errors, 0 kernel faults (ended at 40m on unrelated #57/#142 +0x2626877 hang)
tools/session-fps.sh 22.6 med / 22.5 avg (24.9 early -> 21.3 late) 24.2 med / 24.3 avg (415 samples; no late-session drop — 2nd half hit 27.1 med real FPS)

VICTORY_HW_RT_REUSE=1 parity & overhead (40 minutes)

  • Headers: 2,206,882 asked for (0 missing title copy, 0 no slot), 2,206,304 landed (2,031,469 of a write no longer at its address, 0 no structure's header), 174,835 extents known (10,213 noted at end, 0 waiting).
  • Dropped: 53,226 overwritten structures (31,628 MB of host structures) (0 as their own header landed, 7,296 older ones no longer standing, 24 writes over their own source not judged).
  • Wrong-drop checks (all 0):
    • Copies asked of a dropped source: 0
    • Updates asked of a dropped structure: 0
    • Instances naming a BLAS with no host one: 0 of 340,000,997
    • Every other counter on the hardware RT losses line: 0
  • Overhead: reuse_step took 1,016 ms total across 40 minutes (longest single step 2,517 us).
  • Visuals: Clean throughout — no missing RT reflections/shadows or artifacts.

VRAM / shared memory timeline & VICTORY_SHARED_LEDGER=1

  • Host RT structure memory over time: 0 MB (0m) → 510 MB (5m) → 922 MB (10m) → 838 MB (15m) → 588 MB (20m) → 594 MB (25m) → 928 MB (30m) → 788 MB (35m) → 853 MB (40m).
  • Shared memory still climbed gradually (12,476 MB at 5m → 15,134 MB at 25m → 16,506 MB at 40m, peak 17,151 MB), matching the note under "Not done".
  • Last VICTORY_SHARED_LEDGER sample (at 25m):
    • shared in use 14,933 MB = 8,775 MB title memory in RAM + 1,670 MB our mapped buffers (51,091 buffers: 1,216 MB texture staging, 189 MB shared buffers, 103 MB list scratch, 94 MB host RT on processor heap, 30 MB other uploads, 24 MB remap tables, 12 MB read-backs) + 4,486 MB unnamed (vkd3d/driver, 3,081 host list command allocators alive, 471 lists not reset for >60 s, oldest 1,482 s).
**@⁠DrArroway** on GitHub · 2026-12-03 22:28 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/374#issuecomment-7394259199) 40-minute real-play validation of the merged build on RDNA 2, directly comparing against our [47-minute `#342` run without `VICTORY_HW_RT_REUSE`](https://git.gtahub.st/github/lobomfz--VIctory-xmem/pulls/342) on the same machine and settings. ### Setup & build - **GPU / System:** `AMD Radeon RX 6900 XT (1002:73bf)` (RDNA 2, 16 GB VRAM), Ryzen 9 7900X (12C/24T), 62 GiB RAM, CachyOS kernel `7.3.7-1-cachyos`, `GE-Proton11-15-x86_64`, repo-patched Mesa (`deps/mesa-inst`) + vkd3d-proton. - **Build:** `main` (`95858c5`) + `#342` + `#374` merged cleanly with 0 conflicts (`56.5 s` incremental release build, 0 warnings; existing `#342` shader/pipeline caches stayed valid). - **Settings:** `VICTORY_OUTPUT=2560x1440`, `VICTORY_FSR_4K=quality`, `VICTORY_FIDELITYFX_FRAMEGEN=1`, `VICTORY_FIDELITYFX_FRAMEGEN_DIRECT=1`, `VICTORY_UI_PLANE=3840x2160`, `VICTORY_HW_RT=1`, `VICTORY_HW_RT_DEMOTE=1`, `VICTORY_HW_RT_PACK=1`, `VICTORY_HW_RT_REUSE=1`, `VICTORY_SHARED_LEDGER=1`, `VICTORY_PLACED_COPIED=1`, `VICTORY_PARTS_ONE_CALL=1`, `VICTORY_KEEP_HOST_BUFFERS=1`, `VICTORY_SKIP_BINK=1` (`VICTORY_HW_RT_LEAN_BUILDER` left off so the title's builder writes every console BVH header). ### Before vs After (`#342` alone vs `#342` + `#374`) | Metric | `#342` alone (47 min) | `#342` + **`#374` (`VICTORY_HW_RT_REUSE=1`)** (40 min) | |---|---|---| | **Host RT structure memory** | Climbed `0 -> 10,490 MB` (`20,999` compacted BLASes) | **Flat `510–928 MB`** (`853 MB` end, `1,410 MB` peak; `10,089` compacted = `679 MB`) | | **Card VRAM (`vram`)** | Spilled past 16 GB at 14m (`22,046 MB` peak) | **Never overflowed:** steady `13,472–14,140 MB` (`15,028 MB` peak / `15.5–15.8 GB` budget) | | **GPU / kernel errors** | `0x887A0005` + `SQC (data)` page fault at 47m | **`0` GPU errors, `0` kernel faults** *(ended at 40m on unrelated `#57`/`#142` `+0x2626877` hang)* | | **`tools/session-fps.sh`** | `22.6` med / `22.5` avg (`24.9` early -> `21.3` late) | **`24.2` med / `24.3` avg** (`415` samples; no late-session drop — 2nd half hit `27.1` med real FPS) | ### `VICTORY_HW_RT_REUSE=1` parity & overhead (40 minutes) - **Headers:** `2,206,882` asked for (`0` missing title copy, `0` no slot), `2,206,304` landed (`2,031,469` of a write no longer at its address, **`0` no structure's header**), `174,835` extents known (`10,213` noted at end, `0` waiting). - **Dropped:** **`53,226` overwritten structures (`31,628 MB` of host structures)** (`0` as their own header landed, `7,296` older ones no longer standing, `24` writes over their own source not judged). - **Wrong-drop checks (all `0`):** - Copies asked of a dropped source: **`0`** - Updates asked of a dropped structure: **`0`** - Instances naming a BLAS with no host one: **`0` of `340,000,997`** - Every other counter on the `hardware RT losses` line: **`0`** - **Overhead:** `reuse_step` took **`1,016 ms` total across 40 minutes** (longest single step **`2,517 us`**). - **Visuals:** Clean throughout — no missing RT reflections/shadows or artifacts. ### VRAM / shared memory timeline & `VICTORY_SHARED_LEDGER=1` - Host RT structure memory over time: `0 MB` (`0m`) → `510 MB` (`5m`) → `922 MB` (`10m`) → `838 MB` (`15m`) → `588 MB` (`20m`) → `594 MB` (`25m`) → `928 MB` (`30m`) → `788 MB` (`35m`) → `853 MB` (`40m`). - Shared memory still climbed gradually (`12,476 MB` at `5m` → `15,134 MB` at `25m` → `16,506 MB` at `40m`, peak `17,151 MB`), matching the note under "Not done". - Last `VICTORY_SHARED_LEDGER` sample (at `25m`): - `shared in use 14,933 MB` = `8,775 MB` title memory in RAM + `1,670 MB` our mapped buffers (`51,091` buffers: `1,216 MB` texture staging, `189 MB` shared buffers, `103 MB` list scratch, `94 MB` host RT on processor heap, `30 MB` other uploads, `24 MB` remap tables, `12 MB` read-backs) + **`4,486 MB` unnamed** (vkd3d/driver, `3,081` host list command allocators alive, `471` lists not reset for >60 s, oldest `1,482 s`).
Author
Owner

@⁠khift363 on GitHub · 2026-12-04 06:54 UTC · original

I have been running this on my personal build for a bit, tracking your various changes, and the difference in both speed and quality is incredible. However, this version has a memory leak - but of a different version. Specifically, the shared GPU memory continues to grow as the play session goes on, until it eventually obliterates the frame rate. Disabling native RT via this branch eliminates the leak. The total VRAM in use remains extremely stable over time - but the proportion of VRAM allocated to shared GPU memory grows without bound.

I also believe the leak is related to speed - it seems to build up much faster when driving around in town versus driving in the countryside, on a boat, or doing more stationary activities.

Either way, I just want to reiterate - this is a huge win on both quality and speed, just gotta nail down that memory leak.

**@⁠khift363** on GitHub · 2026-12-04 06:54 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/374#issuecomment-7404031589) I have been running this on my personal build for a bit, tracking your various changes, and the difference in both speed and quality is incredible. However, this version has a memory leak - but of a different version. Specifically, the shared GPU memory continues to grow as the play session goes on, until it eventually obliterates the frame rate. Disabling native RT via this branch eliminates the leak. The total VRAM in use remains extremely stable over time - but the proportion of VRAM allocated to shared GPU memory grows without bound. I also believe the leak is related to speed - it seems to build up much faster when driving around in town versus driving in the countryside, on a boat, or doing more stationary activities. Either way, I just want to reiterate - this is a huge win on both quality and speed, just gotta nail down that memory leak.
Author
Owner

@⁠LOCKhart07 on GitHub · 2026-12-04 11:46 UTC · original

I have been running this on my personal build for a bit, tracking your various changes, and the difference in both speed and quality is incredible. However, this version has a memory leak - but of a different version. Specifically, the shared GPU memory continues to grow as the play session goes on, until it eventually obliterates the frame rate. Disabling native RT via this branch eliminates the leak. The total VRAM in use remains extremely stable over time - but the proportion of VRAM allocated to shared GPU memory grows without bound.

I also believe the leak is related to speed - it seems to build up much faster when driving around in town versus driving in the countryside, on a boat, or doing more stationary activities.

Either way, I just want to reiterate - this is a huge win on both quality and speed, just gotta nail down that memory leak.

From what I found yesterday, it's seemingly to do with the game never marking memory for free up. The console just overwrites that memory whenever it needs, which victory does not seem to be track. Good place to start if someone wants to point their clanker at it

**@⁠LOCKhart07** on GitHub · 2026-12-04 11:46 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/374#issuecomment-7410535370) > I have been running this on my personal build for a bit, tracking your various changes, and the difference in both speed and quality is incredible. However, this version has a memory leak - but of a different version. Specifically, the shared GPU memory continues to grow as the play session goes on, until it eventually obliterates the frame rate. Disabling native RT via this branch eliminates the leak. The total VRAM in use remains extremely stable over time - but the proportion of VRAM allocated to shared GPU memory grows without bound. > > I also believe the leak is related to speed - it seems to build up much faster when driving around in town versus driving in the countryside, on a boat, or doing more stationary activities. > > Either way, I just want to reiterate - this is a huge win on both quality and speed, just gotta nail down that memory leak. From what I found yesterday, it's seemingly to do with the game never marking memory for free up. The console just overwrites that memory whenever it needs, which victory does not seem to be track. Good place to start if someone wants to point their clanker at it
Author
Owner

@⁠Luxuride on GitHub · 2026-12-04 12:20 UTC · original

The mechanism is well argued and the counters are exactly what a maintainer would ask for — but as a 26,462-line draft that also contains the whole hardware-RT stack, it cannot be reviewed. Please split it.

Three things that matter more than the size:

  1. Eleven switches, zero documentation. The diff adds VICTORY_HW_RT, _ARENA, _DEMOTE, _LEAN_BUILDER, _LIFT, _NAMED, _NAMED_DUMP, _PACK, _REFIT, _REUSE, _WHY, and git diff <base> pr/374 -- docs README.md is empty, while docs/SETTINGS.md documents 81 other switches. That is the cheapest fix in the stack and it is the one thing a user cannot work around.
  2. packed_extent decides what gets dropped, from a number nobody cross-checks. crates/victory-gpu/src/hwrt.rs:2473 accepts any header whose low 16 bits are 6 and whose node count fits EXTENT_MOST — (version == 6 && nodes > 0 && len <= EXTENT_MOST).then_some(len) — and every live structure sharing a byte with that extent is dropped. Your own note says CPU-side size reads produced "a few structures of 40 MB and more, and wrong verdicts", and the sanity helper that exists (copy_size_trusted, hwrt.rs:2485) is #[cfg(test)] only. Make the extent bound part of the production guard.
  3. Evidence. You state the merged build has not been run in play, that the card still reaches ~14 of 15 GB in two minutes with or without the switch, and that the evidence is one 11-minute session on the pre-merge commit. A 26k-line change where the feature's own numbers are neutral needs a second session on the exact tree before it is mergeable.

Minor: Reuse::landed treats "same address, header landed after a later write" as a silent no-op — correct — but it also drops the older entries it collected on the way without telling anyone, so the ledger keeps structures the model has forgotten. A counter there is nearly free.

Land the stack's clean head first, then reopen the reuse commit alone. It is ~4,900 lines where most is counters and tests, and it deserves to be read.

**@⁠Luxuride** on GitHub · 2026-12-04 12:20 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/374#issuecomment-7411295823) The mechanism is well argued and the counters are exactly what a maintainer would ask for — but as a 26,462-line draft that also contains the whole hardware-RT stack, it cannot be reviewed. Please split it. Three things that matter more than the size: 1. **Eleven switches, zero documentation.** The diff adds `VICTORY_HW_RT`, `_ARENA`, `_DEMOTE`, `_LEAN_BUILDER`, `_LIFT`, `_NAMED`, `_NAMED_DUMP`, `_PACK`, `_REFIT`, `_REUSE`, `_WHY`, and `git diff <base> pr/374 -- docs README.md` is empty, while `docs/SETTINGS.md` documents 81 other switches. That is the cheapest fix in the stack and it is the one thing a user cannot work around. 2. **`packed_extent` decides what gets dropped, from a number nobody cross-checks.** `crates/victory-gpu/src/hwrt.rs:2473` accepts any header whose low 16 bits are 6 and whose node count fits `EXTENT_MOST` — `(version == 6 && nodes > 0 && len <= EXTENT_MOST).then_some(len)` — and every live structure sharing a byte with that extent is dropped. Your own note says CPU-side size reads produced "a few structures of 40 MB and more, and wrong verdicts", and the sanity helper that exists (`copy_size_trusted`, `hwrt.rs:2485`) is `#[cfg(test)]` only. Make the extent bound part of the production guard. 3. **Evidence.** You state the merged build has not been run in play, that the card still reaches ~14 of 15 GB in two minutes with or without the switch, and that the evidence is one 11-minute session on the pre-merge commit. A 26k-line change where the feature's own numbers are neutral needs a second session on the exact tree before it is mergeable. Minor: `Reuse::landed` treats "same address, header landed after a later write" as a silent no-op — correct — but it also drops the `older` entries it collected on the way without telling anyone, so the ledger keeps structures the model has forgotten. A counter there is nearly free. Land the stack's clean head first, then reopen the reuse commit alone. It is ~4,900 lines where most is counters and tests, and it deserves to be read.
Author
Owner

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

Split as asked: the reuse commit alone is rt-7-reuse on my fork (3,500 lines with its tests and the two counting-only switches), on top of the six branches under it (bottom at #468).

On your points:

  1. All switches are documented in both files, each in the branch that adds it.
  2. The extent bound is in the production guard. A header's extent is now judged only if it is no more than the most that write can have: for a build, what the title's builder answered for that shape; for a copy, the bytes noted for its source. One past it drops nothing, and the report line counts how many extents had a bound and how many were refused. Honest limits: a rehydrate, a build whose size the title never asked and a copy whose source has no header noted still have only the 1 GB bound, and I have not run it, so whether the builder's answer is ever less than its own header's extent is not measured.
  3. Evidence: still one 11-minute session of mine on the pre-split tree, plus the 40-minute run reported above. A second session on the exact tree is still owed, and I am not going to get to it myself soon. If anyone here can do it: build rt-7-reuse from my fork, play with VICTORY_HW_RT=1 VICTORY_HW_RT_REUSE=1, and post the last hardware RT title bytes written again and hardware RT losses lines. The first now also says how many extents were held against a bound and how many were refused, which is the number the new guard needs.

On the minor point: Reuse::landed does not drop older entries untold. Nothing noted shares a byte with a later write's bytes, so a late header finds none before its own address, and in every other case the older ones are returned and dropped from the ledger (or counted as no longer standing). I added the counter anyway (headers landed after a later write's) and a test that says so.

Two things that rode in this commit and need no ray tracing are out of it: the card-address ranges said when the device is lost (rt-8-ranges, now behind VICTORY_REMOVAL_RANGES, off by default) and the shared memory ledger (rt-9-ledger, VICTORY_SHARED_LEDGER, off by default), each its own branch with its switch documented.

This one can be closed.

**@⁠LOCKhart07** on GitHub · 2026-12-04 14:34 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/374#issuecomment-7414544092) Split as asked: the reuse commit alone is `rt-7-reuse` on my fork (3,500 lines with its tests and the two counting-only switches), on top of the six branches under it (bottom at #468). On your points: 1. All switches are documented in both files, each in the branch that adds it. 2. The extent bound is in the production guard. A header's extent is now judged only if it is no more than the most that write can have: for a build, what the title's builder answered for that shape; for a copy, the bytes noted for its source. One past it drops nothing, and the report line counts how many extents had a bound and how many were refused. Honest limits: a rehydrate, a build whose size the title never asked and a copy whose source has no header noted still have only the 1 GB bound, and I have not run it, so whether the builder's answer is ever less than its own header's extent is not measured. 3. Evidence: still one 11-minute session of mine on the pre-split tree, plus the 40-minute run reported above. A second session on the exact tree is still owed, and I am not going to get to it myself soon. If anyone here can do it: build `rt-7-reuse` from my fork, play with `VICTORY_HW_RT=1 VICTORY_HW_RT_REUSE=1`, and post the last `hardware RT title bytes written again` and `hardware RT losses` lines. The first now also says how many extents were held against a bound and how many were refused, which is the number the new guard needs. On the minor point: `Reuse::landed` does not drop older entries untold. Nothing noted shares a byte with a later write's bytes, so a late header finds none before its own address, and in every other case the older ones are returned and dropped from the ledger (or counted as no longer standing). I added the counter anyway (headers landed after a later write's) and a test that says so. Two things that rode in this commit and need no ray tracing are out of it: the card-address ranges said when the device is lost (`rt-8-ranges`, now behind `VICTORY_REMOVAL_RANGES`, off by default) and the shared memory ledger (`rt-9-ledger`, `VICTORY_SHARED_LEDGER`, off by default), each its own branch with its switch documented. This one can be closed.
Author
Owner

@⁠DrArroway on GitHub · 2026-12-04 17:41 UTC · original

@⁠LOCKhart07 Here is a 63m 44s real-play test on your exact LOCKhart07/VIctory-xmem rt-7-reuse (621120b) branch — clean voluntary exit, 0 errors.

Setup

  • GPU / System: AMD Radeon RX 6900 XT (1002:73bf) (RDNA 2, 16 GB VRAM), Ryzen 9 7900X (12C/24T), 62 GiB RAM, CachyOS kernel 7.3.7-1-cachyos, GE-Proton11-15-x86_64, repo-patched Mesa (deps/mesa-inst) + vkd3d-proton.
  • Branch / build: LOCKhart07/VIctory-xmem rt-7-reuse @ 621120b747ee8f38096460686184a9b060baea63; release build in 60 s (0 warnings); ./run.sh shaders VICTORY_HW_RT=1 (25,694 cached in 95 s); ./run.sh warm VICTORY_HW_RT=1 (94,440 / 94,440 pipelines in 69 s, 0 bad, 0 refused).
  • Settings: VICTORY_OUTPUT=2560x1440, VICTORY_FSR_4K=quality, VICTORY_FIDELITYFX_FRAMEGEN=1, VICTORY_FIDELITYFX_FRAMEGEN_DIRECT=1, VICTORY_UI_PLANE=3840x2160, VICTORY_HW_RT=1, VICTORY_HW_RT_DEMOTE=1, VICTORY_HW_RT_PACK=1, VICTORY_HW_RT_REUSE=1, VICTORY_PLACED_COPIED=1, VICTORY_PARTS_ONE_CALL=1, VICTORY_KEEP_HOST_BUFFERS=1, VICTORY_SKIP_BINK=1.

Verbatim final lines (at 63m 44s)

2026-12-04T17:34:17.074713Z  INFO victory_gpu::hwrt: hardware RT title bytes written again (VICTORY_HW_RT_REUSE; since the start): headers asked for after a write 5798811 (no copy of title memory there 0, no slot 0), landed 5798410 (of a write no longer at its address 5634523, no structure's header 0), extents known 163887 (noted now 7013, waiting for a card point 0), of them held against the most their write can have 32021 and past it, not judged, 2040; landed after a later write's at their address 0. Structures the title wrote another over, dropped: 49612 (18243 MB of host structures), of them as their own header landed 0; older ones no longer standing 10787; writes over their own source (not judged) 10. CHECK (must be 0): copies asked of a source dropped here 0, updates asked of one dropped here (built in full) 0; the first instance named with no host BLAS (the losses line) is one dropped here: none named. The step: 1724 ms in all, longest 2350 us
2026-12-04T17:34:17.074726Z  INFO victory_gpu::hwrt: hardware RT losses (each a bug to fix; 0 is parity): geometries not given 0, instances naming a BLAS with no host one 0 (first 0x0; found 615452503; since the start), CPU rehydrates with no host BLAS 0, copies not followed 0, BLASes left out of the remap table 0, lifted dispatches given the empty TLAS for lack of a host one 0 (address 0: 0; first 0x0, last 0x0), copies of a source with no host structure 0; in the card's order: structure writes after a newer structure's at the same address 0, refits or copies whose source is not the one assumed 0, lifted dispatches given another TLAS than the one built last there 0; builds or copies not done (no memory, or larger than their host structure's buffer) 0, remap tables written again while an earlier run of their list may read them 0; compactions left clones for a size of 0 or past the clone 0, for no memory 0, for no size slot 0; triangles naming a vertex past the count given, made 0,0,0 on the card 0, vertices given that could not be widened to the indices naming them 0

Summary

  • New extent-bound guard: out of 163,887 known extents, 32,021 were checked against the write's upper bound and 2,040 (6.4%) exceeded it and were safely refused (not judged); landed after a later write's at their address: 0.
  • Parity & overhead: 49,612 overwritten BLASes (18,243 MB) dropped; 0 copies/updates of dropped structures; 0 of 615,452,503 instances missing a host BLAS; 0 across all loss counters; reuse_step totaled 1,724 ms across 64 minutes (2,350 us longest).
  • Memory & performance (full 64 minutes):
    • Host RT structure memory stayed flat at 513–797 MB (740 MB at end, 1,113 MB peak; 6,938 compacted BLASes = 576 MB).
    • Card VRAM stayed inside 16 GB the entire hour (13,888–14,688 MB, 14,204 / 15,489 MB at end, 15,204 MB peak).
    • Shared memory peaked at 16,057 MB mid-session and settled back down to 14,449 MB at exit.
    • tools/session-fps.sh (583 samples): 27.6 median / 26.6 avg real FPS (6.8 ms avg preparing, 1.3 ms avg copy; 2nd half reached 30.4 median real FPS across all gameplay samples).
**@⁠DrArroway** on GitHub · 2026-12-04 17:41 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/374#issuecomment-7419302701) @⁠LOCKhart07 Here is a **63m 44s** real-play test on your exact **`LOCKhart07/VIctory-xmem` `rt-7-reuse` (`621120b`)** branch — clean voluntary exit, **`0` errors**. ### Setup - **GPU / System:** `AMD Radeon RX 6900 XT (1002:73bf)` (RDNA 2, 16 GB VRAM), Ryzen 9 7900X (12C/24T), 62 GiB RAM, CachyOS kernel `7.3.7-1-cachyos`, `GE-Proton11-15-x86_64`, repo-patched Mesa (`deps/mesa-inst`) + vkd3d-proton. - **Branch / build:** `LOCKhart07/VIctory-xmem` `rt-7-reuse @ 621120b747ee8f38096460686184a9b060baea63`; release build in `60 s` (0 warnings); `./run.sh shaders VICTORY_HW_RT=1` (`25,694` cached in `95 s`); `./run.sh warm VICTORY_HW_RT=1` (`94,440 / 94,440` pipelines in `69 s`, `0` bad, `0` refused). - **Settings:** `VICTORY_OUTPUT=2560x1440`, `VICTORY_FSR_4K=quality`, `VICTORY_FIDELITYFX_FRAMEGEN=1`, `VICTORY_FIDELITYFX_FRAMEGEN_DIRECT=1`, `VICTORY_UI_PLANE=3840x2160`, `VICTORY_HW_RT=1`, `VICTORY_HW_RT_DEMOTE=1`, `VICTORY_HW_RT_PACK=1`, `VICTORY_HW_RT_REUSE=1`, `VICTORY_PLACED_COPIED=1`, `VICTORY_PARTS_ONE_CALL=1`, `VICTORY_KEEP_HOST_BUFFERS=1`, `VICTORY_SKIP_BINK=1`. ### Verbatim final lines (at `63m 44s`) ```text 2026-12-04T17:34:17.074713Z INFO victory_gpu::hwrt: hardware RT title bytes written again (VICTORY_HW_RT_REUSE; since the start): headers asked for after a write 5798811 (no copy of title memory there 0, no slot 0), landed 5798410 (of a write no longer at its address 5634523, no structure's header 0), extents known 163887 (noted now 7013, waiting for a card point 0), of them held against the most their write can have 32021 and past it, not judged, 2040; landed after a later write's at their address 0. Structures the title wrote another over, dropped: 49612 (18243 MB of host structures), of them as their own header landed 0; older ones no longer standing 10787; writes over their own source (not judged) 10. CHECK (must be 0): copies asked of a source dropped here 0, updates asked of one dropped here (built in full) 0; the first instance named with no host BLAS (the losses line) is one dropped here: none named. The step: 1724 ms in all, longest 2350 us ``` ```text 2026-12-04T17:34:17.074726Z INFO victory_gpu::hwrt: hardware RT losses (each a bug to fix; 0 is parity): geometries not given 0, instances naming a BLAS with no host one 0 (first 0x0; found 615452503; since the start), CPU rehydrates with no host BLAS 0, copies not followed 0, BLASes left out of the remap table 0, lifted dispatches given the empty TLAS for lack of a host one 0 (address 0: 0; first 0x0, last 0x0), copies of a source with no host structure 0; in the card's order: structure writes after a newer structure's at the same address 0, refits or copies whose source is not the one assumed 0, lifted dispatches given another TLAS than the one built last there 0; builds or copies not done (no memory, or larger than their host structure's buffer) 0, remap tables written again while an earlier run of their list may read them 0; compactions left clones for a size of 0 or past the clone 0, for no memory 0, for no size slot 0; triangles naming a vertex past the count given, made 0,0,0 on the card 0, vertices given that could not be widened to the indices naming them 0 ``` ### Summary - **New extent-bound guard:** out of `163,887` known extents, **`32,021`** were checked against the write's upper bound and **`2,040` (`6.4%`) exceeded it and were safely refused (`not judged`)**; `landed after a later write's at their address: 0`. - **Parity & overhead:** **`49,612` overwritten BLASes (`18,243 MB`) dropped**; **`0`** copies/updates of dropped structures; **`0` of `615,452,503`** instances missing a host BLAS; **`0`** across all loss counters; `reuse_step` totaled **`1,724 ms`** across 64 minutes (**`2,350 us`** longest). - **Memory & performance (full 64 minutes):** - Host RT structure memory stayed flat at `513–797 MB` (`740 MB` at end, `1,113 MB` peak; `6,938` compacted BLASes = `576 MB`). - Card VRAM stayed inside 16 GB the entire hour (`13,888–14,688 MB`, `14,204 / 15,489 MB` at end, `15,204 MB` peak). - Shared memory peaked at `16,057 MB` mid-session and settled back down to `14,449 MB` at exit. - `tools/session-fps.sh` (`583` samples): **`27.6` median / `26.6` avg real FPS** (`6.8 ms` avg preparing, `1.3 ms` avg copy; 2nd half reached `30.4` median real FPS across all gameplay samples).
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/host.rs
  • crates/victory-gpu/src/um/residency.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/374/head:github-bot/gh-374'
git switch 'github-bot/gh-374'

Merge

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