GPU and shaders: Grand Theft Auto VI runs its first 3D scene on a 32-lane laptop GPU (wave64 split and fallback, capped heaps, null root views, castable stand-in views, mapped pipeline library) #3147

Open
github-bot wants to merge 20 commits from github-bot/gh-3147 into main AGit
Owner

@⁠RaghavVijayanand on GitHub · 2026-11-26 10:16 UTC · original
RaghavVijayanand:gta6/run-fixes → main · +3389 −214 · 26 files · 20 commits · open

Fixes found while running Grand Theft Auto VI in Series S mode on a laptop: RTX 5060 Laptop (8 GB, 32-lane waves only), Radeon 780M iGPU beside it, 23 GB RAM, Windows 11. With these it gets past the hangs at the first 3D scene and runs it, with the camera moving. The lit image is still black at the end: what remains is in the lighting pass, below.

This is one branch on top of main 63bcca4. It carries #1960 (wave64 on 32-lane hosts), rebased onto today's main, so it supersedes that PR. It also carries #2126 by @⁠0xkn0wh3r3, which keeps relabelled thread ids unique in tiled group layouts, as one commit. On top of that is the split_ids fix by @⁠0xkn0wh3r3 and @⁠stem23456-coder: a 32x4 wave64 group paired the wrong host waves on NVIDIA. Its regression test fails without the fix on an RTX 5060.

What is in it

Hosts this title did not run on

  • wave64 compute on 32-lane hosts (#1960, rebased): each console wave becomes two host waves, cross-half reads go through group-shared memory, and a program that cannot be split is refused. The rebase follows main's ds_bpermute, which reads within its 32-lane half, and keeps v_readfirstlane reading the first lane of EXEC after #2468 (scalar results unguarded).
  • VICTORY_WAVE64_APPROX (opt-in): runs the refused wave64 programs in 32-lane waves anyway. They can be wrong, but they are not missing. Their loops stop after VICTORY_WAVE64_LOOPS iterations (64 by default). At 64, some of the title's programs still kept the GPU busy for minutes at the first 3D scene. At 8 they all finish.
  • Capped view heaps (NVIDIA and AMD cap shader-visible heaps at 1,000,000 views): the heap is probed and the title's slots are clamped to it, keeping 2^18 dynamic slots (2^16 ran out). The device is made on the high-performance adapter, so the RTX is used, not the 780M. Render targets and storage in formats the host lacks get stand-ins.

Rendering

  • A root view that the title did not set, or that lies outside title buffers, is the null buffer view. Before, the whole dispatch was dropped. About 190 dispatches a frame ran just before the lighting (f6e47efa50226beb, 3b90165a77d95cdf, …). Each case is logged once, with the address.
  • A view in a format its stand-in texture is castable to now reads that format. One R11G11B10 texture (the stand-in for R9G9B9E5) is made castable to R32_UINT and R9G9B9E5. The title's compute writes it as R32_UINT and its lighting reads it as R9G9B9E5. The view was rewritten to R11G11B10, so the bits were decoded wrongly.
  • Format twins: removed after review (they missed writes earlier in the same list). The castable view above is the path the title takes; @⁠steven-seagull27's test packed_lighting_uav_write_is_visible_to_a_same_list_rgb9e5_srv (ignored by default, needs a GPU) covers it.

Memory and tools

  • The pipeline library is memory-mapped from its file. It was read whole into process memory, and every save serialised it into another buffer of its size. For this title that is 2.4 GB of private memory, plus 2.4 GB allocated at every save. Saves now write generations, host-pipelines-<n>.bin, because Windows refuses to replace a mapped file. They come every 5 minutes, not every 20 s. A run that made no pipeline writes only the early list.
  • VICTORY_PATCH=<rva>:<hex>,... writes title bytes once, before the title runs. I used it to make the title render at 720p by rewriting its display-mode table. VICTORY_DISPLAY_MODE lists another display mode.

Where the black image comes from (for whoever continues)

From VICTORY_CAPTURE_WORLD=30 and VICTORY_DUMP_TARGETS=1: geometry and materials render. f0c91b4d2578f5bf's 853x480 targets show the characters and the room. The lit HDR target stays black: 348e1e8c414c7eca and 63381c3250b287fa write it, at 853x480, format 10. With this branch nothing is skipped and no root view drops a dispatch, so the next suspect is one of the lighting inputs. VICTORY_TRACE_SHADERS=348e1e8c414c7eca lists them.

Testing

On the machine above, Windows 11 26300:

  • cargo clippy --workspace --all-targets [--all-features] --locked -- -D warnings: clean.
  • cargo test --workspace --locked: passes, with two exceptions that behave the same on unmodified main 63bcca4 on this machine. emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index crashes with STATUS_ACCESS_VIOLATION, so it was skipped. The two stride_tests::a_heap_buffer_* tests and synthetic_tests::gathers_at_a_level_match_the_hardware fail.
  • All 16 wave64_tests pass on the RTX 5060 (split programs) and on the 780M. On a machine without a GPU (CI) they skip.
  • In the title: Series S, 720p. Intro and menus at about 30 fps. The 3D scene runs at about 0.6 fps, with camera input working.

🤖 Generated with Claude Code

**@⁠RaghavVijayanand** on GitHub · 2026-11-26 10:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/3147) `RaghavVijayanand:gta6/run-fixes` → `main` · +3389 −214 · 26 files · 20 commits · open Fixes found while running Grand Theft Auto VI in Series S mode on a laptop: RTX 5060 Laptop (8 GB, 32-lane waves only), Radeon 780M iGPU beside it, 23 GB RAM, Windows 11. With these it gets past the hangs at the first 3D scene and runs it, with the camera moving. The lit image is still black at the end: what remains is in the lighting pass, below. This is one branch on top of `main` 63bcca4. It carries #1960 (wave64 on 32-lane hosts), rebased onto today's `main`, so it supersedes that PR. It also carries #2126 by @⁠0xkn0wh3r3, which keeps relabelled thread ids unique in tiled group layouts, as one commit. On top of that is the `split_ids` fix by @⁠0xkn0wh3r3 and @⁠stem23456-coder: a 32x4 wave64 group paired the wrong host waves on NVIDIA. Its regression test fails without the fix on an RTX 5060. ## What is in it **Hosts this title did not run on** - **wave64 compute on 32-lane hosts** (#1960, rebased): each console wave becomes two host waves, cross-half reads go through group-shared memory, and a program that cannot be split is refused. The rebase follows `main`'s `ds_bpermute`, which reads within its 32-lane half, and keeps `v_readfirstlane` reading the first lane of EXEC after #2468 (scalar results unguarded). - **`VICTORY_WAVE64_APPROX`** (opt-in): runs the refused wave64 programs in 32-lane waves anyway. They can be wrong, but they are not missing. Their loops stop after `VICTORY_WAVE64_LOOPS` iterations (64 by default). At 64, some of the title's programs still kept the GPU busy for minutes at the first 3D scene. At 8 they all finish. - **Capped view heaps** (NVIDIA and AMD cap shader-visible heaps at 1,000,000 views): the heap is probed and the title's slots are clamped to it, keeping 2^18 dynamic slots (2^16 ran out). The device is made on the high-performance adapter, so the RTX is used, not the 780M. Render targets and storage in formats the host lacks get stand-ins. **Rendering** - **A root view that the title did not set, or that lies outside title buffers, is the null buffer view.** Before, the whole dispatch was dropped. About 190 dispatches a frame ran just before the lighting (`f6e47efa50226beb`, `3b90165a77d95cdf`, …). Each case is logged once, with the address. - **A view in a format its stand-in texture is castable to now reads that format.** One R11G11B10 texture (the stand-in for R9G9B9E5) is made castable to R32_UINT and R9G9B9E5. The title's compute writes it as R32_UINT and its lighting reads it as R9G9B9E5. The view was rewritten to R11G11B10, so the bits were decoded wrongly. - ~~Format twins~~: removed after review (they missed writes earlier in the same list). The castable view above is the path the title takes; @⁠steven-seagull27's test `packed_lighting_uav_write_is_visible_to_a_same_list_rgb9e5_srv` (ignored by default, needs a GPU) covers it. **Memory and tools** - **The pipeline library is memory-mapped from its file.** It was read whole into process memory, and every save serialised it into another buffer of its size. For this title that is 2.4 GB of private memory, plus 2.4 GB allocated at every save. Saves now write generations, `host-pipelines-<n>.bin`, because Windows refuses to replace a mapped file. They come every 5 minutes, not every 20 s. A run that made no pipeline writes only the early list. - **`VICTORY_PATCH=<rva>:<hex>,...`** writes title bytes once, before the title runs. I used it to make the title render at 720p by rewriting its display-mode table. **`VICTORY_DISPLAY_MODE`** lists another display mode. ## Where the black image comes from (for whoever continues) From `VICTORY_CAPTURE_WORLD=30` and `VICTORY_DUMP_TARGETS=1`: geometry and materials render. `f0c91b4d2578f5bf`'s 853x480 targets show the characters and the room. The lit HDR target stays black: `348e1e8c414c7eca` and `63381c3250b287fa` write it, at 853x480, format 10. With this branch nothing is skipped and no root view drops a dispatch, so the next suspect is one of the lighting inputs. `VICTORY_TRACE_SHADERS=348e1e8c414c7eca` lists them. ## Testing On the machine above, Windows 11 26300: - `cargo clippy --workspace --all-targets [--all-features] --locked -- -D warnings`: clean. - `cargo test --workspace --locked`: passes, with two exceptions that behave the same on unmodified `main` 63bcca4 on this machine. `emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index` crashes with STATUS_ACCESS_VIOLATION, so it was skipped. The two `stride_tests::a_heap_buffer_*` tests and `synthetic_tests::gathers_at_a_level_match_the_hardware` fail. - All 16 `wave64_tests` pass on the RTX 5060 (split programs) and on the 780M. On a machine without a GPU (CI) they skip. - In the title: Series S, 720p. Intro and menus at about 30 fps. The 3D scene runs at about 0.6 fps, with camera input working. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A compute program that reads other lanes declares the console's wave size
(WaveSize), so a wave64 one could only be created on a GPU with 64-lane
waves: NVIDIA's run 32 lanes only, and pipeline creation failed there.

The translation now knows whether the host has 64-lane waves
(emit::set_host_wave64, default yes). Without, such a program declares
WaveSize(32) and each console wave becomes two host waves (lower/wave64.rs).
Thread ids keep the console's lane order, the console lane is the host
lane plus 32 in the second half, and what stays within a half is exact as
it was: DPP, ds_swizzle, v_writelane, v_mbcnt, a lane's bit of a mask.
What spans both halves goes through group-shared scratch (store, group
sync, load, group sync): 64-bit ballots of lane masks read as data,
v_readlane at any lane, v_readfirstlane, ds_bpermute (the lane read and
its bit of EXEC's ballot), and whole-wave reductions and prefix sums
(each half's, combined with the other half's). A group sync is made only
in blocks every thread of the group runs once (no loop contains them,
every path to an end passes them); elsewhere the program is refused, as
it is for a group of 33 to 64 threads with LDS (one console wave, which
the console compiler leaves without barriers), for scratch beyond 32 KiB
of group-shared memory, and for 16-bit whole-wave sums (shortcut: not
joined over the halves). A group of at most 32 threads is one host wave
and needs no exchange. Every waveGetLaneIndex the translation makes sets
the wave-operations feature flag.

v_readfirstlane under a lane guard (an EXEC the structurisation could not
prove) read the host's first active lane, which can be outside EXEC; it
now reads the first lane of the guard's ballot, on any wave size (a pixel
helper lane still takes its own value).

The test host can now enumerate hardware adapters (Host::hardware: GPUs
as the default adapter is chosen, not software and with video memory of
their own) and read their wave sizes (Host::wave_lanes).

Tests (emit/wave64_tests.rs): hand-assembled wave64 programs of 128, 96,
64 and 32 threads with ballots (s_bcnt1, s_ff1, v_mbcnt), lane reads at
lanes of both halves, v_readfirstlane with full and partial EXEC, a
ballot under a narrowed EXEC, v_writelane, whole-wave sum, prefix sums
and maximum sections, a ballot after a divergent branch, and ds_bpermute
across the halves with full and partial EXEC, each lane checked against
a model of the console's wave. Each runs on every hardware adapter and
WARP for the wave sizes it supports: the RTX 5060 (32 lanes) ran the
split programs, the Radeon 780M (32-64) both the split and the
WaveSize(64) ones, WARP (4 lanes) neither. Refusals are tested for a
ballot in divergent code, a lane read in a loop and LDS in one console
wave. The tests fail when the exchange reads its own half instead of the
other, when the every-thread check is dropped (the 2 refusal tests), and
the permute test when ds_bpermute reads within its half; the guarded
v_readfirstlane test failed on the 780M's 64-lane waves before the fix.
The translation can split wave64 compute programs into host waves of 32
lanes, but only when told the host lacks 64-lane waves. The host device
now reads WaveLaneCountMin and WaveLaneCountMax (D3D12 OPTIONS1) when it
is created, logs them and passes whether 64 lies between them to
emit::set_host_wave64. Translation (at first use and `translate --cache`
alike) creates the device first, so the setting is in place before any
program is translated, and the shader cache keys translations for hosts
without 64-lane waves apart from the others. README: what is still
missing on such hosts.

Builds and passes clippy and the workspace tests; not run against the
title (no game data here).
- Shaders clamp view heap indices below the largest view heap the host
  takes (probed at device creation; NVIDIA and AMD cap at 1,000,000), and
  the null buffer views sit inside it; the shader cache keys on the size.
- The host device is made on the high-performance adapter (a laptop's
  discrete GPU) when there is one.
- Unordered views in a format the host cannot store to are left null
  instead of removing the device (B5G5R5A1).
- Render targets and unordered textures in formats the host cannot render
  or store to get a stand-in of the same element size (RGB9E5 by
  R11G11B10 float, B4G4R4A4 by B5G5R5A1 or B5G6R5), as do their clear
  values, views and the pipelines drawing to them.
- Translated loops stop after 2^12 iterations per lane (2^20 still hung).
- VICTORY_PREBUILD_VERBOSE keeps the pre-build's per-pipeline log lines.
- The shader test host prefers the high-performance adapter.
On a host that caps its view heaps (the RTX 5060: 1,000,000 slots) the
dynamic slots were cut to 2^16, which Grand Theft Auto VI's world used up
about a minute in: draws were dropped for want of slots and the title
then waited for their work for good. They now keep their full 2^18 where
the heap has room for twice that; the title's slots left below them go
from 934,461 to 737,853, the rest reading null as those past the cap
already did.
On a host without 64-lane waves, wave64 compute programs the exact split
cannot take (LDS shared without barriers in one console wave of 33 to 64
threads, cross-lane operations spanning both halves where not every
thread arrives) were left out: 139 of the programs the title's world
runs, its frames then black behind the text. With the switch, such a
program is lowered as for 64-lane waves and declares no wave size, so it
runs in the host's waves with its cross-lane results possibly wrong
instead of not at all. Off by default; the shader cache keys on it.
A wave64 program lowered approximately (VICTORY_WAVE64_APPROX) can loop
waiting for what the other half of a console wave was to give, which in
the host's 32-lane waves never comes; at the 4096 iterations per lane
every loop gets, Grand Theft Auto VI's first 3D scene in Series S mode
kept the RTX 5060 busy for minutes (no reset: the GPU stays preemptible)
and the title waited for good. Loops of such programs now stop after 64.
Unlike VICTORY_POKE (writable data, twice a second), a patch is written
once before the title's code runs and may change read-only data: the
page protection is lifted for the write and restored. Grand Theft Auto VI
sizes its window and render targets from a display mode table in .rdata
(1280x720, 1664x936, 1920x1080, 2560x1440, 3840x2160 at 60 Hz; the last
is what Series X mode uses, chosen before the title asks the host for its
modes): 615c100:8007000038040000 makes that entry 1920x1080.
The pipeline library (over 2 GB for the world) was read whole into
process memory and kept for the run, and every save serialised it into
another buffer of its size: two private copies, the second allocated
every 20 s while pipelines were added (a 2,164,033,260-byte allocation
failed when memory ran short). The library is now mapped from its file,
so the host drops and rereads its pages instead of paging them out, and
saves serialise straight into a mapped file. Windows refuses to replace
a mapped file, so each save writes the next generation
(host-pipelines-<n>.bin; host-pipelines.bin is generation 0) and older
ones go once nothing maps them, as do temporary files a killed save left.
Saves come every 5 minutes instead of 20 s: each writes the whole library
and holds its lock.
A run whose pipelines all came from the library still changed the list
of pipelines to start early, and that rewrote the whole library (over
2 GB) a few seconds into every run. The list alone is written then.
The limit (64) still let some of Grand Theft Auto VI's approximately
lowered programs keep the GPU busy for minutes at the first 3D scene. It
is now read from VICTORY_WAVE64_LOOPS (1 to 4096, 64 by default) and goes
into the shader cache key.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Grand Theft Auto VI's frame dropped some 190 dispatches before its
lighting (light lists, it seems) for a root view that was not set or not
in a title buffer, and the lit image stayed black. A console shader need
not touch a root view on every path: the dispatch now runs with the null
buffer view there (zeros read, writes lost) and the case is logged once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Grand Theft Auto VI's compute writes two 192x108 lighting textures as
R32_UINT and its lighting reads the same memory as R9G9B9E5_SHAREDEXP, a
view the host does not allow of an R32 texture: refused, the lighting read
zeros and the scene stayed black. Such a shader-resource view now reads a
twin texture in its format, given the texture's bytes before every
submission (texture to buffer to texture, placed footprints of one texel
size), from the texture's real state and back.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A host texture standing in for R9G9B9E5 (R11G11B10) that was made
castable to R9G9B9E5 and R32_UINT is written as R32_UINT by Grand Theft
Auto VI's compute and read as R9G9B9E5 by its lighting; the view was
rewritten to the stand-in's format and read the bits as R11G11B10. A view
format the texture is castable to is now kept (logged: shader views in a
format of another family than their texture).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Scalar results are written whatever EXEC holds (#2468), so the lane
guard no longer reached v_readfirstlane, and in a split wave64 it read
the host wave's first lane instead of the first lane of EXEC
(lane_reads_reach_the_other_half: 0 for lanes above 36 in EXEC). The op
now gets EXEC's lanes beside its unguarded write. The wave64 permute
test follows main's ds_bpermute, which reads within its 32-lane half
(RDNA 2 ISA, 10.4.4). Clippy: is_multiple_of in VICTORY_PATCH parsing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Taking EXEC's lanes for every scalar result failed a v_readlane under a
join of an untracked mask (a_scalar_result_needs_no_exec); only
v_readfirstlane needs them. Clippy: parentheses in the permute model.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 11:08:42 +00:00
Author
Owner

@⁠copilot-pull-request-reviewer[bot] on GitHub · 2026-11-26 10:16 UTC · original · reviewed

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

**@⁠copilot-pull-request-reviewer[bot]** on GitHub · 2026-11-26 10:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/3147#pullrequestreview-6072240422) · **reviewed** Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-26 10:41 UTC · original · edited 2026-11-26 10:55 UTC

I found an ordering case in the fallback format twin on 7e641689. I extended your 8×4 lighting-texture fixture (R32_UINT source, R9G9B9E5 twin) so it reads back both resources. Every texel gets a distinct seed; a second upload flips every bit. Both devices produced the following counts in two fresh processes each, with the D3D12 debug layer enabled.

Ordering Source with expected bytes Twin with expected bytes
Seed written on a previous submission (original control) 32/32 32/32
Source rewritten, then twin read later in the same command list 32/32 0/32
Same resources read again on the next submission 32/32 32/32

In the middle row all 32 twin texels still contained their own previous seed. This reproduced on the RTX 5080 (621.40) and Windows inbox WARP. It matches the placement of format_twin::refresh in the prelude. If a lighting input uses this fallback and its producer writes earlier in that same list, the consumer can read the previous contents. The synthetic fixture uses a texture copy as its producer.

Which path did the descriptor builder actually take? I also created 853×480 guest textures through the production resource and SRV paths, requested either R9G9B9E5 or R32_UINT as the resource format, and bound an R9G9B9E5 SRV. I tried UAV and RT+UAV flags for both formats. All four combinations on each adapter bound the original resource with effective SRV format 67, with zero view-creation diagnostics. For the RGB9E5 resource, RTX used a castable R11G11B10 stand-in and WARP kept native RGB9E5. This rules out the fallback-twin ordering issue for those eight descriptor combinations here. A trace showing a lighting input actually binds a different underlying texture would be the discriminator in-game.

I then dispatched a typed R32_UINT UAV write followed by an R9G9B9E5 shader read on the same list, using those production descriptors. Each adapter matched 128/128 sampled texels and 512/512 float components per run, twice, against a CPU shared-exponent decode. Pixel (108,60) held 0x87251229 and returned exactly (41/256, 137/256, 457/256, 1). The passing control is independently applicable to your PR and runs with cargo test --locked -p victory-gpu --all-features --lib packed_lighting_uav_write_is_visible -- --ignored --nocapture. Direct lighting-path test

The separate fallback test keeps your existing control and adds an opt-in same-list regression that currently fails after checking the next-submission recovery. Fallback reproduction commit

git fetch https://github.com/steven-seagull27/VIctory.git codex/pr3147-format-twin-order
git cherry-pick bc9f2f405de02df83a620ddd8557196d6ab7a707
$env:VICTORY_D3D12_DEBUG = '1'
$env:VICTORY_D3D12_WARP = '0'
cargo test --locked -p victory-gpu --features diagnostics --lib format_twin::tests:: -- --include-ignored --nocapture --test-threads=1

Set VICTORY_D3D12_WARP=1 to repeat on the software adapter. AI-assisted testing with synthetic texture data.

**@⁠steven-seagull27** on GitHub · 2026-11-26 10:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/3147#issuecomment-7189712493) · edited 2026-11-26 10:55 UTC I found an ordering case in the fallback format twin on `7e641689`. I extended your 8×4 lighting-texture fixture (`R32_UINT` source, `R9G9B9E5` twin) so it reads back both resources. Every texel gets a distinct seed; a second upload flips every bit. Both devices produced the following counts in two fresh processes each, with the D3D12 debug layer enabled. | Ordering | Source with expected bytes | Twin with expected bytes | |---|---:|---:| | Seed written on a previous submission (original control) | 32/32 | 32/32 | | Source rewritten, then twin read later in the **same command list** | 32/32 | **0/32** | | Same resources read again on the next submission | 32/32 | 32/32 | In the middle row all 32 twin texels still contained their own previous seed. This reproduced on the RTX 5080 (621.40) and Windows inbox WARP. It matches the placement of `format_twin::refresh` in the prelude. If a lighting input uses this fallback and its producer writes earlier in that same list, the consumer can read the previous contents. The synthetic fixture uses a texture copy as its producer. **Which path did the descriptor builder actually take?** I also created 853×480 guest textures through the production resource and SRV paths, requested either `R9G9B9E5` or `R32_UINT` as the resource format, and bound an `R9G9B9E5` SRV. I tried UAV and RT+UAV flags for both formats. All four combinations on each adapter bound the original resource with effective SRV format 67, with zero view-creation diagnostics. For the RGB9E5 resource, RTX used a castable R11G11B10 stand-in and WARP kept native RGB9E5. This rules out the fallback-twin ordering issue for those eight descriptor combinations here. A trace showing a lighting input actually binds a different underlying texture would be the discriminator in-game. I then dispatched a typed `R32_UINT` UAV write followed by an `R9G9B9E5` shader read on the **same list**, using those production descriptors. Each adapter matched **128/128 sampled texels and 512/512 float components per run**, twice, against a CPU shared-exponent decode. Pixel `(108,60)` held `0x87251229` and returned exactly `(41/256, 137/256, 457/256, 1)`. The passing control is independently applicable to your PR and runs with `cargo test --locked -p victory-gpu --all-features --lib packed_lighting_uav_write_is_visible -- --ignored --nocapture`. [Direct lighting-path test](https://github.com/steven-seagull27/VIctory/commit/fb329ac85d11be2d3f5b6e2f37e1e8b89caf493b) The separate fallback test keeps your existing control and adds an opt-in same-list regression that currently fails after checking the next-submission recovery. [Fallback reproduction commit](https://github.com/steven-seagull27/VIctory/commit/bc9f2f405de02df83a620ddd8557196d6ab7a707) ```powershell git fetch https://github.com/steven-seagull27/VIctory.git codex/pr3147-format-twin-order git cherry-pick bc9f2f405de02df83a620ddd8557196d6ab7a707 $env:VICTORY_D3D12_DEBUG = '1' $env:VICTORY_D3D12_WARP = '0' cargo test --locked -p victory-gpu --features diagnostics --lib format_twin::tests:: -- --include-ignored --nocapture --test-threads=1 ``` Set `VICTORY_D3D12_WARP=1` to repeat on the software adapter. AI-assisted testing with synthetic texture data.
Author
Owner

@⁠pickles976 on GitHub · 2026-11-26 11:10 UTC · original

Offscreen verification of 7e64168 on Wine 11.0/Linux 6.17, RTX 4060 Laptop 8 GB (32-lane waves only, like your 5060), NVIDIA 590.48.1, DXVK 3.1.1, Rust 1.98.1. Caveat: locally built diagnostic-relaxed vkd3d-proton 3.2.0 2576c0b4adfae4a+ (assertions disabled, allocator/list from_iface vtable identity checks removed, null checks kept) — not stock-runtime certification. Local edits: the format_twin and a small HRESULT probe test made fail-closed on a missing host (they otherwise return silently); no production changes. One test thread, 9 GiB/512 MiB cgroup scope.

Passing: all 11 emit::wave64_tests pass on the real adapter (split-program dispatch/readback; fresh 6.04 s compile, 1.17 s run), including v_readfirstlane's EXEC-lane fix at the head. format_twin::tests::a_twin_takes_its_textures_bytes_at_submission passes — the R9G9B9E5-of-R32_UINT twin takes the texture's bytes and keeps its format.

pipeline::library::tests: 11/14 under Wine; three failures share one root cause — this host refuses an empty pipeline library. A local probe calling ID3D12Device1::CreatePipelineLibrary directly records:

CreatePipelineLibrary(empty)   -> hr=0x80070057  (E_INVALIDARG)
CreatePipelineLibrary(garbage) -> hr=0x887E0002  (D3D12_ERROR_DRIVER_VERSION_MISMATCH)

vkd3d-proton matches Windows' incompatible-blob semantics (your open fallback arm is reached correctly), but unlike Windows it refuses zero-length data, so the empty-library bootstrap at the end of open always fails here. Failing on that path: a_library_loads_from_a_mapped_file, a_rejected_blob_gives_an_empty_library, pipelines_load_on_many_threads_at_once — all three panic at open(...).expect("an empty library"). mapped_files_round_trip, the generation naming/cleanup tests and a_pipeline_loads_while_a_save_holds_the_library pass (a valid serialized blob does load). Runtime consequence under Wine/vkd3d-proton: first run (or any rejected blob) degrades exactly as your code intends — "no host pipeline library: pipelines are not kept" — so the title still runs, but the memory-mapped cache this PR adds gives no cross-run pipeline reuse on such stacks. On Windows, where you tested, the empty bootstrap succeeds; nothing here contradicts your results. Log verify-pr3147-gates.log / verify-pr3147-library-hr-probe.log (kept locally).

Next for me is a guarded title trial of this branch (720p, Series S mode) — the wave64 split plus your capped view heaps and the null-buffer-view root fallback are exactly the loading-stage blockers I measured on this machine (310,720 title slot past the host heap warnings, three refused compute IDs on the emulation approach). I will report the RAM trajectory and whether the first 3D scene is reached here.

AI use: omp, harness model openai-codex/gpt-6-astra, ran the checks and drafted this report. No upstream code changes or assets attached.

**@⁠pickles976** on GitHub · 2026-11-26 11:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/3147#issuecomment-7190365501) Offscreen verification of `7e64168` on Wine 11.0/Linux 6.17, RTX 4060 Laptop 8 GB (32-lane waves only, like your 5060), NVIDIA 590.48.1, DXVK 3.1.1, Rust 1.98.1. **Caveat: locally built diagnostic-relaxed vkd3d-proton 3.2.0 `2576c0b4adfae4a+` (assertions disabled, allocator/list `from_iface` vtable identity checks removed, null checks kept) — not stock-runtime certification.** Local edits: the `format_twin` and a small HRESULT probe test made fail-closed on a missing host (they otherwise `return` silently); no production changes. One test thread, 9 GiB/512 MiB cgroup scope. **Passing:** all 11 `emit::wave64_tests` pass on the real adapter (split-program dispatch/readback; fresh 6.04 s compile, 1.17 s run), including `v_readfirstlane`'s EXEC-lane fix at the head. `format_twin::tests::a_twin_takes_its_textures_bytes_at_submission` passes — the R9G9B9E5-of-R32_UINT twin takes the texture's bytes and keeps its format. **`pipeline::library::tests`: 11/14 under Wine; three failures share one root cause — this host refuses an empty pipeline library.** A local probe calling `ID3D12Device1::CreatePipelineLibrary` directly records: ``` CreatePipelineLibrary(empty) -> hr=0x80070057 (E_INVALIDARG) CreatePipelineLibrary(garbage) -> hr=0x887E0002 (D3D12_ERROR_DRIVER_VERSION_MISMATCH) ``` vkd3d-proton matches Windows' incompatible-blob semantics (your `open` fallback arm is reached correctly), but unlike Windows it refuses zero-length data, so the empty-library bootstrap at the end of `open` always fails here. Failing on that path: `a_library_loads_from_a_mapped_file`, `a_rejected_blob_gives_an_empty_library`, `pipelines_load_on_many_threads_at_once` — all three panic at `open(...).expect("an empty library")`. `mapped_files_round_trip`, the generation naming/cleanup tests and `a_pipeline_loads_while_a_save_holds_the_library` pass (a valid serialized blob does load). Runtime consequence under Wine/vkd3d-proton: first run (or any rejected blob) degrades exactly as your code intends — `"no host pipeline library: pipelines are not kept"` — so the title still runs, but the memory-mapped cache this PR adds gives no cross-run pipeline reuse on such stacks. On Windows, where you tested, the empty bootstrap succeeds; nothing here contradicts your results. Log `verify-pr3147-gates.log` / `verify-pr3147-library-hr-probe.log` (kept locally). Next for me is a guarded title trial of this branch (720p, Series S mode) — the wave64 split plus your capped view heaps and the null-buffer-view root fallback are exactly the loading-stage blockers I measured on this machine (310,720 `title slot past the host heap` warnings, three refused compute IDs on the emulation approach). I will report the RAM trajectory and whether the first 3D scene is reached here. AI use: omp, harness model `openai-codex/gpt-6-astra`, ran the checks and drafted this report. No upstream code changes or assets attached.
Author
Owner

@⁠stem23456-coder on GitHub · 2026-11-26 11:10 UTC · original

Following the move from #1960, here is the integration patch, regression shader and CPU probe for the overlap with #2126. The original fix and RTX 5070 Ti test are by @⁠0xkn0wh3r3 in their demo branch.

The patch was prepared on the combined #1960 (fc61f2e) and #2126 (e214ce4) heads. It uses the logical Xbox thread ID in split_ids for both the half and the wave base. In our CPU probe the 32×4 layout went from 64 output slots written twice to all 128 written once, each with (id % 64, 64). The 128×1 and 16×8 controls passed too. Could whichever PR lands second carry the change and regression test? This patch needs both prerequisites and may need rebasing onto the current heads. Earlier verification. AI-assisted with Codex.

**@⁠stem23456-coder** on GitHub · 2026-11-26 11:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/3147#issuecomment-7190378797) Following the move from #1960, here is the [integration patch, regression shader and CPU probe](https://gist.github.com/stem23456-coder/14a4788ec408364054c33f32789728ca) for the overlap with #2126. The original fix and RTX 5070 Ti test are by @⁠0xkn0wh3r3 in [their demo branch](https://git.gtahub.st/github/Marvisak--VIctory/pulls/1960). The patch was prepared on the combined #1960 (`fc61f2e`) and #2126 (`e214ce4`) heads. It uses the logical Xbox thread ID in `split_ids` for both the half and the wave base. In our CPU probe the 32×4 layout went from 64 output slots written twice to all 128 written once, each with `(id % 64, 64)`. The 128×1 and 16×8 controls passed too. Could whichever PR lands second carry the change and regression test? This patch needs both prerequisites and may need rebasing onto the current heads. [Earlier verification](https://git.gtahub.st/github/Marvisak--VIctory/pulls/1960). AI-assisted with Codex.
The format twin (a copy in the view's format, refreshed at submission)
missed writes earlier in the same list: a reviewer's same-list test read
the twin's old texels, 0 of 32. The title's lighting textures take the
castable view instead (f5a9b50's path), which the same reviewer checked
on the production descriptors with a same-list R32_UINT write and R9G9B9E5
read, 128 of 128 texels; no twin was made in a run of the title. The twin
is removed; the log of views in a format of another family stays.

wave64_tests failed on CI, which has no GPU: no device runs a 64-lane
program split or whole there (WARP runs 4-lane waves). They now say they
skipped, as the other hardware-only tests do.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠pickles976 on GitHub · 2026-11-26 11:14 UTC · original

Follow-up as promised: guarded title trial of 7e64168 on this machine (same Wine/RTX 4060 Laptop 8 GB stack; 16 GiB RAM, cgroup 9 GiB/512 MiB, available-RAM guard floor 2,048 MiB).

Result: stopped by the RAM guard during loading at 112.9 s, 1,757 MiB available (GPU 3,263 MiB) — the loading-stage memory wall on this machine is unchanged by this PR, and the empty-library refusal above means its pipeline-library lever is inert here.

What the run shows:

  • host view heap capped: title slots past the room left read null count=1245184 room=737853 views=1000000 — the cap engages exactly as designed (1,000,000-view host limit probed), and the title's 1,245,184 slots leave 507,331 past the room; those read null, matching the count of title slot past the host heap warnings one-for-one. Cleaner than before (a single explicit line, views accounted), but on a host that caps at 1M views the overflow slots are still null — the paging in #2121 is what would address them.
  • no host pipeline library yet; starting an empty one → no host pipeline library: pipelines are not kept: the runtime consequence of the zero-length CreatePipelineLibrary E_INVALIDARG from my previous comment. First-run behavior is correct-graceful, but on vkd3d-proton every run is a first run: the library is never saved or re-mapped, so this PR's 2.4 GB private-copy savings never materialize on stacks like this one. A warm-cache trial on Windows is where that part pays off.
  • Captures at 45 s and 60 s show GTA VI loading artwork (the trunk/duffle-bag illustration with storefronts); no 3D scene, no menu after. The wall I hit is before the 3D scene your branch reaches: on 16 GiB RAM the title's loading-stage XMemAllocatePhysicalPages/MapViewOfFile3 tmpfs sections (measured at cgroup level: shmem 787→3,980 MiB over 80 s in a prior attribution run) exhaust available RAM before the world. That is not something this PR or #2121 addresses — it is title memory behavior on hosts with half your machine's RAM.

No FPS, world-entry, or input-response claim. Logs kept locally (20261126T111205Z*, captures menu-20261126T1112*.png).

AI use: omp, harness model openai-codex/gpt-6-astra, ran the checks and drafted this report. No upstream code changes or assets attached.

**@⁠pickles976** on GitHub · 2026-11-26 11:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/3147#issuecomment-7190478233) Follow-up as promised: guarded title trial of `7e64168` on this machine (same Wine/RTX 4060 Laptop 8 GB stack; 16 GiB RAM, cgroup 9 GiB/512 MiB, available-RAM guard floor 2,048 MiB). **Result: stopped by the RAM guard during loading at 112.9 s, 1,757 MiB available (GPU 3,263 MiB) — the loading-stage memory wall on this machine is unchanged by this PR, and the empty-library refusal above means its pipeline-library lever is inert here.** What the run shows: - `host view heap capped: title slots past the room left read null count=1245184 room=737853 views=1000000` — the cap engages exactly as designed (1,000,000-view host limit probed), and the title's 1,245,184 slots leave 507,331 past the room; those read null, matching the count of `title slot past the host heap` warnings one-for-one. Cleaner than before (a single explicit line, views accounted), but on a host that caps at 1M views the overflow slots are still null — the paging in #2121 is what would address them. - `no host pipeline library yet; starting an empty one` → `no host pipeline library: pipelines are not kept`: the runtime consequence of the zero-length `CreatePipelineLibrary` E_INVALIDARG from my previous comment. First-run behavior is correct-graceful, but on vkd3d-proton every run is a first run: the library is never saved or re-mapped, so this PR's 2.4 GB private-copy savings never materialize on stacks like this one. A warm-cache trial on Windows is where that part pays off. - Captures at 45 s and 60 s show GTA VI loading artwork (the trunk/duffle-bag illustration with storefronts); no 3D scene, no menu after. The wall I hit is before the 3D scene your branch reaches: on 16 GiB RAM the title's loading-stage `XMemAllocatePhysicalPages`/`MapViewOfFile3` tmpfs sections (measured at cgroup level: shmem 787→3,980 MiB over 80 s in a prior attribution run) exhaust available RAM before the world. That is not something this PR or #2121 addresses — it is title memory behavior on hosts with half your machine's RAM. No FPS, world-entry, or input-response claim. Logs kept locally (`20261126T111205Z*`, captures `menu-20261126T1112*.png`). AI use: omp, harness model `openai-codex/gpt-6-astra`, ran the checks and drafted this report. No upstream code changes or assets attached.
Author
Owner

@⁠RaghavVijayanand on GitHub · 2026-11-26 11:24 UTC · original

@⁠steven-seagull27 thank you. Your same-list case is right: the twin was only refreshed in the submission's prelude, so a write earlier in the same list never reached it. And your second finding agrees with what I saw in the title: in a run with the logging from 372d56f, the lighting textures took the castable view, and no twin was made.

So in 4596ccb the twin is gone. A fallback that misses same-list writes is worse than refusing the view. The castable-view fix (372d56f) stays, along with its once-per-format-pair log of views in a format of another family. I cherry-picked your direct-path test as 0ddd54c, with you as the author. Here it passes on the RTX 5060 Laptop (--ignored, all features).

The CI failure was the wave64_tests: they asserted that some device ran each program, and the runner has no GPU (WARP's 4-lane waves run neither the split nor the WaveSize(64) form). They now print that they skipped, like the other hardware-only tests.

Locally (RTX 5060 Laptop):

  • clippy with and without --all-features: clean.
  • cargo test --workspace: passes, except stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride, stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros and synthetic_tests::gathers_at_a_level_match_the_hardware. All three fail the same way on unmodified main 63bcca4 here, which I re-checked just now.
**@⁠RaghavVijayanand** on GitHub · 2026-11-26 11:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/3147#issuecomment-7190690306) @⁠steven-seagull27 thank you. Your same-list case is right: the twin was only refreshed in the submission's prelude, so a write earlier in the same list never reached it. And your second finding agrees with what I saw in the title: in a run with the logging from 372d56f, the lighting textures took the castable view, and no twin was made. So in 4596ccb the twin is gone. A fallback that misses same-list writes is worse than refusing the view. The castable-view fix (372d56f) stays, along with its once-per-format-pair log of views in a format of another family. I cherry-picked your direct-path test as 0ddd54c, with you as the author. Here it passes on the RTX 5060 Laptop (`--ignored`, all features). The CI failure was the `wave64_tests`: they asserted that some device ran each program, and the runner has no GPU (WARP's 4-lane waves run neither the split nor the WaveSize(64) form). They now print that they skipped, like the other hardware-only tests. Locally (RTX 5060 Laptop): - clippy with and without `--all-features`: clean. - `cargo test --workspace`: passes, except `stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride`, `stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros` and `synthetic_tests::gathers_at_a_level_match_the_hardware`. All three fail the same way on unmodified `main` 63bcca4 here, which I re-checked just now.
A compute program that reads other lanes is relabelled so that each
thread's host lane is its console lane (`Lower::thread_id`): its flat id
was its wave's first flat id rounded down to the wave size, plus its lane
index. That is a bijection only while each host wave holds one aligned
run of flat ids. Measured on an RTX 5070 Ti (driver 621.24), it does not
for 2-D groups 24, 32 or 64 wide or not a power of two wide: the driver
fills waves with 16 by 2 tiles (ids 0-15 and 32-47 in one wave), so two
waves round to one base. A 32 by 2 group gave its 64 threads 32 ids;
32 by 8, 64 by 4, 24 by 8, 12 by 12 and 10 by 10 lost a quarter to a half
of theirs, threads computing and storing for the same console thread.
(XCL's public notes report 2 by 2 quads on an RX 9070, which would break
8 by 8 groups too.)

1-D groups keep the rounding: hosts put them into waves in order. Other
groups take ids by ticket: every thread zeroes a group-shared counter,
a barrier, then each full wave's first lane adds the wave size to it and
the wave takes the old value as its base; the one partial wave (the
group's last threads, its lanes from 0) takes the last run. Computed
once, in the entry block.

New tests (`emit::lane_order_tests`):
- `relabelled_threads_each_get_their_own_id` translates a console wave32
  program that reads lanes and stores 1 at its thread's flat id, in nine
  group shapes, and checks every id is stored once. On main six shapes
  fail (32 by 2: 32 of 64); with the change all pass.
- `host_waves_keep_what_the_relabelling_relies_on` probes the host with a
  plain HLSL program (the Windows SDK's dxc), printing each shape's wave
  layout, and checks 1-D groups are aligned runs and each group has at
  most one partial wave, its lanes from 0. Skipped without dxc.

---- from #2126, squashed with its two follow-ups:

Shaders: programs whose LDS fills group-shared memory keep the rounding

The ticket that gives relabelled threads in 2-D and 3-D groups their ids
is one more dword of group-shared memory. A program that reads lanes and
already allocates the host's whole 32 KiB would then fail validation
("Total Thread Group Shared Memory storage is 32772, exceeded 32768")
where it translated before. Such programs keep the old rounding of the
wave's first flat id (`Lower::ticket`), noted as a shortcut: they
translate as they did, with the ids it repeats on hosts that put several
rows into one wave.

`programs_with_all_the_lds_keep_the_rounding` lowers the 8 by 8 program
of `lane_order_tests` with 32 KiB of LDS (the rounding) and with 31.5 KiB
(the ticket), and validates both where dxil.dll is found; with the ticket
forced, the first fails validation.

`relabelled_threads_each_get_their_own_id` now skips on a host that runs
no waves of 32 (D3D12_FEATURE_D3D12_OPTIONS1's lane range, read by the new
`Host::wave_lanes`) or that refuses the 1-D program, which takes no ticket,
as an Intel UHD (Xe-LP, waves of 16) did with "The parameter is
incorrect".

Shaders: relabelled threads' ids are made in a module of their own

`Lower::console_flat` and `Lower::ticket`, with the group-shared size
they check against, move from `lower.rs` to `lower/thread_ids.rs`,
unchanged. With them `lower.rs` grew past the 512 KiB the asset policy
allows a source file.

Applied on top of the wave64 split from #1960/#3147 as one commit (the first
alone takes lower.rs past the 512 KiB limit). Conflicts: Lower::thread_id
takes console_flat (as @stem23456-coder resolved it); Host::wave_lanes is
this version (the split's tests unwrap it); both test-only fields kept.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A host may lay a 2-D group out in tiles: an RTX 5070 Ti puts a 32x4
group's threads in 16 by 2 tiles, so the host wave's first flat id, masked
to 64, paired the wrong host waves into a console wave (64 output slots
written twice, 64 none). split_ids now takes the half and the wave base
from Lower::console_flat, which gives each host wave one 32-aligned run
of console thread ids in any layout.

lane_order_tests::a_wave64_program_runs_as_the_console_runs_it_on_a_32_lane_host
runs a wave64 program in 128x1, 16x8 and 32x4 groups, translated for
32-lane waves, and checks every thread's console lane and its wave's
lane count. It fails at 32x4 on an RTX 5060 Laptop without this change
and passes with it. synthetic_tests::lowered_for translates for a given
host wave size.

Fix and regression shader by @0xkn0wh3r3 (#1960); ported onto #2126 by
@stem23456-coder (gist 14a4788ec408364054c33f32789728ca); applied here.

Co-Authored-By: stem23456-coder <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠RaghavVijayanand on GitHub · 2026-11-26 12:40 UTC · original

@⁠stem23456-coder @⁠0xkn0wh3r3: done. This PR now carries both, so it is the "second to land" you asked about:

  • 0167517: #2126's three commits (console_flat, the LDS rounding, the thread_ids module) as one commit, with @⁠0xkn0wh3r3 as author. They are squashed because the first one alone takes lower.rs past the 512 KiB limit. Conflicts: Lower::thread_id takes console_flat, as you resolved it. Host::wave_lanes is #2126's Result version, which the split's tests now unwrap. Both test-only Lowered fields are kept. If #2126 lands first, this commit drops out on a rebase.
  • 2eb38bb: the split_ids fix (half and wave base from console_flat), with @⁠0xkn0wh3r3 as author and @⁠stem23456-coder as co-author, plus the 128x1 / 16x8 / 32x4 regression test as lane_order_tests::a_wave64_program_runs_as_the_console_runs_it_on_a_32_lane_host. synthetic_tests::lowered_for is from the patch. I left out the patch's comment and flag cleanups in lower.rs to stay under the size limit; they do not change behaviour.

On an RTX 5060 Laptop, the new test fails at 32x4 without the split_ids change and passes with it, so this card tiles 32x4 groups too. All 11 wave64_tests, the lane_order_tests and #2126's own tests pass.

Workspace tests: 313 of 316 in victory-shader; the other crates all pass. The three failures are the ones that also fail on unmodified main here (stride_tests::a_heap_buffer_*, gathers_at_a_level_match_the_hardware). Clippy is clean with and without --all-features, and the asset policy passes.

@⁠pickles976: thanks for the Wine run. The empty-library refusal is real, and it predates this PR (main's open makes the same empty library). I'll look at starting without an empty library in a separate change, so vkd3d-proton stacks keep pipelines across runs too.

**@⁠RaghavVijayanand** on GitHub · 2026-11-26 12:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/3147#issuecomment-7192321601) @⁠stem23456-coder @⁠0xkn0wh3r3: done. This PR now carries both, so it is the "second to land" you asked about: - **0167517:** #2126's three commits (`console_flat`, the LDS rounding, the `thread_ids` module) as one commit, with @⁠0xkn0wh3r3 as author. They are squashed because the first one alone takes `lower.rs` past the 512 KiB limit. Conflicts: `Lower::thread_id` takes `console_flat`, as you resolved it. `Host::wave_lanes` is #2126's `Result` version, which the split's tests now unwrap. Both test-only `Lowered` fields are kept. If #2126 lands first, this commit drops out on a rebase. - **2eb38bb:** the `split_ids` fix (half and wave base from `console_flat`), with @⁠0xkn0wh3r3 as author and @⁠stem23456-coder as co-author, plus the 128x1 / 16x8 / 32x4 regression test as `lane_order_tests::a_wave64_program_runs_as_the_console_runs_it_on_a_32_lane_host`. `synthetic_tests::lowered_for` is from the patch. I left out the patch's comment and flag cleanups in `lower.rs` to stay under the size limit; they do not change behaviour. On an RTX 5060 Laptop, **the new test fails at 32x4 without the `split_ids` change and passes with it**, so this card tiles 32x4 groups too. All 11 `wave64_tests`, the `lane_order_tests` and #2126's own tests pass. Workspace tests: 313 of 316 in `victory-shader`; the other crates all pass. The three failures are the ones that also fail on unmodified `main` here (`stride_tests::a_heap_buffer_*`, `gathers_at_a_level_match_the_hardware`). Clippy is clean with and without `--all-features`, and the asset policy passes. @⁠pickles976: thanks for the Wine run. The empty-library refusal is real, and it predates this PR (`main`'s `open` makes the same empty library). I'll look at starting without an empty library in a separate change, so vkd3d-proton stacks keep pipelines across runs too.
Author
Owner

@⁠lhnizdo on GitHub · 2026-11-26 14:23 UTC · original

@⁠RaghavVijayanand, an offer for this PR's split, in case you'd like it: lhnizdo:pr/first-lane-scalars, one commit (809c945) on top of this PR's head 2eb38bb.

What it does: the split refuses v_readfirstlane_b32 in a block not every thread reaches (NOT_EVERY_THREAD), because the read goes through the halves' exchange. The title often does this for values that are the same in every lane: spilled SGPRs combined as v_sub_f32 v, s, s and read back into an SGPR inside a lane branch, or an integer division's reciprocal of a scalar. Its cloud program 8b9483919d8d5e99 is refused for 23 such reads.

The commit follows the value back. If it was made by lane-wise arithmetic, selects and compares of scalars and constants only, with each step either earlier in the block with no EXEC write in between, or unguarded in a dominating block, then every lane active at the read holds it, and the read is the lane's own. No exchange, no sync.

Where it lives: in a new lower/uniform.rs, with 6 lines in lower.rs, because lower.rs is 343 bytes from the asset policy's limit on this head.

Test: wave64_tests::a_first_lane_read_of_scalars_in_a_lane_branch_needs_no_exchange. A spill, then the read in a lane branch of one console wave.

  • Without the change, the split refuses the program.
  • With it, it's taken with 0 group syncs and gives the console's values on an RTX 2080 (32-lane waves).
  • The other wave64 tests pass.

The hardware run needs the Agility SDK in the test binary, which #2878 does; without it the GPU part skips here.

On a local stack (this split plus more of mine on top, so not this branch exactly):

  • 7 of the title's 2,527 compute programs no longer need a fallback, and none stopped translating.
  • The cloud program's submissions on the RTX 2080 went from about 12 s to normal.

Take it, change it, or leave it, whatever suits the PR.

AI-assisted (Claude Code); tests on my machine. No game data.

**@⁠lhnizdo** on GitHub · 2026-11-26 14:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/3147#issuecomment-7194758531) @⁠RaghavVijayanand, an offer for this PR's split, in case you'd like it: [`lhnizdo:pr/first-lane-scalars`](https://github.com/lhnizdo/VIctory/tree/pr/first-lane-scalars), one commit (`809c945`) on top of this PR's head `2eb38bb`. **What it does:** the split refuses `v_readfirstlane_b32` in a block not every thread reaches (`NOT_EVERY_THREAD`), because the read goes through the halves' exchange. The title often does this for values that are the same in every lane: spilled SGPRs combined as `v_sub_f32 v, s, s` and read back into an SGPR inside a lane branch, or an integer division's reciprocal of a scalar. Its cloud program `8b9483919d8d5e99` is refused for 23 such reads. The commit follows the value back. If it was made by lane-wise arithmetic, selects and compares of scalars and constants only, with each step either earlier in the block with no EXEC write in between, or unguarded in a dominating block, then every lane active at the read holds it, and the read is the lane's own. No exchange, no sync. **Where it lives:** in a new `lower/uniform.rs`, with 6 lines in `lower.rs`, because `lower.rs` is 343 bytes from the asset policy's limit on this head. **Test:** `wave64_tests::a_first_lane_read_of_scalars_in_a_lane_branch_needs_no_exchange`. A spill, then the read in a lane branch of one console wave. - Without the change, the split refuses the program. - With it, it's taken with 0 group syncs and gives the console's values on an RTX 2080 (32-lane waves). - The other wave64 tests pass. The hardware run needs the Agility SDK in the test binary, which #2878 does; without it the GPU part skips here. **On a local stack** (this split plus more of mine on top, so not this branch exactly): - 7 of the title's 2,527 compute programs no longer need a fallback, and none stopped translating. - The cloud program's submissions on the RTX 2080 went from about 12 s to normal. Take it, change it, or leave it, whatever suits the PR. AI-assisted (Claude Code); tests on my machine. No game data.
Author
Owner

@⁠Kajanos on GitHub · 2026-11-26 16:06 UTC · original

Windows 11 / RTX 5080 (32-lane waves) world run of this branch: the wave64 split removes the ~2.3 s loop-cap submissions with the default loop limit. VICTORY_WAVE64_APPROX=1 crashed at world load.

Setup: Windows 11 Home build 26300, RTX 5080 16 GB, NVIDIA 621.40, Ryzen 9 9950X3D (with its Radeon iGPU beside the RTX), 64 GB. Retail 1.0.2.1, default console (Series X). Head 7e64168 as is (on main 63bcca4), --profile diag --features diagnostics. translate --cache --pipelines was run on the desktop before each mode. The title was played by hand to the same spot in the world, about 3 minutes there per run.

Startup: host adapter (high performance) adapter="NVIDIA GeForce RTX 5080", host wave lanes min=32 max=32 wave64=false. The adapter choice works on this two-GPU box.

Build (same machine, same save) World GPU ms/frame Slow host submissions
main 63bcca4 black screen, stuck after frame 1 (heap capped, no room for the null buffer views) – –
main + #2461 + 2^18 dynamic slots, loop limit 2^20 0.4–0.6 fps ~2,700 57, nearly all 2,331–2,339 ms
same, diag, VICTORY_SHADER_LOOP_LIMIT=4096 ~3.1 fps ~200 0
this PR, default loop limit 2.7–2.9 fps 190–235 18–24, 264–915 ms
this PR, VICTORY_WAVE64_APPROX=1 crash at world load (below) – –

Plain mode (no approx)

  • translate: 543 of 25,985 shader containers refused. Pipelines: the host refuses it 397 → 1, compute shader does not translate 24 → 333.
  • At runtime, 148 programs are dropped as not translating. 77: LDS shared without barriers by a wave64 group of 33 to 64 threads. 65: a wave64 cross-lane operation spanning both halves. 2: a lane mask read as data. 1 each: v_permlanex16_b32, barycentrics read directly, a descriptor read only as data, a 16-bit wave reduction in a wave64 program.
  • A typical frame at the spot: 2.6 fps, 387.4 ms/frame (114.3 preparing: copies 74.6 ms 436.3 MB …; 234.9 on the GPU; 35.7 copying back), about 3,000 draws/frame, dropped 337 without a host pipeline … and 67 indirect. Task Manager shows the GPU at 50–60%.
  • 0 ERROR lines, no device removal, no crashes.log. Clean exit on closing the window.

GPU timing (VICTORY_GPU_TIMING=1 + VICTORY_D3D12_DRED=1, plain mode, default loop limit): lists 189.1 ms/frame of wall time, their commands 173.2 ms/frame. Top programs by average ms per frame:

Program Kind This PR, limit 2^20 #2461 + 2^18, limit 4096
compute 0184869d6e47e5fa indirect kind 2 38.1 37.9
compute 5552dac6a2b7a1fd dispatch 25.6 –
compute ce30cb330ef34306 indirect kind 2 17.9 20.8
compute c7feccae4e01e454 indirect kind 2 38.1 (10 of 43 frames) 35.2
compute 3b90165a77d95cdf dispatch 13.0 –
compute 512416d975ace48b dispatch 6.8 6.6
mesh 857b2e13c9cc107f + pixel 63051e97862e7dad mesh 6.3 4.0
compute 00167d58cc5a78d7 dispatch 5.1 4.7

With the default limit, the three indirect programs (0184869d, ce30cb33, c7feccae, also in #71 / #898 / #1465) now cost what they cost on the other build at a 4096 cap, so they no longer run to the cap. Together they are still about half of the frame's GPU command time. 5552dac6 and 3b90165a are new in the ranking. I have not checked whether they are programs this PR splits.

VICTORY_WAVE64_APPROX=1

  • translate: 229 containers refused (plain: 543), pipelines compute shader does not translate 24.
  • The menu ran at ~28–30 fps. At world load the process died with unhandled exception 0xc0000005 at victory-image-…dll+0x23cf683 (write 0x0: nothing mapped there), on a thread that starts from KERNEL32 (title code, not VIctory).
  • It came right after first bind … stage=compute … hash=c06aa62112ffba4c. In the 100 ms before it, a burst of refused buffer view: empty or past its copy start=0x0 first=0 count=0 element=4, one unordered buffer view empty or past its host copy, and one a shader view in a format of another family than its host texture. GPU load showed 100% around that time, unlike plain mode.
  • One run only. Plain mode with the same build and save loads the world every time, so this looks approx-specific (an approximated program writing data the title uses as a pointer). That is not verified, and c06aa621 is only the program bound at that frame.

Not run: cargo test on this head, VICTORY_WAVE64_LOOPS other than the default, a second approx run.

AI-assisted (Claude Code)

**@⁠Kajanos** on GitHub · 2026-11-26 16:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/3147#issuecomment-7197181357) **Windows 11 / RTX 5080 (32-lane waves) world run of this branch: the wave64 split removes the ~2.3 s loop-cap submissions with the default loop limit. `VICTORY_WAVE64_APPROX=1` crashed at world load.** Setup: Windows 11 Home build 26300, RTX 5080 16 GB, NVIDIA 621.40, Ryzen 9 9950X3D (with its Radeon iGPU beside the RTX), 64 GB. Retail 1.0.2.1, default console (Series X). Head `7e64168` as is (on `main` `63bcca4`), `--profile diag --features diagnostics`. `translate --cache --pipelines` was run on the desktop before each mode. The title was played by hand to the same spot in the world, about 3 minutes there per run. Startup: `host adapter (high performance) adapter="NVIDIA GeForce RTX 5080"`, `host wave lanes min=32 max=32 wave64=false`. The adapter choice works on this two-GPU box. | Build (same machine, same save) | World | GPU ms/frame | Slow host submissions | |---|---|---|---| | `main` `63bcca4` | black screen, stuck after frame 1 (heap capped, `no room for the null buffer views`) | – | – | | `main` + #2461 + 2^18 dynamic slots, loop limit 2^20 | 0.4–0.6 fps | ~2,700 | 57, nearly all 2,331–2,339 ms | | same, diag, `VICTORY_SHADER_LOOP_LIMIT=4096` | ~3.1 fps | ~200 | 0 | | **this PR, default loop limit** | **2.7–2.9 fps** | **190–235** | 18–24, 264–915 ms | | this PR, `VICTORY_WAVE64_APPROX=1` | crash at world load (below) | – | – | **Plain mode (no approx)** - `translate`: 543 of 25,985 shader containers refused. Pipelines: `the host refuses it` 397 → 1, `compute shader does not translate` 24 → 333. - At runtime, 148 programs are dropped as not translating. 77: `LDS shared without barriers by a wave64 group of 33 to 64 threads`. 65: `a wave64 cross-lane operation spanning both halves`. 2: `a lane mask read as data`. 1 each: `v_permlanex16_b32`, barycentrics read directly, a descriptor read only as data, a 16-bit wave reduction in a wave64 program. - A typical frame at the spot: `2.6 fps, 387.4 ms/frame (114.3 preparing: copies 74.6 ms 436.3 MB …; 234.9 on the GPU; 35.7 copying back)`, about 3,000 draws/frame, `dropped 337 without a host pipeline … and 67 indirect`. Task Manager shows the GPU at 50–60%. - 0 ERROR lines, no device removal, no `crashes.log`. Clean exit on closing the window. **GPU timing** (`VICTORY_GPU_TIMING=1` + `VICTORY_D3D12_DRED=1`, plain mode, default loop limit): `lists 189.1 ms/frame of wall time, their commands 173.2 ms/frame`. Top programs by average ms per frame: | Program | Kind | This PR, limit 2^20 | #2461 + 2^18, limit 4096 | |---|---|---:|---:| | compute `0184869d6e47e5fa` | indirect kind 2 | 38.1 | 37.9 | | compute `5552dac6a2b7a1fd` | dispatch | 25.6 | – | | compute `ce30cb330ef34306` | indirect kind 2 | 17.9 | 20.8 | | compute `c7feccae4e01e454` | indirect kind 2 | 38.1 (10 of 43 frames) | 35.2 | | compute `3b90165a77d95cdf` | dispatch | 13.0 | – | | compute `512416d975ace48b` | dispatch | 6.8 | 6.6 | | mesh `857b2e13c9cc107f` + pixel `63051e97862e7dad` | mesh | 6.3 | 4.0 | | compute `00167d58cc5a78d7` | dispatch | 5.1 | 4.7 | With the default limit, the three indirect programs (`0184869d`, `ce30cb33`, `c7feccae`, also in #71 / #898 / #1465) now cost what they cost on the other build at a 4096 cap, so they no longer run to the cap. Together they are still about half of the frame's GPU command time. `5552dac6` and `3b90165a` are new in the ranking. I have not checked whether they are programs this PR splits. **`VICTORY_WAVE64_APPROX=1`** - `translate`: 229 containers refused (plain: 543), pipelines `compute shader does not translate` 24. - The menu ran at ~28–30 fps. At world load the process died with `unhandled exception 0xc0000005 at victory-image-…dll+0x23cf683 (write 0x0: nothing mapped there)`, on a thread that starts from `KERNEL32` (title code, not VIctory). - It came right after `first bind … stage=compute … hash=c06aa62112ffba4c`. In the 100 ms before it, a burst of `refused buffer view: empty or past its copy start=0x0 first=0 count=0 element=4`, one `unordered buffer view empty or past its host copy`, and one `a shader view in a format of another family than its host texture`. GPU load showed 100% around that time, unlike plain mode. - One run only. Plain mode with the same build and save loads the world every time, so this looks approx-specific (an approximated program writing data the title uses as a pointer). That is not verified, and `c06aa621` is only the program bound at that frame. Not run: `cargo test` on this head, `VICTORY_WAVE64_LOOPS` other than the default, a second approx run. AI-assisted (Claude Code)
Author
Owner

@⁠Kajanos on GitHub · 2026-11-26 16:32 UTC · original

Follow-up at 2eb38bb, same machine as my earlier comment (Windows 11 Home build 26300, RTX 5080, NVIDIA 621.40): plain mode is unchanged, and the VICTORY_WAVE64_APPROX=1 crash reproduces at the same address.

Head 2eb38bb as is, on main 63bcca4, diag build, fresh translate --cache --pipelines per mode on the desktop. Same save and spot as before.

Plain mode (with VICTORY_GPU_TIMING=1 + VICTORY_D3D12_DRED=1)

  • translate gives the same counts as 7e64168: 543 of 25,985 containers refused; pipelines skipped as compute shader does not translate 333, the host refuses it 1. The same 148 programs are dropped at runtime, for the same reasons.
  • World: 2.5–2.6 fps, ~383–393 ms/frame, ~237 ms on the GPU, preparing 110–120 ms (copies 61–70 ms, 408–428 MB/frame). lists 184.7 ms/frame of wall time, their commands 168.7 ms/frame.
  • Top programs, avg ms per frame at 2eb38bb [7e64168]: compute 0184869d6e47e5fa 35.9 [38.1], 5552dac6a2b7a1fd 31.4 [25.6], ce30cb330ef34306 18.0 [17.9], c7feccae4e01e454 37.5 [38.1], 3b90165a77d95cdf 16.5 [13.0].
  • 0 ERROR lines, no device removal, no crashes.log, clean exit.

VICTORY_WAVE64_APPROX=1: the crash at world load reproduces. The menu runs at ~22–30 fps, then:

unhandled exception 0xc0000005 at victory-image-…dll+0x23cf683 (write 0x0: nothing mapped there)
rax 0x0 rbx 0x0 rcx 0xd0024c348 rdx 0x1 … rbp 0x0
r8 0xd074d8c40 r9 0xd074d8e20 r10 0xd074d8ad8 r11 0xd074d8c40 …
#0 +0x23cf683  #1 +0x2215c35  #2 +0x2215eca  #3 KERNEL32+0x2dda7  #4 ntdll+0xc9c5c
  • The address, the stack and rcx/r8–r11 are identical to the 7e64168 run. Only the stack and heap pointers differ.
  • In the ~2 s before it, there is the same burst: 199× refused buffer view: empty or past its copy start=0x0 first=0 count=0 element=4, 1× unordered buffer view empty or past its host copy, 2× a shader view in a format of another family than its host texture.
  • The crash frame (1120 → 1213) and the compute programs bound just before it differ between the two runs, so the last-bound program is not a lead.
  • So the thread-id and half-pairing fixes in 0167517/2eb38bb don't change it. It still looks like an approximated program writing data the title later dereferences, but which program is not known. Not tried: VICTORY_WAVE64_LOOPS other than the default, or narrowing the approximated set.

AI-assisted (Claude Code)

**@⁠Kajanos** on GitHub · 2026-11-26 16:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/3147#issuecomment-7197779969) **Follow-up at `2eb38bb`, same machine as [my earlier comment](https://git.gtahub.st/github/Marvisak--VIctory/pulls/3147) (Windows 11 Home build 26300, RTX 5080, NVIDIA 621.40): plain mode is unchanged, and the `VICTORY_WAVE64_APPROX=1` crash reproduces at the same address.** Head `2eb38bb` as is, on `main` `63bcca4`, diag build, fresh `translate --cache --pipelines` per mode on the desktop. Same save and spot as before. **Plain mode (with `VICTORY_GPU_TIMING=1` + `VICTORY_D3D12_DRED=1`)** - `translate` gives the same counts as `7e64168`: 543 of 25,985 containers refused; pipelines skipped as `compute shader does not translate` 333, `the host refuses it` 1. The same 148 programs are dropped at runtime, for the same reasons. - World: 2.5–2.6 fps, ~383–393 ms/frame, ~237 ms on the GPU, preparing 110–120 ms (copies 61–70 ms, 408–428 MB/frame). `lists 184.7 ms/frame of wall time, their commands 168.7 ms/frame`. - Top programs, avg ms per frame at `2eb38bb` [`7e64168`]: compute `0184869d6e47e5fa` 35.9 [38.1], `5552dac6a2b7a1fd` 31.4 [25.6], `ce30cb330ef34306` 18.0 [17.9], `c7feccae4e01e454` 37.5 [38.1], `3b90165a77d95cdf` 16.5 [13.0]. - 0 ERROR lines, no device removal, no `crashes.log`, clean exit. **`VICTORY_WAVE64_APPROX=1`**: the crash at world load reproduces. The menu runs at ~22–30 fps, then: ``` unhandled exception 0xc0000005 at victory-image-…dll+0x23cf683 (write 0x0: nothing mapped there) rax 0x0 rbx 0x0 rcx 0xd0024c348 rdx 0x1 … rbp 0x0 r8 0xd074d8c40 r9 0xd074d8e20 r10 0xd074d8ad8 r11 0xd074d8c40 … #0 +0x23cf683 #1 +0x2215c35 #2 +0x2215eca #3 KERNEL32+0x2dda7 #4 ntdll+0xc9c5c ``` - The address, the stack and `rcx`/`r8`–`r11` are identical to the `7e64168` run. Only the stack and heap pointers differ. - In the ~2 s before it, there is the same burst: 199× `refused buffer view: empty or past its copy start=0x0 first=0 count=0 element=4`, 1× `unordered buffer view empty or past its host copy`, 2× `a shader view in a format of another family than its host texture`. - The crash frame (1120 → 1213) and the compute programs bound just before it differ between the two runs, so the last-bound program is not a lead. - So the thread-id and half-pairing fixes in `0167517`/`2eb38bb` don't change it. It still looks like an approximated program writing data the title later dereferences, but which program is not known. Not tried: `VICTORY_WAVE64_LOOPS` other than the default, or narrowing the approximated set. AI-assisted (Claude Code)
Author
Owner

@⁠lhnizdo on GitHub · 2026-11-26 17:11 UTC · original

@⁠RaghavVijayanand, a second idea for this PR's split, from the same local stack as the first-lane offer, in case it fits. No branch yet: on this head it needs rebuilding around VICTORY_WAVE64_APPROX, and I'd rather ask first whether you want it here.

The case: a group of one console wave (33 to 64 threads) that the split refuses with NOT_EVERY_THREAD. In the title most of those programs use the console compiler's atomic optimizer inside a lane branch: a lane count (s_bcnt1 of EXEC) or a sum over the wave (DPP, v_permlanex16, v_readlane …, 32), one atomic by the first lane (s_ff1 + v_cmpx_eq against the v_mbcnt rank), and each lane's slot = the returned base + its rank. The split can't exchange there.

What I do with them: run each half as a wave of its own, lowered exactly as a group of 32 threads is today (no split, WaveSize(32)), with v_readlane of a constant lane ≥ 32 reading 0. HLSL's wave operations hold for any wave size, so this is the program as it would run on 32-lane hardware. Per half, each half takes its own slots with its own atomic, and every lane still gets a unique one. The order between the halves differs, but that was never fixed between waves anyway.

Only where that's safe: a classification over the IR (per_half_ok):

  • Values computed over lanes (counts, first lanes, sums, readlanes) may only flow into an atomic's data (combining ops only: add, sub, and, or, xor, min, max) or into choosing the lane that does it.
  • An atomic's result, plus ranks, counts as a slot and may go anywhere.
  • Refused: a value over lanes that is stored, used as an address or an atomic's address, or that decides a branch or EXEC. LDS anywhere is refused too.
  • Accepted as each lane's own: waterfall reads and tests (res.waterfall); a first-lane read used only as a scalar load's address (a resource index HLSL holds alike in the wave); and the first-lane reads of values made of scalars (the other offer).

Measured on the local stack:

  • Census of the title's 2,527 compute programs: 28 run per half, none stopped translating.
  • In the world on an RTX 2080, the three costliest programs on the GPU all used it: 9d1d228b02e56a96 (457 ms a frame), 2809db6c31de483d (245 ms) and 73ac67482f6b6a5d (131 ms). After, each was under 9.4 ms, below the GPU timing's top 25. GPU time went from about 1.67 s to 0.97 s a frame, frame time from 3.6 to 1.8 s (one run each; the GPU part is the steady one).

Tests, all on hand-encoded GFX10, run on an RTX 2080:

  • The atomic optimizer in a lane branch of one console wave: per half, the counter ends at 40 and slots 1–40 hold 1–40 in any order.
  • A stored lane count is not run per half.
  • A first-lane resource index keeps a program per half; the same value stored does not.
  • A wave64 waterfall over table entries, alone (the split) and beside the atomic optimizer (per half), with each lane loading from its own buffer.

On this PR it would be an alternative to VICTORY_WAVE64_APPROX for the programs the classification accepts: exact by HLSL's rules where approx can be wrong. If that's of interest, I can port it onto this head as a branch.

AI-assisted (Claude Code); runs on my machine. No game data.

**@⁠lhnizdo** on GitHub · 2026-11-26 17:11 UTC · [original](https://github.com/Marvisak/VIctory/pull/3147#issuecomment-7198633522) @⁠RaghavVijayanand, a second idea for this PR's split, from the same local stack as the first-lane offer, in case it fits. No branch yet: on this head it needs rebuilding around `VICTORY_WAVE64_APPROX`, and I'd rather ask first whether you want it here. **The case:** a group of one console wave (33 to 64 threads) that the split refuses with `NOT_EVERY_THREAD`. In the title most of those programs use the console compiler's **atomic optimizer** inside a lane branch: a lane count (`s_bcnt1` of EXEC) or a sum over the wave (DPP, `v_permlanex16`, `v_readlane …, 32`), one atomic by the first lane (`s_ff1` + `v_cmpx_eq` against the `v_mbcnt` rank), and each lane's slot = the returned base + its rank. The split can't exchange there. **What I do with them:** run each half as a wave of its own, lowered exactly as a group of 32 threads is today (no split, `WaveSize(32)`), with `v_readlane` of a constant lane ≥ 32 reading 0. HLSL's wave operations hold for any wave size, so this is the program as it would run on 32-lane hardware. Per half, each half takes its own slots with its own atomic, and every lane still gets a unique one. The order between the halves differs, but that was never fixed between waves anyway. **Only where that's safe:** a classification over the IR (`per_half_ok`): - Values computed over lanes (counts, first lanes, sums, readlanes) may only flow into an atomic's data (combining ops only: add, sub, and, or, xor, min, max) or into choosing the lane that does it. - An atomic's result, plus ranks, counts as a slot and may go anywhere. - Refused: a value over lanes that is stored, used as an address or an atomic's address, or that decides a branch or EXEC. LDS anywhere is refused too. - Accepted as each lane's own: waterfall reads and tests (`res.waterfall`); a first-lane read used only as a scalar load's address (a resource index HLSL holds alike in the wave); and the first-lane reads of values made of scalars (the other offer). **Measured on the local stack:** - Census of the title's 2,527 compute programs: 28 run per half, none stopped translating. - In the world on an RTX 2080, the three costliest programs on the GPU all used it: `9d1d228b02e56a96` (457 ms a frame), `2809db6c31de483d` (245 ms) and `73ac67482f6b6a5d` (131 ms). After, each was under 9.4 ms, below the GPU timing's top 25. GPU time went from about 1.67 s to 0.97 s a frame, frame time from 3.6 to 1.8 s (one run each; the GPU part is the steady one). **Tests,** all on hand-encoded GFX10, run on an RTX 2080: - The atomic optimizer in a lane branch of one console wave: per half, the counter ends at 40 and slots 1–40 hold 1–40 in any order. - A stored lane count is not run per half. - A first-lane resource index keeps a program per half; the same value stored does not. - A wave64 waterfall over table entries, alone (the split) and beside the atomic optimizer (per half), with each lane loading from its own buffer. On this PR it would be an alternative to `VICTORY_WAVE64_APPROX` for the programs the classification accepts: exact by HLSL's rules where approx can be wrong. If that's of interest, I can port it onto this head as a branch. AI-assisted (Claude Code); runs on my machine. No game data.
Author
Owner

@⁠pickles976 on GitHub · 2026-11-26 19:16 UTC · original

Wine follow-through: mmap library works with #1722's cold-bootstrap fix

Mixed integration, not an exact PR-head result: 2eb38bb1185f1b1b077da398b8e435787c0c6356 plus only #1722 ee84a44859d4384ea5b945fa59e09ad9f9ac8d61's explicit-null empty-library creation block in production. Kept this PR's Blob::Mapped ownership and generation logic unchanged. Separate local checkout VIctory-pr3147-cache; the earlier dirty checkout was not switched or overwritten.

pipeline::library::tests::: 14 passed, 0 failed/ignored, 0.89 s after fresh8.25s compilation of the intended GPU crate and local dependencies:

cargo test --locked --target x86_64-pc-windows-msvc -p victory-gpu --lib pipeline::library::tests:: -- --nocapture --test-threads=1

Local test-only strengthening:

  • Six absent-device/library/compiler returns now panic, so those paths cannot silently pass.
  • The concurrent fixture still builds/stores48 synthetic compute PSOs, but now serializes the populated library directly into a writable file mapping, flushes/drops that mapping, opens a read-only mapping, and passes Blob::Mapped to open. It asserts the mapping was accepted rather than rejected into an empty library, retains the Library owner during all operations, then runs the original eight-thread matching/mismatched/missing-entry checks and adds48 more entries. All96 eventual loads pass. This extends the existing mapped-file fixture, which only round-trips an empty library.
  • a_pipeline_loads_while_a_save_holds_the_library also executes successfully with a real library required; it is no longer able to pass by returning because Wine bootstrap failed.

Host: physical NVIDIA RTX4060 Laptop8GiB, driver590.48.1; Linux/Wine11.0, Rust1.98.1 Windows MSVC target, vendor masking disabled. Diagnostic-relaxed vkd3d-proton3.2.0 2576c0b4adfae4a+, not stock-driver certification. Single test thread,9GiB memory/512MiB swap scope,180s timeout. Evidence: .compat-runtime/logs/verify-pr3147-pr1722-wine-mapped-library.log.

This clears the previously observed Wine empty-library prerequisite for the mapped-cache path in this disclosed combination. I did not rerun the unchanged empty-blob failure. No title launch, shader dispatch, new wave64/lighting validation, large-cache resident-memory measurement, or demonstrated loading-RAM improvement. The earlier loading guard stop remains valid; the author's2.4GB saving is not a measurement from this laptop. Suggested integration: carry the owner #1722 bootstrap fix and retain a populated mapped-library regression, rather than relying only on empty-library roundtrips.

Separate diagnostic lead for the reported approx-mode crash

@⁠Kajanos: the +0x2215c35 / +0x2215eca frames in your follow-up deserve checking before attributing +0x23cf683 to an arbitrary corrupted pointer. On our retail1.0.2.1 executable, bounded static analysis of the unchanged code at +0x2215c35 identifies an explicit absolute-null store followed by INT3, reached by the title's job-system watchdog (unchanged-heartbeat countdown or a separate timed-entry fatal route). Our XCL minidump also has the worker-pool frames; details are in the existing report.

[INFERENCE] The shared watchdog frames make a stall-triggered deliberate crash a lead for your Windows approx-mode report too; they do not establish identical causality or prove what +0x23cf683 does in your prepared image. Please inspect the crash context/minidump and heartbeat/worker state before treating the final null write as evidence of an approximated shader manufacturing a bad pointer. I did not reproduce your crash or enable approximation, and this is not a claim that VIctory and XCL have the same underlying stall.

AI-assisted verification/source review (OpenAI GPT-6 Astra).

**@⁠pickles976** on GitHub · 2026-11-26 19:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/3147#issuecomment-7201387561) ### Wine follow-through: mmap library works with #1722's cold-bootstrap fix **Mixed integration, not an exact PR-head result:** `2eb38bb1185f1b1b077da398b8e435787c0c6356` plus only #1722 `ee84a44859d4384ea5b945fa59e09ad9f9ac8d61`'s explicit-null empty-library creation block in production. Kept this PR's `Blob::Mapped` ownership and generation logic unchanged. Separate local checkout `VIctory-pr3147-cache`; the earlier dirty checkout was not switched or overwritten. `pipeline::library::tests::`: **14 passed, 0 failed/ignored**, 0.89 s after fresh8.25s compilation of the intended GPU crate and local dependencies: ```text cargo test --locked --target x86_64-pc-windows-msvc -p victory-gpu --lib pipeline::library::tests:: -- --nocapture --test-threads=1 ``` Local test-only strengthening: - Six absent-device/library/compiler returns now panic, so those paths cannot silently pass. - The concurrent fixture still builds/stores48 synthetic compute PSOs, but now **serializes the populated library directly into a writable file mapping**, flushes/drops that mapping, opens a read-only mapping, and passes `Blob::Mapped` to `open`. It asserts the mapping was accepted rather than rejected into an empty library, retains the `Library` owner during all operations, then runs the original eight-thread matching/mismatched/missing-entry checks and adds48 more entries. All96 eventual loads pass. This extends the existing mapped-file fixture, which only round-trips an empty library. - `a_pipeline_loads_while_a_save_holds_the_library` also executes successfully with a real library required; it is no longer able to pass by returning because Wine bootstrap failed. Host: physical NVIDIA RTX4060 Laptop8GiB, driver590.48.1; Linux/Wine11.0, Rust1.98.1 Windows MSVC target, vendor masking disabled. Diagnostic-relaxed vkd3d-proton3.2.0 `2576c0b4adfae4a+`, **not stock-driver certification**. Single test thread,9GiB memory/512MiB swap scope,180s timeout. Evidence: `.compat-runtime/logs/verify-pr3147-pr1722-wine-mapped-library.log`. This clears the previously observed Wine empty-library prerequisite for the mapped-cache path **in this disclosed combination**. I did not rerun the unchanged empty-blob failure. No title launch, shader dispatch, new wave64/lighting validation, large-cache resident-memory measurement, or demonstrated loading-RAM improvement. The earlier loading guard stop remains valid; the author's2.4GB saving is not a measurement from this laptop. Suggested integration: carry the owner #1722 bootstrap fix and retain a populated mapped-library regression, rather than relying only on empty-library roundtrips. ### Separate diagnostic lead for the reported approx-mode crash @⁠Kajanos: the `+0x2215c35` / `+0x2215eca` frames in your follow-up deserve checking before attributing `+0x23cf683` to an arbitrary corrupted pointer. On our retail1.0.2.1 executable, bounded static analysis of the unchanged code at `+0x2215c35` identifies an **explicit absolute-null store followed by INT3**, reached by the title's job-system watchdog (unchanged-heartbeat countdown or a separate timed-entry fatal route). Our XCL minidump also has the worker-pool frames; details are in [the existing report](https://github.com/xcl-dev/xcl/pull/850#issuecomment-7190646148). **[INFERENCE]** The shared watchdog frames make a stall-triggered deliberate crash a lead for your Windows approx-mode report too; they do not establish identical causality or prove what `+0x23cf683` does in your prepared image. Please inspect the crash context/minidump and heartbeat/worker state before treating the final null write as evidence of an approximated shader manufacturing a bad pointer. I did not reproduce your crash or enable approximation, and this is not a claim that VIctory and XCL have the same underlying stall. AI-assisted verification/source review (OpenAI GPT-6 Astra).
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3147/head:github-bot/gh-3147'
git switch 'github-bot/gh-3147'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3147'
git switch 'github-bot/gh-3147'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3147'
git switch 'github-bot/gh-3147'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3147'
git switch 'main'
git merge --squash 'github-bot/gh-3147'
git switch 'main'
git merge --ff-only 'github-bot/gh-3147'
git switch 'main'
git merge 'github-bot/gh-3147'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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/Marvisak--VIctory!3147
No description provided.