Hardware ray tracing 1/7: the translator lifts the title's structure walks to ray queries (VICTORY_HW_RT, off by default) #468
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/lobomfz--VIctory-xmem!468
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-468"
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?
@LOCKhart07 on GitHub · 2026-12-04 14:34 UTC · original
LOCKhart07:rt-1-lift→main· +9667 −45 · 13 files · 5 commits · draftThis is the bottom of the hardware ray tracing stack, split as asked in review of #262, #274, #306, #323, #328, #342 and #374. It replaces the first commit of #262. Opened as a draft: see "Not proven" below.
What it changes
With
VICTORY_HW_RT=1in the environment ofvictory translate, a compute or pixel program that walks the title's acceleration structures in a loop of its own is emitted with a DXR 1.1 ray query in place of the loop. Without the switch the translator emits what it does on main: measured, see below.TRANSLATOR_VERSIONstays 20, so no cache is rebuilt.Correction (2026-12-04). As first opened, this PR said the output without the switch was meant to be main's and that I had not compared them. I have now, and it was not: 3,980 of 25,694 shaders came out different. The lift commit carried two translator changes that did not depend on the switch (the zero addend of
v_mad_legacyworked on the bits, and stores through a counter view), and bumped the version for them. Both are taken out in a new commit here; main's own form of the first stays, and the second is a branch of its own on main (main-counter-storeon my fork, 2 shaders different, its own version bump). After that commit: 0 of 25,694 different.This PR alone does not change a run:
victory runrefusesVICTORY_HW_RT=1here and says the host structures are in the next PR.victory shadersandtranslate --warmdo take the switch and write the cache a run reads, so the switch is now part of the cache key (second new commit): a lifted program is never stored under a plain one's key.crates/victory-shader/src/emit/rayquery.rs(new, 8,269 lines): finding the traversal loop, proving what leaves it, emitting the query.crates/victory-shader/src/structure.rs(new): the title's structure layout as the lift reads it.emit/lower.rs,emit/shader.rs,emit/mod.rs,emit/bitcode.rs: the hooks, all behind the switch.apps/victory/src/translate.rs: counts what was lifted and what stayed on the software walk, and why.crates/victory-gpu/src/shader_cache.rs: the switch in the cache key, only when on.The size is one file. I could not find a cut of
rayquery.rsthat compiles and is reviewable in halves; if you see one, say so and I will make it.Switches (all in
docs/SETTINGS.mdin this PR)VICTORY_HW_RTVICTORY_HW_RT_LIFT10: withVICTORY_HW_RT=1, lift nothing (to tell a translator fault from a lift fault). On by default under a switch that is off by default, as noted in review; now written downVICTORY_HW_RT_WHYThey are not in
run.conf.defaultin this PR, because a run refuses the switch here; the next PR adds them there when a run can use them.Review points answered here
rayquery_tests::a_node_test_outside_a_traversal_loop_keeps_the_software_walk_and_says_whyfailed withVICTORY_HW_RT_LIFT=0in the environment (reported from a Windows run on #342): the ray-query tests now pin the lift on. Before: 6 passed, 1 failed atrayquery_tests.rs:82with the variable set; after: 30 passed, 1 ignored.#[cfg(windows)] pub mod hwrt. What is in this PR (rayquery.rs,structure.rs, their tests) is platform neutral.Measured
All for
x86_64-pc-windows-msvc, tests under Wine on Linux (RADV), this branch against main at0fd7614on the same machine:--lib --bins --tests)victory-shader --libvictory-gpu --libvictory-core --libvictory-hle --libOutput without the switch, over the 25,694 shader containers of the title's archive:
victory shaderstranslating again what main (0fd7614) had cached and counting what comes out different.cbdeda3, measured on the top of the stack)902df9fand later)195 of the containers hold no program and translate on neither. With
VICTORY_HW_RT=1,victory translateon this branch lifts whole all 64 compute programs that have traversal loops, 397 loops of 397.The table of tests above is from
cbdeda3. On the current head onlyvictory-shader --libwas run again (431 passed, 0 failed, 5 ignored), and clippy on the top of the stack with these commits merged in (51 warning lines).The failures are main's own here: in
victory-gpu, tests ofindirect::testsandwatch::that need a device or vary from run to run under Wine (which ones fail differs a little between runs, on main too); invictory-hle, the same five on both (gameinput,net,xgamesave). None is in code this PR touches. The GPU suite is run withoutdescriptor::tests::views_die_with_their_resource, which crashes the process on main here, as it was skipped in the Windows run reported on #342.Not proven, not measured
docs/RT-PARITY.mdare still outstanding. That is why this is a draft.the_local_shader_cache_lifts_its_ray_queriesis ignored (it needs a local shader cache) and was not run for this tree.The rest of the stack
Each is a branch on my fork showing only its own change, each behind its own switch, each with its docs. I will open them here one at a time as the one below lands, unless you would rather see them all at once.
rt-1-liftVICTORY_HW_RT(translate)rt-2-structuresVICTORY_HW_RT(run),_REFITrt-3-lean_LEAN_BUILDERrt-4-arena_ARENArt-5-demote_DEMOTErt-6-pack_PACKrt-7-reuse_REUSE,_NAMED,_NAMED_DUMPThe branches above this one received the two new commits as a merge, not a rebase, so work based on them keeps its base.
Already open and independent of ray tracing: #458 (send memory) and #459 (tight texture alignment), which are #306's other two commits.
🤖 Generated with Claude Code
@Luxuride on GitHub · 2026-12-04 17:15 UTC · original · edited 2026-12-04 17:21 UTC
Thanks — this is the split that was asked for, and it replaces the first commit of #262, so the overlap with the stack is by design rather than accidental.
One thing for the queue rather than for this PR: the translator commits
1e42fca,60375bfandcbdeda3are literally the same SHAs still sitting in #429 and #452, and 4,682 of the added lines here are identical to that stack's. That is fine as history, but while both copies are open, anyone reading the stack reads those ~4.6k lines a second time, and the two copies can drift.So the only question worth settling is which copy is the one to review — the series or the stack — and once that is decided, the other just says so in a line, so a reviewer knows to skip it instead of comparing. Nothing else here reads as duplication.
@fsrajner on GitHub · 2026-12-05 10:20 UTC · original
Data point for the whole stack (
rt-7-reuse@621120b) on RDNA 4.Setup: RX 9070 XT 16 GB, Ryzen 7 7800X3D, CachyOS, repo-patched Mesa 26.3.1 RADV + vkd3d-proton, proton-cachyos-slr. Series X profile, 4K output with FSR 4.1.2 Quality, RT on, headless gamescope. Build:
main@8bf4878withrt-7-reusemerged (no conflicts).Method: same intro snapshot every run, 120 s after the first A press, 2 runs per arm after one warm-up run per arm (so pipeline compiles don't land in the measured runs). The metrics come from the 5 s
stats: framewindows: ms/frame, the share of windows slower than 40 ms (25 fps), the worst window, and the count oflong framelines.long framelinesHW_RT=1+LEAN_BUILDER=1DEMOTE+PACK+REUSElifted 1 of 1 (bvh64 0/0, bvh32 1/1), on the software walk: none, and every counter on thehardware RT lossesline is 0. No device loss and no errors.DEMOTE/PACK/REUSEadd nothing measurable in a 2-minute scene, which is expected:REUSEis meant to stop the VRAM growth that shows up in long sessions.@tommiehansen on GitHub · 2026-12-06 00:18 UTC · original
@LOCKhart07 I replayed your seven-stage HWRT stack in order on current main (
8c4e663) in an isolated integration branch, without touching your branches. The main conflicts were theUsagefield context, structural test insertion, SETTINGS placement and run.conf additions. Then I replayed the dependent #429/#452/#602/#633/#634 stack. Both Linux shader tests and Windows GPU/HLE compilation + scoped RT tests pass: CI 47586258133. Integration history if useful for reconciling your foundation. No competing PR or physical DXR performance claim. Thanks for the original work!@tommiehansen on GitHub · 2026-12-06 01:48 UTC · original
Thanks for the earlier RDNA4 results. Would anyone with a 9070 XT or 9060 XT 16 GB be able to run a matched native RT capture (1440p/1080p respectively, no FSR or frame generation) on the pinned HWRT integration and capture protocol? Raw frame times, a fixed dense scene and the same downtown route, plus mesh/compute pass timings if available, would help identify the actual critical path. The same focused AMD runner can check individual changes separately. No need to test every experiment in one build. Please include driver/build/settings and any visual differences. Thank you!
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.Merge
Merge the changes and update on Forgejo.