Hardware ray tracing: build idle updatable structures again as compact ones (VICTORY_HW_RT_DEMOTE=1, off by default, on #306) #323
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!323
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-323"
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 13:58 UTC · original
LOCKhart07:rt-demote→main· +20120 −133 · 31 files · 8 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.VICTORY_HW_RT_DEMOTE=1). On #306. (this one)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 #306 (which is on #262). Only the last commit is new here; it touches one file,
crates/victory-gpu/src/hwrt.rs. Off by default:VICTORY_HW_RT_DEMOTE=1, and it only does anything withVICTORY_HW_RT=1.What is wrong
A bottom-level structure the title updates twice within a second is built with ALLOW_UPDATE from then on, and it stays that way for good. Much of what earns that is updated for a while and then left alone, while the top level still reads it.
On RADV an updatable structure has a fixed layout of about 177 bytes a triangle that compaction cannot shrink. A compacted one that is not updatable takes about 46. So the idle ones hold most of a gigabyte and more that they do not need.
What this does
Not covered, and left as they are: inputs under 256 KiB, inputs decoded or staged in place, boxes, and copies.
One change applies with the switch off too: a spare piece of the build pool is now picked by how lately it was used, and one idle for 10 s is let go. That part alone was not shown to gain anything in play.
Measured
RX 9070 XT, RADV (Mesa 26.3.1), 2560x1440, nine minutes of driving, one run with the switch on.
The picture looked as before.
What it does not do
Tests
hwrtmodule: 57 passed. New ones cover the verdict table, the swap at the card point, refits and copies tapped before the swap, an update after the swap not being a refit, which inputs are kept, the pick and the wait, and the pool of kept pieces. Only this module's tests were run.🤖 Generated with Claude Code
@Luxuride on GitHub · 2026-12-04 12:02 UTC · original · edited 2026-12-05 11:24 UTC
This copy is contained in the later PR as I read it: the content is wholly contained in the later PR in the stack, so nothing is lost — the delta worth reviewing is the one from the previous branch to this one, i.e. the ~1,100 lines of
hwrt.rs.Two things from here that should survive into the PR that lands:
LEASE_IDLE_MS = 10_000at every card point (crates/victory-gpu/src/hwrt.rs:836, 892-899, 3392), independent ofdemote_on()(hwrt.rs:1140). Your own commit body says that part alone was not shown to gain anything in play — exactly the reason it belongs behind the switch or in its own PR, not folded into a 1,100-line feature.unsafe impl Send/Sync for Inputs(hwrt.rs:1134-1136) makes a struct holdingVec<ID3D12Resource>cross-thread shareable on the strength of a two-line SAFETY comment, andkeptis#[allow(dead_code)]so nothing here proves the sharing is ever exercised. COM refcounting is free-threaded so it is probably right, but this is precisely what a reviewer must be told to check.The 448-demoted / 1,695 MB → 455 MB measurement on your RX 9070 XT is the useful part — make sure it survives in the PR that keeps the code.
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:
rt-5-demoteon my fork, showing only its own change.On your two points:
VICTORY_HW_RT_DEMOTE=1. Without the switch the pool is as it was before this change; a test holds that.SAFETYcomment onInputsnow says where one is made, how it reaches another thread, what that thread does with it and why each is sound, and whykeptis never read. No test exercises the sharing (it needs a device and two host threads); the comment says that too.The 448 demoted, 1,695 MB to 455 MB measurement is in the commit that adds the switch and in
docs/SETTINGS.md.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.