Recompiler: route 32_32_UINT MUBUF stores by DST_SEL #2818

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

@⁠CryingLaughing on GitHub · 2026-11-26 14:23 UTC · original
CryingLaughing:fix/mubuf-u32x2-store-select → main · +113 −2 · 3 files · 1 commits · open

Part of #1414.

For non-D16 MUBUF BUFFER_STORE_FORMAT_XYZW with 32_32_UINT, the buffer descriptor selects which two input words reach memory. The current translators always take the first two. Apply the measured desktop RDNA2 routing before packing both translated forms.

What is in it

  • Route the two values in gpu/recomp/emit.rs and gpu/dxil/lower_mem.rs. Preserve the existing order for reserved selectors, and leave the MTBUF and other format paths unchanged.
  • Add a 13-case raw-memory regression in gpu/recomp/tests.rs that also checks neighboring formats, bounds and guard words.

Tested

  • Head 138e36d6f56e3b6112bf0fa935a9147e9eb5d71c on b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7. RTX 4080 driver 621.01, i5-13600K, Windows 11 25H2 build 26200.9974, Rust 1.100.0 x64 MSVC, DXC 1.8.2502.11, debug.

  • gpu_mubuf_u32x2_xyzw_store_selects_channels failed 0/1/0 at the intended XYZW assertion on the base with the test overlay, in both HLSL and direct DXIL. Both translators stored (17,34) instead of (17,68). The patched fixture passed 1/0/0 in each mode over all 13 cases with no capability skips.

  • cargo build --workspace --locked -j 4 succeeded. cargo test --workspace --locked -j 4 --no-fail-fast -- --test-threads=4 --show-output reported 1,436 passed, 0 failed, 47 ignored across 37 harnesses. The pass count includes 29 capability skips.

  • Independent RTX 5070 Ti Laptop verification covered all 13 cases in wave32 and in the upper half of split wave64, through both translators. Windows GPU check

  • Independent RX 9070 verification under Wine passed all 13 cases in native wave32 and wave64. A test-only multilane fixture found zero output or guard mismatches on the head across HLSL, direct plain, and direct compact. AMD GPU check

Regression run

Independent retail smoke by Anon64 compared release builds of main and this exact head on an RTX 3060 12 GB (driver 581.80), Core i9-14900KF, and Windows 11 build 26200. The 60-second runs used the same title. The head retained 102.3% of the baseline frames and used 88.3% of its peak commit, with zero crashes or device removals. The run did not establish whether the title reached the changed code.

main:

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1461 (PresentX 1461)
presents per 2 s (last 3): 10 6 5
device removals: 0
crashes: 0
peak commit: 24953 MB

PR:

xcl-smoke v1
commit: 138e36d6f56e3b6112bf0fa935a9147e9eb5d71c
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1494 (PresentX 1494)
presents per 2 s (last 3): 29 5 4
device removals: 0
crashes: 0
peak commit: 22029 MB

Not tested

  • Xbox-native behavior, selector W combinations outside the reported probe, retail execution of this shader form, and performance.
**@⁠CryingLaughing** on GitHub · 2026-11-26 14:23 UTC · [original](https://github.com/xcl-dev/xcl/pull/2818) `CryingLaughing:fix/mubuf-u32x2-store-select` → `main` · +113 −2 · 3 files · 1 commits · open Part of #1414. For non-D16 MUBUF `BUFFER_STORE_FORMAT_XYZW` with `32_32_UINT`, the buffer descriptor selects which two input words reach memory. The current translators always take the first two. Apply the [measured desktop RDNA2 routing](https://github.com/scarlett-commons/scarlett-commons/blob/eb4431d8f7712d5b4f5bda54ef92595f9b8bbb2f/engine/tools/buffer_store_probe.py#L211-L254) before packing both translated forms. **What is in it** - Route the two values in `gpu/recomp/emit.rs` and `gpu/dxil/lower_mem.rs`. Preserve the existing order for reserved selectors, and leave the MTBUF and other format paths unchanged. - Add a 13-case raw-memory regression in `gpu/recomp/tests.rs` that also checks neighboring formats, bounds and guard words. **Tested** - Head `138e36d6f56e3b6112bf0fa935a9147e9eb5d71c` on `b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7`. RTX 4080 driver 621.01, i5-13600K, Windows 11 25H2 build 26200.9974, Rust 1.100.0 x64 MSVC, DXC 1.8.2502.11, debug. - `gpu_mubuf_u32x2_xyzw_store_selects_channels` failed 0/1/0 at the intended XYZW assertion on the base with the test overlay, in both HLSL and direct DXIL. Both translators stored `(17,34)` instead of `(17,68)`. The patched fixture passed 1/0/0 in each mode over all 13 cases with no capability skips. - `cargo build --workspace --locked -j 4` succeeded. `cargo test --workspace --locked -j 4 --no-fail-fast -- --test-threads=4 --show-output` reported **1,436 passed, 0 failed, 47 ignored** across 37 harnesses. The pass count includes 29 capability skips. - Independent RTX 5070 Ti Laptop verification covered all 13 cases in wave32 and in the upper half of split wave64, through both translators. [Windows GPU check](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2818) - Independent RX 9070 verification under Wine passed all 13 cases in native wave32 and wave64. A test-only multilane fixture found zero output or guard mismatches on the head across HLSL, direct plain, and direct compact. [AMD GPU check](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2818) **Regression run** [Independent retail smoke by Anon64](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2818) compared release builds of main and this exact head on an RTX 3060 12 GB (driver 581.80), Core i9-14900KF, and Windows 11 build 26200. The 60-second runs used the same title. The head retained 102.3% of the baseline frames and used 88.3% of its peak commit, with zero crashes or device removals. The run did not establish whether the title reached the changed code. main: ``` xcl-smoke v1 commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 gpu: NVIDIA GeForce RTX 3060 title: 21222967 seconds: 60 exit: 0x0 frames shown: 1461 (PresentX 1461) presents per 2 s (last 3): 10 6 5 device removals: 0 crashes: 0 peak commit: 24953 MB ``` PR: ``` xcl-smoke v1 commit: 138e36d6f56e3b6112bf0fa935a9147e9eb5d71c gpu: NVIDIA GeForce RTX 3060 title: 21222967 seconds: 60 exit: 0x0 frames shown: 1494 (PresentX 1494) presents per 2 s (last 3): 29 5 4 device removals: 0 crashes: 0 peak commit: 22029 MB ``` **Not tested** - Xbox-native behavior, selector W combinations outside the reported probe, retail execution of this shader form, and performance.
Apply the observed channel routing before packing non-D16 XYZW stores. Keep reserved selectors and other formats on the existing path, and check the raw result in both GPU translators. Part of #1414.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 14:25:12 +00:00
Author
Owner

@⁠ettehn on GitHub · 2026-11-26 14:37 UTC · original

Independent Windows GPU check on 138e36d6f56e3b6112bf0fa935a9147e9eb5d71c: RTX 5070 Ti Laptop (driver 621.24), Windows 11 x64 (build 26200), Rust 1.97.1 MSVC and DXC 1.8.2502.11.

  • Unmodified fixture, wave32: all 13 rows passed through both HLSL (XCL_DIRECT_DXIL=0) and direct DXIL (=1).
  • Local test-only extension, split wave64: all 13 rows passed through both backends with only guest lane 32 active (EXEC_LO=0, EXEC_HI=1). This checks the upper half of the split, including the guard words and out-of-bounds case. The extension used the existing split-wave options and did not change translator code.

Each backend invocation reported 1 passed, 0 failed, 0 ignored and no capability skips. Command: cargo test --locked --offline -p xcl --lib -j 2 gpu_mubuf_u32x2_xyzw_store_selects_channels -- --test-threads=1 --nocapture with XCL_ADAPTER=NVIDIA and XCL_REQUIRE_GPU=wave64. No retail smoke run.

OpenAI Codex (6.2sol) assisted with verification.

**@⁠ettehn** on GitHub · 2026-11-26 14:37 UTC · [original](https://github.com/xcl-dev/xcl/pull/2818#issuecomment-7195083521) Independent Windows GPU check on `138e36d6f56e3b6112bf0fa935a9147e9eb5d71c`: RTX 5070 Ti Laptop (driver 621.24), Windows 11 x64 (build 26200), Rust 1.97.1 MSVC and DXC 1.8.2502.11. - Unmodified fixture, wave32: all 13 rows passed through both HLSL (`XCL_DIRECT_DXIL=0`) and direct DXIL (`=1`). - Local test-only extension, split wave64: all 13 rows passed through both backends with only guest lane 32 active (`EXEC_LO=0`, `EXEC_HI=1`). This checks the upper half of the split, including the guard words and out-of-bounds case. The extension used the existing split-wave options and did not change translator code. Each backend invocation reported 1 passed, 0 failed, 0 ignored and no capability skips. Command: `cargo test --locked --offline -p xcl --lib -j 2 gpu_mubuf_u32x2_xyzw_store_selects_channels -- --test-threads=1 --nocapture` with `XCL_ADAPTER=NVIDIA` and `XCL_REQUIRE_GPU=wave64`. No retail smoke run. OpenAI Codex (6.2sol) assisted with verification.
Author
Owner

@⁠SzczepanGrela on GitHub · 2026-11-26 14:44 UTC · original

RX 9070 / Wine verification, including native Wave32/Wave64 and concurrent per-lane stores.

Tested

  • Head 138e36d6f56e3b6112bf0fa935a9147e9eb5d71c against main b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7.
  • RX 9070 16 GB (RADV GFX1201), Ryzen 7 7700, CachyOS kernel 7.3.0-5-cachyos, Mesa 26.3.1-arch3.5, GE-Proton11-12 Wine 11.0 Staging, vkd3d-proton 8293130ebe370b1+ (local asserts-disabled build), DXC/DXIL 1.9.2602.17, Rust 1.97.1, release x86_64-pc-windows-gnu.
  • Explicit RX 9070 selection, XCL_REQUIRE_GPU=wave64, XCL_NETWORK=0, private caches. These tests execute native waves; split is disabled in the local extension.

Original fixture

gpu::recomp::tests::gpu_mubuf_u32x2_xyzw_store_selects_channels, three fresh processes per revision/backend:

  • Head: 1 passed / 0 failed / 0 ignored per invocation, all 13 rows in both native Wave64 and Wave32, through HLSL (XCL_DIRECT_DXIL=0) and direct DXIL (=1).
  • Main control: 0 passed / 1 failed / 0 ignored per invocation, at the first changed wave64 XYZW assertion: (17,34) instead of (17,68). Its later rows/wave are not reached in this fixture.

Main imports the upstream test with only its new format-constant import replaced by literal 62 inside the test. Production code remains unchanged.

Local multilane fixture

Both source copies additionally receive identical gpu_mubuf_u32x2_multilane_guard_readback. It retains the 13 upstream expected routes, adds distinct inputs for each lane and disjoint 32-byte output slots through OFFEN, and checks the complete 26 KiB memory image. This includes guard words, inactive-lane slots, reserved selectors, MTBUF, neighboring formats and the out-of-bounds row.

Every mode runs through HLSL/DXC, direct plain and direct compact, with DXIL validation before dispatch. Three fresh processes per revision give identical results on all three paths:

Mode Active lanes Main mismatching (row,lane) blocks Head mismatches
Native Wave32 all 32 160 0
Native Wave64 all 64 320 0
Native Wave64 lane 63 only 5 0
Native Wave64 mixed EXEC mask, 32 lanes 160 0

Main differs only in rows XYZW, XYZ1, YX01, YZZ1, Y001. The remaining eight rows match. Guard/inactive/out-of-bounds checks report zero unexpected writes on both revisions. The local test reports head 1/0/0 versus main 0/1/0; main's final assertion collects all 12 mode/path results before failing.

Existing gpu_typed_buffer_loads_and_stores and gpu_grouped_loads_bounds_and_inactive_lanes each pass separately on both revisions with XCL_DIRECT_DXIL=0 and 1.

All 26 process summaries, 72 local mode/path records, 12 upstream head wave records, exact main failures, source reconstruction and executable hashes were independently checked. No runtime skips or ignored tests. Removing the disclosed test insertions reconstructs the exact original sources on both sides.

Build: cargo test --offline --locked --release --target x86_64-pc-windows-gnu -p xcl --lib --no-run. Invocation: GE-Proton Wine, <libtest.exe> gpu::recomp::tests::<test> --exact --nocapture --test-threads=1. The local fixture explicitly selects all three translator paths.

Not tested

Independent native Xbox/RDNA2 instruction measurements, selectors outside the upstream fixture, forced split execution here, native Windows, other GPUs, full workspace suite, retail workload, scripts/smoke.ps1, performance or FPS. These translated-kernel checks use the PR fixture's expected channel routing.

AI use

OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed the diff, wrote the local multilane fixture, ran and independently verified the paired tests, and drafted this report. Publication authorized by the account owner.

**@⁠SzczepanGrela** on GitHub · 2026-11-26 14:44 UTC · [original](https://github.com/xcl-dev/xcl/pull/2818#issuecomment-7195268370) RX 9070 / Wine verification, including native Wave32/Wave64 and concurrent per-lane stores. **Tested** - Head `138e36d6f56e3b6112bf0fa935a9147e9eb5d71c` against main `b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7`. - RX 9070 16 GB (RADV GFX1201), Ryzen 7 7700, CachyOS kernel 7.3.0-5-cachyos, Mesa 26.3.1-arch3.5, GE-Proton11-12 Wine 11.0 Staging, vkd3d-proton `8293130ebe370b1+` (local asserts-disabled build), DXC/DXIL 1.9.2602.17, Rust 1.97.1, release `x86_64-pc-windows-gnu`. - Explicit RX 9070 selection, `XCL_REQUIRE_GPU=wave64`, `XCL_NETWORK=0`, private caches. These tests execute native waves; split is disabled in the local extension. **Original fixture** `gpu::recomp::tests::gpu_mubuf_u32x2_xyzw_store_selects_channels`, three fresh processes per revision/backend: - Head: 1 passed / 0 failed / 0 ignored per invocation, all 13 rows in both native Wave64 and Wave32, through HLSL (`XCL_DIRECT_DXIL=0`) and direct DXIL (`=1`). - Main control: 0 passed / 1 failed / 0 ignored per invocation, at the first changed `wave64 XYZW` assertion: `(17,34)` instead of `(17,68)`. Its later rows/wave are not reached in this fixture. Main imports the upstream test with only its new format-constant import replaced by literal 62 inside the test. Production code remains unchanged. **Local multilane fixture** Both source copies additionally receive identical `gpu_mubuf_u32x2_multilane_guard_readback`. It retains the 13 upstream expected routes, adds distinct inputs for each lane and disjoint 32-byte output slots through OFFEN, and checks the complete 26 KiB memory image. This includes guard words, inactive-lane slots, reserved selectors, MTBUF, neighboring formats and the out-of-bounds row. Every mode runs through HLSL/DXC, direct plain and direct compact, with DXIL validation before dispatch. Three fresh processes per revision give identical results on all three paths: | Mode | Active lanes | Main mismatching (row,lane) blocks | Head mismatches | | --- | --- | --- | --- | | Native Wave32 | all 32 | 160 | 0 | | Native Wave64 | all 64 | 320 | 0 | | Native Wave64 | lane 63 only | 5 | 0 | | Native Wave64 | mixed EXEC mask, 32 lanes | 160 | 0 | Main differs only in rows `XYZW`, `XYZ1`, `YX01`, `YZZ1`, `Y001`. The remaining eight rows match. Guard/inactive/out-of-bounds checks report zero unexpected writes on both revisions. The local test reports head 1/0/0 versus main 0/1/0; main's final assertion collects all 12 mode/path results before failing. Existing `gpu_typed_buffer_loads_and_stores` and `gpu_grouped_loads_bounds_and_inactive_lanes` each pass separately on both revisions with `XCL_DIRECT_DXIL=0` and `1`. All 26 process summaries, 72 local mode/path records, 12 upstream head wave records, exact main failures, source reconstruction and executable hashes were independently checked. No runtime skips or ignored tests. Removing the disclosed test insertions reconstructs the exact original sources on both sides. Build: `cargo test --offline --locked --release --target x86_64-pc-windows-gnu -p xcl --lib --no-run`. Invocation: GE-Proton Wine, `<libtest.exe> gpu::recomp::tests::<test> --exact --nocapture --test-threads=1`. The local fixture explicitly selects all three translator paths. **Not tested** Independent native Xbox/RDNA2 instruction measurements, selectors outside the upstream fixture, forced split execution here, native Windows, other GPUs, full workspace suite, retail workload, `scripts/smoke.ps1`, performance or FPS. These translated-kernel checks use the PR fixture's expected channel routing. **AI use** OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed the diff, wrote the local multilane fixture, ran and independently verified the paired tests, and drafted this report. Publication authorized by the account owner.
Author
Owner

@⁠Anon64 on GitHub · 2026-11-26 14:55 UTC · original

Regression run of 138e36d on a newer retail title: no device removal, no crash, frames and commit within the limits.

Setup: RTX 3060 12 GB (NVIDIA 581.80), i9-14900KF, Windows 11 26200, release builds of main b49be18 (this PR's base) and of this PR's exact head, scripts/smoke.ps1 -Game <title> for 60 s with XCL_NETWORK=0 and A pressed every 4 s from 20 s. Main ran before and after this PR and peaked at 24,953 and 25,032 MB.

main:

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1461 (PresentX 1461)
presents per 2 s (last 3): 10 6 5
device removals: 0
crashes: 0
peak commit: 24953 MB

this PR:

xcl-smoke v1
commit: 138e36d6f56e3b6112bf0fa935a9147e9eb5d71c
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1494 (PresentX 1494)
presents per 2 s (last 3): 29 5 4
device removals: 0
crashes: 0
peak commit: 22029 MB

102 % of main's frames, 88 % of its peak commit. One run each.

Not tested: the suite on this head; whether the title reaches the code this PR changes in its first 60 s; AMD.

AI use: Claude Code (Claude Opus 5.5) ran these runs on this machine and wrote this report.

**@⁠Anon64** on GitHub · 2026-11-26 14:55 UTC · [original](https://github.com/xcl-dev/xcl/pull/2818#issuecomment-7195533021) **Regression run of `138e36d` on a newer retail title: no device removal, no crash, frames and commit within the limits.** **Setup:** RTX 3060 12 GB (NVIDIA 581.80), i9-14900KF, Windows 11 26200, release builds of main `b49be18` (this PR's base) and of this PR's exact head, `scripts/smoke.ps1 -Game <title>` for 60 s with `XCL_NETWORK=0` and A pressed every 4 s from 20 s. Main ran before and after this PR and peaked at 24,953 and 25,032 MB. main: ``` xcl-smoke v1 commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 gpu: NVIDIA GeForce RTX 3060 title: 21222967 seconds: 60 exit: 0x0 frames shown: 1461 (PresentX 1461) presents per 2 s (last 3): 10 6 5 device removals: 0 crashes: 0 peak commit: 24953 MB ``` this PR: ``` xcl-smoke v1 commit: 138e36d6f56e3b6112bf0fa935a9147e9eb5d71c gpu: NVIDIA GeForce RTX 3060 title: 21222967 seconds: 60 exit: 0x0 frames shown: 1494 (PresentX 1494) presents per 2 s (last 3): 29 5 4 device removals: 0 crashes: 0 peak commit: 22029 MB ``` 102 % of main's frames, 88 % of its peak commit. One run each. **Not tested:** the suite on this head; whether the title reaches the code this PR changes in its first 60 s; AMD. AI use: Claude Code (Claude Opus 5.5) ran these runs on this machine and wrote this report.
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/2818/head:github-bot/gh-2818'
git switch 'github-bot/gh-2818'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2818'
git switch 'github-bot/gh-2818'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2818'
git switch 'github-bot/gh-2818'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2818'
git switch 'main'
git merge --squash 'github-bot/gh-2818'
git switch 'main'
git merge --ff-only 'github-bot/gh-2818'
git switch 'main'
git merge 'github-bot/gh-2818'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.