Hardware ray tracing behind VICTORY_HW_RT=1 (DXR 1.1 ray queries) #81
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ReTerryDavis--ReVIctory!81
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-80"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Mbappinho on GitHub · 2026-12-05 02:31 UTC · original
Mbappinho:hw-rt→main· +14305 −24 · 36 files · 8 commits · openWhat this changes
With
-RayTracing -More @{ VICTORY_HW_RT = '1' }, the title's own BVH traversal loops run on the card's ray tracing units instead of the software walk. Off by default: without the switch the translator, the heaps and the HLE modules behave as before (thexboxbvhmodule is not even registered).victory-shader(emit/lower/rayquery.rs): the title's traversal loops (bvh64/bvh32) are lifted into DXR 1.1RayQuery. A loop the lifter does not recognise keeps the software walk. Root SRV slots t230-t241 carry the host structures; programs with ray queries ask for raytracing tier 1.1.victory-gpu(hwrt.rs): host BLAS/TLAS are built from the console structures and recorded into the title's lists as external work. Heap views of a console structure become views of its host structure, refreshed when that structure is built again.victory-hle(xboxbvh.rs): the module the title asks for its builds, registered only with the switch.README.md: one bullet under Ray tracing.The base is a port of MJ26gaming/victory-rdna4-linux-rt-MJ26 (
dfb4905,365fad5), itself a port of VIctory-NVIDIA's PR 3706. On top of it, one commit each:host::read_into. MJ26's tree asked Windows (VirtualQuery) whether an address was readable; here streamed pages are mapped only once something touches them, so every quant24 vertex buffer and meshlet index buffer was given inactive (11 instances in a TLAS).plane_uploadfills that read no title memory go throughdefer_hosttoo; before, the remap table and the BLAS inputs were sometimes never written and the card read stale bytes (device removed while loading).4b2d4503,7fb56e9d,18f73068): top levels name only bottom structures whose build was submitted; the BLAS table fill holds no clone of the TLAS; a geometry whose transform cannot be read is inactive instead of the identity (VICTORY_HWRT_TX_MISSING_OUT, on unless0).VICTORY_HWRT_MESHLET_CHECK, on unless0, from VIctory-SandBard8c4d262).Measured
RX 9070 XT, Ryzen 7 9800X3D, 32 GB, Windows 11. Release builds on
7e701172(the branch is now on8f78f14; #78 came in after, no conflict). Series X,-RayTracing -NoPcQuality, no other switch. Same save, standing still outdoors, 60 s to settle then 150 s measured, nobody at the controls; runs alternated.main, 2 runsVICTORY_HW_RT=1With the switch off the branch runs as
maindoes (the spread between runs is larger than the difference). With it on, the rays cost the card about 4-5 ms instead of 10-14; the frame is then bound by the CPU side (about 20 ms of preparation per frame in every row).01852c0d,966f7e7cand7e701172(6 of this branch, 6 of the same commits with my diagnostics). On the older249f2aabthe same commits lost the device once, 28 s into the world. Before commit 3, the device was removed while loading in 1 of 3 plain hardware runs of the last batch without it.main; with #43's rebase (d61a654) on top, 6 and 5 against 0 and 6.VICTORY_THIN=0removes them with both walks, at a cost of about 9 fps here with hardware rays. Details: #43after(17)(OLDERthere,EXTERNALhere): whichever lands second moves its op toafter(18). With that change the two run together (34 fps, no device removed).Checks
cargo clippy --workspace --all-targets --locked -- -D warnings, and with--all-features: clean.cargo test --workspace --locked --no-fail-fast, and with--all-features: 1,732 tests pass; two targets fail, both outside this change:host::stamps::tests::a_submissions_times_are_the_pcs(GPU/CPU clock check) fails 3/3 onmainon this PC too;victory-loader's unit tests (a crate this change does not touch, nor its dependencies) hang here when run in parallel (minidump, thread-exit and trap tests) and pass with--test-threads=1.cargo xtask policy: ok.Made with Claude Code.
@Mbappinho on GitHub · 2026-12-05 05:00 UTC · original
Two notes on this PR.
Default testsjob was cancelled when it hit its 60-minute limit, as on most CI runs tonight, includingmain's own push run for #78's merge (cancelled at 01:28 UTC). Clippy and the diagnostics tests passed. My local results are in the Checks section above.Made with Claude Code.
@ReTerryDavis on GitHub · 2026-12-05 09:44 UTC · original
Impressive work—the default-OFF isolation, GPU-side vertex/index sanitization, transform snapshotting, and resource retirement are all super clean, and the vendor-agnostic DXR 1.1 gains look great.
Ready to merge after a straightforward mechanical rebase onto current
main(5 small hunks after7e033ddand627da77):crates/victory-gpu/src/pipeline/host.rs(SLOT_MEMORY_VAS)crates/victory-gpu/src/watch.rs(title_memory_freed/forget_watch_reservations)crates/victory-shader/src/emit/lower/mod.rs(struct Lower)crates/victory-shader/src/emit/mod.rs(pub use shader::{ ... })crates/victory-shader/src/emit/shader.rs(SLOT_MEMORY_VAS/SLOT_AMD_EXT= 252; no collision withSLOT_TLAS_BASE..=MAX= 230..=241)One small cleanup while rebasing: in
hwrt.rs:68, please avoidunsafe { std::env::set_var("VICTORY_BVH_BUILDER", "0") }insiderequested()—checking!hwrt::requested()directly inpipeline.rs's builder toggle is safer under Rust 2024.@staticman256 on GitHub · 2026-12-05 12:09 UTC · original
@Mbappinho users report that the fork here performs RT way better. Is this the same RT implementation? https://github.com/Zelbrad/VIda/tree/rt
Anything you can get from that? I haven't tested this personally for now.
0527db45b3to9709294b95@Mbappinho on GitHub · 2026-12-05 17:57 UTC · original
Thanks. Rebased onto
mainata6b5a998; it also merges cleanly with today's8bff52be, andcargo checkpasses on that merge (with #87 too). The five hunks you listed were the only conflicts, each resolved by keeping both sides:SLOT_MEMORY_VAS/SLOT_AMD_EXT(252) next toSLOT_TLAS_BASE..=SLOT_TLAS_MAX(230..=241),forget_watch_reservationsthenhwrt::title_memory_freed, both sets of fields instruct Lower, and the mergedpub use shader::{...}.The
set_varis gone (9709294b):requested()only reads now.pipeline::builder_runschecks!hwrt::requested()next toVICTORY_BVH_BUILDER, and so does the BVH probe's default, so withVICTORY_HW_RT=1andVICTORY_BVH_BUILDER=1(what-RayTracingsets) the title's builder and the probe stay off, as before.Checked on
9709294b: clippy with and without--all-features(withmain's own lint failures allowed), policy, the workspace tests butvictory-gpu, whose test target does not build onmain(overlay/shots.rs,Tab::Lighting): 1092 passed, 0 failed with--all-featureson one thread. With the default thread count,victory-loader's lib tests did not finish within 40 minutes, here and on #87's branch (threads::tests::exit_ends_the_other_threads_firstandminidump::tests::a_dump_of_this_process_is_written_with_its_threadsamong the unfinished); neither branch touchesvictory-loaderor its dependencies. Hardware RT runs of the rebased build, no device removal: 20.5-21.6 fps against 32-33 for the branch as first posted, which is a slowdown on currentmainthat I am narrowing down and will detail in a separate comment, not this PR.Made with Claude Code.
@Mbappinho on GitHub · 2026-12-05 18:38 UTC · original
@ReTerryDavis a heads-up from measuring the rebased branches: on this PC (9800X3D, RX 9070 XT, Windows 11, native 4K, the same save and still scene for every build), current
mainis much slower than before627da774, and the cause is the new hot-block rules inwatch.rs.A first-parent bisect, software RT (the title's builder):
[stats] frame detail)7e033dda627da774Then one exe on
8bff52bewith two local switches that bring back the rules from before627da774:VICTORY_HOT_OLD=1for hot blocks (500 ms default, 50 ms grace, one step hotter at a time, no jitter, no cool-down step, 8192 kept) andVICTORY_EVICT_OLD=1forlet_go_idle(no 5 s floor, written copies evictable). Software RT, 90 s per run, in this order:mainmainagainVICTORY_GUARD_HOT=500alone (the old default) gives back about 1 fps, so the cost is in the rest of the change: the 250 ms grace, the jump from 0 to 2, the cool-down step or the jitter. I have not split those. Hardware RT (#81) shows the same drop: 32-33 fps on8f78f14a, 20.5-21.6 once rebased.I understand these rules target the synchronized
VirtualProtectstorms, and this bench (a still scene, 90 s) measures neither hitches nor long sessions, so I am not asking for a plain revert. A switch, or the old rules by default with the new ones opt-in, would let both be measured. The switch I used is about 40 lines; I can push it to a branch, or run any variant on this PC.Made with Claude Code.
@Mbappinho on GitHub · 2026-12-05 18:38 UTC · original
@staticman256 I have not run it, but from its source and README: VIda-RT's
rtbranch is the same family. Its hardware ray tracing is a port of Darner (TrustNo1), as this PR's is through MJ26 (the samerayquery.rslifting andhwrt.rshost side).Two things likely explain the reports:
627da774, which costs about a third of the frame rate on this PC, with or without ray tracing (details in my comment above). Anyone comparing it with currentmainsees that too.Two of its additions may be worth a look later:
VICTORY_HWRT_MIN_T=1(off by default there: running-minimum hit-distance accumulators clamped to the committed hit) and filling the card to 70% of its memory against flicker.Made with Claude Code.
@Saksukella on GitHub · 2026-12-05 19:27 UTC · original
Tested the rebased PR #81 (
9709294) merged cleanly onto current main (8bff52b) + PR #87 (3aa8562) on **AMD Radeon RX 9070 XT (@staticman256 on GitHub · 2026-12-05 19:38 UTC · original
@Mbappinho
Nice find on the hot-block slowdown. I had a go at a small fix based on your numbers, diff attached.
I think the new 250 ms window makes too many pages "hot", so they get copied every frame even though the game only writes them every few frames. The diff goes back to 50 ms for that and keeps the 250 ms only so a hitch doesn't reset things.
I can't reproduce the slowdown on my PC, so I can't tell if it works. Could you try it on your bench?
It's on by default, and VICTORY_HOT_ENTER=0 gives the current behaviour, so one build can compare both.
hot-enter-2.patch
@Mbappinho on GitHub · 2026-12-05 22:53 UTC · original
@staticman256 Thanks, measured. One exe,
8bff52beplus your hot-enter-2.patch as attached; same PC, scene and bench as above (software RT, 90 s per run), in this order:VICTORY_HOT_ENTER=0VICTORY_HOT_ENTER=0So the narrow entry gives back most of the drop (+8.5 fps, copies 280 -> 153 MB), and about 2.5 fps are still missing against the rules from before
627da774, with copies at 153 MB against 85. What is left would be in what the patch keeps: the jump from 0 to 2, the cool-down step, the jitter or the 1000 ms ceiling. No device removal in any run, and the patch's watch tests pass here. This bench still says nothing of hitches; I am glad to run a next variant.Made with Claude Code.
@PillowFullOfBricks on GitHub · 2026-12-05 23:42 UTC · original · edited 2026-12-06 01:06 UTC
@Mbappinho there won't be a next version from me because I don't have this problem and cannot reproduce it to test. The above blob was just claude's attempt at fixing it from description and commit alone. Feel free to adapt and push the code as its own PR.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.