Repository navigation
Recompiler: direct DXIL s_buffer_load offsets wrap within their window - #2062
Open
LucasHoepfner wants to merge 1 commit into
Open
LucasHoepfner wants to merge 1 commit into
LucasHoepfner wants to merge 1 commit into
Conversation
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)
|
A run with vkd3d-proton as the host D3D12. The DXIL goes through dxil-spirv and then the NVIDIA Vulkan driver, a different compiler from a native-Windows run: this PR's new test passes. Tested
Not tested
AI use
|
|
NVIDIA RTX 3070 on native Windows, head Tested
Regression run ( PR head That is 111 % of Not tested
AI use
|
LucasHoepfner
marked this pull request as ready for review
November 25, 2026 03:33
Contributor
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With two or more memory windows, the direct DXIL translator read an
s_buffer_loadwhose 32-bit offset (OFFSET + soff) wraps from the next window, 4 GiB above the buffer. It used the wrapped sum for the range check and the address, but took the window from the two parts added in 64 bits. The HLSL path uses the 32-bit sum for all three. Part of #1893: #1933 has the MUBUF and atomic cases, and with it this is every case measured there where the two translators differ (#1893 (comment)), so the issue can be closed once both are in.What is in it
Recompiler: direct DXIL s_buffer_load offsets wrap within their window: the window comes from the 32-bit offset (crates/xcl/src/gpu/dxil/lower_mem.rs, one line), with the GPU testgpu_scalar_buffer_load_offset_wraps_within_its_window(crates/xcl/src/gpu/recomp/tests.rs):s_buffer_load_dwordanddwordx4withOFFSET0x20 andsoff0xFFFF_FFF0 on a two-window arena, through both translators and both window forms.Tested
stable-x86_64-pc-windows-msvc; DXC 1.8.2502.11; debug. This head (7e2c923, onmainaaa0936).cargo test -p xcl --lib gpu_scalar_buffer_load_offset_wraps_within_its_window: without thelower_mem.rsline, 1 failed atdirect true, heap windows false: dword(left 0xB000_0000, window 1's marker; right 0xA000_0000); with it, 1 passed.cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 1152 passed, 0 failed, 46 ignored. SKIPPED: 20 ×no wave64,heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows),pso_measurement_compiles_an_exact_synthetic_record(Developer Mode is off), 3 per-lane programs with f16 instructions (refused (unsupported …)).Regression run
scripts/smoke.ps1 -Game <folder> -Seconds 60, the same title, back to back, menus, no input.mainaaa0936:This head
7e2c923:Not tested
s_buffer_loadthat wraps); AMD / Intel GPUs; native wave64; a release build of the tests.soffis not part of the MUBUF range check;num_records * stridecan wrap) are the same on the HLSL path and are not changed here.AI use