Recompiler: sign-extend D16 IMAGE_STORE lanes for SINT textures #1185
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1194"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by b3IKK on 2026-11-24T13:04:38Z.
IMAGE_STOREwithD16 = 1passed zero-extended 16-bit halves for bothUINT(t_cls == 1) andSINT(t_cls == 2) UAVs, turning negativei16values such as-1(0xFFFF) into+65535and clamping them to+32767when written toRWTexture<int4>.This sign-extends each 16-bit half when
t_cls == 2u, keepingf16tof32for float formats and zero-extension forUINTformats.What is in it
crates/xcl/src/gpu/recomp/emit.rs: sign-extend 16-bit halves inD16IMAGE_STOREwhent_cls == 2u(SINT).crates/xcl/src/gpu/recomp/tests.rs: add GPU testgpu_image_store_d16_sign_extends_sinttestingD16IMAGE_STOREtoR16G16B16A16_SINT([-1, -1234, 42, i16::MIN]) andR16G16B16A16_UINTcontrol (verified failing on the GPU before the fix with[32767, 32767, 42, 32767]).Tested
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: 2no 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 to32767)Regression run
main:
PR:
Not tested
AI use
emit.rs, wrote the fix and GPU test, ran the test suite andscripts/smoke.ps1regression runs, and drafted this PR description.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T13:21:02Z.
Independent verification on current
main384f7f7(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_sinton real hardware.AI use: test runs by Devin (Cognition, SWE-2); no code changes.
Imported from ivall/xcl. Originally posted by bjarngard on 2026-11-24T13:23:54Z.
Test report for head
6aa7f05(AMD, native wave64)Tested
XCL_ADAPTER=radeon cargo test --workspace --no-fail-fast -- --test-threads=4: 742 passed, 0 failed, 41 ignored, no SKIPPEDXCL_REQUIRE_GPU=wave64:gpu_image_store_d16_sign_extends_sintpassedNot 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.
Imported from ivall/xcl. Originally posted by 0xTehuti on 2026-11-24T13:30:08Z.
Test report on NVIDIA GeForce RTX 2070 SUPER (Turing, wave32)
Commit tested
6aa7f058d96adb76a5985646703efff61a01bf5d(PR #1194 head)Tested
cargo test -p xcl --lib gpu_image_store_d16_sign_extends_sint:1 passed; 0 failed; 0 ignored; finished in 0.31sIMAGE_STOREwithD16 = 1fort_cls == 2(SINT) sign-extends 16-bit negative values ([-1, -1234, 42, i16::MIN]) correctly on Turing architecture.32767inRWTexture<int4>.Not tested
AI use
Imported from ivall/xcl. Originally posted by JoaoPauluu on 2026-11-24T13:57:12Z.
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
x86_64-pc-windows-gnu.6aa7f05as it is (based on47efa2e), 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
AI use
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-26T22:49:25Z.
Tested
Independent run at clean PR head
6aa7f058d96adb76a5985646703efff61a01bf5don Intel Arc A770 (driver 32.0.101.9175), Ryzen 7 3800X, Windows 11 x64 26200.9974, Rust/Cargo 1.100.0 MSVC, DXC/DXIL 1.9.2609.5, debug test profile.Prebuilt with
cargo test --locked -p xcl --lib --no-run --message-format=json-render-diagnosticsoutside the GPU mutex. Ran<test-exe> gpu::recomp::tests::gpu_image_store_d16_sign_extends_sint --exact --nocapture --test-threads=1under the Arc mutex withXCL_ADAPTER=A770.1 passed, 0 failed, 0 ignored and 0 GPU skips (0.60 s) with
XCL_DIRECT_DXIL=0. The 1×1 readbacks matched[-1, -1234, 42, -32768]for SINT and[65535, 64302, 42, 32768]for UINT.Not tested
Direct DXIL, other formats and masks, a pre-fix baseline, the workspace suite and retail smoke.
AI use
T3 Code / Codex (gpt-6.2-sol) ran the original verification and summarized the saved results.
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T10:59:03Z.
Independent desktop NVIDIA verification of PR #1194 at head
6aa7f058d96adb76a5985646703efff61a01bf5d(1commit; exact parent & merge-base:47efa2ecea0a12934719ae69b81930cf02a4b1c3, pre-#2555ancestor ofmain).Environment
7956 MiBreported by D3D12, Wave32-only Ada), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200(Developer Mode off)rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.9.2609.5,--releaseTargeted GPU tests & build (
6aa7f058)cargo test --release -p xcl --lib gpu_image_store_d16_sign_extends_sint -- --nocapture(3 consecutive runs)1 passed; 0 failed; 0 ignored; 719 filtered out× 3 (0.26s,0.27s,0.23s,0skipped; live RTX 4060 execution compiled with DXC1.9.2609.5)cargo build --release -p xcl1m 07s, exit0,0new warnings inemit.rs/tests.rs)Paired quiet 60 s retail smoke (
title: 29640639)(Note:
scripts/smoke.ps1at47efa2ecpredates9683e7a6and printed the local folder basename ontitle:; replaced below with the standard9683e7a6title hash29640639, with all measured fields verbatim.)Exact parent & merge-base (
47efa2ecea0a12934719ae69b81930cf02a4b1c3, cached baseline on the same machine):PR #1194 (
6aa7f058d96adb76a5985646703efff61a01bf5d):Limits of coverage
gpu_image_store_d16_sign_extends_sintcompiled and executed3/3on desktop RTX 4060 (Wave32-only Ada; native Wave64 paths are not exercised), directly verifying D16IMAGE_STORElane sign-extension for SINT textures.0device removals,0crashes); single-run frame/commit delta vs. the cached parent reflects normal startup variance.AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
Imported from ivall/xcl. Originally posted by brainhay5 on 2026-11-30T07:08:14Z.
merge-check claim
head:
6aa7f058d9Imported from ivall/xcl. Originally posted by brainhay5 on 2026-11-30T07:22:09Z.
merge-check
base:
d52ff48caahead:
6aa7f058d9merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2876 passed, 2 failed, 51 ignored; 29 SKIPPED lines
failing: test_title_runs_and_game_folder_is_untouched
review: automated overnight check — diff inspected for safety only (no build/CI/toolchain/script changes, no process/network/runtime-loading code); no duplicate search performed; no line-by-line code review.
performance: not assessed beyond the suite.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB, driver 610.88 (32.0.16.1088); Ryzen 7 5800X3D, 64 GB; Windows 11 22631; OpenCode agent, DeepSeek V4.1 Flash 1017
correction: this check first reported the PR as "not yet" because of a test failure that is not the PR's. The base-comparison step failed to run (test names contain a double colon, not a legal Windows filename), so an empty read was mistaken for "passes on base".
gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16fails on based52ff48cby itself (verified separately with the same command: "assertion failed: 2D D16 resinfo clobbered v2/v3"). Verdict corrected. Apologies for the noise.Imported from ivall/xcl. Originally posted by BBareth on 2026-11-30T09:46:43Z.
merge-check claim
head:
6aa7f058d9Imported from ivall/xcl. Originally posted by BBareth on 2026-11-30T09:53:25Z.
merge-check
base:
9dfbe3ea66head:
6aa7f058d9merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2886 passed, 1 failed, 51 ignored; failing: gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16, which fails on the base alone too (base: 2885 passed, 1 failed, 51 ignored, 28 SKIPPED lines). 28 SKIPPED lines, as on the base. The new test
gpu_image_store_d16_sign_extends_sintpassed (R16G16B16A16_SINT gets -1, -1234, 42, i16::MIN; the UINT control keeps the raw halves).review: no blocking finding; two files, read in full. One expression in the HLSL emitter: a D16 image_store half is sign-extended when the texture's class is SINT, stays zero-extended for UINT and
f16tof32for float. This is the HLSL counterpart of #1920 (merged, direct DXIL); #3279 (closed) was a later PR for the same line. Not a duplicate of an open PR.performance: none; one shift pair per stored component, only for SINT targets at run time. The generated HLSL of programs with a D16 image_store changes, so they are translated and compiled again once.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB, driver 621.24 (32.0.16.2124); i7-12700K; Windows 11 26200. Claude Code, Claude Fable 5.2 read the diff, ran the build and the suite and wrote this check.
Imported from ivall/xcl. Originally posted by Edgaras0404 on 2026-11-30T13:00:55Z.
Tested
32.0.21045.29003), AMD Ryzen 5 5600X 6-Core Processor, Windows 10 Pro 22H2 (build 19045)rustc 1.100.1 (20ddd0171 2026-11-25),dxcompiler 1.9.2609.5(01b62ad4) /dxil 1.9.2609.5, D3D12 Agility SDK,debug#1194head6aa7f058trial-merged ontomain9dfbe3ea(crates/xcl/src/gpu/recomp/emit.rs+1/-1,crates/xcl/src/gpu/recomp/tests.rs+36)cargo test -p xcl --lib gpu_image_store_d16_sign_extends_sint -- --test-threads=1 --nocapture:1 passed; 0 failed; 0 ignored; 0 measured; 2769 filtered out(0 SKIPPED— ran on RX 6700 XT via DXC)cargo test --workspace --no-fail-fast -- --test-threads=4:0 failed(includingtests\gpu_compute_e2e.rs:9 passed; 0 failedwithSKIPPED heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows;tests\console_shaders.rs:3 passed; 0 failed; 4 ignored;tests\heap_probe.rs:0 passed; 0 failed; 4 ignored;tests\xg_oracle.rs:6 passed; 0 failed; 12 ignored).tests\gpu_two_pass_cache_e2e.rs:0 passed; 1 failed; 0 ignored(two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs, pre-existing baseline failure onmain9dfbe3ea).-p xcl --lib(2770tests): aborted withexit code: 0x80004005(xcl: sparse upload preparation still failed after bounded retries – the title is stopped before its GPU submission), matchingmain9dfbe3eabaseline behavior. Before aborting, it loggedSKIPPED hle::d3d12x::bind::tests::two_pass_binds_set_the_shared_view_heap: no heap windows (opt-in: XCL_HEAP_WINDOWS=1)and the same 5 pre-existinggpu::baseline failures (gpu_compact_form_with_micro_blocks_and_literal_table_runs_as_the_plain_form,gpu_direct_image_get_resinfo_d16,f32_programs_on_the_gpu,gpu_f32_compares_with_nan,gpu_float_compares_random);gpu_image_store_d16_sign_extends_sintdid not fail.Not tested
-p xcl --lib -- --skip gpu:: --skip hle::d3d12x::slice on the merged tree (full-p xcl --libhit the pre-existing0x80004005abort)XCL_HEAP_WINDOWS=1tests (the 2SKIPPEDheap-window tests above)scripts/smoke.ps1(includingXCL_DIRECT_DXIL=0HLSL title run)AI use