Recompiler: widen 1-window raw MUBUF bounds checks to 64-bit to prevent wrap #1146
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1146
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1146"
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?
@b3IKK on GitHub · 2026-11-24 12:32 UTC · original
b3IKK:recomp/mubuf-raw-bounds-overflow→main· +54 −23 · 2 files · 1 commits · openIn
mubuf,buffer_atomic, andmubuf_d16, the single-window (mem_windows == 1) path computedt_off = voff + OFFSETand checkedt_off + bytes <= d2in 32-bituint, unlike the multi-window path which already usesuint64_t. A large/negativevoff(e.g.0xFFFFFFFCwithbytes = 4, or0xFFFFFFF0withOFFSET = 16) wrapped past2^32to0 <= d2, reading or writing out of bounds instead of treating the access as out of bounds.This hoists
uint64_t t_offand uses the 64-bit raw bounds check in both single- and multi-window modes acrossmubuf,buffer_atomic, andmubuf_d16.What is in it
crates/xcl/src/gpu/recomp/emit.rs: computet_offand rawSTRIDE == 0bounds comparisons inuint64_tformubuf,buffer_atomic, andmubuf_d16regardless ofmem_windows.crates/xcl/src/gpu/recomp/tests.rs: add GPU testgpu_mubuf_raw_bounds_do_not_wrap_32bitcoveringBUFFER_LOAD_DWORD,BUFFER_STORE_DWORD,BUFFER_ATOMIC_ADD, andBUFFER_LOAD_SHORT_D16(verified failing before the fix); update the HLSL text check inatomic_fcmpswap_x2_is_a_bitwise_64_bit_casfor the widened comparison.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_mubuf_raw_bounds_do_not_wrap_32bit: 1 passed, 0 failed (failed on the GPU before the fix, reading0xDEAD_BEEFfrombase - 4)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.@DavidM1911 on GitHub · 2026-11-24 12:44 UTC · original
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 mubuf: 1 passed, 0 failed —gpu_mubuf_raw_bounds_do_not_wrap_32bitexercises the widened 64-bit bounds check on real hardware.AI use: test runs by Devin (Cognition, SWE-2); no code changes.
@bjarngard on GitHub · 2026-11-24 13:05 UTC · original
Test report for head
9e43be5(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_mubuf_raw_bounds_do_not_wrap_32bitpassedNot 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.
@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
x86_64-pc-windows-gnu.9e43be5as it is (based on47efa2e), no uncommitted changes. The lib test binary runs under Wine, one test per process (--exact).gpu::recomp::tests::gpu_mubuf_raw_bounds_do_not_wrap_32bit: ok, no SKIPPED.Not tested
AI use
@luckyteagirl on GitHub · 2026-11-25 04:22 UTC · original
RX 6800M focused GPU report for PR #1146 at
9e43be57c295938915ae2dd4e458e113d1d3e89cSetup: Windows 11 build 26200, AMD Radeon RX 6800M (driver
30.0.13002.13003), Ryzen 9 5980HX, Rust1.99.0MSVC, DXC/DXIL1.9.2609.5. Clean exact-head worktree;XCL_ADAPTER=6800M,XCL_REQUIRE_GPU=1,XCL_DIRECT_DXIL=0.Tested
cargo test --locked -p xcl --lib -j 2 gpu_mubuf_raw_bounds_do_not_wrap_32bit -- --test-threads=1 --show-output: 1 passed, 0 failed, 0 ignored, no printedSKIPPEDsubcases. This covers raw MUBUF bounds near 32-bit wrap, including load, store, atomic add, and D16 load on the AMD GPU.cargo build --locked --workspace -j 2: passed.Not tested: Full workspace suite, paired retail-title smoke, other GPUs, or the Direct DXIL path. This verifies the focused HLSL regression on the PR head; it does not establish a green full suite or world-load behavior. No game data was used.
AI assistance: OpenAI Codex (GPT-6) ran the commands, extracted the test counts from the log, and drafted this report.
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.