Repository navigation
Recompiler: reuse repeated s_buffer_load_dword* loads in direct DXIL - #2256
ramon-victor wants to merge 1 commit into
Conversation
|
Tested Independent Windows verification on clean
Both logged 20 native-wave64 skips, three per-lane f16/f32 refusals, unavailable driver-cache control and unavailable heap windows. The RTX 2080 SUPER also logged two skips for the missing D3D12 debug layer.
Not tested Native wave64 execution of the focused reload fixture, full AMD workspace, Intel, retail smoke or shader samples, and performance. AI use Ran via Samaritan:
|
Extends the direct DXIL scalar load reuse pass (
gpu::dxil::reload) to follows_buffer_load_dword*in addition tos_load_dword*, so repeated non-coherent constant-buffer loads reuse their earlier post-bounds-check values instead of re-emitting buffer bounds checks, window selection, anddx.op.rawBufferLoadcalls.Part of #1269.
What is in it
crates/xcl/src/gpu/dxil/reload.rs: extendKeywith abuffer: boolflag sos_load_dword*ands_buffer_load_dword*cannot alias; matchS_BUFFER_LOAD_DWORD..DWORDX16(excludingGLC/DLCcoherent loads, requiringsbase <= 121for the 4-SGPR descriptor, and tracking all foursbase..sbase+4descriptor registers inreads()as well as rejecting loads whoseSDATAoverlaps any descriptor or offset register). Add unit tests for 4-SGPR invalidation, self-overwrite/GLC exclusion, non-aliasing,rawBufferLoadcount reduction, and a wave32 GPU execution test checking repeated load reuse (including OOB zeroing) and fresh reload after a global store.crates/xcl/src/gpu/dxil/lower_mem.rs: checkself.reloadat the top ofLw::smembefore branching ons_buffer_load*so availables_buffer_load_dword*repeats read their saved SSA variables directly.On a seeded 600-program sample (
xcl shaders <archive> --direct --sample 600 --seed 3 --max-bytes 40000 --validate --threads 8, 573 programs within the cap), all 573/573 validate cleanly (0validator failures):42,232,344 B -> 42,202,120 B(-30,224 B,-0.07%)302.6 ms -> 292.3 msTested
621.24, wave32), AMD Ryzen 7 5700X, Windows 11 Pro26300,rustc 1.99.0(x86_64-pc-windows-msvc), DXC/DXIL1.8.2502.11(Windows SDK10.0.26100.0).cargo test -p xcl --lib gpu::dxil::reload::tests(debug):9 passed; 0 failed(includings_buffer_load_reuses_and_tracks_four_sgpr_base,the_translator_emits_a_repeated_s_buffer_load_once, andgpu_repeated_s_buffer_load_matches_fresh_loadon the RTX 3070)..\scripts\test.ps1(debug, full workspace):1246 passed; 0 failed; 46 ignored(25 GPU sub-checks skipped on this wave32 adapter: 21no wave64, 1no heap windows, 3 per-lane#1426refusals).cargo build --release -p xcl+ direct DXIL validation sweep on 573 sampled retail shader programs:573/573translated anddxil.dll-validated (0failures).Regression run
Not tested
XCL_SAMPLE_*env vars unset).AI use
reload.rsandlower_mem.rs, implementeds_buffer_load_dword*reuse and unit/GPU tests, ran the workspace test suite, retail shader validation sweep, and 60 s smoke regression run.