shader, host: cap early wave64 folding at 65 VGPRs, scope Batch::title_written_at, deduplicate texbacks, and forward put_off in split send #3524

Closed
Maverick0351a wants to merge 1 commit from upstream-pr/3524 into main
Maverick0351a commented 2026-11-30 00:26:52 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Maverick0351a on 2026-11-30T00:26:52Z.


Summary

  1. GF(2)-factored XOR texture tiling (crates/victory-formats/src/texture.rs):

    • xor_offset is a linear parity map over GF(2): xor_offset(pattern, bits, x, y, z) = xor_axis(0, x) ^ xor_axis(1, y) ^ xor_axis(2, z).
    • In Layout::walk_xor, precompute column runs (x_combined, linear_x, byte_len) once per subresource (where x_combined = (((x_t / bw) as usize) << bits) | xor_axis(pattern, bits, 0, x_t)), compute tiled_row and row_xor = xor_axis(pattern, bits, 1, y_t) ^ xor_axis(pattern, bits, 2, z_coord) once per (z, y) row, and copy fixed-size 4/8/16/32-byte aligned chunks via copy_runs_xor::<N, DETILE>.
    • Avoids calling xor_offset (16 iterations of bit-mask, XOR, and count_ones()) 16,384 to 65,536 times per 256x256 XOR-swizzled texture readback on victory-relay.
  2. Skip redundant title-memory read on full-coverage texture readbacks & deduplicate per-flight readbacks (crates/victory-gpu/src/texback.rs, crates/victory-gpu/src/host.rs):

    • In texback::land, when !same() and the texture's single mip covers 100% of [at, end) without padding or mip tail, skip reading size bytes (256 KiB–512 KiB) from title memory into tiled before overwriting every byte in back.layout.tile(tiled, ...).
    • In read_backs and read_backs_flight, skip landing any texture_back whose (at, end) title allocation is overwritten by a later texture_back in the same flight before any fence signal or bottom-of-pipe write.
  3. Forward card_steps::put_off (VICTORY_LATE_FILLS=1) in Handoff / Host::send_published and graduate verified-clean constant pages (crates/victory-gpu/src/host.rs, crates/victory-gpu/src/host/card_steps.rs):

    • When VICTORY_CARD_STEPS_LEARN=1 and VICTORY_LATE_FILLS=1 are active, Taken::steps includes put_off so run_deferred leaves those learned constant-buffer fills out during submission preparation.
    • When VICTORY_SUBMIT_SPLIT=1 (publish == true), Host::submit previously returned early before calling card_steps::put_off::send, and Host::send_published did not carry or send put_off. Carry put_off in Handoff and dispatch card_steps::put_off::send + queue.Wait in Host::send_published (and call own.landed() in settle before release_scratch()).
    • Graduate constant-buffer source pages verified clean (no_shader_wrote == true) across 8 landings directly to the parallel CPU fill batch (Step::Fill / wide_fills), avoiding hundreds of extra CopyBufferRegion commands per frame for pure CPU constant buffers.
  4. Cap early Wave64 folding (folded (before wave-wide)) at 65 console VGPRs (crates/victory-shader/src/emit/mod.rs):

    • Commit 05d1c56 enabled folded (before wave-wide) ahead of deep skips, wave-wide branches, and local waves so 44-VGPR tree-culling shaders (CS_Tree_BatchCull*) fold instead of flickering. However, applying early folding unconditionally to all Wave64 compute shaders folded 4 high-VGPR shaders past NVIDIA's 255-VGPR physical hardware register file limit per thread (2 * native.vgprs + 2 >= 260..314 host VGPRs), causing massive register spilling to scratch memory and 100–140 ms/frame GPU stalls (5–8 FPS) in cardmeter:
      • ptfx_CS_lightAtlas_Sprite (2561af9577c47289, 129 -> 260 VGPRs, 95.97 ms/frame GPU time)
      • ptfx_CS_lightAtlas_Trail (c06aa62112ffba4c, 129 -> 260 VGPRs)
      • CS_TransmissionVolumetrics_Tiled_LocalLights (6f225b641c5b0708, 156 -> 314 VGPRs, 41.13 ms/frame GPU time)
      • CS_TransmissionVolumetricsSubmerged (926c46bab3b86bd6, 129 -> 260 VGPRs)
    • Gate folded (before wave-wide) on native.vgprs <= FOLD_BEFORE_WIDE_MAX_VGPRS (65, i.e. <= 132 host VGPRs) while keeping folded (last resort) at the end of emit_strict uncapped:
      • All 4 CS_Tree_BatchCull* (44 -> 90 VGPRs) and CS_DrawBatch (65 -> 132 VGPRs) still fold before wave-wide.
      • ptfx_CS_lightAtlas_Sprite and _Trail lower via local waves at 129 VGPRs (0 barriers, 0 register spilling).
      • CS_TransmissionVolumetrics_Tiled* (101 and 156 VGPRs) and Submerged (129 VGPRs) lower via their dedicated wide_by_default wave-wide path.
      • 100% of bound compute shaders (1,271 / 1,271) translate cleanly.
  5. Preserve non-overlapping Batch::textures across Batch::title_written_at(dst, len) (crates/victory-gpu/src/host.rs):

    • Batch::title_written_at(dst, len) previously cleared self.textures unconditionally on every small buffer Step::Copy / Step::Placed and called self.flush() whenever !self.due.is_empty(). Because self.textures was wiped after every buffer copy, subsequent command lists in the same submission re-queued already-refreshed textures into self.due, which then triggered a full self.flush() of all buffer refreshes on the next Step::Copy (25–31 flushes/frame).
    • Store each refreshed texture's (start, end) title-memory span in Batch::textures (texture_due_at) and only refresh self.due or invalidate entries in self.textures whose title-memory range overlaps [dst, dst + len).

Verification

  • cargo test -p victory-shader --lib (462 passed, 0 failed)
  • cargo test -p victory-formats --lib texture (30 passed, 0 failed)
  • cargo test -p victory-gpu --lib batch:: (4 passed, 0 failed, including title_writes_at_range_only_invalidate_overlapping_textures)
  • victory.exe translate across all 1,271 bound compute shaders (1271 emitted of 1271 compute programs)
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5556808484 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3524). Originally posted by [Maverick0351a](https://github.com/Maverick0351a) on 2026-11-30T00:26:52Z. --- ### Summary 1. **GF(2)-factored XOR texture tiling (`crates/victory-formats/src/texture.rs`):** - `xor_offset` is a linear parity map over GF(2): `xor_offset(pattern, bits, x, y, z) = xor_axis(0, x) ^ xor_axis(1, y) ^ xor_axis(2, z)`. - In `Layout::walk_xor`, precompute column runs `(x_combined, linear_x, byte_len)` once per subresource (where `x_combined = (((x_t / bw) as usize) << bits) | xor_axis(pattern, bits, 0, x_t)`), compute `tiled_row` and `row_xor = xor_axis(pattern, bits, 1, y_t) ^ xor_axis(pattern, bits, 2, z_coord)` once per `(z, y)` row, and copy fixed-size 4/8/16/32-byte aligned chunks via `copy_runs_xor::<N, DETILE>`. - Avoids calling `xor_offset` (16 iterations of bit-mask, XOR, and `count_ones()`) 16,384 to 65,536 times per 256x256 XOR-swizzled texture readback on `victory-relay`. 2. **Skip redundant title-memory read on full-coverage texture readbacks & deduplicate per-flight readbacks (`crates/victory-gpu/src/texback.rs`, `crates/victory-gpu/src/host.rs`):** - In `texback::land`, when `!same()` and the texture's single mip covers 100% of `[at, end)` without padding or mip tail, skip reading `size` bytes (256 KiB–512 KiB) from title memory into `tiled` before overwriting every byte in `back.layout.tile(tiled, ...)`. - In `read_backs` and `read_backs_flight`, skip landing any `texture_back` whose `(at, end)` title allocation is overwritten by a later `texture_back` in the same flight before any fence signal or bottom-of-pipe write. 3. **Forward `card_steps::put_off` (`VICTORY_LATE_FILLS=1`) in `Handoff` / `Host::send_published` and graduate verified-clean constant pages (`crates/victory-gpu/src/host.rs`, `crates/victory-gpu/src/host/card_steps.rs`):** - When `VICTORY_CARD_STEPS_LEARN=1` and `VICTORY_LATE_FILLS=1` are active, `Taken::steps` includes `put_off` so `run_deferred` leaves those learned constant-buffer fills out during submission preparation. - When `VICTORY_SUBMIT_SPLIT=1` (`publish == true`), `Host::submit` previously returned early before calling `card_steps::put_off::send`, and `Host::send_published` did not carry or send `put_off`. Carry `put_off` in `Handoff` and dispatch `card_steps::put_off::send` + `queue.Wait` in `Host::send_published` (and call `own.landed()` in `settle` before `release_scratch()`). - Graduate constant-buffer source pages verified clean (`no_shader_wrote == true`) across 8 landings directly to the parallel CPU fill batch (`Step::Fill` / `wide_fills`), avoiding hundreds of extra `CopyBufferRegion` commands per frame for pure CPU constant buffers. 4. **Cap early Wave64 folding (`folded (before wave-wide)`) at 65 console VGPRs (`crates/victory-shader/src/emit/mod.rs`):** - Commit `05d1c56` enabled `folded (before wave-wide)` ahead of `deep skips`, `wave-wide branches`, and `local waves` so 44-VGPR tree-culling shaders (`CS_Tree_BatchCull*`) fold instead of flickering. However, applying early folding unconditionally to all Wave64 compute shaders folded 4 high-VGPR shaders past NVIDIA's 255-VGPR physical hardware register file limit per thread (`2 * native.vgprs + 2 >= 260..314` host VGPRs), causing massive register spilling to scratch memory and `100–140 ms/frame` GPU stalls (`5–8 FPS`) in `cardmeter`: - `ptfx_CS_lightAtlas_Sprite` (`2561af9577c47289`, `129 -> 260` VGPRs, `95.97 ms/frame` GPU time) - `ptfx_CS_lightAtlas_Trail` (`c06aa62112ffba4c`, `129 -> 260` VGPRs) - `CS_TransmissionVolumetrics_Tiled_LocalLights` (`6f225b641c5b0708`, `156 -> 314` VGPRs, `41.13 ms/frame` GPU time) - `CS_TransmissionVolumetricsSubmerged` (`926c46bab3b86bd6`, `129 -> 260` VGPRs) - Gate `folded (before wave-wide)` on `native.vgprs <= FOLD_BEFORE_WIDE_MAX_VGPRS` (`65`, i.e. `<= 132` host VGPRs) while keeping `folded (last resort)` at the end of `emit_strict` uncapped: - All 4 `CS_Tree_BatchCull*` (`44 -> 90` VGPRs) and `CS_DrawBatch` (`65 -> 132` VGPRs) still fold before `wave-wide`. - `ptfx_CS_lightAtlas_Sprite` and `_Trail` lower via `local waves` at `129` VGPRs (0 barriers, 0 register spilling). - `CS_TransmissionVolumetrics_Tiled*` (`101` and `156` VGPRs) and `Submerged` (`129` VGPRs) lower via their dedicated `wide_by_default` wave-wide path. - 100% of bound compute shaders (`1,271 / 1,271`) translate cleanly. 5. **Preserve non-overlapping `Batch::textures` across `Batch::title_written_at(dst, len)` (`crates/victory-gpu/src/host.rs`):** - `Batch::title_written_at(dst, len)` previously cleared `self.textures` unconditionally on every small buffer `Step::Copy` / `Step::Placed` and called `self.flush()` whenever `!self.due.is_empty()`. Because `self.textures` was wiped after every buffer copy, subsequent command lists in the same submission re-queued already-refreshed textures into `self.due`, which then triggered a full `self.flush()` of all buffer refreshes on the next `Step::Copy` (25–31 flushes/frame). - Store each refreshed texture's `(start, end)` title-memory span in `Batch::textures` (`texture_due_at`) and only refresh `self.due` or invalidate entries in `self.textures` whose title-memory range overlaps `[dst, dst + len)`. ### Verification - `cargo test -p victory-shader --lib` (462 passed, 0 failed) - `cargo test -p victory-formats --lib texture` (30 passed, 0 failed) - `cargo test -p victory-gpu --lib batch::` (4 passed, 0 failed, including `title_writes_at_range_only_invalidate_overlapping_textures`) - `victory.exe translate` across all 1,271 bound compute shaders (`1271 emitted of 1271 compute programs`)
Maverick0351a commented 2026-11-30 00:35:07 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Maverick0351a on 2026-11-30T00:35:07Z.


Live Playthrough Telemetry (GTA VI v1.0.2.1, RTX 5080 Laptop GPU, Driving Scene)

Comparing victory-nvidia-play-20261130-000314-53404.log (before) vs victory-nvidia-play-20261130-003105-52456.log (after) in the same driving scene (~260 texture readbacks/sec of 256 KiB and 512 KiB textures, 7,355 draws/frame):

  • read-backs and lists on victory-relay: dropped from 25.60-33.17 ms/frame down to 5.81-7.99 ms/frame (4.4x faster, saving ~20-25 ms/frame on victory-relay).
  • Total copying back on victory-relay: dropped from 36.1-45.2 ms/frame down to 17.5-23.1 ms/frame.
  • Median frame time in the driving scene: dropped from 65.1-72.2 ms down to 56.2 ms.
  • VICTORY_CARD_STEPS=2 + VICTORY_CARD_STEPS_LEARN=1 + VICTORY_LATE_FILLS=1 with VICTORY_SUBMIT_SPLIT=1:
    card steps, places the title writes after sending (VICTORY_CARD_STEPS_LEARN), per frame:
    7.1 fills on the card and 3070.3 on the CPU compared at landing, 0.00 and 40.73 found written again,
    0.93 submissions waited for a learned page; 13 pages learned;
    195.3 fills in 4.93 submissions done when the card got to them (VICTORY_LATE_FILLS)
    
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7265398943 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3524#issuecomment-7265398943). Originally posted by [Maverick0351a](https://github.com/Maverick0351a) on 2026-11-30T00:35:07Z. --- ### Live Playthrough Telemetry (`GTA VI v1.0.2.1`, RTX 5080 Laptop GPU, Driving Scene) Comparing `victory-nvidia-play-20261130-000314-53404.log` (before) vs `victory-nvidia-play-20261130-003105-52456.log` (after) in the same driving scene (~260 texture readbacks/sec of `256 KiB` and `512 KiB` textures, `7,355 draws/frame`): - **`read-backs and lists` on `victory-relay`:** dropped from **`25.60-33.17 ms/frame`** down to **`5.81-7.99 ms/frame`** (**4.4x faster**, saving **~20-25 ms/frame** on `victory-relay`). - **Total `copying back` on `victory-relay`:** dropped from **`36.1-45.2 ms/frame`** down to **`17.5-23.1 ms/frame`**. - **Median frame time in the driving scene:** dropped from **`65.1-72.2 ms`** down to **`56.2 ms`**. - **`VICTORY_CARD_STEPS=2` + `VICTORY_CARD_STEPS_LEARN=1` + `VICTORY_LATE_FILLS=1` with `VICTORY_SUBMIT_SPLIT=1`:** ``` card steps, places the title writes after sending (VICTORY_CARD_STEPS_LEARN), per frame: 7.1 fills on the card and 3070.3 on the CPU compared at landing, 0.00 and 40.73 found written again, 0.93 submissions waited for a learned page; 13 pages learned; 195.3 fills in 4.93 submissions done when the card got to them (VICTORY_LATE_FILLS) ```
Maverick0351a commented 2026-11-30 02:45:31 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Maverick0351a on 2026-11-30T02:45:31Z.


Follow-up Update (8e374f6) — Verified-Clean Constant Page Graduation & Scoped Batch::title_written_at

In heavy outdoor city scenes (~4,970 indirect executions/frame, ~7,500 buffers/textures touched across 21 submissions/frame), we observed two follow-up bottlenecks when routing late::written constant-buffer pages through put_off:

  1. Per-Landing read_into Comparison Storm (20,292 fills/frame compared at landing) & Unblocked 174 MB Root-UAV Constant Heap:

    • When VICTORY_CARD_STEPS_LEARN=1 is active without graduating clean pages, note_flight_landed calls read_into on every constant-buffer fill in every flight forever (20,292.2 fills on the CPU compared at landing per frame, adding ~14 ms/frame on victory-relay).
    • Furthermore, once 0.00 submissions are refused, card_steps accepts the main render submission (5,161 fills) and routes every fill from the 174 MB shader-writable constant heap through Step::CopyBuffer on the GPU (3,741.3 copies into the buffer between per frame) even for constant pages that have never been late-written.
    • Fix (8e374f6): Track a per-page clean-landing counter in card_steps::late (backed by an RwLock<LateLearn>) that graduates 4 KiB pages after CLEAN_THRESHOLD = 8 consecutive verified-clean landings (late::verified_clean), skipping further landing read_into comparisons unless a dirty write is detected. In Host::fill_is_titles, allow non-shader constant fills whose pages are card_steps::late_verified_clean(src, src + len) and !watch::landed_lately(src, len, 600) to take the fast direct upload path instead of card_steps GPU staging. Also elevate victory-late-fills to THREAD_PRIORITY_HIGHEST with a short spin before WaitForSingleObject.
  2. Full-Batch Batch::title_written() Flush on Every Small Step::Copy / Step::Placed:

    • Batch::title_written() unconditionally called flush_fills, flush_refreshes, and self.ahead.clear(), forcing 32–46 full refresh flushes per frame (23–32 ms/frame).
    • Fix (3ab89f4 / 8e374f6): Scope Batch::title_written_at(dst, len) to the written [dst, dst + len) range so flush_fills and flush_refreshes only run when a pending fill or refresh actually overlaps [dst, dst + len), and self.ahead only evicts overlapping entries.

Live Telemetry (victory-nvidia-play-20261130-023708-52468.log, RTX 5080 Laptop GPU)

  • Indoor / island scenes: 57–67 FPS internal (median 14.6–15.8 ms, 0 over 100 ms), 5–8 refresh flushes/frame (2.8–5.6 ms), 0.6–2.6 ms/frame total landing time on victory-relay.
  • Heavy outdoor city scene (4,972 indirect executions/frame, 1,373 mesh pipelines/frame):
    • VICTORY_CARD_STEPS_LEARN: 0.0 fills on the card and 0.0 on the CPU compared at landing after the first 8 landings (down from 20,292.2 comparisons/frame), 0.00 submissions waited for a learned page, 2 pages learned; 27.0 fills in 7.00 submissions done when the card got to them (VICTORY_LATE_FILLS).
    • VICTORY_CARD_STEPS=2: 125.9–136.1 fills/frame (33.4 copies into the buffer between, 51.8 KB) instead of 5,161 fills/frame (3,741.3 copies), with 0.00 submissions refused and waited (0.0–0.1 ms waiting for flights, down from 69–82 ms/frame).
    • preparing per frame, the submitting thread: 33.5–41.9 ms/frame (down from 151.3–171.6 ms/frame — a ~3.8x speedup in outdoor frame preparation).
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7267289551 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3524#issuecomment-7267289551). Originally posted by [Maverick0351a](https://github.com/Maverick0351a) on 2026-11-30T02:45:31Z. --- ### Follow-up Update (`8e374f6`) — Verified-Clean Constant Page Graduation & Scoped `Batch::title_written_at` In heavy outdoor city scenes (`~4,970` indirect executions/frame, `~7,500` buffers/textures touched across `21` submissions/frame), we observed two follow-up bottlenecks when routing `late::written` constant-buffer pages through `put_off`: 1. **Per-Landing `read_into` Comparison Storm (`20,292` fills/frame compared at landing) & Unblocked 174 MB Root-UAV Constant Heap:** - When `VICTORY_CARD_STEPS_LEARN=1` is active without graduating clean pages, `note_flight_landed` calls `read_into` on every constant-buffer fill in every flight forever (`20,292.2 fills on the CPU compared at landing` per frame, adding `~14 ms/frame` on `victory-relay`). - Furthermore, once `0.00 submissions` are refused, `card_steps` accepts the main render submission (`5,161` fills) and routes every fill from the 174 MB shader-writable constant heap through `Step::CopyBuffer` on the GPU (`3,741.3 copies into the buffer between` per frame) even for constant pages that have never been late-written. - **Fix (`8e374f6`):** Track a per-page clean-landing counter in `card_steps::late` (backed by an `RwLock<LateLearn>`) that graduates 4 KiB pages after `CLEAN_THRESHOLD = 8` consecutive verified-clean landings (`late::verified_clean`), skipping further landing `read_into` comparisons unless a dirty write is detected. In `Host::fill_is_titles`, allow non-shader constant fills whose pages are `card_steps::late_verified_clean(src, src + len)` and `!watch::landed_lately(src, len, 600)` to take the fast direct upload path instead of `card_steps` GPU staging. Also elevate `victory-late-fills` to `THREAD_PRIORITY_HIGHEST` with a short spin before `WaitForSingleObject`. 2. **Full-Batch `Batch::title_written()` Flush on Every Small `Step::Copy` / `Step::Placed`:** - `Batch::title_written()` unconditionally called `flush_fills`, `flush_refreshes`, and `self.ahead.clear()`, forcing `32–46` full refresh flushes per frame (`23–32 ms/frame`). - **Fix (`3ab89f4` / `8e374f6`):** Scope `Batch::title_written_at(dst, len)` to the written `[dst, dst + len)` range so `flush_fills` and `flush_refreshes` only run when a pending fill or refresh actually overlaps `[dst, dst + len)`, and `self.ahead` only evicts overlapping entries. #### Live Telemetry (`victory-nvidia-play-20261130-023708-52468.log`, RTX 5080 Laptop GPU) - **Indoor / island scenes:** **`57–67 FPS` internal (`median 14.6–15.8 ms`, `0 over 100 ms`)**, `5–8` refresh flushes/frame (`2.8–5.6 ms`), `0.6–2.6 ms/frame` total landing time on `victory-relay`. - **Heavy outdoor city scene (`4,972` indirect executions/frame, `1,373` mesh pipelines/frame):** - `VICTORY_CARD_STEPS_LEARN`: **`0.0 fills on the card and 0.0 on the CPU compared at landing`** after the first 8 landings (down from **`20,292.2` comparisons/frame**), **`0.00 submissions waited for a learned page`**, `2 pages learned; 27.0 fills in 7.00 submissions done when the card got to them (VICTORY_LATE_FILLS)`. - `VICTORY_CARD_STEPS=2`: **`125.9–136.1 fills/frame` (`33.4 copies into the buffer between`, `51.8 KB`)** instead of `5,161 fills/frame` (`3,741.3 copies`), with **`0.00 submissions refused and waited` (`0.0–0.1 ms waiting for flights`, down from `69–82 ms/frame`)**. - `preparing per frame, the submitting thread`: **`33.5–41.9 ms/frame`** (down from **`151.3–171.6 ms/frame`** — a **`~3.8x` speedup** in outdoor frame preparation).
davemathews12 commented 2026-11-30 05:15:04 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by davemathews12 on 2026-11-30T05:15:04Z.


On the texture part. The copy_runs_xor fast path looks correct:

  • chunk_size requires every body run to have the same length and a column offset that is a multiple of it.
  • Both tiled_row and row_xor are checked to be multiples of N.
  • So (tiled_row + (x_off ^ row_xor)) / N == tiled_row / N + ((x_off / N) ^ (row_xor / N)).
  • The linear chunks are contiguous because the body runs start at x = 0.

Three suggestions:

  1. Keep a reference test independent of the new code. This PR rewrites xor_offset itself on top of xor_axis, and offset() uses xor_offset. That makes the existing xor_modes_tile_where_offset_points compare the new code with itself. Only the golden digests (render_xor_water_*) stay independent, and they cover one mode (64KB_R_X, 4-byte). A test that pins xor_axis to the per-bit definition would fix that: XOR of the three axis parts == parity of (x & px) ^ (y & py) ^ (z & pz) per bit, for every XOR_PATTERNS entry. The element-by-element test from the #2543 comment would also apply here.
  2. Split the PR. It bundles the texture change with unrelated GPU changes (constant-buffer page routing in card_steps, put_off, texback dedup) and a shader one (the wave64 VGPR cap in emit/mod.rs). Each is easier to review, bisect and revert on its own.
  3. It overlaps #2543, which rewrites the same walk_xor.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7269490464 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3524#issuecomment-7269490464). Originally posted by [davemathews12](https://github.com/davemathews12) on 2026-11-30T05:15:04Z. --- **On the texture part.** The `copy_runs_xor` fast path looks **correct**: - `chunk_size` requires every body run to have the same length and a column offset that is a multiple of it. - Both `tiled_row` and `row_xor` are checked to be multiples of N. - So `(tiled_row + (x_off ^ row_xor)) / N == tiled_row / N + ((x_off / N) ^ (row_xor / N))`. - The linear chunks are contiguous because the body runs start at x = 0. Three suggestions: 1. **Keep a reference test independent of the new code.** This PR rewrites `xor_offset` itself on top of `xor_axis`, and `offset()` uses `xor_offset`. That makes the existing `xor_modes_tile_where_offset_points` compare the new code with itself. Only the golden digests (`render_xor_water_*`) stay independent, and they cover one mode (`64KB_R_X`, 4-byte). A test that pins `xor_axis` to the per-bit definition would fix that: XOR of the three axis parts == parity of `(x & px) ^ (y & py) ^ (z & pz)` per bit, for every `XOR_PATTERNS` entry. The element-by-element test from the #2543 comment would also apply here. 2. **Split the PR.** It bundles the texture change with unrelated GPU changes (constant-buffer page routing in `card_steps`, `put_off`, texback dedup) and a shader one (the wave64 VGPR cap in `emit/mod.rs`). Each is easier to review, bisect and revert on its own. 3. **It overlaps #2543**, which rewrites the same `walk_xor`.
DoubleD17 commented 2026-11-30 13:31:44 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by DoubleD17 on 2026-11-30T13:31:44Z.


We ran a test of this PR on current main (41adb551 with this PR merged, head fc05a1b5), on a CPU-bound machine: seven 150 s runs among seven main runs, in two rounds (ABBA), with a preload made for each build (this PR changes the translator).

CPU preparation is lower in all seven runs. Light-view seconds only (the idle camera's lighter views, about 7,500 draws a frame), each run against main's runs of its round interpolated in time:

CPU prep (ms/frame) main at that point fps main at that point
round 1, run 1 67.6 70.8 12.4 12.3
round 1, run 2 65.7 71.2 13.5 12.5
round 1, run 3 61.1 67.5 12.6 13.6
round 2, run 1 59.8 63.9 12.8 13.7
round 2, run 2 68.0 71.6 11.0 11.6
round 2, run 3 66.0 73.4 13.2 11.1
round 2, run 4 64.2 70.7 11.7 10.9
mean difference −5.3 ms +2.4 %

On these views fps moves less than preparation does, as other limits take over.

The heavier view gains the most. The idle camera also spends 5 to 55 s of each run on a heavier view (about 15,000 draws a frame). There, every PR run was faster than every main run:

fps on the heavy view CPU prep (ms/frame)
this PR, 7 runs 8.7 to 11.4, mean 10.1 mean 80.3
main, 7 runs 6.2 to 8.4, mean 7.0 mean 90.1

These are fewer seconds per run (10 to 50 s for the PR, 5 to 55 s for main), so take the size with care, but the direction held in all fourteen runs.

Threads: the relay thread was landing 37.4 ms a frame on average with this PR against 41.3 on main, and the submitting thread's refreshes took 19.7 ms against 21.0 (medians of the 5 s lines, means over the seven runs).

Picture: in round 1, two frames out of 240 had vegetation near the camera missing for one frame (palms, potted plants and a bush; the islands further away stayed), back in the next frame. Round 2 was clean (0 in 320), and main's runs in both rounds were clean too (0 in 560). We see the same one-frame gap on main about once in 4,000 frames, and about once in 600 frames on builds of other PRs from the same base (#1165), so we cannot pin it on this PR. With 2 in 560 it is worth keeping an eye on, because skipped or deduplicated readbacks could leave the culling's lists one frame stale.

Memory: no change (in the last 100 s of each run, shared 8.2 to 9.1 GB with this PR and 8.4 to 9.5 GB on main, dedicated about 10.3 GB in both).

One caveat for round 2: the PC was in use for light browsing during part of it. The order (ABBA) spreads that over both builds, and round 2 agrees with round 1.

Setup:

  • Ryzen 7 5800X (8 cores, 16 threads), RTX 5070 12 GB (driver 621.40, DXGI budget 11,175 MB), 64 GB RAM, Windows 11;
  • Series X, 1440p with DLAA (DLSS at native resolution), frame generation and ray tracing off;
  • the PR merged locally onto main 41adb551, against 41adb551 itself, each with a preload made with these settings;
  • a warm-up run per build, then 150 s runs from the same save, restored before each run;
  • medians of the 5 s lines after the first 20 s, split by draws a frame (light under 11,000, heavy over 12,000);
  • picture check: a burst of 80 frames at the end of each run, looked at frame by frame.

AI Assisted

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7279974753 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3524#issuecomment-7279974753). Originally posted by [DoubleD17](https://github.com/DoubleD17) on 2026-11-30T13:31:44Z. --- We ran a test of this PR on current main (41adb551 with this PR merged, head fc05a1b5), on a CPU-bound machine: seven 150 s runs among seven main runs, in two rounds (ABBA), with a preload made for each build (this PR changes the translator). **CPU preparation is lower in all seven runs.** Light-view seconds only (the idle camera's lighter views, about 7,500 draws a frame), each run against main's runs of its round interpolated in time: | | CPU prep (ms/frame) | main at that point | fps | main at that point | |---|---|---|---|---| | round 1, run 1 | 67.6 | 70.8 | 12.4 | 12.3 | | round 1, run 2 | 65.7 | 71.2 | 13.5 | 12.5 | | round 1, run 3 | 61.1 | 67.5 | 12.6 | 13.6 | | round 2, run 1 | 59.8 | 63.9 | 12.8 | 13.7 | | round 2, run 2 | 68.0 | 71.6 | 11.0 | 11.6 | | round 2, run 3 | 66.0 | 73.4 | 13.2 | 11.1 | | round 2, run 4 | 64.2 | 70.7 | 11.7 | 10.9 | | **mean difference** | **−5.3 ms** | | **+2.4 %** | | On these views fps moves less than preparation does, as other limits take over. **The heavier view gains the most.** The idle camera also spends 5 to 55 s of each run on a heavier view (about 15,000 draws a frame). There, every PR run was faster than every main run: | | fps on the heavy view | CPU prep (ms/frame) | |---|---|---| | this PR, 7 runs | 8.7 to 11.4, mean 10.1 | mean 80.3 | | main, 7 runs | 6.2 to 8.4, mean 7.0 | mean 90.1 | These are fewer seconds per run (10 to 50 s for the PR, 5 to 55 s for main), so take the size with care, but the direction held in all fourteen runs. **Threads:** the relay thread was landing 37.4 ms a frame on average with this PR against 41.3 on main, and the submitting thread's refreshes took 19.7 ms against 21.0 (medians of the 5 s lines, means over the seven runs). **Picture:** in round 1, two frames out of 240 had vegetation near the camera missing for one frame (palms, potted plants and a bush; the islands further away stayed), back in the next frame. Round 2 was clean (0 in 320), and main's runs in both rounds were clean too (0 in 560). We see the same one-frame gap on main about once in 4,000 frames, and about once in 600 frames on builds of other PRs from the same base (#1165), so we cannot pin it on this PR. With 2 in 560 it is worth keeping an eye on, because skipped or deduplicated readbacks could leave the culling's lists one frame stale. **Memory:** no change (in the last 100 s of each run, shared 8.2 to 9.1 GB with this PR and 8.4 to 9.5 GB on main, dedicated about 10.3 GB in both). One caveat for round 2: the PC was in use for light browsing during part of it. The order (ABBA) spreads that over both builds, and round 2 agrees with round 1. **Setup:** - Ryzen 7 5800X (8 cores, 16 threads), RTX 5070 12 GB (driver 621.40, DXGI budget 11,175 MB), 64 GB RAM, Windows 11; - Series X, 1440p with DLAA (DLSS at native resolution), frame generation and ray tracing off; - the PR merged locally onto main 41adb551, against 41adb551 itself, each with a preload made with these settings; - a warm-up run per build, then 150 s runs from the same save, restored before each run; - medians of the 5 s lines after the first 20 s, split by draws a frame (light under 11,000, heavy over 12,000); - picture check: a burst of 80 frames at the end of each run, looked at frame by frame. AI Assisted
trustno1-coder commented 2026-12-01 18:51:23 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-12-01T18:51:23Z.


Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7321681768 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3524#issuecomment-7321681768). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-12-01T18:51:23Z. --- Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
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.

Reference
trustno1-coder/VIctory-NVIDIA!3524
No description provided.