Recompiler: preserve upper 16 bits in buffer_load_format_d16_x and _xyz #1189
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1198"
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:08:02Z.
On RDNA2,
buffer_load_format_d16_xwritesXintoVDST[15:0]and preservesVDST[31:16], andbuffer_load_format_d16_xyzwritesZinto(VDST+1)[15:0]and preserves(VDST+1)[31:16](symmetric tod16_hi_xpreserving[15:0]). The emitter previously zeroed the upper 16 bits both in-bounds and out-of-bounds.This preserves
(v & 0xFFFF0000u)for the trailing odd 16-bit component inBufKind::FormatLoad.What is in it
crates/xcl/src/gpu/recomp/emit.rs: preserve the upper 16 bits of the last destination VGPR for odd-component D16 format loads (buffer_load_format_d16_x,buffer_load_format_d16_xyz, andtbuffer_equivalents).crates/xcl/src/gpu/recomp/tests.rs: add GPU testgpu_buffer_load_format_d16_x_and_xyz_preserve_upper_halfcovering in-bounds and out-of-boundsBUFFER_LOAD_FORMAT_D16_XandBUFFER_LOAD_FORMAT_D16_XYZ(verified failing before the fix).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_buffer_load_format_d16_x_and_xyz_preserve_upper_half: 1 passed, 0 failed (failed on the GPU before the fix, zeroing upper 16 bits)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:19:55Z.
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 buffer_load_format: 1 passed, 0 failed —gpu_buffer_load_format_d16_x_and_xyz_preserve_upper_halfon 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:51Z.
Test report for head
74276a0(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_buffer_load_format_d16_x_and_xyz_preserve_upper_halfpassedNot 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 JoaoPauluu on 2026-11-24T13:57:14Z.
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.74276a0as it is (based on47efa2e), no uncommitted changes. The lib test binary runs under Wine, one test per process (--exact).gpu::recomp::tests::gpu_buffer_load_format_d16_x_and_xyz_preserve_upper_half: ok, no SKIPPED.Not tested
AI use
upstream-sync referenced this pull request2026-11-24 23:06:49 +00:00
Imported from ivall/xcl. Originally posted by xpatfussy69x on 2026-11-25T08:26:14Z.
Test report for head
74276a0as pushed (not merged onto currentmain) – NVIDIA, wave32.Tested
.\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 742 passed, 0 failed, 41 ignoredgpu_buffer_load_format_d16_x_and_xyz_preserve_upper_halfran and passedXCL_SAMPLE_*data set (game-data tests not run)Not tested
mainAI use
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-28T20:17:32Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:04:28Z.
Triage (#1607) – head
74276a0#1977 (opened later) contains the same emit.rs hunk for odd-component D16 format loads, and also changes the direct-DXIL path (gpu/dxil/lower_mem.rs) and adds integer saturation. This PR is the earlier, single-purpose fix with a test of in-bounds and out-of-bounds loads; main still writes
0uinto the upper half.Not covered here: the direct-DXIL lowering of the same loads still zeroes the upper half, so the two routes disagree after this PR.
Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.