Proposal: upload textures picked by index by what shaders sampled, and let go of the least recently sampled (RX 9070 XT numbers) #1423
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/fxceless--victory-fork#1423
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@Granite900 on GitHub · 2026-11-27 01:52 UTC · original
The textures shaders pick by index (
draw.rsheap_textures) are uploaded in the queue's order and let go when nothing names them. The layer cannot see which of them a frame samples. When the card cannot hold them all, what is on screen waits behind what is not, and textures still in use are let go and made again. This proposes that the translated shaders report what they sample, so that the queue uploads that first and lets go of what has not been sampled lately. I am asking before writing any of it.What it looks like on a 16 GB card (RX 9070 XT, driver 32.0.32029.2010, Ryzen 7 9850X3D, 32 GB)
Base
4c60466with #452's change (the AMD compiler crash), diagnostics build, the test switch set plusVICTORY_TILES_SMALL_WHEN_FULL_MB=512. Café scene of the opening, about 2 minutes a run. Frame shots (VICTORY_SHOT) were taken with the waitress on screen.VICTORY_BAKE_SOURCES=full=full,VICTORY_CARD_WINDOWS_MB=512=1(half of #1422),VICTORY_TEXTURE_ROOM_PERCENT=96=1with #1422, 96 %The card stayed at 12.4–12.7 GB of a 13.9 GB budget. In a usual frame the card is idle 72–84 ms of about 125 ms (frame log, warm shader cache). So the card has room to spare in time, but not in memory.
The switches only move the line between faces and speed. More room fixes faces, but it costs frame time because the buffer windows leave the card, and it makes textures churn. On 8 GB cards #898 shows the same queue that never drains (15–19 k waiting). There, too, the line
resource::roomdraws while room is kept for targets and copies not made yet holds the queue back with gigabytes unused. #1422 takes the skin bake's sources out of that line. This proposal is about everything else.What other layers and engines do
VICTORY_TILES_SMALL_WHEN_FULL_MB).This layer translates every shader, so it can add that report itself.
Proposal, in steps that each measure on their own
emit::shaderheap_handle;lowercalls it) also sets bit index in a buffer of one bit per view slot (2,097,152 slots = 256 KiB), with one atomic OR. The layer reads the buffer back a frame later and clears it, then logs a line: slots sampled this frame, of them with no host copy, and with only small levels. No upload or eviction changes. This says how much of the queue is ever sampled, and how much of what is sampled is missing.Questions
lower.rsis over the 512 KiB policy limit, so the hook refuses any commit that touches it. Step 1 may fit inemit/shader.rsand the GPU crate alone. If it does not, is a split oflower.rsplanned?I can build step 1 and measure it on this card if this direction is wanted.
AI-assisted (Claude Code); no game data.
@akimfomin on GitHub · 2026-11-27 02:03 UTC · original
For the record-only stage, I checked the descriptor lifetime at your
4c60466base.HostHeap::publishalready refuses a queued update when its view index/generation no longer matches. A frame-delayed bitset needs the same distinction: if the GPU sampled A at slot 240 and that slot holds B at readback, applying the bit to B would create a false hot texture. Matching a slot alone also aliases two shader-visible heaps.A first synthetic fixture could contain one true sample, one constructed handle that is never sampled, and one sampled slot recycled before the CPU consumes the feedback. Only the stable sample should be eligible to affect scheduling. If the exact heap/view epoch the commands saw is unknown, count the mark separately rather than using it for eviction. A minimal CPU model passed these four controls (including two heaps with the same slot). No hardware or overhead result yet. PortBridge can help repeat the fixture once the record-only prototype is available. AI-assisted source review with OpenAI Codex.
@Granite900 on GitHub · 2026-11-27 02:14 UTC · original
Agreed — a slot alone isn't enough. Step 1 will keep, per submission, the
(heap, index, generation)key each sampled slot held when the commands were recorded, and match the readback against that snapshot rather than the live slot; marks whose key no longer matches (or whose heap is unknown) are counted separately and never feed eviction. The three-case fixture (true sample, constructed-but-unsampled handle, recycled slot) plus the two-heaps-same-slot case will go in as unit tests with the prototype.