Recompiler: preserve interleaved packed VS input components #306

Open
likecrank-dotcom wants to merge 2 commits from upstream-pr/309 into main
likecrank-dotcom commented 2026-11-23 23:05:01 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by likecrank-dotcom on 2026-11-23T23:05:01Z.


Stacked on #297. Only the top commit (a039d33) is mine; the first commit is #297's packed-input implementation by TG0000, replayed onto current main without its older documentation/workflow ancestry.

With TEXCOORD0.xz and TEXCOORD1.y sharing r1, selecting an input by its first-to-last component span makes TEXCOORD0 shadow TEXCOORD1.y. A synthetic GPU draw produces [0.25, -0.4, 0.75, 0] instead of [0.25, 0.5, 0.75, 0]. Select packed fields by their actual component mask. Inputs alone in their register retain the existing four-component behavior.

What is in it

  • emit.rs: retain the owned component mask in VsInputField and use it when selecting the fetch-shader VGPR source.
  • tests.rs: a GPU regression adapted from #297's packed-input test, with interleaved masks 0x5 / 0x2, distinct values for the overlapping component, and per-pixel output checks.

Tested

  • Ryzen 5 3600, RTX 5060 Ti, NVIDIA 621.14 / 32.0.16.2114, 32 GB RAM; Windows 11 Pro 10.0.26300; Rust 1.100.0 MSVC, MSVC 19.44, SDK 10.0.26100.0, DXC 1.9.2602.17; debug.
  • #297 head a5b7825: cargo build --workspace and cargo test --workspace -- --test-threads=4 --nocapture: 653 passed, 0 failed, 40 ignored.
  • The added interleaved-mask GPU test on that head without this fix: 1 failed, exit 101, wrong pixel value as above. With this fix: 1 passed, exit 0.
  • Clean head a039d336837920a2bdbf028ff207b4cab3181916: cargo build --workspace, then cargo test --workspace -- --test-threads=4 --nocapture: exit 0; 654 passed, 0 failed, 40 ignored (lib: 614/0/20), including the synthetic-title end-to-end test. git diff --check passes.
  • Four explicit skips: two no-wave64 tests (gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware), test_title_draws_with_a_root_signature_under_the_debug_layer (no d3d12SDKLayers.dll), and uploads_start_from_each_subresources_state (no D3D12 debug layer).

Regression run
Not run on a retail title. This is a draft pending the real-title main/head smoke runs required by CONTRIBUTING.md.

Not tested

  • No retail title or game-data samples; no claim that a particular title uses interleaved masks or that gameplay improves.
  • AMD, Intel, wave64, Wine, and debug-layer validation.
  • The separate zero-mask edge case is not addressed.

AI use
Codex reproduced the GPU failure, wrote the fix and adapted regression, ran the commands, and prepared this description. The exact deployed model identifier is not exposed in this session. No claim of human code review is made.

<!-- greyfinch-sync:ivall/xcl:issue:5462778877 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/309). Originally posted by [likecrank-dotcom](https://github.com/likecrank-dotcom) on 2026-11-23T23:05:01Z. --- Stacked on #297. Only the top commit (`a039d33`) is mine; the first commit is #297's packed-input implementation by TG0000, replayed onto current main without its older documentation/workflow ancestry. With TEXCOORD0.xz and TEXCOORD1.y sharing r1, selecting an input by its first-to-last component span makes TEXCOORD0 shadow TEXCOORD1.y. A synthetic GPU draw produces `[0.25, -0.4, 0.75, 0]` instead of `[0.25, 0.5, 0.75, 0]`. Select packed fields by their actual component mask. Inputs alone in their register retain the existing four-component behavior. **What is in it** - `emit.rs`: retain the owned component mask in `VsInputField` and use it when selecting the fetch-shader VGPR source. - `tests.rs`: a GPU regression adapted from #297's packed-input test, with interleaved masks 0x5 / 0x2, distinct values for the overlapping component, and per-pixel output checks. **Tested** - Ryzen 5 3600, RTX 5060 Ti, NVIDIA 621.14 / 32.0.16.2114, 32 GB RAM; Windows 11 Pro 10.0.26300; Rust 1.100.0 MSVC, MSVC 19.44, SDK 10.0.26100.0, DXC 1.9.2602.17; debug. - #297 head `a5b7825`: `cargo build --workspace` and `cargo test --workspace -- --test-threads=4 --nocapture`: 653 passed, 0 failed, 40 ignored. - The added interleaved-mask GPU test on that head without this fix: 1 failed, exit 101, wrong pixel value as above. With this fix: 1 passed, exit 0. - Clean head `a039d336837920a2bdbf028ff207b4cab3181916`: `cargo build --workspace`, then `cargo test --workspace -- --test-threads=4 --nocapture`: exit 0; **654 passed, 0 failed, 40 ignored** (lib: 614/0/20), including the synthetic-title end-to-end test. `git diff --check` passes. - Four explicit skips: two no-wave64 tests (`gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`), `test_title_draws_with_a_root_signature_under_the_debug_layer` (no d3d12SDKLayers.dll), and `uploads_start_from_each_subresources_state` (no D3D12 debug layer). **Regression run** Not run on a retail title. This is a draft pending the real-title main/head smoke runs required by CONTRIBUTING.md. **Not tested** - No retail title or game-data samples; no claim that a particular title uses interleaved masks or that gameplay improves. - AMD, Intel, wave64, Wine, and debug-layer validation. - The separate zero-mask edge case is not addressed. **AI use** Codex reproduced the GPU failure, wrote the fix and adapted regression, ran the commands, and prepared this description. The exact deployed model identifier is not exposed in this session. No claim of human code review is made.
AC-Storm-YT commented 2026-11-24 07:04:58 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by AC-Storm-YT on 2026-11-24T00:25:56Z.


Test run on AMD RDNA4 – commit a039d33 (this PR's head, as is, not merged with main, which it currently conflicts with), clean tree

Tested

  • AMD Radeon RX 9070 XT (RDNA4, wave64), driver 32.0.32029.2010 – the tests ran on it (backend 'real' – AMD Radeon RX 9070 XT); AMD Ryzen 7 9800X3D; Windows 11 Pro build 26200; Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug; DXC 1.8.2502.11
  • cargo build --workspace: ok
  • cargo test --workspace -- --test-threads=4: 654 passed, 0 failed, 40 ignored. No SKIPPED tests.
  • The new tests pass: gpu_vs_packed_isg1_inputs, gpu_vs_interleaved_isg1_input_masks (GPU), vs_packed_isg1_inputs_are_members_of_their_own

Not tested

  • No retail title or smoke.ps1 run
  • Release build; the commit after it is rebased onto current main

AI use: run and report by Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:ivall/xcl:comment:7118061696 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/309#issuecomment-7118061696). Originally posted by [AC-Storm-YT](https://github.com/AC-Storm-YT) on 2026-11-24T00:25:56Z. --- Test run on AMD RDNA4 – commit `a039d33` (this PR's head, as is, not merged with `main`, which it currently conflicts with), clean tree **Tested** - AMD Radeon RX 9070 XT (RDNA4, wave64), driver 32.0.32029.2010 – the tests ran on it (`backend 'real' – AMD Radeon RX 9070 XT`); AMD Ryzen 7 9800X3D; Windows 11 Pro build 26200; Rust 1.100.0 `stable-x86_64-pc-windows-msvc`, debug; DXC 1.8.2502.11 - `cargo build --workspace`: ok - `cargo test --workspace -- --test-threads=4`: 654 passed, 0 failed, 40 ignored. No SKIPPED tests. - The new tests pass: `gpu_vs_packed_isg1_inputs`, `gpu_vs_interleaved_isg1_input_masks` (GPU), `vs_packed_isg1_inputs_are_members_of_their_own` **Not tested** - No retail title or `smoke.ps1` run - Release build; the commit after it is rebased onto current `main` AI use: run and report by Claude Code (Claude Opus 5.5).
nullmarsh commented 2026-11-24 07:04:58 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by nullmarsh on 2026-11-24T00:28:54Z.


Adding a negative control to AC-Storm-YT's RDNA4 run above, on a second RDNA4 card (RX 9060 XT, driver 32.0.32029.2010, Windows 11 26200, Rust 1.100.0, debug):

  • Head a039d33, XCL_REQUIRE_GPU=wave64,mesh cargo test -p xcl --lib isg1: 4 passed.
  • #297's commit cecd16f with this PR's tests.rs: gpu_vs_interleaved_isg1_input_masks fails with pixel (0,0) = [0.25, -0.4, 0.75, 0.0], expected [0.25, 0.5, 0.75, 0.0], the same value as your NVIDIA run. So the test catches the TEXCOORD0 shadowing on AMD too. The other three pass.

AI use

  • Claude Code (Claude Opus 5.5) ran the commands and wrote this report from the logs; I checked it before posting.
<!-- greyfinch-sync:ivall/xcl:comment:7118112994 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/309#issuecomment-7118112994). Originally posted by [nullmarsh](https://github.com/nullmarsh) on 2026-11-24T00:28:54Z. --- Adding a negative control to AC-Storm-YT's RDNA4 run above, on a second RDNA4 card (RX 9060 XT, driver 32.0.32029.2010, Windows 11 26200, Rust 1.100.0, debug): - Head `a039d33`, `XCL_REQUIRE_GPU=wave64,mesh cargo test -p xcl --lib isg1`: 4 passed. - #297's commit `cecd16f` with this PR's `tests.rs`: `gpu_vs_interleaved_isg1_input_masks` fails with `pixel (0,0) = [0.25, -0.4, 0.75, 0.0], expected [0.25, 0.5, 0.75, 0.0]`, the same value as your NVIDIA run. So the test catches the TEXCOORD0 shadowing on AMD too. The other three pass. **AI use** - Claude Code (Claude Opus 5.5) ran the commands and wrote this report from the logs; I checked it before posting.
Toons29 commented 2026-11-25 03:05:52 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Toons29 on 2026-11-25T02:54:04Z.


Regression run of a039d336 on the retail title, for this PR's Regression run section. Both blocks are from scripts/smoke.ps1 as printed, not edited: main on 4178e888, this PR on its head commit with no uncommitted changes, same title and time.

xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1618 (PresentX 1618)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14831 MB
xcl-smoke v1
commit: a039d336837920a2bdbf028ff207b4cab3181916
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1462 (PresentX 1462)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14892 MB

Against the limits in CONTRIBUTING.md: 90 % of main's frames, 100 % of its peak commit, no crash, no device removal.

AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, cargo build --release -p xcl, 60 s, XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.

AI use: Claude Code (Claude Opus 5.5) built both trees and ran scripts/smoke.ps1; I checked the blocks before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7151333686 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/309#issuecomment-7151333686). Originally posted by [Toons29](https://github.com/Toons29) on 2026-11-25T02:54:04Z. --- Regression run of `a039d336` on the retail title, for this PR's **Regression run** section. Both blocks are from `scripts/smoke.ps1` as printed, not edited: `main` on `4178e888`, this PR on its head commit with no uncommitted changes, same title and time. ``` xcl-smoke v1 commit: 4178e888c0b5be50a2887eda45cdb832763b68a4 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1618 (PresentX 1618) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 14831 MB ``` ``` xcl-smoke v1 commit: a039d336837920a2bdbf028ff207b4cab3181916 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1462 (PresentX 1462) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14892 MB ``` Against the limits in CONTRIBUTING.md: 90 % of `main`'s frames, 100 % of its peak commit, no crash, no device removal. AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, `cargo build --release -p xcl`, 60 s, `XCL_NETWORK=0`. This is a regression check only: it does not show whether the run reaches the code this PR changes. AI use: Claude Code (Claude Opus 5.5) built both trees and ran `scripts/smoke.ps1`; I checked the blocks before posting.
DavidM1911 commented 2026-11-25 15:07:56 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T14:43:43Z.


Verification on RTX 3060 Ti (Windows 11): merge conflict with current main — needs a rebase before it can be tested.

<!-- greyfinch-sync:ivall/xcl:comment:7165721889 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/309#issuecomment-7165721889). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T14:43:43Z. --- Verification on RTX 3060 Ti (Windows 11): **merge conflict with current `main`** — needs a rebase before it can be tested.
github-actions[bot] commented 2026-11-29 20:42:17 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T20:42:17Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7262291638 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/309#issuecomment-7262291638). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-29T20:42:17Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 03:06:14 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T03:06:14Z.


Triage (#1607) – head a039d33

Stacked on #297: the first commit (cecd16f) is #297's change; only a039d33 belongs here (keep the mask in VsInputField and select by mask bit instead of the first..last span).
No bugs found in the top commit; for contiguous masks it behaves the same as #297. The case it fixes (one element with mask 0x5, e.g. TEXCOORD0.xz) is synthetic, and the PR does not show a title that produces it. It needs #297 to merge first.
Recommendation: keep open (stacked on #297).

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7299326893 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/309#issuecomment-7299326893). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T03:06:14Z. --- **Triage (#1607)** – head a039d33 Stacked on #297: the first commit (cecd16f) is #297's change; only a039d33 belongs here (keep the `mask` in VsInputField and select by mask bit instead of the first..last span). No bugs found in the top commit; for contiguous masks it behaves the same as #297. The case it fixes (one element with mask 0x5, e.g. TEXCOORD0.xz) is synthetic, and the PR does not show a title that produces it. It needs #297 to merge first. Recommendation: keep open (stacked on #297). AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
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/309:upstream-pr/309'
git switch 'upstream-pr/309'

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/309'
git switch 'upstream-pr/309'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/309'
git switch 'upstream-pr/309'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/309'
git switch 'main'
git merge --squash 'upstream-pr/309'
git switch 'main'
git merge --ff-only 'upstream-pr/309'
git switch 'main'
git merge 'upstream-pr/309'
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
xcl-dev/xcl!306
No description provided.