Performance and quality plan: measure first, incremental texture detile, flicker, lighting, memory, reproducibility #358
Labels
No labels
accessibility
already-solved
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
merged
needs-decision
needs-game-run
needs-rebase
not-merged
nvidia
obsolete
question
security
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/avatarmanz--VIctory-7900XTX#358
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?
@D4rkGh057 on GitHub · 2026-11-26 18:30 UTC · original
Summary
A consolidated, evidence-ranked plan for the limits listed in the README: busy-street chases at 6-10 fps with far longer single frames, 11-17 fps on foot, distant trees/plants/buildings flickering, dim rooms, textures that appear late, 40-46 GB of memory, and "tested on one PC only".
Method and caveat. This comes from reading the code, comments, README and
docs/findings.md(parallel read-only surveys of each area). Nothing here was built, run or measured. Figures are quoted from the repo's own comments/docs; where a figure has no run id, it says so. Every item states how to confirm it before changing code.How the limits relate
docs/findings.md, "Where a frame goes"), so the street-scene split is unknown and is the first thing to measure.Step 0: measure (no code change)
Run a busy-street chase with a
diagnosticsbuild and keep the log.copies per frame: ...line:textures X MB watched and changed, Y MB hashed, Z MB of them changed(texture CPU work).recording per frameline and the memory lines (printed every ~5 s fromcopystat.rs;VICTORY_MEMORY_MAP=<n>walks the address space).texlatelatency lines.VICTORY_TIMELINE=<file>for the chain of waits behind each present;timeline::spannames show the submit stages.docs/replay.md):--timing detailedfor the card-time split by pipeline.Decision rule for texture work: tens of MB per frame hashed/changed during streaming means continue with section 1; a few MB means stop and prioritise sections 2 and 3.
1. Incremental texture detile and upload (late textures, streaming spikes)
Current behaviour (
crates/victory-gpu/src/texture.rs):Staging::detile(~1498) detiles every held level when any byte changes; the upload records oneCopyTextureRegionper subresource every time (~843-892). No per-level or per-dirty-page path exists.tiles.rsheader).last.hashis set (~1389-1546), so the texture is not retried until its bytes change.Plan (one reviewable commit each):
Layout::level_range(mip, slice)invictory-formats(pure). Verifywalkalready holds this. Test: ranges coverlayout.sizewithout overlap except packed tail mips, for BC1, BC7, RGBA8, 3D.u32mask inStaging, set fromwatch::writes(page to range to levels) or a per-level digest. Any uncertainty means all dirty.serial. Reset to all dirty when staging is dropped (let_go_idle), the serial changes, or a lowerfirstis requested.Risk: a mistake shows as a wrong texture and no existing test catches it visually. Needs the equivalence test plus an independent image and counter comparison against the previous build.
Follow-ups: replace the 30-frame poll with a page-arrival signal (check whether
watch::remappedcan feed it); per-level digest for partly mapped textures.VICTORY_TEXTURE_STORE(off, ~8 ms/frame per README)The 8 ms may predate commit
7e82cf5(work moved to the store thread); re-measure first. To enable by default it also needs: a disk size cap and LRU (nothing is ever trimmed), an index format version and GPU/driver in the key (blobs hold host-layout bytes), a check of the assumption that shape plus 32 KiB of small levels determine the large levels, tests beyond index parsing, coverage decisions for array/MSAA/multiplane/XOR-swizzle/on-demand textures, and=1currently creates a folder literally named1.2. Frame time: submit thread and card
Submit thread (
queue/behind.rs,Host::submitinhost.rs)Older water run, stale, no run id: lists' steps ~18 ms (refreshes ~10), card steps ~7, descriptor-record wait ~6, write-watch ask ~5, copies in card memory ~4, title bytes under shader writes ~4. Since reduced by ports 5-7 (README).
Concrete items:
VICTORY_PORT_JOURNAL(-1 to -3 ms),VICTORY_PORT_GUARD(-2 ms),VICTORY_PORT_CBV(-4.7 ms),VICTORY_PORT_DESCRIPTORS. Needs thedoctor/build-check work in section 6 first, because ports 1 and 2 depend on one build's offsets.late_blockedread-after-flight hazards.VICTORY_CARD_BUFFERS_MIN_KB=64is documented as not yet measured.Card (~36 ms; no published split)
Measured with the replay tool (
--compare --loops 5 --timing detailed; differences under 5 % are noise per the docs):--buffers vramthen--buffers sysmem, bisect with--only-buffers min=...; if it wins setVICTORY_CARD_BUFFERS_MIN_KB=64. No number exists for it.--skip-clamps(bound the cost) and--batch-clamps 2(off by default; risk: stale arguments).--skip-hash-passes(pure measurement; hash/compare passes cost ~13 ms card time per findings).--merge-barriers(~2.4 ms of 79.5 on capture replay5) andVICTORY_UP_QUEUE=1(~5 ms of up-copies; no measured gain).--skip-shader <hash>,--shadersA/B,--retranslatefor the page-directory lookup invictory-shader/src/emit/lower.rs(~3579-3600, cost unmeasured).VICTORY_OUTPUT=1920x1080(about 16 ms of card time) but it changes the output size.Pipeline and shader caches (CPU stalls on first run)
pipeline/library.rssaveserializes the whole library whenever any pipeline was added (1,352 MB quoted in a comment). Grows with the number of pipelines.pipeline/host.rs).TRANSLATOR_VERSIONentries even if the translator changed; the 13 env vars in the key are listed by hand (shader_cache.rs), so a new switch not added there gives stale hits.pipeline.rs:9-11(mesh pipelines exist).3. Distant flicker (trees, signs, plants, far buildings)
No diagnosis exists; only one documented hypothesis. Candidates, ranked, each with the experiment that confirms or rules it out:
docs/findings.md:93-95,indirect.rs:296-304): one bad indirect record takes the rest of the list's budget so later records run empty, and which record it is may differ per frame. Read the frame line's "indirect records ... ran empty for want of their list's budget" count at a flicker spot; run withVICTORY_INDIRECT_REST=0,VICTORY_INDIRECT_WINDOW=1,VICTORY_INDIRECT_BATCH=0/2.docs/replay.md:111-117): recorded copies from another run can make draws read another run's lists. Use--diverge/--diverge-picture; more than one outcome from identical memory confirms it.VICTORY_POP_WATCH=<from>-<to>separates one-frame blips (stale/neutral texture) from lone blocks and steps (draw-set changes); togglesVICTORY_KEEP_VIEWS,VICTORY_KEEP_SHOWN.victory warm, then re-run; if it disappears, pipelines are the cause.VICTORY_RDNA_FLOAT,VICTORY_SKIP_PIPELINES=<hash>.Unknown: whether it also happens with ray tracing off (the README lists it under both). Rect-topology indirect draws and sampler/descriptor heap caps were not examined.
4. Lighting and dim rooms
-RayTracingare partly by design: the ambient stand-in is off unlessVICTORY_AMBIENTis set (ambient.rs:86-103), and it is skipped whenever the ray-tracing builder runs. Cheap test: makeVICTORY_AMBIENT=1the default when the builder is off, and compare dorm/sunset scenes (alsoVICTORY_AMBIENT_AIRfor the "brown veil").VICTORY_LIGHT_PROBE=probe.csv(andVICTORY_LIGHT_PROBE_LUX=1, which once lost the device) in three configs: stand-in on / builder on /VICTORY_AMBIENT_SETTLE=0. Ifexp/target/luxoscillate whiletitle,standinandwrittenstay flat, the loop is confirmed. Possible fix: make the estimate exposure-aware (divide by lux factor and exposure, then re-multiply).freshbound defaults to 0); tryVICTORY_AMBIENT_SETTLE=250,3,2and check for a spike right after a jump. The settle uses wall-clock time and a jump threshold of 3, so behaviour differs between a big and a small change; frame gaps over 1 s are treated as 33 ms.pipeline.rs): any dropped stage makesbuilder_runs()false for the next 2 frames, which also toggles the stand-in;docs/fork-ray-tracing.md:109-117reports only "8 of 65" and "48 of 275" dynamic structures good, with compacted sizes read 1-2 frames late. Log builder rests against probestandinand luminance jumps (VICTORY_BVH_TRACE=1).reports/LIGHT-POPIN.md(cited atambient.rs:134) is not in the repo.5. Memory (40-46 GB)
Documented split (
docs/findings.md:96): lists' allocators 9 GB, windows 7, uploads 4 (about 20 GB of host-side structures). The README says ~30 GB private plus 10.5 GB VRAM; the two figures disagree and neither has a run id, so measure first (private/workingfrom the memory line and aVICTORY_MEMORY_MAPwalk at the same place in a run).Savings below are estimates, not measurements:
SPARE_MOST/SPARE_KEPT/SCRATCH_CHUNK(host.rs:1971-1979); about 3-5 GB; risk: chunk churn and stalls.VICTORY_RESIDENCY=1as the default under 32 GB (the code exists,residency.rs).READbuffer intexture.rs(with_read) is sized to the largest texture seen and never shrunk.xmem.rsreservation policy, whether title memory could be committed on demand.6. Reproducibility (tested on one PC, one build)
Blockers, ranked:
descriptor_sites.rs(SITES),frame_rate.rs,resolution.rs, and the allocation hook at+0x1e86440inport.rs; there are no pattern scans.port.rsallocation hook fails softly.OpenExistingHeapFromAddress1, descriptor-heap limits fromprobe_view_limit); the reference machine is a Radeon RX 7900 XTX on Windows 11. See the update below for the first report from another setup.indirect.rs:1426asserts AVX.play.ps1sets ~20 machine-tuned variables and deletes otherVICTORY_*variables.ci.yml) cannot catch any of this: game/GPU tests are#[ignore]and patch tests use synthetic bytes.Update (from the comments below): first report from another setup. RX 7900 XT, RADV 26.3.1, game build 1.0.2.1 (the build the offsets target), Series X profile at 1280x720, Wine 11.22 (so Linux), AMD branch launched directly with the BVH builder off and the ambient fallback at 0.8;
play.ps1 -Safenot tried. A 32-minute session ran, so the layer works at least to that extent outside Windows. This changes the picture in two ways:OpenExistingHeapFromAddress1and the write-watch behaviour (MEM_WRITE_WATCHinxmem.rs) are handled under Wine, and whether the descriptor-heap limit probe gives the same result on RADV.Concrete improvements:
victory doctoroutput below also report the OS/translation layer (native Windows vs Wine), the driver (name and version) and the number of patch sites applied versus skipped, so reports from different setups can be compared at a glance.victory doctorpreflight (low risk): OS build, CPU features, each adapter (name, vendor/device ID, VRAM, SM level, mesh tier), whetherOpenExistingHeapFromAddress1works,probe_view_limitresult, game exe version and a.texthash, and a per-site "would patch / would differ" report..github/ISSUE_TEMPLATEasking for thedoctoroutput, build hash,play.ps1flags,-Saferesult and log.doctoras a smoke test, test that the patch tables leave bytes untouched on a synthetic mismatched image, add a build-id table test.-Safetroubleshooting path.Suggested order
doctorpreflight and issue template (low risk, enables others to report).Not verified
Everything above is static reading. In particular: the street-scene breakdown of the 40 ms, the split of the 36 ms card time, the cause of flicker, the share of memory by contributor, and whether
texstore's 8 ms is current.@UwUCammie on GitHub · 2026-11-26 18:52 UTC · original
For the indirect-budget hypothesis in section 3, I checked a 32-minute play session on an RX 7900 XT. All 1,850 reporting intervals displayed 0.00 indirect records per frame lost to budget exhaustion. Two saved-game replays, with async texture uploads on and off, also kept the porch rail stable over an 11-second stationary view. I haven’t reproduced the distant geometry flicker in that spot. If someone gets a repeatable spot, the camera position would help tie the counters to the affected object. Waterfront test notes
@D4rkGh057 on GitHub · 2026-11-26 19:08 UTC · original
Thanks for running this, and on a different card (RX 7900 XT) too, which is useful for the reproducibility point in section 6.
On section 3: a zero count across 1,850 intervals means that hypothesis has no evidence in that session, but I don't read it as ruled out. The counter only tells us something at a spot where the flicker actually happens, and the report says it was not reproduced there. If the count stays at zero at a spot that does flicker, hypothesis 1 drops and the culling-atomics and LOD/streaming candidates (2 and 3) move up.
What would make the next test conclusive (all of this is from reading the code, I have not run it myself, so please correct any flag that has changed):
indirect records a frame ran empty for want of their list's budget(and "the largest cost of one") for that window only, not the whole session.VICTORY_INDIRECT_REST=0, thenVICTORY_INDIRECT_WINDOW=1, thenVICTORY_INDIRECT_BATCH=0and=2. If the flicker changes with any of them, the indirect path is involved even when the counter is zero.VICTORY_POP_WATCH=<from>-<to>withVICTORY_POP_FOLDER. One-frame blips point to stale or neutral texture content; lone blocks and steps point to draws appearing and disappearing (culling or budget).victory warm, then repeat. If it disappears on a warm second run, host pipelines not being ready is the cause.--diverge/--diverge-picture(docs/replay.md). More than one outcome from identical memory points at the culling atomics.When reporting, please include: adapter and driver version, game build id, the
play.ps1flags (and whether-Safechanges anything), and the log lines from steps 2 and 4.@UwUCammie on GitHub · 2026-11-26 19:15 UTC · original
For the waterfront sample: RX 7900 XT, RADV 26.3.1, Xbox 1.0.2.1, Series X at 1280×720 on Wine 11.22. I launched the AMD branch directly with the BVH builder off and the ambient fallback at 0.8. I haven’t tested the play.ps1 -Safe preset on that route. The last 11 seconds of the porch rail were stable, so I don’t have a failing camera position or a pop-watch interval to attach yet. I’ll use the 60-second stationary window and change one indirect setting at a time if I can reproduce it. I’ll include the budget and pop-watch counts for that window.
@D4rkGh057 on GitHub · 2026-11-26 19:27 UTC · original
One small question that would help interpret your runs: on the Wine setup, did the build-specific patches apply? Each site that does not match the build leaves a warning in the log containing
not patchedand(another build?)(fromdescriptor_sites.rsandframe_rate.rs). If you still have a log from the 32-minute session, searching it foranother build(ornot patched) and pasting the lines, or just saying there were none, is enough. It tells us whether your run takes the same code paths as the reference machine.No rush, and no need to reply before you have the flicker spot.
@UwUCammie on GitHub · 2026-11-26 19:28 UTC · original
I searched the full 32-minute Wine play log, case-insensitively. Zero lines contain “another build” and zero contain “not patched”. The loader did log a successful 1280×720 scene / 3840×2160 interface patch. I used the stock frame timer and had the descriptor-store port off for this run, so those two optional patch paths weren’t exercised.
@D4rkGh057 on GitHub · 2026-11-26 20:12 UTC · original
Thanks, that settles the patch question for the paths you ran.
One more thing, optional and needing no new run: your 32-minute log probably already contains the numbers that decide whether the texture work in section 1 is worth doing at all. Could you paste a few sample lines from it (a quiet moment and a busy one, such as fast travel or a chase if you have one)?
copies per frame: ...line. The part that matters is the end:textures X MB watched and changed, Y MB hashed, Z MB of them changed.texlate(how long a texture takes to be shown after the title asks for it).private,working, and the "what holds it" part).If the texture figures are a few MB per frame, section 1 can wait. If they are tens of MB during streaming, it becomes the next thing to look at.
A caveat so nobody over-reads it: 1280x720 on Wine is not the reference setup, so the absolute numbers won't match the 4K ones. This is only a first signal. The incremental detile itself is only a plan for now, there is nothing to test yet.
@UwUCammie on GitHub · 2026-11-26 20:27 UTC · original
The 32-minute session does show tens of MB of texture source reads per frame. After the first two minutes, 346 of 351 reporting intervals were at or above 10 MB/frame, with a median of 35.0 MB/frame. The release build counts the bytes returned by each texture refresh. It doesn’t break those bytes into watched, hashed and changed, so the log alone can’t say how much incremental detiling would save. Counter in the tested source
I picked the first two near the 10th and 90th percentiles by read volume. I don’t have a chase or fast-travel marker for them.
There were no
texlatelines. The last upload-ahead counter reported 545,000 uploads, 2.4 ms average from request to upload, 318 ms longest. The separate show-after counter reported 1.1 million texture slots, 0.59 frames from request to showing the slot on average, four frames longest. Those counters cover different populations.The log has no process private/working-set breakdown or “what holds it” line. Immediately after swap-chain creation it reported 147 MB local GPU memory in use against an 18,018 MB budget and 16 MB shared in use against 28,538 MB. That’s a startup reading. This was the 1280×720 Wine run on the RX 7900 XT, RADV 26.3.1.
@UwUCammie on GitHub · 2026-11-26 20:33 UTC · original
I found two implementations in the fxceless fork that may save some work on the incremental detile. PR 1130 reads and detiles individual written pages for eligible write-watched textures. It still uploads the whole subresource and its author tested it on synthetic inputs. PR 1174 also narrows the upload for synchronous single-list cases and reports a GPU readback comparison on an RTX 2070 Super. Both PRs are open. I haven't measured either on the 7900 XT.
@D4rkGh057 on GitHub · 2026-11-26 21:21 UTC · original
Thanks for the pointers. I read both PRs and left two questions about PR 1130 on the PR itself, for its author. Page granularity is finer than the per-mip split in section 1, so if it holds up it should replace that part of the plan.
One thing from your side would still settle whether any of this matters: the
copies per frameline (the parttextures X MB watched and changed, Y MB hashed, Z MB of them changed) from a quiet moment and a busy one. If it is a few MB per frame, the texture work can wait.