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.
Wave64 follow-up (test-only overlay): In separate scratch checkouts at the same head, I changed only the existing
Not tested Full AMD workspace, Intel, retail smoke or shader samples, and performance. AI use Ran via Samaritan:
|
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
luckyteagirl
left a comment
There was a problem hiding this comment.
On 69b0bf6, this PR extends available-load reuse to S_BUFFER_LOAD_DWORD*, but reload::changes still misses VOPC SDWA's SD=1, SDST SGPR write. For example, two identical S_BUFFER_LOAD_DWORD instructions using descriptor s[4:7], separated by V_CMP_EQ_U32 SDWA writing s4, can reuse the first load's value for the second even though the descriptor base changed. The new buffer-load key makes this instruction family subject to the existing missed invalidation; the base emits two loads.
#2479 fixes the SDWA invalidation for the same analysis. Could this PR be stacked/rebased on that fix, or include it before buffer-load reuse is merged? Extending its CPU analysis fixture to a changed buffer descriptor would pin down this new instruction family. Source review only; I did not run the synthetic program.
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.