Folded code tables stop before the VGPR-bases trailer (Xid 13 at world entry) #3695

Open
github-bot wants to merge 1 commit from github-bot/gh-3695 into main AGit
Owner

@⁠stasadance on GitHub · 2026-11-30 04:12 UTC · original
stasadance:fix/fold-code-table-trailer → main · +17 −0 · 2 files · 1 commits · open

Fixes #3050, #3358

What it changes

A folded wave64 program's code ends with its VGPR-bases trailer. A constant table the shader reads by lane index (code_dword) was taken from its start to the end of the code, so it took that trailer in too: for c1eee35dbc50a9ef that was 16,579 dwords instead of 69. NVIDIA puts a table that size in per-thread local memory, and the dispatch faults: Xid 13 at world entry.

The table now stops before the trailer (fold.rs records where the trailer starts, lower.rs bounds the table there). Unfolded programs are unchanged.

How it was tested

  • GPU and profile: RTX 4090 on Linux (NVIDIA 620.73.04, kron4ek Wine 11.23, vkd3d-proton GE cae8353ed), Series S profile, DLSS + frame generation
  • Before: Xid 13 (device lost) on entering the world, every run.
  • After: several sessions in-world with no Xid and clean exits.
  • For shader changes, the wave sizes tested: 64 lanes folded (the path changed); 32 unchanged.
  • cargo test passed for the crates it touches: yes, cargo test -p victory-shader --lib (Linux host: 295 passed; the Windows-only emit tests not run). Windows clippy reports the same 4 errors as current main (lower/analysis.rs, lower.rs:594, native.rs:1655), none in this diff.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #1880 (table start bound, merged), #2916 (also edits code_dword), #3427 and #2278 (folding hangs / Xid 13, possibly the same oversized table).
**@⁠stasadance** on GitHub · 2026-11-30 04:12 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3695) `stasadance:fix/fold-code-table-trailer` → `main` · +17 −0 · 2 files · 1 commits · open Fixes #3050, #3358 ## What it changes A folded wave64 program's code ends with its VGPR-bases trailer. A constant table the shader reads by lane index (`code_dword`) was taken from its start to the end of the code, so it took that trailer in too: for `c1eee35dbc50a9ef` that was 16,579 dwords instead of 69. NVIDIA puts a table that size in per-thread local memory, and the dispatch faults: Xid 13 at world entry. The table now stops before the trailer (`fold.rs` records where the trailer starts, `lower.rs` bounds the table there). Unfolded programs are unchanged. ## How it was tested - GPU and profile: RTX 4090 on Linux (NVIDIA 620.73.04, kron4ek Wine 11.23, vkd3d-proton GE cae8353ed), Series S profile, DLSS + frame generation - Before: Xid 13 (device lost) on entering the world, every run. - After: several sessions in-world with no Xid and clean exits. - For shader changes, the wave sizes tested: 64 lanes folded (the path changed); 32 unchanged. - `cargo test` passed for the crates it touches: yes, `cargo test -p victory-shader --lib` (Linux host: 295 passed; the Windows-only emit tests not run). Windows clippy reports the same 4 errors as current main (`lower/analysis.rs`, `lower.rs:594`, `native.rs:1655`), none in this diff. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #1880 (table start bound, merged), #2916 (also edits `code_dword`), #3427 and #2278 (folding hangs / Xid 13, possibly the same oversized table).
A folded wave64 program's code ends with its VGPR-bases trailer. A code
table read by a lane index ran to the end of the code and took the trailer
in (c1eee35dbc50a9ef: 16,579 dwords instead of 69), which NVIDIA puts in
per-thread local memory: Xid 13 at world entry.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 04:16:44 +00:00
Author
Owner

@⁠VibeCodeGuy on GitHub · 2026-11-30 23:04 UTC · original

Offline corpus check (every shader container in a v1.0.2.1 dump: 25,699 unique programs), main e1251c31 against main + this PR at 3aa991c3.

  • Newly failing: 0. Newly passing: 0.
  • DXIL output changed: 8 programs (8 Cs); 8 of them pass the validator.
The 8 changed programs
  • c1eee35dbc50a9ef Cs GpuParticleUpdate:CS_UpdateSkinnedAttachMeshTreeParticles
  • 6b638f32efd6f858 Cs InstanceCulling:CS_Tree_BatchCullReflect
  • da96a8117d87567a Cs InstanceCulling:CS_Tree_BatchNoCull
  • 0a5d4f9047b3dce4 Cs indirect_light_probes:CS_IrradianceCache_IntegrateIrradianceSH
  • b2711644ca5566cc Cs scattering_transmittance_system:CS_Gather
  • 0903802745985664 Cs scattering_transmittance_system:CS_Gather_Reference
  • 0ffd3b911e35e7d0 Cs sr_denoising:CS_TemporalResolve1_Opaque_FrameStatistics
  • 6547aeeef562cc81 Cs sr_denoising:CS_TemporalResolve1_Opaque

How: victory translate <dump> --validate --list built for each side (release, cross-built with cargo-xwin, run under Wine), VICTORY_HOST_WAVE=32, plus the four shader-cache-key settings play starts with (VICTORY_EARLY_DEPTH=1, VICTORY_NAN_SCRUB=1, VICTORY_BVH_MISS=1, VICTORY_SAMPLED_MARKS=1). Validator: dxil.dll from DXC v1.9.2609. "Changed" compares translate's emitted hash of each module and its bindings. There was no GPU on this side, so no host pipelines were made and nothing was run on a card. On main the same run has 72 failures: 71 mesh programs over the 32 KiB output limit (the known shortcut in mesh_prologue) and CS_TraceShadowRays_FullAdaptive (#2993).

**@⁠VibeCodeGuy** on GitHub · 2026-11-30 23:04 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3695#issuecomment-7294671970) **Offline corpus check** (every shader container in a v1.0.2.1 dump: 25,699 unique programs), `main` e1251c31 against `main` + this PR at 3aa991c3. - Newly failing: **0**. Newly passing: **0**. - DXIL output changed: **8** programs (8 Cs); 8 of them pass the validator. <details><summary>The 8 changed programs</summary> - `c1eee35dbc50a9ef` Cs `GpuParticleUpdate:CS_UpdateSkinnedAttachMeshTreeParticles` - `6b638f32efd6f858` Cs `InstanceCulling:CS_Tree_BatchCullReflect` - `da96a8117d87567a` Cs `InstanceCulling:CS_Tree_BatchNoCull` - `0a5d4f9047b3dce4` Cs `indirect_light_probes:CS_IrradianceCache_IntegrateIrradianceSH` - `b2711644ca5566cc` Cs `scattering_transmittance_system:CS_Gather` - `0903802745985664` Cs `scattering_transmittance_system:CS_Gather_Reference` - `0ffd3b911e35e7d0` Cs `sr_denoising:CS_TemporalResolve1_Opaque_FrameStatistics` - `6547aeeef562cc81` Cs `sr_denoising:CS_TemporalResolve1_Opaque` </details> How: `victory translate <dump> --validate --list` built for each side (release, cross-built with cargo-xwin, run under Wine), `VICTORY_HOST_WAVE=32`, plus the four shader-cache-key settings `play` starts with (`VICTORY_EARLY_DEPTH=1`, `VICTORY_NAN_SCRUB=1`, `VICTORY_BVH_MISS=1`, `VICTORY_SAMPLED_MARKS=1`). Validator: `dxil.dll` from DXC v1.9.2609. "Changed" compares translate's `emitted` hash of each module and its bindings. There was no GPU on this side, so no host pipelines were made and nothing was run on a card. On `main` the same run has 72 failures: 71 mesh programs over the 32 KiB output limit (the known shortcut in `mesh_prologue`) and `CS_TraceShadowRays_FullAdaptive` (#2993).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/3695/head:github-bot/gh-3695'
git switch 'github-bot/gh-3695'

Merge

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