Recompiler: decode only requested components in buffer_load_format_* #1300
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1310"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by coolpersonnn on 2026-11-24T14:34:58Z.
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.Imported from ivall/xcl. Originally posted by Aniseto on 2026-11-24T14:37:49Z.
Ran the two new tests on an NVIDIA Blackwell part at
c8b5978: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.
buffer_load_format_decodes_only_requested_componentsandgpu_buffer_load_format_swizzled_narrow_loadspass here. The author's run used DXC 1.8.2502.11, so this also covers the newer compiler's code generation for the narrow loads on the same tests.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.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T15:42:03Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 21 ignored. (One run aborted with 0xc0000005 under parallel scheduling; clean on rerun — same flake seen on unmodifiedmain.)Thanks!
upstream-sync referenced this pull request2026-11-24 19:06:45 +00:00
upstream-sync referenced this pull request2026-11-24 23:06:49 +00:00
Imported from ivall/xcl. Originally posted by Rednaxeh on 2026-11-25T00:51:27Z.
A size measurement in favour of this direction, on the largest retail compute program (
CS_ScreenProbes_ActivateRays, record95cc13288a27a96e), HLSL path ofmain20cf130(#1321 in), 4 memory windows, native wave64, DXC 1.9.2602.17 on Windows:-O0(what XCL uses above 8 MB of HLSL; this program's HLSL is 15.0 MB)-O1-O0, withfmt_compreduced toreturn r[c & 3u](a size probe, not a correct program)So at
-O0the runtime format decode is 46 % of this program's DXIL: 1 890 typed buffer loads, each decoding its descriptor's format four times (7 561fmt_compcalls, all with a descriptor-derivedinfo, none constant), and DXC at-O0folds nothing. The AMD driver (RX 7800 XT, 32.0.32029.2010) refuses this program with E_OUTOFMEMORY after 15–33 s at its current size (#232, #1918). Decoding only the requested components, and decodinginfoonce per load rather than once per component, both act directly on this half; I can rerun the probe on this PR's head if useful.AI use: Claude Code (Claude Fable 5.1) ran DXC and counted; the export was mine.
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T01:08:24Z.
Tested
Clean PR head
234ec72cc5ac3b3d544b4444a26a03b6164694a4on Intel Arc A770 (driver 32.0.101.9175), AMD Ryzen 7 3800X, Windows 11 Enterprise Evaluation 25H2 build 26200.9974 x64, Rust 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc), MSVC 14.44.35207, and DXC/DXIL 1.9.2609.5. Cargo used the debug test profile.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.
Imported from ivall/xcl. Originally posted by xpatfussy69x on 2026-11-25T08:26:06Z.
Test report for head
234ec72as pushed (not merged onto currentmain) – NVIDIA, wave32.Tested
.\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 961 passed, 0 failed, 43 ignoredDIFFERS_ON_1426list, unrelated to this PR)buffer_load_format_decodes_only_requested_componentsandgpu_buffer_load_format_swizzled_narrow_loadsran and passedXCL_SAMPLE_*data set (game-data tests not run)Not tested
mainAI use
Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-11-25T20:46:13Z.
Independent AMD RDNA4 / Linux (RADV, native wave64) test report for head
234ec72cc5ac3b3d544b4444a26a03b6164694a4(merged cleanly ontomain6d12f58).Hardware & environment
experimental-11.0-20261112),vkd3d-protonmasterec207194(3.2.0) +dxil-spirvb540c8a2+ relaxed-vtable patch (-Db_ndebug=true), DXVKv3.1.1-209, DXC1.9.2609.5, Rustx86_64-pc-windows-gnu(debug)Unit / GPU tests (
XCL_REQUIRE_GPU=wave64,XCL_DXC_DIR,VKD3D_CONFIG=ignore_shared_fence,--test-threads=1 --nocapture)buffer_load_format: 2 passed, 0 failed, 0 ignored (0 skipped; coversbuffer_load_format_decodes_only_requested_componentsandgpu_buffer_load_format_swizzled_narrow_loadson the RX 9070)Not tested
AI use
main, ran the tests under Proton on this machine, and drafted this report.Imported from ivall/xcl. Originally posted by bmjask on 2026-11-25T21:13:29Z.
Review: COMMENTED
No concrete source-level defect found. Requested-component HLSL decoding preserves selector/missing-channel/integer behavior; structural, DXC, and GPU coverage are strong with reported Windows/NVIDIA/AMD/smoke evidence. Nonblocking scope: optional narrow TBUFFER_D16 coverage could strengthen it. I found no blocker.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T04:47:34Z.
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:23:54Z.
Triage (#1607) – head
234ec72No open or merged PR makes the same change. #1423 also edits the
BufKind::FormatLoadselector code, but it changes which channel a missing component reads, not how many are decoded. Whichever merges second needs a rebase, and the expected values for a missing Z / W in this PR's GPU test would change.fmt_selgives the same result asdst_selover the four decoded components, so the change looks correct.The PR conflicts with main, whose d16 path now uses
d16_fmt(...)instead off32tof16(asfloat(...)). The rebase has to keep that.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by coolpersonnn on 2026-12-01T14:27:21Z.
Closing: conflicts with newer d16 changes on main (and #1647), with limited payoff now that compute defaults to direct DXIL.
Pull request closed