Card memory: send buffers used again, structures in shared blocks, textures placed tight (on #262) #306
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!306
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-306"
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 10:06 UTC · original
LOCKhart07:vram-fixes→main· +19092 −133 · 31 files · 7 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.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: the first commits here are that PR's, and only the last three are new. Until #262 merges, read those three (or compare
hw-rt-queries...vram-fixes).Three changes to how much of the card's memory the runtime holds, each its own commit, each measured from one run's own report lines on an RX 9070 XT (RADV), 2560x1440 native, six minutes with the camera turning,
VICTORY_HW_RT=1.1. Send memory: buffers used again, idle ones let go
Every submission in flight made an upload buffer of its own and a buffer given back was used again only by a request of exactly its size, so most were made new. About 570 MB of them stood on the card at the end of a six minute run.
Buffers are now made at powers of two and kept spare for the next request; spare ones not taken for 10 s go, through
host::retire.2. Bottom-level structures in shared blocks, by how long they live
Every host bottom-level structure was a committed buffer of its own: 73,703 buffers made in 6.9 s of one play (the longest 73 ms), 363 MB lost to 64 KiB placement.
They are now cut from 64 MiB blocks at 4 KiB (
VICTORY_HW_RT_ARENA, on by default;=0is the old way). Two sets of blocks: one for structures built in full and not updatable, which are compacted or replaced within moments, one for those that stay. In one set the short-lived left holes among the long-lived and no block ever emptied (1,664 MB of blocks for 888 MB of structures); in two, 1,280 MB for 1,023 MB with nothing resting, and the short-lived set's blocks do go back (6 made, 4 given back).The gain is the buffers no longer made. The bytes are about what the buffers took; the two figures are from different scenes, so this is not claimed as a saving.
3. Texture blocks: tight alignment
Every texture cut from a texture block took a multiple of 64 KiB, and most of the title's textures are small: 1,599 MB of copy footprints lay in 2,760 MB of pieces.
A texture is now asked with
D3D12_RESOURCE_FLAG_USE_TIGHT_ALIGNMENTwhere the host reports the tier, and its piece is exactly the size at the alignment the host answers. A host without the tier is asked as before.Part of what was saved went to textures that had been held back for room; the rest shows as lower use. The two columns are consecutive runs of a streaming scene, not a controlled pair.
On the earlier 4 KiB placement (
VICTORY_POOL_SMALL, removed after two device losses): what those were was not proven, and I could not make them happen. The new testpool::tests::small_textures_placed_back_to_back_keep_their_own_bytesplaces 11 kinds of small texture three times over back to back, starting at the offset and with the kind of texture of those losses, in each way of asking (alignment 0, 4 KiB, the flag). Every level is written with bytes of its own, read back by a copy, then read by a shader through a whole-chain view and a per-level view and compared with the same texture on a 64 KiB multiple: 500 reads compared, none differ. Unlike that code, this asks once (the flag is never refused, where a 4 KiB request is for a large texture) and makes the texture with the description the size was asked for.What to know before merging
pool14,hwrt47,host::send6,resource16,texture11, all passing), because an unrelated test crashes under Wine here.New report lines
What submissions send up; host buffers by who makes them; the blocks of structures of each set; the build memory (held, asked against handed out, buffers made, the spare by size and how much of it sat untaken); texture blocks by fill with footprints against pieces; texture queue slots held back for room.
🤖 Generated with Claude Code
@Luxuride on GitHub · 2026-12-04 12:09 UTC · original
Three good commits buried inside a 19,092-line diff nobody will ever read. Please split.
What I measured:
git diff <base> pr/306is 19k insertions, butcrates/victory-shader/src/emit/rayquery.rs(8,269) andcrates/victory-gpu/src/hwrt.rs(7,312) come from the hardware-RT base and are not touched by20547ee,0c411bbor9bba82d. You are asking a reviewer to read a diff you did not write.Two of the three are RT-independent and can go to
mainon their own merits this month:20547ee— recycling per-submission upload buffers (power-of-two sizes, 64 KiB floor, 768 MB spare cap, 10 s idle trim,host::retire).9bba82d—D3D12_RESOURCE_FLAG_USE_TIGHT_ALIGNMENTwhen the host reports tier ≥ 1.0c411bb(the structure arena) rides with the RT stack, not before it.Findings worth folding into those splits:
9bba82ddrops the "ask again withAlignment = 0" fallback thatmainstill has atcrates/victory-gpu/src/pool.rs:953-970. Right call — the flag cannot be refused — but the old path also covered hosts that answerAlignment != 0for a desc asking 0, and the new code trustsinfo.SizeInBytes != u64::MAXalone. Onedebug_assert!(info.Alignment <= 64 << 10)would say what you believe.crates/victory-gpu/src/hwrt.rs:1476:VICTORY_HW_RT_ARENAis on by default inside a feature that is off by default, andgit grep -n HW_RToverdocs/andrun.conf.defaultfinds zero hits forVICTORY_HW_RT,_DEMOTE,_PACK,_ARENAor_REUSE. Every switch the project already ships is in both files. That is the cheapest fix in the whole stack.crates/victory-gpu/src/descriptor/host.rsandcrates/victory-shader/src/lib.rsare inherited from the base too — neither file is touched by your three commits. Rebasing this branch alone will not clear them; the stack has to be rebased as a stack.The commits themselves are the best-documented work in this batch: before/after numbers, three runs, loss counters, tests with names that say what they prove.
@LOCKhart07 on GitHub · 2026-12-04 14:34 UTC · original
Split as asked.
rt-4-arenaon my fork, in the ray tracing stack (#468 is its bottom).main-texture-report), which I can open if you want it.On your findings: #459 has the
debug_assert!(info.Alignment <= 64 << 10)(pushed as a second commit, with why no multisampled texture reaches the blocks).VICTORY_HW_RT_ARENAis documented in both files, with its default of on said.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.