Ray tracing on AMD RDNA 4: about 1 run in 3 clean indoors on identical settings; what we found, and questions #2109

Open
opened 2026-11-29 09:33:52 +00:00 by BackseatDrivers-Unbound · 2 comments
BackseatDrivers-Unbound commented 2026-11-29 09:33:52 +00:00 (Migrated from github.com)
Contributor

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by BackseatDrivers-Unbound on 2026-11-29T09:33:52Z.


Problem. With the title's own ray tracing on (VICTORY_BVH_BUILDER=1), on an RX 9070 XT, the house interior is either right or broken for the whole visit. Right means warm wood floors that reflect the room and glass that shows what is behind it. Broken means flickering black patches, cold blue-grey floors and outdoor scenery in indoor glass. On identical settings and the same replayed route, about 1 run in 3 is clean (3 of 8 in a noise baseline, 11 of 50 blind-rated runs overall). Which one you get is decided around arrival at the house. We have seen moments almost 1:1 with the console, but we cannot reproduce them reliably.

Hardware and settings. RX 9070 XT 16 GB (driver 32.0.32029.2010), Ryzen 7 5800X3D, 32 GB, Windows 11. 4K output (title told 3840x2160), console mode Series X. No FSR, DLSS or frame generation: only the console's own upscaler. Ray-tracing base: VICTORY_BVH_BUILDER=1, VICTORY_BVH_AHEAD=1, VICTORY_BVH_GAPS=quiet, VICTORY_LIST_VIEW_TWINS=1, VICTORY_EARLY_DEPTH=0. Our full list of 39 common VICTORY_* settings is in the write-up. About 10-12.7 fps with ray tracing on, and CPU-bound.

AMD vs NVIDIA, as far as we know

  • Wave width: RDNA keeps the console's 64-lane waves. NVIDIA splits each into two 32-lane halves with LDS exchange and barriers (host wave lanes min=32 max=32). That costs a lot in the builder and the ray walks (29 ms for CS_ScreenProbes_TraceRays alone on an RTX 40-series card).
  • Dispatches over 65,535 groups were cut on NVIDIA (the stale "melting" band at the bottom indoors). We do not see that band on AMD.
  • Broken NVIDIA runs we saw show whole walls staying dark. Ours flicker. A possible reason: real GPU timestamps there, about 0 ms here. The title uses that span as its probes' time step.
  • A suspected AMD-only cause, now ruled out for this title in our tree: the wave64 lane mask written in halves in the builder's PrefixSum256 (Marvisak/VIctory#3486, fixes #2836 and #3023). We ported both behind a switch: it changes 0 of 25,689 title shaders and 0 of 34 builder programs, and our translation of PrefixSum256 gives 0 of 256 wrong results without it. Our structure dumps also show no radix-sort key-loss signature.

What works

  • Packed (prebuilt) bottom levels come out healthy.
  • The tree fix (VICTORY_LIST_VIEW_TWINS, from RAZDA4A-XEN) works.
  • VICTORY_EARLY_DEPTH=0 gives better glass refraction with ray tracing on, and does not cause the patches.
  • The page-seam fix (VICTORY_SEAM_LOADS=1) fixes a real bug: multi-dword loads across a 64 KiB page took their later dwords from the wrong page, 18-28 such loads a frame. But it does not change the clean rate: a first 3 of 7 vs 0 of 6 did not hold up (1 of 12 base runs clean with it on overnight).

What doesn't, or is unclear

  • The CPU-answered compacted sizes (VICTORY_RT_NATIVE + VICTORY_RT_SIZES_CPU). The race is real: about 92 % of compaction copies were made before the size was answered, and answers landed 9-12 frames late (see #1412). The fix removes about 2/3 of the overlaps our detector sees, but blind ratings did not show it as better.
  • No gain from JOIN_PARTS=1, a full barrier after every builder dispatch, a fixed 60 ms GPU time, or serving faults to the builder only or the walks only.
  • Our counters say MEMORY_LAND_SENT and READY_SKIP move about 0 bytes here.
  • Also no change in the clean rate (scored automatically, alternating A/B): real card GPU timestamps (2 of 7 vs 1 of 7), a fixed 40 ms GPU time (3 of 5 vs 2 of 5), WC_NO_BACK=0 (1 of 5 vs 0 of 5), the out-of-range index check (#690 / Marvisak #3670 port: 1 of 4 vs 1 of 6), leaving out the heat-haze and decal-defrag passes (1 of 2 vs 0 of 2).

Main hypothesis. The run-wide fault budget (2,048 pages) is spent before the house in 37 of 43 runs (compare #688). Pages the builder reads or writes are often not ready before it runs, so it builds from zeros or stale bytes, or places compacted copies by sizes it does not know yet. Dumps show broken trees overlapping their neighbours: 44 of 69 broken trees overlap, against 3 of 95 healthy ones. The root node is the last node of a structure, so a tail overwrite kills the whole tree. Timing decides which structures are hit, so runs differ. Another private NVIDIA build has VICTORY_RT_POINTED / VICTORY_RT_INPUTS (making ready what builder root views point at, and the build inputs); there they removed white blocks and sky light indoors. We ported and tested them (6 vs 6): same clean rate (1 of 6 each), but every run with them had warm floors (base: 5 of 6 cold), and the black patches stayed. Their counters show they bring 0 new pages in our tree: our VICTORY_BVH_AHEAD already had 15,027 of 15,028 of those addresses ready. So in our tree the missing-input explanation does not hold as such, and the run-to-run split is still unexplained.

Full details and code: branch pub-rt-amd of https://github.com/BackseatDrivers-Unbound/VIctory-AMD. The write-up is https://github.com/BackseatDrivers-Unbound/VIctory-AMD/blob/pub-rt-amd/docs/RT-AMD-INVESTIGATION.md. It covers how ray tracing works in this tree, every switch with our verdict, the method (game-clock route replay, 16-frame bursts, blind ratings, a picture scorer at about 94 % agreement with them) and what we got wrong. All new switches are off by default.

Related: #688 (fault budget), #689 (sizes answered at the call), #690 (OOB_SELECT index check), #1412 (compacted-size race at scale). Upstream Marvisak/VIctory: #3486, #2836, #3023, #3670.

Questions

  1. On NVIDIA, with the same settings and route, is the interior clean far more often than 1 in 3? That would separate a lane-width cause from a memory-timing cause. We can share our route and runner.
  2. Has anyone made ready what the builder's root views point at (its geometry-description tables) and the build calls' inputs before the dispatches? Did run-to-run differences go away?
  3. Our next step is a structure validator: read back each structure built at run time and check it against its inputs, to find the first builder step whose output is wrong. Has anyone built something like this (or compared a good and a bad build of the same structure byte by byte)?
  4. For compacted copies: is it better to hold the copy until the size is answered, or to answer on the CPU (#689 vs our record-time answer)? Have you seen overlaps left with the size answered?
  5. Stores to pages with no directory entry are dropped silently. Has anyone tried one card-only arena for all structures built at run time, instead of per-64 KiB-page copies of title memory?
  6. What span does the title's GPU timestamp pair have on a console at 30 fps?

Credits: Kemerd/VIctory-NVIDIA-RT (builder calls), crossducking/RAZDA4A-XEN (tree fix), DexNom/VIctory PR 62 by MrToucann (RDNA 4 compiler crash), avatarmanz (fault bounds), Belobug (input log), and another private NVIDIA build (sizes on the CPU, LAND_SENT, GPU stamps).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:6677154355 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/2109). Originally posted by [BackseatDrivers-Unbound](https://github.com/BackseatDrivers-Unbound) on 2026-11-29T09:33:52Z. --- **Problem.** With the title's own ray tracing on (`VICTORY_BVH_BUILDER=1`), on an RX 9070 XT, the house interior is either right or broken for the whole visit. Right means warm wood floors that reflect the room and glass that shows what is behind it. Broken means flickering black patches, cold blue-grey floors and outdoor scenery in indoor glass. On identical settings and the same replayed route, about 1 run in 3 is clean (3 of 8 in a noise baseline, 11 of 50 blind-rated runs overall). Which one you get is decided around arrival at the house. We have seen moments almost 1:1 with the console, but we cannot reproduce them reliably. **Hardware and settings.** RX 9070 XT 16 GB (driver 32.0.32029.2010), Ryzen 7 5800X3D, 32 GB, Windows 11. 4K output (title told 3840x2160), console mode Series X. No FSR, DLSS or frame generation: only the console's own upscaler. Ray-tracing base: `VICTORY_BVH_BUILDER=1`, `VICTORY_BVH_AHEAD=1`, `VICTORY_BVH_GAPS=quiet`, `VICTORY_LIST_VIEW_TWINS=1`, `VICTORY_EARLY_DEPTH=0`. Our full list of 39 common `VICTORY_*` settings is in the write-up. About 10-12.7 fps with ray tracing on, and CPU-bound. **AMD vs NVIDIA, as far as we know** - Wave width: RDNA keeps the console's 64-lane waves. NVIDIA splits each into two 32-lane halves with LDS exchange and barriers (`host wave lanes min=32 max=32`). That costs a lot in the builder and the ray walks (29 ms for `CS_ScreenProbes_TraceRays` alone on an RTX 40-series card). - Dispatches over 65,535 groups were cut on NVIDIA (the stale "melting" band at the bottom indoors). We do not see that band on AMD. - Broken NVIDIA runs we saw show whole walls staying dark. Ours flicker. A possible reason: real GPU timestamps there, about 0 ms here. The title uses that span as its probes' time step. - A suspected AMD-only cause, now ruled out for this title in our tree: the wave64 lane mask written in halves in the builder's `PrefixSum256` (Marvisak/VIctory#3486, fixes #2836 and #3023). We ported both behind a switch: it changes 0 of 25,689 title shaders and 0 of 34 builder programs, and our translation of `PrefixSum256` gives 0 of 256 wrong results without it. Our structure dumps also show no radix-sort key-loss signature. **What works** - Packed (prebuilt) bottom levels come out healthy. - The tree fix (`VICTORY_LIST_VIEW_TWINS`, from RAZDA4A-XEN) works. - `VICTORY_EARLY_DEPTH=0` gives better glass refraction with ray tracing on, and does not cause the patches. - The page-seam fix (`VICTORY_SEAM_LOADS=1`) fixes a real bug: multi-dword loads across a 64 KiB page took their later dwords from the wrong page, 18-28 such loads a frame. But it does not change the clean rate: a first 3 of 7 vs 0 of 6 did not hold up (1 of 12 base runs clean with it on overnight). **What doesn't, or is unclear** - The CPU-answered compacted sizes (`VICTORY_RT_NATIVE` + `VICTORY_RT_SIZES_CPU`). The race is real: about 92 % of compaction copies were made before the size was answered, and answers landed 9-12 frames late (see #1412). The fix removes about 2/3 of the overlaps our detector sees, but blind ratings did not show it as better. - No gain from `JOIN_PARTS=1`, a full barrier after every builder dispatch, a fixed 60 ms GPU time, or serving faults to the builder only or the walks only. - Our counters say `MEMORY_LAND_SENT` and `READY_SKIP` move about 0 bytes here. - Also no change in the clean rate (scored automatically, alternating A/B): real card GPU timestamps (2 of 7 vs 1 of 7), a fixed 40 ms GPU time (3 of 5 vs 2 of 5), `WC_NO_BACK=0` (1 of 5 vs 0 of 5), the out-of-range index check (#690 / Marvisak #3670 port: 1 of 4 vs 1 of 6), leaving out the heat-haze and decal-defrag passes (1 of 2 vs 0 of 2). **Main hypothesis.** The run-wide fault budget (2,048 pages) is spent before the house in 37 of 43 runs (compare #688). Pages the builder reads or writes are often not ready before it runs, so it builds from zeros or stale bytes, or places compacted copies by sizes it does not know yet. Dumps show broken trees overlapping their neighbours: 44 of 69 broken trees overlap, against 3 of 95 healthy ones. The root node is the last node of a structure, so a tail overwrite kills the whole tree. Timing decides which structures are hit, so runs differ. Another private NVIDIA build has `VICTORY_RT_POINTED` / `VICTORY_RT_INPUTS` (making ready what builder root views point at, and the build inputs); there they removed white blocks and sky light indoors. We ported and tested them (6 vs 6): same clean rate (1 of 6 each), but every run with them had warm floors (base: 5 of 6 cold), and the black patches stayed. Their counters show they bring 0 new pages in our tree: our `VICTORY_BVH_AHEAD` already had 15,027 of 15,028 of those addresses ready. So in our tree the missing-input explanation does not hold as such, and the run-to-run split is still unexplained. **Full details and code:** branch `pub-rt-amd` of https://github.com/BackseatDrivers-Unbound/VIctory-AMD. The write-up is https://github.com/BackseatDrivers-Unbound/VIctory-AMD/blob/pub-rt-amd/docs/RT-AMD-INVESTIGATION.md. It covers how ray tracing works in this tree, every switch with our verdict, the method (game-clock route replay, 16-frame bursts, blind ratings, a picture scorer at about 94 % agreement with them) and what we got wrong. All new switches are off by default. Related: #688 (fault budget), #689 (sizes answered at the call), #690 (OOB_SELECT index check), #1412 (compacted-size race at scale). Upstream Marvisak/VIctory: #3486, #2836, #3023, #3670. **Questions** 1. On NVIDIA, with the same settings and route, is the interior clean far more often than 1 in 3? That would separate a lane-width cause from a memory-timing cause. We can share our route and runner. 2. Has anyone made ready what the builder's root views point at (its geometry-description tables) and the build calls' inputs before the dispatches? Did run-to-run differences go away? 3. Our next step is a structure validator: read back each structure built at run time and check it against its inputs, to find the first builder step whose output is wrong. Has anyone built something like this (or compared a good and a bad build of the same structure byte by byte)? 4. For compacted copies: is it better to hold the copy until the size is answered, or to answer on the CPU (#689 vs our record-time answer)? Have you seen overlaps left with the size answered? 5. Stores to pages with no directory entry are dropped silently. Has anyone tried one card-only arena for all structures built at run time, instead of per-64 KiB-page copies of title memory? 6. What span does the title's GPU timestamp pair have on a console at 30 fps? Credits: Kemerd/VIctory-NVIDIA-RT (builder calls), crossducking/RAZDA4A-XEN (tree fix), DexNom/VIctory PR 62 by MrToucann (RDNA 4 compiler crash), avatarmanz (fault bounds), Belobug (input log), and another private NVIDIA build (sizes on the CPU, `LAND_SENT`, GPU stamps).
github-actions[bot] commented 2026-11-29 09:33:59 +00:00 (Migrated from github.com)
Author
Contributor

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by github-actions[bot] on 2026-11-29T09:33:59Z.


Please attach both logs from the run that went wrong. Without them we can only guess. Paste %LOCALAPPDATA% into the address bar of File Explorer to get there.

  1. The play log, in %LOCALAPPDATA%\victory\logs\: the newest victory-nvidia-play-<date>-<time>-<number>.log (from victory.exe) or victory-nvidia-<date>-<time>.log (from the script launcher). The window shows its path at the start, on the line Log: ....
  2. The crash log: %LOCALAPPDATA%\VIctory\data\7952987A\crashes.log, and, if there is one from that run, the newest victory-<date>-<time>-<number>.crash.log in %LOCALAPPDATA%\VIctory\data\7952987A\temp\.

Also say which GPU, Windows version (10 or 11)

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7253848201 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/2109#issuecomment-7253848201). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-29T09:33:59Z. --- Please attach both logs from the run that went wrong. Without them we can only guess. Paste `%LOCALAPPDATA%` into the address bar of File Explorer to get there. 1. The play log, in `%LOCALAPPDATA%\victory\logs\`: the newest `victory-nvidia-play-<date>-<time>-<number>.log` (from `victory.exe`) or `victory-nvidia-<date>-<time>.log` (from the script launcher). The window shows its path at the start, on the line `Log: ...`. 2. The crash log: `%LOCALAPPDATA%\VIctory\data\7952987A\crashes.log`, and, if there is one from that run, the newest `victory-<date>-<time>-<number>.crash.log` in `%LOCALAPPDATA%\VIctory\data\7952987A\temp\`. Also say which GPU, Windows version (10 or 11)
ProjectUnknownVI commented 2026-11-29 16:24:46 +00:00 (Migrated from github.com)
Author
Contributor

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by ProjectUnknownVI on 2026-11-29T16:24:46Z.


Tested extensively on an RX 9070 XT 16 GB (Windows 11, native 1440p, BVH_BUILDER=1 + HW_BVH=1). A few findings that directly address Questions #2, #4, and #5:

  1. Why RT_POINTED/RT_INPUTS brought 0 pages yet interiors still broke (Q2):
    BVH_AHEAD maps the root-view table address itself, but the 1,024-thread leaf-unpacking dispatch (constants = [0, 0, 0, _, _, _, _, 1, ..]) dereferences 48-byte D3D12 triangle-geometry records inside that table to read raw (ib, ib_len) and (vb, vb_len) addresses that no view names. Once the 2,048-page fault budget is spent, those leaf-unpacking reads return zeros and unpack degenerate triangles. Pre-mapping (ib, vb) from those 48-byte records (fivenine/victory-proton f7ace5b8e), raising FAULTS_ALL from 2,048 to 16,384 (869860482), and adding the builder UAV barrier (ae1624b69) made our primary interior consistently clean (warm floors, no outdoor sky bleeding into indoor glass). We still see an occasional shifting dark RT-GI patch in a secondary interior, so it may not explain 100% of every indoor artifact, but it eliminated the 1-in-3 roulette on the main interior.

  2. Preventing the 4 GiB / 64-arena cap (MOST=65536) after pre-mapping geometry buffers (Q5):
    Pre-mapping leaf-unpacking (ib, vb) buffers causes memory.rs arenas to hit 64/64 (4,096 MB) on longer drives (~18 min), after which new RT pages read zeros (580+ faults/frame). Tagging pages allocated exclusively by leaf-unpacking (geometry_only, cleared if any other path/fault touches them) and reclaiming both uncommitted unowned pages (>= 8 frames) and idle geometry_only pages (>= 120 frames) through an 8-frame retiring grace queue dropped active arenas from 62 (3,902 MB) down to 22 (1,105 MB) on RX 9070 XT with 0 refaults.

  3. Compacted sizes (Q4):
    Answering compacted-size queries immediately at recording/dispatch with the prebuild upper bound (BVH_SIZES_BOUND + BVH_SIZE_COPY) avoids the 9–12 frame readback race without stalling the GPU and stops compacted copies from overwriting neighbours' tails.

  4. RDNA 4 HW_BVH note:
    Native RDNA 4 hardware BVH traversal (HW_BVH=1) is also working on RX 9070 XT (verified with per-ray divergence counters against SW traversal) and helps RT frame times noticeably alongside wave64, though it's still a work in progress — while it looks clean most of the time, there are still some small visual issues we're tracking down.

(Working on an RDNA 4 RT fork based on mandy — not published yet, happy to share the memory.rs reclamation diff if it helps with your investigation.)

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7258882960 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/2109#issuecomment-7258882960). Originally posted by [ProjectUnknownVI](https://github.com/ProjectUnknownVI) on 2026-11-29T16:24:46Z. --- Tested extensively on an RX 9070 XT 16 GB (Windows 11, native 1440p, `BVH_BUILDER=1` + `HW_BVH=1`). A few findings that directly address Questions #2, #4, and #5: 1. **Why `RT_POINTED`/`RT_INPUTS` brought 0 pages yet interiors still broke (Q2):** `BVH_AHEAD` maps the root-view table address itself, but the 1,024-thread leaf-unpacking dispatch (`constants = [0, 0, 0, _, _, _, _, 1, ..]`) dereferences 48-byte D3D12 triangle-geometry records *inside* that table to read raw `(ib, ib_len)` and `(vb, vb_len)` addresses that no view names. Once the 2,048-page fault budget is spent, those leaf-unpacking reads return zeros and unpack degenerate triangles. Pre-mapping `(ib, vb)` from those 48-byte records (`fivenine/victory-proton f7ace5b8e`), raising `FAULTS_ALL` from `2,048` to `16,384` (`869860482`), and adding the builder UAV barrier (`ae1624b69`) made our primary interior consistently clean (warm floors, no outdoor sky bleeding into indoor glass). We still see an occasional shifting dark RT-GI patch in a secondary interior, so it may not explain 100% of every indoor artifact, but it eliminated the 1-in-3 roulette on the main interior. 2. **Preventing the 4 GiB / 64-arena cap (`MOST=65536`) after pre-mapping geometry buffers (Q5):** Pre-mapping leaf-unpacking `(ib, vb)` buffers causes `memory.rs` arenas to hit `64/64` (`4,096 MB`) on longer drives (~18 min), after which new RT pages read zeros (`580+` faults/frame). Tagging pages allocated *exclusively* by leaf-unpacking (`geometry_only`, cleared if any other path/fault touches them) and reclaiming both uncommitted unowned pages (`>= 8` frames) and idle `geometry_only` pages (`>= 120` frames) through an 8-frame retiring grace queue dropped active arenas from **62 (`3,902 MB`) down to 22 (`1,105 MB`)** on RX 9070 XT with **0 refaults**. 3. **Compacted sizes (Q4):** Answering compacted-size queries immediately at recording/dispatch with the prebuild upper bound (`BVH_SIZES_BOUND` + `BVH_SIZE_COPY`) avoids the 9–12 frame readback race without stalling the GPU and stops compacted copies from overwriting neighbours' tails. 4. **RDNA 4 `HW_BVH` note:** Native RDNA 4 hardware BVH traversal (`HW_BVH=1`) is also working on RX 9070 XT (verified with per-ray divergence counters against SW traversal) and helps RT frame times noticeably alongside wave64, though it's still a work in progress — while it looks clean most of the time, there are still some small visual issues we're tracking down. *(Working on an RDNA 4 RT fork based on `mandy` — not published yet, happy to share the `memory.rs` reclamation diff if it helps with your investigation.)*
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
trustno1-coder/VIctory-NVIDIA#2109
No description provided.