Shaders: follow paired dword mask copies #702

Open
Flyander wants to merge 1 commit from upstream-pr/702 into main
Flyander commented 2026-11-25 05:03:19 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Flyander on 2026-11-25T05:03:19Z.


Summary

Track lane-mask provenance when two adjacent s_mov_b32 instructions copy the low and high dwords into an adjacent SGPR pair in the same block. The source pair is reused only when its symbolic mask contains no opaque atoms, so unknown values remain conservative.

Adds a positive regression test and a negative test for unknown source values.

Retail shader pack results

Windows 11, RTX 5070 Ti, VICTORY_HOST_WAVE=32, victory translate --validate --pipelines --list --jobs 8:

  • “lane mask holding lanes elsewhere read as data”: 2 failures → 0
  • “opaque lane mask”: 1 failure → 0
  • validated programs: 25,383 → 25,386
  • pipelines created: 25,571 → 25,572

The previously failing PS_VoxelizeVisiblity variant now emits, validates, and creates a host pipeline. Two volumetric water shaders now emit and validate too. Their default D3D12 pipeline creation is still refused on this 32-lane host.

Targeted integration with #695

I stacked this commit locally on #695's e5b43c4 head. With global VICTORY_WAVE_WIDE unset and VICTORY_WAVE_WIDE_ONLY=6871d6e4b3ac9a10,926c46bab3b86bd6, both newly unblocked water shaders create pipelines and validate.

Negative control: the unlisted CS_TransmissionVolumetrics_Tiled shader (5dc3b25986622949) validates but its pipeline remains refused. This confirms the per-hash setting does not enable the wide form for unlisted programs. These are targeted offline checks; no in-game visual comparison was made.

Checks

  • cargo test -p victory-shader --lib --locked: 216 passed, 3 ignored
  • cargo clippy -p victory-shader --all-targets --locked -- -D warnings: clean
  • Release build of the local #695 + this-PR stack succeeded (one victory-gpu dead-code warning)
  • git diff --check: clean
<!-- greyfinch-sync:fxceless/victory-fork:issue:6597598928 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/702). Originally posted by [Flyander](https://github.com/Flyander) on 2026-11-25T05:03:19Z. --- ## Summary Track lane-mask provenance when two adjacent `s_mov_b32` instructions copy the low and high dwords into an adjacent SGPR pair in the same block. The source pair is reused only when its symbolic mask contains no opaque atoms, so unknown values remain conservative. Adds a positive regression test and a negative test for unknown source values. ## Retail shader pack results Windows 11, RTX 5070 Ti, `VICTORY_HOST_WAVE=32`, `victory translate --validate --pipelines --list --jobs 8`: - “lane mask holding lanes elsewhere read as data”: 2 failures → 0 - “opaque lane mask”: 1 failure → 0 - validated programs: 25,383 → 25,386 - pipelines created: 25,571 → 25,572 The previously failing `PS_VoxelizeVisiblity` variant now emits, validates, and creates a host pipeline. Two volumetric water shaders now emit and validate too. Their default D3D12 pipeline creation is still refused on this 32-lane host. ## Targeted integration with #695 I stacked this commit locally on #695's `e5b43c4` head. With global `VICTORY_WAVE_WIDE` unset and `VICTORY_WAVE_WIDE_ONLY=6871d6e4b3ac9a10,926c46bab3b86bd6`, both newly unblocked water shaders create pipelines and validate. Negative control: the unlisted `CS_TransmissionVolumetrics_Tiled` shader (`5dc3b25986622949`) validates but its pipeline remains refused. This confirms the per-hash setting does not enable the wide form for unlisted programs. These are targeted offline checks; no in-game visual comparison was made. ## Checks - `cargo test -p victory-shader --lib --locked`: 216 passed, 3 ignored - `cargo clippy -p victory-shader --all-targets --locked -- -D warnings`: clean - Release build of the local #695 + this-PR stack succeeded (one `victory-gpu` dead-code warning) - `git diff --check`: clean
JRamos1993 commented 2026-11-25 06:06:41 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by JRamos1993 on 2026-11-25T05:54:52Z.


Offline check on the retail shader pack: your result reproduces.

victory translate --validate --list over the title's full shader pack on an RTX 5090, main 310c6eb against this head merged onto it, default settings:

  • 25,382 → 25,385 validated (the 2 "lane mask holding lanes elsewhere read as data" programs and the 1 "opaque lane mask"). None lost.
  • With a local DXIL hash on each validated line, 2 other programs' DXIL changes; both still validate.

AI use: Claude Code with Claude Opus 5.5 ran the pack and wrote this. Nothing from the title is in it.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7154259274 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/702#issuecomment-7154259274). Originally posted by [JRamos1993](https://github.com/JRamos1993) on 2026-11-25T05:54:52Z. --- **Offline check on the retail shader pack: your result reproduces.** `victory translate --validate --list` over the title's full shader pack on an RTX 5090, `main` `310c6eb` against this head merged onto it, default settings: - 25,382 → **25,385 validated** (the 2 "lane mask holding lanes elsewhere read as data" programs and the 1 "opaque lane mask"). None lost. - With a local DXIL hash on each validated line, **2 other programs' DXIL changes**; both still validate. AI use: Claude Code with Claude Opus 5.5 ran the pack and wrote this. Nothing from the title is in it.
Dathinel commented 2026-11-25 23:09:59 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Dathinel on 2026-11-25T22:57:15Z.


Synthetic numerical A/B on RTX 3050 Laptop, native wave32. On the local Series S base with the allocator from #561 and the backward permute path from #1166 held fixed, adding only this PR's structure.rs change fixes 18 wrong output words in a wave64 group of 64 threads. Both variants emitted DXIL.

Reproducer: initialize v1 to 42, save EXEC, narrow EXEC to thread IDs below 47, save that mask in s[20:21], restore full EXEC, copy s20 and s21 into s22 and s23 with separate s_mov_b32 instructions, then restore EXEC from s[22:23]. Run ds_bpermute_b32 with address 4*(tid+33) and source tid, restore full EXEC, and store v1 by thread ID. Before: lane 46 reads 47 from an inactive source instead of 0, and lanes 47–63 overwrite the sentinel. After: all 160 words across 16/33/47/64-thread groups match the expected values. The smaller groups also pass before the change.

Run 278 in the public diagnostics records hash 926c46bab3b86bd6 failing mask translation; this test exercises the paired-copy behavior independently. No visual or performance measurement. AI-assisted.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7176977588 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/702#issuecomment-7176977588). Originally posted by [Dathinel](https://github.com/Dathinel) on 2026-11-25T22:57:15Z. --- Synthetic numerical A/B on RTX 3050 Laptop, native wave32. On the local Series S base with the allocator from #561 and the backward permute path from #1166 held fixed, adding only this PR's structure.rs change fixes 18 wrong output words in a wave64 group of 64 threads. Both variants emitted DXIL. Reproducer: initialize v1 to 42, save EXEC, narrow EXEC to thread IDs below 47, save that mask in s[20:21], restore full EXEC, copy s20 and s21 into s22 and s23 with separate s_mov_b32 instructions, then restore EXEC from s[22:23]. Run ds_bpermute_b32 with address 4*(tid+33) and source tid, restore full EXEC, and store v1 by thread ID. Before: lane 46 reads 47 from an inactive source instead of 0, and lanes 47–63 overwrite the sentinel. After: all 160 words across 16/33/47/64-thread groups match the expected values. The smaller groups also pass before the change. Run 278 in the public diagnostics records hash 926c46bab3b86bd6 failing mask translation; this test exercises the paired-copy behavior independently. No visual or performance measurement. AI-assisted.
Luigilt20 commented 2026-11-26 05:05:54 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Luigilt20 on 2026-11-26T04:40:32Z.


I also tested this change in the Neptune tree at LooperSalty/AnyXboxX@c4c93bd. The structure.rs change applies cleanly. I built the original and patched translation tools and ran the same compute programs through both on Windows 11 using the Windows SDK DXIL validator (dxil.dll 1.9.2602.17).

Selected programs Original, emitted and validated Patched, emitted and validated
Two transmission-volumetrics compute variants 0/2 2/2
Vertex control 1/1 1/1
Five shadow compute variants with a separate descriptor diagnostic 0/5 0/5

Both focused Rust tests for paired DWORD mask provenance also passed on the isolated Neptune test build. This is an offline compiler result. GPU pipeline creation, water appearance and frame rate were outside this measurement. AI-assisted testing and reporting with Codex.

Full-pack follow-up on the same Neptune build and validator, six CPU threads. Of 26,084 programs, 25,687 → 25,689 emitted and 25,616 → 25,618 validated. The two water compute variants were the only gains. Across the 25,889 individually listed programs, none lost either emission or validation. Another 195 export-stage programs had no individual result in either run. No GPU pipelines were created.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7182803294 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/702#issuecomment-7182803294). Originally posted by [Luigilt20](https://github.com/Luigilt20) on 2026-11-26T04:40:32Z. --- I also tested this change in the Neptune tree at LooperSalty/AnyXboxX@c4c93bd. The `structure.rs` change applies cleanly. I built the original and patched translation tools and ran the same compute programs through both on Windows 11 using the Windows SDK DXIL validator (dxil.dll 1.9.2602.17). | Selected programs | Original, emitted and validated | Patched, emitted and validated | | --- | ---: | ---: | | Two transmission-volumetrics compute variants | 0/2 | 2/2 | | Vertex control | 1/1 | 1/1 | | Five shadow compute variants with a separate descriptor diagnostic | 0/5 | 0/5 | Both focused Rust tests for paired DWORD mask provenance also passed on the isolated Neptune test build. This is an offline compiler result. GPU pipeline creation, water appearance and frame rate were outside this measurement. AI-assisted testing and reporting with Codex. Full-pack follow-up on the same Neptune build and validator, six CPU threads. Of 26,084 programs, 25,687 → 25,689 emitted and 25,616 → 25,618 validated. The two water compute variants were the only gains. Across the 25,889 individually listed programs, none lost either emission or validation. Another 195 export-stage programs had no individual result in either run. No GPU pipelines were created.
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/702:upstream-pr/702'
git switch 'upstream-pr/702'

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/702'
git switch 'upstream-pr/702'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/702'
git switch 'upstream-pr/702'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/702'
git switch 'main'
git merge --squash 'upstream-pr/702'
git switch 'main'
git merge --ff-only 'upstream-pr/702'
git switch 'main'
git merge 'upstream-pr/702'
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
fxceless/victory-fork!702
No description provided.