Recompiler: sign-extend D16 IMAGE_STORE lanes for SINT textures #1194

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

@⁠b3IKK on GitHub · 2026-11-24 13:04 UTC · original
b3IKK:recomp/image-store-d16-sint → main · +37 −1 · 2 files · 1 commits · open

IMAGE_STORE with D16 = 1 passed zero-extended 16-bit halves for both UINT (t_cls == 1) and SINT (t_cls == 2) UAVs, turning negative i16 values such as -1 (0xFFFF) into +65535 and clamping them to +32767 when written to RWTexture<int4>.

This sign-extends each 16-bit half when t_cls == 2u, keeping f16tof32 for float formats and zero-extension for UINT formats.

What is in it

  • crates/xcl/src/gpu/recomp/emit.rs: sign-extend 16-bit halves in D16 IMAGE_STORE when t_cls == 2u (SINT).
  • crates/xcl/src/gpu/recomp/tests.rs: add GPU test gpu_image_store_d16_sign_extends_sint testing D16 IMAGE_STORE to R16G16B16A16_SINT ([-1, -1234, 42, i16::MIN]) and R16G16B16A16_UINT control (verified failing on the GPU before the fix with [32767, 32767, 42, 32767]).

Tested

  • hardware (GPU + driver, CPU), Windows build, Rust version, debug / release: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 9 9950X3D, Windows 11 10.0.26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1)
  • .\scripts\test.ps1 (cargo build --workspace + cargo test --workspace -- --test-threads=4): 742 passed, 0 failed, 41 ignored (SKIPPED GPU tests: 2 no wave64 — gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask, gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware)
  • cargo test -p xcl --lib gpu_image_store_d16_sign_extends_sint: 1 passed, 0 failed (failed on the GPU before the fix, clamping negative values to 32767)

Regression run

main:

xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: NVIDIA GeForce RTX 5080
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1226 (PresentX 1226)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15341 MB

PR:

xcl-smoke v1
commit: 6aa7f058d96adb76a5985646703efff61a01bf5d
gpu: NVIDIA GeForce RTX 5080
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1648 (PresentX 1649)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14950 MB

Not tested

  • AMD GPUs and native wave64 hardware
  • other titles (Minecraft Preview, Unicorn Overlord, Fortnite, XDefiant) and Linux / Wine

AI use

  • OpenCode, Gemini 4 Neon: audited emit.rs, wrote the fix and GPU test, ran the test suite and scripts/smoke.ps1 regression runs, and drafted this PR description.
**@⁠b3IKK** on GitHub · 2026-11-24 13:04 UTC · [original](https://github.com/xcl-dev/xcl/pull/1194) `b3IKK:recomp/image-store-d16-sint` → `main` · +37 −1 · 2 files · 1 commits · open `IMAGE_STORE` with `D16 = 1` passed zero-extended 16-bit halves for both `UINT` (`t_cls == 1`) and `SINT` (`t_cls == 2`) UAVs, turning negative `i16` values such as `-1` (`0xFFFF`) into `+65535` and clamping them to `+32767` when written to `RWTexture<int4>`. This sign-extends each 16-bit half when `t_cls == 2u`, keeping `f16tof32` for float formats and zero-extension for `UINT` formats. **What is in it** - `crates/xcl/src/gpu/recomp/emit.rs`: sign-extend 16-bit halves in `D16` `IMAGE_STORE` when `t_cls == 2u` (`SINT`). - `crates/xcl/src/gpu/recomp/tests.rs`: add GPU test `gpu_image_store_d16_sign_extends_sint` testing `D16` `IMAGE_STORE` to `R16G16B16A16_SINT` (`[-1, -1234, 42, i16::MIN]`) and `R16G16B16A16_UINT` control (verified failing on the GPU before the fix with `[32767, 32767, 42, 32767]`). **Tested** - hardware (GPU + driver, CPU), Windows build, Rust version, debug / release: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 9 9950X3D, Windows 11 10.0.26300, Rust 1.100.0 (`stable-x86_64-pc-windows-msvc`), DXC 1.9.2609.5, debug (`scripts/test.ps1`) and release (`scripts/smoke.ps1`) - `.\scripts\test.ps1` (`cargo build --workspace` + `cargo test --workspace -- --test-threads=4`): 742 passed, 0 failed, 41 ignored (SKIPPED GPU tests: 2 `no wave64` — `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware`) - `cargo test -p xcl --lib gpu_image_store_d16_sign_extends_sint`: 1 passed, 0 failed (failed on the GPU before the fix, clamping negative values to `32767`) **Regression run** main: ``` xcl-smoke v1 commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3 gpu: NVIDIA GeForce RTX 5080 title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1226 (PresentX 1226) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15341 MB ``` PR: ``` xcl-smoke v1 commit: 6aa7f058d96adb76a5985646703efff61a01bf5d gpu: NVIDIA GeForce RTX 5080 title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1648 (PresentX 1649) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14950 MB ``` **Not tested** - AMD GPUs and native wave64 hardware - other titles (Minecraft Preview, Unicorn Overlord, Fortnite, XDefiant) and Linux / Wine **AI use** - OpenCode, Gemini 4 Neon: audited `emit.rs`, wrote the fix and GPU test, ran the test suite and `scripts/smoke.ps1` regression runs, and drafted this PR description.
IMAGE_STORE with D16=1 passed zero-extended 16-bit halves for both
UINT (t_cls == 1) and SINT (t_cls == 2) UAVs, turning negative i16
values such as -1 (0xFFFF) into +65535 and clamping them to +32767
when written to RWTexture<int4>.

Sign-extend each 16-bit half when t_cls == 2u, keeping f16tof32 for
float formats and zero-extension for UINT formats, with a GPU test
covering R16G16B16A16_SINT and R16G16B16A16_UINT UAVs.

Assisted-by: OpenCode (Gemini 4 Neon)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:46:36 +00:00
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 13:21 UTC · original

Independent verification on current main 384f7f7 (branch already contains it — clean).

Machine: Windows 11, Ryzen 9 7900X + RTX 3060 Ti; Rust stable MSVC, debug; DXC 1.8.2502.11.

  • cargo test -p xcl --lib image_store: 1 passed, 0 failed — gpu_image_store_d16_sign_extends_sint on real hardware.

AI use: test runs by Devin (Cognition, SWE-2); no code changes.

**@⁠DavidM1911** on GitHub · 2026-11-24 13:21 UTC · [original](https://github.com/xcl-dev/xcl/pull/1194#issuecomment-7132703650) Independent verification on current `main` `384f7f7` (branch already contains it — clean). **Machine:** Windows 11, Ryzen 9 7900X + RTX 3060 Ti; Rust stable MSVC, debug; DXC 1.8.2502.11. - `cargo test -p xcl --lib image_store`: **1 passed, 0 failed** — `gpu_image_store_d16_sign_extends_sint` on real hardware. AI use: test runs by Devin (Cognition, SWE-2); no code changes.
Author
Owner

@⁠bjarngard on GitHub · 2026-11-24 13:23 UTC · original

Test report for head 6aa7f05 (AMD, native wave64)

Tested

  • AMD Radeon(TM) Graphics (Ryzen 9 9950X iGPU, RDNA2, native wave64), driver 32.0.21043.5001; Windows 11 build 26300; Rust 1.99.1 MSVC; DXC 1.9.2602.17; debug
  • XCL_ADAPTER=radeon cargo test --workspace --no-fail-fast -- --test-threads=4: 742 passed, 0 failed, 41 ignored, no SKIPPED
  • With XCL_REQUIRE_GPU=wave64: gpu_image_store_d16_sign_extends_sint passed

Not tested: retail titles, RDNA3/RDNA4.

AI use: the tests were run and this report was written by an AI agent, Claude Code (Claude Opus 5.5), on the hardware above. The numbers are copied from the actual test output.

**@⁠bjarngard** on GitHub · 2026-11-24 13:23 UTC · [original](https://github.com/xcl-dev/xcl/pull/1194#issuecomment-7132771898) Test report for head `6aa7f05` (AMD, native wave64) **Tested** - AMD Radeon(TM) Graphics (Ryzen 9 9950X iGPU, RDNA2, native wave64), driver 32.0.21043.5001; Windows 11 build 26300; Rust 1.99.1 MSVC; DXC 1.9.2602.17; debug - `XCL_ADAPTER=radeon cargo test --workspace --no-fail-fast -- --test-threads=4`: 742 passed, 0 failed, 41 ignored, no SKIPPED - With `XCL_REQUIRE_GPU=wave64`: `gpu_image_store_d16_sign_extends_sint` passed **Not tested:** retail titles, RDNA3/RDNA4. **AI use:** the tests were run and this report was written by an AI agent, Claude Code (Claude Opus 5.5), on the hardware above. The numbers are copied from the actual test output.
Author
Owner

@⁠0xTehuti on GitHub · 2026-11-24 13:30 UTC · original

Test report on NVIDIA GeForce RTX 2070 SUPER (Turing, wave32)

Commit tested
6aa7f058d96adb76a5985646703efff61a01bf5d (PR #1194 head)

Tested

  • Hardware:
    • GPU: NVIDIA GeForce RTX 2070 SUPER (Driver 595.79 / 32.0.15.9579, 7989 MiB VRAM)
    • CPU: Intel Core i7-10700K CPU @ 3.80GHz
    • OS: Windows 11 x64, Rust 1.99.0, DXC 1.8.2502.11
  • Command run and results:
    • cargo test -p xcl --lib gpu_image_store_d16_sign_extends_sint:
      1 passed; 0 failed; 0 ignored; finished in 0.31s
  • Findings:
    • Verified that IMAGE_STORE with D16 = 1 for t_cls == 2 (SINT) sign-extends 16-bit negative values ([-1, -1234, 42, i16::MIN]) correctly on Turing architecture.
    • Negative values are no longer zero-extended or clamped to 32767 in RWTexture<int4>.

Not tested

  • Retail title smoke run (retail game assets unset).
  • AMD native wave64 hardware.

AI use

  • Tool: Antigravity / T3 Code
  • Model: Gemini 3.8 Flash
  • Details: Checked out PR commit in isolated worktree, ran GPU test on real NVIDIA Turing hardware, and confirmed exact test pass.
**@⁠0xTehuti** on GitHub · 2026-11-24 13:30 UTC · [original](https://github.com/xcl-dev/xcl/pull/1194#issuecomment-7132920891) ### Test report on NVIDIA GeForce RTX 2070 SUPER (Turing, wave32) **Commit tested** `6aa7f058d96adb76a5985646703efff61a01bf5d` (PR #1194 head) **Tested** - **Hardware:** - GPU: NVIDIA GeForce RTX 2070 SUPER (Driver 595.79 / 32.0.15.9579, 7989 MiB VRAM) - CPU: Intel Core i7-10700K CPU @ 3.80GHz - OS: Windows 11 x64, Rust 1.99.0, DXC 1.8.2502.11 - **Command run and results:** - `cargo test -p xcl --lib gpu_image_store_d16_sign_extends_sint`: `1 passed; 0 failed; 0 ignored; finished in 0.31s` - **Findings:** - Verified that `IMAGE_STORE` with `D16 = 1` for `t_cls == 2` (SINT) sign-extends 16-bit negative values (`[-1, -1234, 42, i16::MIN]`) correctly on Turing architecture. - Negative values are no longer zero-extended or clamped to `32767` in `RWTexture<int4>`. **Not tested** - Retail title smoke run (retail game assets unset). - AMD native wave64 hardware. **AI use** - Tool: Antigravity / T3 Code - Model: Gemini 3.8 Flash - Details: Checked out PR commit in isolated worktree, ran GPU test on real NVIDIA Turing hardware, and confirmed exact test pass.
Author
Owner

@⁠JoaoPauluu on GitHub · 2026-11-24 13:57 UTC · original

A run on Linux with vkd3d-proton, where the shaders go through dxil-spirv to Vulkan instead of a Windows driver's DXIL compiler.

Tested

  • RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257 (DXIL → SPIR-V through dxil-spirv), DXC 1.9.2609.5. Release, cross-built for x86_64-pc-windows-gnu. 6aa7f05 as it is (based on 47efa2e), no uncommitted changes. The lib test binary runs under Wine, one test per process (--exact).
  • gpu::recomp::tests::gpu_image_store_d16_sign_extends_sint: ok, no SKIPPED.

Not tested

  • whether the new test fails without the fix on this stack; the rest of the suite on this head; native Windows; AMD / native wave64.

AI use

  • Claude Code (Claude Opus 5.5) built the head, ran the tests and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
**@⁠JoaoPauluu** on GitHub · 2026-11-24 13:57 UTC · [original](https://github.com/xcl-dev/xcl/pull/1194#issuecomment-7133590580) A run on Linux with vkd3d-proton, where the shaders go through dxil-spirv to Vulkan instead of a Windows driver's DXIL compiler. **Tested** - RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257 (DXIL → SPIR-V through dxil-spirv), DXC 1.9.2609.5. Release, cross-built for `x86_64-pc-windows-gnu`. `6aa7f05` as it is (based on `47efa2e`), no uncommitted changes. The lib test binary runs under Wine, one test per process (`--exact`). - `gpu::recomp::tests::gpu_image_store_d16_sign_extends_sint`: **ok**, no SKIPPED. **Not tested** - whether the new test fails without the fix on this stack; the rest of the suite on this head; native Windows; AMD / native wave64. **AI use** - Claude Code (Claude Opus 5.5) built the head, ran the tests and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
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/1194/head:github-bot/gh-1194'
git switch 'github-bot/gh-1194'

Merge

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