Shaders: the code table starts after the instructions (fixes RTX 5090 Xid 13; port of Marvisak/VIctory#2143) #1006
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!1006
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@OctoAlgo on GitHub · 2026-11-25 15:53 UTC · original
OctoAlgo:fix/code-table-after-instructions→main· +49 −7 · 1 files · 1 commits · openFixes #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
@Ym1r1710 on GitHub · 2026-11-25 16:04 UTC · original
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.
@ThomasHFWright on GitHub · 2026-11-25 16:40 UTC · original · edited 2026-11-25 16:52 UTC
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.
@ArturoWolff on GitHub · 2026-11-25 19:02 UTC · original · edited 2026-11-25 19:08 UTC
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)
@tylerstraub on GitHub · 2026-11-26 06:55 UTC · original
Confirming on a second RTX 5090, on a different fork (trustno1-coder/VIctory-NVIDIA, 0a43566 line), 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 plus
VKD3D_DISABLE_EXTENSIONS=VK_NV_raw_access_chains, there were no GPU errors through 20+ minutes of gameplay. (Applied together, not yet A/B'd.)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.