Repository navigation
Conversation
DenRakEiw
left a comment
There was a problem hiding this comment.
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).
|
Heads-up before merging. In a game run, reading table SRVs both ways made the largest shaders (the materials' |
7358e04 to
238286d
Compare
|
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 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. |
|
Automated triage for the maintainers. Needs work: needs the maintainer's decision, plus one small change. The head is unchanged ( 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:
CI: Generated by Claude Code |
|
Mechanics check out: gated to 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 |
# Conflicts: # crates/victory-gpu/src/host.rs
Port of upstream PR Marvisak#2464 (claude-GTA6, AI-assisted, design from fxceless/victory-fork's raw_window). FIND-11 / upstream Marvisak#1744: a scalar or offset-only buffer read is translated as a rawBufferLoad 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, so WindNew's loop counts came from other records' data and its loops ran until the device was reset (opening-credits hang on NVIDIA). buffer_srv: on an NVIDIA host a structured SRV becomes a raw view (R32_TYPELESS + RAW) over the same bytes when they start on 16 bytes; otherwise it stays structured and logs once. VICTORY_RAW_STRUCTURED overrides the vendor check. host_vendor() reads the adapter vendor once by LUID. Shaders are unchanged: reads by element keep their structured handle, which NVIDIA and WARP read right on a raw view (AMD reads element 0, so other hosts are unchanged). No shader-cache or pipeline-library rebuild is needed. Co-authored-by: openhands <openhands@all-hands.dev>
|
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
AI-assisted (Claude Code); the runs were done on my machine. |
Scalar and offset-only buffer reads are translated as raw reads (rawBufferLoad through a raw handle, at a byte offset). On a slot that holds the title's structured view, D3D12 leaves that undefined, and NVIDIA took the byte offset as the element: the wind simulation's loop counts (WindNew CS_CopyLatestWindFieldForRenderingWithSmooth, t71, 680-byte records) were other records' data, and its loops ran until the device was reset, every run, in the opening credits. On NVIDIA hosts a structured SRV is now made as a raw view of the same bytes (starting on 16 bytes, as raw views must; others stay structured). Raw reads then read what they name, and 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. This replaces reading such slots both ways in the shaders, which made the largest shaders too much for the NVIDIA driver's compiler (569 pipelines refused with E_OUTOFMEMORY, none without it). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018sSQTeDQ6Kc6DEkgPbAww8
238286d to
b9dc4b0
Compare
|
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.
|
|
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, Tree: Runs, one each, 600 s limit:
With the stack:
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. |
|
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.
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 The test-only commit on this exact PR head is available if you want to compare other adapters. With 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. |
|
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 #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. |
Measured in the world on an RTX 2080 (1,000,000-view cap), `main` + Marvisak#2460 Marvisak#2461 Marvisak#2464 and local work, 10 minutes each from a save that loads into the world: with 65,533 dynamic slots the host ran out of them and dropped draws (512 and more, and root views); with this PR's layout before (721,469 title slots, 262,144 dynamic) none were dropped, and no draw read a title slot past the kept ones (523,715 left out, all for_draw=false). Back to that layout until a scene needs more title slots. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018sSQTfPXZpSkjMMNa7RB5G
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:
rawBufferLoadthrough 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_CopyLatestWindFieldForRenderingWithSmoothreads its loop counts that way, fromt71(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):VICTORY_RAW_STRUCTURED=0or=1overrides 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 theCS_RaytracingResolveand skinning mesh shaders: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:
victory-gputests are unchanged againstmain.🤖 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: Claudeline.