Recompiler: write all bytes of unaligned multi-dword formatted buffer stores #309
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/312"
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 Michael-Glaser on 2026-11-23T23:07:13Z.
st_bytesinPRELUDE_MEMonly wroter.xon its unaligned / non-multiple-of-4 fallback path, dropping bytes 4..15 of 8-, 12-, and 16-byte formatted buffer stores.What is in it
crates/xcl/src/gpu/recomp/emit.rs: loop over all 4 dwords ofrinst_bytes's fallback path.crates/xcl/src/gpu/recomp/tests.rs: HLSL emission test + GPU test for 8-, 12-, and 16-byte unaligned formatted stores.Tested
aarch64-apple-darwin, Rust 1.100.0):cargo check --offline --target x86_64-pc-windows-msvc --workspace --tests(0 errors, 0 new warnings).@regiumlepidi(RTX 5070 Ti + RDNA2 iGPU, 668 passed, 0 failed, 41 ignored) and@nullmarsh(RX 9060 XT RDNA4, 668 passed, 0 failed, 41 ignored, 0 SKIPPED GPU tests), both confirming the new tests fail without theemit.rsfix; plus@DavidM1911(RTX 3060 Ti, merged withmain).Regression run
Retail 60 s smoke run contributed by
@CuteBooty(RTX 3070 8 GB, NVIDIA 621.24, Ryzen 5 3600, Windows 11 Pro 26200, Rust 1.100.0 MSVC, release build):main:
this PR:
Not tested
AI use
@CuteBootywith Claude Code (Claude Opus 5.5).Imported from ivall/xcl. Originally posted by regiumlepidi on 2026-11-23T23:45:45Z.
A Windows run for this draft, since the description has none yet:
d9d6fe0merged onto currentmaindb1ddb2(clean merge): builds and passes on NVIDIA and AMD, and the new tests catch the bug.Tested
XCL_ADAPTER=radeon.\scripts\test.ps1(cargo test --workspace -- --test-threads=4), noXCL_SAMPLE_*setmaindb1ddb2d9d6fe0ondb1ddb2GPU tests skipped: the usual 2 (
no wave64) on NVIDIA, none on the iGPU.The two new tests with this PR's
tests.rsbutmain'semit.rs: both fail on both adapters, e.g.gpu_unaligned_multi_dword_format_stores:store of 8 bytes at 0x100+1,left: [170, 68, 51, 34, 17, 170, 170, …],right: [170, 68, 51, 34, 17, 136, 119, 102, 85, 170, …](the second dword never written). With this PR'semit.rsboth pass on both adapters.Not tested
scripts/smoke.ps1on a real title (I have none).AI use: Claude Code with Claude Opus 5.5 ran the build and tests and wrote this comment; the numbers come from those runs.
Imported from ivall/xcl. Originally posted by nullmarsh on 2026-11-23T23:48:40Z.
Tested
d9d6fe0merged ontomaindb1ddb2(clean merge) on AMD RDNA4: pass, and both new tests fail without theemit.rschange. This covers the Windows build and GPU run listed under "Not tested".Tested
.\scripts\test.ps1: 668 passed, 0 failed, 41 ignored; noSKIPPEDGPU tests on this adapter.XCL_REQUIRE_GPU=wave64,mesh cargo test -p xcl --lib unaligned:st_bytes_writes_every_dword_of_unaligned_storesandgpu_unaligned_multi_dword_format_storespass.emit.rsput back tomain. Both tests fail. The GPU one fails at its first case,store of 8 bytes at 0x100+1: bytes 1..4 holdr.xand bytes 5..8 stay0xAA(expected88 77 66 55). (The PR's owntests.rs, from its base4017f8f, doesn't compile on currentmain, so the control uses the merged tree.)Not tested
XCL_SAMPLE_*set and no retail title, so nosmoke.ps1regression run; NVIDIA.AI use
Imported from ivall/xcl. Originally posted by CuteBooty on 2026-11-24T21:02:21Z.
Regression run on a retail title for
b8424b2: pass (no device removal, no crash, frames and peak commit within the check's limits).Tested
scripts\smoke.ps1 -Game <folder> -Seconds 60, no input, on this PR's head as it is and onmain47efa2e, the commit it branches from, each from a clean checkout. Each build ran twice back to back; the blocks are the second runs. Themainblock is shared with my reports on other PRs of the same base.main:
this PR:
Not tested
mainmerged in, AMD and Intel GPUs.AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T14:43:36Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
Imported from ivall/xcl. Originally posted by Michael-Glaser on 2026-11-27T12:01:12Z.
Thanks @CuteBooty, @regiumlepidi, @nullmarsh, and @DavidM1911! Added the verbatim
xcl-smoke v1regression blocks forb8424b2and the Windows GPU test results into the PR description.Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-27T17:56:52Z.
NVIDIA and AMD full-suite run, to go with the reports above by CuteBooty, since none of them covers AMD. Tested exact head
b8424b2c(on its base47efa2e).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace --no-fail-fast -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 743 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.st_bytes_writes_every_dword_of_unaligned_stores,gpu_unaligned_multi_dword_format_stores.XCL_ADAPTER=radeon),cargo test --workspace --no-fail-fast -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 743 passed, 0 failed, 41 ignored, no skips.--skipleaves out tests that fail on main6089122atoo, not because of this PR. On NVIDIA:heap_window_out_of_memory_falls_back_to_the_switch_form(#1651), the fourgpu::recomp::lower_dxil::tests::*_programs_on_the_gputests,const_and_null_mask_operands_agree_with_hlsl_on_the_gpuandmask_ff0_and_flbit_agree_with_hlsl_on_the_gpu(follow-up on #1651) fail becauserunner::skip_testturns their skips into failures underXCL_REQUIRE_GPU=mesh, andgpu::dxil::fuzz_testsseeds 70, 545, 1019 and 1507 failCreateComputePipelineStatewithE_OUTOFMEMORYon this card (drivers 616.64 and 621.40). On AMD:fuzz_validate_and_gpu_1fails on seed 540 (res[833]0x7 vs CPU 0x6). The AMD run does not setXCL_REQUIRE_GPU.Not tested
AI use
Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-11-27T18:00:57Z.
Tested on AMD / Linux:
b8424b2c(RX 9070 16 GB, RDNA4, Mesa 26.3.1 RADV; Ryzen 5 9600X, 32 GB; CachyOS; Proton Experimentalexperimental-11.0-20261112with vkd3d-proton masterec207194plus a local patch dropping thelpVtblchecks of command allocators and lists; DXC 1.9.2609.5; Rust 1.96.0,x86_64-pc-windows-gnudebug build, tests run under Wine)The head as it is (not merged onto current
main), with its base47efa2ecthe same session as the baseline.Tests (
XCL_REQUIRE_GPU=wave64)cargo test -p xcl --lib -- unaligned --test-threads=1: 2 passed, 0 failed, 0 ignored (st_bytes_writes_every_dword_of_unaligned_stores,gpu_unaligned_multi_dword_format_stores).cargo test --workspace --no-fail-fast -- --test-threads=4with--skip compositor_blends_ui_plane_over_scene_plane --skip failed_restore_stops_before_importing_an_unbacked_window --skip grooming_leaves_a_window_under_1_gib_only_its_hole(the first loses the RADV device here, the other two run out of memory under Wine): lib 692 passed, 8 failed, 21 ignored; base47efa2eclib (same flags): 693 passed, 5 failed, 21 ignored. The 3 extra (placed_title_textures_share_vram_and_preserve_pixels,transitions_apply_when_their_list_is_submitted,d32s8_targets_take_their_own_size_of_video_memory) fail under load here: run alone they passed 2 of 2 times on this head and on the base, and a second lib run gave 695 passed, 5 failed on this head, the same 5 as the base (693 passed, 5 failed). The other binaries fail the same 3 tests as onmainhere (e2e,pls_quota,predication_e2e).Not tested
AI use
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T03:06:46Z.
Triage (#1607) – head
b8424b2No open or merged PR makes the same change:
st_byteson main still writes onlyr.xfor unaligned or non-multiple-of-4 stores, so 8/12/16-byte format stores at an unaligned address lose every dword after the first. The loop over the dwords (with the spill of each into the next) is correct for the partial last dword too, and the GPU test checks all three sizes at offsets 1-3.The PR conflicts with main and needs a rebase.
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.