Repository navigation
Recompiler: decode only requested components in buffer_load_format_* - #1310
coolpersonnn wants to merge 1 commit into
Conversation
|
Ran the two new tests on an NVIDIA Blackwell part at Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC 14.44.35207, DXC 1.9.2609.5, debug build.
Not tested: native wave64, RDNA2/RDNA4 and Intel GPUs, Wine, release profile, retail titles. AI-assisted (OpenCode), model: DeepSeek V4.1 Flash 1017 - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
Narrow buffer_load_format_* and tbuffer_load_format_* instructions
previously pre-decoded all four format components into {t}_c via
fmt_comp even when only 1-3 components were selected. On format-heavy
compute shaders (especially wide unrolled kernels), the unused decodes
inflated emitted HLSL, DXIL size, and DXC compile time.
Add a branch-free fmt_sel helper right after dst_sel in PRELUDE_MEM
that routes only the needed format components into dst_sel, and update
BufKind::FormatLoad to use fmt_sel whenever n_comp < 4 (including d16
loads, binding {t}_s{c} once before the 16-bit pack so the format
decode is not evaluated twice).
Measured on 4 extracted compute shaders from a retail shader pack
(split-wave64, isolated caches):
- 2,809 insts (9 x, 1 xy): DXIL 157184 B -> 141620 B (-9.9%), DXC 1.07 s -> 1.04 s
- 7,305 insts (25 x, 2 xyz): DXIL 489424 B -> 450520 B (-7.9%), DXC 4.13 s -> 4.18 s
- 16,414 insts (37 x, 6 xy, 4 xyz): DXIL 1092324 B -> 1030584 B (-5.7%), DXC 11.16 s -> 10.97 s
- 88,863 insts (3,281 x): DXIL 29750432 B -> 20197536 B (-32.1%), DXC 130.59 s -> 94.61 s (-27.5%)
Tests: .\scripts\test.ps1 passed (753 passed, 0 failed, 41 ignored;
2 expected wave64 GPU skips on RTX 5090), plus targeted Radeon GPU
runs for gpu_buffer_load_format_swizzled_narrow_loads and
gpu_typed_buffer_loads_and_stores.
Assisted-by: Antigravity via T3 Code (Gemini Pro)
c8b5978 to
234ec72
Compare
|
A size measurement in favour of this direction, on the largest retail compute program (
So at AI use: Claude Code (Claude Fable 5.1) ran DXC and counted; the export was mine. |
|
Tested Clean PR head $r='L:/XclTooling/pr1310-234ec72c'
$env:Path="$env:USERPROFILE/.cargo/bin;$env:Path"
$env:TEMP="$r/temp"
$env:TMP=$env:TEMP
$env:CARGO_TARGET_DIR="$r/target"
$env:CARGO_BUILD_JOBS='2'
$env:CARGO_INCREMENTAL='0'
$env:XCL_DXIL_CACHE="$r/dxil"
$env:XCL_DXC_DIR="$r/dxc-1.9.2609.5/bin/x64"
$env:XCL_DIRECT_DXIL='0'
cargo test -p xcl --lib -- --exact gpu::recomp::tests::buffer_load_format_decodes_only_requested_components gpu::recomp::tests::buffer_format_d16_packs_and_unpacks_halves gpu::recomp::tests::buffer_format_table_matches_llvm --nocapture --test-threads=1
$env:XCL_ADAPTER='A770'
$env:XCL_REQUIRE_GPU='wave64'
Set-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSigned -Force
& 'L:/XclTooling/Invoke-ArcTest.ps1' -Test { cargo test -p xcl --lib -- --exact gpu::recomp::tests::gpu_buffer_load_format_swizzled_narrow_loads gpu::recomp::tests::gpu_typed_buffer_loads_and_stores --nocapture --test-threads=1 }
Not tested Full workspace suite, retail title smoke runs, PR-base comparison, AMD or NVIDIA, native wave64, direct DXIL, release mode, and performance. AI use Codex (gpt-6.2-sol) selected and ran the existing tests and wrote this report. |
|
Test report for head Tested
Not tested
AI use
|
Decode only the format components actually selected by narrow
buffer_load_format_*andtbuffer_load_format_*instructions instead of unconditionally callingfmt_compon all four channels. On format-heavy compute shaders, this cuts emitted HLSL, DXIL binary size, and DXC compile time without altering decoded semantics.What is in it
fmt_sel(uint4 r, uint info, uint sel, bool isint)right afterdst_selinPRELUDE_MEM(crates/xcl/src/gpu/recomp/emit.rs), evaluating format decoding only for channels selected bydst_sel.BufKind::FormatLoad(crates/xcl/src/gpu/recomp/emit.rs) to emitfmt_comp(uint4 {t}_c) only whenn_comp == 4, and usefmt_selwhenevern_comp < 4(includingd16loads, binding{t}_s{c}once per component before the 16-bit pack sofmt_selis not evaluated twice insideselect).buffer_load_format_decodes_only_requested_components) and a D3D12 GPU test (gpu_buffer_load_format_swizzled_narrow_loads) covering non-identityDST_SELswizzles,SEL_0/SEL_1/missing channels on float andUINTformats,TBUFFER_LOAD_FORMAT_X,D16_{X,HI_X,XYZ}(including low-half preservation), and out-of-range loads (crates/xcl/src/gpu/recomp/tests.rs).Tested
234ec72on Ryzen 9 9950X3D, RTX 5090 (621.01), Windows 11 build 26300, rustc 1.100.0 and DXC 1.8.2502.11..\scripts\test.ps1withXCL_ADAPTER=nvidiareported 961 passed, 0 failed and 43 ignored. The harness reported 23 GPU skips.XCL_SAMPLE_*fixtures were unset for the rebased suite.GPU coverage skips on the rebased head
The original measurements below were taken before this rebase.
32.0.16.2101), AMD Radeon(TM) Graphics (driver32.0.21045.29003, targeted GPU check), AMD Ryzen 9 9950X3D 16-Core Processor, Windows 11 (NT 10.0.26300.0),rustc 1.100.0(stable-x86_64-pc-windows-msvc), DXC1.8.2502.11..\scripts\test.ps1(cargo build --workspaceandcargo test --workspace -- --test-threads=4, debug):753 passed, 0 failed, 41 ignored(709lib +44integration/e2e/oracle;SKIPPEDGPU tests on RTX 5090:gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64;XCL_SAMPLE_*unset/skipped).XCL_ADAPTER=radeon:cargo test -p xcl --lib gpu_buffer_load_format_swizzled_narrow_loads(1 passed, 0 failed) andcargo test -p xcl --lib gpu_typed_buffer_loads_and_stores(1 passed, 0 failed).9 x,1 xy): DXIL157184 B->141620 B(-9.9%), DXC1.07 s->1.04 s, PSO1.32 s->1.22 s(1 made, 0 refused).25 x,2 xyz): DXIL489424 B->450520 B(-7.9%), DXC4.13 s->4.18 s, PSO9.00 s->8.80 s(1 made, 0 refused).37 x,6 xy,4 xyz): DXIL1092324 B->1030584 B(-5.7%), DXC11.16 s->10.97 s, PSO47.42 s->49.19 s(1 made, 0 refused).3,281 x): DXIL29750432 B->20197536 B(-32.1%), DXC130.59 s->94.61 s(-27.5%), PSO>60.0 sbefore />120.0 safter (killed at cap).mainbaseline smoke run had a cold shader cache, whereas the PR smoke run executed after caches were warmed.Regression run
Main
PR head
Not tested
CreateComputePipelineStateon the 88.9k-instruction compute shader still exceeded the 120 s timeout cap on RTX 5090.AI use
Antigravity via T3 Code (Gemini Pro) — inspected
crates/xcl/src/gpu/recomp/emit.rsandcrates/xcl/src/gpu/recomp/tests.rs, implementedfmt_seland the narrowBufKind::FormatLoademission path, wrote unit and GPU tests, ran the test suite, shader benchmarks, and smoke tests, and drafted the commit and PR description.