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

Open
stasadance wants to merge 1 commit from upstream-pr/3695 into main
stasadance commented 2026-11-30 04:12:52 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by stasadance on 2026-11-30T04:12:52Z.


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).
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5558843333 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3695). Originally posted by [stasadance](https://github.com/stasadance) on 2026-11-30T04:12:52Z. --- 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).
VibeCodeGuy commented 2026-11-30 23:04:15 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by VibeCodeGuy on 2026-11-30T23:04:15Z.


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).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7294671970 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3695#issuecomment-7294671970). Originally posted by [VibeCodeGuy](https://github.com/VibeCodeGuy) on 2026-11-30T23:04:15Z. --- **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 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/3695:upstream-pr/3695'
git switch 'upstream-pr/3695'

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/3695'
git switch 'upstream-pr/3695'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3695'
git switch 'upstream-pr/3695'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3695'
git switch 'main'
git merge --squash 'upstream-pr/3695'
git switch 'main'
git merge --ff-only 'upstream-pr/3695'
git switch 'main'
git merge 'upstream-pr/3695'
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
trustno1-coder/VIctory-NVIDIA!3695
No description provided.