Ray tracing: hardware DXR 1.1 for the title's structures and traversal loops (35-46 ms against 43-94 ms for the software walk on an RTX 4090) #3704

Closed
opened 2026-11-30 04:28:05 +00:00 by github-bot · 1 comment
Owner

@⁠dyshay on GitHub · 2026-11-30 04:22 UTC · original

The software path today

With VICTORY_BVH_BUILDER=1 (the F1 menu's RAY TRACING) the title's own structure builder runs as translated compute programs, and the trace programs walk the console's structures in title memory, with the node test (image_bvh64_intersect_ray, image_bvh_intersect_ray) emulated in DXIL (emit/intersect.rs). It is correct, but on an RTX 4090 it is slow and uneven:

  • Series S, ray tracing on, the house scene, 300 s: 43 to 94 ms a frame depending on the run.
  • A slow state: after a camera cut, six of the traversal programs take 2 to 9 times as long as before, and stay so. The same scene then runs at the top of that range.
  • Series X 1440p (DLSS Quality), ray tracing on, same scene: 69.6 ms median.

What a hardware path does

Ported from Leslie-d-a/VIctory-NVIDIA-HWRT, original work by dakisback2 (dakisback2/VIctory-Nvidia-Linux). It runs only on a card with DXR 1.1 (D3D12_RAYTRACING_TIER_1_1):

  • Structures. The title's XboxBvhBuilder.dll is replaced by an HLE module (victory-hle xboxbvh.rs, its 12 exports by name only, no title bytes). Its calls become host DXR 1.1 bottom and top levels, keyed by the console structure's GPU address (victory-gpu hwrt.rs): refits of dynamic bottom levels, a scratch pool, an empty top level until the first is built, the instances' bottom-level addresses remapped on the card by a small compute pass, and eviction when the title frees the memory. The title's builder programs do not run.
  • Traversal. The translator recognises the console's traversal loops in the trace programs and lifts them to inline RayQuery (emit/rayquery.rs) where every value a loop leaves behind is accounted for. A loop it cannot account for keeps the software walk; a program whose lifted form is refused is translated again without lifting, whole. The host binds the structure as a root SRV (t230..t241).
  • Counters. One log line per ray-tracing program when its translation arrives: ray queries lifted N of M (bvh64 a/b, bvh32 c/d), fell back: <first reason>. Every five seconds: ray queries: lifted shaders N, partly N, fell back N (software); per frame ... dispatches, and hardware RT: BLAS live ..., TLAS live ..., AS memory ... MB.

Measured (RTX 4090, Windows 11, diagnostics build, house scene, 300 s)

Run Median ms p95 ms GPU ms Notes
Series S, ray tracing, hardware, run 1 37.4 57 19
Series S, ray tracing, hardware, run 2 35.0 60 19
Series S, ray tracing, hardware, run 3 36.2 55 19
Series S, ray tracing, software walk 43 to 94 slow state after camera cuts
Series X 1440p, ray tracing, hardware 46.2 25
Series X 1440p, ray tracing, software walk 69.6

In each hardware run 13 ray-tracing programs were lifted whole and none fell back to software; 4,193 bottom levels were live; no device loss.

What should be tested on other cards

The proposed PR keeps it off by default (VICTORY_HW_RT=1 turns it on, in place of VICTORY_BVH_BUILDER=1; with both set the hardware path is kept and the builder is turned off, with a warning). It has been run on one PC and one card. It would help to know:

  • NVIDIA RTX 20, 30, 40 and 50 series: frame times with VICTORY_HW_RT=1 against VICTORY_BVH_BUILDER=1 on the same scene, and whether the picture matches (indirect light in interiors, shadows, reflections).
  • AMD RDNA 2 and later (DXR 1.1, RayQuery available): whether the lifted programs make pipelines and run, and the same timings. The lifted programs have only been validated by dxil.dll and run on WARP and on NVIDIA.
  • Cards with 8 to 12 GB: the bottom levels' memory (the AS memory ... MB figure in the five-second line) and whether a long run in a dense area runs out of card memory or evicts often.
  • The lift counters on your log: any program with fell back other than none, and the reason it gives (VICTORY_HW_RT_WHY=1 logs more).
  • A card without DXR 1.1 should behave exactly as before (the module logs that the device lacks tier 1.1 and the rays find nothing; use VICTORY_BVH_BUILDER=1 there).

I have a branch ready with the port behind VICTORY_HW_RT and will open the PR referencing this issue.

**@⁠dyshay** on GitHub · 2026-11-30 04:22 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/3704) ## The software path today With `VICTORY_BVH_BUILDER=1` (the F1 menu's RAY TRACING) the title's own structure builder runs as translated compute programs, and the trace programs walk the console's structures in title memory, with the node test (`image_bvh64_intersect_ray`, `image_bvh_intersect_ray`) emulated in DXIL (`emit/intersect.rs`). It is correct, but on an RTX 4090 it is slow and uneven: - Series S, ray tracing on, the house scene, 300 s: 43 to 94 ms a frame depending on the run. - A slow state: after a camera cut, six of the traversal programs take 2 to 9 times as long as before, and stay so. The same scene then runs at the top of that range. - Series X 1440p (DLSS Quality), ray tracing on, same scene: 69.6 ms median. ## What a hardware path does Ported from Leslie-d-a/VIctory-NVIDIA-HWRT, original work by dakisback2 (dakisback2/VIctory-Nvidia-Linux). It runs only on a card with DXR 1.1 (`D3D12_RAYTRACING_TIER_1_1`): - **Structures.** The title's `XboxBvhBuilder.dll` is replaced by an HLE module (`victory-hle` `xboxbvh.rs`, its 12 exports by name only, no title bytes). Its calls become host DXR 1.1 bottom and top levels, keyed by the console structure's GPU address (`victory-gpu` `hwrt.rs`): refits of dynamic bottom levels, a scratch pool, an empty top level until the first is built, the instances' bottom-level addresses remapped on the card by a small compute pass, and eviction when the title frees the memory. The title's builder programs do not run. - **Traversal.** The translator recognises the console's traversal loops in the trace programs and lifts them to inline `RayQuery` (`emit/rayquery.rs`) where every value a loop leaves behind is accounted for. A loop it cannot account for keeps the software walk; a program whose lifted form is refused is translated again without lifting, whole. The host binds the structure as a root SRV (`t230..t241`). - **Counters.** One log line per ray-tracing program when its translation arrives: `ray queries lifted N of M (bvh64 a/b, bvh32 c/d), fell back: <first reason>`. Every five seconds: `ray queries: lifted shaders N, partly N, fell back N (software); per frame ... dispatches`, and `hardware RT: BLAS live ..., TLAS live ..., AS memory ... MB`. ## Measured (RTX 4090, Windows 11, diagnostics build, house scene, 300 s) | Run | Median ms | p95 ms | GPU ms | Notes | |---|---|---|---|---| | Series S, ray tracing, hardware, run 1 | 37.4 | 57 | 19 | | | Series S, ray tracing, hardware, run 2 | 35.0 | 60 | 19 | | | Series S, ray tracing, hardware, run 3 | 36.2 | 55 | 19 | | | Series S, ray tracing, software walk | 43 to 94 | | | slow state after camera cuts | | Series X 1440p, ray tracing, hardware | 46.2 | | 25 | | | Series X 1440p, ray tracing, software walk | 69.6 | | | | In each hardware run 13 ray-tracing programs were lifted whole and none fell back to software; 4,193 bottom levels were live; no device loss. ## What should be tested on other cards The proposed PR keeps it off by default (`VICTORY_HW_RT=1` turns it on, in place of `VICTORY_BVH_BUILDER=1`; with both set the hardware path is kept and the builder is turned off, with a warning). It has been run on one PC and one card. It would help to know: - **NVIDIA RTX 20, 30, 40 and 50 series**: frame times with `VICTORY_HW_RT=1` against `VICTORY_BVH_BUILDER=1` on the same scene, and whether the picture matches (indirect light in interiors, shadows, reflections). - **AMD RDNA 2 and later** (DXR 1.1, `RayQuery` available): whether the lifted programs make pipelines and run, and the same timings. The lifted programs have only been validated by `dxil.dll` and run on WARP and on NVIDIA. - **Cards with 8 to 12 GB**: the bottom levels' memory (the `AS memory ... MB` figure in the five-second line) and whether a long run in a dense area runs out of card memory or evicts often. - The lift counters on your log: any program with `fell back` other than `none`, and the reason it gives (`VICTORY_HW_RT_WHY=1` logs more). - A card without DXR 1.1 should behave exactly as before (the module logs that the device lacks tier 1.1 and the rays find nothing; use `VICTORY_BVH_BUILDER=1` there). I have a branch ready with the port behind `VICTORY_HW_RT` and will open the PR referencing this issue.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 04:28:05 +00:00
Author
Owner

@⁠github-actions[bot] on GitHub · 2026-11-30 04:23 UTC · original

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)

**@⁠github-actions[bot]** on GitHub · 2026-11-30 04:23 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/3704#issuecomment-7268727521) 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)
This discussion has been locked. Commenting is limited to contributors.
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.

Dependencies

No dependencies set

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