Shaders: the code table starts after the instructions (fixes RTX 5090 Xid 13; port of Marvisak/VIctory#2143) #1004
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1006"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from fxceless/victory-fork. Originally posted by OctoAlgo on 2026-11-25T15:53:28Z.
Fixes #861.
Problem
On an RTX 5090 (GB202), this fork faults at every world entry (Linux, Proton, vkd3d-proton, NVIDIA 620.73.04): NVRM Xid 13, "SM Warp Exception: MMU Fault", shader writes to unmapped GPU addresses. The same build runs clean on an RTX 5070 Ti in the same PC. On other NVIDIA cards the same cause costs video memory instead: Marvisak/VIctory#2143 reports GBs of VRAM reserved on an RTX 5080.
Cause
code_dword(crates/victory-shader/src/emit/lower.rs) turns the program's code, starting at the lowest offset any load or descriptor names, into a constant array. A load at a computed offset names offset 0, so the array is the whole program. In 12 lighting computes reached at world entry, that is 4160–4596 dwords (16.3–18 KiB).Under vkd3d-proton the array becomes a private one. NVIDIA's compiler keeps up to 16 KiB of such arrays in constant memory and copies a bigger one into each thread's local memory: 16–18 KB per thread in those 12 shaders. On GB202 this local memory faults.
Change
This is a port of Marvisak/VIctory#2143 by @desplmfao: its two commits squashed into one, with desplmfao kept as the author. The only difference from upstream is the test module's import list.
The table now starts where the instructions end, because the program's constants follow its instructions and a computed load reads them. It keeps the old start if a load at a fixed offset reads below the end. A computed index below the start is clamped like one past the end, as before.
No follow-up change was needed. A 15-minute run logged all 1149 code-table reads in 114 programs:
s_getpc_b64+ literal table base, as the translator computes it, sits at or after the instructions' end.Evidence (RTX 5090 + RTX 5070 Ti, one PC)
Testing
cargo test -p victory-shader --lib(Linux host): 172 passed, 2 ignored, including #2143'sthe_code_table_starts_after_the_instructions.cargo build --locked --target x86_64-pc-windows-msvc --release -p victory(cross-built with xwin): OK. Also--profile diag --features diagnostics.--profile diag --features diagnostics, with this PC's Linux-only additions on top (not part of this PR): the DXC fallback from #20 and theVICTORY_NO_WATCHDOGloader hook.Credit for the fix goes to @desplmfao (Marvisak/VIctory#2143).
(Investigated and prepared with an AI coding assistant; all numbers are from runs on this PC.)
🤖 Generated with Claude Code
Imported from fxceless/victory-fork. Originally posted by Ym1r1710 on 2026-11-25T16:04:23Z.
Ran this on an RTX 5080 16 GB, Windows 11 (native D3D12, not Proton), on top of current main plus a few open PRs.
No faults before or after on this card, so I can't say anything about the Xid itself. What I can say: the picture in the first cell is the same as without it (lit the same, window and walls unchanged), frame time is within run to run noise (~155-170 ms either way), and video memory in use was the same in both runs, 12.4 GB per the memory line. So at least on Windows I don't see the multi-GB reservation from #2143 going away or coming back, it just doesn't show up here.
Keeping it in my build since it removes the 16-18 KB local arrays and costs nothing that I can measure.
Imported from fxceless/victory-fork. Originally posted by ThomasHFWright on 2026-11-25T16:40:39Z.
Independent positive result on CachyOS, RTX 5090, NVIDIA 620.73.04 and GE-Proton 11-14, testing the exact change at
4e7af7b013.Before this change, the immediately preceding build hit Xid 13 at world entry after 131 seconds. With this change, the run lasted 583.74 seconds with no NVIDIA Xid and produced textured in-world characters, floor geometry and lighting for the first time in this investigation. It eventually exited with a title breakpoint (0x80000003), so this is not a claim of complete stability or playable performance. Frame times remained highly variable.
The captured production SPIR-V confirms two private tables shrinking from 18,368 to 632 bytes and from 16,640 to 616 bytes. Each new initializer matches the corresponding old table's trailing data exactly.
Checks: native shader suite 179 passed / 2 ignored; Windows shader suite 225 passed / 1 existing stub-pipeline failure / 3 ignored; diagnostic cross-build and Clippy passed. Restoring the old table-start rule makes the new regression fail.
Context: this is atop existing Linux descriptor/subresource corrections. Runtime is vkd3d-proton cae8353e with local allocator/null-CBV fixes and a patched DXIL converter. Those fixes were also present in the preceding failing run. Normal shaders and default loop limits; watchdog disabled; Vulkan core/synchronization validation enabled. A repeat with the same executable/runtime and validation disabled lasted 534.58 seconds, again rendered world scenes without Xid, then hit the same title breakpoint. Memory/swap-limit and OOM counters remained zero; memory pressure was substantial, but allocation failure is not established as the assertion's cause.
Imported from fxceless/victory-fork. Originally posted by ArturoWolff on 2026-11-25T19:02:35Z.
Incremental asset-free regression on the receiving fork, before attempting another physical-GPU run:
c5820acd4fc24a387396dc6ccef051115cbe9813(#1056) with the exact delta from this PR at4e7af7b01356417864b935bd1fffc7d0dece266f. The delta applies cleanly. Credit to @desplmfao (Marvisak/VIctory#2143) and @OctoAlgo for the port.In addition to this PR's table-start helper test, I exercised the actual
Lower::code_dwordallocation path with a synthetic 4,251-dword instruction prefix, 160 dwords of trailing constants, and controlled CODE resource addresses. No title assets, driver pipeline creation, or GPU dispatch involved.The baseline regression failed at the expected table extent assertion (17,644 bytes vs expected 640). Patched full native
cargo test --locked --offline -p victory-shader --lib: 173 passed, 0 failed, 2 ignored, including the upstream test and this additional witness. Rust 1.98.1 on Linux. This tests the emitter's table extent, not driver local-memory allocation or correctness of executed loads. The fixed-read case is deliberately preserved.The motivation is our separate Linux/Proton DXC integration test on #20. This makes #1006 a candidate for that integration, but it does not establish that the RTX 4060 host hang reported on #20 shares the RTX 5090 Xid mechanism. No new gameplay, FPS or hardware stability claim.
Integration follow-up: this exact #1006 delta also cross-builds cleanly on
c5820ac+ #830 (951dc00) + #20 (d4a36b1, manifest-only context adaptation). Rust 1.98.1, locked/offline GNU/LLVM Windows diagnostics release. On a separately linkedvictory-gpu --libtest executable from the integrated tree, the strict production argument-clamp witness still behaves as expected under GE-Proton11-14 / llvmpipe 26.3.1: with the Wine builtin compiler forced and no DXC DLLs, actual FL11_0 device creation succeeds but clamp construction fails (0x8007007E, test exit 101); with DXC DLLs, the production root signature and PSO are created (1 passed, exit 0). Separate copies of the same software-only prefix, identical test executable; no physical GPU or title files exposed. This is integration compatibility evidence only. Marvisak/VIctory#144 and #2723 describe another converter/handle-typing problem that still deserves separate testing before a physical NVIDIA run.AI assistance: Hermes Agent, working on behalf of ArturoWolff. (GPT 6.2 Sol High)
Imported from fxceless/victory-fork. Originally posted by tylerstraub on 2026-11-26T06:55:49Z.
Confirming on a second RTX 5090, on a different fork (trustno1-coder/VIctory-NVIDIA,
0a43566line), Linux/Proton Experimental, NVIDIA 595.99.02: without this change the world entry hung every time, showing as Xid 109 only rather than Xid 13. With a hand port of this fix plusVKD3D_DISABLE_EXTENSIONS=VK_NV_raw_access_chains, there were no GPU errors through 20+ minutes of gameplay. (Applied together, not yet A/B'd.)Imported from fxceless/victory-fork. Originally posted by Filip722 on 2026-11-27T07:47:23Z.
I carried the source change from
4e7af7bonto current fork main9a9091dwith the code-table regression in the current test module. The focused code-table test passed under GE-Proton11-14 and vkd3d-proton 3.2.0 on Bazzite, with an RTX 5060 Laptop (8 GiB), driver 615.78.08.The known #861 report was an MMU fault. This laptop reproduced a different subtype, Xid 13
SKEDCHECK36_DEPENDENCE_COUNTER_UNDERFLOWwith D3D120x887A0005, both before and after this change. Both replays used bounded compute waits and identical starting native caches. This comparison effectively used cold shader translations because the offline seed missed the runtime cache key. The patched arm submitted more world draws and survived longer, but its output stayed black and it eventually had the same subtype. This leaves the #861 fix and the 5060 failure as separate observations.Assisted by Codex (GPT-6.2-Sol High).
Imported from fxceless/victory-fork. Originally posted by OctoAlgo on 2026-11-27T08:22:15Z.
Thanks for carrying it forward and for the careful before/after. Agreed: the 5060's Xid 13
SKEDCHECK36_DEPENDENCE_COUNTER_UNDERFLOWwith0x887A0005shows with and without this change, so it looks like a separate problem from #861's MMU fault.I've rebased the branch onto current main (
9a9091d18), so it merges cleanly again. The only conflict was the test module moving out oflower.rs; the regression test now sits inemit/lower_tests.rs. It passes here (run natively on Linux, with the Windows-only validator test left out), and the test build for the Windows target compiles.If you have a recipe for the 5060 case, we can run it on an RTX 5090 and an RTX 5070 Ti under Proton to see whether that subtype shows up on desktop cards.
Imported from fxceless/victory-fork. Originally posted by OctoAlgo on 2026-11-27T15:57:28Z.
main was replaced today (
5dbf5ce22, the tree of trustno1-coder/VIctory-NVIDIA959dcaf; now919578001), so this PR conflicted. The fix is still missing on the new main:code_dwordincrates/victory-shader/src/emit/lower.rsstill builds the code table from the lowest offset any load names, so a load at a computed offset makes the table the whole program (16-18 KiB private arrays on the lighting computes; Xid 13 on an RTX 5090 under vkd3d-proton, and GBs of VRAM reserved on other cards).I re-ported it onto
919578001and updated the branch. Thelower.rschange is the same as before (desplmfao's fix from Marvisak/VIctory#2143). This tree has nolower_tests.rs, so the regression testthe_code_table_starts_after_the_instructionsnow sits in emit's own test module andcode_table_startispub(super)for it.Run on Linux:
cargo test -p victory-shader --lib206 passed, 0 failed (the new test included);cargo check --target x86_64-pc-windows-msvc -p victory-shader --testsclean.One data point from today on another fork that lacks the fix (edsuuu/VI-BR-PORT
main), RTX 5090, Proton 11: 94 Xid 13 at 78 s after start and the world never loads; with this patch applied unchanged, no Xid in any later run. We have not yet run the new main itself on the 5090; that run is next and I'll report it here.Imported from fxceless/victory-fork. Originally posted by OctoAlgo on 2026-11-27T16:58:44Z.
Follow-up as promised: fork main
919578001plus this fix under Proton on the RTX 5090 (CachyOS, NVIDIA 620.73.04, Series X profile).E5005: Method 'InterlockedOr' is not defined on type 'RWByteAddressBuffer'), indirect executions are dropped, and the GPU hangs at the third world frame (Xid 109, device removed). With a DXC fallback for that one shader it plays, at about 2.6 fps. One run each.I'll send those two as separate small PRs.
(written with AI assistance)
Imported from fxceless/victory-fork. Originally posted by OctoAlgo on 2026-11-27T18:29:02Z.
Update on the two follow-ups mentioned above:
(written with AI assistance)
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.