Heap textures (picked by index) are re-fingerprinted on a schedule that ends, so later in-place changes show late or are never seen #337
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/Belobug--VIctory-Belobug-AMD#337
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?
@adrianmjim on GitHub · 2026-11-26 20:47 UTC · original
On
a-publieratcd8dfc0, a texture that is bound only through the descriptor heap ("picked by index") and uploaded whole from title memory is looked at again only on a fixed schedule. After the fifth unchanged look it is never looked at again unless a descriptor write or a remap makes it due. For textures over 48 KiB, the fingerprint covers only three 16 KiB windows. In a real run, the warning that reports these changes hit its 200-line log cap.origin/rx9070xtis the same commit, so the same code applies there.origin/mainuses a different scheme (see "Other trees" below).Setup
cargo build --locked --profile diag -p victory --features diagnosticsatcd8dfc0.--console series-swith thescripts/play.ps1defaults, plusVICTORY_PORT_CONSTANTS/DESCRIPTORS/CBV/GUARD/JOURNAL=1andVICTORY_PIPELINE_BOOK=1.VICTORY_RECHECK_SOON,VICTORY_HEAP_RECHECKandVICTORY_PAGE_WRITESwere left at their defaults.How the recheck works (code,
cd8dfc0)draw.rs:734:RECHECK_FRAMES = [4, 12, 40, 120, 400]. Each wait counts from the look before, so after a first upload the looks come at 4, 16, 56, 176 and 576 frames.draw.rs:2444-2458: if a look finds the texture unchanged, the next look is scheduled. After the last look the slot goes totexture_slot_done(L2452).recheck_soon()(L204,VICTORY_RECHECK_SOON, on by default) sets the next wait to 1 frame. The re-upload then restarts the chain atlooks=0(L2631, L2756). The looks after that come at +1, 13, 53, 173 and 573 frames (nominal).BAKE_AHEAD, L213, L2336). The slot, byte and time budgets can push looks later.texture.rs:1566:fingerprint()hashes the whole range when it is 48 KiB or less. Otherwise it hashes 16 KiB at the start, 16 KiB at(len/2) & !0xfffand the last 16 KiB.HEAP_TEXTURES_RECHECKED, L738), but nothing prints them.So a texture that changes every frame is already looked at every frame, about one frame late. The code comment at L2439-2443 describes this case. Three gaps remain:
What the log shows (observed)
The warning
a texture picked by index changed after its upload with nothing to tell of it(draw.rs:2477) is printed while n < 200, and after that only when n is a multiple of 1000.changed= 1..200 and nochanged=1001, so the run total is between 200 and 1000. The cap was reached about 75 s before the log ended, so the rest of the run is not visible.textures picked by index: N uploaded so farline reads 123519 (8220 MB). That count includes re-uploads and comes from a different moment, so it is only a rough comparison.blocks_shown_elsewhere > 0. This counts the 64 KiB pages of the range that the title shows at other addresses too (inplace.rs:391). For a texture under 64 KiB it counts the page that holds it, which neighbouring data may share.lookswhen the change was found: 0 x8, 1 x58, 2 x116, 3 x9, 4 x9. Only 8 changes were caught by the first look after an upload (2-6 frames after it). Most came after one or more quiet looks.Neither of the other notification paths caught these changes. The look itself found them, which is what "nothing to tell of it" means.
REMAPPED(descriptor/host.rs:2042) makes slots due on remaps only.PAGE_WRITTEN(descriptor/host.rs:809) makes slots due only whenVICTORY_PAGE_WRITEShas bit 2 set (1,slotsorall; the default is bit 1 only, seewatch.rs:3296). The run's summary line reports 0 DirectStorage writes and 0 slots, soVICTORY_PAGE_WRITES=slotswould not have helped here.Not shown or not tested
blocks_shown_elsewherecount suggests writes through another view of the same pages, but that is not confirmed.Related
5d6bd84(prelude upload) does not touch this pass.Other trees
origin/mainhas none of this code. Itsdescriptor/host.rs(~L278-288) re-hashes bindless placed textures at most every 15 frames, with up to 32 rechecks per frame, from a round-robin queue. It has no final look and no window fingerprint. With many slots, though, the per-frame quota can stretch the real interval well past 15 frames, and #61 notes that entries popped past the quota are not re-queued. A fix for main would look different.Possible next steps
Runs I can do on this RDNA3 machine once pipelines are warm:
VICTORY_RECHECK_SOON=0and withVICTORY_HEAP_RECHECK=0, to see whether stale textures are visible and which sizes or slots matter.Fix outline (not tried yet):
HEAP_TEXTURES_RECHECKED[0/1]in the periodic summary, and keep some record past the log cap (for example a per-slot count) so the true total is visible.texture_slot_doneafter the fifth look if it has been found changed before. Either keep a slow periodic look (for example every 400 frames), or keep slots that have changed more than once on a shorter cycle.watch.rsalready spreads writes to every view of a page (elsewhere()atwatch.rs:1208, withinplace::pages_ofatinplace.rs:414), but only for guarded host copies. Heap texture slots never ask it.@adrianmjim on GitHub · 2026-11-27 06:24 UTC · original
In-game A/B on RDNA3:
VICTORY_HEAP_RECHECK=0vs default, opening cutsceneSetup: RX 7900 XT (RDNA3), driver 32.0.32029.2010, Windows 11 26300, 32 GB RAM. a-publier
cd8dfc0diag build,--console series-s,scripts/play.ps1defaults plus the fiveVICTORY_PORT_*=1. The pipeline cache was warm:victory warmhad made 83,558 pipelines. I ran three passes back to back with the same data dir:VICTORY_HEAP_RECHECK=0.Each pass went from the title screen into the opening in-engine cutscene, ran ~4 min with no input, and then I closed the window. The window runs from the
the first frame of 500 draws or moreline towindow closed.VICTORY_CAPTURE+VICTORY_CAPTURE_WORLDsaved one half-size frame every 8 frames.Measured over that window (fps from the 5 s
fpslines):HEAP_RECHECK=0)changed after its uploadWARN lineswaiting for their memory, medianThe recheck does not explain the fps gap:
being made> 0.P (recheck on, ports off) had 108
changed after its uploadlines. That count is exact, because its total of 120 stayed under the cap. In the first 178 s P had 49 lines and A had 197.What I saw. I aligned the captures by wall clock from the 500-draw line. The cutscene is time-driven and the two passes match within ~0.5 s for most of it.
3D shots. No difference between A and R. I compared 156 well-aligned pairs in 24 px blocks at full size and found no localized change. Everything else that differs is timing, blinking lights or ambient traffic.
2D illustrated cards. One difference shows only in R. Near the end there is a run of 2D cards, each a text layer over an illustration. In R the new illustration comes in later than its text, and the lag grows with each change:
In A (95281 -> 95289) and in P (2980, then 2988-3012), each text arrives with its own illustration, and the last card's illustration is on screen for ~2 s. R drew these cards at ~18 fps, P at 15-17 and A at ~3, so R was not simply slow.
This fits the issue: a heap texture updated in place that, with no recheck, is only picked up when something else makes the slot due. It is a delay, not a texture frozen for good, because the earlier cards do update. I did not tie these illustrations to specific slots in the log.
R had two other odd captures, each a single frame right at a cut. A and P have no capture at the same moment, so I am not counting them.
Not tested: