VICTORY_REHYDRATE_PREP=1: make the geometry of the builder's unpack calls ready first (opt-in) #33

Manually merged
github merged 1 commit from github-bot/gh-33 into main 2026-11-30 16:22:42 +00:00 AGit
Owner

@⁠MJ26gaming on GitHub · 2026-11-30 12:54 UTC · original
MJ26gaming:pr/rehydrate-prep → main · +311 −0 · 6 files · 1 commits · merged 2026-11-30 16:18 UTC

What

VICTORY_REHYDRATE_PREP=1 (off by default) — before the title's batched RehydrateRaytracingAccelerationStructure call unpacks packed (static) acceleration structures, the geometry each item reads (vertex and index buffers, transform) is made ready in by-address memory.

The unpacking reads that geometry through pointers inside its build inputs, which the by-address memory never sees. A page without a host copy then reads 0 at a stage that runs once, so the structure is unpacked with zero or stale floats and stays wrong for the rest of the run. In arena dumps of eight launches the same static prop's structure was byte-identical in five and had every float zero (or ~1e-12) in the three slowest — this is one source of "some launches are slow".

  • The import is wrapped after binding (LoadedImage::wrap_imports, new, generic); each item's geometry ranges go through memory::prepare_inputs before the original runs.
  • =1 on, =log only counts pages that had no copy, unset/other: nothing is wrapped.

Import hook after BackseatDrivers-Unbound/VIctory-AMD-RT. Port of MJ26gaming/victory-rdna4-linux-rt-MJ26 54437e26.

Measured

RX 9070 XT (RDNA4), Linux / Proton + vkd3d-proton (RADV, Mesa 26.3.1). Series X path with RT, the cell, scripts/play.ps1 settings, 300 s runs, first 90 s left out, on/off alternated, present pacing numbers:

run fps (avg) median p50 frames > 100 ms (per min)
on #1 8.03 8.39 473
off #1 7.22 8.19 419
on #2 8.95 8.29 323
off #2 8.24 8.24 404

Within noise on frame rate here: it is a correctness fix for launches that unpack a structure from zeros, which a few runs don't reliably hit. In our tree (with VICTORY_BVH_KEEP_REPLACED=1 and VICTORY_MEMORY_PEEL=2) it measured 25.57 vs 22.07 fps averaged over four alternated pairs, though launch-to-launch variance still dominated there too. Off by default, so nothing changes unless asked. Picture checked in a capture run.

Checks

  • cargo xwin build --release --locked -p victory (stable 1.100): no new warnings.
  • Full victory-gpu suite not run, per CONTRIBUTING.

🤖 Generated with Claude Code

**@⁠MJ26gaming** on GitHub · 2026-11-30 12:54 UTC · [original](https://github.com/eikkapine/victory-amd/pull/33) `MJ26gaming:pr/rehydrate-prep` → `main` · +311 −0 · 6 files · 1 commits · merged 2026-11-30 16:18 UTC ## What `VICTORY_REHYDRATE_PREP=1` (off by default) — before the title's batched `RehydrateRaytracingAccelerationStructure` call unpacks packed (static) acceleration structures, the geometry each item reads (vertex and index buffers, transform) is made ready in by-address memory. The unpacking reads that geometry through pointers inside its build inputs, which the by-address memory never sees. A page without a host copy then reads 0 at a stage that runs once, so the structure is unpacked with zero or stale floats and stays wrong for the rest of the run. In arena dumps of eight launches the same static prop's structure was byte-identical in five and had every float zero (or ~1e-12) in the three slowest — this is one source of "some launches are slow". - The import is wrapped after binding (`LoadedImage::wrap_imports`, new, generic); each item's geometry ranges go through `memory::prepare_inputs` before the original runs. - `=1` on, `=log` only counts pages that had no copy, unset/other: nothing is wrapped. Import hook after [BackseatDrivers-Unbound/VIctory-AMD-RT](https://github.com/BackseatDrivers-Unbound/VIctory-AMD-RT). Port of [MJ26gaming/victory-rdna4-linux-rt-MJ26](https://github.com/MJ26gaming/victory-rdna4-linux-rt-MJ26) `54437e26`. ## Measured RX 9070 XT (RDNA4), Linux / Proton + vkd3d-proton (RADV, Mesa 26.3.1). Series X path with RT, the cell, `scripts/play.ps1` settings, 300 s runs, first 90 s left out, on/off alternated, `present pacing` numbers: | run | fps (avg) | median p50 | frames > 100 ms (per min) | |---|---|---|---| | on #1 | 8.03 | 8.39 | 473 | | off #1 | 7.22 | 8.19 | 419 | | on #2 | 8.95 | 8.29 | 323 | | off #2 | 8.24 | 8.24 | 404 | Within noise on frame rate here: it is a correctness fix for launches that unpack a structure from zeros, which a few runs don't reliably hit. In our tree (with `VICTORY_BVH_KEEP_REPLACED=1` and `VICTORY_MEMORY_PEEL=2`) it measured 25.57 vs 22.07 fps averaged over four alternated pairs, though launch-to-launch variance still dominated there too. Off by default, so nothing changes unless asked. Picture checked in a capture run. ## Checks - `cargo xwin build --release --locked -p victory` (stable 1.100): no new warnings. - Full `victory-gpu` suite not run, per CONTRIBUTING. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The title unpacks packed (static) acceleration structures with the batched
RehydrateRaytracingAccelerationStructure import. The unpacking reads each
structure's geometry (vertex and index buffers, transform) through pointers
in its build inputs, which the by-address memory never sees. A page without a
host copy then reads 0 at a stage that runs once: the structure is unpacked
with zero or stale floats and stays wrong for the rest of the run (arena
dumps: same prop byte-identical in five launches, every float zero or ~1e-12
in the three slowest).

- VICTORY_REHYDRATE_PREP=1: the import is wrapped (loader: wrap_imports) and
  each item's geometry ranges are made ready (memory::prepare_inputs) before
  the builder records its stages. =log only counts the pages without a copy.
  Off: nothing is wrapped.

Import hook after BackseatDrivers-Unbound/VIctory-AMD-RT. Port of
MJ26gaming/victory-rdna4-linux-rt-MJ26 54437e26.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Lxjd7NpP1AL3PmUWscMPHG
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 12:59:37 +00:00
github manually merged commit 42950618e0 into main 2026-11-30 16:22:42 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.