Repository navigation
Recompiler: treat raw buffer offsets that wrap past 2^32 as out of range - #1933
PracticalStudios wants to merge 2 commits into
Conversation
|
The HLSL path has the same wrap in one of its two forms, from reading
Measured (edited; this replaces my earlier "should"). I ran this PR's program through the HLSL path on
Widening the one-window AI-assisted (Claude Code). |
|
Full-suite run, since this PR has no test report yet. Tested exact head Tested
Not tested
AI use
|
|
Diff audit passed ( Remaining before merge: one independent AMD GPU pass on |
bb5e0b7 to
7946c96
Compare
|
Rebased onto Rebased again onto AI use: Claude Code (Claude Opus 5.5) wrote this note. |
|
|
|
@philip-roy-jones would you have a few minutes for this PR's remaining check, an AMD run? Your RX 580 (native 64-lane waves) would cover what the NVIDIA runs couldn't. On head (and the full AI use: Claude Code (Claude Opus 5.5) wrote this request. |
|
Re-checked AI-assisted (Claude Code). |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
Direct DXIL's buffer bounds check added voff + OFFSET + bytes in 32 bits, so a wrapped sum passed it (xcl-dev#1893); loads read memory, stores and atomics wrote it.
7946c96 to
aa16bda
Compare
A scalar buffer load's offset is OFFSET + soff in 32 bits. The direct translator used that sum for the range check and the address, but took the memory window from the two parts added in 64 bits. Where the sum wraps, the check passed on the wrapped offset and the load read the right low address in the next window, 4 GiB above the buffer. The HLSL path uses the 32-bit sum for all three. The window now comes from the 32-bit offset too. Test: s_buffer_load_dword and dwordx4 with OFFSET 0x20 and soff 0xFFFF_FFF0 on a two-window arena, through both translators and both window forms. Without the change the direct path returns window 1's marker (0xB000_0000 where 0xA000_0000 is expected); the HLSL path passes before and after. Part of xcl-dev#1893; xcl-dev#1933 has the MUBUF and atomic cases. Assisted-by: Claude Code (Claude Fable 5.2)
Direct-DXIL raw buffer loads, stores and atomics now treat an offset that wraps past 2^32 as out of range. Part of #1893 (the raw-buffer part; the
s_buffer_loadpart is not changed).Why:
voff + OFFSETandoff + byteswere added in 32 bits, so a wrapped sum passed the bounds check. Onmain, abuffer_load_dwordat voff0xFFFF_FFF0+ OFFSET0x20on a 0x100-byte buffer returned another dword of the buffer (4116) instead of 0.What is in it
lower_mem.rs:mubuf'sin_rangeandbuffer_atomicalso require the sums not to wrap.gpu_direct_raw_buffer_offsets_that_wrap_are_out_of_range: wrapped loads read 0, a wrapped store and wrapped atomics (also with a non-zero OFFSET) are dropped; an in-range lane is the control.Tested
main(left: 4116, right: 0) and passes here; removing each of the two checks fails it.cargo test --workspace --no-fail-fast -- --test-threads=2onaa16bda: 1154 passed, 1 failed, 46 ignored. The failure (kernelx::tests::xmem_virtual_query_marks_cpu_readable_memory) fails the same way onmain(fixed by Tests: align XMemVirtualQuery buffers and verify CPU flags #650).Regression run
.\scripts\smoke.ps1 -Game <retail title> -Seconds 60, no input,main(this PR's base) first, same machine:Not tested
index < num_records).AI use