GPU: on NVIDIA, structured buffer views are made raw #2462

Open
lhnizdo wants to merge 1 commit from upstream-pr/2464 into main
lhnizdo commented 2026-11-25 14:02:51 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by lhnizdo on 2026-11-25T14:02:51Z.


On NVIDIA hosts, a title SRV that holds a structured buffer view is now made as a raw view of the same bytes.

The problem. Scalar and offset-only buffer reads are translated as raw reads: rawBufferLoad through a raw handle, at a byte offset. When the slot holds the title's structured view, D3D12 leaves that read undefined, and NVIDIA took the byte offset as the element.

WindNew:CS_CopyLatestWindFieldForRenderingWithSmooth reads its loop counts that way, from t71 (680-byte records, offsets 0 and 0xC4). With other records' data as counts, its loops ran until Windows reset the device. That happened every run, in the opening credits, on Windows 10 with an NVIDIA wave32 card. DRED named that dispatch.

The change (descriptor/host.rs, buffer_srv):

  • On an NVIDIA host (vendor 0x10DE), a structured SRV becomes a raw view over the same bytes. Raw views must start on 16 bytes, so a view that wouldn't stays structured and is logged once.
  • Raw reads then read what they name.
  • Reads by element keep their structured handle, which NVIDIA and WARP read right on a raw view. AMD reads element 0 there, so other hosts are unchanged.
  • VICTORY_RAW_STRUCTURED=0 or =1 overrides the vendor check.
  • host::host_vendor() reads the device's adapter vendor once, by its LUID.

Why not in the shaders. The first version of this PR read such slots both ways in the shader and picked the result by the slot's stride. That made the largest shaders too much for the NVIDIA driver's compiler. I checked with translate --pipelines, filtered to the CS_RaytracingResolve and skinning mesh shaders:

  • Without shader changes: 0 of 4,683 pipelines refused.
  • With the both-ways reads: 569 refused with E_OUTOFMEMORY, and their draws dropped in game.

This version leaves the shaders unchanged.

Checked on Windows 10 with an NVIDIA card, together with the Agility SDK (#2460), heap-limit (#2461) and UAV-format (#2462) PRs:

  • A game run of almost 9 minutes, through the opening credits into the prologue, with no device removal and no loop cap. Before, every run hung in the credits.
  • 0 pipelines refused for lack of memory.
  • Clippy is clean. The victory-gpu tests are unchanged against main.

🤖 Generated with Claude Code. The change was written by Claude Code (Claude Opus 5.5) in my session; the commit carries a Co-Authored-By: Claude line.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5492840838 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2464). Originally posted by [lhnizdo](https://github.com/lhnizdo) on 2026-11-25T14:02:51Z. --- On NVIDIA hosts, a title SRV that holds a structured buffer view is now made as a **raw view of the same bytes**. **The problem.** Scalar and offset-only buffer reads are translated as raw reads: `rawBufferLoad` through a raw handle, at a byte offset. When the slot holds the title's *structured* view, D3D12 leaves that read undefined, and NVIDIA took the byte offset as the element. `WindNew:CS_CopyLatestWindFieldForRenderingWithSmooth` reads its loop counts that way, from `t71` (680-byte records, offsets 0 and 0xC4). With other records' data as counts, its loops ran until Windows reset the device. That happened every run, in the opening credits, on Windows 10 with an NVIDIA wave32 card. DRED named that dispatch. **The change** (`descriptor/host.rs`, `buffer_srv`): - On an NVIDIA host (vendor 0x10DE), a structured SRV becomes a raw view over the same bytes. Raw views must start on 16 bytes, so a view that wouldn't stays structured and is logged once. - Raw reads then read what they name. - Reads by element keep their structured handle, which NVIDIA and WARP read right on a raw view. AMD reads element 0 there, so other hosts are unchanged. - `VICTORY_RAW_STRUCTURED=0` or `=1` overrides the vendor check. - `host::host_vendor()` reads the device's adapter vendor once, by its LUID. **Why not in the shaders.** The first version of this PR read such slots both ways in the shader and picked the result by the slot's stride. That made the largest shaders too much for the NVIDIA driver's compiler. I checked with `translate --pipelines`, filtered to the `CS_RaytracingResolve` and skinning mesh shaders: - **Without shader changes:** 0 of 4,683 pipelines refused. - **With the both-ways reads:** 569 refused with `E_OUTOFMEMORY`, and their draws dropped in game. This version leaves the shaders unchanged. **Checked** on Windows 10 with an NVIDIA card, together with the Agility SDK (#2460), heap-limit (#2461) and UAV-format (#2462) PRs: - A game run of almost 9 minutes, through the opening credits into the prologue, with no device removal and no loop cap. Before, every run hung in the credits. - 0 pipelines refused for lack of memory. - Clippy is clean. The `victory-gpu` tests are unchanged against `main`. 🤖 Generated with [Claude Code](https://claude.com/claude-code). The change was written by Claude Code (Claude Opus 5.5) in my session; the commit carries a `Co-Authored-By: Claude` line.
DenRakEiw commented 2026-11-25 14:04:35 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T14:04:35Z.

Review: APPROVED


Verified against origin/main (940d32f) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP:

  • Structured scalar loads lowering builds cleanly and passes all lower tests.
  • cargo test -p victory-shader emit::lower::tests: 21/21 passed on RTX 5090, 21/21 passed on WARP.
  • cargo clippy -p victory-shader --all-targets -- -D warnings: 0 warnings.
  • cargo xtask policy: 183 files ok.

AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6059057039 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2464#pullrequestreview-6059057039). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-25T14:04:35Z. **Review:** APPROVED --- Verified against `origin/main` (`940d32f`) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP: - Structured scalar loads lowering builds cleanly and passes all lower tests. - `cargo test -p victory-shader emit::lower::tests`: 21/21 passed on RTX 5090, 21/21 passed on WARP. - `cargo clippy -p victory-shader --all-targets -- -D warnings`: 0 warnings. - `cargo xtask policy`: 183 files ok. AI-assisted (Gemini 4 Neon).
catminou4 commented 2026-11-25 14:57:30 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T14:57:30Z.

Review: APPROVED


Tested locally: merged into main 940d32f69b, cargo test -p victory-shader --locked on macOS arm64 — 144 passed, 0 failed, 2 ignored (Windows-gated hardware execution tests not run here). Approving — structured scalar loads.

<!-- greyfinch-sync:Marvisak/VIctory:review:6059994856 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2464#pullrequestreview-6059994856). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T14:57:30Z. **Review:** APPROVED --- Tested locally: merged into main 940d32f69b, `cargo test -p victory-shader --locked` on macOS arm64 — 144 passed, 0 failed, 2 ignored (Windows-gated hardware execution tests not run here). Approving — structured scalar loads.
lhnizdo commented 2026-11-25 15:04:24 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by lhnizdo on 2026-11-25T14:46:07Z.


Heads-up before merging. In a game run, reading table SRVs both ways made the largest shaders (the materials' CS_RaytracingResolve variants and some deferred pixel shaders) too big for the NVIDIA driver's compiler: 145 pipelines were refused with E_OUTOFMEMORY and their draws dropped. I have a follow-up commit that looks the slot's stride up once per descriptor and block, and splits constant offsets at translation time. I'll push it once translate --pipelines confirms the refusals are gone. Please hold this one until then.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7165784112 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2464#issuecomment-7165784112). Originally posted by [lhnizdo](https://github.com/lhnizdo) on 2026-11-25T14:46:07Z. --- Heads-up before merging. In a game run, reading table SRVs both ways made the largest shaders (the materials' `CS_RaytracingResolve` variants and some deferred pixel shaders) too big for the NVIDIA driver's compiler: 145 pipelines were refused with `E_OUTOFMEMORY` and their draws dropped. I have a follow-up commit that looks the slot's stride up once per descriptor and block, and splits constant offsets at translation time. I'll push it once `translate --pipelines` confirms the refusals are gone. Please hold this one until then.
upstream-sync changed title from [PR #2464] Pr/structured scalar loads to [PR #2464] GPU: on NVIDIA, structured buffer views are made raw 2026-11-25 17:04:23 +00:00
lhnizdo commented 2026-11-25 17:05:08 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by lhnizdo on 2026-11-25T16:37:24Z.


Update: I've replaced this PR's approach, so the branch was force-pushed.

As I mentioned above, reading table SRVs both ways in the shader made the largest shaders too big for the NVIDIA driver's compiler. A filtered translate --pipelines run on the CS_RaytracingResolve and skinning mesh shaders gave 569 pipelines refused with E_OUTOFMEMORY, against 0 without the shader change.

The PR now fixes it on the host instead: on NVIDIA, a structured SRV is made as a raw view of the same bytes. Raw reads then read what they name, reads by element keep their structured handle (which NVIDIA reads right on a raw view), and the shaders are unchanged. Other vendors are unchanged too.

In a game run with it, the opening credits played through into the prologue with no device removal and no loop cap, and no pipelines were refused for lack of memory. Details are in the updated description. The earlier approvals were for the old version, so a fresh look would be appreciated.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7168274868 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2464#issuecomment-7168274868). Originally posted by [lhnizdo](https://github.com/lhnizdo) on 2026-11-25T16:37:24Z. --- Update: I've replaced this PR's approach, so the branch was force-pushed. As I mentioned above, reading table SRVs both ways in the shader made the largest shaders too big for the NVIDIA driver's compiler. A filtered `translate --pipelines` run on the `CS_RaytracingResolve` and skinning mesh shaders gave **569** pipelines refused with `E_OUTOFMEMORY`, against **0** without the shader change. The PR now fixes it on the host instead: on NVIDIA, a structured SRV is made as a raw view of the same bytes. Raw reads then read what they name, reads by element keep their structured handle (which NVIDIA reads right on a raw view), and the shaders are unchanged. Other vendors are unchanged too. In a game run with it, the opening credits played through into the prologue with no device removal and no loop cap, and no pipelines were refused for lack of memory. Details are in the updated description. The earlier approvals were for the old version, so a fresh look would be appreciated.
Marvisak commented 2026-11-25 17:05:09 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T16:39:39Z.


Automated triage for the maintainers.

Needs work: needs the maintainer's decision, plus one small change. The head is unchanged (b9dc4b0). steven-seagull27's synthetic readback on an RTX 5080 confirms both the fix and its limit. Through 16-byte-aligned SRV origins, wrong dwords drop from 950/960 to 0/960. Unaligned origins (12, 24, 36 bytes) still misread, because buffer_srv in descriptor/host.rs keeps those views structured.

On your reply: #2885 is also open and makes structured SRVs and UAVs raw, with aligned copies for unaligned origins. The maintainer should pick one. If #2885 is chosen, this can close in its favour, as you offer. Until then, the earlier points stand:

  • The fix relies on vendor-specific driver behaviour, gated by host_vendor() == 0x10DE. That needs the maintainer's decision.
  • The commit message still names one of the title's shaders, its register and record size. Please reword it per docs/asset-policy.md, or the maintainer can squash with a new message.

CI: check passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7168335229 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2464#issuecomment-7168335229). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T16:39:39Z. --- <!-- victory-triage v1 head=b9dc4b037a87bf6919ce92eae7c79a36c0307e48 verdict=needs-work at=2026-11-26T07:22:15Z --> Automated triage for the maintainers. **Needs work: needs the maintainer's decision, plus one small change.** The head is unchanged (`b9dc4b0`). steven-seagull27's synthetic readback on an RTX 5080 confirms both the fix and its limit. Through 16-byte-aligned SRV origins, wrong dwords drop from 950/960 to 0/960. Unaligned origins (12, 24, 36 bytes) still misread, because `buffer_srv` in `descriptor/host.rs` keeps those views structured. On your reply: #2885 is also open and makes structured SRVs and UAVs raw, with aligned copies for unaligned origins. The maintainer should pick one. If #2885 is chosen, this can close in its favour, as you offer. Until then, the earlier points stand: - The fix relies on vendor-specific driver behaviour, gated by `host_vendor() == 0x10DE`. That needs the maintainer's decision. - The commit message still names one of the title's shaders, its register and record size. Please reword it per docs/asset-policy.md, or the maintainer can squash with a new message. CI: `check` passing. --- _Generated by [Claude Code](https://claude.ai/code)_
kotekompotek commented 2026-11-25 17:05:19 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T16:52:47Z.


Mechanics check out: gated to stride > 0 so raw/typed views are untouched; guards byte % 16 == 0 (raw-view alignment) and stride % 4 == 0 (so count*stride/4 is exact) before converting to R32_TYPELESS + RAW with dword FirstElement — the fallback stays structured and logs once. Vendor detection via EnumAdapterByLuid is the right way (not name matching).

The hardware rationale is plausible — a byte-offset read through a structured SRV on NVIDIA indexing by element instead would return wrong records, which explains the wind-sim loop-count corruption. WARP already behaving correctly on raw views makes the raw path the safer default on the hosts that get it right.

Note: a structured view whose first*stride isn't 16-aligned keeps the buggy NVIDIA behaviour — unavoidable without a copy, but worth remembering if a title hits it.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7168669558 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2464#issuecomment-7168669558). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-25T16:52:47Z. --- Mechanics check out: gated to `stride > 0` so raw/typed views are untouched; guards `byte % 16 == 0` (raw-view alignment) and `stride % 4 == 0` (so `count*stride/4` is exact) before converting to `R32_TYPELESS` + RAW with dword FirstElement — the fallback stays structured and logs once. Vendor detection via `EnumAdapterByLuid` is the right way (not name matching). The hardware rationale is plausible — a byte-offset read through a structured SRV on NVIDIA indexing by element instead would return wrong records, which explains the wind-sim loop-count corruption. WARP already behaving correctly on raw views makes the raw path the safer default on the hosts that get it right. Note: a structured view whose `first*stride` isn't 16-aligned keeps the buggy NVIDIA behaviour — unavoidable without a copy, but worth remembering if a title hits it.
moe-miau commented 2026-11-25 18:02:48 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by moe-miau on 2026-11-25T17:42:10Z.


Tested on an RTX 4070 SUPER (driver 32.0.16.1742, Windows 11 26300), title 1.0.2.1, Series X profile, diag build. 6-minute runs with scripted Enter presses. The stack is main 67e8ae1 + #1906 + #2098 + #2626 (RGBA8 stand-in for formats 86/115) + #2628 (capped view heap). This PR was merged on top; the only conflict was in host.rs, where both sides add a function in the same place.

device removed fps picture
stack without this PR no 0.1 (about 7.5 s a frame) black after the loading screen
stack + this PR no 0.2–1.6, mostly about 1 the world draws: night city during the opening credits, then the sunset harbour (overexposed, see below)
  • The log shows host adapter vendor vendor=0x10de and structured buffer views made raw on=true. One view stayed structured: not on 16 bytes byte=168744600 stride=100.
  • I also tried making structured UAVs raw the same way (buffer_uav, same 16-byte rule). That gave no visible difference in a 6-minute run, so I don't think this PR needs it.
  • What's still wrong in the picture: heavy overexposure and blocky bands. That fits the 141–162 WaveSize(64) compute pipelines NVIDIA still refuses here (exposure and lighting), not this PR.

AI-assisted (Claude Code); the runs were done on my machine.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7169878349 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2464#issuecomment-7169878349). Originally posted by [moe-miau](https://github.com/moe-miau) on 2026-11-25T17:42:10Z. --- Tested on an RTX 4070 SUPER (driver 32.0.16.1742, Windows 11 26300), title 1.0.2.1, Series X profile, diag build. 6-minute runs with scripted Enter presses. The stack is `main` `67e8ae1` + #1906 + #2098 + #2626 (RGBA8 stand-in for formats 86/115) + #2628 (capped view heap). This PR was merged on top; the only conflict was in `host.rs`, where both sides add a function in the same place. | | device removed | fps | picture | |---|---|---|---| | stack without this PR | no | 0.1 (about 7.5 s a frame) | black after the loading screen | | stack + this PR | no | 0.2–1.6, mostly about 1 | the world draws: night city during the opening credits, then the sunset harbour (overexposed, see below) | - The log shows `host adapter vendor vendor=0x10de` and `structured buffer views made raw on=true`. One view stayed structured: `not on 16 bytes byte=168744600 stride=100`. - I also tried making structured UAVs raw the same way (`buffer_uav`, same 16-byte rule). That gave no visible difference in a 6-minute run, so I don't think this PR needs it. - What's still wrong in the picture: heavy overexposure and blocky bands. That fits the 141–162 `WaveSize(64)` compute pipelines NVIDIA still refuses here (exposure and lighting), not this PR. AI-assisted (Claude Code); the runs were done on my machine.
lhnizdo commented 2026-11-25 19:06:11 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by lhnizdo on 2026-11-25T18:07:31Z.


Thanks @kotekompotek for the review, and @moe-miau for the RTX 4070 SUPER run. A black screen at 0.1 fps turning into the world drawing at about 1 fps is a clearer result than mine.

  • Rebased onto current main (13f91ca). The conflict was the one moe-miau saw: both sides add a function at the same place in host.rs, and both are kept.
  • The view that stays structured (byte=168744600 stride=100, not on 16 bytes) shows up in my runs too. As kotekompotek says, it keeps the old NVIDIA behaviour, and fixing it would need a copy. I've left it as a logged shortcut.
  • Structured UAVs: I'll leave those out, given moe-miau saw no difference with them.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7170473426 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2464#issuecomment-7170473426). Originally posted by [lhnizdo](https://github.com/lhnizdo) on 2026-11-25T18:07:31Z. --- Thanks @kotekompotek for the review, and @moe-miau for the RTX 4070 SUPER run. A black screen at 0.1 fps turning into the world drawing at about 1 fps is a clearer result than mine. - **Rebased** onto current `main` (13f91ca). The conflict was the one moe-miau saw: both sides add a function at the same place in `host.rs`, and both are kept. - **The view that stays structured** (`byte=168744600 stride=100`, not on 16 bytes) shows up in my runs too. As kotekompotek says, it keeps the old NVIDIA behaviour, and fixing it would need a copy. I've left it as a logged shortcut. - **Structured UAVs:** I'll leave those out, given moe-miau saw no difference with them.
frenziedcoder commented 2026-11-25 19:06:43 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by frenziedcoder on 2026-11-25T19:01:31Z.


RTX 5080 (Blackwell), driver 621.40: @moe-miau's stack with this PR draws the world here too, at about 1.5–2.5 fps, and ran the full 10 minutes with no device removal.

Setup: NVIDIA GeForce RTX 5080 16 GB (driver 621.40, 32-lane waves), AMD Ryzen 7 9800X3D, 64 GB RAM, Windows 11 Pro 26200. Title 1.0.2.1, Series X profile, diag build with --features diagnostics, VICTORY_D3D12_DRED=1, scripted Enter from 15 s to 280 s. Shader cache and pipeline library made beforehand with translate --cache --pipelines on each tree.

Tree: main 13f91ca + #1906 (a554b15) + #2098 (33a65d1) + #2626 (d1dc7ad) + #2628 (46d530a) + this PR (b9dc4b0), merged in that order. Two conflicts, both in descriptor/host.rs and neither in code: #2098's doc comment on write_address against #1906's (merged), and #2628's two new tests at the same spot as #1906's (both kept).

Runs, one each, 600 s limit:

tree end how far
main 13f91ca 0x887A0001 at 9 s menus; just before it no host texture … format: 115 (2560x1440 render target), as in #1952 / #1781
main + #2626 0x887A0006 at 85 s menus at 30 fps, then the loading screen; ~40 compute pipelines refused (0x80070057) as the world loads, then a hang in the list that was running
the stack above no removal, stopped at the 600 s limit world's first frame (1,002 draws) at frame 1,191, 47 s in; frame 2,151 at 523 s

With the stack:

  • The world draws: lit night streets and later a daylight outdoor scene, with blocky and over-bright patches like those @moe-miau describes on the 4070 SUPER.
  • Frame rate in the world: 240 frames in 153 s, then 240 in 95 s, 377 in 152 s and 103 in 76 s (about 1.5–2.5 fps). 72 slow host submissions (median 334 ms, longest 1,628 ms).
  • 171 host pipelines refused, all 0x80070057 (WaveSize(64) on a 32-lane host; @moe-miau had 166), and 8 programs whose draws are dropped because they don't translate.
  • Peak video memory 11.6 GB (whole GPU); private memory never left less than 13 GB free.

translate --cache --pipelines on this card: 25,752 of 25,985 programs translate (233 refused); of the pack's 28,164 pipelines, 23,112 made and 3,624 already in the library in 770 s with --jobs 12, 397 refused by the host (the same count on main and on the stack, close to the 394 in #2220).

Not tested: more than one run per tree; #2176 / #189 or #2118 on top; Series S profile; release build.

AI use: Claude Code (Claude Opus 5.5) merged the trees, ran the title on my machine (sandboxed at Low integrity, game folder read-only), read the logs and frame captures, and wrote this report.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7171718572 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2464#issuecomment-7171718572). Originally posted by [frenziedcoder](https://github.com/frenziedcoder) on 2026-11-25T19:01:31Z. --- **RTX 5080 (Blackwell), driver 621.40: @moe-miau's stack with this PR draws the world here too, at about 1.5–2.5 fps, and ran the full 10 minutes with no device removal.** **Setup:** NVIDIA GeForce RTX 5080 16 GB (driver 621.40, 32-lane waves), AMD Ryzen 7 9800X3D, 64 GB RAM, Windows 11 Pro 26200. Title 1.0.2.1, Series X profile, `diag` build with `--features diagnostics`, `VICTORY_D3D12_DRED=1`, scripted `Enter` from 15 s to 280 s. Shader cache and pipeline library made beforehand with `translate --cache --pipelines` on each tree. **Tree:** `main` `13f91ca` + #1906 (`a554b15`) + #2098 (`33a65d1`) + #2626 (`d1dc7ad`) + #2628 (`46d530a`) + this PR (`b9dc4b0`), merged in that order. Two conflicts, both in `descriptor/host.rs` and neither in code: #2098's doc comment on `write_address` against #1906's (merged), and #2628's two new tests at the same spot as #1906's (both kept). **Runs, one each, 600 s limit:** | tree | end | how far | |---|---|---| | `main` `13f91ca` | `0x887A0001` at 9 s | menus; just before it `no host texture … format: 115` (2560x1440 render target), as in #1952 / #1781 | | `main` + #2626 | `0x887A0006` at 85 s | menus at 30 fps, then the loading screen; ~40 compute pipelines refused (`0x80070057`) as the world loads, then a hang in the list that was running | | the stack above | **no removal**, stopped at the 600 s limit | world's first frame (1,002 draws) at frame 1,191, 47 s in; frame 2,151 at 523 s | **With the stack:** - The world draws: lit night streets and later a daylight outdoor scene, with blocky and over-bright patches like those @moe-miau describes on the 4070 SUPER. - Frame rate in the world: 240 frames in 153 s, then 240 in 95 s, 377 in 152 s and 103 in 76 s (about 1.5–2.5 fps). 72 slow host submissions (median 334 ms, longest 1,628 ms). - 171 host pipelines refused, all `0x80070057` (`WaveSize(64)` on a 32-lane host; @moe-miau had 166), and 8 programs whose draws are dropped because they don't translate. - Peak video memory 11.6 GB (whole GPU); private memory never left less than 13 GB free. **`translate --cache --pipelines` on this card:** 25,752 of 25,985 programs translate (233 refused); of the pack's 28,164 pipelines, 23,112 made and 3,624 already in the library in 770 s with `--jobs 12`, **397 refused by the host** (the same count on `main` and on the stack, close to the 394 in #2220). **Not tested:** more than one run per tree; #2176 / #189 or #2118 on top; Series S profile; release build. *AI use: Claude Code (Claude Opus 5.5) merged the trees, ran the title on my machine (sandboxed at Low integrity, game folder read-only), read the logs and frame captures, and wrote this report.*
steven-seagull27 commented 2026-11-26 02:07:10 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by steven-seagull27 on 2026-11-26T01:31:24Z.


I tested the default vendor gate on this PR and its direct parent with an overlapping-view GPU write/readback on an RTX 5080 (driver 621.40) and built-in WARP. On the RTX, this change fixed every read through the two 16-byte-aligned SRV origins. The three unaligned origins reproduced the parent’s results.

Adapter and revision SRV origins 0 and 48 bytes SRV origins 12, 24 and 36 bytes Total wrong dwords
RTX 5080, parent 13f91ca 950/960 1,425/1,440 2,375/2,400
RTX 5080, PR b9dc4b0 0/960 1,425/1,440 1,425/2,400
WARP, parent and PR (each) 0/960 0/1,440 0/2,400

Five 12-byte-stride structured UAVs at different origins write into one allocation in separate trials. For each trial five overlapping SRVs read three fields across 32 lanes. With the writer at byte 0 and reader at byte 12, lane 1 of the first field read 0xa170000c instead of 0xa1700006. The unaligned reads diverged even on fields the writer left untouched. WARP reported the raw-view gate off and the RTX reported it on.

The test-only commit on this exact PR head is available if you want to compare other adapters. With VICTORY_RAW_STRUCTURED unset, run this twice in separate processes, setting VICTORY_D3D12_WARP to 0 and 1 respectively.

cargo test --locked -p victory-gpu --lib --all-features gpu_writes_visible_through_overlapping_views -- --ignored --nocapture --test-threads=1

For the merge comparison, the same fixture on #2178 gave 544/2,400 on each adapter. Those mismatches were confined to newly written words read through a different origin. These are synthetic readbacks, independent of the in-game frame-rate runs above.

AI-assisted with Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7179855793 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2464#issuecomment-7179855793). Originally posted by [steven-seagull27](https://github.com/steven-seagull27) on 2026-11-26T01:31:24Z. --- I tested the default vendor gate on this PR and its direct parent with an overlapping-view GPU write/readback on an RTX 5080 (driver 621.40) and built-in WARP. On the RTX, this change fixed every read through the two 16-byte-aligned SRV origins. The three unaligned origins reproduced the parent’s results. | Adapter and revision | SRV origins 0 and 48 bytes | SRV origins 12, 24 and 36 bytes | Total wrong dwords | | --- | ---: | ---: | ---: | | RTX 5080, parent `13f91ca` | 950/960 | 1,425/1,440 | 2,375/2,400 | | RTX 5080, PR `b9dc4b0` | 0/960 | 1,425/1,440 | 1,425/2,400 | | WARP, parent and PR (each) | 0/960 | 0/1,440 | 0/2,400 | Five 12-byte-stride structured UAVs at different origins write into one allocation in separate trials. For each trial five overlapping SRVs read three fields across 32 lanes. With the writer at byte 0 and reader at byte 12, lane 1 of the first field read `0xa170000c` instead of `0xa1700006`. The unaligned reads diverged even on fields the writer left untouched. WARP reported the raw-view gate off and the RTX reported it on. The [test-only commit on this exact PR head](https://github.com/steven-seagull27/VIctory/commit/e1b0193a71797095f9bf30a82b9f52652509a03e) is available if you want to compare other adapters. With `VICTORY_RAW_STRUCTURED` unset, run this twice in separate processes, setting `VICTORY_D3D12_WARP` to `0` and `1` respectively. ```text cargo test --locked -p victory-gpu --lib --all-features gpu_writes_visible_through_overlapping_views -- --ignored --nocapture --test-threads=1 ``` For the merge comparison, [the same fixture on #2178](https://github.com/Marvisak/VIctory/pull/2178#issuecomment-7179707925) gave 544/2,400 on each adapter. Those mismatches were confined to newly written words read through a different origin. These are synthetic readbacks, independent of the in-game frame-rate runs above. AI-assisted with Codex.
lhnizdo commented 2026-11-26 07:01:44 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by lhnizdo on 2026-11-26T06:12:28Z.


Thanks @steven-seagull27, that's a clean measurement, and it shows exactly this PR's limit. A raw view has to start on 16 bytes, so buffer_srv only makes a structured view raw when first * stride % 16 == 0. Views at 12, 24 or 36 bytes stay structured and keep NVIDIA's misread, as your table shows.

#2885 goes further: a view off 16 bytes gets its own copy at an aligned start, and the table-bound path is lowered through raw handles too. So it should cover your unaligned origins as well. If the maintainers prefer #2885, this PR can be closed in its favour. Your fixture would be a good check of #2885's unaligned case.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7184197739 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2464#issuecomment-7184197739). Originally posted by [lhnizdo](https://github.com/lhnizdo) on 2026-11-26T06:12:28Z. --- Thanks @steven-seagull27, that's a clean measurement, and it shows exactly this PR's limit. A raw view has to start on 16 bytes, so `buffer_srv` only makes a structured view raw when `first * stride % 16 == 0`. Views at 12, 24 or 36 bytes stay structured and keep NVIDIA's misread, as your table shows. #2885 goes further: a view off 16 bytes gets its own copy at an aligned start, and the table-bound path is lowered through raw handles too. So it should cover your unaligned origins as well. If the maintainers prefer #2885, this PR can be closed in its favour. Your fixture would be a good check of #2885's unaligned case.
artor410 commented 2026-11-28 08:19:13 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by artor410 on 2026-11-28T08:19:13Z.


NVIDIA Ampere check of b9dc4b0, merged cleanly onto main 63bcca4 (tree ab6653f). RTX 3070 Ti 8 GB (Ampere, 32-lane waves, heap capped at 1,000,000), driver 610.88, Windows 11, rustc 1.98.1, hardware adapter. Synthetic tests only.

test main this PR
a_heap_buffer_read_by_element_takes_the_views_stride fail fail
a_heap_buffer_read_where_no_buffer_view_is_reads_zeros fail fail
victory-gpu lib 229 / 2 fail 229 / same 2 (#3178)
overlap probe (below) 2375 / 2400 mismatches 1425 / 2400

The stride test goes through the shader harness, not buffer_srv, so this PR cannot change its result. Probe: overlap_test::gpu_writes_visible_through_overlapping_views from #2885 (76a13e1), copied in unchanged as a probe. It writes through one structured view and reads back through views that start at other 12-byte offsets. Views that start on 16 bytes read right, but the 12/24/36-byte starts stay structured and still misread. This is the limit you described. #2885 passes the probe with 0 mismatches.

(Claude Code, Claude Opus 5.5.)

<!-- greyfinch-sync:Marvisak/VIctory:comment:7236505927 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2464#issuecomment-7236505927). Originally posted by [artor410](https://github.com/artor410) on 2026-11-28T08:19:13Z. --- NVIDIA Ampere check of `b9dc4b0`, merged cleanly onto `main` `63bcca4` (tree `ab6653f`). RTX 3070 Ti 8 GB (Ampere, 32-lane waves, heap capped at 1,000,000), driver 610.88, Windows 11, rustc 1.98.1, hardware adapter. Synthetic tests only. | test | main | this PR | |---|---|---| | `a_heap_buffer_read_by_element_takes_the_views_stride` | fail | fail | | `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros` | fail | fail | | victory-gpu lib | 229 / 2 fail | 229 / same 2 (#3178) | | overlap probe (below) | 2375 / 2400 mismatches | **1425 / 2400** | The stride test goes through the shader harness, not `buffer_srv`, so this PR cannot change its result. Probe: `overlap_test::gpu_writes_visible_through_overlapping_views` from #2885 (`76a13e1`), copied in unchanged as a probe. It writes through one structured view and reads back through views that start at other 12-byte offsets. Views that start on 16 bytes read right, but the 12/24/36-byte starts stay structured and still misread. This is the limit you described. #2885 passes the probe with 0 mismatches. (Claude Code, Claude Opus 5.5.)
hxpeerr commented 2026-11-28 21:01:40 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by hxpeerr on 2026-11-28T21:01:40Z.


#2464 and #2885 each remove the NVIDIA world-load hang on a Blackwell card, each alone on main. On main the hang is FIND-12's dispatch running a loop to the loop limit.

Machine: RTX 5060 Ti 16 GB (Blackwell, 32-lane waves, view heap capped at 1,000,000), driver 621.40, Windows 11 26200, Ryzen 7 9800X3D, stock clocks, title 1.0.2.1, Series X profile. Every run: diag build, VICTORY_D3D12_DRED=1, a fresh copy of the same saves, VICTORY_KEYS=40:Enter,45:Enter,60:Enter,70:Enter,80:Enter (boot into the story), shader cache and pipeline library made per tree with translate --cache --pipelines on this driver.

Why main hangs on this card. On main (63bcca4) all five runs ended with 0x887A0006 73-108 s after start, during the opening credits, and DRED stopped at FIND-12's 16x16x16 dispatch (W in #1968) every time. W costs the same in every frame and scales exactly with the loop limit, so one of its loops runs to the limit instead of ending:

VICTORY_SHADER_LOOP_LIMIT submissions containing W tree
default (2^20) 5,844-5,902 ms, 44 of 44 main + #3312, which survives them
65,536 359-372 ms (16x less) main + #3312
4,096 none over the 250 ms report threshold main + #3312

Video memory does not change it: with VICTORY_COPIES_IN_VIDEO_MEMORY=1 or with #3312's page tables, W alone is still 5,855-5,935 ms. W reads its loop counts with scalar loads, through raw handles, from a structured SRV with a 680-byte stride, which is the misread #2464 describes.

Each PR alone on main, default loop limit, 6-minute runs alternating between the trees (63bcca4 + #2464 b9dc4b0, 63bcca4 + #2885 76a13e1; both merge cleanly):

tree runs device removal submissions containing W over 250 ms other submissions over 250 ms (median / max) frames 1024 to 2048
main 5 5 of 5, at W every one of W's not reached
+ #2464 2 none in 360 s none 404 / 655 ms, 395 / 655 ms 3.5 fps, 4.0 fps
+ #2885 2 none in 360 s none 420 / 709 ms, 401 / 689 ms 3.4 fps, 3.6 fps

The frame rates include the world load. Both trees reach the world in the opening credits in every run, and the captures show the city at night and then the harbour. The pipeline counts from translate --pipelines are the same on main and both trees: 23,128 made, 397 refused by the host.

The one difference I see is coverage. With #2464, one view stays structured in every run (structured buffer view not made raw: not on 16 bytes, stride 100), as steven-seagull27's readback predicts. #2885 reports nothing like it. On this card, over 6 minutes, that view makes no visible difference in stability or frame cost.

No game data attached. AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7245718270 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2464#issuecomment-7245718270). Originally posted by [hxpeerr](https://github.com/hxpeerr) on 2026-11-28T21:01:40Z. --- **#2464 and #2885 each remove the NVIDIA world-load hang on a Blackwell card, each alone on `main`. On `main` the hang is FIND-12's dispatch running a loop to the loop limit.** Machine: RTX 5060 Ti 16 GB (Blackwell, 32-lane waves, view heap capped at 1,000,000), driver 621.40, Windows 11 26200, Ryzen 7 9800X3D, stock clocks, title 1.0.2.1, Series X profile. Every run: `diag` build, `VICTORY_D3D12_DRED=1`, a fresh copy of the same saves, `VICTORY_KEYS=40:Enter,45:Enter,60:Enter,70:Enter,80:Enter` (boot into the story), shader cache and pipeline library made per tree with `translate --cache --pipelines` on this driver. **Why `main` hangs on this card.** On `main` (`63bcca4`) all five runs ended with `0x887A0006` 73-108 s after start, during the opening credits, and DRED stopped at FIND-12's 16x16x16 dispatch (W in #1968) every time. W costs the same in every frame and scales exactly with the loop limit, so one of its loops runs to the limit instead of ending: | `VICTORY_SHADER_LOOP_LIMIT` | submissions containing W | tree | |---|---|---| | default (2^20) | 5,844-5,902 ms, 44 of 44 | `main` + #3312, which survives them | | 65,536 | 359-372 ms (16x less) | `main` + #3312 | | 4,096 | none over the 250 ms report threshold | `main` + #3312 | Video memory does not change it: with `VICTORY_COPIES_IN_VIDEO_MEMORY=1` or with #3312's page tables, W alone is still 5,855-5,935 ms. W reads its loop counts with scalar loads, through raw handles, from a structured SRV with a 680-byte stride, which is the misread #2464 describes. **Each PR alone on `main`**, default loop limit, 6-minute runs alternating between the trees (`63bcca4` + #2464 `b9dc4b0`, `63bcca4` + #2885 `76a13e1`; both merge cleanly): | tree | runs | device removal | submissions containing W over 250 ms | other submissions over 250 ms (median / max) | frames 1024 to 2048 | |---|---|---|---|---|---| | `main` | 5 | 5 of 5, at W | every one of W's | | not reached | | + #2464 | 2 | none in 360 s | none | 404 / 655 ms, 395 / 655 ms | 3.5 fps, 4.0 fps | | + #2885 | 2 | none in 360 s | none | 420 / 709 ms, 401 / 689 ms | 3.4 fps, 3.6 fps | The frame rates include the world load. Both trees reach the world in the opening credits in every run, and the captures show the city at night and then the harbour. The pipeline counts from `translate --pipelines` are the same on `main` and both trees: 23,128 made, 397 refused by the host. The one difference I see is coverage. With #2464, one view stays structured in every run (`structured buffer view not made raw: not on 16 bytes`, stride 100), as steven-seagull27's readback predicts. #2885 reports nothing like it. On this card, over 6 minutes, that view makes no visible difference in stability or frame cost. No game data attached. AI-assisted (Claude Code).
lhnizdo commented 2026-11-28 21:52:27 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by lhnizdo on 2026-11-28T21:52:27Z.


Thanks @hxpeerr and @artor410, these two runs pin it down from both sides.

  • The hang (RTX 5060 Ti, Blackwell): main lost the device in 5 of 5 runs at the same dispatch, a loop running to the loop limit. With this PR alone, and with #2885 alone, there was no removal in 360 s and the world was reached. That's the same loop that hung here on an RTX 2080 before this change.
  • The limit (RTX 3070 Ti, Ampere): the overlap probe goes from 2,375 to 1,425 wrong dwords of 2,400, the same split steven-seagull27 measured on a 5080. Views starting on 16 bytes read right; the 12/24/36-byte starts stay structured and still misread. #2885 gets 0 there.

So my offer stands: both fix the hang, #2885 also covers the unaligned starts, and if the maintainers pick #2885 this can close in its favour.

If this one is kept instead, the commit message still names one of the title's shaders, which the triage flagged under the asset policy. I'll reword it, or it can be squashed with a new message on merge.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7246335393 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2464#issuecomment-7246335393). Originally posted by [lhnizdo](https://github.com/lhnizdo) on 2026-11-28T21:52:27Z. --- Thanks @hxpeerr and @artor410, these two runs pin it down from both sides. - **The hang (RTX 5060 Ti, Blackwell):** `main` lost the device in 5 of 5 runs at the same dispatch, a loop running to the loop limit. With this PR alone, and with #2885 alone, there was no removal in 360 s and the world was reached. That's the same loop that hung here on an RTX 2080 before this change. - **The limit (RTX 3070 Ti, Ampere):** the overlap probe goes from 2,375 to 1,425 wrong dwords of 2,400, the same split steven-seagull27 measured on a 5080. Views starting on 16 bytes read right; the 12/24/36-byte starts stay structured and still misread. #2885 gets 0 there. So my offer stands: both fix the hang, #2885 also covers the unaligned starts, and if the maintainers pick #2885 this can close in its favour. If this one is kept instead, the commit message still names one of the title's shaders, which the triage flagged under the asset policy. I'll reword it, or it can be squashed with a new message on merge. AI-assisted (Claude Code).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2464:upstream-pr/2464'
git switch 'upstream-pr/2464'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2464'
git switch 'upstream-pr/2464'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2464'
git switch 'upstream-pr/2464'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2464'
git switch 'main'
git merge --squash 'upstream-pr/2464'
git switch 'main'
git merge --ff-only 'upstream-pr/2464'
git switch 'main'
git merge 'upstream-pr/2464'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!2462
No description provided.