Hardware ray tracing: run the title's structure builder only where the title reads its result (VICTORY_HW_RT_LEAN_BUILDER=1, off by default) #274
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!274
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-274"
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-03 00:21 UTC · original
LOCKhart07:hwrt-lean-builder→main· +18188 −86 · 31 files · 4 commits · openRelated pull requests
These depend on each other. Merge order: #262, then #274 and #306 in either order, then #323, then #328.
VICTORY_HW_RT=1). The base; merge first.VICTORY_HW_RT_LEAN_BUILDER=1). On #262. (this one)VICTORY_HW_RT_DEMOTE=1). On #306.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.
Stacked on #262: only the last commit is new here. The first three are that pull request and drop out of this diff once it merges.
What
With
VICTORY_HW_RT=1every traversal loop is a ray query on the host structures, and those are built from the title's inputs. Nothing of ours reads what the title's structure builder writes any more, but it still runs every stage on the card.The title itself reads one result of it: the compacted size a build is asked for through its postbuild descriptions. That number is the node count of the tree the build made, so only the builder can give it exactly.
VICTORY_HW_RT_LEAN_BUILDER=1(off by default, ignored withoutVICTORY_HW_RT=1) keeps the builder for those requests and drops the rest:The builder's stages run all or none, so whole calls are kept or skipped, and a kept stage only reads what a kept one wrote.
Checks in the log
lean builder:line counts requests kept, skipped by kind, copies kept and skipped, losses, and builder dispatches dropped per frame.Measured
RX 9070 XT, 2560x1440, by the builder's own stamps (
VICTORY_RT_STAMPS=rt), one run each:In both runs with the switch: 0 lost, every hardware ray-tracing loss counter 0, 0 dispatches reading title memory by address, no error lines. What is left while driving is the full builds that ask a size as the world streams in.
It frees no card memory: the title allocates a structure before it asks the builder.
Not checked
🤖 Generated with Claude Code
@lucamzanon on GitHub · 2026-12-03 12:37 UTC · original · edited 2026-12-03 13:25 UTC
Automated A/B/B/A Benchmark Feedback (RX 9070 XT / Linux RADV)
Test setup:
RADV GFX1201), Ryzen 7 5700X, 46 GB RAM, Ubuntu 26.04.1 LTS (kernel7.0.0-44-generic), repo-built Mesa 26.3.1 RADV + vkd3d-protonVICTORY_BENCH=rt,VICTORY_BENCH_MINUTES=2(first 60 s discarded, second 60 s measured), 2560x1440 → 4K FSR 4 Quality, no Frame GenerationA -> B -> B -> A(4 runs per scene), identical save restored before every run, shared warm pipeline cache (94,199 pipelines), HW RT shaders pre-translated (./run.sh shaders VICTORY_HW_RT=1, 25,694 shaders)main(842767a, RDNA4 native ray-node teston=true)main,VICTORY_HW_RT=1 VICTORY_HW_RT_LEAN_BUILDER=1Results:
2m x 4)30.4/30.2) / 10.10bench_results.txt)2m x 4)20.9/21.4) / 6.3518.4/19.7) / 5.85Per-run Prison breakdown:
20.90 fps(1% low6.00, peak27.90, 142.3 s)18.40 fps(1% low5.80, peak24.20, 275.4 s — includes initial HW RT pipeline compile)19.70 fps(1% low5.90, peak26.20, 144.4 s — warm)21.40 fps(1% low6.70, peak28.00, 142.2 s)Notes: Even on the warm B run (Run 3), Prison was ~7% slower than baseline A, and Boat did not complete within the timeout on either B run. Possibly because RDNA4 already runs native hardware ray-node tests on
main, so the extra host TLAS/BLAS maintenance outweighs the traversal savings here. Happy to re-test if you push updates!@Luxuride on GitHub · 2026-12-04 12:02 UTC · original · edited 2026-12-05 11:24 UTC
As I read it, this is superseded, like the rest of the stack: every later PR in it contains this PR's commits, so this diff is 18,188 lines of which ~18,000 are under review elsewhere.
One commit here should survive as its own small PR once the stack has a home:
d766d8b/crates/victory-gpu/src/builder_lean.rs:45-55reads the switch, warns loudly when it is set withoutVICTORY_HW_RT=1, and explains why. That is the model the rest of the stack should follow — with the exception thatVICTORY_HW_RT_LEAN_BUILDERis, likeVICTORY_HW_RT, documented nowhere.Also,
builder_lean.rs:284tells the user to run without the switch when a build the title reads was skipped, i.e. the failure mode is a visibly wrong picture and the recovery is a restart. For an experimental switch that is acceptable only if the loss is also counted somewhere a tester can read afterwards; today it is printed, not counted.Staleness is the worst of the six (251 commits behind, five conflicting files, all in the shader emitter where main is moving fastest), so rebasing this branch is a project rather than a task.
Whether it still has work of its own is the maintainer's call, not mine.
@LOCKhart07 on GitHub · 2026-12-04 14:34 UTC · original
Split as asked: the lean builder is one branch,
rt-3-leanon my fork, on top of the two base branches (#468 is the first).On your two points:
VICTORY_HW_RT_LEAN_BUILDERis documented in both files. And the loss is now counted, not only said: the dispatches that read title memory by address while the builder was skipped go into thelean builder:report line ("a picture loss if not 0"). The requests it could not keep were already counted there.The bench above (a hang on one scene, 10 % slower on another) is not answered: I have not reproduced it and have no run of this branch on current main.
This one can be closed.
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.