Performance and quality plan: measure first, incremental texture detile, flicker, lighting, memory, reproducibility #358

Open
opened 2026-11-26 18:34:28 +00:00 by github-bot · 9 comments
Owner

@⁠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

  • The README says the frame is set by the thread that submits the title's work (~40 ms) while the card needs ~36 ms and waits ~7 ms. The only per-stage breakdown of the submit thread in the docs is an older water run (docs/findings.md, "Where a frame goes"), so the street-scene split is unknown and is the first thing to measure.
  • Texture detile/upload work runs on refresh threads, not the submit thread, so the incremental detile below will not by itself fix the 6-17 fps. It targets frame spikes during streaming, late textures and some memory.

Step 0: measure (no code change)

Run a busy-street chase with a diagnostics build and keep the log.

  1. copies per frame: ... line: textures X MB watched and changed, Y MB hashed, Z MB of them changed (texture CPU work).
  2. recording per frame line and the memory lines (printed every ~5 s from copystat.rs; VICTORY_MEMORY_MAP=<n> walks the address space).
  3. texlate latency lines.
  4. VICTORY_TIMELINE=<file> for the chain of waits behind each present; timeline::span names show the submit stages.
  5. Replay (docs/replay.md): --timing detailed for 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 one CopyTextureRegion per subresource every time (~843-892). No per-level or per-dirty-page path exists.
  • Non-held levels are zero-filled and copied on every refresh (~1535).
  • Partly mapped textures are re-read, hashed and detiled, and polled at most every 30 frames (~1331): a new mip can show up to 30 frames late.
  • Tiles are never returned until the host copy dies (tiles.rs header).
  • A failed detile returns early after last.hash is set (~1389-1546), so the texture is not retried until its bytes change.

Plan (one reviewable commit each):

  1. Layout::level_range(mip, slice) in victory-formats (pure). Verify walk already holds this. Test: ranges cover layout.size without overlap except packed tail mips, for BC1, BC7, RGBA8, 3D.
  2. Dirty-level u32 mask in Staging, set from watch::writes (page to range to levels) or a per-level digest. Any uncertainty means all dirty.
  3. Detile only dirty levels; re-zero non-held levels only when their held state changes. Key test: incremental equals full detile for random bytes changed in one, several and all levels.
  4. Upload only dirty subresources, only while the host texture persists with the same serial. Reset to all dirty when staging is dropped (let_go_idle), the serial changes, or a lower first is requested.
  5. Retry policy for a failed detile (do not cache the hash on failure).

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::remapped can 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 =1 currently creates a folder literally named 1.

2. Frame time: submit thread and card

Submit thread (queue/behind.rs, Host::submit in host.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:

  • Make the opt-in ports the default once validated: VICTORY_PORT_JOURNAL (-1 to -3 ms), VICTORY_PORT_GUARD (-2 ms), VICTORY_PORT_CBV (-4.7 ms), VICTORY_PORT_DESCRIPTORS. Needs the doctor/build-check work in section 6 first, because ports 1 and 2 depend on one build's offsets.
  • Split one submission across two threads (stages 4-6 on one, 1-2 on another). Estimated 40 to 32-35 ms (my estimate, not measured). Risk: ordering and lost writes; the repo recorded a rare lost write in 6 of 200 stress runs, so run the stress test.
  • Pipeline the next submission's preparation (watch ask, stale-bytes compare) while the current one is sent. Gain unknown; risk: late_blocked read-after-flight hazards.
  • Unknown: how much of the lane's 40 ms is idle waiting versus work; VICTORY_CARD_BUFFERS_MIN_KB=64 is 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 vram then --buffers sysmem, bisect with --only-buffers min=...; if it wins set VICTORY_CARD_BUFFERS_MIN_KB=64. No number exists for it.
  • Clamp passes: 4,809 indirect executions per gameplay frame; batching already saved ~9 ms on an old replay frame. Try --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) and VICTORY_UP_QUEUE=1 (~5 ms of up-copies; no measured gain).
  • Per-pipeline cost: --skip-shader <hash>, --shaders A/B, --retranslate for the page-directory lookup in victory-shader/src/emit/lower.rs (~3579-3600, cost unmeasured).
  • Largest known lever: VICTORY_OUTPUT=1920x1080 (about 16 ms of card time) but it changes the output size.
  • Already tried with no gain per findings: wave sizes, fused multiply-adds, fast reciprocals, scalar loads, a second drawing queue, native console shader code.

Pipeline and shader caches (CPU stalls on first run)

  • pipeline/library.rs save serializes the whole library whenever any pipeline was added (1,352 MB quoted in a comment). Grows with the number of pipelines.
  • Root signatures are rebuilt for every PSO, with no cache (pipeline/host.rs).
  • Shader cache serves same-TRANSLATOR_VERSION entries 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.
  • Stale comment at 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:

  1. Indirect budget exhaustion (documented, 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 with VICTORY_INDIRECT_REST=0, VICTORY_INDIRECT_WINDOW=1, VICTORY_INDIRECT_BATCH=0/2.
  2. Non-deterministic culling atomics (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.
  3. Stale texture/LOD content while streaming: VICTORY_POP_WATCH=<from>-<to> separates one-frame blips (stale/neutral texture) from lone blocks and steps (draw-set changes); toggles VICTORY_KEEP_VIEWS, VICTORY_KEEP_SHOWN.
  4. Draws skipped while host pipelines are not ready: run victory warm, then re-run; if it disappears, pipelines are the cause.
  5. Shader precision / depth bounds (lower likelihood): 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

  • Dim rooms without -RayTracing are partly by design: the ambient stand-in is off unless VICTORY_AMBIENT is set (ambient.rs:86-103), and it is skipped whenever the ray-tracing builder runs. Cheap test: make VICTORY_AMBIENT=1 the default when the builder is off, and compare dorm/sunset scenes (also VICTORY_AMBIENT_AIR for the "brown veil").
  • Candidate for "too bright or too dark until the title has run a while": a feedback loop (the stand-in reads the previous frame, changes scene luminance, which feeds the title's exposure target and lux factor). Test with VICTORY_LIGHT_PROBE=probe.csv (and VICTORY_LIGHT_PROBE_LUX=1, which once lost the device) in three configs: stand-in on / builder on / VICTORY_AMBIENT_SETTLE=0. If exp/target/lux oscillate while title, standin and written stay flat, the loop is confirmed. Possible fix: make the estimate exposure-aware (divide by lux factor and exposure, then re-multiply).
  • Leftover memory after a room change is allowed up to 4x the estimate (fresh bound defaults to 0); try VICTORY_AMBIENT_SETTLE=250,3,2 and 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.
  • With ray tracing on, swings may come from the builder (pipeline.rs): any dropped stage makes builder_runs() false for the next 2 frames, which also toggles the stand-in; docs/fork-ray-tracing.md:109-117 reports only "8 of 65" and "48 of 275" dynamic structures good, with compacted sizes read 1-2 frames late. Log builder rests against probe standin and luminance jumps (VICTORY_BVH_TRACE=1).
  • Gap: the probe does not log builder state, structure count or ray hit rate, and only runs with the stand-in on and builder off. Adding those fields is a small, useful diagnostic. reports/LIGHT-POPIN.md (cited at ambient.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/working from the memory line and a VICTORY_MEMORY_MAP walk at the same place in a run).

Savings below are estimates, not measurements:

  • Lists' scratch allocators (9 GB): lower SPARE_MOST / SPARE_KEPT / SCRATCH_CHUNK (host.rs:1971-1979); about 3-5 GB; risk: chunk churn and stalls.
  • Shadow windows outside buffers (7 GB): drop never-copied window pages and shrink the grid; about 2-4 GB; risk: stale reads and shader-write correctness.
  • Texture pool (up to 4 GiB of 64 MiB blocks) and upload arenas: tighter caps and sooner release; about 1-3 GB; risk: prefetch hitches.
  • VICTORY_RESIDENCY=1 as the default under 32 GB (the code exists, residency.rs).
  • Per-thread READ buffer in texture.rs (with_read) is sized to the largest texture seen and never shrunk.
  • Tile heaps (64 MiB each) are returned only when entirely free.
  • The 1.3 GB pipeline library is a mapped file; check how much is in the working set before spending effort.
  • Not examined: xmem.rs reservation policy, whether title memory could be committed on demand.

6. Reproducibility (tested on one PC, one build)

Blockers, ranked:

  1. Pinned to one game build: fixed-offset byte windows in descriptor_sites.rs (SITES), frame_rate.rs, resolution.rs, and the allocation hook at +0x1e86440 in port.rs; there are no pattern scans.
  2. On another build the patches skip with a per-site warning and the game keeps running slower with no clear error. Not checked: whether the port.rs allocation hook fails softly.
  3. Narrow GPU assumptions (SM 6.6, mesh shaders, OpenExistingHeapFromAddress1, descriptor-heap limits from probe_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.
  4. 64 GB recommended; AVX2 is checked at runtime in two places but indirect.rs:1426 asserts AVX.
  5. play.ps1 sets ~20 machine-tuned variables and deletes other VICTORY_* variables.
  6. CI (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 -Safe not tried. A 32-minute session ran, so the layer works at least to that extent outside Windows. This changes the picture in two ways:

  • The "one PC" limit is really "one OS, one driver stack, one translation layer" and a second data point already differs on all three (and on resolution), so numbers from the two setups are not comparable without saying which is which.
  • Open questions this raises (not verified, I have not seen the logs): whether the build-specific patches applied or skipped with the per-site warning on that run, how OpenExistingHeapFromAddress1 and the write-watch behaviour (MEM_WRITE_WATCH in xmem.rs) are handled under Wine, and whether the descriptor-heap limit probe gives the same result on RADV.

Concrete improvements:

  • Make the victory doctor output 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 doctor preflight (low risk): OS build, CPU features, each adapter (name, vendor/device ID, VRAM, SM level, mesh tier), whether OpenExistingHeapFromAddress1 works, probe_view_limit result, game exe version and a .text hash, and a per-site "would patch / would differ" report.
  • One loud summary instead of per-site warnings ("build X unknown: 0 of 6 patches applied, expect slower"); fail fast if the allocation hook cannot attach.
  • .github/ISSUE_TEMPLATE asking for the doctor output, build hash, play.ps1 flags, -Safe result and log.
  • CI without assets: run doctor as a smoke test, test that the patch tables leave bytes untouched on a synthetic mismatched image, add a build-id table test.
  • README "supported builds and hardware" matrix and a -Safe troubleshooting path.
  • Pattern/signature fallbacks (medium to high risk: a hook on the wrong code corrupts rather than skips; keep the full-window comparison as the final check).

Suggested order

  1. Step 0 measurements (cheap, decides everything else).
  2. Cheap switch experiments from sections 2-4 (all existing flags, no code).
  3. doctor preflight and issue template (low risk, enables others to report).
  4. Incremental detile (only if step 0 supports it).
  5. Memory reductions guided by the measured breakdown.
  6. Submit-thread restructuring (highest gain potential, highest risk).

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.

**@⁠D4rkGh057** on GitHub · 2026-11-26 18:30 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/358) ## 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 - The README says the frame is set by the thread that submits the title's work (~40 ms) while the card needs ~36 ms and waits ~7 ms. The only per-stage breakdown of the submit thread in the docs is an older water run (`docs/findings.md`, "Where a frame goes"), so the street-scene split is **unknown** and is the first thing to measure. - Texture detile/upload work runs on refresh threads, not the submit thread, so the incremental detile below will not by itself fix the 6-17 fps. It targets frame spikes during streaming, late textures and some memory. ## Step 0: measure (no code change) Run a busy-street chase with a `diagnostics` build and keep the log. 1. `copies per frame: ...` line: `textures X MB watched and changed, Y MB hashed, Z MB of them changed` (texture CPU work). 2. `recording per frame` line and the memory lines (printed every ~5 s from `copystat.rs`; `VICTORY_MEMORY_MAP=<n>` walks the address space). 3. `texlate` latency lines. 4. `VICTORY_TIMELINE=<file>` for the chain of waits behind each present; `timeline::span` names show the submit stages. 5. Replay (`docs/replay.md`): `--timing detailed` for 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 one `CopyTextureRegion` per subresource every time (~843-892). No per-level or per-dirty-page path exists. - Non-held levels are zero-filled and copied on every refresh (~1535). - Partly mapped textures are re-read, hashed and detiled, and polled at most every 30 frames (~1331): a new mip can show up to 30 frames late. - Tiles are never returned until the host copy dies (`tiles.rs` header). - A failed detile returns early after `last.hash` is set (~1389-1546), so the texture is not retried until its bytes change. Plan (one reviewable commit each): 1. `Layout::level_range(mip, slice)` in `victory-formats` (pure). Verify `walk` already holds this. Test: ranges cover `layout.size` without overlap except packed tail mips, for BC1, BC7, RGBA8, 3D. 2. Dirty-level `u32` mask in `Staging`, set from `watch::writes` (page to range to levels) or a per-level digest. Any uncertainty means all dirty. 3. Detile only dirty levels; re-zero non-held levels only when their held state changes. Key test: incremental equals full detile for random bytes changed in one, several and all levels. 4. Upload only dirty subresources, only while the host texture persists with the same `serial`. Reset to all dirty when staging is dropped (`let_go_idle`), the serial changes, or a lower `first` is requested. 5. Retry policy for a failed detile (do not cache the hash on failure). 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::remapped` can 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 `=1` currently creates a folder literally named `1`. ## 2. Frame time: submit thread and card ### Submit thread (`queue/behind.rs`, `Host::submit` in `host.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: - **Make the opt-in ports the default once validated**: `VICTORY_PORT_JOURNAL` (-1 to -3 ms), `VICTORY_PORT_GUARD` (-2 ms), `VICTORY_PORT_CBV` (-4.7 ms), `VICTORY_PORT_DESCRIPTORS`. Needs the `doctor`/build-check work in section 6 first, because ports 1 and 2 depend on one build's offsets. - **Split one submission across two threads** (stages 4-6 on one, 1-2 on another). Estimated 40 to 32-35 ms (my estimate, not measured). Risk: ordering and lost writes; the repo recorded a rare lost write in 6 of 200 stress runs, so run the stress test. - **Pipeline the next submission's preparation** (watch ask, stale-bytes compare) while the current one is sent. Gain unknown; risk: `late_blocked` read-after-flight hazards. - Unknown: how much of the lane's 40 ms is idle waiting versus work; `VICTORY_CARD_BUFFERS_MIN_KB=64` is 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 vram` then `--buffers sysmem`, bisect with `--only-buffers min=...`; if it wins set `VICTORY_CARD_BUFFERS_MIN_KB=64`. No number exists for it. - Clamp passes: 4,809 indirect executions per gameplay frame; batching already saved ~9 ms on an old replay frame. Try `--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) and `VICTORY_UP_QUEUE=1` (~5 ms of up-copies; no measured gain). - Per-pipeline cost: `--skip-shader <hash>`, `--shaders` A/B, `--retranslate` for the page-directory lookup in `victory-shader/src/emit/lower.rs` (~3579-3600, cost unmeasured). - Largest known lever: `VICTORY_OUTPUT=1920x1080` (about 16 ms of card time) but it changes the output size. - Already tried with no gain per findings: wave sizes, fused multiply-adds, fast reciprocals, scalar loads, a second drawing queue, native console shader code. ### Pipeline and shader caches (CPU stalls on first run) - `pipeline/library.rs` `save` serializes the whole library whenever any pipeline was added (1,352 MB quoted in a comment). Grows with the number of pipelines. - Root signatures are rebuilt for every PSO, with no cache (`pipeline/host.rs`). - Shader cache serves same-`TRANSLATOR_VERSION` entries 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. - Stale comment at `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: 1. **Indirect budget exhaustion** (documented, `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 with `VICTORY_INDIRECT_REST=0`, `VICTORY_INDIRECT_WINDOW=1`, `VICTORY_INDIRECT_BATCH=0/2`. 2. **Non-deterministic culling atomics** (`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. 3. **Stale texture/LOD content while streaming**: `VICTORY_POP_WATCH=<from>-<to>` separates one-frame blips (stale/neutral texture) from lone blocks and steps (draw-set changes); toggles `VICTORY_KEEP_VIEWS`, `VICTORY_KEEP_SHOWN`. 4. **Draws skipped while host pipelines are not ready**: run `victory warm`, then re-run; if it disappears, pipelines are the cause. 5. **Shader precision / depth bounds** (lower likelihood): `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 - Dim rooms without `-RayTracing` are partly by design: the ambient stand-in is off unless `VICTORY_AMBIENT` is set (`ambient.rs:86-103`), and it is skipped whenever the ray-tracing builder runs. Cheap test: make `VICTORY_AMBIENT=1` the default when the builder is off, and compare dorm/sunset scenes (also `VICTORY_AMBIENT_AIR` for the "brown veil"). - Candidate for "too bright or too dark until the title has run a while": a feedback loop (the stand-in reads the previous frame, changes scene luminance, which feeds the title's exposure target and lux factor). Test with `VICTORY_LIGHT_PROBE=probe.csv` (and `VICTORY_LIGHT_PROBE_LUX=1`, which once lost the device) in three configs: stand-in on / builder on / `VICTORY_AMBIENT_SETTLE=0`. If `exp`/`target`/`lux` oscillate while `title`, `standin` and `written` stay flat, the loop is confirmed. Possible fix: make the estimate exposure-aware (divide by lux factor and exposure, then re-multiply). - Leftover memory after a room change is allowed up to 4x the estimate (`fresh` bound defaults to 0); try `VICTORY_AMBIENT_SETTLE=250,3,2` and 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. - With ray tracing on, swings may come from the builder (`pipeline.rs`): any dropped stage makes `builder_runs()` false for the next 2 frames, which also toggles the stand-in; `docs/fork-ray-tracing.md:109-117` reports only "8 of 65" and "48 of 275" dynamic structures good, with compacted sizes read 1-2 frames late. Log builder rests against probe `standin` and luminance jumps (`VICTORY_BVH_TRACE=1`). - Gap: the probe does not log builder state, structure count or ray hit rate, and only runs with the stand-in on and builder off. Adding those fields is a small, useful diagnostic. `reports/LIGHT-POPIN.md` (cited at `ambient.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`/`working` from the memory line and a `VICTORY_MEMORY_MAP` walk at the same place in a run). Savings below are estimates, not measurements: - Lists' scratch allocators (9 GB): lower `SPARE_MOST` / `SPARE_KEPT` / `SCRATCH_CHUNK` (`host.rs:1971-1979`); about 3-5 GB; risk: chunk churn and stalls. - Shadow windows outside buffers (7 GB): drop never-copied window pages and shrink the grid; about 2-4 GB; risk: stale reads and shader-write correctness. - Texture pool (up to 4 GiB of 64 MiB blocks) and upload arenas: tighter caps and sooner release; about 1-3 GB; risk: prefetch hitches. - `VICTORY_RESIDENCY=1` as the default under 32 GB (the code exists, `residency.rs`). - Per-thread `READ` buffer in `texture.rs` (`with_read`) is sized to the largest texture seen and never shrunk. - Tile heaps (64 MiB each) are returned only when entirely free. - The 1.3 GB pipeline library is a mapped file; check how much is in the working set before spending effort. - Not examined: `xmem.rs` reservation policy, whether title memory could be committed on demand. ## 6. Reproducibility (tested on one PC, one build) Blockers, ranked: 1. Pinned to one game build: fixed-offset byte windows in `descriptor_sites.rs` (`SITES`), `frame_rate.rs`, `resolution.rs`, and the allocation hook at `+0x1e86440` in `port.rs`; there are no pattern scans. 2. On another build the patches skip with a per-site warning and the game keeps running slower with no clear error. Not checked: whether the `port.rs` allocation hook fails softly. 3. Narrow GPU assumptions (SM 6.6, mesh shaders, `OpenExistingHeapFromAddress1`, descriptor-heap limits from `probe_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. 4. 64 GB recommended; AVX2 is checked at runtime in two places but `indirect.rs:1426` asserts AVX. 5. `play.ps1` sets ~20 machine-tuned variables and deletes other `VICTORY_*` variables. 6. CI (`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 -Safe` not tried. A 32-minute session ran, so the layer works at least to that extent outside Windows. This changes the picture in two ways: - The "one PC" limit is really "one OS, one driver stack, one translation layer" and a second data point already differs on all three (and on resolution), so numbers from the two setups are not comparable without saying which is which. - Open questions this raises (not verified, I have not seen the logs): whether the build-specific patches applied or skipped with the per-site warning on that run, how `OpenExistingHeapFromAddress1` and the write-watch behaviour (`MEM_WRITE_WATCH` in `xmem.rs`) are handled under Wine, and whether the descriptor-heap limit probe gives the same result on RADV. Concrete improvements: - Make the `victory doctor` output 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 doctor` preflight (low risk): OS build, CPU features, each adapter (name, vendor/device ID, VRAM, SM level, mesh tier), whether `OpenExistingHeapFromAddress1` works, `probe_view_limit` result, game exe version and a `.text` hash, and a per-site "would patch / would differ" report. - One loud summary instead of per-site warnings ("build X unknown: 0 of 6 patches applied, expect slower"); fail fast if the allocation hook cannot attach. - `.github/ISSUE_TEMPLATE` asking for the `doctor` output, build hash, `play.ps1` flags, `-Safe` result and log. - CI without assets: run `doctor` as a smoke test, test that the patch tables leave bytes untouched on a synthetic mismatched image, add a build-id table test. - README "supported builds and hardware" matrix and a `-Safe` troubleshooting path. - Pattern/signature fallbacks (medium to high risk: a hook on the wrong code corrupts rather than skips; keep the full-window comparison as the final check). ## Suggested order 1. Step 0 measurements (cheap, decides everything else). 2. Cheap switch experiments from sections 2-4 (all existing flags, no code). 3. `doctor` preflight and issue template (low risk, enables others to report). 4. Incremental detile (only if step 0 supports it). 5. Memory reductions guided by the measured breakdown. 6. Submit-thread restructuring (highest gain potential, highest risk). ## 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 18:34:28 +00:00
Author
Owner

@⁠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

**@⁠UwUCammie** on GitHub · 2026-11-26 18:52 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/358#issuecomment-7200952587) 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](https://github.com/UwUCammie/victory-amd/commit/3216e2e2)
Author
Owner

@⁠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):

  1. Find one repeatable flicker spot first. Note the save, camera position, game build, output size, and whether it also flickers with ray tracing off. Without a repeatable spot the counters have nothing to attach to.
  2. Stand still there for ~60 s with a diagnostics build and keep the log. Read the frame line 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.
  3. A/B on the same spot: VICTORY_INDIRECT_REST=0, then VICTORY_INDIRECT_WINDOW=1, then VICTORY_INDIRECT_BATCH=0 and =2. If the flicker changes with any of them, the indirect path is involved even when the counter is zero.
  4. Classify the flicker: VICTORY_POP_WATCH=<from>-<to> with VICTORY_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).
  5. Rule out pipelines: run victory warm, then repeat. If it disappears on a warm second run, host pipelines not being ready is the cause.
  6. If still unexplained: record the frame and compare with --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.ps1 flags (and whether -Safe changes anything), and the log lines from steps 2 and 4.

**@⁠D4rkGh057** on GitHub · 2026-11-26 19:08 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/358#issuecomment-7201243294) 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): 1. **Find one repeatable flicker spot first.** Note the save, camera position, game build, output size, and whether it also flickers with ray tracing off. Without a repeatable spot the counters have nothing to attach to. 2. **Stand still there for ~60 s** with a diagnostics build and keep the log. Read the frame line `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. 3. **A/B on the same spot:** `VICTORY_INDIRECT_REST=0`, then `VICTORY_INDIRECT_WINDOW=1`, then `VICTORY_INDIRECT_BATCH=0` and `=2`. If the flicker changes with any of them, the indirect path is involved even when the counter is zero. 4. **Classify the flicker:** `VICTORY_POP_WATCH=<from>-<to>` with `VICTORY_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). 5. **Rule out pipelines:** run `victory warm`, then repeat. If it disappears on a warm second run, host pipelines not being ready is the cause. 6. **If still unexplained:** record the frame and compare with `--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.ps1` flags (and whether `-Safe` changes anything), and the log lines from steps 2 and 4.
Author
Owner

@⁠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.

**@⁠UwUCammie** on GitHub · 2026-11-26 19:15 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/358#issuecomment-7201368492) 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.
Author
Owner

@⁠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 patched and (another build?) (from descriptor_sites.rs and frame_rate.rs). If you still have a log from the 32-minute session, searching it for another build (or not 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.

**@⁠D4rkGh057** on GitHub · 2026-11-26 19:27 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/358#issuecomment-7201614230) 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 patched` and `(another build?)` (from `descriptor_sites.rs` and `frame_rate.rs`). If you still have a log from the 32-minute session, searching it for `another build` (or `not 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.
Author
Owner

@⁠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.

**@⁠UwUCammie** on GitHub · 2026-11-26 19:28 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/358#issuecomment-7201628897) 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.
Author
Owner

@⁠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)?

  1. The 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.
  2. The texture latency lines from texlate (how long a texture takes to be shown after the title asks for it).
  3. One of the memory lines (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.

**@⁠D4rkGh057** on GitHub · 2026-11-26 20:12 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/358#issuecomment-7202420473) 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)? 1. The `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`. 2. The texture latency lines from `texlate` (how long a texture takes to be shown after the title asks for it). 3. One of the memory lines (`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.
Author
Owner

@⁠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

Session time Texture reads per frame Texture time on the same submission-preparation line
30:43, lower-volume sample 21.8 MB 1.5 ms
25:18, higher-volume sample 44.9 MB 2.8 ms
31:51, largest sample 63.2 MB 2.8 ms

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 texlate lines. 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:27 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/358#issuecomment-7202712907) 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](https://github.com/UwUCammie/VIctory-7900XTX/blob/7178b4be/crates/victory-gpu/src/texture.rs#L1186-L1192) | Session time | Texture reads per frame | Texture time on the same submission-preparation line | |---|---:|---:| | 30:43, lower-volume sample | 21.8 MB | 1.5 ms | | 25:18, higher-volume sample | 44.9 MB | 2.8 ms | | 31:51, largest sample | 63.2 MB | 2.8 ms | 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 `texlate` lines. 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.
Author
Owner

@⁠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.

**@⁠UwUCammie** on GitHub · 2026-11-26 20:33 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/358#issuecomment-7202820335) I found two implementations in the fxceless fork that may save some work on the incremental detile. [PR 1130](https://github.com/fxceless/victory-fork/pull/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](https://github.com/fxceless/victory-fork/pull/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.
Author
Owner

@⁠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 frame line (the part textures 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.

**@⁠D4rkGh057** on GitHub · 2026-11-26 21:21 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/358#issuecomment-7203644030) 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 frame` line (the part `textures 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.
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/avatarmanz--VIctory-7900XTX#358
No description provided.