Repository navigation
Recompiler: range-check UMA memory windows and propagate 64-bit carry/borrow - #792
Conversation
…/borrow When a translated shader uses multiple 4 GiB UMA windows (`mem_windows > 1`), `window()` previously selected `xcl_w = hi & 3u`, silently wrapping any out-of-UMA high dword onto live windows 0..3, and address arithmetic dropped 32-bit carry/borrow across 4 GiB window boundaries (part of xcl-dev#105). Pass `Uma::base() >> 32` through `IO_UMA_BASE_HI` (`io` slot 112) into `xcl_uma_base`, compute 64-bit effective addresses before selecting `xcl_w`, map `hi == 0` to window 0 for reads only (32-bit console descriptor table pointers), and make the `default` arm in `mem_accessors` return 0 for reads and drop stores/atomics with zeroed `out` values instead of aliasing `mem`.
|
Hardware check of Tested
Regression run PR ( Not tested
AI use
|
|
Test run of Tested
Review: Computing the 64-bit effective address before selecting the window, and range-checking it against the UMA base, stops an out-of-UMA high dword from aliasing a live window through Not tested: no retail title or regression run (I have no unpacked game), no Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code. |
Range-check multi-window UMA address selection and compute 64-bit effective addresses before selecting
xcl_w, so out-of-UMA high dwords cannot alias live windows viahi & 3uand 32-bit offsets carry/borrow across 4 GiB window boundaries. Part of #105.What is in it
crates/xcl/src/gpu/recomp/mod.rs,runner.rs,crates/xcl/src/hle/d3d12x/bind.rs,console_list.rs: passUma::base() >> 32viaIO_UMA_BASE_HI(ioslot 112).crates/xcl/src/gpu/recomp/emit.rs: loadxcl_uma_basefromio, compute 64-bit effective addresses across SMEM, MUBUF/MTBUF, FLAT/GLOBAL (including_addtid, atomics, and BVH) whenmem_windows > 1, splitwindow_read(hi == 0maps to window 0 for 32-bit descriptor tables) vswindow_write(dropshi == 0and out-of-range high dwords), and makemem_accessorsdefaultarms return 0 / drop stores and atomics instead of aliasingmem.crates/xcl/src/gpu/recomp/tests.rs: addgpu_memory_windows_reject_out_of_uma_aliasingcovering out-of-UMA reads/writes/atomics,hi == 0read vs write, stridedV#high-dword masking, 64-bit carry across window 0→1, and signed borrow below window 0; populateIO_UMA_BASE_HIingpu_sparse_vram_descriptors_buffers_and_xmem.Tested
rustc 1.98.1(x86_64-pc-windows-msvccross-compile), debug.cargo test --workspace --no-fail-fast --target x86_64-pc-windows-msvc -- --test-threads=4 --skip a_freed_block_is_decommitted_before_its_address_is_reused: 700 passed, 4 failed (pre-existing Wine-only failures:hle::xaudio2::tests::xma2_source_voice_decodes_and_manages_lifetime,test_title_runs_and_game_folder_is_untouched,disk_free_space_ex_reports_pls_quota,set_predication_buffer_state_and_kickoff), 41 ignored, 1 filtered (a_freed_block_is_decommitted_before_its_address_is_reused, aborts under WineMEM_DECOMMITstress).SKIPPEDGPU tests:gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask(no wave64),gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware(no wave64).gpu_memory_windows_reject_out_of_uma_aliasing,gpu_memory_windows_above_4_gib,gpu_mesh_mode_reads_memory_windows,gpu_bvh64_intersect_ray_across_memory_windows_and_grazing,gpu_sparse_vram_descriptors_buffers_and_xmem.Regression run
scripts/smoke.ps1runs on a retail title (Linux/Proton environment only).Not tested
scripts/smoke.ps1retail regression run.AI use