Hardware ray tracing: lift the structure walks to ray queries, host structures by a builder tap (VICTORY_HW_RT=1, off by default) #262

Open
github-bot wants to merge 4 commits from github-bot/gh-262 into main AGit
Owner

@⁠LOCKhart07 on GitHub · 2026-12-02 22:11 UTC · original
LOCKhart07:hw-rt-queries → main · +17618 −96 · 29 files · 4 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. (this one)
  • #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.

All five together, current with main: #342.

#274 and #306 are both on #262 and not on each other. #323 has #306's commits in it until that merges.


What

Hardware ray tracing behind VICTORY_HW_RT=1 (off by default). With the switch off no host structure is made, and translations are what they were apart from two small translator fixes (point 6 below).

With it on:

  • Translator (first commit): each loop in which a ray-tracing program walks the console's structures is recognised and written as a DXIL RayQuery, keeping the title's own hit tests, masks and ordering as the candidate and commit steps. A loop that cannot be proven equivalent stays as translated before.

  • Host (second commit): the title's structure builder keeps running; its build, refit and copy calls are tapped, and the same triangles and instances go into host bottom- and top-level structures that the lifted programs trace.

  • Host memory (third commit): keeps those structures small in free play (point 7 below).

Developed and measured on an RX 9070 XT with RADV and vkd3d-proton, on the unified-memory path.

Where it comes from

This is a port, not new invention, and the credit belongs upstream of us:

  • The lift and the host structures are from VIctory-NVIDIA PR #3706 (dyshay), GPL-3.0.
  • The lifter's exactness rules are from dakisback2/VIctory-Nvidia-Linux (85b0b11b, 5485daf7), by way of Leslie-d-a/VIctory-NVIDIA-HWRT.
  • The host side started from MJ26gaming/victory-rdna4-linux-rt-MJ26 365fad515, which is #3706's host half on RADV.

The file headers say the same. What follows is what is different here.

What is different from those

1. No forced misses: 64 of 64 programs, 397 of 397 loops lifted.
The earlier ports leave 6 programs partly lifted (14 loops) and give those rays a miss, which their notes put at about 1 % darker. All 14 are one shape: the console compiler reuses three registers as loop scratch on the "then" lanes and reads their original values on the "else" lanes, and the lifter could not relate the two lane sets because they pass through mask joins. The lifter now proves it exactly: joins whose inputs are all one mask collapse to that mask, and the read's lanes are then refuted against the loop's entry lanes by an exact search (Bools::sat_with; out of budget means refuse, never guess). With that, all 397 loops lift and all 64 programs pass the DXIL validator.

2. The title's builder is tapped, not replaced.
The console structures stay real, so sizes, compaction and validation the title asks about are its own answers, and anything that still walked them would walk real data. The cost is that the builder's dispatches still run (see the numbers).

3. Inputs follow the console builder, not a safer rule.
Read from the builder's own triangle loader: it has no bounds at all, and skips a triangle only when a vertex's X is NaN. So here:

  • only a NaN in X makes a triangle inactive; infinite and far positions pass through (the earlier rule turned positions farther than 1e10 into NaN: 124,094 vertex copies in one 5 minute run were geometry the console keeps);
  • indices and meshlets past the stated counts read the title's real bytes past the end, as the console does;
  • a quantised vertex header that is not finite is decoded anyway;
  • bytes that cannot be read are a counted loss, never a silent (0,0,0).

Every one of these is counted by what it really changed (on the card and on the processor), and printed.

4. No eviction, no masked instances.
No budget drops a bottom-level structure and hides its instances. Memory is kept down by compaction and by not keeping structures updatable that are not updated (point 7), never by dropping one the title still holds.

5. Builds in the card's order.
Host builds, refits and copies are recorded inside the title's own lists at the point of the title's call, and a ledger keeps what each top-level structure refers to in the order the card will run it. This removed an ordering race between a top-level build and the bottom-level builds it refers to when lists are submitted in a different order than they were recorded.

6. Two translator fixes found on the way (both on the path with the switch off too, so the translator version goes up): the sign of zero in v_mad_legacy, and partial stores through a counter view.

7. Host structures stay small in free play (third commit).
In a first free-play session (driving through the city) the host structures passed 7 GB in a few minutes and kept growing, the card filled and the frame rate collapsed, with every loss counter still 0. Measured by what each buffer holds, it was not a leak but size: 86 % of the bytes were structures built with ALLOW_UPDATE and uncompacted copies of them. Read from the driver's source: on RADV (BVH8) an updatable structure takes about 177 bytes a triangle against about 46 for a compacted one, and compacting an updatable one can trim only 15 to 20 %, because the refit needs a fixed leaf region. The title allows updates of many structures it never updates, or updates once. So:

  • a structure is 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), so nothing about the hits changes, only the host's bytes and build time;
  • every structure built without ALLOW_UPDATE is compacted by the host once built, through the same tickets the title's own compact copies use: the streamed-in ("rehydrated") structures, which are ready-made on the console and never copied by the title, and the title's builds it does not copy;
  • structures the title builds over are dropped: the builder's 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.

Over a 3 minute drive each (free play, so routes differ; read as sizes):

before after
host structure memory at the end 7.3 GB, growing 2.5 GB, steady between 2.1 and 2.5
updatable structures 1,549 (4.9 GB) + 937 uncompacted copies (1.4 GB) 240 (1.0 GB)
compacted structures 3,491 (0.2 GB) 7,776 (1.3 GB)
loss counters 0 but one refit refused in the card's order all 0

Where the console's own size of a build is known (3,836 builds), the console used 1,551 MB and the host's bound for the same builds was 992 MB. The report prints all of this: bytes alive by what they hold, updatable ones by their last update and by how many updates they had, and the host's own cost.

Numbers

Same build, same place, 5 minutes each, 1440p, VICTORY_RT_STAMPS=rt (card time stamps around the ray-tracing dispatches only; added here, diagnostics build). Medians per frame:

VICTORY_HW_RT=1 off
trace passes (15 dispatches) 0.90 ms (60 µs each) 5.40 ms (360 µs each)
host builds and copies 0.50 ms none
title's structure builder (140 dispatches) 2.10 ms 2.20 ms
ray tracing together 3.5 ms 7.6 ms
frames per second (30 cap) 28.9 25.6

One run each; a stamp pair spans overlapping work, so read these as sizes, not exact figures. The run with the switch on sits at the cap.

Loss counters over the check runs: all 0 (structures not built, instances without a structure, triangles zeroed, views not widened, device errors).

Not done

  • Each structure is still its own buffer. Over the 3 minute drive 73,703 structure buffers were made in 6.9 s in all, the longest single one 73 ms, which is a visible hitch. A pool would remove it; not done. About 0.4 GB is also lost to 64 KiB placement.
  • Structures the title updated for a while and then left stay updatable (about 200, 0.9 GB at the end of the drive). No exact way to shrink them on this driver was found.
  • The frame rate in free play is not better with the switch on on a 16 GB card: with or without it the card is full in the city (textures waiting), which is a separate problem from this change.
  • Not checked hit for hit against the console's own walk on a captured frame. What stands behind it today is the proofs in the lifter, the loss counters, and the picture in play.
  • Only tried on one card and driver (RX 9070 XT, RADV). #3706 reported a device removal on one NVIDIA card; not looked at here.
  • The title's builder still costs about 2 ms a frame. With every loop lifted it may be possible to switch it off without loss; not studied.
  • Build memory is larger than it needs to be.
  • Translations are keyed by the switch, so the first run with it on translates the ray-tracing programs and makes their pipelines again.

Tests

On this branch (main at 32b136e + the three commits), under Wine:

  • victory-shader: 410 passed, 0 failed, 5 ignored (whole suite; includes the lifter and the sat_with tests).
  • victory-gpu: 43 host-structure tests (decoders, input classes, refit rule, ledger, compaction tickets, the update rule, the accounting) and the stamps mode test pass. Of the whole suite, as run before the third commit, 5 tests in descriptor::host::tests fail here (a_structured_view_made_raw_passes_the_host_check, raw_twins_show_the_views_bytes, views_off_their_elements_are_told, slots_held_for_lack_of_room_come_back_when_there_is_room, views_are_made_beside_the_heap_and_copied_in); the same 5 fail the same way on plain main (32b136e) on this machine, and this change does not touch what they test.
  • victory-hle: 4 builder-tap tests pass.
  • The diagnostics build type-checks with no new warnings.

Not yet run in play on this exact branch. The fixed-place numbers were taken on a local branch that was 53 commits behind main; the free-play runs of point 7 on a local branch with this work merged into main at 32b136e. Both carry other local changes, but the two files of the third commit are byte for byte the same there and here. A play run on this branch is still the thing to do before merging.

🤖 Generated with Claude Code

**@⁠LOCKhart07** on GitHub · 2026-12-02 22:11 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/262) `LOCKhart07:hw-rt-queries` → `main` · +17618 −96 · 29 files · 4 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. **(this one)** - #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. All five together, current with main: #342. #274 and #306 are both on #262 and not on each other. #323 has #306's commits in it until that merges. --- ## What Hardware ray tracing behind `VICTORY_HW_RT=1` (off by default). With the switch off no host structure is made, and translations are what they were apart from two small translator fixes (point 6 below). With it on: - **Translator** (first commit): each loop in which a ray-tracing program walks the console's structures is recognised and written as a DXIL `RayQuery`, keeping the title's own hit tests, masks and ordering as the candidate and commit steps. A loop that cannot be proven equivalent stays as translated before. - **Host** (second commit): the title's structure builder keeps running; its build, refit and copy calls are tapped, and the same triangles and instances go into host bottom- and top-level structures that the lifted programs trace. - **Host memory** (third commit): keeps those structures small in free play (point 7 below). Developed and measured on an RX 9070 XT with RADV and vkd3d-proton, on the unified-memory path. ## Where it comes from This is a port, not new invention, and the credit belongs upstream of us: - The lift and the host structures are from VIctory-NVIDIA PR #3706 (dyshay), GPL-3.0. - The lifter's exactness rules are from dakisback2/VIctory-Nvidia-Linux (`85b0b11b`, `5485daf7`), by way of Leslie-d-a/VIctory-NVIDIA-HWRT. - The host side started from MJ26gaming/victory-rdna4-linux-rt-MJ26 `365fad515`, which is #3706's host half on RADV. The file headers say the same. What follows is what is different here. ## What is different from those **1. No forced misses: 64 of 64 programs, 397 of 397 loops lifted.** The earlier ports leave 6 programs partly lifted (14 loops) and give those rays a miss, which their notes put at about 1 % darker. All 14 are one shape: the console compiler reuses three registers as loop scratch on the "then" lanes and reads their original values on the "else" lanes, and the lifter could not relate the two lane sets because they pass through mask joins. The lifter now proves it exactly: joins whose inputs are all one mask collapse to that mask, and the read's lanes are then refuted against the loop's entry lanes by an exact search (`Bools::sat_with`; out of budget means refuse, never guess). With that, all 397 loops lift and all 64 programs pass the DXIL validator. **2. The title's builder is tapped, not replaced.** The console structures stay real, so sizes, compaction and validation the title asks about are its own answers, and anything that still walked them would walk real data. The cost is that the builder's dispatches still run (see the numbers). **3. Inputs follow the console builder, not a safer rule.** Read from the builder's own triangle loader: it has no bounds at all, and skips a triangle only when a vertex's X is NaN. So here: - only a NaN in X makes a triangle inactive; infinite and far positions pass through (the earlier rule turned positions farther than 1e10 into NaN: 124,094 vertex copies in one 5 minute run were geometry the console keeps); - indices and meshlets past the stated counts read the title's real bytes past the end, as the console does; - a quantised vertex header that is not finite is decoded anyway; - bytes that cannot be read are a counted loss, never a silent (0,0,0). Every one of these is counted by what it really changed (on the card and on the processor), and printed. **4. No eviction, no masked instances.** No budget drops a bottom-level structure and hides its instances. Memory is kept down by compaction and by not keeping structures updatable that are not updated (point 7), never by dropping one the title still holds. **5. Builds in the card's order.** Host builds, refits and copies are recorded inside the title's own lists at the point of the title's call, and a ledger keeps what each top-level structure refers to in the order the card will run it. This removed an ordering race between a top-level build and the bottom-level builds it refers to when lists are submitted in a different order than they were recorded. **6. Two translator fixes found on the way** (both on the path with the switch off too, so the translator version goes up): the sign of zero in `v_mad_legacy`, and partial stores through a counter view. **7. Host structures stay small in free play** (third commit). In a first free-play session (driving through the city) the host structures passed 7 GB in a few minutes and kept growing, the card filled and the frame rate collapsed, with every loss counter still 0. Measured by what each buffer holds, it was not a leak but size: 86 % of the bytes were structures built with `ALLOW_UPDATE` and uncompacted copies of them. Read from the driver's source: on RADV (BVH8) an updatable structure takes about 177 bytes a triangle against about 46 for a compacted one, and compacting an updatable one can trim only 15 to 20 %, because the refit needs a fixed leaf region. The title allows updates of many structures it never updates, or updates once. So: - a structure is 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), so nothing about the hits changes, only the host's bytes and build time; - every structure built without `ALLOW_UPDATE` is compacted by the host once built, through the same tickets the title's own compact copies use: the streamed-in ("rehydrated") structures, which are ready-made on the console and never copied by the title, and the title's builds it does not copy; - structures the title builds over are dropped: the builder's 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. Over a 3 minute drive each (free play, so routes differ; read as sizes): | | before | after | |---|---|---| | host structure memory at the end | 7.3 GB, growing | 2.5 GB, steady between 2.1 and 2.5 | | updatable structures | 1,549 (4.9 GB) + 937 uncompacted copies (1.4 GB) | 240 (1.0 GB) | | compacted structures | 3,491 (0.2 GB) | 7,776 (1.3 GB) | | loss counters | 0 but one refit refused in the card's order | all 0 | Where the console's own size of a build is known (3,836 builds), the console used 1,551 MB and the host's bound for the same builds was 992 MB. The report prints all of this: bytes alive by what they hold, updatable ones by their last update and by how many updates they had, and the host's own cost. ## Numbers Same build, same place, 5 minutes each, 1440p, `VICTORY_RT_STAMPS=rt` (card time stamps around the ray-tracing dispatches only; added here, diagnostics build). Medians per frame: | | `VICTORY_HW_RT=1` | off | |---|---|---| | trace passes (15 dispatches) | **0.90 ms** (60 µs each) | **5.40 ms** (360 µs each) | | host builds and copies | 0.50 ms | none | | title's structure builder (140 dispatches) | 2.10 ms | 2.20 ms | | ray tracing together | **3.5 ms** | **7.6 ms** | | frames per second (30 cap) | 28.9 | 25.6 | One run each; a stamp pair spans overlapping work, so read these as sizes, not exact figures. The run with the switch on sits at the cap. Loss counters over the check runs: all 0 (structures not built, instances without a structure, triangles zeroed, views not widened, device errors). ## Not done - **Each structure is still its own buffer.** Over the 3 minute drive 73,703 structure buffers were made in 6.9 s in all, the longest single one 73 ms, which is a visible hitch. A pool would remove it; not done. About 0.4 GB is also lost to 64 KiB placement. - **Structures the title updated for a while and then left stay updatable** (about 200, 0.9 GB at the end of the drive). No exact way to shrink them on this driver was found. - **The frame rate in free play is not better with the switch on** on a 16 GB card: with or without it the card is full in the city (textures waiting), which is a separate problem from this change. - **Not checked hit for hit** against the console's own walk on a captured frame. What stands behind it today is the proofs in the lifter, the loss counters, and the picture in play. - Only tried on one card and driver (RX 9070 XT, RADV). #3706 reported a device removal on one NVIDIA card; not looked at here. - The title's builder still costs about 2 ms a frame. With every loop lifted it may be possible to switch it off without loss; not studied. - Build memory is larger than it needs to be. - Translations are keyed by the switch, so the first run with it on translates the ray-tracing programs and makes their pipelines again. ## Tests On this branch (`main` at 32b136e + the three commits), under Wine: - `victory-shader`: 410 passed, 0 failed, 5 ignored (whole suite; includes the lifter and the `sat_with` tests). - `victory-gpu`: 43 host-structure tests (decoders, input classes, refit rule, ledger, compaction tickets, the update rule, the accounting) and the stamps mode test pass. Of the whole suite, as run before the third commit, 5 tests in `descriptor::host::tests` fail here (`a_structured_view_made_raw_passes_the_host_check`, `raw_twins_show_the_views_bytes`, `views_off_their_elements_are_told`, `slots_held_for_lack_of_room_come_back_when_there_is_room`, `views_are_made_beside_the_heap_and_copied_in`); the same 5 fail the same way on plain `main` (32b136e) on this machine, and this change does not touch what they test. - `victory-hle`: 4 builder-tap tests pass. - The diagnostics build type-checks with no new warnings. **Not yet run in play on this exact branch.** The fixed-place numbers were taken on a local branch that was 53 commits behind `main`; the free-play runs of point 7 on a local branch with this work merged into `main` at 32b136e. Both carry other local changes, but the two files of the third commit are byte for byte the same there and here. A play run on this branch is still the thing to do before merging. 🤖 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]>
Claude-Session: https://claude.ai/code/session_01DJe9WSdi44GnJxKp1NiFqn
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]>
Claude-Session: https://claude.ai/code/session_01DJe9WSdi44GnJxKp1NiFqn
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 22:11:28 +00:00
github-bot force-pushed github-bot/gh-262 from 883dd52904 to 56d254a9d7 2026-12-02 22:38:52 +00:00 Compare
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]>
Author
Owner

@⁠Widget9337 on GitHub · 2026-12-03 04:04 UTC · original

Free-play data point on the same card: RX 9070 XT 16 GB, Ryzen 9 7950X3D, 64 GB RAM, CachyOS (kernel 7.2), this repo's patched Mesa and vkd3d-proton. Series X profile, 1920x1080 output with PC FSR 4 Balanced (1129x635 render), 30 fps cap, 3 shadow cascades (#211), VICTORY_LATE_FENCE=1. Build: main at 8585cd4 plus this PR (merged cleanly), compared with the same build without it. About 8 minutes of play: running on foot and very fast driving.

It works as described. 64 of 64 programs lifted, every dispatch lifted (~17 per frame), and every loss counter stayed at 0 for the whole run.

Frame rate, medians of 1 s samples grouped by draws per frame (the first 2 minutes left out). The two runs without the PR are on the same build, one with less driving and one with more:

draws per frame without (less driving) without (more driving) with VICTORY_HW_RT=1
7–8k 30.0 fps, GPU wait 4.3 ms 28.2 / 15.7 ms 29.3 / 12.2 ms
8–9k 27.7 / 14.6 ms 26.7 / 17.4 ms 27.9 / 12.2 ms
9k+ 26.4 / 16.7 ms 25.4 / 17.2 ms 23.7 / 14.0 ms
worst 10% overall 25.0 21.5 20.1
  • On foot it felt better, and GPU wait is lower at the same load, so the trace passes are clearly cheaper.
  • In fast driving it's slower without being GPU-bound: two minutes at 23–25 fps with GPU wait only 11–12 ms and preparing up to 7.7 ms. By then the host had made 157,479 structure buffers in 9,260 ms in all, the longest 69.8 ms. That's the per-structure buffer cost from your "Not done" list, and at driving speed it shows up as stalls.

Card memory: host structure memory reached 3,563 MB (compacted 2,552 MB, updatable 464 buffers / 781 MB, TLAS 160 MB; 558 MB lost to 64 KiB placement), more than the 2.1–2.5 GB in your drive. The card was down to 694 MB free, against about 3.2 GB without the PR.

Flicker looked worse with it on. I see the flickering and black textures from #69 in every build, including with ray tracing off, so this PR doesn't cause it. But it was noticeably worse with VICTORY_HW_RT=1. Possibly a clue for #69: whatever the textures' problem is, it seems to show more when the trace passes are cheaper, or read from the host structures.

Back on the build without it for now, because of the flicker and the card filling up. I'm happy to rerun once the structure buffers are pooled, or to run any switch or diagnostics build at the same spots.

**@⁠Widget9337** on GitHub · 2026-12-03 04:04 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/262#issuecomment-7367240820) Free-play data point on the same card: **RX 9070 XT 16 GB, Ryzen 9 7950X3D, 64 GB RAM, CachyOS (kernel 7.2), this repo's patched Mesa and vkd3d-proton.** Series X profile, 1920x1080 output with PC FSR 4 Balanced (1129x635 render), 30 fps cap, 3 shadow cascades (#211), `VICTORY_LATE_FENCE=1`. Build: `main` at `8585cd4` plus this PR (merged cleanly), compared with the same build without it. About 8 minutes of play: running on foot and very fast driving. **It works as described.** 64 of 64 programs lifted, every dispatch lifted (~17 per frame), and every loss counter stayed at 0 for the whole run. **Frame rate**, medians of 1 s samples grouped by draws per frame (the first 2 minutes left out). The two runs without the PR are on the same build, one with less driving and one with more: | draws per frame | without (less driving) | without (more driving) | with `VICTORY_HW_RT=1` | |---|---|---|---| | 7–8k | 30.0 fps, GPU wait 4.3 ms | 28.2 / 15.7 ms | 29.3 / 12.2 ms | | 8–9k | 27.7 / 14.6 ms | 26.7 / 17.4 ms | 27.9 / 12.2 ms | | 9k+ | 26.4 / 16.7 ms | 25.4 / 17.2 ms | **23.7** / 14.0 ms | | worst 10% overall | 25.0 | 21.5 | **20.1** | - **On foot it felt better**, and GPU wait is lower at the same load, so the trace passes are clearly cheaper. - **In fast driving it's slower without being GPU-bound:** two minutes at 23–25 fps with GPU wait only 11–12 ms and preparing up to 7.7 ms. By then the host had made 157,479 structure buffers in 9,260 ms in all, the longest 69.8 ms. That's the per-structure buffer cost from your "Not done" list, and at driving speed it shows up as stalls. **Card memory:** host structure memory reached **3,563 MB** (compacted 2,552 MB, updatable 464 buffers / 781 MB, TLAS 160 MB; 558 MB lost to 64 KiB placement), more than the 2.1–2.5 GB in your drive. The card was down to **694 MB free**, against about 3.2 GB without the PR. **Flicker looked worse with it on.** I see the flickering and black textures from #69 in every build, including with ray tracing off, so this PR doesn't cause it. But it was noticeably worse with `VICTORY_HW_RT=1`. Possibly a clue for #69: whatever the textures' problem is, it seems to show more when the trace passes are cheaper, or read from the host structures. Back on the build without it for now, because of the flicker and the card filling up. I'm happy to rerun once the structure buffers are pooled, or to run any switch or diagnostics build at the same spots.
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]>
Author
Owner

@⁠Luxuride on GitHub · 2026-12-04 12:02 UTC · original · edited 2026-12-05 11:24 UTC

This one is superseded as I read it, but not the work: the branch is real and it is the only hardware-RT implementation in the backlog.

The scheduling problem is that this PR's three commits (3dacbed, 56d254a, 27f1a9b) appear with identical hashes in the five later PRs of the stack, so every review comment would have to be posted six times and none of the six is mergeable on its own. The tip contains all of it and merges clean, so the review effort belongs there once, not here.

Two things that should be true of the PR that lands:

  • apps/victory/src/run.rs:61 documents the switch only in a stderr banner. VICTORY_HW_RT needs a line in run.conf.default and docs/SETTINGS.md before it changes what the GPU is asked to draw for anyone.
  • Parity is unproven by the author's own instruments: "not yet checked hit for hit" in the same banner, hwrt.rs:3071 printing "hardware RT losses (each a bug to fix; 0 is parity)", and no fps, scene or card anywhere in the diff. A 17k-line PR whose correctness claim rests on a counter not yet driven to zero is a branch, not a PR.

Also worth stating out loud in the body: #[cfg(windows)] pub mod hwrt means none of this compiles on Linux; only emit/rayquery_tests.rs is platform-neutral.

Whether it still has work of its own is the maintainer's call, not mine.

**@⁠Luxuride** on GitHub · 2026-12-04 12:02 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/262#issuecomment-7410886628) · edited 2026-12-05 11:24 UTC This one is superseded as I read it, but not the work: the branch is real and it is the only hardware-RT implementation in the backlog. The scheduling problem is that this PR's three commits (`3dacbed`, `56d254a`, `27f1a9b`) appear with identical hashes in the five later PRs of the stack, so every review comment would have to be posted six times and none of the six is mergeable on its own. The tip contains all of it and merges clean, so the review effort belongs there once, not here. Two things that should be true of the PR that lands: - `apps/victory/src/run.rs:61` documents the switch only in a stderr banner. `VICTORY_HW_RT` needs a line in `run.conf.default` and `docs/SETTINGS.md` before it changes what the GPU is asked to draw for anyone. - Parity is unproven by the author's own instruments: "not yet checked hit for hit" in the same banner, `hwrt.rs:3071` printing "hardware RT losses (each a bug to fix; 0 is parity)", and no fps, scene or card anywhere in the diff. A 17k-line PR whose correctness claim rests on a counter not yet driven to zero is a branch, not a PR. Also worth stating out loud in the body: `#[cfg(windows)] pub mod hwrt` means none of this compiles on Linux; only `emit/rayquery_tests.rs` is platform-neutral. Whether it still has work of its own is the maintainer's call, not mine.
Author
Owner

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

Split as asked. The three commits here are now two branches, each showing only its own change:

  • commit 1 (the translator's lift) is #468, opened as a draft;
  • commits 2 and 3 (the host structures and the built-over rule) are rt-2-structures on my fork, to be opened when that one lands.

On your two points: VICTORY_HW_RT, _LIFT, _WHY and _REFIT are in docs/SETTINGS.md and run.conf.default, each in the branch that adds it. And parity is still not checked hit for hit; the new PR says so and is a draft for that reason. It also states that the host side is #[cfg(windows)].

This one can be closed.

**@⁠LOCKhart07** on GitHub · 2026-12-04 14:34 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/262#issuecomment-7414539288) Split as asked. The three commits here are now two branches, each showing only its own change: - commit 1 (the translator's lift) is #468, opened as a draft; - commits 2 and 3 (the host structures and the built-over rule) are `rt-2-structures` on my fork, to be opened when that one lands. On your two points: `VICTORY_HW_RT`, `_LIFT`, `_WHY` and `_REFIT` are in `docs/SETTINGS.md` and `run.conf.default`, each in the branch that adds it. And parity is still not checked hit for hit; the new PR says so and is a draft for that reason. It also states that the host side is `#[cfg(windows)]`. This one can be closed.
This pull request has changes conflicting with the target branch.
  • 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/262/head:github-bot/gh-262'
git switch 'github-bot/gh-262'

Merge

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