VICTORY_MEMORY_PEEL + VICTORY_MEMORY_UINT4: uniform views for walkers' loads by address #39

Closed
github-bot wants to merge 0 commits from github-bot/gh-39 into main AGit
Owner

@⁠MJ26gaming on GitHub · 2026-11-30 16:09 UTC · original
MJ26gaming:pr/memory-peel-stacked → main · +0 −0 · 0 files · 18 commits · closed without merging

Two commits, one switch each (the second only works with the first):

1. VICTORY_MEMORY_PEEL=1|2 (off by default)

A load by address reads the copy view its page's directory entry names, which differs between lanes. As a non-uniform descriptor index, the AMD back end turns every such load into a waterfall loop per dword. With the switch, a load in a program that walks the title's structures (not the structure builder's) loops over the wave's distinct copies instead: each turn takes the wave-wide minimum slot not yet read (uniform, so its view needs no waterfall), and the lanes holding it read. The wave ops sit in the loop's head and latch, where every lane runs. Same bytes are read. =1: loads of two dwords or more; =2: single dwords too. The shader cache keys on it (only when on).

2. VICTORY_MEMORY_UINT4=1 (off by default, with PEEL)

The host's translation reads a raw view one dword at a time whatever alignment the load is said to have; a structured view of 16-byte elements reads as one vector. With the switch, the run of copy views doubles (a copy's structured view lies 4096 slots past its raw one), and inside the peel loop a lane whose byte is on 16 reads element byte/16 of the structured view; others read the raw view as before. Off: the run keeps its length. On RDNA4 the walk passes go from ~1,500 to ~480 memory instructions.

On our tree (MJ26gaming/victory-rdna4-linux-rt-MJ26), PEEL=2 over 7 alternated pairs: mean +1.2 fps, but launch-to-launch spread down from SD 3.5 to 1.5 fps (it removed the slow launches); UINT4 on top: 28.6 vs 25.2 fps averaged over 3 pairs (+3.4).

Measured on victory-amd

Current main (with #32 and #33 merged, v2026.11.30.4): same settings as below, VICTORY_REHYDRATE_PREP=1:

run fps (avg) median p50 frames > 100 ms (per min)
on #1 14.35 15.03 21
off #1 9.19 7.43 311
on #2 13.38 14.17 23
off #2 9.93 9.47 246

Earlier, on 2cf103c + #32 + #33:

RX 9070 XT (RDNA4), Linux / Proton + vkd3d-proton (RADV, Mesa 26.3.1). Series X path with RT, the cell, scripts/play.ps1 settings plus #32 and #33 (VICTORY_REHYDRATE_PREP=1), 300 s runs, first 90 s left out, on/off alternated, warmed shader cache, present pacing numbers. "On" = VICTORY_MEMORY_PEEL=2 VICTORY_MEMORY_UINT4=1:

run fps (avg) median p50 frames > 100 ms (per min)
on #1 13.86 14.71 31
off #1 11.70 9.88 244
on #2 13.10 14.06 38
off #2 10.18 8.19 293

On top of #32 and #33: +2.2 / +2.9 fps average, median frame rate up 50–70 %, and frames over 100 ms down by about 85 % in both pairs. (Alone on main without #32/#33 neither switch helped here — the walk passes only become the bottleneck once the compacted-size race is fixed — hence the dependency.)

Checks

  • Picture checked in capture runs (PEEL+UINT4 alone, and together with #32, #33 and the other switches): cell scene correct.

  • cargo xwin build --release --locked -p victory (stable 1.100): no new warnings.

  • victory-shader lib tests under Wine: 276 pass with the switches off and on; the 37 that dispatch on a D3D12 device can't run without one (same set either way). Full victory-gpu suite not run, per CONTRIBUTING.

🤖 Generated with Claude Code

**@⁠MJ26gaming** on GitHub · 2026-11-30 16:09 UTC · [original](https://github.com/eikkapine/justanxboxemulator/pull/39) `MJ26gaming:pr/memory-peel-stacked` → `main` · +0 −0 · 0 files · 18 commits · closed without merging Two commits, one switch each (the second only works with the first): ## 1. `VICTORY_MEMORY_PEEL=1|2` (off by default) A load by address reads the copy view its page's directory entry names, which differs between lanes. As a non-uniform descriptor index, the AMD back end turns every such load into a waterfall loop per dword. With the switch, a load in a program that walks the title's structures (not the structure builder's) loops over the wave's distinct copies instead: each turn takes the wave-wide minimum slot not yet read (uniform, so its view needs no waterfall), and the lanes holding it read. The wave ops sit in the loop's head and latch, where every lane runs. Same bytes are read. `=1`: loads of two dwords or more; `=2`: single dwords too. The shader cache keys on it (only when on). ## 2. `VICTORY_MEMORY_UINT4=1` (off by default, with PEEL) The host's translation reads a raw view one dword at a time whatever alignment the load is said to have; a structured view of 16-byte elements reads as one vector. With the switch, the run of copy views doubles (a copy's structured view lies 4096 slots past its raw one), and inside the peel loop a lane whose byte is on 16 reads element `byte/16` of the structured view; others read the raw view as before. Off: the run keeps its length. On RDNA4 the walk passes go from ~1,500 to ~480 memory instructions. On our tree (MJ26gaming/victory-rdna4-linux-rt-MJ26), PEEL=2 over 7 alternated pairs: mean +1.2 fps, but launch-to-launch spread down from SD 3.5 to 1.5 fps (it removed the slow launches); UINT4 on top: 28.6 vs 25.2 fps averaged over 3 pairs (+3.4). ## Measured on victory-amd **Current `main` (with #32 and #33 merged, v2026.11.30.4):** same settings as below, `VICTORY_REHYDRATE_PREP=1`: | run | fps (avg) | median p50 | frames > 100 ms (per min) | |---|---|---|---| | on #1 | 14.35 | 15.03 | 21 | | off #1 | 9.19 | 7.43 | 311 | | on #2 | 13.38 | 14.17 | 23 | | off #2 | 9.93 | 9.47 | 246 | Earlier, on 2cf103c + #32 + #33: RX 9070 XT (RDNA4), Linux / Proton + vkd3d-proton (RADV, Mesa 26.3.1). Series X path with RT, the cell, `scripts/play.ps1` settings plus #32 and #33 (`VICTORY_REHYDRATE_PREP=1`), 300 s runs, first 90 s left out, on/off alternated, warmed shader cache, `present pacing` numbers. "On" = `VICTORY_MEMORY_PEEL=2 VICTORY_MEMORY_UINT4=1`: | run | fps (avg) | median p50 | frames > 100 ms (per min) | |---|---|---|---| | on #1 | 13.86 | 14.71 | 31 | | off #1 | 11.70 | 9.88 | 244 | | on #2 | 13.10 | 14.06 | 38 | | off #2 | 10.18 | 8.19 | 293 | On top of #32 and #33: +2.2 / +2.9 fps average, median frame rate up 50–70 %, and frames over 100 ms down by about 85 % in both pairs. (Alone on `main` without #32/#33 neither switch helped here — the walk passes only become the bottleneck once the compacted-size race is fixed — hence the dependency.) ## Checks - Picture checked in capture runs (PEEL+UINT4 alone, and together with #32, #33 and the other switches): cell scene correct. - `cargo xwin build --release --locked -p victory` (stable 1.100): no new warnings. - `victory-shader` lib tests under Wine: 276 pass with the switches off and on; the 37 that dispatch on a D3D12 device can't run without one (same set either way). 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
The title copies each new structure's compacted size out of the slot the
builder's size program stores in, with a small buffer copy in the same list.
Done at submission, that copy read the slot before the program ran: an older
structure's size, so compaction copies overran their room and wrote over the
next structure (broken structures, a frame-time climb).

A copy of at most 64 bytes out of a page the size programs store in (or a
host copy stored in by address), into memory without a host copy, is now a
bottom-of-pipe write from title memory after the list has run; a source
stored in by address counts as the shaders' for copies at their place.

On whenever the builder is (VICTORY_BVH_BUILDER=1); VICTORY_BVH_SIZE_COPY=0
turns it off. Without the builder nothing changes. A "bvh size copy" log line
counts the copies put behind their list.

Port of VIctory-NVIDIA 1788f11 by way of
MJ26gaming/victory-rdna4-linux-rt-MJ26 (f6e40733, 0f116d96).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Lxjd7NpP1AL3PmUWscMPHG
A load by address reads the copy view its page's directory entry names,
which differs between lanes. As a non-uniform descriptor index the AMD back
end turns every such load into a waterfall loop per dword. With the switch,
a load in a program that walks the title's structures (not the structure
builder's) loops over the wave's distinct copies instead: each turn takes
the wave-wide minimum slot not yet read (uniform, so its view needs no
waterfall) and the lanes holding it read. The wave operations sit in the
loop's head and latch, where every lane runs. The same bytes are read.

- =1: loads of two dwords or more; =2: single dwords too. 0/unset: off.
- Part of the translation: the shader cache keys on it (only when on, so
  translations cached without it keep their key).

memory() is split into memory_page / memory_entry / memory_view (no change
when off).

Measured on RX 9070 XT / RADV, Series X RT, with VICTORY_BVH_KEEP_REPLACED:
about +5 fps (MJ26gaming/victory-rdna4-linux-rt-MJ26 1054053c).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Lxjd7NpP1AL3PmUWscMPHG
The host's translation reads a raw view one dword at a time whatever
alignment the load is said to have; a structured view of 16-byte elements
reads as one vector. With the switch the run of copy views doubles: a copy's
structured view lies MEMORY_STRUCTURED (4096) slots past its raw one. In the
peel loop a lane whose byte is on 16 reads element byte/16 of the structured
view; any other lane reads the raw view as before. The shader cache keys on
the switch. Off: nothing changes (the run keeps its length).

On RX 9070 XT / RADV the walk passes go from ~1,500 to ~480 memory
instructions; MJ26gaming/victory-rdna4-linux-rt-MJ26 fe1a11bf measured
+3.4 fps on top of VICTORY_MEMORY_PEEL=2 (Series X RT, cell).

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 16:12:05 +00:00
github-bot changed title from VICTORY_MEMORY_PEEL + VICTORY_MEMORY_UINT4: uniform views for walkers' loads by address (depends on #32, #33) to VICTORY_MEMORY_PEEL + VICTORY_MEMORY_UINT4: uniform views for walkers' loads by address 2026-11-30 16:43:35 +00:00
github-bot closed this pull request 2026-12-01 19:52:21 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.