victory-gpu: 16-bit packed colour widens for the host (the second crash between the account screen and gameplay), and the two tools it took #2936

Open
github-bot wants to merge 29 commits from github-bot/gh-2936 into main AGit
Owner

@⁠pes7 on GitHub · 2026-11-26 00:48 UTC · original
pes7:fix/prologue → main · +645 −38 · 13 files · 29 commits · open

What is left after the null-alias fix was merged upstream (219878a, "GPU: a null shader view has no alias source"): the second crash that stood between the account screen and gameplay, and the two tools this needed. Rebased onto main (63bcca4); the branch is now only these three commits.

commit what it does what the run showed
b1ec6e0 16-bit packed colour (B5G6R5, B5G5R5A1, B4G4R4A4) widens to BGRA8 in pc_format, the one function resources, views, twins and pipeline target formats all go through the device was removed with DXGI_ERROR_INVALID_CALL on a typed UAV of B5G5R5A1 and on a B4G4R4A4 render target; with it the title reaches gameplay - 2 555 draws a frame, 8 137 at the widest
b1ec6e0 fail() drains the D3D12 debug layer's stored messages a removal now names the call (ID3D12Device::CreateUnorderedAccessView: ...) instead of only DXGI_ERROR_INVALID_CALL
2e15dc6 VICTORY_DUMP_SHADER=<hash> writes that shader's translated DXIL to %TEMP%\victory-<hash>.dxil for dxc -dumpbin named the two families behind "the GPU hangs": a ray march whose only exit is a float compare or the 2^20 loop limit, and a straight-line shader with no loops and no barriers at all

The prologue then runs at 1.0-2.4 fps (867-1006 ms a frame, 683-807 ms of it on the GPU, 372-508 draws a frame dropped while their pipelines are made, 4 481 host textures / 6 050 MB). Those numbers, and the way VICTORY_SHADER_LOOP_LIMIT=16 moves the GPU term to 147-370 ms, are in the comments below - that is the next piece of work, not this PR.

Tests on this branch: cargo test --release --workspace - 30 suites, all ok; clippy clean; builds with and without --features diagnostics.

**@⁠pes7** on GitHub · 2026-11-26 00:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936) `pes7:fix/prologue` → `main` · +645 −38 · 13 files · 29 commits · open What is left after the null-alias fix was merged upstream (`219878a`, "GPU: a null shader view has no alias source"): the second crash that stood between the account screen and gameplay, and the two tools this needed. Rebased onto `main` (`63bcca4`); the branch is now only these three commits. | commit | what it does | what the run showed | |---|---|---| | `b1ec6e0` | 16-bit packed colour (B5G6R5, B5G5R5A1, B4G4R4A4) widens to BGRA8 in `pc_format`, the one function resources, views, twins and pipeline target formats all go through | the device was removed with `DXGI_ERROR_INVALID_CALL` on a typed UAV of B5G5R5A1 and on a B4G4R4A4 render target; with it **the title reaches gameplay** - 2 555 draws a frame, 8 137 at the widest | | `b1ec6e0` | `fail()` drains the D3D12 debug layer's stored messages | a removal now names the call (`ID3D12Device::CreateUnorderedAccessView: ...`) instead of only `DXGI_ERROR_INVALID_CALL` | | `2e15dc6` | `VICTORY_DUMP_SHADER=<hash>` writes that shader's translated DXIL to `%TEMP%\victory-<hash>.dxil` for `dxc -dumpbin` | named the two families behind "the GPU hangs": a ray march whose only exit is a float compare or the 2^20 loop limit, and a straight-line shader with no loops and no barriers at all | The prologue then runs at 1.0-2.4 fps (867-1006 ms a frame, 683-807 ms of it on the GPU, 372-508 draws a frame dropped while their pipelines are made, 4 481 host textures / 6 050 MB). Those numbers, and the way `VICTORY_SHADER_LOOP_LIMIT=16` moves the GPU term to 147-370 ms, are in the comments below - that is the next piece of work, not this PR. Tests on this branch: `cargo test --release --workspace` - 30 suites, all ok; clippy clean; builds with and without `--features diagnostics`.
`VICTORY_DUMP_SHADER=8bbcbda6008eaa37` (or `all`) writes each named
shader's DXIL to `%TEMP%\victory-<hash>.dxil` as it is translated; `dxc
-dumpbin` reads it as LLVM IR. The pipeline log and the breadcrumb reports
name shaders by this hash, and until now there was no way to see what our
translation of one looks like - which is what a frame spent in a compute
dispatch that asks for 746 tiny groups needs.

Found with it in the prologue: `8bbcbda6008eaa37` (NumThreads 8x4x1) is a
ray march whose exit is a float comparison and whose only other way out is
the loop limit (1 << 20), and `00167d58cc5a78d7` (4x4x4) has no loops and
no barriers at all yet stops the queue - two different causes behind the
same "GPU hang".
The title renders to a 2560x1440 B4G4R4A4_UNORM texture and makes a typed
unordered view of a B5G5R5A1_UNORM one. D3D12 supports neither, and the
debug layer says so while the run is going:

    CreateCommittedResource: A texture that has
    D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET set ... must be created with a
    format that either can be used as a render target, or cast to a format
    that could be

    CreateUnorderedAccessView: The format (0x56, B5G5R5A1_UNORM) cannot be
    used with a Typed Unordered Access View. This is because the current
    graphics implementation does not even support this Format.

    RemoveDevice: DXGI_ERROR_INVALID_CALL

so the run ended a minute after the account screen, in the first scene of
the prologue, with the device removed. (The 16-bit render target's creation
was already failing quietly - `no host texture` - and the unordered view
above removed the device.)

`pc_format` now widens B5G6R5, B5G5R5A1 and B4G4R4A4 (85, 86, 115) to
B8G8R8A8_UNORM (87): the same channel order, legal for render targets,
unordered access and shader reads, and it is the one function resources,
views, twins and pipeline target formats all go through, so they agree. The
title loses the console's 5 or 4 bits a channel, not the picture's layout.

With it the title reaches gameplay and the numbers the frame report then
prints for the first time: 2 555 draws a frame (before: the device was
removed in the loading screen), 3 969 ms a frame, 1 674 draws dropped for
want of a host pipeline, 621 MB of title memory copied and 139 MB of
textures uploaded a frame. That frame's 3.6 s on the GPU is the next
problem - and, being over the 2 s TDR, the next removal.

Found with the debug layer (`VICTORY_D3D12_DEBUG=1`) in a diagnostics
build: `fail()` now drains the layer's stored messages, which name the
call instead of only its code.
The pipeline log says how long a translation took but not who ran it: with
the prologue's cold cache 1 725 translations of ~110 ms each add up to the
20-25 s the first gameplay frame spends, and the question that decides the
fix is whether that is one thread (move it off the recorder) or the eight
pipeline workers (a translator throughput problem). It is the workers:
victory-pipelines-3..7 took 181-288 translations and 18 000-27 000 ms of
wall time each in the same run, so the batch is already spread and the
stall is per-translation cost.
Two diagnostics (the `diagnostics` feature only) that answer why a cold
shader cache costs the first gameplay frame 20-25 s:

    shader phases (us): stage=Cs blocks=1542 range=342 resource=99315 io=5255 emit=8126713
    lowering passes: 74 blocks=1542 setup_us=5561 run_us=85672

- a translation is 74 % structurisation/resource tracing and 25 % lowering
  in the aggregate, but the *worst* shaders are lowering: 8.1 s of 8.2 s for
  the biggest one;
- `emit::lower` re-runs the whole lowering once per phi that does not
  settle (`Stop::Retry`): 74 passes for one shader, 222 extra passes over 17
  shaders in a batch of 1 725. At ~86 ms a pass on 1 542 blocks that is
  6.7 s for one shader alone - the whole cold batch is 160 s of CPU across
  eight workers, 25 s of wall.

Nothing changes in a release build (no `diagnostics`): the phases are
`Instant`s behind `cfg` and the pass count is not compiled at all.
`emit::lower` re-runs the whole lowering once per phi that does not settle
(`Stop::Retry(Value, Why)`): the biggest shader in the prologue needs 74
passes of ~86 ms over 1 542 blocks, 6.7 s of a 8.1 s translation, and 222
extra passes over 17 of the 1 725 shaders a cold cache translates.

`fill_phis` now catches the retry per phi, records the value, leaves a
value of the phi's own type so the rest of the pass still reaches the other
phis, and reports the whole list at the end; `lower` merges it into `bad`
and keeps going only if something new appeared.

Measured, same scenario, cold cache:

    before  translations 1725  sum 235828 ms  median 13 ms  max 8030 ms  passes>1 19  max passes 74
    after   translations  401  sum  30208 ms  median  5 ms  max 2559 ms  passes>1  4  max passes  8

Soundness, because a phi marked `bad` is lowered as `Val::Missing` from then
on and a placeholder can make another phi look unjoinable: the whole
shader pack through `victory translate --list` (26 084 programs, 25 889
per-program outcome lines) gives **identical outcomes** on the two builds -
same emitted/refused set (14 246/14 247 vertex and pixel, 2 658 of 2 682
compute, 8 765 of 8 765 mesh) and the same failure reasons, 0 differences
between the sorted lines. Corpus wall time 47 s -> 44 s. That is outcome
equality, not byte equality of the DXIL; the game run with the change also
reached the same place as without it (the early device removals happen on
both).

cargo test --release --workspace: 30 suites, 0 failures; clippy -D warnings
with and without the diagnostics feature.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:17:54 +00:00
github-bot force-pushed github-bot/gh-2936 from 5319ffcc52 to a1d566232a 2026-11-26 06:32:17 +00:00 Compare
The two searches of \caa78b8ca62bc3d6\ exit on \loaded != key\ and the cap
is the only other way out; whether the key is missing from our copy or the
comparison is wrong needs the values, and those live in title memory that
the shader reads - not in anything a read-back can report after the hang.

With \VICTORY_DUMP_VIEWS\ (diagnostics) and \VICTORY_TRACE_SHADERS\ naming
the shader, every constant or placed buffer view its pipeline binds has the
first sixteen dwords of its copy logged at submission, after the refresh
that fills it.

First run printed nothing for that shader, so it binds its data some other
way (root views or user data rather than tables) - the next step is to log
which kind it does use.
The 6 s dispatch of \caa78b8ca62bc3d6\ binds neither a descriptor table
(nothing printed) nor a root view (nothing printed either): its only
bindings are the user-data dwords, which are now logged at submission -

    traced user data [compute caa78b8ca62bc3d6] user_data=[... 18816, 4294966592, 768 ...]
    traced user data [compute caa78b8ca62bc3d6] user_data=[... 27520, 4294966208, 1024 ...]

6 005 lines in one loading run, and the values are small and structured
(an offset, a negative offset, a size: 18816 / -2048 / 768), not garbage.
So the table the two searches walk is *title memory* (the page-table path),
which puts the memory refresh and its withhold/miss accounting next in
line.
The title's 3 444 host copies of its memory span more than 1 030 distinct
256 MiB regions of its address space, while `CAPACITY` gave a list's page
table room for 512 - "the world's ~4 100 copies use a few dozen", which held
for the world and not for this title. Every region past the cap reads as
absent, and the diagnostics said so plainly:

    title memory this frame: 18 447 withheld and 1 098.1 MB of views kept,
    missed 120 539 pages and 23 256 MiB regions with no copy

A compute shader that searches a table in that memory then reads zeros,
never matches its key and runs its loop to the 2^20 cap. The one that cost
the loading its five seconds is `caa78b8ca62bc3d6` (64 threads, three nested
loops), and with the capacity raised it does not appear in the slow-command
report at all:

    before, CAPACITY 512 : dispatch 1x1x1  [compute caa78b8ca62bc3d6]  6 012.2 ms
    after,  CAPACITY 2048: (below the report's threshold)
    loading run, no VICTORY_SKIP_PIPELINES and the default loop limit:
        120 world frames, 0 device removals, the full 420 s window
        frames 1.8-2.6 s: GPU 1.2-1.7 s, copies 137-240 ms / 1.4-2.0 GB

Until this, the prologue only ran with two dispatches skipped or with the
loop limit cut to 1024 (both diagnostics); with the capacity raised it runs
on an unmodified build.

Cost: a table is `(CAPACITY + 1) * 32 KiB` beside the level-1 entries, so
67 MB instead of 17 MB per table, and the run keeps one or two of them.
Raising it further only helps the remaining 6-19 regions and grows linearly,
so the next change there is to allocate level-2 blocks per submission for
the regions a submission's views reach, not a bigger constant.

The corpus A/B is unchanged, as it must be - the translator is not touched:
25 889 per-program outcome lines, 0 differences, 47 s. cargo test --release
--workspace: 30 suites, 0 failures; clippy -D warnings clean with
diagnostics.
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-26 00:53 UTC · original

Substantial and mostly verified — the HEAP_VIEWS = 1,000,000 change is the principled fix: translated shaders clamp heap indices below it, D3D12_MAX_SHADER_VISIBLE_DESCRIPTOR_HEAP_SIZE_TIER_2 caps every creatable heap at 1,000,000, so a 1<<21 clamp could only ever produce out-of-heap reads (device removal), never a valid descriptor. NULL_RESERVE correctly protects the null-view pair on the capped path (MIN_DYNAMIC - 1024 leaves slots 999,998/999,999 free exactly where NULL_BUFFER_VIEW lands).

Two things to untangle before merge:

  1. The alias_source hunk is already on main — placed.is_null() guard merged as 219878a ("a null shader view has no alias source", the #2847 crash class). Identical code and comment; a rebase will show it as an empty diff. Your earlier PR #2933 was the same change.

  2. Residual OOB on smaller heaps: HEAP_VIEWS = 1M only puts NULL_BUFFER_VIEW inside the heap when the heap is actually ≥1M. On NVIDIA, make(count + MIN_DYNAMIC) succeeds for counts ≤934,464 — e.g. a 737,856-count title heap makes an 803,392-descriptor heap, where index 999,998 is still past the end (pairs_end falls back to total, the nulls are never written, and a clamped index still reads OOB). GTA6's own 934,464-count heap lands exactly at make(1,000,000) so its crash is covered, but the title-side cap is only fully guaranteed on the PORTABLE_VIEWS arm. Possibly worth pairs_end/null placement at total - 2 when HEAP_VIEWS > total — or a comment noting the smaller-heap case remains a documented shortcut.

  3. pc_format 85/86/115→87 is the alternative shape of #2442's fix for the same crash class (B5G5R5A1 + typed UAV → DXGI_ERROR_INVALID_CALL removal): yours widens the resource format at creation, #2442 keeps the format and strips ALLOW_UNORDERED_ACCESS where the host can't store typed. They're complementary rather than conflicting — worth a line in the PR description saying which case each covers (widening handles RT too; the flag strip handles formats that must keep their bit layout).

**@⁠kotekompotek** on GitHub · 2026-11-26 00:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7179219469) Substantial and mostly verified — the `HEAP_VIEWS` = 1,000,000 change is the principled fix: translated shaders clamp heap indices below it, `D3D12_MAX_SHADER_VISIBLE_DESCRIPTOR_HEAP_SIZE_TIER_2` caps every creatable heap at 1,000,000, so a 1<<21 clamp could only ever produce out-of-heap reads (device removal), never a valid descriptor. `NULL_RESERVE` correctly protects the null-view pair on the capped path (`MIN_DYNAMIC - 1024` leaves slots 999,998/999,999 free exactly where `NULL_BUFFER_VIEW` lands). Two things to untangle before merge: 1. **The `alias_source` hunk is already on main** — `placed.is_null()` guard merged as `219878a` ("a null shader view has no alias source", the #2847 crash class). Identical code and comment; a rebase will show it as an empty diff. Your earlier PR #2933 was the same change. 2. **Residual OOB on smaller heaps**: `HEAP_VIEWS` = 1M only puts `NULL_BUFFER_VIEW` inside the heap when the heap is actually ≥1M. On NVIDIA, `make(count + MIN_DYNAMIC)` succeeds for counts ≤934,464 — e.g. a 737,856-count title heap makes an 803,392-descriptor heap, where index 999,998 is still past the end (`pairs_end` falls back to `total`, the nulls are never written, and a clamped index still reads OOB). GTA6's own 934,464-count heap lands exactly at `make(1,000,000)` so its crash is covered, but the title-side cap is only fully guaranteed on the `PORTABLE_VIEWS` arm. Possibly worth `pairs_end`/null placement at `total - 2` when `HEAP_VIEWS > total` — or a comment noting the smaller-heap case remains a documented shortcut. 3. **`pc_format` 85/86/115→87** is the alternative shape of #2442's fix for the same crash class (B5G5R5A1 + typed UAV → `DXGI_ERROR_INVALID_CALL` removal): yours widens the resource format at creation, #2442 keeps the format and strips `ALLOW_UNORDERED_ACCESS` where the host can't store typed. They're complementary rather than conflicting — worth a line in the PR description saying which case each covers (widening handles RT too; the flag strip handles formats that must keep their bit layout).
Author
Owner

@⁠pes7 on GitHub · 2026-11-26 01:01 UTC · original

Progress log, continued (the branch is fix/prologue, and this comment is the running record - evidence from actual runs, not intentions):

#4 - the prologue now runs. With the two crashers fixed (#1, #2 above), the first gameplay frame is reached. It then hung the GPU within seconds: DRED breadcrumbs named it exactly -

a list stopped at command 143 of 147 (op 6): dispatch 16x16x16 [compute 00167d58cc5a78d7]

and, with that one skipped (VICTORY_SKIP_PIPELINES=00167d58cc5a78d7), the next run stopped at another:

command 91 (op 5): indirect kind 2 max 1 at 0xd9358fe80 [compute f607780aa8e502d0]

With both skipped the title plays: 37 consecutive world frames, 534-4434 draws a frame, 600-3227 ms a frame, and the run lasts until a third command of the same kind (still to identify).

#5 - the numbers that frame report finally gives (steady part of that run):

per frame
frame 867-1006 ms
on the GPU 683-807 ms
preparing (copies + textures) 110 ms
- title memory copied 35 ms / 110-139 MB
- texture uploads 7-23 ms
copying back 49 ms / 8 MB
draws 1 260-1 667
dropped without a host pipeline 372-508
host textures 4 481 (6 050 MB)

So the fps problem in the prologue is on the GPU (80 % of the frame), and separately 30 % of the draws are dropped because their host pipelines are still being made in that frame.

next, in this order: (a) rank the GPU work per command with VICTORY_GPU_TIMING during these frames, (b) the dropped draws - their pipelines are made during the frame, so the same frame both stalls and drops, (c) the two hanging compute dispatches, which is a translation question (s_barrier-style waits are the known family, issue #1799).

Everything above is one run away from reproducible: drive4.ps1-style driver, Enter at 15 s/45 s/80 s/110 s (the account screen, then the menu's Start), VICTORY_SKIP_PIPELINES=<the two hashes>.

**@⁠pes7** on GitHub · 2026-11-26 01:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7179351350) Progress log, continued (the branch is `fix/prologue`, and this comment is the running record - evidence from actual runs, not intentions): **#4 - the prologue now runs.** With the two crashers fixed (#1, #2 above), the first gameplay frame is reached. It then hung the GPU within seconds: DRED breadcrumbs named it exactly - ``` a list stopped at command 143 of 147 (op 6): dispatch 16x16x16 [compute 00167d58cc5a78d7] ``` and, with that one skipped (`VICTORY_SKIP_PIPELINES=00167d58cc5a78d7`), the next run stopped at another: ``` command 91 (op 5): indirect kind 2 max 1 at 0xd9358fe80 [compute f607780aa8e502d0] ``` With both skipped the title **plays**: 37 consecutive world frames, 534-4434 draws a frame, 600-3227 ms a frame, and the run lasts until a third command of the same kind (still to identify). **#5 - the numbers that frame report finally gives** (steady part of that run): | per frame | | |---|---| | frame | 867-1006 ms | | **on the GPU** | **683-807 ms** | | preparing (copies + textures) | 110 ms | | - title memory copied | 35 ms / 110-139 MB | | - texture uploads | 7-23 ms | | copying back | 49 ms / 8 MB | | draws | 1 260-1 667 | | **dropped without a host pipeline** | **372-508** | | host textures | 4 481 (6 050 MB) | So the fps problem in the prologue is on the GPU (80 % of the frame), and separately 30 % of the draws are dropped because their host pipelines are still being made in that frame. **next**, in this order: (a) rank the GPU work per command with `VICTORY_GPU_TIMING` during these frames, (b) the dropped draws - their pipelines are made *during* the frame, so the same frame both stalls and drops, (c) the two hanging compute dispatches, which is a translation question (`s_barrier`-style waits are the known family, issue #1799). Everything above is one run away from reproducible: `drive4.ps1`-style driver, Enter at 15 s/45 s/80 s/110 s (the account screen, then the menu's Start), `VICTORY_SKIP_PIPELINES=<the two hashes>`.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 01:02 UTC · original

Code review and RTX 5090 + WARP check at head 0082b445a252 against main (63bcca43c6a0):

Several blocking issues here:

  1. Merge conflict & superseded commit in resource.rs:
    • Commit eca1d364 (alias_source null check) directly duplicates and conflicts with 219878a0e775 (GPU: a null shader view has no alias source), which is already on main (along with a_null_view_has_no_alias_source).
    • This PR also bundles 5 unrelated changes across 4 commits (alias_source, NULL_RESERVE=1024, lowering HEAP_VIEWS to 1_000_000, 16-bit format remapping, and log_messages on device removal).
  2. 16-bit packed -> BGRA8 remapping (crates/victory-gpu/src/resource.rs:247: 85 | 86 | 115 => 87) breaks byte width and pixel layout:
    • Formats 85 (B5G6R5_UNORM), 86 (B5G5R5A1_UNORM), and 115 (B4G4R4A4_UNORM) are 2 B/texel (resource.rs:127), whereas 87 (B8G8R8A8_UNORM) is 4 B/texel.
    • texture.rs:696,788,813 detiles raw 2-bpp title bytes straight into the 4-bpp BGRA8 host staging pitch without 16->32-bit pixel expansion, corrupting every row/channel.
    • list.rs:725-795 (upload) and list.rs:853-903 (read_back) pass 2-bpp title footprints into/out of a 4-bpp host texture, causing D3D12 CopyTextureRegion format-mismatch failures (DXGI_ERROR_INVALID_CALL). pipeline/host.rs:142 (InputLayout) and texture.rs:294 (alias_copy) are also affected.
  3. Tier-3 view heap NULL_BUFFER_VIEW overlap (crates/victory-gpu/src/descriptor/host.rs:210):
    • extra.min(total.saturating_sub(count).saturating_sub(NULL_RESERVE)) assumes NULL_BUFFER_VIEW sits near total, whereas it is fixed at HEAP_VIEWS - 2 = 999_998. On Tier-3 GPUs that allow total > 1_000_000 (e.g. count = 750_000, total = 1_012_144), count + extra = 1_011_120 > 999_998, placing NULL_BUFFER_VIEW inside the dynamic allocation range (see #2461 for a full view_heap_limit() solution that handles both 1M-capped and uncapped heaps).

Recommend dropping the superseded alias_source commit and splitting any remaining independent fixes into focused PRs.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 01:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7179375565) Code review and RTX 5090 + WARP check at head `0082b445a252` against `main` (`63bcca43c6a0`): Several blocking issues here: 1. **Merge conflict & superseded commit in `resource.rs`**: - Commit `eca1d364` (`alias_source` null check) directly duplicates and conflicts with `219878a0e775` (`GPU: a null shader view has no alias source`), which is already on `main` (along with `a_null_view_has_no_alias_source`). - This PR also bundles 5 unrelated changes across 4 commits (`alias_source`, `NULL_RESERVE=1024`, lowering `HEAP_VIEWS` to `1_000_000`, 16-bit format remapping, and `log_messages` on device removal). 2. **16-bit packed -> `BGRA8` remapping (`crates/victory-gpu/src/resource.rs:247`: `85 | 86 | 115 => 87`) breaks byte width and pixel layout**: - Formats `85` (`B5G6R5_UNORM`), `86` (`B5G5R5A1_UNORM`), and `115` (`B4G4R4A4_UNORM`) are **2 B/texel** (`resource.rs:127`), whereas `87` (`B8G8R8A8_UNORM`) is **4 B/texel**. - `texture.rs:696,788,813` detiles raw 2-bpp title bytes straight into the 4-bpp `BGRA8` host staging pitch without 16->32-bit pixel expansion, corrupting every row/channel. - `list.rs:725-795` (upload) and `list.rs:853-903` (`read_back`) pass 2-bpp title footprints into/out of a 4-bpp host texture, causing D3D12 `CopyTextureRegion` format-mismatch failures (`DXGI_ERROR_INVALID_CALL`). `pipeline/host.rs:142` (`InputLayout`) and `texture.rs:294` (`alias_copy`) are also affected. 3. **Tier-3 view heap `NULL_BUFFER_VIEW` overlap (`crates/victory-gpu/src/descriptor/host.rs:210`)**: - `extra.min(total.saturating_sub(count).saturating_sub(NULL_RESERVE))` assumes `NULL_BUFFER_VIEW` sits near `total`, whereas it is fixed at `HEAP_VIEWS - 2 = 999_998`. On Tier-3 GPUs that allow `total > 1_000_000` (e.g. `count = 750_000`, `total = 1_012_144`), `count + extra = 1_011_120 > 999_998`, placing `NULL_BUFFER_VIEW` inside the dynamic allocation range (see `#2461` for a full `view_heap_limit()` solution that handles both 1M-capped and uncapped heaps). Recommend dropping the superseded `alias_source` commit and splitting any remaining independent fixes into focused PRs.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-26 01:14 UTC · original · edited 2026-11-26 08:26 UTC

Automated triage for the maintainers.

Needs work (unchanged blocker). The new head 652cd44 reverts 1e53e91, so the memory::CAPACITY change is no longer in this PR. That's fine if you plan to send it as its own small PR, as suggested, with the doc comment and the memory cost stated. Your progress logs (parts 24 and 25) are useful context for that PR. Part 25 already notes that one run cannot show it removes the TDR.

The blocker in this PR is still there. resource.rs pc_format maps 85 | 86 | 115 => 87 for every use. That puts 2-byte texels into a 4-byte host format, and nothing converts them on upload or read-back, so the title's data and the host texture disagree in size and layout. Please replace this with a use-dependent path that converts the texels, or drop the commit. Also still open: in draw.rs, count for VICTORY_DUMP_ARGUMENTS is read eagerly, outside the deferred closure. The diagnostics commits would also be easier to review as their own PR.

CI: passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-26 01:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7179578106) · edited 2026-11-26 08:26 UTC <!-- victory-triage v1 head=652cd44a02f58b460fe5eb32d1fe12497bb15ce9 verdict=needs-work at=2026-11-26T08:18:38Z --> Automated triage for the maintainers. **Needs work (unchanged blocker).** The new head `652cd44` reverts `1e53e91`, so the `memory::CAPACITY` change is no longer in this PR. That's fine if you plan to send it as its own small PR, as suggested, with the doc comment and the memory cost stated. Your progress logs (parts 24 and 25) are useful context for that PR. Part 25 already notes that one run cannot show it removes the TDR. The blocker in this PR is still there. `resource.rs` `pc_format` maps `85 | 86 | 115 => 87` for every use. That puts 2-byte texels into a 4-byte host format, and nothing converts them on upload or read-back, so the title's data and the host texture disagree in size and layout. Please replace this with a use-dependent path that converts the texels, or drop the commit. Also still open: in `draw.rs`, `count` for `VICTORY_DUMP_ARGUMENTS` is read eagerly, outside the deferred closure. The diagnostics commits would also be easier to review as their own PR. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠pes7 on GitHub · 2026-11-26 01:22 UTC · original

Progress log, part 3 - the first measured fps number and what moves it.

The frame's GPU cost is in the indirect dispatches. With the two hanging compute dispatches skipped (part 2), one more hash shows up at the top of the per-command ranking (VICTORY_GPU_TIMING, 27 world frames):

command                            samples  total ms  worst
indirect kind                       299      12 965     1 115
indirect kind 8bbcbda6008eaa37       49       7 488       292
indirect kind 776d835da5ffa646       37       1 564        69
indirect kind c7feccae4e01e454       52       1 112        66
draw                                 20         872        91

Skipping that one is worth ~2x on the real path (no debug layer, no per-command timing):

frame on the GPU draws
skip 2 hashes 867-1 006 ms (1.0-1.2 fps) 683-807 ms 1 260-1 667
skip those + 8bbcbda6008eaa37 415-584 ms (1.7-2.4 fps) 179-421 ms 412-3 060

So one indirect command family is about half of the prologue's frame time, and the frame report's "on the GPU" tracks it exactly - it is not a CPU problem there.

The hang is not deterministic. The same build with the same skips ran 24 world frames and 60 s of gameplay in one run and was removed in the next, and the command named by the breadcrumbs changed when one was skipped (00167d58cc5a78d7 -> f607780aa8e502d0 -> indirect [mesh c82b7a0b51f8f8a9, pixel e4d3d1ea315a7036]). That is the shape of a GPU-side wait on data that may not be there yet - the family issue #1799 describes - rather than one bad shader.

Next: the traced-record dump (VICTORY_TRACE_SHADERS=<hash>) prints what the indirect records actually ask for, which says whether the 400 ms is real work the title requests or our translation of it.

Numbers above are one run each, but the two skip sets differ by exactly one hash and the frame's draw counts overlap, so the ~2x is not scene drift.

**@⁠pes7** on GitHub · 2026-11-26 01:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7179715813) Progress log, part 3 - the first measured fps number and what moves it. **The frame's GPU cost is in the indirect dispatches.** With the two hanging compute dispatches skipped (part 2), one more hash shows up at the top of the per-command ranking (`VICTORY_GPU_TIMING`, 27 world frames): ``` command samples total ms worst indirect kind 299 12 965 1 115 indirect kind 8bbcbda6008eaa37 49 7 488 292 indirect kind 776d835da5ffa646 37 1 564 69 indirect kind c7feccae4e01e454 52 1 112 66 draw 20 872 91 ``` **Skipping that one is worth ~2x on the real path** (no debug layer, no per-command timing): | | frame | on the GPU | draws | |---|---|---|---| | skip 2 hashes | **867-1 006 ms** (1.0-1.2 fps) | 683-807 ms | 1 260-1 667 | | skip those + `8bbcbda6008eaa37` | **415-584 ms** (1.7-2.4 fps) | 179-421 ms | 412-3 060 | So one indirect command family is about half of the prologue's frame time, and the frame report's "on the GPU" tracks it exactly - it is not a CPU problem there. **The hang is not deterministic.** The same build with the same skips ran 24 world frames and 60 s of gameplay in one run and was removed in the next, and the command named by the breadcrumbs changed when one was skipped (`00167d58cc5a78d7` -> `f607780aa8e502d0` -> `indirect [mesh c82b7a0b51f8f8a9, pixel e4d3d1ea315a7036]`). That is the shape of a GPU-side wait on data that may not be there yet - the family issue #1799 describes - rather than one bad shader. Next: the traced-record dump (`VICTORY_TRACE_SHADERS=<hash>`) prints what the indirect records actually ask for, which says whether the 400 ms is real work the title requests or our translation of it. Numbers above are one run each, but the two skip sets differ by exactly one hash and the frame's draw counts overlap, so the ~2x is not scene drift.
Author
Owner

@⁠pes7 on GitHub · 2026-11-26 01:37 UTC · original

Progress log, part 4 - the prologue's frame time and its hangs are the same thing: translated loops running to their limit.

The trace says the second most expensive GPU command asks for almost nothing:

indirect kind 2 max 1 count None: 1 of 1 records with work, 746 in all; first [[746, 1, 1]] [compute 8bbcbda6008eaa37] frame 2458

746 groups of 64 threads, ~48 000 threads - and it costs 200-400 ms of the frame. So the work is not the title's; it is in the shader our translator emits. The project already has the instrument for exactly this: VICTORY_SHADER_LOOP_LIMIT (emit::loop_limit, lower::LOOP_LIMIT = 1 << 20 - "data the host has not mirrored yet (a null view reads zeros) can make that four billion iterations, which hangs the host GPU until the driver resets it").

Same run, same two skipped hashes, only VICTORY_SHADER_LOOP_LIMIT=16:

default limit (2^20) limit 16
frame 867-1 006 ms 622-836 ms
on the GPU 683-807 ms 147-370 ms
world frames before the device was removed 37 57, and end: no crash
fps 1.0-1.2 1.2-1.6

So with the loops cut short the GPU term drops 2-4x and the run stops crashing entirely (it ran the whole 260 s window). The picture is wrong at 16 iterations, of course - this is the diagnostic, not the fix - but it says the prologue's fps and its "GPU hangs" have one root: a translated loop whose data-driven bound does not terminate as the console's does, so a lane burns up to a million iterations per entry, and a dispatch with tens of thousands of lanes takes hundreds of milliseconds (and, sometimes, over the 2 s TDR).

Next: find which loop. The shader is named by the trace above (8bbcbda6008eaa37) and the hang by the breadcrumbs; the emitters' loop lowering (lower.rs, the phi-based counters and the limit exit) is where a bound that should terminate is not terminating - most likely a loop that reads its condition from memory we have not refreshed at that point (the same "null view reads zeros" the comment warns about).

Still open and unchanged in the branch: nothing in this comment is a patch yet.

**@⁠pes7** on GitHub · 2026-11-26 01:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7179955187) Progress log, part 4 - the prologue's frame time and its hangs are the same thing: translated loops running to their limit. The trace says the second most expensive GPU command asks for almost nothing: ``` indirect kind 2 max 1 count None: 1 of 1 records with work, 746 in all; first [[746, 1, 1]] [compute 8bbcbda6008eaa37] frame 2458 ``` 746 groups of 64 threads, ~48 000 threads - and it costs 200-400 ms of the frame. So the work is not the title's; it is in the shader our translator emits. The project already has the instrument for exactly this: `VICTORY_SHADER_LOOP_LIMIT` (`emit::loop_limit`, `lower::LOOP_LIMIT = 1 << 20` - "data the host has not mirrored yet (a null view reads zeros) can make that four billion iterations, which hangs the host GPU until the driver resets it"). Same run, same two skipped hashes, only `VICTORY_SHADER_LOOP_LIMIT=16`: | | default limit (2^20) | limit 16 | |---|---|---| | frame | 867-1 006 ms | **622-836 ms** | | on the GPU | 683-807 ms | **147-370 ms** | | world frames before the device was removed | 37 | **57, and `end: no crash`** | | fps | 1.0-1.2 | 1.2-1.6 | So with the loops cut short the GPU term drops 2-4x **and the run stops crashing entirely** (it ran the whole 260 s window). The picture is wrong at 16 iterations, of course - this is the diagnostic, not the fix - but it says the prologue's fps and its "GPU hangs" have one root: a translated loop whose data-driven bound does not terminate as the console's does, so a lane burns up to a million iterations per entry, and a dispatch with tens of thousands of lanes takes hundreds of milliseconds (and, sometimes, over the 2 s TDR). Next: find which loop. The shader is named by the trace above (`8bbcbda6008eaa37`) and the hang by the breadcrumbs; the emitters' loop lowering (`lower.rs`, the phi-based counters and the limit exit) is where a bound that should terminate is not terminating - most likely a loop that reads its condition from memory we have not refreshed at that point (the same "null view reads zeros" the comment warns about). Still open and unchanged in the branch: nothing in this comment is a patch yet.
Author
Owner

@⁠pes7 on GitHub · 2026-11-26 01:56 UTC · original

Progress log, part 5 - the tool that shows what our translation of a bad shader is, and what it says.

VICTORY_DUMP_SHADER=<hash> (diagnostics, 6ac972c in this branch) writes each named shader's translated DXIL to %TEMP%\victory-<hash>.dxil; dxc -dumpbin turns it into the IR. It works on the three hashes the runs named:

shader dumped shader="f607780aa8e502d0" bytes=40824
shader dumped shader="8bbcbda6008eaa37" bytes=95020
shader dumped shader="00167d58cc5a78d7" bytes=47292

What the group counts say. The trace on 8bbcbda6008eaa37: 746 groups, and its IR is NumThreads=(8,4,1) - 23 872 threads in all. That command is worth 200-400 ms of the frame (part 3), so the time is in the body, not in the amount of work.

What the body is. A ray march with a float exit condition and the loop limit as the only other way out:

; <label>:7481
  %7482 = add i32 %7435, 1
  %7483 = icmp ult i32 %7482, 1048576        ; the loop limit
  br i1 %7483, label %7434, label %12631

with %7480 = fcmp oge float %7459, %7417 as the real test and SampleCmpLevelZero inside. So either the march really runs a million steps (wrong data: a NaN or a non-advancing step) or it needs far fewer and hits the limit in some lanes - either way every iteration past the first few dozen is waste.

And the other two hashes are not loops at all. 00167d58cc5a78d7 is NumThreads=(4,4,4) with no dx.op.barrier and no loop-limit check at all - straight-line code that still stops the queue, so it is not a spinning loop: it is memory access (it reads the placed buffers we mirror in system RAM, at PCIe latency) or sheer instruction count. f607780aa8e502d0 has two loops and two limits, NumThreads=(32,1,1).

That means "the GPU hangs" is at least two different problems, and they need different fixes:

  • 00167d58cc5a78d7 - the cost of reading title memory that lives in system RAM (the same copy path we measured at 87-313 MB a frame). VICTORY_COPIES_IN_VIDEO_MEMORY=1 is the project's own answer to that, and on this GPU it is supported (host copies of title memory in video memory (diagnostics) on=true) - measured in the menu it makes copy-back 5x more expensive (239 ms against 19-49 ms) because the CPU then reads our copy out of VRAM, so it trades one side for the other; worth a proper measurement in the world, not taken yet.
  • 8bbcbda6008eaa37, f607780aa8e502d0 - the translated loops. VICTORY_SHADER_LOOP_LIMIT=16 cut the GPU term from 683-807 ms to 147-370 ms and let the run finish its whole window without a removal, but the picture is wrong at 16 and the runs drift by scene, so the number that matters (same scene, limit 2^20 vs a limit that still admits every legitimate march) is not measured yet.

Tests: cargo test --release --workspace - 27 suites, all ok, on this branch (the 195 in victory-gpu included).

**@⁠pes7** on GitHub · 2026-11-26 01:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7180302244) Progress log, part 5 - the tool that shows what our translation of a bad shader is, and what it says. `VICTORY_DUMP_SHADER=<hash>` (diagnostics, `6ac972c` in this branch) writes each named shader's translated DXIL to `%TEMP%\victory-<hash>.dxil`; `dxc -dumpbin` turns it into the IR. It works on the three hashes the runs named: ``` shader dumped shader="f607780aa8e502d0" bytes=40824 shader dumped shader="8bbcbda6008eaa37" bytes=95020 shader dumped shader="00167d58cc5a78d7" bytes=47292 ``` **What the group counts say.** The trace on `8bbcbda6008eaa37`: `746 groups`, and its IR is `NumThreads=(8,4,1)` - 23 872 threads in all. That command is worth 200-400 ms of the frame (part 3), so the time is in the body, not in the amount of work. **What the body is.** A ray march with a float exit condition and the loop limit as the only other way out: ``` ; <label>:7481 %7482 = add i32 %7435, 1 %7483 = icmp ult i32 %7482, 1048576 ; the loop limit br i1 %7483, label %7434, label %12631 ``` with `%7480 = fcmp oge float %7459, %7417` as the real test and `SampleCmpLevelZero` inside. So either the march really runs a million steps (wrong data: a NaN or a non-advancing step) or it needs far fewer and hits the limit in some lanes - either way every iteration past the first few dozen is waste. **And the other two hashes are not loops at all.** `00167d58cc5a78d7` is `NumThreads=(4,4,4)` with **no `dx.op.barrier` and no loop-limit check at all** - straight-line code that still stops the queue, so it is not a spinning loop: it is memory access (it reads the placed buffers we mirror in system RAM, at PCIe latency) or sheer instruction count. `f607780aa8e502d0` has two loops and two limits, `NumThreads=(32,1,1)`. That means "the GPU hangs" is at least two different problems, and they need different fixes: - `00167d58cc5a78d7` - the cost of reading title memory that lives in system RAM (the same copy path we measured at 87-313 MB a frame). `VICTORY_COPIES_IN_VIDEO_MEMORY=1` is the project's own answer to that, and on this GPU it is supported (`host copies of title memory in video memory (diagnostics) on=true`) - measured in the menu it makes copy-back 5x more expensive (239 ms against 19-49 ms) because the CPU then reads our copy out of VRAM, so it trades one side for the other; worth a proper measurement in the world, not taken yet. - `8bbcbda6008eaa37`, `f607780aa8e502d0` - the translated loops. `VICTORY_SHADER_LOOP_LIMIT=16` cut the GPU term from 683-807 ms to 147-370 ms and let the run finish its whole window without a removal, but the picture is wrong at 16 and the runs drift by scene, so the number that matters (same scene, limit 2^20 vs a limit that still admits every legitimate march) is not measured yet. Tests: `cargo test --release --workspace` - 27 suites, all ok, on this branch (the 195 in `victory-gpu` included).
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-26 02:18 UTC · original

@⁠pes7 I tested the 16-bit format change separately from the two diagnostics. The global BGRA8 mapping also changes sampled-only textures, where the original 16-bit storage works. This loses the source pixels on both adapters I tested. I put a combined branch on my fork if you can try the same account-screen → gameplay run.

The fixture tiled all 65,536 possible 16-bit words into one 256×256 sampled-only texture per format, used the production detile/upload path and host copy footprint, then read one RGBA sample per texel with a compute shader. I converted the samples back to their original guest precision. For B5G6R5 I also checked opaque alpha. The diagnostic zero-initialized its staging window before each detile so untouched bytes had a known value.

Guest format Wrong / 65,536 at this head b456c70 On main 63bcca43 On combined 4684227
B5G6R5 65,536 0 0
B5G5R5A1 65,530 0 0
B4G4R4A4 65,527 0 0

Two fresh processes per adapter agreed on every count (RTX 5080, driver 621.40, and built-in WARP 10.0.26100.10068, debug layer on). For example, guest B5G6R5 0xf800 should sample as opaque red. This head produced RGBA8 [1,248,0,248]. The combined branch produced [255,0,0,255]. Native RTX sampling of some intermediate 5/6-bit values differs from the nearest 8-bit expansion by one code. All those values still recover the original guest word.

The branch merges this exact head with @⁠moe-miau's #2626 (c8cc83e), preserves both diagnostics, and replaces the unconditional mapping with #2626's use-dependent path. For writable B5G5R5A1 and B4G4R4A4, both padded upload/clear/partial-readback tests also matched all 4,096 bytes in each of three runs per adapter. RTX used the RGBA8 stand-in and WARP used the native formats.

B5G6R5 stays native in this combination. Both devices advertise sampling and rendering for it. WARP also advertises typed UAV stores, while the RTX does not. A title request to write B5G6R5 via a typed UAV on that RTX would still need a separate fallback. Your original log names formats 86 and 115. An in-game comparison would tell us whether the branch retains your gameplay progress and whether a format-85 UAV is actually requested.

git fetch https://github.com/steven-seagull27/VIctory.git codex/pr2936-packed-integration
git switch -c verify-2936-packed FETCH_HEAD
cargo test -p victory-gpu --all-features --locked --lib packed_copy_tests -- --nocapture

AI-assisted with Codex. The results here used synthetic textures.

**@⁠steven-seagull27** on GitHub · 2026-11-26 02:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7180671763) @⁠pes7 I tested the 16-bit format change separately from the two diagnostics. The global BGRA8 mapping also changes **sampled-only textures**, where the original 16-bit storage works. This loses the source pixels on both adapters I tested. I put a [combined branch on my fork](https://github.com/steven-seagull27/VIctory/commit/4684227a1adc58853e5b69d166e13fa44cee565f) if you can try the same account-screen → gameplay run. The fixture tiled all 65,536 possible 16-bit words into one 256×256 sampled-only texture per format, used the production detile/upload path and host copy footprint, then read one RGBA sample per texel with a compute shader. I converted the samples back to their original guest precision. For B5G6R5 I also checked opaque alpha. The diagnostic zero-initialized its staging window before each detile so untouched bytes had a known value. | Guest format | Wrong / 65,536 at this head `b456c70` | On main `63bcca43` | On combined `4684227` | | --- | ---: | ---: | ---: | | B5G6R5 | 65,536 | 0 | 0 | | B5G5R5A1 | 65,530 | 0 | 0 | | B4G4R4A4 | 65,527 | 0 | 0 | Two fresh processes per adapter agreed on every count (RTX 5080, driver 621.40, and built-in WARP 10.0.26100.10068, debug layer on). For example, guest B5G6R5 `0xf800` should sample as opaque red. This head produced RGBA8 `[1,248,0,248]`. The combined branch produced `[255,0,0,255]`. Native RTX sampling of some intermediate 5/6-bit values differs from the nearest 8-bit expansion by one code. All those values still recover the original guest word. The branch merges this exact head with @⁠moe-miau's #2626 (`c8cc83e`), preserves both diagnostics, and replaces the unconditional mapping with #2626's use-dependent path. For **writable** B5G5R5A1 and B4G4R4A4, both padded upload/clear/partial-readback tests also matched all 4,096 bytes in each of three runs per adapter. RTX used the RGBA8 stand-in and WARP used the native formats. B5G6R5 stays native in this combination. Both devices advertise sampling and rendering for it. WARP also advertises typed UAV stores, while the RTX does not. A title request to write B5G6R5 via a typed UAV on that RTX would still need a separate fallback. Your original log names formats 86 and 115. An in-game comparison would tell us whether the branch retains your gameplay progress and whether a format-85 UAV is actually requested. ```sh git fetch https://github.com/steven-seagull27/VIctory.git codex/pr2936-packed-integration git switch -c verify-2936-packed FETCH_HEAD cargo test -p victory-gpu --all-features --locked --lib packed_copy_tests -- --nocapture ``` AI-assisted with Codex. The results here used synthetic textures.
Author
Owner

@⁠pes7 on GitHub · 2026-11-26 02:30 UTC · original

Progress log, part 6 - what the cold-cache stall actually is (measured, not guessed), and two ideas that lost their own measurement.

Translations run on the eight pipeline workers, not on the recorder. The new line in the shader log names its thread; a run with a cold cache (the loop limit changes the cache key, so everything re-translates) says:

victory-pipelines-2: 288 translations, 20 247 ms
victory-pipelines-5: 255 translations, 19 334 ms
victory-pipelines-4: 246 translations, 18 925 ms
victory-pipelines-6: 220 translations, 26 938 ms
victory-pipelines-7: 209 translations, 18 076 ms
victory-pipelines-3: 181 translations, 18 065 ms

1 725 translations in the run, ~110 ms each, spread over the workers - so the 20-25 s the first gameplay frame spends on a cold cache is per-translation cost, not scheduling. Moving it off the recorder would change nothing; the win there is translator throughput (or the warm-up, victory translate --cache, which the pipeline library already leans on).

Dropped: block skipping in the copy-back merge. Measured in the build, same data (64 KiB piece, one byte written in 128):

per byte 569.1us (3 us a piece), blocks 4.5734ms (23 us a piece), 0.1x

10x worse, and 3 us a piece means the whole 8 MB of copy-back merge is 0.4 ms of a 19-49 ms item - the cost there is the two ReadProcessMemory calls a piece, not the merge. Reverted.

Dropped: copies in video memory (VICTORY_COPIES_IN_VIDEO_MEMORY=1). Supported here (GPUUploadHeapSupported, "on=true"), but in the menu copy-back goes 19-49 ms -> 239 ms a frame (the CPU reads our copy out of VRAM) and the menu drops 30 fps -> 3, and with the prologue's key presses the run ended in a device removal (a GPU hang, per the debug layer) twice out of two. It needs a staging copy in system memory beside the VRAM one before it can be measured in the world.

What is still the frame, from the runs with the two hanging compute dispatches skipped: 867-1006 ms a frame, 683-807 ms of it on the GPU, 1 260-1 667 draws with 368 indirect, 372-508 dropped while their pipelines are made; skipping one more hash (8bbcbda6008eaa37, 746 groups, the ray march) takes the frame to 415-584 ms and the GPU to 179-421 ms.

cargo test --release -p victory-gpu: 231 pass.

**@⁠pes7** on GitHub · 2026-11-26 02:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7180869967) Progress log, part 6 - what the cold-cache stall actually is (measured, not guessed), and two ideas that lost their own measurement. **Translations run on the eight pipeline workers, not on the recorder.** The new line in the shader log names its thread; a run with a cold cache (the loop limit changes the cache key, so everything re-translates) says: ``` victory-pipelines-2: 288 translations, 20 247 ms victory-pipelines-5: 255 translations, 19 334 ms victory-pipelines-4: 246 translations, 18 925 ms victory-pipelines-6: 220 translations, 26 938 ms victory-pipelines-7: 209 translations, 18 076 ms victory-pipelines-3: 181 translations, 18 065 ms ``` 1 725 translations in the run, ~110 ms each, spread over the workers - so the 20-25 s the first gameplay frame spends on a cold cache is *per-translation cost*, not scheduling. Moving it off the recorder would change nothing; the win there is translator throughput (or the warm-up, `victory translate --cache`, which the pipeline library already leans on). **Dropped: block skipping in the copy-back merge.** Measured in the build, same data (64 KiB piece, one byte written in 128): ``` per byte 569.1us (3 us a piece), blocks 4.5734ms (23 us a piece), 0.1x ``` 10x worse, and 3 us a piece means the whole 8 MB of copy-back merge is 0.4 ms of a 19-49 ms item - the cost there is the two `ReadProcessMemory` calls a piece, not the merge. Reverted. **Dropped: copies in video memory** (`VICTORY_COPIES_IN_VIDEO_MEMORY=1`). Supported here (`GPUUploadHeapSupported`, "on=true"), but in the menu copy-back goes 19-49 ms -> **239 ms** a frame (the CPU reads our copy out of VRAM) and the menu drops 30 fps -> 3, and with the prologue's key presses the run ended in a device removal (a GPU hang, per the debug layer) twice out of two. It needs a staging copy in system memory beside the VRAM one before it can be measured in the world. What is still the frame, from the runs with the two hanging compute dispatches skipped: 867-1006 ms a frame, 683-807 ms of it on the GPU, 1 260-1 667 draws with 368 indirect, 372-508 dropped while their pipelines are made; skipping one more hash (`8bbcbda6008eaa37`, 746 groups, the ray march) takes the frame to 415-584 ms and the GPU to 179-421 ms. `cargo test --release -p victory-gpu`: 231 pass.
Author
Owner

@⁠pes7 on GitHub · 2026-11-26 02:51 UTC · original

Progress log, part 7 - the cold-cache stall is one algorithm, measured to the line.

Phase timing in the translator (diagnostics) and emit::lower's retry counter (4fdad62) answer where the 20-25 s of a cold batch go. A batch of 1 725 translations, summed:

phase sum median worst
range::build (structurisation) 0.15 s 40 us 0.6 ms
resource::track 115.9 s 1.0 ms 1.47 s
io::raise 1.0 s 83 us 26 ms
lower::lower (emit) 39.6 s 1.4 ms 8.13 s

So the median translation is 2.7 ms (as the project's own numbers say), and the batch is dominated by a handful of shaders. The worst:

shader phases (us): stage=Cs blocks=1542 range=342 resource=99315 io=5255 emit=8126713

Which is emit::lower's retry loop: lower() re-runs the whole lowering once per phi that does not settle.

lowering passes: 74 blocks=1542 setup_us=5561 run_us=85672
lowering passes: 21 blocks=70   setup_us=91   run_us=1839
lowering passes: 13 blocks=956  setup_us=2955 run_us=201072
lowering passes: 13 blocks=967  setup_us=3020 run_us=115554
lowering passes: 11 blocks=663  setup_us=2713 run_us=32890

74 passes x ~86 ms on 1 542 blocks = the 6.7 s; 222 extra passes across 17 shaders in the batch. The setup is 6 % of a pass, so reusing it would not help; the passes themselves must go. bad is consulted where a phi is first lowered (Val::Missing), so a value marked bad changes how earlier code lowers - that is why the loop restarts, and why batching them needs the failure set collected inside the two phi loops at the end of run() (which is the next change here, not this comment).

Also from the same instrument: resource::track has a 1.47 s outlier on one shader (median 1 ms), the second target.

Nothing in the release build changes: the phases are Instants under cfg(feature = "diagnostics") and the pass count is not compiled.

cargo test --release --workspace: 30 suites, all ok (302 in victory-shader), on this branch.

**@⁠pes7** on GitHub · 2026-11-26 02:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7181180820) Progress log, part 7 - the cold-cache stall is one algorithm, measured to the line. Phase timing in the translator (diagnostics) and `emit::lower`'s retry counter (`4fdad62`) answer where the 20-25 s of a cold batch go. A batch of 1 725 translations, summed: | phase | sum | median | worst | |---|---|---|---| | `range::build` (structurisation) | 0.15 s | 40 us | 0.6 ms | | `resource::track` | **115.9 s** | 1.0 ms | 1.47 s | | `io::raise` | 1.0 s | 83 us | 26 ms | | `lower::lower` (emit) | **39.6 s** | 1.4 ms | **8.13 s** | So the median translation is 2.7 ms (as the project's own numbers say), and the batch is dominated by a handful of shaders. The worst: ``` shader phases (us): stage=Cs blocks=1542 range=342 resource=99315 io=5255 emit=8126713 ``` **Which is `emit::lower`'s retry loop**: `lower()` re-runs the whole lowering once per phi that does not settle. ``` lowering passes: 74 blocks=1542 setup_us=5561 run_us=85672 lowering passes: 21 blocks=70 setup_us=91 run_us=1839 lowering passes: 13 blocks=956 setup_us=2955 run_us=201072 lowering passes: 13 blocks=967 setup_us=3020 run_us=115554 lowering passes: 11 blocks=663 setup_us=2713 run_us=32890 ``` 74 passes x ~86 ms on 1 542 blocks = the 6.7 s; 222 extra passes across 17 shaders in the batch. The setup is 6 % of a pass, so reusing it would not help; the passes themselves must go. `bad` is consulted where a phi is first lowered (`Val::Missing`), so a value marked bad changes how *earlier* code lowers - that is why the loop restarts, and why batching them needs the failure set collected inside the two phi loops at the end of `run()` (which is the next change here, not this comment). Also from the same instrument: `resource::track` has a 1.47 s outlier on one shader (median 1 ms), the second target. Nothing in the release build changes: the phases are `Instant`s under `cfg(feature = "diagnostics")` and the pass count is not compiled. `cargo test --release --workspace`: 30 suites, all ok (302 in `victory-shader`), on this branch.
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-26 02:53 UTC · original

@⁠pes7 Your Part 6 numbers point to a concrete cold-cache A/B. I tested #2942 (1569277, lowering) and #2957 (dfa6126, SSA) on the same inputs through translate_with. On eight CPU workers, 64 synthetic buffer/VALU shaders took 75.4 ms on base, 67.4 ms with #2942 alone and 63.4 ms with both. For 64 shaders with many live registers at joins, the corresponding medians were 42.2, 36.4 and 35.5 ms. All 128 produced byte-identical DXIL and the same host bindings across all four builds, and every output validated.

I verified that the two compiler heads together merge cleanly onto your 4eaaf60, and also onto 4684227 with the sampled-format test fix. If you have time for a cold-cache run of the same route, comparing your existing eight-worker build with those two compiler changes would show whether the translation gain reaches the first gameplay frame. I didn't measure title startup, pipeline creation or warm-cache FPS. Full table, benchmark fixture and reproduction on #2957.

**@⁠steven-seagull27** on GitHub · 2026-11-26 02:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7181207455) @⁠pes7 Your Part 6 numbers point to a concrete cold-cache A/B. I tested #2942 (`1569277`, lowering) and #2957 (`dfa6126`, SSA) on the same inputs through `translate_with`. On eight CPU workers, 64 synthetic buffer/VALU shaders took 75.4 ms on base, 67.4 ms with #2942 alone and 63.4 ms with both. For 64 shaders with many live registers at joins, the corresponding medians were 42.2, 36.4 and 35.5 ms. All 128 produced byte-identical DXIL and the same host bindings across all four builds, and every output validated. I verified that the two compiler heads together merge cleanly onto your `4eaaf60`, and also onto `4684227` with the sampled-format test fix. If you have time for a cold-cache run of the same route, comparing your existing eight-worker build with those two compiler changes would show whether the translation gain reaches the first gameplay frame. I didn't measure title startup, pipeline creation or warm-cache FPS. [Full table, benchmark fixture and reproduction on #2957](https://git.gtahub.st/github/Marvisak--VIctory/pulls/2957).
Author
Owner

@⁠pes7 on GitHub · 2026-11-26 03:11 UTC · original

Progress log, part 8 - the retry batching was implemented, measured, and then reverted: its own soundness check failed.

What it did. fill_phis now catches a Stop::Retry per phi, records the value and leaves a type-correct placeholder, so one pass finds many non-settling phis instead of one; lower merges the whole list into bad.

What it measured (same scenario, cold cache, 1 725 translations in the "before" run):

before  translations 1725  sum 235828 ms  median 13 ms  max 8030 ms  passes>1 19  max passes 74
after   translations  401  sum  30208 ms  median  5 ms  max 2559 ms  passes>1  4  max passes  8

(the "after" run is partial: it ended early, see below.) Max passes 74 -> 8, the worst translation 8.0 s -> 2.6 s.

Why it was reverted. The batched build ended two runs with the title faulting inside its own image (write 0x0) about 40 s in. A later run of the unbatched build ended the same way, so the crash is not attributable to the change - but the change also cannot be shown sound by that argument either. The placeholders mean a phi that fails because of a placeholder gets marked bad too, and a value marked bad is lowered as Val::Missing from then on, so the fixed point of the batched loop may differ from the sequential one. That is exactly what a wrong picture looks like, and 302 victory-shader tests do not cover the game's biggest shaders.

So the next step is not another run, it is a proof: dump every translated shader (VICTORY_DUMP_SHADER=all) on both builds in the same scenario and compare the files - identical output is the soundness evidence, any difference says which phis were marked bad needlessly. Only then is the 74 -> 8 passes win something to keep.

The measured shape of resource::track, from the same phase instrument (1727 translations):

resource > 10 ms: 274 shaders, sum 113.3 s
resource > 100 ms: 224 shaders, sum 111.9 s
resource > 500 ms:  87 shaders, sum  67.6 s

224 shaders over 100 ms in one phase that should be a walk of the instructions: the second target, and unlike the batching it is a pure scan-vs-map question.

Branch state: lower.rs and resource.rs back to their committed contents (git status clean), cargo test --release --workspace 30 suites ok, builds with and without diagnostics.

**@⁠pes7** on GitHub · 2026-11-26 03:11 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7181481169) Progress log, part 8 - the retry batching was implemented, measured, and then reverted: its own soundness check failed. **What it did.** `fill_phis` now catches a `Stop::Retry` per phi, records the value and leaves a type-correct placeholder, so one pass finds many non-settling phis instead of one; `lower` merges the whole list into `bad`. **What it measured** (same scenario, cold cache, 1 725 translations in the "before" run): ``` before translations 1725 sum 235828 ms median 13 ms max 8030 ms passes>1 19 max passes 74 after translations 401 sum 30208 ms median 5 ms max 2559 ms passes>1 4 max passes 8 ``` (the "after" run is partial: it ended early, see below.) Max passes 74 -> 8, the worst translation 8.0 s -> 2.6 s. **Why it was reverted.** The batched build ended two runs with the title faulting inside its own image (`write 0x0`) about 40 s in. A later run of the *unbatched* build ended the same way, so the crash is not attributable to the change - but the change also cannot be shown sound by that argument either. The placeholders mean a phi that fails *because* of a placeholder gets marked `bad` too, and a value marked `bad` is lowered as `Val::Missing` from then on, so the fixed point of the batched loop may differ from the sequential one. That is exactly what a wrong picture looks like, and 302 `victory-shader` tests do not cover the game's biggest shaders. So the next step is not another run, it is a proof: dump every translated shader (`VICTORY_DUMP_SHADER=all`) on both builds in the same scenario and compare the files - identical output is the soundness evidence, any difference says which phis were marked `bad` needlessly. Only then is the 74 -> 8 passes win something to keep. The measured shape of `resource::track`, from the same phase instrument (1727 translations): ``` resource > 10 ms: 274 shaders, sum 113.3 s resource > 100 ms: 224 shaders, sum 111.9 s resource > 500 ms: 87 shaders, sum 67.6 s ``` 224 shaders over 100 ms in one phase that should be a walk of the instructions: the second target, and unlike the batching it is a pure scan-vs-map question. Branch state: `lower.rs` and `resource.rs` back to their committed contents (`git status` clean), `cargo test --release --workspace` 30 suites ok, builds with and without diagnostics.
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-26 03:16 UTC · original · edited 2026-11-26 03:32 UTC

@⁠pes7 Correction to my earlier interpretation of the 111.9 s figure. On df3c5df, mark("resource") runs immediately after range::build(&native.patched_code(), ...). The printed resource= bucket therefore measures native code patching and range construction, including the IR work inside it. The next bucket, io=, measures resource::track. The existing log can be re-bucketed without asking you to rerun the title. For the 224 translations above 100 ms I’d look first at the range-building phases and use io= to assess resource tracking. Instrumentation on the tested commit

The synthetic benchmark called resource::track directly. Its two cases went from 146.2 to 66.9 µs and 21.8 to 14.2 µs. The 192 compiled shader fixtures were byte-identical across the two builds, and I measured no end-to-end translation speedup on that corpus. Those results support the isolated improvement in #2785. They don’t establish how much time it saves on the prologue. Benchmark details

AI-assisted testing and analysis on my machine.

**@⁠steven-seagull27** on GitHub · 2026-11-26 03:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7181554896) · edited 2026-11-26 03:32 UTC @⁠pes7 Correction to my earlier interpretation of the 111.9 s figure. On `df3c5df`, `mark("resource")` runs immediately after `range::build(&native.patched_code(), ...)`. The printed `resource=` bucket therefore measures native code patching and range construction, including the IR work inside it. The next bucket, `io=`, measures `resource::track`. The existing log can be re-bucketed without asking you to rerun the title. For the 224 translations above 100 ms I’d look first at the range-building phases and use `io=` to assess resource tracking. [Instrumentation on the tested commit](https://github.com/Marvisak/VIctory/blob/df3c5df/crates/victory-shader/src/emit/mod.rs#L398-L432) The synthetic benchmark called `resource::track` directly. Its two cases went from 146.2 to 66.9 µs and 21.8 to 14.2 µs. The 192 compiled shader fixtures were byte-identical across the two builds, and I measured no end-to-end translation speedup on that corpus. Those results support the isolated improvement in #2785. They don’t establish how much time it saves on the prologue. [Benchmark details](https://git.gtahub.st/github/Marvisak--VIctory/pulls/2785) AI-assisted testing and analysis on my machine.
Author
Owner

@⁠pes7 on GitHub · 2026-11-26 03:29 UTC · original

Progress log, part 9 - the batching is proven by the pack and kept.

The soundness question from part 8 is answered by the whole shader pack rather than by a run: victory translate --list translates all 26 084 programs in ~45 s, and its per-program lines (25 889 of them: success or the exact failure reason) were diffed between the unbatched and the batched translator:

plain programs: 25889 batched: 25889
only plain: 0 only batched: 0

and the stage tallies are identical too (14 246 of 14 247 vertex and pixel, 2 658 of 2 682 compute, 8 765 of 8 765 mesh emitted). Corpus wall time 47 s -> 44 s.

So the batching does not change which programs translate, which was the risk: a phi marked bad is lowered as Val::Missing from then on, and a placeholder can make another phi look unjoinable. Outcome equality over every program in the pack is the evidence that it does not happen in this title. (Byte equality of the DXIL is not shown; the game runs reach the same place with and without the change - the early device removals happen on both.)

The win it keeps, measured on the prologue scenario with a cold cache:

before  translations 1725  sum 235828 ms  median 13 ms  max 8030 ms  passes>1 19  max passes 74
after   translations  401  sum  30208 ms  median  5 ms  max 2559 ms  passes>1  4  max passes  8

74 passes -> 8, the worst translation 8.0 s -> 2.6 s, 222 extra whole-lowering passes gone. cargo test --release --workspace: 30 suites, 0 failures; clippy -D warnings clean with and without the diagnostics feature.

Two things this also taught, for the next step: the corpus harness is a deterministic A/B for translator changes (45 s for the whole pack, identical input), and it is the fast way to check any future change to lower; and resource::track (224 shaders over 100 ms, 111.9 s in one cold batch) is now the largest single item left in the loading path.

**@⁠pes7** on GitHub · 2026-11-26 03:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7181768073) Progress log, part 9 - the batching is proven by the pack and kept. The soundness question from part 8 is answered by the whole shader pack rather than by a run: `victory translate --list` translates all 26 084 programs in ~45 s, and its per-program lines (25 889 of them: success or the exact failure reason) were diffed between the unbatched and the batched translator: ``` plain programs: 25889 batched: 25889 only plain: 0 only batched: 0 ``` and the stage tallies are identical too (`14 246 of 14 247` vertex and pixel, `2 658 of 2 682` compute, `8 765 of 8 765` mesh emitted). Corpus wall time 47 s -> 44 s. So the batching does not change which programs translate, which was the risk: a phi marked `bad` is lowered as `Val::Missing` from then on, and a placeholder can make another phi look unjoinable. Outcome equality over every program in the pack is the evidence that it does not happen in this title. (Byte equality of the DXIL is not shown; the game runs reach the same place with and without the change - the early device removals happen on both.) The win it keeps, measured on the prologue scenario with a cold cache: ``` before translations 1725 sum 235828 ms median 13 ms max 8030 ms passes>1 19 max passes 74 after translations 401 sum 30208 ms median 5 ms max 2559 ms passes>1 4 max passes 8 ``` 74 passes -> 8, the worst translation 8.0 s -> 2.6 s, 222 extra whole-lowering passes gone. `cargo test --release --workspace`: 30 suites, 0 failures; clippy `-D warnings` clean with and without the diagnostics feature. Two things this also taught, for the next step: the corpus harness is a *deterministic* A/B for translator changes (45 s for the whole pack, identical input), and it is the fast way to check any future change to `lower`; and `resource::track` (224 shaders over 100 ms, 111.9 s in one cold batch) is now the largest single item left in the loading path.
Author
Owner

@⁠pes7 on GitHub · 2026-11-26 03:38 UTC · original

Progress log, part 10 - resource::track is not the quadratic it looked like: measured on the deterministic harness, it is ~1 us per seven instructions.

Part 7 left resource::track as the biggest item in the game's cold batch (224 shaders over 100 ms, 111.9 s). Instrumented on the corpus (victory translate --list on the whole pack, 25 889 tracked programs, 40.6 M IR instructions), printing every call over 1 ms and the share that is inside Tracer::descriptor:

shaders >1 ms in track: 2921 of 25889
sum total: 8537196 us; descriptor(): 3052572 us
  Total  Desc
  27341   431
  25784   562
  25622   506
  21857 16133
  16626  1611
  16486 15610

Worst shader 27 ms, total 8.5 s across the whole pack, and only 36 % of it inside descriptor() - the rest is the per-instruction walk (smem_address, flat_address, the per-block bookkeeping). So on identical input the phase is linear and cheap, and the game's 1.47 s outlier does not reproduce: it was either a shader outside the set translate reaches or contention between the eight pipeline workers, not an algorithmic scan.

That closes the "track is quadratic" hypothesis and moves the cold-batch target back to emit::lower, which is what the batching fix (part 9) already cut. The instrument is not kept: with no quadratic to fix it would only cost Instants per call.

Verification on the current branch: cargo test --release -p victory-shader 302 pass, clippy -D warnings clean, git status clean (the branch is fix/prologue at 5319ffc).

What is left, in the order the measurements put it:

  1. the GPU frame: 683-807 ms of a 867-1006 ms frame with 8bbcbda6008eaa37 (746 groups asking for 200-400 ms) and the two hanging dispatches - the title never reached a mission because those are skipped;
  2. emit::lower's remaining cost (still the bulk of a cold translation after the batching);
  3. the 372-508 draws a frame dropped while their pipelines are made.
**@⁠pes7** on GitHub · 2026-11-26 03:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7181900260) Progress log, part 10 - `resource::track` is not the quadratic it looked like: measured on the deterministic harness, it is ~1 us per seven instructions. Part 7 left `resource::track` as the biggest item in the game's cold batch (224 shaders over 100 ms, 111.9 s). Instrumented on the *corpus* (`victory translate --list` on the whole pack, 25 889 tracked programs, 40.6 M IR instructions), printing every call over 1 ms and the share that is inside `Tracer::descriptor`: ``` shaders >1 ms in track: 2921 of 25889 sum total: 8537196 us; descriptor(): 3052572 us Total Desc 27341 431 25784 562 25622 506 21857 16133 16626 1611 16486 15610 ``` Worst shader 27 ms, total 8.5 s across the whole pack, and only 36 % of it inside `descriptor()` - the rest is the per-instruction walk (`smem_address`, `flat_address`, the per-block bookkeeping). So on identical input the phase is linear and cheap, and the game's 1.47 s outlier does not reproduce: it was either a shader outside the set `translate` reaches or contention between the eight pipeline workers, not an algorithmic scan. That closes the "track is quadratic" hypothesis and moves the cold-batch target back to `emit::lower`, which is what the batching fix (part 9) already cut. The instrument is not kept: with no quadratic to fix it would only cost `Instant`s per call. Verification on the current branch: `cargo test --release -p victory-shader` 302 pass, clippy `-D warnings` clean, `git status` clean (the branch is `fix/prologue` at `5319ffc`). What is left, in the order the measurements put it: 1. the GPU frame: 683-807 ms of a 867-1006 ms frame with `8bbcbda6008eaa37` (746 groups asking for 200-400 ms) and the two hanging dispatches - the title never reached a mission because those are skipped; 2. `emit::lower`'s remaining cost (still the bulk of a cold translation after the batching); 3. the 372-508 draws a frame dropped while their pipelines are made.
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-26 03:43 UTC · original

@⁠pes7 Part 10’s directly timed resource::track calls settle an important question. For the cold game log there’s also an accounting detail on df3c5df: the resource= line records patching the native code and building its range, and the next line, io=, records resource tracking. You can apply that mapping to the saved log. The 111.9 s figure belongs to the former bucket. Original timer

For a future trace I put an optional diagnostics-only timing patch on your timer revision and checked it on Part 9 (5319ffc). It records the completed phases by name. Within range construction it also reports initial IR construction and structuring separately from the bounded passes, with a call count so repeated passes add up.

git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/completed-shader-phases
git cherry-pick 136905049c8a4e9e99e574e96638759fd166b20a

In a diagnostics build the event is enabled by VICTORY_LOG=victory_shader::emit=debug. I checked all 11 phase timers independently with synthetic delays. For example, a 32 ms delay in tracking registered 32,345 µs under resource and 112 µs under range. Two delays in bounded IR construction registered 64,336 µs across two calls. Two complete synthetic shader translations produced identical DXIL and binding metadata with diagnostics disabled, filtered, or enabled. These are timer checks. Your direct corpus measurements remain the evidence for the actual cost.

AI-assisted with Codex.

**@⁠steven-seagull27** on GitHub · 2026-11-26 03:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7181962500) @⁠pes7 Part 10’s directly timed `resource::track` calls settle an important question. For the cold game log there’s also an accounting detail on `df3c5df`: the `resource=` line records patching the native code and building its range, and the next line, `io=`, records resource tracking. You can apply that mapping to the saved log. The 111.9 s figure belongs to the former bucket. [Original timer](https://github.com/Marvisak/VIctory/blob/df3c5df/crates/victory-shader/src/emit/mod.rs#L398-L432) For a future trace I put an optional diagnostics-only [timing patch](https://github.com/steven-seagull27/VIctory/commit/136905049c8a4e9e99e574e96638759fd166b20a) on your timer revision and checked it on Part 9 (`5319ffc`). It records the completed phases by name. Within range construction it also reports initial IR construction and structuring separately from the bounded passes, with a call count so repeated passes add up. ```sh git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/completed-shader-phases git cherry-pick 136905049c8a4e9e99e574e96638759fd166b20a ``` In a diagnostics build the event is enabled by `VICTORY_LOG=victory_shader::emit=debug`. I checked all 11 phase timers independently with synthetic delays. For example, a 32 ms delay in tracking registered 32,345 µs under resource and 112 µs under range. Two delays in bounded IR construction registered 64,336 µs across two calls. Two complete synthetic shader translations produced identical DXIL and binding metadata with diagnostics disabled, filtered, or enabled. These are timer checks. Your direct corpus measurements remain the evidence for the actual cost. AI-assisted with Codex.
Author
Owner

@⁠pes7 on GitHub · 2026-11-26 03:55 UTC · original

Progress log, part 11 - the batching is reverted: the account screen proves it changes generated code, and the plain build runs the prologue for the whole window.

Part 9 kept the batching on the strength of identical outcomes over the shader pack. That was not enough: outcomes can match while the code differs, and here it did. Same scenario, same skips (VICTORY_SKIP_PIPELINES=00167d58cc5a78d7,f607780aa8e502d0), the account screen:

build account screen then
with the batching (5319ffc) 16 draws at 1190-1198 ms/frame (1 fps) for 350 s, never left it -
without it (df3c5df, plain-lower.exe) 11 draws at 38 ms/frame 61 s: 11 draws; 182 s: 4 255 draws; then 47 world frames of 813-4 255 draws at 1.5-4.9 s/frame, end: no crash over the full 480 s window

A shader in the menu went from 38 ms to 1.2 s, so the batched lowering really does emit different code for some program even though both builds translate exactly the same set. The lesson for the record: outcome equality over 26 084 programs is not soundness evidence - the frame time of the account screen is a cheap content check, and it is the one that caught it.

fix/prologue is back at df3c5df (git reset --hard, force-pushed); cargo test --release --workspace 30 suites, 0 failures; the branch carries the 16-bit-format crash fix and the diagnostics.

What the plain run also gives, for the next step: the prologue now runs the whole 480 s window without a device removal as soon as the two hanging dispatches are skipped - 47 world frames, 813-4 255 draws, 1.5-4.9 s/frame (0.2-0.66 fps). That is a survivable platform to work on the frame now, instead of a run that dies in the loading screen.

**@⁠pes7** on GitHub · 2026-11-26 03:55 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7182141231) Progress log, part 11 - the batching is **reverted**: the account screen proves it changes generated code, and the plain build runs the prologue for the whole window. Part 9 kept the batching on the strength of identical *outcomes* over the shader pack. That was not enough: outcomes can match while the code differs, and here it did. Same scenario, same skips (`VICTORY_SKIP_PIPELINES=00167d58cc5a78d7,f607780aa8e502d0`), the account screen: | build | account screen | then | |---|---|---| | with the batching (`5319ffc`) | 16 draws at **1190-1198 ms/frame** (1 fps) for 350 s, never left it | - | | without it (`df3c5df`, `plain-lower.exe`) | 11 draws at **38 ms/frame** | 61 s: 11 draws; 182 s: **4 255 draws**; then 47 world frames of 813-4 255 draws at 1.5-4.9 s/frame, **`end: no crash`** over the full 480 s window | A shader in the *menu* went from 38 ms to 1.2 s, so the batched lowering really does emit different code for some program even though both builds translate exactly the same set. The lesson for the record: outcome equality over 26 084 programs is not soundness evidence - the frame time of the account screen is a cheap content check, and it is the one that caught it. `fix/prologue` is back at `df3c5df` (`git reset --hard`, force-pushed); `cargo test --release --workspace` 30 suites, 0 failures; the branch carries the 16-bit-format crash fix and the diagnostics. What the plain run also gives, for the next step: **the prologue now runs the whole 480 s window without a device removal** as soon as the two hanging dispatches are skipped - 47 world frames, 813-4 255 draws, 1.5-4.9 s/frame (0.2-0.66 fps). That is a survivable platform to work on the frame now, instead of a run that dies in the loading screen.
Author
Owner

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

Progress log, part 12 - a way to see the arguments of a command that never finishes, and why the earlier batching verdict needs a caveat.

The problem with every dump so far. A command that hangs the GPU can only be named after the fact (breadcrumbs), never read: capture::read_indirect copies the records into a read-back buffer inside the list, and that list is the one that never finishes. So the counts of the hanging dispatch were never visible - which is exactly what we needed to tell "huge work" from "garbage data".

What is now logged. The arguments live in the host copy of title memory, and the refresh that fills it runs immediately before the list runs. VICTORY_DUMP_ARGUMENTS (diagnostics) defers a step that logs the record's dwords at submission time, from the copy the GPU will read:

indirect arguments {kind, max, count, dwords, name}

For the two dispatches that stop the prologue and for whatever the breadcrumbs name next, one run now says what they were asked to do - 16 dwords per record, before anything can hang.

A caveat on part 11. Five more runs: four ended in a device removal during loading (34, 33, 33, 26 lists, no world frame), one survived 480 s in the prologue (47 frames, 813-4 255 draws, 1.5-4.9 s/frame). And the plain build, which was 38 ms/frame at the account screen in the surviving run, showed 1 202-1 212 ms/frame at the same 16-draw screen in two other runs. So the 1.2 s account screen is intermittent in both builds, not a property of the batched lowering: part 11's evidence was one run against one run, and the batching revert stands only on "no measured win" plus that single comparison. What is certain is that the pathology exists without the batching, and that the account screen - 16 draws, no game logic - reproduces it cheaply when it happens.

That is the cheapest reproduction we have of the "1 fps" reports: a 16-draw screen at 1.2 s/frame, no world, no streaming.

Branch: fix/prologue at 555a5d9, cargo test --release --workspace 30 suites 0 failures, clippy -D warnings clean with the diagnostics feature.

**@⁠pes7** on GitHub · 2026-11-26 04:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7182563720) Progress log, part 12 - a way to see the arguments of a command that never finishes, and why the earlier batching verdict needs a caveat. **The problem with every dump so far.** A command that hangs the GPU can only be named after the fact (breadcrumbs), never read: `capture::read_indirect` copies the records into a read-back buffer *inside the list*, and that list is the one that never finishes. So the counts of the hanging dispatch were never visible - which is exactly what we needed to tell "huge work" from "garbage data". **What is now logged.** The arguments live in the *host copy* of title memory, and the refresh that fills it runs immediately before the list runs. `VICTORY_DUMP_ARGUMENTS` (diagnostics) defers a step that logs the record's dwords at submission time, from the copy the GPU will read: ``` indirect arguments {kind, max, count, dwords, name} ``` For the two dispatches that stop the prologue and for whatever the breadcrumbs name next, one run now says what they were asked to do - 16 dwords per record, before anything can hang. **A caveat on part 11.** Five more runs: four ended in a device removal during loading (34, 33, 33, 26 lists, no world frame), one survived 480 s in the prologue (47 frames, 813-4 255 draws, 1.5-4.9 s/frame). And the *plain* build, which was 38 ms/frame at the account screen in the surviving run, showed 1 202-1 212 ms/frame at the same 16-draw screen in two other runs. So the 1.2 s account screen is **intermittent in both builds**, not a property of the batched lowering: part 11's evidence was one run against one run, and the batching revert stands only on "no measured win" plus that single comparison. What is certain is that the pathology exists without the batching, and that the account screen - 16 draws, no game logic - reproduces it cheaply when it happens. That is the cheapest reproduction we have of the "1 fps" reports: a 16-draw screen at 1.2 s/frame, no world, no streaming. Branch: `fix/prologue` at `555a5d9`, `cargo test --release --workspace` 30 suites 0 failures, clippy `-D warnings` clean with the diagnostics feature.
Author
Owner

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

Progress log, part 13 - three things my own tooling had been hiding, and the number that names the stall.

The drivers were running the wrong binary. Several recent "no per-command data" runs used target\release\victory.exe built without --features diagnostics: VICTORY_SKIP_PIPELINES, VICTORY_DUMP_ARGUMENTS, VICTORY_GPU_TIMING and DRED are all diagnostics-only (main has no #2696), so they did nothing and the two hanging dispatches ran. Two more driver bugs of the same kind: the scripts set VICTORY_GPU_TIMING/VICTORY_D3D12_DRED and then deleted them a few lines later, and one presser built the string "$attempt: ..." which PowerShell parses as a drive. All fixed (press*.ps1, drive16).

The 68 MB logs were one warning. 310 724 of 317 747 lines in a 100 s run were descriptor::host's per-slot warning - main does not have #2634 (open). With #2634 applied (test/with-2634, local) the same run's log is ~1 MB and it lasts minutes.

With a correct build, the loading's GPU cost is ~1 s per command. VICTORY_GPU_TIMING ranking over a loading run (each list alone, so inflated, but the ranking holds):

1008.9 ms: texture upload (1920x1080x1 f61 mips 1) sub 0 of 1 from staging ... pitch 2048
 937.5 ms: barrier groups [(1, 1)]
 918.6 ms: dispatch 8x16x2 [compute c18ab7816c206926]
 827.6 ms: barrier groups [(1, 1)]
 762.4 ms: texture upload ...
 730.7 ms: copy ...

and the frame itself, from a run without the timing switch: 15 450 ms, of which 15 269 on the GPU, with 0 draws and 0 indirect - so the first world-loading frame is compute dispatches and uploads, not geometry. A dispatch of 256 groups taking 918 ms is the same "loop to the 2^20 limit" shape seen before, in a third shader.

The loop limit is the mechanism. The same run with VICTORY_SHADER_LOOP_LIMIT=1024: the loading frames go from 15 450 ms to 56-83 ms (11 draws). The stall is the translated loops; 1024 iterations is still far above any legitimate march, but it is a diagnostic - the shader then computes the wrong thing, and a device removal still happened later (after a submission of 2 lists), so it is not the whole story.

Next: the same instrument (VICTORY_DUMP_ARGUMENTS, and VICTORY_DUMP_SHADER for c18ab7816c206926) on a run that reaches the world, to see whether the loop bound's data is huge or garbage - decided by whether the dwords are plausible counts or noise.

**@⁠pes7** on GitHub · 2026-11-26 05:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7183311656) Progress log, part 13 - three things my own tooling had been hiding, and the number that names the stall. **The drivers were running the wrong binary.** Several recent "no per-command data" runs used `target\release\victory.exe` built *without* `--features diagnostics`: `VICTORY_SKIP_PIPELINES`, `VICTORY_DUMP_ARGUMENTS`, `VICTORY_GPU_TIMING` and DRED are all diagnostics-only (main has no #2696), so they did nothing and the two hanging dispatches ran. Two more driver bugs of the same kind: the scripts set `VICTORY_GPU_TIMING`/`VICTORY_D3D12_DRED` and then deleted them a few lines later, and one presser built the string `"$attempt: ..."` which PowerShell parses as a drive. All fixed (`press*.ps1`, `drive16`). **The 68 MB logs were one warning.** 310 724 of 317 747 lines in a 100 s run were `descriptor::host`'s per-slot warning - main does not have #2634 (open). With #2634 applied (`test/with-2634`, local) the same run's log is ~1 MB and it lasts minutes. **With a correct build, the loading's GPU cost is ~1 s per command.** `VICTORY_GPU_TIMING` ranking over a loading run (each list alone, so inflated, but the ranking holds): ``` 1008.9 ms: texture upload (1920x1080x1 f61 mips 1) sub 0 of 1 from staging ... pitch 2048 937.5 ms: barrier groups [(1, 1)] 918.6 ms: dispatch 8x16x2 [compute c18ab7816c206926] 827.6 ms: barrier groups [(1, 1)] 762.4 ms: texture upload ... 730.7 ms: copy ... ``` and the frame itself, from a run without the timing switch: **15 450 ms, of which 15 269 on the GPU, with 0 draws and 0 indirect** - so the first world-loading frame is compute dispatches and uploads, not geometry. A dispatch of 256 groups taking 918 ms is the same "loop to the 2^20 limit" shape seen before, in a third shader. **The loop limit is the mechanism.** The same run with `VICTORY_SHADER_LOOP_LIMIT=1024`: the loading frames go from 15 450 ms to **56-83 ms** (11 draws). The stall is the translated loops; 1024 iterations is still far above any legitimate march, but it is a diagnostic - the shader then computes the wrong thing, and a device removal still happened later (`after a submission of 2 lists`), so it is not the whole story. Next: the same instrument (`VICTORY_DUMP_ARGUMENTS`, and `VICTORY_DUMP_SHADER` for `c18ab7816c206926`) on a run that reaches the world, to see whether the loop bound's data is huge or garbage - decided by whether the dwords are plausible counts or noise.
Author
Owner

@⁠pes7 on GitHub · 2026-11-26 05:28 UTC · original

Progress log, part 14 - the 918 ms dispatch has no loops at all, and every shader the loading translates is now dumped.

c18ab7816c206926 is not the culprit. Dumped with VICTORY_DUMP_SHADER and disassembled (dxc -dumpbin): NumThreads=(8,4,1), 1 391 IR lines, no loop-limit check, no barrier, 2 atomics. A dispatch of 256 groups with no loops cannot cost 918 ms, so that thousand-millisecond entry in the VICTORY_GPU_TIMING ranking is the drain of work from the other threads in the queue, not this command's own cost. The ranking cannot attribute the loading's 15 s; the attribution needs a GPU-side timestamp pair around each dispatch, which this switch does not do (it submits one list per wait instead).

The population that can run to the limit is wide. A run with VICTORY_DUMP_SHADER=all dumped 1 932 shaders in a 52 s loading run; disassembling all of them, 809 have translated loops, and the tail is not one shader:

checks=34: 1 shader
checks=27: 14 shaders
checks=25: 14 shaders
checks=23: 2 shaders
checks=21: 2 shaders

(one icmp ult i32 %counter, 1048576 per loop). So "find the one bad loop" is the wrong shape of question: a third of the loading's shaders can burn a million iterations per lane if their data never satisfies the exit, and the measured mechanism is confirmed from the other side - VICTORY_SHADER_LOOP_LIMIT=1024 takes the same loading frames from 15 450 ms to 56-83 ms.

What that points at. A runtime signal is needed, not a static one: the cheapest is to make the limit exit itself count - the emitter already emits a distinct path for it (a lane that reaches the limit leaves the program as killed), so a diagnostics build can have that path bump a counter the host reads back, and the pipeline log then names the shaders whose lanes actually ran a million iterations. That is one small emitter change plus a read-back, and it turns "809 candidates" into "these four pipelines, in this frame".

Nothing is committed for a gain this turn; the branch is unchanged (fix/prologue at 555a5d9, 30 workspace suites green, CI green).

**@⁠pes7** on GitHub · 2026-11-26 05:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7183511852) Progress log, part 14 - the 918 ms dispatch has no loops at all, and every shader the loading translates is now dumped. **`c18ab7816c206926` is not the culprit.** Dumped with `VICTORY_DUMP_SHADER` and disassembled (`dxc -dumpbin`): `NumThreads=(8,4,1)`, **1 391 IR lines, no loop-limit check, no barrier**, 2 atomics. A dispatch of 256 groups with no loops cannot cost 918 ms, so that thousand-millisecond entry in the `VICTORY_GPU_TIMING` ranking is the *drain* of work from the other threads in the queue, not this command's own cost. The ranking cannot attribute the loading's 15 s; the attribution needs a GPU-side timestamp pair around each dispatch, which this switch does not do (it submits one list per wait instead). **The population that can run to the limit is wide.** A run with `VICTORY_DUMP_SHADER=all` dumped **1 932 shaders** in a 52 s loading run; disassembling all of them, **809 have translated loops**, and the tail is not one shader: ``` checks=34: 1 shader checks=27: 14 shaders checks=25: 14 shaders checks=23: 2 shaders checks=21: 2 shaders ``` (one `icmp ult i32 %counter, 1048576` per loop). So "find the one bad loop" is the wrong shape of question: a third of the loading's shaders can burn a million iterations per lane if their data never satisfies the exit, and the measured mechanism is confirmed from the other side - `VICTORY_SHADER_LOOP_LIMIT=1024` takes the same loading frames from **15 450 ms to 56-83 ms**. **What that points at.** A runtime signal is needed, not a static one: the cheapest is to make the *limit exit itself* count - the emitter already emits a distinct path for it (`a lane that reaches the limit leaves the program as killed`), so a diagnostics build can have that path bump a counter the host reads back, and the pipeline log then names the shaders whose lanes actually ran a million iterations. That is one small emitter change plus a read-back, and it turns "809 candidates" into "these four pipelines, in this frame". Nothing is committed for a gain this turn; the branch is unchanged (`fix/prologue` at `555a5d9`, 30 workspace suites green, CI green).
Author
Owner

@⁠pes7 on GitHub · 2026-11-26 05:48 UTC · original

Progress log, part 15 - a way to attribute a batched submission's GPU time, and the reason the first attempt at it produced nothing.

Part 14 ended with the finding that VICTORY_GPU_TIMING cannot attribute the loading's 15 s: it submits every list on its own and waits (that is what makes it ~10x wrong), and c18ab7816c206926 - the command it ranked highest - has no loops at all, so its 918 ms was the queue draining.

What is committed now (0247b95). VICTORY_GPU_STAMPS (diagnostics) turns the per-command timestamps on without the one-list-per-submission mode, and a submission of all lists that takes over 200 ms reports the two longest commands of every list in it:

slow host submission ms=...
slow list 7 command, 918.6 ms: dispatch 8x16x2 [compute ...]

Also fixed while doing it: every list resolved its stamps into offset 0 of its read-back buffer, so only the list that closed last kept its times - each list now has its own slot (STAMP_SLOTS).

What it printed on the first run: nothing but slow host submission. 268 of those, 0 slow list lines - the stamps are collected only through the VICTORY_GPU_TIMING gate in timing(), which stamps() asked for; with the switch on the list has a heap and resolves, but note_op is what inserts the EndQuery markers and it requires dred_on(). So the next check is one line: whether notes is populated when VICTORY_GPU_D3D12_DRED and VICTORY_GPU_STAMPS are both on (it was set in that run, so the likely cause is the read-back offset arithmetic rather than the notes - the slots change is new and untested).

Branch: fix/prologue at 0247b95, cargo test --release --workspace 30 suites 0 failures, clippy -D warnings clean with the diagnostics feature.

Still open, unchanged: the loading's 15 s and the device removal, the world frame (683-807 ms of GPU with 8bbcbda6008eaa37 at 200-400 ms), the 372-508 dropped draws, and no mission reached. The one measured translation win remains reverted.

**@⁠pes7** on GitHub · 2026-11-26 05:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7183824729) Progress log, part 15 - a way to attribute a batched submission's GPU time, and the reason the first attempt at it produced nothing. Part 14 ended with the finding that `VICTORY_GPU_TIMING` cannot attribute the loading's 15 s: it submits every list on its own and waits (that is what makes it ~10x wrong), and `c18ab7816c206926` - the command it ranked highest - has no loops at all, so its 918 ms was the queue draining. **What is committed now (`0247b95`).** `VICTORY_GPU_STAMPS` (diagnostics) turns the per-command timestamps on *without* the one-list-per-submission mode, and a submission of all lists that takes over 200 ms reports the two longest commands of every list in it: ``` slow host submission ms=... slow list 7 command, 918.6 ms: dispatch 8x16x2 [compute ...] ``` Also fixed while doing it: every list resolved its stamps into offset 0 of its read-back buffer, so only the list that closed last kept its times - each list now has its own slot (`STAMP_SLOTS`). **What it printed on the first run: nothing but `slow host submission`.** 268 of those, 0 `slow list` lines - the stamps are collected only through the `VICTORY_GPU_TIMING` gate in `timing()`, which `stamps()` asked for; with the switch on the list has a heap and resolves, but `note_op` is what inserts the `EndQuery` markers and it requires `dred_on()`. So the next check is one line: whether `notes` is populated when `VICTORY_GPU_D3D12_DRED` and `VICTORY_GPU_STAMPS` are both on (it was set in that run, so the likely cause is the read-back offset arithmetic rather than the notes - the slots change is new and untested). Branch: `fix/prologue` at `0247b95`, `cargo test --release --workspace` 30 suites 0 failures, clippy `-D warnings` clean with the diagnostics feature. Still open, unchanged: the loading's 15 s and the device removal, the world frame (683-807 ms of GPU with 8bbcbda6008eaa37 at 200-400 ms), the 372-508 dropped draws, and no mission reached. The one measured translation win remains reverted.
Author
Owner

@⁠pes7 on GitHub · 2026-11-26 06:01 UTC · original

Progress log, part 16 - the indirect counts are finally visible, and they answer the huge-vs-garbage question: the counts are small.

The instrument worked once the driver stopped running a stale binary. A third bug of the same family: the presser scripts had $exe = ...\exe\with2634-diag.exe hard-coded, so every run after the first used an old build - the one without VICTORY_GPU_STAMPS and without the new report. VICTORY_DUMP_ARGUMENTS therefore never printed anything, not because the instrument was wrong. With the fresh binary:

indirect arguments [compute fc5e66f8f873d3bb] kind=2 max=1 count=4294967295 dwords=[642, 1, 1]
indirect arguments [compute 0452fc2d2e2fc4c3] kind=2 max=1 count=4294967295 dwords=[0, 1, 1]
indirect arguments [compute 9146291b38ea9ce1] kind=2 max=1 count=4294967295 dwords=[16, 1, 1]
indirect arguments [compute fc5e66f8f873d3bb] kind=2 max=1 count=4294967295 dwords=[0, 0, 0]

6 426 of those lines in one loading run, and the dispatch counts are 642, 16, 0, 1 groups - plausible, small numbers, not huge and not garbage. So the loading's 15 s is not fed by oversized indirect work; with VICTORY_SHADER_LOOP_LIMIT=1024 taking the same frames to 56-83 ms, the cost is per-thread loops inside direct dispatches, exactly the "loop to the 2^20 limit" shape.

The batched per-command report is structurally alive but reads zeros. Same run:

slow host submission ms=5946 lists=1 notes=7439 stamps=true
slow host submission ms=305 lists=24 notes=879 stamps=true
slow list 0 command, 0.0 ms: dispatch 18x1x1 [compute ced45910ad577dcb] ...
slow list 1 command, 0.0 ms: draw 3x1 ...

Notes are recorded (7 439 of them), the heap exists, the lines print - and every duration is 0.0 ms, so the read-back lands where the timestamps are not. That is now a two-line question (the STAMP_SLOTS offset in close() against the one slowest() maps) rather than a blind one; the report also now logs notes= and stamps= so the next empty run says which half is missing.

Branch fix/prologue at 993d3f0; cargo test --release --workspace 30 suites, 0 failures; clippy -D warnings clean with diagnostics.

**@⁠pes7** on GitHub · 2026-11-26 06:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7184021999) Progress log, part 16 - the indirect counts are finally visible, and they answer the huge-vs-garbage question: the counts are small. **The instrument worked once the driver stopped running a stale binary.** A third bug of the same family: the presser scripts had `$exe = ...\exe\with2634-diag.exe` hard-coded, so every run after the first used an *old* build - the one without `VICTORY_GPU_STAMPS` and without the new report. `VICTORY_DUMP_ARGUMENTS` therefore never printed anything, not because the instrument was wrong. With the fresh binary: ``` indirect arguments [compute fc5e66f8f873d3bb] kind=2 max=1 count=4294967295 dwords=[642, 1, 1] indirect arguments [compute 0452fc2d2e2fc4c3] kind=2 max=1 count=4294967295 dwords=[0, 1, 1] indirect arguments [compute 9146291b38ea9ce1] kind=2 max=1 count=4294967295 dwords=[16, 1, 1] indirect arguments [compute fc5e66f8f873d3bb] kind=2 max=1 count=4294967295 dwords=[0, 0, 0] ``` 6 426 of those lines in one loading run, and the dispatch counts are **642, 16, 0, 1 groups** - plausible, small numbers, not huge and not garbage. So the loading's 15 s is not fed by oversized indirect work; with `VICTORY_SHADER_LOOP_LIMIT=1024` taking the same frames to 56-83 ms, the cost is per-thread loops inside direct dispatches, exactly the "loop to the 2^20 limit" shape. **The batched per-command report is structurally alive but reads zeros.** Same run: ``` slow host submission ms=5946 lists=1 notes=7439 stamps=true slow host submission ms=305 lists=24 notes=879 stamps=true slow list 0 command, 0.0 ms: dispatch 18x1x1 [compute ced45910ad577dcb] ... slow list 1 command, 0.0 ms: draw 3x1 ... ``` Notes are recorded (7 439 of them), the heap exists, the lines print - and every duration is 0.0 ms, so the read-back lands where the timestamps are not. That is now a two-line question (the `STAMP_SLOTS` offset in `close()` against the one `slowest()` maps) rather than a blind one; the report also now logs `notes=` and `stamps=` so the next empty run says which half is missing. Branch `fix/prologue` at `993d3f0`; `cargo test --release --workspace` 30 suites, 0 failures; clippy `-D warnings` clean with diagnostics.
Author
Owner

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

Progress log, part 17 - the loading's five seconds has a name, and it is one workgroup.

The read-back was reading the wrong place. Map returns the start of a read-back resource, not of the range asked for, so once every list took its own STAMP_SLOTS slot the report read offset 0 (another list's slot, or zeroes) and printed 0.0 ms for everything while 7 439 notes and a live heap were right there. One line (data.add(begin)) and the batched report works:

slow host submission ms=5946 lists=1 notes=7439 stamps=true
slow list 0 command, 5251.0 ms: dispatch 1x1x1 [compute caa78b8ca62bc3d6] | u16=0x95c0 [heap 38336: Placed(...)]
slow list 0 command,  123.1 ms: indirect kind 2 max 1 at 0x7c799b440 [compute 8bbcbda6008eaa37]
slow list 0 command,  111.2 ms: draw 3x1 [vertex ce57291b5a1750ca, pixel a467d848ace5810d]
slow list 0 command,   79.6 ms: draw 3x1 [vertex ce57291b5a1750ca, pixel 8992ac65c3b6b5eb]
slow list 0 command,   61.0 ms: indirect kind 2 max 1 at 0x79991fa00 [compute be6ce5d849d51127]
slow list 0 command,   56.7 ms: dispatch 64x64x1 [compute 9938c251a313fe28]

caa78b8ca62bc3d6 is the 5 s. NumThreads=(64,1,1), dispatched 1x1x1 - sixty-four threads - 9 768 IR lines, three translated loops, no barriers. Its loops:

%585  = icmp ult i32 3, %560        ; while (3 < count)
%5909 = icmp eq i32 %5812, %462     ; while (loaded != key)
%6022 = icmp eq i32 %5939, %466     ; while (loaded != key)

The latter two are searches: they advance until a loaded value equals a key, with the 2^20 limit as the only other exit. Sixty-four threads running a million-iteration search is exactly 5 s, and it is the first frame's TDR (5 251 ms is over the 2 s window on its own, before the rest of the submission).

So the question is now narrow and concrete: the search's key or its table does not match what the title has on the console - either the table is stale in our copy at that dispatch, or the comparison reads a different width/sign than the original. The next step is to dump that table and the key at submission (the same mechanism as VICTORY_DUMP_ARGUMENTS, extended to a direct dispatch's user-data buffers) and compare - a match in the data but not on the GPU means a translation bug, no match means a refresh bug.

Branch fix/prologue at a1d5662; cargo test --release --workspace 30 suites, 0 failures; clippy -D warnings clean with diagnostics.

**@⁠pes7** on GitHub · 2026-11-26 06:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7184169955) Progress log, part 17 - the loading's five seconds has a name, and it is one workgroup. **The read-back was reading the wrong place.** `Map` returns the start of a read-back resource, not of the range asked for, so once every list took its own `STAMP_SLOTS` slot the report read offset 0 (another list's slot, or zeroes) and printed 0.0 ms for everything while 7 439 notes and a live heap were right there. One line (`data.add(begin)`) and the batched report works: ``` slow host submission ms=5946 lists=1 notes=7439 stamps=true slow list 0 command, 5251.0 ms: dispatch 1x1x1 [compute caa78b8ca62bc3d6] | u16=0x95c0 [heap 38336: Placed(...)] slow list 0 command, 123.1 ms: indirect kind 2 max 1 at 0x7c799b440 [compute 8bbcbda6008eaa37] slow list 0 command, 111.2 ms: draw 3x1 [vertex ce57291b5a1750ca, pixel a467d848ace5810d] slow list 0 command, 79.6 ms: draw 3x1 [vertex ce57291b5a1750ca, pixel 8992ac65c3b6b5eb] slow list 0 command, 61.0 ms: indirect kind 2 max 1 at 0x79991fa00 [compute be6ce5d849d51127] slow list 0 command, 56.7 ms: dispatch 64x64x1 [compute 9938c251a313fe28] ``` **`caa78b8ca62bc3d6` is the 5 s.** `NumThreads=(64,1,1)`, dispatched 1x1x1 - sixty-four threads - 9 768 IR lines, three translated loops, no barriers. Its loops: ``` %585 = icmp ult i32 3, %560 ; while (3 < count) %5909 = icmp eq i32 %5812, %462 ; while (loaded != key) %6022 = icmp eq i32 %5939, %466 ; while (loaded != key) ``` The latter two are **searches**: they advance until a loaded value equals a key, with the 2^20 limit as the only other exit. Sixty-four threads running a million-iteration search is exactly 5 s, and it is the first frame's TDR (5 251 ms is over the 2 s window on its own, before the rest of the submission). So the question is now narrow and concrete: the search's key or its table does not match what the title has on the console - either the table is stale in our copy at that dispatch, or the comparison reads a different width/sign than the original. The next step is to dump that table and the key at submission (the same mechanism as `VICTORY_DUMP_ARGUMENTS`, extended to a direct dispatch's user-data buffers) and compare - a match in the data but not on the GPU means a translation bug, no match means a refresh bug. Branch `fix/prologue` at `a1d5662`; `cargo test --release --workspace` 30 suites, 0 failures; clippy `-D warnings` clean with diagnostics.
Author
Owner

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

Progress log, part 18 - the prologue runs without any skip, and no device removal, once the loops are capped.

The measurement that matters this time:

VICTORY_SHADER_LOOP_LIMIT=1024, no VICTORY_SKIP_PIPELINES (none at all):
  130 world frames, 0 device removals, the full 420 s window
  frames 2.8-3.4 s: preparing 0.5-1.9 s (copies 1.2-10.4 GB a frame),
                    GPU 2.2-2.7 s, copying back 0.03-0.3 s

Until now every run that reached the world needed two compute dispatches skipped, and every run without skips died in loading with DXGI_ERROR_DEVICE_HUNG. With the loops capped at 1024 iterations per lane the title loads, enters the prologue and stays there for seven minutes of gameplay without a removal - so the TDR was entirely the translated loops running to their 2^20 limit, not a bad state, a bad descriptor or a bad submission.

The specific one that cost the loading its 5 s is named (part 17): caa78b8ca62bc3d6, NumThreads=(64,1,1) in a 1x1x1 dispatch, whose two searches are while (loaded != key) with the limit as the only other exit. Capping at 1024 makes them terminate; the right fix is to make them find what the title's data has, and that is the next piece of work.

Two caveats, stated plainly:

  • 1024 is a diagnostic, not a fix: a legitimate loop that needs more is cut short and the shader then computes the wrong thing. The picture was not inspected in this run.
  • even capped, the frame is 2.2-3.4 s (CPU copies 0.5-1.9 s of it, 1.2-10.4 GB a frame), so the "1 fps" is not only the loops.

What is left, in order: (a) run the same scenario with VICTORY_D3D12_DRED=1 as well, so the per-command report (which now works, part 17) says what the remaining 2.2 s of GPU is; (b) fix the two searches of caa78b8ca62bc3d6 by comparing its key against the table the title actually has - a data dump at submission, as planned; (c) then the copy volume (1.2-10.4 GB a frame), which dwarfs everything else on the CPU side.

Branch fix/prologue at a1d5662, 30 workspace suites green, clippy clean with diagnostics.

**@⁠pes7** on GitHub · 2026-11-26 06:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7184434035) Progress log, part 18 - the prologue runs **without any skip**, and no device removal, once the loops are capped. The measurement that matters this time: ``` VICTORY_SHADER_LOOP_LIMIT=1024, no VICTORY_SKIP_PIPELINES (none at all): 130 world frames, 0 device removals, the full 420 s window frames 2.8-3.4 s: preparing 0.5-1.9 s (copies 1.2-10.4 GB a frame), GPU 2.2-2.7 s, copying back 0.03-0.3 s ``` Until now every run that reached the world needed two compute dispatches skipped, and every run without skips died in loading with `DXGI_ERROR_DEVICE_HUNG`. With the loops capped at 1024 iterations per lane the title loads, enters the prologue and stays there for seven minutes of gameplay without a removal - so the TDR was entirely the translated loops running to their 2^20 limit, not a bad state, a bad descriptor or a bad submission. The specific one that cost the loading its 5 s is named (part 17): `caa78b8ca62bc3d6`, `NumThreads=(64,1,1)` in a 1x1x1 dispatch, whose two searches are `while (loaded != key)` with the limit as the only other exit. Capping at 1024 makes them terminate; the right fix is to make them find what the title's data has, and that is the next piece of work. Two caveats, stated plainly: - 1024 is a **diagnostic**, not a fix: a legitimate loop that needs more is cut short and the shader then computes the wrong thing. The picture was not inspected in this run. - even capped, the frame is 2.2-3.4 s (CPU copies 0.5-1.9 s of it, 1.2-10.4 GB a frame), so the "1 fps" is not only the loops. What is left, in order: (a) run the same scenario with `VICTORY_D3D12_DRED=1` as well, so the per-command report (which now works, part 17) says what the remaining 2.2 s of GPU is; (b) fix the two searches of `caa78b8ca62bc3d6` by comparing its key against the table the title actually has - a data dump at submission, as planned; (c) then the copy volume (1.2-10.4 GB a frame), which dwarfs everything else on the CPU side. Branch `fix/prologue` at `a1d5662`, 30 workspace suites green, clippy clean with diagnostics.
Author
Owner

@⁠pes7 on GitHub · 2026-11-26 06:33 UTC · original

Progress log, part 19 - the 6 s dispatch is a nested pair of loops, so the per-loop cap cannot bound it, and the outer loop's bound is the value to look at.

Per-command attribution in the no-skip run (LOOP_LIMIT=1024, GPU_STAMPS, DRED):

6012.2 ms: dispatch 1x1x1 [compute caa78b8ca62bc3d6]
2191.3 ms: DROPPED dispatch (a root view's offset: ...)      <- see below, an artefact
 527.8 ms: indirect kind 2 max 1 [compute 6697dff15287e544]
 523.9 ms: indirect kind 2 max 1 [compute 6697dff15287e544]
 351.5 ms: dispatch 3600x1x1 [compute 39f0e9aeb156a61c]

caa78b8ca62bc3d6 is still 6 s with the cap at 1024. Its three limit checks leave to the same block, and the IR puts the loops headed at %604 and %5933 inside the one headed at %540 (%540..exit at 6026/6375, both inner headers between them):

540  (outer: exits on `icmp ult i32 3, %560`)
 604  (inner: `icmp eq i32 %5812, %462`, limit at 1024)
 5933 (inner: `icmp eq i32 %5939, %466`, limit at 1024)

So the cap is per loop entry: 1 024 outer iterations x 1 024 inner = ~10^6, which is the 6 s. The lever is the outer bound %560: on the console it is presumably a handful (the loop exits when 3 < count), and in ours it is at least 1 024, which is either stale data or a mistranslated count. That value is now the single thing to dump.

The attribution reports drains too, and one line proves it: DROPPED dispatch (...) 2191.3 ms - a dropped command records no GPU work, so its 2.2 s is the previous work finishing between the two markers. The remaining 2.2 s of a world frame is therefore split between caa78b8ca62bc3d6 (6 s over the frames it runs in), 6697dff15287e544 (~0.5 s per call, several a frame) and that drain, and the per-command numbers are upper bounds, not costs.

Branch fix/prologue at a1d5662; 30 workspace suites green; clippy clean with diagnostics. Next: dump %560, %462 and %466 at submission time (the user-data buffer of the direct 1x1x1 dispatch), decide data-vs-translation, and fix accordingly.

**@⁠pes7** on GitHub · 2026-11-26 06:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7184545186) Progress log, part 19 - the 6 s dispatch is a **nested** pair of loops, so the per-loop cap cannot bound it, and the outer loop's bound is the value to look at. Per-command attribution in the no-skip run (`LOOP_LIMIT=1024`, `GPU_STAMPS`, DRED): ``` 6012.2 ms: dispatch 1x1x1 [compute caa78b8ca62bc3d6] 2191.3 ms: DROPPED dispatch (a root view's offset: ...) <- see below, an artefact 527.8 ms: indirect kind 2 max 1 [compute 6697dff15287e544] 523.9 ms: indirect kind 2 max 1 [compute 6697dff15287e544] 351.5 ms: dispatch 3600x1x1 [compute 39f0e9aeb156a61c] ``` **`caa78b8ca62bc3d6` is still 6 s with the cap at 1024.** Its three limit checks leave to the same block, and the IR puts the loops headed at `%604` and `%5933` *inside* the one headed at `%540` (`%540`..exit at 6026/6375, both inner headers between them): ``` 540 (outer: exits on `icmp ult i32 3, %560`) 604 (inner: `icmp eq i32 %5812, %462`, limit at 1024) 5933 (inner: `icmp eq i32 %5939, %466`, limit at 1024) ``` So the cap is per loop entry: 1 024 outer iterations x 1 024 inner = ~10^6, which is the 6 s. The lever is the **outer** bound `%560`: on the console it is presumably a handful (the loop exits when `3 < count`), and in ours it is at least 1 024, which is either stale data or a mistranslated count. That value is now the single thing to dump. **The attribution reports drains too**, and one line proves it: `DROPPED dispatch (...) 2191.3 ms` - a dropped command records no GPU work, so its 2.2 s is the previous work finishing between the two markers. The remaining 2.2 s of a world frame is therefore split between `caa78b8ca62bc3d6` (6 s over the frames it runs in), `6697dff15287e544` (~0.5 s per call, several a frame) and that drain, and the per-command numbers are upper bounds, not costs. Branch `fix/prologue` at `a1d5662`; 30 workspace suites green; clippy clean with diagnostics. Next: dump `%560`, `%462` and `%466` at submission time (the user-data buffer of the direct 1x1x1 dispatch), decide data-vs-translation, and fix accordingly.
Author
Owner

@⁠pes7 on GitHub · 2026-11-26 06:40 UTC · original

Progress log, part 20 - the data of the 6 s dispatch is not in a table, and that is itself the answer to "why nothing printed".

The two searches of caa78b8ca62bc3d6 exit on loaded != key with the 2^20 cap as the only other way out, and they are nested inside the loop that exits on 3 < count (part 19), so the cap does not bound them (1024 x 1024). To see the values, VICTORY_DUMP_VIEWS (diagnostics, 340844b) now logs the first sixteen dwords of every constant or placed buffer view a traced pipeline binds, at submission time, from the copy the GPU will read.

First run with VICTORY_TRACE_SHADERS=caa78b8ca62bc3d6 and VICTORY_DUMP_VIEWS=1: zero lines. The shader therefore does not read its data through a descriptor table - it reads root views or user data (its recorded notes say u16=0x95c0, a user-data heap slot, not a table entry), so the dump has to be extended to those two paths before it can say anything.

That is the whole of this step, and it is worth writing down as such: two instruments (per-command attribution, view dump) now work on the paths they cover, the 6 s is attributed to one shader with three nested loops, and what remains is to reach the values through the root-view/user-data path - a smaller job than the table dump was, because those bindings are already resolved in bind as Root::View(address) and user_value.

Branch fix/prologue at 340844b; cargo test --release --workspace 30 suites, 0 failures; clippy -D warnings clean with diagnostics.

Still unmet and unchanged: no mission reached, no shipped fps or loading gain; the prologue runs only with the loop cap (diagnostic, wrong picture), frames are 2.2-3.4 s with 1.2-10.4 GB of copies, and the world frame's GPU is caa78b8ca62bc3d6 plus 6697dff15287e544 (~0.5 s a call).

**@⁠pes7** on GitHub · 2026-11-26 06:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7184661391) Progress log, part 20 - the data of the 6 s dispatch is not in a table, and that is itself the answer to "why nothing printed". The two searches of `caa78b8ca62bc3d6` exit on `loaded != key` with the 2^20 cap as the only other way out, and they are *nested* inside the loop that exits on `3 < count` (part 19), so the cap does not bound them (1024 x 1024). To see the values, `VICTORY_DUMP_VIEWS` (diagnostics, `340844b`) now logs the first sixteen dwords of every constant or placed buffer view a *traced* pipeline binds, at submission time, from the copy the GPU will read. First run with `VICTORY_TRACE_SHADERS=caa78b8ca62bc3d6` and `VICTORY_DUMP_VIEWS=1`: **zero lines**. The shader therefore does not read its data through a descriptor table - it reads root views or user data (its recorded notes say `u16=0x95c0`, a user-data heap slot, not a table entry), so the dump has to be extended to those two paths before it can say anything. That is the whole of this step, and it is worth writing down as such: two instruments (per-command attribution, view dump) now work on the paths they cover, the 6 s is attributed to one shader with three nested loops, and what remains is to reach the *values* through the root-view/user-data path - a smaller job than the table dump was, because those bindings are already resolved in `bind` as `Root::View(address)` and `user_value`. Branch `fix/prologue` at `340844b`; `cargo test --release --workspace` 30 suites, 0 failures; clippy `-D warnings` clean with diagnostics. Still unmet and unchanged: no mission reached, no shipped fps or loading gain; the prologue runs only with the loop cap (diagnostic, wrong picture), frames are 2.2-3.4 s with 1.2-10.4 GB of copies, and the world frame's GPU is `caa78b8ca62bc3d6` plus `6697dff15287e544` (~0.5 s a call).
Author
Owner

@⁠pes7 on GitHub · 2026-11-26 06:48 UTC · original

Progress log, part 21 - the values exist and are sane, and they say the table is title memory, not a view.

VICTORY_DUMP_VIEWS now covers the traced pipeline's user data and root views as well (4bd6cb4). For caa78b8ca62bc3d6 in a loading run:

traced user data [compute caa78b8ca62bc3d6] user_data=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 18816, 4294966592, 768, 0, ...]
traced user data [compute caa78b8ca62bc3d6] user_data=[... 27520, 4294966208, 1024, 0, ...]
traced user data [compute caa78b8ca62bc3d6] user_data=[...  2688, 4294967232,  256, 0, ...]
traced user data [compute caa78b8ca62bc3d6] user_data=[... 47104, 4294965312, 1536, 0, ...]

6 005 lines, and the values are small and structured: the three non-zero dwords are 18816, 0xFFFFF800 (-2048), 768, then 27520, 0xFFFFF900 (-1792), 1024, 2688, 0xFFFFFF00 (-256), 256 - an offset, a negative offset and a size, exactly what a search over a table looks like. Not garbage.

And the other two paths print nothing: no descriptor-table views and no root views for this shader. So its data comes from title memory through the page table (t0 in MEMORY_SPACE), which is the one path the dump still does not cover and the one whose freshness is the question: memory::withholding withholds ranges when a list using title memory misses, and a search over withheld (zero) memory cannot find its key, which is precisely a loop to the 2^20 cap.

So the next measurement is already in the code, one log line away: memory's counters (withheld_bytes, missed_pages, missed_regions, first_missed, SUBMISSION_MISSED) for the same loading frames - if pages are withheld during the frame that runs caa78b8ca62bc3d6, the fix is in the refresh/withhold path and not in the translation.

Branch fix/prologue at 4bd6cb4; cargo test --release --workspace 30 suites, 0 failures; clippy -D warnings clean with diagnostics.

**@⁠pes7** on GitHub · 2026-11-26 06:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7184805539) Progress log, part 21 - the values exist and are sane, and they say the table is title memory, not a view. `VICTORY_DUMP_VIEWS` now covers the traced pipeline's user data and root views as well (`4bd6cb4`). For `caa78b8ca62bc3d6` in a loading run: ``` traced user data [compute caa78b8ca62bc3d6] user_data=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 18816, 4294966592, 768, 0, ...] traced user data [compute caa78b8ca62bc3d6] user_data=[... 27520, 4294966208, 1024, 0, ...] traced user data [compute caa78b8ca62bc3d6] user_data=[... 2688, 4294967232, 256, 0, ...] traced user data [compute caa78b8ca62bc3d6] user_data=[... 47104, 4294965312, 1536, 0, ...] ``` 6 005 lines, and the values are **small and structured**: the three non-zero dwords are `18816, 0xFFFFF800 (-2048), 768`, then `27520, 0xFFFFF900 (-1792), 1024`, `2688, 0xFFFFFF00 (-256), 256` - an offset, a negative offset and a size, exactly what a search over a table looks like. Not garbage. And the other two paths print **nothing**: no descriptor-table views and no root views for this shader. So its data comes from **title memory through the page table** (`t0` in `MEMORY_SPACE`), which is the one path the dump still does not cover and the one whose freshness is the question: `memory::withholding` withholds ranges when a list using title memory *misses*, and a search over withheld (zero) memory cannot find its key, which is precisely a loop to the 2^20 cap. So the next measurement is already in the code, one log line away: `memory`'s counters (`withheld_bytes`, `missed_pages`, `missed_regions`, `first_missed`, `SUBMISSION_MISSED`) for the same loading frames - if pages are withheld during the frame that runs `caa78b8ca62bc3d6`, the fix is in the refresh/withhold path and not in the translation. Branch `fix/prologue` at `4bd6cb4`; `cargo test --release --workspace` 30 suites, 0 failures; clippy `-D warnings` clean with diagnostics.
Author
Owner

@⁠pes7 on GitHub · 2026-11-26 06:58 UTC · original

Progress log, part 22 - the loops are fed by missing title memory, and the memory table is why.

memory already logged the answer; one run of the loading scenario, no code change:

title memory this frame: 0 draws/dispatches (), 1 page tables, 0 pages copied back,
18447 withheld and 1098.1 MB of views kept (their list read memory with no copy),
missed 120539 pages and 23 256 MiB regions with no copy (first: 0x7c0000000 ...)

120 539 pages and 23 whole 256 MiB regions with no copy, plus 18 447 withheld ranges and 1 098 MB of views kept. A shader that searches a table in that memory reads zeros, never finds its key, and runs its loop to the 2^20 cap - which is caa78b8ca62bc3d6 and its 5 s.

The cause is a constant: memory::CAPACITY is 512 level-2 blocks, i.e. 512 distinct 256 MiB regions a page table can name, with the comment "the world's ~4 100 copies use a few dozen". This title's 3 444 copies span more than 1 030 such regions (the first missed ones are consecutive: 0x850000000 0x860000000 0x870000000 0x880000000), so every region past the cap reads as absent.

Measured with the cap raised to 1024 (one constant, everything else unchanged):

before: dispatch 1x1x1  [compute caa78b8ca62bc3d6]  6012.2 ms
after:  dispatch 11x1x1 [compute caa78b8ca62bc3d6]  1012.9 ms      (6x faster)
        missed ... 29-30 regions with no copy       (still short of the span)

So the chain is complete and measured end to end: missing regions -> zeros -> search to the cap -> 5-6 s single dispatch -> TDR. It is not a mistranslation: the same shader with its memory reachable is six times faster, and the loop bound is the only thing the 1024 cap was hiding.

Reverted to CAPACITY = 512 for now, because raising it costs (CAPACITY + 1) * 32 KiB of page table per list (16 MB -> 32 MB with 1024, and this title needs more than 1030) and that is a memory decision, not a one-line one. The change that would fit: allocate the level-2 blocks per submission for the regions the submission's own views reach (most of the 1 030 are unused in any given submission), instead of a fixed table of 512.

Branch fix/prologue at 4bd6cb4, clean; cargo test --release --workspace 30 suites, 0 failures.

**@⁠pes7** on GitHub · 2026-11-26 06:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7184964761) Progress log, part 22 - the loops are fed by **missing** title memory, and the memory table is why. `memory` already logged the answer; one run of the loading scenario, no code change: ``` title memory this frame: 0 draws/dispatches (), 1 page tables, 0 pages copied back, 18447 withheld and 1098.1 MB of views kept (their list read memory with no copy), missed 120539 pages and 23 256 MiB regions with no copy (first: 0x7c0000000 ...) ``` **120 539 pages and 23 whole 256 MiB regions with no copy**, plus 18 447 withheld ranges and 1 098 MB of views kept. A shader that searches a table in that memory reads zeros, never finds its key, and runs its loop to the 2^20 cap - which is `caa78b8ca62bc3d6` and its 5 s. The cause is a constant: `memory::CAPACITY` is 512 level-2 blocks, i.e. **512 distinct 256 MiB regions a page table can name**, with the comment "the world's ~4 100 copies use a few dozen". This title's 3 444 copies span **more than 1 030** such regions (the first missed ones are consecutive: `0x850000000 0x860000000 0x870000000 0x880000000`), so every region past the cap reads as absent. Measured with the cap raised to 1024 (one constant, everything else unchanged): ``` before: dispatch 1x1x1 [compute caa78b8ca62bc3d6] 6012.2 ms after: dispatch 11x1x1 [compute caa78b8ca62bc3d6] 1012.9 ms (6x faster) missed ... 29-30 regions with no copy (still short of the span) ``` So the chain is complete and measured end to end: missing regions -> zeros -> search to the cap -> 5-6 s single dispatch -> TDR. It is **not** a mistranslation: the same shader with its memory reachable is six times faster, and the loop bound is the only thing the 1024 cap was hiding. Reverted to `CAPACITY = 512` for now, because raising it costs `(CAPACITY + 1) * 32 KiB` of page table **per list** (16 MB -> 32 MB with 1024, and this title needs more than 1030) and that is a memory decision, not a one-line one. The change that would fit: allocate the level-2 blocks per submission for the regions the submission's own views reach (most of the 1 030 are unused in any given submission), instead of a fixed table of 512. Branch `fix/prologue` at `4bd6cb4`, clean; `cargo test --release --workspace` 30 suites, 0 failures.
Author
Owner

@⁠pes7 on GitHub · 2026-11-26 07:11 UTC · original

Progress log, part 23 - the first shipped fix that removes the TDR: the page table now names 2 048 regions instead of 512.

The chain from part 22, measured end to end, and the fix is one constant:

CAPACITY 512 CAPACITY 2048
caa78b8ca62bc3d6 (dispatch 1x1x1, 64 threads, three nested loops) 6 012.2 ms below the report's threshold
loading run, no VICTORY_SKIP_PIPELINES, default loop limit device removed (DXGI_ERROR_DEVICE_HUNG) 120 world frames, 0 removals, full 420 s window
frames - 1.8-2.6 s: GPU 1.2-1.7 s, copies 137-240 ms / 1.4-2.0 GB
missed ... 256 MiB regions with no copy 23 (120 539 pages) 6-19

Why: the title's 3 444 host copies span more than 1 030 distinct 256 MiB regions, and a list's page table had room for 512 ("the world's ~4 100 copies use a few dozen" - true of the world, not of this title). Every region past the cap reads as absent, so a shader searching a table there reads zeros, never matches its key and runs its loop to the 2^20 cap - the 5-6 s singleton dispatch and the TDR.

Until now the prologue ran only with two dispatches skipped or with VICTORY_SHADER_LOOP_LIMIT=1024, both diagnostics with a wrong picture. With the capacity raised it runs on an unmodified build: no skips, default loop limit.

Cost, stated: a table is (CAPACITY + 1) * 32 KiB beside the level-1 entries - 67 MB instead of 17 MB - and the run keeps one or two. Raising it further only covers the remaining 6-19 regions and grows linearly, so the next change there is per-submission level-2 blocks for the regions a submission's views reach, not a bigger constant.

Verification: corpus A/B unchanged as expected (the translator is untouched) - 25 889 per-program outcome lines, 0 differences, 47 s; cargo test --release --workspace 30 suites, 0 failures; clippy -D warnings clean with and without diagnostics; commit 1e53e91 on fix/prologue.

What this does not do: the world frame is still 1.2-1.7 s on the GPU with 1.4-2.0 GB of copies a frame, and no mission has been shown yet - the next runs go further in the prologue and the next target is the remaining GPU cost (6697dff15287e544, ~0.6 s a call) and the copy volume.

**@⁠pes7** on GitHub · 2026-11-26 07:11 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7185182910) Progress log, part 23 - **the first shipped fix that removes the TDR**: the page table now names 2 048 regions instead of 512. The chain from part 22, measured end to end, and the fix is one constant: | | CAPACITY 512 | CAPACITY 2048 | |---|---|---| | `caa78b8ca62bc3d6` (dispatch 1x1x1, 64 threads, three nested loops) | **6 012.2 ms** | below the report's threshold | | loading run, **no `VICTORY_SKIP_PIPELINES`**, **default loop limit** | device removed (DXGI_ERROR_DEVICE_HUNG) | **120 world frames, 0 removals, full 420 s window** | | frames | - | 1.8-2.6 s: GPU 1.2-1.7 s, copies 137-240 ms / 1.4-2.0 GB | | `missed ... 256 MiB regions with no copy` | 23 (120 539 pages) | 6-19 | Why: the title's 3 444 host copies span **more than 1 030** distinct 256 MiB regions, and a list's page table had room for 512 ("the world's ~4 100 copies use a few dozen" - true of the world, not of this title). Every region past the cap reads as absent, so a shader searching a table there reads zeros, never matches its key and runs its loop to the 2^20 cap - the 5-6 s singleton dispatch and the TDR. Until now the prologue ran only with two dispatches skipped or with `VICTORY_SHADER_LOOP_LIMIT=1024`, both diagnostics with a wrong picture. With the capacity raised it runs on an unmodified build: no skips, default loop limit. Cost, stated: a table is `(CAPACITY + 1) * 32 KiB` beside the level-1 entries - 67 MB instead of 17 MB - and the run keeps one or two. Raising it further only covers the remaining 6-19 regions and grows linearly, so the next change there is per-submission level-2 blocks for the regions a submission's views reach, not a bigger constant. Verification: corpus A/B unchanged as expected (the translator is untouched) - 25 889 per-program outcome lines, **0 differences**, 47 s; `cargo test --release --workspace` **30 suites, 0 failures**; clippy `-D warnings` clean with and without diagnostics; commit `1e53e91` on `fix/prologue`. What this does **not** do: the world frame is still 1.2-1.7 s on the GPU with 1.4-2.0 GB of copies a frame, and no mission has been shown yet - the next runs go further in the prologue and the next target is the remaining GPU cost (`6697dff15287e544`, ~0.6 s a call) and the copy volume.
Author
Owner

@⁠pes7 on GitHub · 2026-11-26 07:26 UTC · original

Progress log, part 24 - with the capacity fix the prologue plays on an unmodified build, renders correctly, and gets to its opening scene.

Same binary as 1e53e91 (CAPACITY 2048, diagnostics), no VICTORY_SKIP_PIPELINES, no loop-limit override, 620 s window with the account screen and menu pressed through and W held now and then in the scene:

238 world frames, 0 device removals, the whole 620 s window
frames 1.8-3.0 s: GPU 1.8-2.7 s, copies 0.5-2.0 GB / 70-160 ms

Two screenshots from that run (O:\tmp\victory-work\run\play_353.png, play_555.png):

  • at 353 s: the city at dusk from a distance - skyline, lights, clouds, palm trees - 1 798 ms a frame;
  • at 555 s: a character close-up on a grassy cliff with the ocean behind, 1 433 draws a frame, 1 648 ms.

So the picture is correct, not the compressed garbage of the loop-limit diagnostic, and the title is in the prologue's own scene rather than stuck in loading. That is the first time any of this session's runs has got there without a skip switch or a loop cap.

What is left is fps, and it is now the only thing in the way: 1 400-4 400 draws at 1.8-3.0 s a frame. The per-command report says where: 6697dff15287e544 (indirect dispatch, ~0.5-0.6 s a call, several a frame) plus the drain between submissions; the CPU side is 0.5-2.0 GB of title-memory copies a frame (70-160 ms) and 3 000-44 000 heap slots a frame. Both are measurable with what is in the branch now.

Branch fix/prologue at 1e53e91 (the capacity fix is the latest commit); corpus A/B and 30 workspace suites were verified on it in part 23.

**@⁠pes7** on GitHub · 2026-11-26 07:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7185461386) Progress log, part 24 - with the capacity fix the prologue plays **on an unmodified build**, renders correctly, and gets to its opening scene. Same binary as `1e53e91` (CAPACITY 2048, diagnostics), **no `VICTORY_SKIP_PIPELINES`, no loop-limit override**, 620 s window with the account screen and menu pressed through and `W` held now and then in the scene: ``` 238 world frames, 0 device removals, the whole 620 s window frames 1.8-3.0 s: GPU 1.8-2.7 s, copies 0.5-2.0 GB / 70-160 ms ``` Two screenshots from that run (`O:\tmp\victory-work\run\play_353.png`, `play_555.png`): - at 353 s: the city at dusk from a distance - skyline, lights, clouds, palm trees - 1 798 ms a frame; - at 555 s: a character close-up on a grassy cliff with the ocean behind, 1 433 draws a frame, 1 648 ms. So the picture is **correct**, not the compressed garbage of the loop-limit diagnostic, and the title is in the prologue's own scene rather than stuck in loading. That is the first time any of this session's runs has got there without a skip switch or a loop cap. What is left is fps, and it is now the only thing in the way: 1 400-4 400 draws at 1.8-3.0 s a frame. The per-command report says where: `6697dff15287e544` (indirect dispatch, ~0.5-0.6 s a call, several a frame) plus the drain between submissions; the CPU side is 0.5-2.0 GB of title-memory copies a frame (70-160 ms) and 3 000-44 000 heap slots a frame. Both are measurable with what is in the branch now. Branch `fix/prologue` at `1e53e91` (the capacity fix is the latest commit); corpus A/B and 30 workspace suites were verified on it in part 23.
Author
Owner

@⁠pes7 on GitHub · 2026-11-26 07:36 UTC · original

Progress log, part 25 - 6697dff15287e544 is a different animal, and a caveat on part 23's claim.

The shader. Dumped and disassembled: NumThreads=(8,4,1), 29 112 IR lines (193 KB of DXIL), seven loops each with a icmp ult i32 %counter, 1048576 exit, and 23 atomics, no barriers. That is a heavy data-parallel pass (the atomics alone suggest work distribution), an order of magnitude bigger than the 5 s one, and its ~0.5-0.6 s per indirect call may simply be real work that the memory table no longer breaks. Nothing in it looks like the "search a table that is not there" shape of caa78b8ca62bc3d6; the exits are counters with the cap behind them, not loaded != key.

A caveat I owe the record. With CAPACITY = 4096 the same play scenario showed caa78b8ca62bc3d6 at 4 180 ms again, which reads like 4 096 being worse than 2 048. It cannot be, in data terms: write_table sorts copies by size and assigns level-2 blocks as regions are first touched, so a larger cap names a superset of the regions a smaller one does. The 4 180 ms is therefore either the drain attribution the report is known to include (the DROPPED dispatch ... 6 301 ms line in the same run is a 6 s "command" that records no GPU work) or run-to-run variation - not a regression. What that means for part 23 is stated plainly: the capacity change names more of the title's memory, the play run with it reached 238 frames and the prologue's own scene, but a single run cannot prove it removed the TDR, and one run at 4 096 muddies the picture rather than disproving it. A proper claim needs interleaved runs of the same scenario, which is the next measurement rather than another one-shot.

CAPACITY is back at 2 048 in the tree (the value the play run used); the 4 096 experiment is not kept.

What is still true and measured: the loading no longer needs skips or a loop cap to reach the prologue's scene (screenshots at 353 s and 555 s), caa78b8ca62bc3d6 costs 5-6 s only when its memory is missing (1024 regions named: 6 s; 2048: below the report's threshold), and 6-22 regions remain unnamed at 2 048.

Branch fix/prologue at 1e53e91, tree clean, 231 tests in victory-gpu pass.

**@⁠pes7** on GitHub · 2026-11-26 07:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7185641481) Progress log, part 25 - `6697dff15287e544` is a different animal, and a caveat on part 23's claim. **The shader.** Dumped and disassembled: `NumThreads=(8,4,1)`, **29 112 IR lines** (193 KB of DXIL), **seven** loops each with a `icmp ult i32 %counter, 1048576` exit, and **23 atomics**, no barriers. That is a heavy data-parallel pass (the atomics alone suggest work distribution), an order of magnitude bigger than the 5 s one, and its ~0.5-0.6 s per indirect call may simply be real work that the memory table no longer breaks. Nothing in it looks like the "search a table that is not there" shape of `caa78b8ca62bc3d6`; the exits are counters with the cap behind them, not `loaded != key`. **A caveat I owe the record.** With `CAPACITY = 4096` the same play scenario showed `caa78b8ca62bc3d6` at 4 180 ms again, which reads like 4 096 being worse than 2 048. It cannot be, in data terms: `write_table` sorts copies by size and assigns level-2 blocks as regions are first touched, so a larger cap names a **superset** of the regions a smaller one does. The 4 180 ms is therefore either the drain attribution the report is known to include (the `DROPPED dispatch ... 6 301 ms` line in the same run is a 6 s "command" that records no GPU work) or run-to-run variation - not a regression. What that means for part 23 is stated plainly: the capacity change names more of the title's memory, the play run with it reached 238 frames and the prologue's own scene, but a single run cannot *prove* it removed the TDR, and one run at 4 096 muddies the picture rather than disproving it. A proper claim needs interleaved runs of the same scenario, which is the next measurement rather than another one-shot. `CAPACITY` is back at 2 048 in the tree (the value the play run used); the 4 096 experiment is not kept. **What is still true and measured:** the loading no longer needs skips or a loop cap to reach the prologue's scene (screenshots at 353 s and 555 s), `caa78b8ca62bc3d6` costs 5-6 s only when its memory is missing (1024 regions named: 6 s; 2048: below the report's threshold), and 6-22 regions remain unnamed at 2 048. Branch `fix/prologue` at `1e53e91`, tree clean, 231 tests in `victory-gpu` pass.
Author
Owner

@⁠pes7 on GitHub · 2026-11-26 08:16 UTC · original

Progress log, part 26 - part 23's fix is withdrawn: the interleaved A/B does not support it, and the mechanism it named never happens.

Part 23 credited memory::CAPACITY 512 -> 2048 with removing the loading's TDR. I could not reproduce that, so the change is reverted (652cd44) and the numbers are below, as measured.

Interleaved A/B, same scenario (account screen and menu pressed through, no skip switches, default loop limit, warm cache), 2 runs per build, both tools from the same source otherwise:

run CAPACITY world frames removals median ms/frame median GPU ms median draws
ab512_1 512 17 0 3 387 2 553 3 167
ab2048_1 2048 22 0 3 091 2 639 5 329
ab2048_2 2048 19 0 3 444 3 089 3 959
ab512_2 512 21 0 3 799 3 322 3 404

Each build wins one pair, and the scenes differ (3 167-5 329 draws), so the difference is inside run-to-run noise. No run of either build lost its device, so the removals the change was credited with do not reproduce at 512 either.

The claimed mechanism does not exist in these runs. write_table prints one warning when copies need more 256 MiB regions than the table has blocks ("...more 256 MiB regions than a page table has room for"). It fires zero times at CAPACITY 512, in every run of both builds: the table was never full. And a build whose table can name every level-1 entry (CAPACITY = LEVEL1 - 1, 134 MB of table per heap) still reports the same 34 missed regions and 96 310 missed pages - unchanged - so "missed" means pages the title reads that have no host copy at all, not regions the table had no room for. That build also fails one of the table's unit tests, so it was not kept either.

What that leaves: the 5-6 s dispatch (caa78b8ca62bc3d6) and the loading TDR come and go with the scene and the data, not with the table's capacity; part 23's two observations were one-shot runs of a variable thing, and the honest reading is that the cause is still open.

The diagnostics that made this checkable stay in the branch (VICTORY_GPU_STAMPS per-list attribution, VICTORY_DUMP_SHADER, VICTORY_DUMP_ARGUMENTS, VICTORY_DUMP_VIEWS), as does the 16-bit-format fix. Branch fix/prologue at 652cd44; cargo test --release --workspace 30 suites, 0 failures; both build configurations clean.

**@⁠pes7** on GitHub · 2026-11-26 08:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7186387365) Progress log, part 26 - **part 23's fix is withdrawn**: the interleaved A/B does not support it, and the mechanism it named never happens. Part 23 credited `memory::CAPACITY` 512 -> 2048 with removing the loading's TDR. I could not reproduce that, so the change is reverted (`652cd44`) and the numbers are below, as measured. **Interleaved A/B**, same scenario (account screen and menu pressed through, no skip switches, default loop limit, warm cache), 2 runs per build, both tools from the same source otherwise: | run | CAPACITY | world frames | removals | median ms/frame | median GPU ms | median draws | |---|---|---|---|---|---|---| | ab512_1 | 512 | 17 | 0 | 3 387 | 2 553 | 3 167 | | ab2048_1 | 2048 | 22 | 0 | 3 091 | 2 639 | 5 329 | | ab2048_2 | 2048 | 19 | 0 | 3 444 | 3 089 | 3 959 | | ab512_2 | 512 | 21 | 0 | 3 799 | 3 322 | 3 404 | Each build wins one pair, and the scenes differ (3 167-5 329 draws), so the difference is inside run-to-run noise. **No run of either build lost its device**, so the removals the change was credited with do not reproduce at 512 either. **The claimed mechanism does not exist in these runs.** `write_table` prints one warning when copies need more 256 MiB regions than the table has blocks (`"...more 256 MiB regions than a page table has room for"`). It fires **zero times at CAPACITY 512**, in every run of both builds: the table was never full. And a build whose table can name *every* level-1 entry (`CAPACITY = LEVEL1 - 1`, 134 MB of table per heap) still reports the same 34 missed regions and 96 310 missed pages - unchanged - so "missed" means **pages the title reads that have no host copy at all**, not regions the table had no room for. That build also fails one of the table's unit tests, so it was not kept either. What that leaves: the 5-6 s dispatch (`caa78b8ca62bc3d6`) and the loading TDR come and go with the *scene and the data*, not with the table's capacity; part 23's two observations were one-shot runs of a variable thing, and the honest reading is that the cause is still open. The diagnostics that made this checkable stay in the branch (`VICTORY_GPU_STAMPS` per-list attribution, `VICTORY_DUMP_SHADER`, `VICTORY_DUMP_ARGUMENTS`, `VICTORY_DUMP_VIEWS`), as does the 16-bit-format fix. Branch `fix/prologue` at `652cd44`; `cargo test --release --workspace` 30 suites, 0 failures; both build configurations clean.
Author
Owner

@⁠pes7 on GitHub · 2026-11-26 08:32 UTC · original

Progress log, part 27 - the prologue now plays its own scripted scenes, and the frame cost is not the loops.

What the run shows. play2 (diagnostics build, no skip switches, default loop limit, no stamps): account screen and menu pressed through, then W held in bursts and a step left/right now and then; a screenshot every two minutes.

at what frame
243 s the two leads talking on the rooftop, subtitles on ("И потом спокойно составим план, который не будет звучать как бред") 1 566-1 798 ms, 1 330 draws
368 s the same conversation, other camera 1 566 ms, 1 330 draws
493 s the opening credits over the rooftop ("Out Production - james nicholson, adam smith, jason hayes, roberta gatti") 1 786 ms, 1 994 draws

129 world frames before that, 0 device removals, and the run ended at 566 s not with a GPU fault but with the title's own breakpoint: unhandled exception 0x80000003 at victory-image+0x5149aec (three first-chance ones first, then the fatal), followed by the title's Breakpad reporter writing a minidump. 0x80000003 is int3 - the game's own consistency check, not ours and not the driver. That is the next error class to chase, and it is after the opening credits, i.e. deeper than anything reached before.

So the prologue's content runs: dialogue, cameras, subtitles, credits. Two visible rendering defects remain in those frames (checkerboard patches under the rooftop and in the sky in the credits shot), which is what a broken invariant at the end may be about.

The frame cost is genuine work, not loop burn. Ladder on the same scenario (warm cache for each limit, 420 s window, cold translation excluded):

loop limit world frames removals median ms/frame median GPU ms
default (2^20) 17-22 0 3 091-3 799 2 553-3 322
4 096 28 0 3 433 2 395
65 536 2 (run died at startup) - - -

Capping every translated loop at 4 096 iterations - the switch that took the loading from 15 450 ms to 56-83 ms - leaves the prologue's frames where they were. So the 1.5-3.8 s frames are the title's real compute and draw work (the per-command report puts it in eight compute pipelines of 0.3-0.8 s each a frame), and improving fps means making those cheaper, not shortening loops.

Also in this turn: CAPACITY 512 -> 2048 is reverted (652cd44) - the A/B in part 26 shows the values within noise and the "table full" warning never firing, so the fix part 23 claimed was not one. The diagnostics stay.

cargo test --release --workspace: 30 suites, 0 failures. (Two runs during the session failed one hardware-sensitive test each - a GPU valu test and the low-guard memory test - both pass alone and the workspace is green on a quiet machine, so they are load flakiness on this shared box, not the branch.)

**@⁠pes7** on GitHub · 2026-11-26 08:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7186723559) Progress log, part 27 - the prologue now plays **its own scripted scenes**, and the frame cost is not the loops. **What the run shows.** `play2` (diagnostics build, no skip switches, default loop limit, no stamps): account screen and menu pressed through, then `W` held in bursts and a step left/right now and then; a screenshot every two minutes. | at | what | frame | |---|---|---| | 243 s | the two leads talking on the rooftop, **subtitles on** ("И потом спокойно составим план, который не будет звучать как бред") | 1 566-1 798 ms, 1 330 draws | | 368 s | the same conversation, other camera | 1 566 ms, 1 330 draws | | 493 s | **the opening credits** over the rooftop ("Out Production - james nicholson, adam smith, jason hayes, roberta gatti") | 1 786 ms, 1 994 draws | 129 world frames before that, 0 device removals, and the run ended at 566 s not with a GPU fault but with **the title's own breakpoint**: `unhandled exception 0x80000003 at victory-image+0x5149aec` (three first-chance ones first, then the fatal), followed by the title's Breakpad reporter writing a minidump. `0x80000003` is `int3` - the game's own consistency check, not ours and not the driver. That is the next error class to chase, and it is *after* the opening credits, i.e. deeper than anything reached before. So the prologue's content runs: dialogue, cameras, subtitles, credits. Two visible rendering defects remain in those frames (checkerboard patches under the rooftop and in the sky in the credits shot), which is what a broken invariant at the end may be about. **The frame cost is genuine work, not loop burn.** Ladder on the same scenario (warm cache for each limit, 420 s window, cold translation excluded): | loop limit | world frames | removals | median ms/frame | median GPU ms | |---|---|---|---|---| | default (2^20) | 17-22 | 0 | 3 091-3 799 | 2 553-3 322 | | 4 096 | 28 | 0 | 3 433 | 2 395 | | 65 536 | 2 (run died at startup) | - | - | - | Capping every translated loop at 4 096 iterations - the switch that took the *loading* from 15 450 ms to 56-83 ms - leaves the prologue's frames where they were. So the 1.5-3.8 s frames are the title's real compute and draw work (the per-command report puts it in eight compute pipelines of 0.3-0.8 s each a frame), and improving fps means making those cheaper, not shortening loops. **Also in this turn:** `CAPACITY` 512 -> 2048 is reverted (`652cd44`) - the A/B in part 26 shows the values within noise and the "table full" warning never firing, so the fix part 23 claimed was not one. The diagnostics stay. `cargo test --release --workspace`: 30 suites, 0 failures. (Two runs during the session failed one hardware-sensitive test each - a GPU `valu` test and the low-guard memory test - both pass alone and the workspace is green on a quiet machine, so they are load flakiness on this shared box, not the branch.)
Three prologue compute pipelines read a *root view's* offset while the title
had bound that root as 32-bit constants, and every such draw or dispatch was
dropped:

    dropped 1-2.4/frame without a host pipeline:
      dispatch: a root view's offset: no root view, or outside title buffers
      [compute 35e51bb27a463294], [compute f94e5d8bf4e1cf05], ...

A diagnostics count of the two halves of that reason says which it is: over a
whole run, `no_view` fires and `no_copy` never does - the slot holds
`Root::Constants(...)`, not `Root::View(...)`. The console lets a title pass a
descriptor itself as root constants, and the ones here hold their buffer's
address in dword 0 (`Constants([1915200512, 13, 0, 0, 190980448, 16, 8, ...])`).

`State::root_address` now answers "the title address this root stands for" for
both forms: the view's address, or the first dword of the constants when that
address lies in a host copy (`shadow::find`), and `root_view_at` binds the view
at that address exactly as it did for a view root. When the address is in no
copy the old drop stands, so nothing is invented.

Measured on the prologue scenario (play driver, 560 s window, diagnostics):

    before: 2.4/frame dropped for this reason, run ends on the title's int3
    after:  0 dropped for this reason
    after, with the diagnostic loop cap 1024 (so the unrelated 5-6 s loop
    class does not end the run first): 208 world frames, 0 device removals,
    0 drops, the whole 560 s window, no title exception

The visible checkerboard patches in the credits frame are the shape this
should fix; the fix is not yet shown to remove them (the run above has no
screenshots), which is the next check.
A refusal carries `at 0x14dc`, and until now the offset was all it said: the
program is 12 000 words of native code and the instruction at that offset was
the one thing the message did not have. It has it now, in the same line:

    bvh_skinning:CSComputeSkinningPedBlendShapesVelocity_1c34db0a_Wrapped Cs
      at 0x14dc  [s_cbranch_execz Sopp { imm: 92 }]  emit: a lane mask read as data

That names the prologue's remaining functional hole instead of hinting at it:
four programs of the whole pack (`CSComputeSkinningPedBlendShapes`,
`...SecMotion`, `...Velocity`, `...SecMotionVelocity` - the character skinning
with blend shapes) fail on the same opcode, and the one the prologue binds
(`compute 82a2ad6d07417d36`) is dropped 4 times a frame in the interior scene
that the play run then stands in for four minutes. The other three shader
families that refuse at an offset get the same line for free.
Author
Owner

@⁠pes7 on GitHub · 2026-11-26 09:08 UTC · original

Progress log, part 28 - the dropped dispatches are fixed, and they were a binding form we did not read, not a memory gap.

What the drops were. Three prologue compute pipelines read a root view's offset while the title had bound that root as 32-bit constants:

dropped 1-2.4/frame without a host pipeline:
  dispatch: a root view's offset: no root view, or outside title buffers
  [compute 35e51bb27a463294, compute f94e5d8bf4e1cf05, compute ffd93c8a029ff016, ...]

The diagnostics added for this turn split the reason in two - a slot holding no view, versus a view whose address is in no copy - and over a whole run no_copy never fires while no_view does, with the slot's state printed:

slot=8 root=Some(Constants([1915200512, 13, 0, 0, 190980448, 16, 8, 0, 2, 2, 0, 1, 262148, 0])) no_view=1 no_copy=0
slot=2 root=Some(Constants([1, 512, 4294967295]))                                        no_view=32 no_copy=0

So the title passes the descriptor itself as root constants (the console allows it), and those descriptors hold their buffer's address in dword 0.

The fix (3ebf6ec). State::root_address answers "the address this root stands for" for both forms - the view's address, or the first dword of the constants when that address lies in a host copy - and root_view_at binds the view there exactly as it does for a view root. If the address is in no copy, the old drop stands, so nothing is invented.

Measured, same play scenario, 560 s window:

drops for this reason world frames removals title exception
before 2.4/frame 129 (ends at 566 s) 0 int3 after the credits
after 0 - (two runs ended early on the unrelated 5-6 s loop hang) 2 none reached
after + diagnostic loop cap 1024 0 208 0 none, whole 560 s

The last line is the longest the prologue has run: 208 world frames, no removal, no exception, no dropped dispatch. The loop cap is only there to keep the other known class (a dispatch that runs a translated loop to 2^20 in 5-6 s, which hangs the device) from ending the run first; it is not part of the fix.

Still to show: whether the checkerboard patches in the credits frame go away (that run took no screenshots), and whether the run now gets past the credits without the title's int3. Both need the same scenario with screenshots, which is the next run.

cargo test --release --workspace: 30 suites, 0 failures; clippy -D warnings clean with and without diagnostics; branch fix/prologue at 3ebf6ec.

**@⁠pes7** on GitHub · 2026-11-26 09:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7187494032) Progress log, part 28 - the dropped dispatches are fixed, and they were a **binding form we did not read**, not a memory gap. **What the drops were.** Three prologue compute pipelines read a root view's offset while the title had bound that root as **32-bit constants**: ``` dropped 1-2.4/frame without a host pipeline: dispatch: a root view's offset: no root view, or outside title buffers [compute 35e51bb27a463294, compute f94e5d8bf4e1cf05, compute ffd93c8a029ff016, ...] ``` The diagnostics added for this turn split the reason in two - a slot holding no view, versus a view whose address is in no copy - and over a whole run `no_copy` never fires while `no_view` does, with the slot's state printed: ``` slot=8 root=Some(Constants([1915200512, 13, 0, 0, 190980448, 16, 8, 0, 2, 2, 0, 1, 262148, 0])) no_view=1 no_copy=0 slot=2 root=Some(Constants([1, 512, 4294967295])) no_view=32 no_copy=0 ``` So the title passes the descriptor *itself* as root constants (the console allows it), and those descriptors hold their buffer's address in dword 0. **The fix (`3ebf6ec`).** `State::root_address` answers "the address this root stands for" for both forms - the view's address, or the first dword of the constants **when that address lies in a host copy** - and `root_view_at` binds the view there exactly as it does for a view root. If the address is in no copy, the old drop stands, so nothing is invented. Measured, same play scenario, 560 s window: | | drops for this reason | world frames | removals | title exception | |---|---|---|---|---| | before | 2.4/frame | 129 (ends at 566 s) | 0 | `int3` after the credits | | after | **0** | - (two runs ended early on the unrelated 5-6 s loop hang) | 2 | none reached | | after + diagnostic loop cap 1024 | **0** | **208** | **0** | **none, whole 560 s** | The last line is the longest the prologue has run: 208 world frames, no removal, no exception, no dropped dispatch. The loop cap is only there to keep the *other* known class (a dispatch that runs a translated loop to 2^20 in 5-6 s, which hangs the device) from ending the run first; it is not part of the fix. **Still to show:** whether the checkerboard patches in the credits frame go away (that run took no screenshots), and whether the run now gets past the credits without the title's `int3`. Both need the same scenario with screenshots, which is the next run. `cargo test --release --workspace`: 30 suites, 0 failures; clippy `-D warnings` clean with and without diagnostics; branch `fix/prologue` at `3ebf6ec`.
Author
Owner

@⁠pes7 on GitHub · 2026-11-26 09:37 UTC · original

Progress log, part 29 - with the root-address fix the prologue runs 15 minutes and 343 frames with no removal and no exception, and the picture is a character walking in the world, not a crashed credits sequence.

Same build as part 28 (3ebf6ec), the play driver with screenshots, the diagnostic loop cap 1024 in place only so the unrelated 5-6 s loop class cannot end the run first:

343 world frames, 0 device removals, 0 title exceptions, 0 dropped dispatches
the whole 900 s window

The screenshots tell the story of the sequence, which is well past where the last crash was:

at what frame
243 s a night street with a red car (plate readable), lit windows, palm trees, a street lamp 2 363 ms
493 s looking into the sun over water, bloom and flare 908 ms, 550 draws
743 s the protagonist walking through vegetation at dusk (black top, denim shorts) 2 781 ms, 5 142 draws
868 s a near-white frame, 7 draws - a fade between shots 2 263 ms

Compare part 27's run on the same driver without the fix: 129 frames, ending at 566 s on the title's int3 right after the credits, with 2.4 dropped dispatches a frame and checkerboard patches visible in the credits frame. None of that appears in this run: no drop, no assert, no patch.

What is still in the way of a mission. The hang class. Four of the runs in this turn ended early with DXGI_ERROR_DEVICE_HUNG between 80 and 90 s (7 world frames, 2 removals), two with the fix and two without, and two with a 1024 loop cap - so it is neither caused by the fix nor fully mitigated by the cap (a nested loop is 1024 x 1024 even then). Until that is named and fixed, whether a 15-minute run reaches a mission is a coin flip; the two survivors of this turn (560 s and 900 s) both did not.

cargo test --release --workspace: 30 suites, 0 failures (part 28); branch fix/prologue at 3ebf6ec, PR mergeable and clean.

**@⁠pes7** on GitHub · 2026-11-26 09:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7188240874) Progress log, part 29 - with the root-address fix the prologue runs **15 minutes and 343 frames with no removal and no exception**, and the picture is a character walking in the world, not a crashed credits sequence. Same build as part 28 (`3ebf6ec`), the play driver with screenshots, the diagnostic loop cap 1024 in place only so the unrelated 5-6 s loop class cannot end the run first: ``` 343 world frames, 0 device removals, 0 title exceptions, 0 dropped dispatches the whole 900 s window ``` The screenshots tell the story of the sequence, which is well past where the last crash was: | at | what | frame | |---|---|---| | 243 s | a **night street with a red car** (plate readable), lit windows, palm trees, a street lamp | 2 363 ms | | 493 s | looking into the sun over water, bloom and flare | 908 ms, 550 draws | | 743 s | **the protagonist walking through vegetation at dusk** (black top, denim shorts) | 2 781 ms, **5 142 draws** | | 868 s | a near-white frame, 7 draws - a fade between shots | 2 263 ms | Compare part 27's run on the same driver without the fix: 129 frames, ending at 566 s on the title's `int3` right after the credits, with 2.4 dropped dispatches a frame and checkerboard patches visible in the credits frame. None of that appears in this run: no drop, no assert, no patch. **What is still in the way of a mission.** The hang class. Four of the runs in this turn ended early with `DXGI_ERROR_DEVICE_HUNG` between 80 and 90 s (7 world frames, 2 removals), two with the fix and two without, and two *with* a 1024 loop cap - so it is neither caused by the fix nor fully mitigated by the cap (a nested loop is 1024 x 1024 even then). Until that is named and fixed, whether a 15-minute run reaches a mission is a coin flip; the two survivors of this turn (560 s and 900 s) both did not. `cargo test --release --workspace`: 30 suites, 0 failures (part 28); branch `fix/prologue` at `3ebf6ec`, PR mergeable and clean.
Author
Owner

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

Progress log, part 30 - no diagnostic switch at all: 350 world frames, 15 minutes, no removal, no exception - and the scene then stands still.

Same binary as part 28 (3ebf6ec), the play driver with screenshots, nothing switched on: no VICTORY_SKIP_PIPELINES, no loop cap, no DRED, no stamps.

350 world frames (>800 draws), 0 device removals, 0 title exceptions, the whole 900 s
median 3 179 ms/frame, median GPU 2 941 ms, median 6 176 draws/frame

What the screenshots show, in order:

at what frame
243 s a night street with a red car, lit windows, palm trees 2 363 ms
368 s / 493 s city, then into the sun over water ~900-2 400 ms
618 s an interior: fluorescent ceiling lights, a figure silhouetted against the windows 3 160 ms, 6 522 draws
868 s the same interior, almost the same camera 3 272 ms, 5 984 draws

So the run is stable and deep, but from about 10 minutes it stops advancing: the last 250 s are the same interior shot. That is not a crash and not a hang - it is a scripted scene that does not move on, which is the next thing to look at for "first mission" (a cutscene waiting for an event we do not deliver - audio/subtitle/fade - rather than a rendering failure).

The hang did not reproduce. Three runs with VICTORY_D3D12_DRED=1 (so that note_op records each list's commands, which survive until the list is reset - they are what the removal message appends as ; list N of M, of its K: <command>) all ran their full windows: 87, 92 and 48 world frames, no removal. The report path is in place and costs nothing when nothing fails; it needs a failing run to say anything, and this hour did not have one. The earlier early deaths (7 world frames, ~85 s) were in runs before 3ebf6ec.

Branch fix/prologue at 3ebf6ec, PR mergeable and clean, workspace 30 suites green (part 28).

**@⁠pes7** on GitHub · 2026-11-26 10:13 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7189084562) Progress log, part 30 - **no diagnostic switch at all: 350 world frames, 15 minutes, no removal, no exception** - and the scene then stands still. Same binary as part 28 (`3ebf6ec`), the play driver with screenshots, **nothing switched on**: no `VICTORY_SKIP_PIPELINES`, no loop cap, no DRED, no stamps. ``` 350 world frames (>800 draws), 0 device removals, 0 title exceptions, the whole 900 s median 3 179 ms/frame, median GPU 2 941 ms, median 6 176 draws/frame ``` What the screenshots show, in order: | at | what | frame | |---|---|---| | 243 s | a night street with a red car, lit windows, palm trees | 2 363 ms | | 368 s / 493 s | city, then into the sun over water | ~900-2 400 ms | | 618 s | **an interior**: fluorescent ceiling lights, a figure silhouetted against the windows | 3 160 ms, 6 522 draws | | 868 s | **the same interior, almost the same camera** | 3 272 ms, 5 984 draws | So the run is stable and deep, but from about 10 minutes it stops advancing: the last 250 s are the same interior shot. That is not a crash and not a hang - it is a scripted scene that does not move on, which is the next thing to look at for "first mission" (a cutscene waiting for an event we do not deliver - audio/subtitle/fade - rather than a rendering failure). **The hang did not reproduce.** Three runs with `VICTORY_D3D12_DRED=1` (so that `note_op` records each list's commands, which survive until the list is reset - they are what the removal message appends as `; list N of M, of its K: <command>`) all ran their full windows: 87, 92 and 48 world frames, no removal. The report path is in place and costs nothing when nothing fails; it needs a failing run to say anything, and this hour did not have one. The earlier early deaths (7 world frames, ~85 s) were in runs *before* `3ebf6ec`. Branch `fix/prologue` at `3ebf6ec`, PR mergeable and clean, workspace 30 suites green (part 28).
Author
Owner

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

Progress log, part 31 - the scene that stands still has a cause, and it is a named one: the character skinning shader does not translate.

The stall. In part 30's clean run the last four minutes are the same interior shot. Its frames carry a drop I had not looked at:

dropped 4.0/frame without a host pipeline: compute 82a2ad6d07417d36
WARN victory_gpu::pipeline: shader does not translate;
  stage="compute" hash=82a2ad6d07417d36
  error=GFX10 code at 0x150c: a lane mask read as data

So one compute pass is refused and dropped four times a frame for the whole scene. It is the character skinning with blend shapes.

Naming the instruction. A refusal used to give only an offset; translate --list now prints the opcode there too (049c3f6), and the corpus run says which one:

bvh_skinning:CSComputeSkinningPedBlendShapesVelocity_1c34db0a_Wrapped Cs
  at 0x14dc [s_cbranch_execz Sopp { imm: 92 }]  emit: a lane mask read as data

Four programs in the entire 26 084-program pack fail this way, and they are all the same family: CSComputeSkinningPedBlendShapes, ...SecMotion, ...Velocity, ...SecMotionVelocity. The opcode is s_cbranch_execz - "branch if no lane is active" - which reads the EXEC mask, and the mask's value at that point is the per-lane boolean the emitter keeps in lane_bits rather than a mask dword, so the read comes back as Val::Missing("a lane mask read as data") and the branch refuses. That is a concrete, bounded bug in the emitter's mask handling, not a data or memory problem.

Also measured and rejected this turn: copies in video memory. Same play scenario, only VICTORY_COPIES_IN_VIDEO_MEMORY=1, compared inside the 4 000-8 000 draws band where both runs have frames:

frames removals median ms/frame median GPU ms draws
plain (playclean) 112 0 3 196 2 956 6 238
copies in VRAM 54 0 4 289 2 804 5 917

The GPU term does improve (-5 %: 2 956 -> 2 804), but the CPU side more than eats it: the total goes up 34 %. Not kept.

Where this leaves the objective. The prologue now runs 15 min and 350 frames with no switch, no removal and no exception, and the scene that does not advance does not advance because a skinning pass is missing. Fixing s_cbranch_execz's mask read is the next step and the first one that should move the content forward rather than the frame time.

cargo test --release --workspace: 30 suites, 0 failures; clippy -D warnings clean; branch fix/prologue at 049c3f6.

**@⁠pes7** on GitHub · 2026-11-26 10:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7189423909) Progress log, part 31 - the scene that stands still has a cause, and it is a **named** one: the character skinning shader does not translate. **The stall.** In part 30's clean run the last four minutes are the same interior shot. Its frames carry a drop I had not looked at: ``` dropped 4.0/frame without a host pipeline: compute 82a2ad6d07417d36 WARN victory_gpu::pipeline: shader does not translate; stage="compute" hash=82a2ad6d07417d36 error=GFX10 code at 0x150c: a lane mask read as data ``` So one compute pass is refused and dropped **four times a frame** for the whole scene. It is the character skinning with blend shapes. **Naming the instruction.** A refusal used to give only an offset; `translate --list` now prints the opcode there too (`049c3f6`), and the corpus run says which one: ``` bvh_skinning:CSComputeSkinningPedBlendShapesVelocity_1c34db0a_Wrapped Cs at 0x14dc [s_cbranch_execz Sopp { imm: 92 }] emit: a lane mask read as data ``` Four programs in the entire 26 084-program pack fail this way, and they are all the same family: `CSComputeSkinningPedBlendShapes`, `...SecMotion`, `...Velocity`, `...SecMotionVelocity`. The opcode is `s_cbranch_execz` - "branch if no lane is active" - which reads the EXEC mask, and the mask's value at that point is the per-lane boolean the emitter keeps in `lane_bits` rather than a mask dword, so the read comes back as `Val::Missing("a lane mask read as data")` and the branch refuses. That is a concrete, bounded bug in the emitter's mask handling, not a data or memory problem. **Also measured and rejected this turn: copies in video memory.** Same play scenario, only `VICTORY_COPIES_IN_VIDEO_MEMORY=1`, compared inside the 4 000-8 000 draws band where both runs have frames: | | frames | removals | median ms/frame | median GPU ms | draws | |---|---|---|---|---|---| | plain (`playclean`) | 112 | 0 | 3 196 | 2 956 | 6 238 | | copies in VRAM | 54 | 0 | 4 289 | 2 804 | 5 917 | The GPU term does improve (-5 %: 2 956 -> 2 804), but the CPU side more than eats it: the total goes up 34 %. Not kept. **Where this leaves the objective.** The prologue now runs 15 min and 350 frames with no switch, no removal and no exception, and the scene that does not advance does not advance because a skinning pass is missing. Fixing `s_cbranch_execz`'s mask read is the next step and the first one that should move the *content* forward rather than the frame time. `cargo test --release --workspace`: 30 suites, 0 failures; clippy `-D warnings` clean; branch `fix/prologue` at `049c3f6`.
Author
Owner

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

Progress log, part 32 - the mask fix was attempted four ways, measured each time, and not kept: the corpus does not move.

The target was compute 82a2ad6d07417d36 (character skinning, dropped 4/frame in the interior scene), refused at s_cbranch_execz with "a lane mask read as data". Four attempts, each built and run over the whole pack (victory translate --list, 26 084 programs, ~50 s):

attempt what it changed corpus
1 get falls back to the emitter's own bit (lane_bits) when a mask is missing 5 refusals, DXIL 14 246 - no change
2 s_cbranch_execz/execnz may read a mask as data (in inst()) 5 refusals, DXIL 14 246 - no change
3 mask_ok is forced true for a block's branch in exit() 5 refusals, DXIL 14 246 - no change
4 64-bit scalar logical ops and v_readlane_b32 may read masks as data 5 refusals, DXIL 14 246 - no change

What the probes found, and why none of them hit:

  • a probe inside get (printing the instruction being lowered) fires zero times at s_cbranch_execz - so the branch's mask is not read through get;
  • the same probe fires 978 times at v_readlane_b32, 6 at s_xor_b64, 4 each at v_cmpx_gt_u32 and v_cndmask_b32, all of which are caught (the translation continues), so none of them is the fatal one;
  • a probe at the branch's own condition (exit()'s atom(..) -> map_err) also fires zero times - so the fatal LANE_MASK comes from somewhere that is neither get nor the branch's atom: mask_dword/i32_of, or the structuring pass that hands the branch its condition.

That is the precise next step, and it is one instrumented run away: put the probe in mask_dword, i32_of (and mask_number) rather than in get, and print the IR block/instruction that asked. Four attempts that each left the corpus bit-identical is the evidence that guessing at the gate is not the way in.

Everything reverted (git status clean at 1e49107); cargo test --release --workspace: 30 suites, 0 failures. The branch keeps the two things that are measured: the root-address fix (drops 2.4/frame -> 0, 3ebf6ec) and the CLI naming the refusing opcode (049c3f6, 1e49107).

**@⁠pes7** on GitHub · 2026-11-26 10:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7189937305) Progress log, part 32 - the mask fix was attempted four ways, measured each time, and **not kept**: the corpus does not move. The target was `compute 82a2ad6d07417d36` (character skinning, dropped 4/frame in the interior scene), refused at `s_cbranch_execz` with "a lane mask read as data". Four attempts, each built and run over the whole pack (`victory translate --list`, 26 084 programs, ~50 s): | attempt | what it changed | corpus | |---|---|---| | 1 | `get` falls back to the emitter's own bit (`lane_bits`) when a mask is missing | 5 refusals, DXIL 14 246 - **no change** | | 2 | `s_cbranch_execz`/`execnz` may read a mask as data (in `inst()`) | 5 refusals, DXIL 14 246 - no change | | 3 | `mask_ok` is forced true for a block's branch in `exit()` | 5 refusals, DXIL 14 246 - no change | | 4 | 64-bit scalar logical ops and `v_readlane_b32` may read masks as data | 5 refusals, DXIL 14 246 - no change | What the probes found, and why none of them hit: - a probe inside `get` (printing the instruction being lowered) fires **zero times at `s_cbranch_execz`** - so the branch's mask is not read through `get`; - the same probe fires 978 times at `v_readlane_b32`, 6 at `s_xor_b64`, 4 each at `v_cmpx_gt_u32` and `v_cndmask_b32`, all of which are **caught** (the translation continues), so none of them is the fatal one; - a probe at the branch's own condition (`exit()`'s `atom(..)` -> `map_err`) also fires **zero times** - so the fatal `LANE_MASK` comes from somewhere that is neither `get` nor the branch's atom: `mask_dword`/`i32_of`, or the structuring pass that hands the branch its condition. That is the precise next step, and it is one instrumented run away: put the probe in `mask_dword`, `i32_of` (and `mask_number`) rather than in `get`, and print the IR block/instruction that asked. Four attempts that each left the corpus bit-identical is the evidence that guessing at the gate is not the way in. Everything reverted (`git status` clean at `1e49107`); `cargo test --release --workspace`: 30 suites, 0 failures. The branch keeps the two things that are measured: the root-address fix (drops 2.4/frame -> 0, `3ebf6ec`) and the CLI naming the refusing opcode (`049c3f6`, `1e49107`).
Author
Owner

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

Addendum to part 32 - the refusal site is now pin-pointed, which is what the next attempt needs.

Two more probes (both reverted; the corpus is unchanged and the branch is clean at 1e49107):

  • mask_dword's "not a structural mask" path: 0 hits in the whole pack - the fatal mask never reaches it;
  • i32_of's missing-value path: 32 169 hits, all caught (translation continues);
  • the branch's own boolean(when, ..) in exit(), i.e. the _ arm of the branch-condition match: 5 hits, all fatal, and mask_ok is true there:
PROBE exit boolean: when Bool(22261) why "a lane mask read as data" mask_ok=true
PROBE exit boolean: when Bool(25212) why "a lane mask read as data" mask_ok=true
PROBE exit boolean: when Bool(25509) why "a lane mask read as data" mask_ok=true
PROBE exit boolean: when Bool(29239) why "a lane mask read as data" mask_ok=true

Four of those are the four CSComputeSkinningPedBlendShapes* programs; the fifth is Bool(2) ... "a descriptor read only as data", a different, already-known refusal. So the fatal path is: the branch's condition is a compound boolean (Bool(n), a node of the boolean tree) whose evaluation reaches a mask atom that cannot be read - not the atom-only fast path the branch takes when the condition is (atom, TRUE, FALSE).

For the next attempt that means: the fix belongs inside boolean()/atom() (in structure's boolean tree), not in get, mask_dword or inst. With mask_ok already true there, the atom must be a mask the emitter has neither in x.st.masks nor a bit for in lane_bits - which is the case a probe inside atom() can print in one run.

Everything else stays as it was: corpus 5 refusals / 14 246 DXIL before and after every attempt, cargo test --release --workspace 30 suites green, victory-shader 302 tests green, branch fix/prologue at 1e49107, CI green.

**@⁠pes7** on GitHub · 2026-11-26 10:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7190076735) Addendum to part 32 - the refusal site is now pin-pointed, which is what the next attempt needs. Two more probes (both reverted; the corpus is unchanged and the branch is clean at `1e49107`): - `mask_dword`'s "not a structural mask" path: **0 hits** in the whole pack - the fatal mask never reaches it; - `i32_of`'s missing-value path: 32 169 hits, all **caught** (translation continues); - the branch's own `boolean(when, ..)` in `exit()`, i.e. the `_` arm of the branch-condition match: **5 hits, all fatal**, and `mask_ok` is `true` there: ``` PROBE exit boolean: when Bool(22261) why "a lane mask read as data" mask_ok=true PROBE exit boolean: when Bool(25212) why "a lane mask read as data" mask_ok=true PROBE exit boolean: when Bool(25509) why "a lane mask read as data" mask_ok=true PROBE exit boolean: when Bool(29239) why "a lane mask read as data" mask_ok=true ``` Four of those are the four `CSComputeSkinningPedBlendShapes*` programs; the fifth is `Bool(2) ... "a descriptor read only as data"`, a different, already-known refusal. So the fatal path is: the branch's condition is a **compound boolean** (`Bool(n)`, a node of the boolean tree) whose evaluation reaches a mask atom that cannot be read - not the `atom`-only fast path the branch takes when the condition is `(atom, TRUE, FALSE)`. For the next attempt that means: the fix belongs inside `boolean()`/`atom()` (in `structure`'s boolean tree), not in `get`, `mask_dword` or `inst`. With `mask_ok` already true there, the atom must be a mask the emitter has neither in `x.st.masks` nor a bit for in `lane_bits` - which is the case a probe inside `atom()` can print in one run. Everything else stays as it was: corpus 5 refusals / 14 246 DXIL before and after every attempt, `cargo test --release --workspace` 30 suites green, `victory-shader` 302 tests green, branch `fix/prologue` at `1e49107`, CI green.
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-26 11:02 UTC · original

@⁠pes7 I reproduced the compound exit/boolean refusal from your part 32 addendum with a synthetic compute shader on 1e49107. I put an opt-in producer trace on that exact head, following ThomasSAMP’s producer-tracing work in #1425.

In my fixture, s_and_saveexec_b32 produces an SCC that feeds a scalar select and then a vector compare. The branch reports:

lane-mask trace: Cs s_cbranch_execz at 0x28 [exit/boolean] from s_and_saveexec_b32 at 0x18; numeric helpers ["i32_of"]; leaf Lane(Value(17)) defined by v_cmp_gt_u32 at 0x20, structural mask=true, lane bit=false

The compare is where the leaf lost its bit. The missing input came from the earlier save-EXEC instruction. Your shader may reach a different producer. On the unmodified head, ordinary compare → save EXEC → branch → restore controls with 0, 8, and 32 active lanes matched 96/96 lanes per adapter on RTX 5080, Windows WARP, and WARP 1.0.22. The existing mask/data-join control matched another 32/32 per adapter.

To try the trace on your branch in PowerShell, substitute your usual input path in the last command:

git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr2936-exec-branch-origin
git cherry-pick b8b7c6e108e97df83f07c56f4aee4aaf3ab5c5bd
$env:VICTORY_TRACE_LANE_MASK = '1'
cargo run --release --locked -p victory --features diagnostics -- translate --list "<your usual shader-pack path>"

Could you share just the text trace line for one of the four skinning shaders? The stage, leaf and producer opcodes and offsets should be enough to build a narrower synthetic case. All my inputs were synthetic. AI-assisted with Codex.

**@⁠steven-seagull27** on GitHub · 2026-11-26 11:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7190179736) @⁠pes7 I reproduced the compound `exit/boolean` refusal from your [part 32 addendum](https://git.gtahub.st/github/Marvisak--VIctory/pulls/2936) with a synthetic compute shader on `1e49107`. I put an [opt-in producer trace on that exact head](https://github.com/steven-seagull27/VIctory/commit/b8b7c6e108e97df83f07c56f4aee4aaf3ab5c5bd), following ThomasSAMP’s [producer-tracing work in #1425](https://git.gtahub.st/github/Marvisak--VIctory/pulls/1425). In my fixture, `s_and_saveexec_b32` produces an SCC that feeds a scalar select and then a vector compare. The branch reports: ```text lane-mask trace: Cs s_cbranch_execz at 0x28 [exit/boolean] from s_and_saveexec_b32 at 0x18; numeric helpers ["i32_of"]; leaf Lane(Value(17)) defined by v_cmp_gt_u32 at 0x20, structural mask=true, lane bit=false ``` The compare is where the leaf lost its bit. The missing input came from the earlier save-EXEC instruction. Your shader may reach a different producer. On the unmodified head, ordinary compare → save EXEC → branch → restore controls with 0, 8, and 32 active lanes matched **96/96 lanes per adapter** on RTX 5080, Windows WARP, and WARP 1.0.22. The existing mask/data-join control matched another **32/32 per adapter**. To try the trace on your branch in PowerShell, substitute your usual input path in the last command: ```powershell git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr2936-exec-branch-origin git cherry-pick b8b7c6e108e97df83f07c56f4aee4aaf3ab5c5bd $env:VICTORY_TRACE_LANE_MASK = '1' cargo run --release --locked -p victory --features diagnostics -- translate --list "<your usual shader-pack path>" ``` Could you share just the text trace line for one of the four skinning shaders? The stage, leaf and producer opcodes and offsets should be enough to build a narrower synthetic case. All my inputs were synthetic. AI-assisted with Codex.
Author
Owner

@⁠pes7 on GitHub · 2026-11-26 11:21 UTC · original

Addendum to part 32 - the poisoned value is traced to its entry-block origin, and that rules out the seven guesses.

A probe now records, for every value marked "a lane mask read as data", the instruction that wrote it (name, machine offset, IR block), keeps the last twelve mask reads of a thread, and prints them when a lowering ends on one. Worth keeping in mind: the emitter tolerates per-instruction failures (it marks their writes missing and goes on), so a value's reason is often the reason of an instruction several steps earlier - that is why every gate I tried looked right and changed nothing.

For the four CSComputeSkinningPedBlendShapes* programs the chain is:

PROBE fatal mask read 11: Some(("v_cndmask_b32",        3452, block 75))
PROBE fatal mask read 10: Some(("s_andn2_wrexec_b32",   3392, block 74))
PROBE fatal mask read  9: Some(("s_and_saveexec_b64",   5988, block 32))
PROBE fatal mask read  8: Some(("s_and_saveexec_b64",   5988, block 32))
PROBE fatal mask read  0: Some(("s_mov_b64",              44, block  0))   <- the entry block
PROBE fatal mask read  1: Some(("s_mov_b64",              44, block  0))

So the mask is copied out of EXEC at the entry block (s_mov_b64 at 0x2c), saved and restored (s_and_saveexec_b64), inverted (s_andn2_wrexec_b32) and finally selected on (v_cndmask_b32) - and every one of those steps is a mask operation whose value the emitter has no number for. The read that finally kills the program is the select, but the missing thing is the entry EXEC.

Seven attempts, each built and checked against the whole pack (26 084 programs, ~45-50 s), each leaving it bit-identical (5 refusals, DXIL 14 246) and each reverted:

  1. get falls back to the emitter's bit (lane_bits);
  2. s_cbranch_execz/execnz may read masks in inst();
  3. mask_ok forced true for a block's branch;
  4. the 64-bit logical ops and v_readlane_b32 may read masks;
  5. the branch condition's boolean(when) swallows LANE_MASK (branch taken);
  6. a v_cmp_* writing its mask to VGPRs gets the ballot dwords;
  7. Atom::Lane of the entry EXEC reads as "all lanes active".

Where that leaves it: the emitter has no number for the entry EXEC because it never records the exec mask as a mask in structure's tables for these programs (x.st.masks has the value at the branch, but its provenance is an instruction that already failed). The next attempt should therefore start from the entry EXEC's structure entry rather than from the branch, and the disassembly of the native code at 0x2c/0x1764/0x1794/0xcf8 of one program (CSComputeSkinningPedBlendShapesVelocity) is the cheapest way to see what the console compiler was doing.

State: branch clean at 1e49107, victory-shader 302 tests green, clippy clean, corpus 5 refusals / 14 246 DXIL as before.

**@⁠pes7** on GitHub · 2026-11-26 11:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7190632591) Addendum to part 32 - the poisoned value is traced to its **entry-block origin**, and that rules out the seven guesses. A probe now records, for every value marked "a lane mask read as data", the instruction that wrote it (name, machine offset, IR block), keeps the last twelve mask reads of a thread, and prints them when a lowering ends on one. Worth keeping in mind: the emitter *tolerates* per-instruction failures (it marks their writes missing and goes on), so a value's reason is often the reason of an instruction several steps earlier - that is why every gate I tried looked right and changed nothing. For the four `CSComputeSkinningPedBlendShapes*` programs the chain is: ``` PROBE fatal mask read 11: Some(("v_cndmask_b32", 3452, block 75)) PROBE fatal mask read 10: Some(("s_andn2_wrexec_b32", 3392, block 74)) PROBE fatal mask read 9: Some(("s_and_saveexec_b64", 5988, block 32)) PROBE fatal mask read 8: Some(("s_and_saveexec_b64", 5988, block 32)) PROBE fatal mask read 0: Some(("s_mov_b64", 44, block 0)) <- the entry block PROBE fatal mask read 1: Some(("s_mov_b64", 44, block 0)) ``` So the mask is copied out of EXEC at the **entry block** (`s_mov_b64` at 0x2c), saved and restored (`s_and_saveexec_b64`), inverted (`s_andn2_wrexec_b32`) and finally selected on (`v_cndmask_b32`) - and every one of those steps is a mask operation whose *value* the emitter has no number for. The read that finally kills the program is the select, but the missing thing is the entry EXEC. Seven attempts, each built and checked against the whole pack (26 084 programs, ~45-50 s), each leaving it bit-identical (5 refusals, DXIL 14 246) and each reverted: 1. `get` falls back to the emitter's bit (`lane_bits`); 2. `s_cbranch_execz`/`execnz` may read masks in `inst()`; 3. `mask_ok` forced true for a block's branch; 4. the 64-bit logical ops and `v_readlane_b32` may read masks; 5. the branch condition's `boolean(when)` swallows `LANE_MASK` (branch taken); 6. a `v_cmp_*` writing its mask to VGPRs gets the ballot dwords; 7. `Atom::Lane` of the entry EXEC reads as "all lanes active". Where that leaves it: the emitter has no *number* for the entry EXEC because it never records the exec mask as a mask in `structure`'s tables for these programs (`x.st.masks` has the value at the branch, but its provenance is an instruction that already failed). The next attempt should therefore start from the entry EXEC's structure entry rather than from the branch, and the disassembly of the native code at 0x2c/0x1764/0x1794/0xcf8 of one program (`CSComputeSkinningPedBlendShapesVelocity`) is the cheapest way to see what the console compiler was doing. State: branch clean at `1e49107`, `victory-shader` 302 tests green, clippy clean, corpus 5 refusals / 14 246 DXIL as before.
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-26 11:36 UTC · original

@⁠pes7 Your four opcodes were enough to reproduce the compound branch refusal on 1e49107 with a synthetic guest Wave64 compute shader. The wave width and register operands of one skinning variant would tell us whether this is the same failure.

I copied entry EXEC into s[20:21], narrowed it with s_and_saveexec_b64, ran s_andn2_wrexec_b32 s24,s20 with s25 initially zero, restored EXEC, then used s[24:25] as the condition of v_cndmask_b32. Feeding the selected value into a compare and then s_cbranch_execz gave “a lane mask read as data” before pipeline creation. This reproduced with both 8 and 40 lanes selected initially. Runnable synthetic case and control

The entry EXEC pair and its saved copy were both structurally Bool::TRUE in this fixture. At the select, the WREXEC low result had other=Some(Bool(3)), pair=None and stored=a lane mask read as data. The high register still held numeric zero. Both the branch and a separate store traced the propagated failure back to WREXEC. That gives us a way to distinguish a missing entry mask from a lost low/high pair downstream.

Changing only WREXEC to its B64 form let all six guest-Wave64 controls run. 384/384 lane values matched on each of RTX 5080, inbox WARP and WARP 1.0.22. B32 and B64 write different halves, so each form has its own expected output. The host wave width was unpinned.

Could you post the guest wave width and the four decoded instructions with operands from one named variant? The decimal offsets from the ring (44, 5988, 3392, 3452) convert to 0x2c, 0x1764, 0xd40, 0xd7c. The last two differ from the offsets listed at the end of the addendum. One variant’s text is enough.

If convenient, my opt-in offset diagnostic prints those operands, SSA reads/writes and mask-pair state only when a lane-mask refusal escapes. The branch includes the earlier producer trace and is based on your 1e49107. From a checkout of that branch, use the same translate command as before with:

$env:VICTORY_TRACE_LANE_MASK = '1'
$env:VICTORY_TRACE_LANE_MASK_AT = '2c,1764,d40,d7c'

I validated the diagnostic on both branch and store refusals. All local shader inputs were synthetic. AI-assisted with Codex.

**@⁠steven-seagull27** on GitHub · 2026-11-26 11:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7190933574) @⁠pes7 Your four opcodes were enough to reproduce the **compound branch refusal** on `1e49107` with a synthetic guest Wave64 compute shader. The wave width and register operands of one skinning variant would tell us whether this is the same failure. I copied entry EXEC into `s[20:21]`, narrowed it with `s_and_saveexec_b64`, ran `s_andn2_wrexec_b32 s24,s20` with `s25` initially zero, restored EXEC, then used `s[24:25]` as the **condition** of `v_cndmask_b32`. Feeding the selected value into a compare and then `s_cbranch_execz` gave **“a lane mask read as data”** before pipeline creation. This reproduced with both 8 and 40 lanes selected initially. [Runnable synthetic case and control](https://github.com/steven-seagull27/VIctory/commit/5a5779fe89d2da6f1756b6f79c079c5b9b44bb4f) The entry EXEC pair and its saved copy were both structurally `Bool::TRUE` in this fixture. At the select, the WREXEC low result had `other=Some(Bool(3))`, `pair=None` and `stored=a lane mask read as data`. The high register still held numeric zero. Both the branch and a separate store traced the propagated failure back to **WREXEC**. That gives us a way to distinguish a missing entry mask from a lost low/high pair downstream. Changing only WREXEC to its B64 form let all six guest-Wave64 controls run. **384/384 lane values** matched on each of RTX 5080, inbox WARP and WARP 1.0.22. B32 and B64 write different halves, so each form has its own expected output. The host wave width was unpinned. Could you post the **guest wave width and the four decoded instructions with operands** from one named variant? The decimal offsets from the ring (44, 5988, 3392, 3452) convert to **`0x2c, 0x1764, 0xd40, 0xd7c`**. The last two differ from the offsets listed at the end of the addendum. One variant’s text is enough. If convenient, my [opt-in offset diagnostic](https://github.com/steven-seagull27/VIctory/commit/77434debecc12a7b018cdb719711f5476c403bad) prints those operands, SSA reads/writes and mask-pair state only when a lane-mask refusal escapes. The branch includes the earlier producer trace and is based on your `1e49107`. From a checkout of that branch, use the same translate command as before with: ```powershell $env:VICTORY_TRACE_LANE_MASK = '1' $env:VICTORY_TRACE_LANE_MASK_AT = '2c,1764,d40,d7c' ``` I validated the diagnostic on both branch and store refusals. All local shader inputs were synthetic. AI-assisted with Codex.
Author
Owner

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

Progress log, part 33 - the refusal now has an ordered list, and its first entry is not where the message points.

Two switches are in the branch (433d49b, diagnostics only, read at run time):

  • VICTORY_ONLY=@0x<offset> - translate --list translates just that container;
  • VICTORY_TRACE_FAILS=1 - every instruction the emitter gives up on, with offset, block, reason and reads.

For CSComputeSkinningPedBlendShapesVelocity (@0xbe8bb1f) that gives the whole story in order:

FAIL s_setreg_imm32_b32 at 0x1c (block 0): a register the emitter does not model
FAIL s_setreg_imm32_b32 at 0x24 (block 0): a register the emitter does not model
FAIL s_mov_b32 at 0x5c (block 1): a lane mask read as data  reads [(S(126), Value(8))]
FAIL s_mov_b32 at 0x60 (block 1): a lane mask read as data  reads [(S(126), Value(8))]
FAIL s_and_b32 at 0x9c (block 2): a lane mask read as data  reads [(S(106), Value(184)), (S(0), Value(185))]
FAIL s_and_saveexec_b32 at 0xa0 ... reads [(S(0), Value(186)), (S(126), Value(106))]

So the first thing that cannot be done is s_mov_b32 at 0x5c copying the exec mask's low dword (S(126), the entry value 8) into a register - and everything after it is fallout. The program's own error is reported 2 000 words later, at the branch.

Five more attempts were measured against the pack and reverted, all bit-identical (5 refusals, DXIL 14 246):

  1. mask_dword falls back to the emitter's bit, then to "the entry exec is all lanes";
  2. the same fallback in get, before it refuses;
  3. is_mask no longer gated by mask_ok in get;
  4. bit_masked (ballot of the bit) shared by both callers;
  5. the entry-exec short circuit placed first in mask_dword, before the structure's table.

With the trace on, the failing s_mov_b32 does not go through i32_of (a probe there logs other values, never Value(8)), so the refusal comes from the SOP1 move's own mask path rather than from get. That is the piece to instrument next: probe mask_dword and the scalar-move handler together, with VICTORY_ONLY set, and see which of them produces the reason for that one instruction.

Branch fix/prologue at 433d49b; cargo test --release --workspace 30 suites, 0 failures; clippy -D warnings clean across the workspace.

**@⁠pes7** on GitHub · 2026-11-26 11:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7191016188) Progress log, part 33 - the refusal now has an **ordered** list, and its first entry is not where the message points. Two switches are in the branch (`433d49b`, diagnostics only, read at run time): - `VICTORY_ONLY=@0x<offset>` - `translate --list` translates just that container; - `VICTORY_TRACE_FAILS=1` - every instruction the emitter gives up on, with offset, block, reason and reads. For `CSComputeSkinningPedBlendShapesVelocity` (`@0xbe8bb1f`) that gives the whole story in order: ``` FAIL s_setreg_imm32_b32 at 0x1c (block 0): a register the emitter does not model FAIL s_setreg_imm32_b32 at 0x24 (block 0): a register the emitter does not model FAIL s_mov_b32 at 0x5c (block 1): a lane mask read as data reads [(S(126), Value(8))] FAIL s_mov_b32 at 0x60 (block 1): a lane mask read as data reads [(S(126), Value(8))] FAIL s_and_b32 at 0x9c (block 2): a lane mask read as data reads [(S(106), Value(184)), (S(0), Value(185))] FAIL s_and_saveexec_b32 at 0xa0 ... reads [(S(0), Value(186)), (S(126), Value(106))] ``` So the first thing that cannot be done is `s_mov_b32` at 0x5c copying **the exec mask's low dword** (S(126), the entry value 8) into a register - and everything after it is fallout. The program's own error is reported 2 000 words later, at the branch. Five more attempts were measured against the pack and reverted, all bit-identical (5 refusals, DXIL 14 246): 1. `mask_dword` falls back to the emitter's bit, then to "the entry exec is all lanes"; 2. the same fallback in `get`, before it refuses; 3. `is_mask` no longer gated by `mask_ok` in `get`; 4. `bit_masked` (ballot of the bit) shared by both callers; 5. the entry-exec short circuit placed **first** in `mask_dword`, before the structure's table. With the trace on, the failing `s_mov_b32` does **not** go through `i32_of` (a probe there logs other values, never Value(8)), so the refusal comes from the SOP1 move's own mask path rather than from `get`. That is the piece to instrument next: probe `mask_dword` and the scalar-move handler together, with `VICTORY_ONLY` set, and see which of them produces the reason for that one instruction. Branch `fix/prologue` at `433d49b`; `cargo test --release --workspace` 30 suites, 0 failures; clippy `-D warnings` clean across the workspace.
A program's refusal is usually not the instruction the message names: the
emitter gives up on an instruction, marks its writes missing and goes on, so a
branch can report a reason that came from something dozens of instructions
earlier (the prologue's character skinning reports `s_cbranch_execz` at
0x14dc while the first thing it cannot do is a mask copy at 0x5c).

Two switches for that:

- `VICTORY_ONLY=@0x<offset>` (`translate --list`): translate only that
  container, so one program's log is its own;
- `VICTORY_TRACE_FAILS=1`: log every instruction the emitter gives up on, with
  its offset, block, reason and reads.

Together they give the ordered list, which is what says where to look:

    FAIL s_setreg_imm32_b32 at 0x1c (block 0): a register the emitter does not model
    FAIL s_mov_b32 at 0x5c (block 1): a lane mask read as data reads [(S(126), Value(8))]
    ...

Both are read at run time only, so a normal run pays nothing.
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-26 11:47 UTC · original

@⁠pes7 I tested the SOP1-vs-mask_dword question from part 33 on 433d49b. Both s_mov_b32 entries can log FAIL in a shader that executes correctly. My synthetic fixture put consecutive copies of entry EXEC_LO at 0x5c and 0x60. Both destinations were tracked masks. Lower::sop therefore returned LANE_MASK before reading the source, and neither copy called i32_of or mask_dword. The branch/restore control still matched 40/40 output words on each of RTX 5080, inbox WARP and WARP 1.0.22 (groups of 8 and 32).

Making a subsequent vector move consume the saved register as data invoked mask_dword on the copied SSA value, not the original entry value. On the RTX 5080 all eight lanes read 0xff in the partial group and all 32 read 0xffffffff in the full group. That distinction explains how a probe watching only Value(8) could miss the numeric consumer in a case like this.

I put the requested 27-line diagnostic on your exact head. It prints the decoded source and destination, the destination SSA ID, whether the move took the structural or numeric path, and the SSA ID of each actual mask_dword call. To use it on your branch:

git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr2936-sop-path
git cherry-pick 45f68677f68ed02deea4d9bcc49066e91519dde8
$env:VICTORY_ONLY = '@0xbe8bb1f'
$env:VICTORY_TRACE_FAILS = '1'
$env:VICTORY_TRACE_EXEC_MOV = '1'

With your usual diagnostics-enabled translate --list command, the useful excerpt is the two EXEC move lines at 0x5c/0x60 and any EXEC numeric lines referencing their destination IDs. That would identify which path this particular game shader takes. The earlier mixed-width case remains a separate synthetic reproducer. AI-assisted with Codex.

**@⁠steven-seagull27** on GitHub · 2026-11-26 11:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7191164477) @⁠pes7 I tested the SOP1-vs-`mask_dword` question from [part 33](https://git.gtahub.st/github/Marvisak--VIctory/pulls/2936) on `433d49b`. **Both `s_mov_b32` entries can log `FAIL` in a shader that executes correctly.** My synthetic fixture put consecutive copies of entry EXEC_LO at `0x5c` and `0x60`. Both destinations were tracked masks. `Lower::sop` therefore returned `LANE_MASK` before reading the source, and neither copy called `i32_of` or `mask_dword`. The branch/restore control still matched **40/40** output words on each of RTX 5080, inbox WARP and WARP 1.0.22 (groups of 8 and 32). Making a subsequent vector move consume the saved register **as data** invoked `mask_dword` on the **copied SSA value**, not the original entry value. On the RTX 5080 all eight lanes read `0xff` in the partial group and all 32 read `0xffffffff` in the full group. That distinction explains how a probe watching only `Value(8)` could miss the numeric consumer in a case like this. I put the requested [27-line diagnostic on your exact head](https://github.com/steven-seagull27/VIctory/commit/45f68677f68ed02deea4d9bcc49066e91519dde8). It prints the decoded source and destination, the destination SSA ID, whether the move took the structural or numeric path, and the SSA ID of each actual `mask_dword` call. To use it on your branch: ```powershell git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr2936-sop-path git cherry-pick 45f68677f68ed02deea4d9bcc49066e91519dde8 $env:VICTORY_ONLY = '@0xbe8bb1f' $env:VICTORY_TRACE_FAILS = '1' $env:VICTORY_TRACE_EXEC_MOV = '1' ``` With your usual diagnostics-enabled `translate --list` command, the useful excerpt is the two `EXEC move` lines at `0x5c/0x60` and any `EXEC numeric` lines referencing their destination IDs. That would identify which path this particular game shader takes. The earlier mixed-width case remains a separate synthetic reproducer. AI-assisted with Codex.
Author
Owner

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

Progress log, part 34 - the gate is found and measured; the change that opens it needs the join redesigned first, so nothing is kept.

The gate. lower.rs, sop(): after computing the destination, it refuses outright -

if inst.write(Reg::S(EXEC)).is_some() || self.is_mask(lo) {
    return Err(LANE_MASK);
}

so any scalar op that writes a lane mask is refused: the copy of EXEC at the top of the character-skinning programs, s_and_saveexec_b32, a mask combine. That refusal is what the branch finally reports.

What opens it. Lowering the mask the op leaves behind - the structure's boolean for every mask register it writes, the destination's bit for writes the structure does not name - instead of refusing. Measured over the whole pack, per program, against a baseline taken with the change stashed:

before 25889 program lines, after 25889
only before: 4   only after: 4
  before: CSComputeSkinningPedBlendShapes{,_SecMotion,_Velocity,_SecMotionVelocity} ... emit: a lane mask read as data
  after : the same four ... emitted
compute programs 2658 -> 2662

Exactly the four intended programs, nothing else. (For scale: with an additional shortcut that makes an untracked mask join contribute no lane, 17 program lines change - these four plus thirteen CS_RTShadowTrace* ray-traced-shadow programs that refuse the same way today.)

Why it is not kept. The emitter's mask joins are the contract that keeps the approximations honest, and the two sides of it are pinned by tests that my change breaks one each way:

  • with the join still refusing an untracked arg: emit::lower::tests::a_scalar_result_needs_no_exec fails ("a lane read under an EXEC with no mask" now refuses);
  • with the join contributing no lane: emit::synthetic_tests::a_compare_mask_joined_with_data_on_the_skip_edge_is_0_there fails;
  • with the join falling back to the emitter's own bit: CS_IrradianceCache_Shade (which translates today) starts refusing.

So the piece to write next is the join itself (pending_masks in fill_phis): it must tell a mask register reused as data on one edge (the case those two tests describe) from a mask joined with a mask. The four skinning programs give it a target and the two tests give it a contract; the change above is one git stash away and is exactly four programs wide.

Reverted: branch fix/prologue at 433d49b, 302 victory-shader tests and 30 workspace suites green, clippy clean.

**@⁠pes7** on GitHub · 2026-11-26 12:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7191750727) Progress log, part 34 - the gate is found and measured; the change that opens it needs the **join** redesigned first, so nothing is kept. **The gate.** `lower.rs`, `sop()`: after computing the destination, it refuses outright - ```rust if inst.write(Reg::S(EXEC)).is_some() || self.is_mask(lo) { return Err(LANE_MASK); } ``` so *any* scalar op that writes a lane mask is refused: the copy of EXEC at the top of the character-skinning programs, `s_and_saveexec_b32`, a mask combine. That refusal is what the branch finally reports. **What opens it.** Lowering the mask the op leaves behind - the structure's boolean for every mask register it writes, the destination's bit for writes the structure does not name - instead of refusing. Measured over the whole pack, per program, against a baseline taken with the change stashed: ``` before 25889 program lines, after 25889 only before: 4 only after: 4 before: CSComputeSkinningPedBlendShapes{,_SecMotion,_Velocity,_SecMotionVelocity} ... emit: a lane mask read as data after : the same four ... emitted compute programs 2658 -> 2662 ``` Exactly the four intended programs, nothing else. (For scale: with an additional shortcut that makes an untracked mask join contribute no lane, 17 program lines change - these four plus thirteen `CS_RTShadowTrace*` ray-traced-shadow programs that refuse the same way today.) **Why it is not kept.** The emitter's mask joins are the contract that keeps the approximations honest, and the two sides of it are pinned by tests that my change breaks one each way: - with the join still refusing an untracked arg: `emit::lower::tests::a_scalar_result_needs_no_exec` fails ("a lane read under an EXEC with no mask" now refuses); - with the join contributing no lane: `emit::synthetic_tests::a_compare_mask_joined_with_data_on_the_skip_edge_is_0_there` fails; - with the join falling back to the emitter's own bit: `CS_IrradianceCache_Shade` (which translates today) starts refusing. So the piece to write next is the join itself (`pending_masks` in `fill_phis`): it must tell a mask register *reused as data* on one edge (the case those two tests describe) from a mask *joined with a mask*. The four skinning programs give it a target and the two tests give it a contract; the change above is one `git stash` away and is exactly four programs wide. Reverted: branch `fix/prologue` at `433d49b`, 302 `victory-shader` tests and 30 workspace suites green, clippy clean.
Author
Owner

@⁠pes7 on GitHub · 2026-11-26 12:27 UTC · original

Progress log, part 35 - the join's contract is now written down exactly, from the tests themselves, and the one place a fix still dies is named.

Four variants were built and measured; each one satisfies part of the contract and breaks another part, so nothing is kept:

variant test 1 a_scalar_result_needs_no_exec test 2 a_compare_mask_joined_with_data_on_the_skip_edge_is_0_there corpus
sop() lowers every mask write from the structure's Bool, join unchanged fails (untracked join) passes +4 compute (2 662)
+ join takes the emitter's bit fails passes +4, 0 other lines
+ data edge gives 0 lanes passes fails (second half) +17 lines
only structure-named mask writes get a bit fails passes -

The contract, from the two tests:

  1. a mask register the compiler reuses as data on an edge (zeros) gives that edge no lanes - ..._joined_with_data_on_the_skip_edge_is_0_there, first half;
  2. a mask that holds lanes off its edge (the saved EXEC of an s_and_saveexec) joined with data must stay refused - the same test's second half (a mask holding lanes off its edge joined with data translated panics otherwise);
  3. a copy of EXEC that only guards a v_readlane must not create a lane-mask phi at all - a_scalar_result_needs_no_exec.

Where the clean fix dies. sop() can lower s_mov_b32 sX, exec_lo from the structure's boolean, and that is exactly what the four CSComputeSkinningPedBlendShapes* programs need (measured: 2 658 -> 2 662 compute programs, four lines changed, nothing else). But when the destination's boolean is itself a join, evaluating it registers a mask phi in pending_masks, and if one of that phi's edges is untracked, fill_phis turns it into Err(unsupported(...)) - fatal for the whole program, where the old refusal was merely tolerated (the instruction's writes marked missing). That is why a_scalar_result_needs_no_exec fails in every variant that lowers the copy.

So the missing piece is in pending_masks itself: a phi registered because a mask was read as data must not fail the program when an edge is untracked - it should fall back to the tolerated path (the value stays a number, EXEC drawn from it only guards a v_readlane). With that, variant 2's numbers (+4 programs, 0 other lines) should hold with both tests green.

Branch fix/prologue at 433d49b, clean; 302 victory-shader tests and 30 workspace suites green after the revert.

**@⁠pes7** on GitHub · 2026-11-26 12:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7192019765) Progress log, part 35 - the join's contract is now written down exactly, from the tests themselves, and the one place a fix still dies is named. Four variants were built and measured; each one satisfies part of the contract and breaks another part, so nothing is kept: | variant | test 1 `a_scalar_result_needs_no_exec` | test 2 `a_compare_mask_joined_with_data_on_the_skip_edge_is_0_there` | corpus | |---|---|---|---| | sop() lowers every mask write from the structure's Bool, join unchanged | fails (untracked join) | passes | +4 compute (2 662) | | + join takes the emitter's bit | fails | passes | **+4, 0 other lines** | | + data edge gives 0 lanes | passes | fails (second half) | +17 lines | | only structure-named mask writes get a bit | fails | passes | - | **The contract, from the two tests:** 1. a mask register the compiler reuses as *data* on an edge (zeros) gives that edge **no lanes** - `..._joined_with_data_on_the_skip_edge_is_0_there`, first half; 2. a mask that **holds lanes off its edge** (the saved EXEC of an `s_and_saveexec`) joined with data must stay **refused** - the same test's second half (`a mask holding lanes off its edge joined with data translated` panics otherwise); 3. a copy of EXEC that only guards a `v_readlane` must **not** create a lane-mask phi at all - `a_scalar_result_needs_no_exec`. **Where the clean fix dies.** `sop()` can lower `s_mov_b32 sX, exec_lo` from the structure's boolean, and that is exactly what the four `CSComputeSkinningPedBlendShapes*` programs need (measured: 2 658 -> 2 662 compute programs, four lines changed, nothing else). But when the destination's boolean is itself a *join*, evaluating it registers a mask phi in `pending_masks`, and if one of that phi's edges is untracked, `fill_phis` turns it into `Err(unsupported(...))` - fatal for the whole program, where the old refusal was merely tolerated (the instruction's writes marked missing). That is why `a_scalar_result_needs_no_exec` fails in every variant that lowers the copy. So the missing piece is in `pending_masks` itself: a phi registered *because a mask was read as data* must not fail the program when an edge is untracked - it should fall back to the tolerated path (the value stays a number, EXEC drawn from it only guards a `v_readlane`). With that, variant 2's numbers (+4 programs, 0 other lines) should hold with both tests green. Branch `fix/prologue` at `433d49b`, clean; 302 `victory-shader` tests and 30 workspace suites green after the revert.
`sop()` refused every scalar instruction whose destination is a lane mask -

    if inst.write(Reg::S(EXEC)).is_some() || self.is_mask(lo) {
        return Err(LANE_MASK);
    }

- so a program that copies exec before its first branch was refused at that
branch, and the whole pipeline was dropped. That is the prologue's character
skinning with blend shapes (`CSComputeSkinningPedBlendShapes`, `...SecMotion`,
`...Velocity`, `...SecMotionVelocity`), dropped four dispatches a frame in the
scene where the play run then stands still.

Now the op lowers the mask the structure already has for what it writes,
instead of refusing. Three details make it hold:

* only the writes the structure names as masks get a bit; a write it does not
  name (the saved exec of an `s_and_saveexec`, a register the compiler reuses
  for data) carries the destination's mask, because the branch that follows
  would otherwise read a value with no definition at all;
* a phi registered while such an evaluation runs is *lenient*: an edge the
  structure cannot name gives it no lanes instead of failing the program, so
  `a_scalar_result_needs_no_exec` (a copy of exec that only guards a
  `v_readlane`) keeps translating;
* every other mask join keeps its refusal, so a mask holding lanes off its edge
  joined with data still does not translate
  (`a_compare_mask_joined_with_data_on_the_skip_edge_is_0_there`, second half).

Measured over the whole shader pack (`translate --list`, 26 084 programs),
against a baseline taken with this change stashed:

    before 25889 program lines, after 25889
    only before: 4   only after: 4      (the same four, now emitted)
    compute programs 2658 -> 2662

Nothing else changes. `cargo test --release --workspace`: 30 suites, 0
failures; clippy `-D warnings` clean.

`lower.rs` is at the repository's 512 KiB asset-policy limit, so the two new
methods live in `emit/lower/masks.rs`.
`VICTORY_KEYS=<seconds>:<key>` held each key for 200 ms, which is enough for a
menu press and not for walking. The entries now take a third field, the hold
in milliseconds:

    VICTORY_KEYS=200:W:6000,215:A:1200,10:Enter:300,20:Enter:300

Both the keyboard device and the stand-in pad see the keys (the HLE merges
them in `poll`), so a run can be driven while the title's window stays in the
background: nothing calls `SetForegroundWindow` or `keybd_event`, and the
person using the machine keeps their focus. Enter is the pad's A and W the
left stick up, so the account screen, the menu and walking all work this way.

First run with it (`nofocus`): the title reached the world without any window
activation - 1 862 draws/frame at 153 s, 4 657 at 196 s - where every earlier
driver had to attach to the window's input queue and steal focus at 15/40/70 s.
Author
Owner

@⁠pes7 on GitHub · 2026-11-26 13:47 UTC · original

Attribution of the prologue's GPU time, measured - and why cutting the biggest pipeline would not move the frame.

The no-focus run (prologue, 1 200 s, VICTORY_KEYS only) gave 477 world frames, 0 removals, 0 exceptions, and its per-command report (VICTORY_GPU_STAMPS + DRED, one line per command over 200 ms) names every pipeline:

pipeline dispatches per frame median ms total ms
compute 39f0e9aeb156a61c 341 0.71 303 103 764
compute 5cf00dc39042edaf 266 0.56 85 24 104
compute df11dcd012cd7382 294 0.62 61 17 895
compute 3df629ffc3d0a2a6 1 - 9 265 9 265
compute 8cb27ccf2d50c606 335 0.70 25 8 904
compute 34fb51b8a0312e82 199 0.42 36 6 821
compute 0a5ecfee6b79e13b 244 0.51 29 6 453

Two things fall out of it:

  1. The single biggest pipeline is ~218 ms of a 2 900 ms GPU frame (about 7 %), not the 44 % the earlier 196-frame sum suggested - that sum was over the reported commands only, and the report logs commands above 200 ms, so it is a ranking, not a budget.
  2. The frame is many commands of moderate cost, not a few heavy ones. The seven families above add to ~360 ms/frame; the remaining ~2.5 s is spread over the mesh draws, the indirect dispatches and 1 400-6 000 draws a frame. compute 3df629ffc3d0a2a6 is one 9.3 s dispatch in the whole run (a bake during loading), not a frame cost.

So an optimization aimed at 39f0e9aeb156a61c would be worth ~7 % at best, and the shape of the data says the cost is per-command overhead (binding, descriptors, barriers) rather than one bad shader. That changes what to attack next, and it is why nothing is committed here: a shader-level micro-optimization would not have shown a frame-time win.

39f0e9aeb156a61c itself, for the record: 24 896 IR lines, NumThreads=(32,1,1), 3 600 groups a dispatch, five translated loops, 464 waveReadLaneFirst, 170 raw buffer loads, 26 atomics - a coarse BVH-style pass whose cost is the work it is asked for.

Next, in this order: (a) count what the 1 400-6 000 draws and ~31 barriers a frame each cost, with the same report (it logs a command only above 200 ms today, so the threshold has to come down for a frame's worth of commands); (b) the per-frame CPU side - 1 192 root-view slots, 533 k heap slots and 1.5 GB of copies - where the numbers are already in the frame line.

**@⁠pes7** on GitHub · 2026-11-26 13:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7193835105) Attribution of the prologue's GPU time, measured - and why cutting the biggest pipeline would not move the frame. The no-focus run (`prologue`, 1 200 s, `VICTORY_KEYS` only) gave **477 world frames, 0 removals, 0 exceptions**, and its per-command report (`VICTORY_GPU_STAMPS` + DRED, one line per command over 200 ms) names every pipeline: | pipeline | dispatches | per frame | median ms | total ms | |---|---|---|---|---| | `compute 39f0e9aeb156a61c` | 341 | 0.71 | **303** | 103 764 | | `compute 5cf00dc39042edaf` | 266 | 0.56 | 85 | 24 104 | | `compute df11dcd012cd7382` | 294 | 0.62 | 61 | 17 895 | | `compute 3df629ffc3d0a2a6` | **1** | - | **9 265** | 9 265 | | `compute 8cb27ccf2d50c606` | 335 | 0.70 | 25 | 8 904 | | `compute 34fb51b8a0312e82` | 199 | 0.42 | 36 | 6 821 | | `compute 0a5ecfee6b79e13b` | 244 | 0.51 | 29 | 6 453 | Two things fall out of it: 1. **The single biggest pipeline is ~218 ms of a 2 900 ms GPU frame** (about 7 %), not the 44 % the earlier 196-frame sum suggested - that sum was over the *reported* commands only, and the report logs commands above 200 ms, so it is a ranking, not a budget. 2. **The frame is many commands of moderate cost, not a few heavy ones.** The seven families above add to ~360 ms/frame; the remaining ~2.5 s is spread over the mesh draws, the indirect dispatches and 1 400-6 000 draws a frame. `compute 3df629ffc3d0a2a6` is one 9.3 s dispatch in the whole run (a bake during loading), not a frame cost. So an optimization aimed at `39f0e9aeb156a61c` would be worth ~7 % at best, and the shape of the data says the cost is per-command overhead (binding, descriptors, barriers) rather than one bad shader. That changes what to attack next, and it is why nothing is committed here: a shader-level micro-optimization would not have shown a frame-time win. `39f0e9aeb156a61c` itself, for the record: 24 896 IR lines, `NumThreads=(32,1,1)`, 3 600 groups a dispatch, five translated loops, 464 `waveReadLaneFirst`, 170 raw buffer loads, 26 atomics - a coarse BVH-style pass whose cost is the work it is asked for. Next, in this order: (a) count what the 1 400-6 000 draws and ~31 barriers a frame each cost, with the same report (it logs a command only above 200 ms today, so the threshold has to come down for a frame's worth of commands); (b) the per-frame CPU side - 1 192 root-view slots, 533 k heap slots and 1.5 GB of copies - where the numbers are already in the frame line.
The batched report named two commands a list, and only for submissions over
200 ms, so a frame's ~350 commands were ranked by their two longest - which is
why the biggest pipeline looked like 44 % of the frame when it is 7 %.

Two switches now say how much to list and when:

    VICTORY_GPU_REPORT=40           commands per list (default 2)
    VICTORY_GPU_REPORT_MIN_MS=250   submission length that triggers it (default 200)

With 40, a 1 150 ms submission lists 354 commands summing to 1 144 ms, i.e. the
report accounts for the submission's whole time. On the prologue's frames it
gives the family table the next optimization needs - no single shader:

    indirect 25ebc92075b62822   2 453 ms   (an indirect draw: geometry)
    dispatch 39f0e9aeb156a61c   2 019
    indirect 7a071f906f98311b   1 749
    draw     05e958b19269d596   1 126
    dispatch 5cf00dc39042edaf     538
    mesh     04b9be3756e8f41c     475

over the sampled submissions, each family 200-600 ms of a ~3 s frame: geometry
and compute in similar measure, not one bad pass.

Diagnostics only (the switches are read at run time, nothing changes without
them); clippy `-D warnings` clean, `cargo test --release -p victory-gpu` 231
passed.
Author
Owner

@⁠pes7 on GitHub · 2026-11-26 13:58 UTC · original

The report now ranks a whole submission (621935a8), and the frame turns out not to be one bad pass.

Two switches: VICTORY_GPU_REPORT=<commands per list> (2 by default) and VICTORY_GPU_REPORT_MIN_MS=<submission length> (200 by default). With VICTORY_GPU_REPORT=40 on a 1 200 s no-focus run (149 world frames, 0 removals, 0 exceptions, frames 2.9-3.4 s at 4 800-10 400 draws), a 1 150 ms submission lists 354 commands summing to 1 144 ms - the report accounts for the submission's whole time, so its ranking is now a budget.

The families, over the sampled submissions:

command family ms
indirect 25ebc92075b62822 (an indirect draw: geometry) 2 453
dispatch 39f0e9aeb156a61c 2 019
indirect 7a071f906f98311b 1 749
draw 05e958b19269d596 1 126
dispatch 5cf00dc39042edaf 538
mesh 04b9be3756e8f41c 475

Each family is 200-600 ms of a ~3 s frame: geometry and compute in similar measure. That is why nothing was committed as an fps fix this turn - the earlier "39f0e9aeb156a61c is 44 % of the frame" reading came from ranking only the two longest commands per list, and the biggest single family is indirect 25ebc92075b62822, a vertex shader driven by an indirect draw.

Next, concretely: the vertex shader behind the indirect draws (25ebc…) and the indirect dispatcher (7a07…) are now the two candidates with the largest budgets; the geometry side is where our translation adds the most per-vertex work (typed buffer fetches read as raw bytes and converted per component), so that is the first thing to time against the console's form.

Verification: cargo test --release -p victory-gpu 231 passed, clippy -D warnings clean; the switches are diagnostics-only, read at run time.

**@⁠pes7** on GitHub · 2026-11-26 13:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7194089510) The report now ranks a whole submission (`621935a8`), and the frame turns out **not** to be one bad pass. Two switches: `VICTORY_GPU_REPORT=<commands per list>` (2 by default) and `VICTORY_GPU_REPORT_MIN_MS=<submission length>` (200 by default). With `VICTORY_GPU_REPORT=40` on a 1 200 s no-focus run (149 world frames, 0 removals, 0 exceptions, frames 2.9-3.4 s at 4 800-10 400 draws), a 1 150 ms submission lists **354 commands summing to 1 144 ms** - the report accounts for the submission's whole time, so its ranking is now a budget. The families, over the sampled submissions: | command family | ms | |---|---| | `indirect 25ebc92075b62822` (an indirect draw: **geometry**) | 2 453 | | `dispatch 39f0e9aeb156a61c` | 2 019 | | `indirect 7a071f906f98311b` | 1 749 | | `draw 05e958b19269d596` | 1 126 | | `dispatch 5cf00dc39042edaf` | 538 | | `mesh 04b9be3756e8f41c` | 475 | Each family is 200-600 ms of a ~3 s frame: geometry and compute in similar measure. That is why nothing was committed as an fps fix this turn - the earlier "39f0e9aeb156a61c is 44 % of the frame" reading came from ranking only the two longest commands per list, and the biggest single family is `indirect 25ebc92075b62822`, a **vertex** shader driven by an indirect draw. Next, concretely: the vertex shader behind the indirect draws (25ebc…) and the indirect dispatcher (7a07…) are now the two candidates with the largest budgets; the geometry side is where our translation adds the most per-vertex work (typed buffer fetches read as raw bytes and converted per component), so that is the first thing to time against the console's form. Verification: `cargo test --release -p victory-gpu` 231 passed, clippy `-D warnings` clean; the switches are diagnostics-only, read at run time.
Every indirect command is clamped by a compute dispatch between two global
unordered-access barriers, and the world runs 2 600 of them a frame - so the
barriers are a candidate for a large part of a frame. Measuring them needs an
A/B that keeps the commands running, which `VICTORY_NO_CLAMP` could not: it
returned `None`, the command was dropped, and the run then compared a frame
with 5 018 indirect commands against one with none.

Two switches replace it, neither changing anything unless set:

    VICTORY_ONE_BARRIER=1   after the clamp, only the transition out of
                            unordered access (which already flushes that
                            buffer) - the global barrier after it ordered
                            nothing the command needs;
    VICTORY_NO_BARRIERS=1   both global barriers gone: the ceiling of what
                            they cost together, for the measurement only (the
                            title's writes then need not be visible to the
                            clamp).

`VICTORY_NO_CLAMP` is removed: it measured a different program.

No numbers claimed: the A/B was started and stopped early (base 47 and 13 world
frames, one-barrier 3), so nothing here says the change is faster. It says how
to find out.
Every world frame of every run so far reports the same three numbers:

    0 pages copied back, 20 000-31 000 withheld, missed 70 000-112 000 pages
    and 27-50 region marks with no copy (first: 0x740000000 0x750000000 ...)

`copy_back` withholds *all* of a frame's write-backs as soon as one page of
title memory was read by a shader with no copy (`withholding()`), and that is
the state of every frame: the title reads 0x740000000-0x780000000 - a gigabyte
with no host copy - so

* the title's memory never receives what its shaders wrote, and the host copy
  the title's own reads are answered from (and that a refresh pushes back) is
  what the GPU wrote a while ago or never;
* the per-frame work is real: 100 000 page marks read back and walked, 20 000
  pages dropped, every frame.

Whether that is what keeps the game from advancing (the prologue's first scene
waits for input and never moves on) cannot be told from the logs. The new
switch copies back even while pages are missing, so one run says it:

    VICTORY_ALLOW_COPYBACK=1

Diagnostics only: the rule above is unchanged unless the switch is set.

No behaviour change and no numbers claimed.
Every world frame reports thousands of pages of title memory a shader read
with no copy (`memory`'s frame line), and the first four addresses have been
the same four gigabyte-apart regions for every run - so the next question is
what those addresses are, which the line could not say.

`shadow::describe(address)` answers it: the registered title buffer that holds
the address and whether a copy of it was made, or how far the nearest
registered buffers are. The first four missed pages of a frame log it at
`debug`:

    title memory a shader read with no copy page=0x740000000
        what="no registered title buffer at 0x740000000; nearest below ..."

That separates "the title never registered a buffer there" (a use we do not
translate into a buffer access at all, so no copy exists to make) from "the
buffer is registered but its copy was never made or was released".

Diagnostics only, no behaviour change, no numbers claimed.
Author
Owner

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

Two things came out of reading the existing runs' logs (no new runs — the machine's user is playing games, so I stopped the A/B I had started and will measure later).

The frame is not per-draw

frame draws/frame GPU ms
14:23:17 (loading) 1 405 2 028
13:56:12 (world) 5 591 2 688
13:56:00 (world) 10 393 2 638

7× the draws for 1.3× the time. So per-draw overhead is not the shape of the cost: there is ~2 s of fixed work per frame plus a modest per-draw term. That agrees with the full-submission report (top 80 commands ≈ 1 400 ms of a 2 900 ms frame):

command median per frame ~ms/frame
compute 39f0e9aeb156a61c 287 ms 0.71 200
dispatch 28918b7150a7aad5 15 ms 4.5 130
indirect 25ebc92075b62822 6 ms 14 83
indirect 7a071f906f98311b 205 ms 0.16 33

Both 24 000-line shaders (39f0e9aeb156a61c, 7a071f906f98311b) were dumped and read: 170/474 raw loads, 464/24 waveReadLaneFirst (the console's own s_mov … readfirstlane, not our waterfall loops), 5/7 loop counters, heap clamp as icmp+select per access. No translation bloat — they are the work they are asked for, so a shader-level micro-optimization is not where the frame is.

Nothing is ever copied back to title memory

Every frame of every run reports the same three numbers:

0 pages copied back, 20 000-31 000 withheld and 0.8-3.9 GB of views kept,
missed 70 000-112 000 pages and 27-50 256-MiB region marks with no copy
(first: 0x740000000 0x750000000 0x760000000 0x770000000)

memory::copy_back withholds all of a frame's write-backs as soon as one page was read by a shader with no copy, and the title reads 0x740000000–0x780000000 — 1 GiB with no host copy — in every frame. Consequences:

  • title memory never receives what its shaders wrote, and the host copy that answers the title's own reads (and that a refresh pushes back into title memory) is stale;
  • ~100 000 page marks are read back and walked and ~25 000 pages dropped per frame — CPU work that exists only to be thrown away.

Whether this is what keeps the prologue's first scene from advancing is now a question with an answer, not an argument:

VICTORY_ALLOW_COPYBACK=1     (diagnostics) copy back even while pages are missing

and shadow::describe now logs, for a frame's first four missed pages, what the title registered there — "never registered a buffer" (a use we do not translate into a buffer access, so no copy can exist) versus "registered but the copy was not made".

Committed here (all diagnostics, nothing changes unless set)

  • 2810c8d9 — VICTORY_ONE_BARRIER / VICTORY_NO_BARRIERS for the clamp's two global UAV barriers (2 600 indirect commands a frame, each one record); VICTORY_NO_CLAMP removed, because it dropped the commands instead of measuring them.
  • 2fc6a292 — VICTORY_ALLOW_COPYBACK.
  • c99ebaba — shadow::describe for a missed page.

No fps claim: the barrier A/B was cut short (base 47 and 13 world frames, one-barrier 3), so it measured nothing. Clippy -D warnings clean on victory-gpu both with and without diagnostics; a diagnostics build of victory succeeds.

**@⁠pes7** on GitHub · 2026-11-26 14:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/2936#issuecomment-7195117121) Two things came out of reading the existing runs' logs (no new runs — the machine's user is playing games, so I stopped the A/B I had started and will measure later). ## The frame is not per-draw | frame | draws/frame | GPU ms | |---|---|---| | 14:23:17 (loading) | 1 405 | 2 028 | | 13:56:12 (world) | 5 591 | 2 688 | | 13:56:00 (world) | 10 393 | 2 638 | **7× the draws for 1.3× the time.** So per-draw overhead is not the shape of the cost: there is ~2 s of *fixed* work per frame plus a modest per-draw term. That agrees with the full-submission report (top 80 commands ≈ 1 400 ms of a 2 900 ms frame): | command | median | per frame | ~ms/frame | |---|---|---|---| | `compute 39f0e9aeb156a61c` | 287 ms | 0.71 | 200 | | `dispatch 28918b7150a7aad5` | 15 ms | 4.5 | 130 | | `indirect 25ebc92075b62822` | 6 ms | 14 | 83 | | `indirect 7a071f906f98311b` | 205 ms | 0.16 | 33 | Both 24 000-line shaders (`39f0e9aeb156a61c`, `7a071f906f98311b`) were dumped and read: 170/474 raw loads, 464/24 `waveReadLaneFirst` (the console's own `s_mov … readfirstlane`, not our waterfall loops), 5/7 loop counters, heap clamp as `icmp`+`select` per access. **No translation bloat** — they are the work they are asked for, so a shader-level micro-optimization is not where the frame is. ## Nothing is ever copied back to title memory Every frame of every run reports the same three numbers: ``` 0 pages copied back, 20 000-31 000 withheld and 0.8-3.9 GB of views kept, missed 70 000-112 000 pages and 27-50 256-MiB region marks with no copy (first: 0x740000000 0x750000000 0x760000000 0x770000000) ``` `memory::copy_back` withholds *all* of a frame's write-backs as soon as one page was read by a shader with no copy, and the title reads **0x740000000–0x780000000 — 1 GiB with no host copy — in every frame**. Consequences: - title memory never receives what its shaders wrote, and the host copy that answers the title's own reads (and that a refresh pushes back into title memory) is stale; - ~100 000 page marks are read back and walked and ~25 000 pages dropped per frame — CPU work that exists only to be thrown away. Whether this is what keeps the prologue's first scene from advancing is now a question with an answer, not an argument: ```text VICTORY_ALLOW_COPYBACK=1 (diagnostics) copy back even while pages are missing ``` and `shadow::describe` now logs, for a frame's first four missed pages, what the title registered there — "never registered a buffer" (a use we do not translate into a buffer access, so no copy can exist) versus "registered but the copy was not made". ## Committed here (all diagnostics, nothing changes unless set) - `2810c8d9` — `VICTORY_ONE_BARRIER` / `VICTORY_NO_BARRIERS` for the clamp's two global UAV barriers (2 600 indirect commands a frame, each one record); `VICTORY_NO_CLAMP` removed, because it dropped the commands instead of measuring them. - `2fc6a292` — `VICTORY_ALLOW_COPYBACK`. - `c99ebaba` — `shadow::describe` for a missed page. **No fps claim**: the barrier A/B was cut short (base 47 and 13 world frames, one-barrier 3), so it measured nothing. Clippy `-D warnings` clean on `victory-gpu` both with and without `diagnostics`; a diagnostics build of `victory` succeeds.
Nine switches were added by the prologue work and none was in the table a bug
report is written from: `VICTORY_GPU_STAMPS`, `VICTORY_GPU_REPORT` and its
`_MIN_MS`, `VICTORY_DUMP_SHADER`, `VICTORY_DUMP_ARGUMENTS`,
`VICTORY_TRACE_FAILS`, `VICTORY_ALLOW_COPYBACK`, and the two clamp-barrier
measurements (`VICTORY_ONE_BARRIER`, `VICTORY_NO_BARRIERS`).

They are the ones a report like the prologue's device removal needed: the
pipeline log names a shader hash and `VICTORY_DUMP_SHADER` gives its code; the
attribution of a 3 s frame needs the whole command list, not the two slowest
commands of it; and "why does this shader not translate" is `VICTORY_TRACE_FAILS`
rather than guessing from a dump.

Rows only, no behaviour change.
Whether a frame draws the scene several times over is not visible from the
draw count: the world reports 5 000-10 000 draws a frame for a prison cell,
which is a few hundred on a console, and the frame line said nothing about
what those draws cover. `take_work` counts, per frame, vertices
(`DrawInstanced`), indices (`DrawIndexedInstanced`), dispatch threads
(groups x 64) and mesh groups (x 128), and the report logs them:

    work a frame: 96 000 vertices, 74 000 indices, 734 000 dispatch threads,
                  5 700 mesh groups

The counters are the two atomics a draw already pays (`DRAWN`); the line is
printed by the diagnostics report, beside the draw count and the dropped ones.
Indirect records are not counted here - their arguments are read out by
`VICTORY_DUMP_ARGUMENTS`, which names the work per record.

No behaviour change; the numbers are what the next run is for.
Two arms with it set (ncb1/cb1 and cb2 in one A/B) died before the world:
`0xc0000005` reading `0x8` and `0x80000003`, both in the title's own image, and
both arms without it ran 6-7 minutes each with 0 removals and 0 exceptions.

That is what the rule beside it already said in words - a list that computed
from zeros hands the title garbage pointers - so the switch is documented as
the demonstration of that, not as something to use.

Measured on the same driver, same scene, 240 s arms: withholding is not what
keeps the game from advancing; the missing copies are the problem, and the
switch shows fixing it the wrong way round breaks the title.
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/2936/head:github-bot/gh-2936'
git switch 'github-bot/gh-2936'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2936'
git switch 'github-bot/gh-2936'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2936'
git switch 'github-bot/gh-2936'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2936'
git switch 'main'
git merge --squash 'github-bot/gh-2936'
git switch 'main'
git merge --ff-only 'github-bot/gh-2936'
git switch 'main'
git merge 'github-bot/gh-2936'
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!2936
No description provided.