Recompiler: stream gpu::effects without Vec<Decoded>/HashSet and avoid copying compute blobs #2646
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2656"
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 Decodere on 2026-11-26T05:10:36Z.
What is in it
Eliminates full-shader
Vec<Decoded>/HashSet<u64>allocations andVec<u8>compute-blob copies incrates/xcl/src/gpu/effects.rs, and adds an early-exit path for memory-writing shaders inbig_and_image_only:analyze+update_writes): Streamsrdna2::decodeover&code[off..]preserving the exactended/S_CODE_ENDstop rules andupdate_writesclassification (ENC_MIMG,ENC_MUBUF/MTBUF/FLAT/FLAT_GLBL/FLAT_SCRATCH/SMEM,ENC_DSGDS/append/consume/ordered-count/DS_GWS_*). Collects monotonically increasingd.pcintopcs(capped initially to(code.len() / 6).min(256)whenstop_on_memoryis enabled so early-exiting memory writers avoid large upfront allocations) and validates branch targets withpcs.binary_search(t)instead of building aHashSet<u64>.analyze_with_far_jumps): Delegates only whenS_SETPC_B64is encountered (afterS_CODE_END/ early-memory-exit checks), runsrdna2::resolve_far_jumps(&mut insts), preserves the exactlastterminator /S_BRANCH/far_targetcheck, and validates branch/indirect targets viainsts.binary_search_by_key(&t, |x| x.pc).big_and_image_onlywith early exit on memory writes: Replacescompute_code() -> Option<Vec<u8>>withis_big_image_only_code(code: &[u8]) -> boolborrowing&f.code(FSPX) and&f.data[p.offset..end](FSSM, keepingf.error.is_none()andp.offset.checked_add(p.len)checks intact) and callinganalyze(code, true).is_some().Part of #2508
Part of #1833
Tested
streaming_matches_reference_of_across_edge_cases): Verifies byte-identicalof()andanalyze(c, true).is_some()parity against verbatim pre-fixof_reference()across empty code, early memory write + trailing undecodable/OOB branch/S_CODE_END, earlyS_ENDPGM+ post-end store, valid & OOBS_SETPC_B64(includingS_SETPC_B64as final instruction and combined with memory writes),S_SWAPPC_B64/S_CALL_B64,< BIG_CODE, valid & errored FSSM and FSPX containers, and 64 deterministic pseudo-random instruction streams.xbox::parse):big_and_image_only):21,567.7 µs->18,940.5 µs(-12.2%, WARP run) /29,736.1 µs->26,312.4 µs(-11.5%, RTX run).big_and_image_only):21,436.2 µs->12,541.7 µs(-41.5%, WARP run) /24,440.0 µs->12,920.7 µs(-47.1%, RTX run).XCL_ADAPTER=warp,XCL_WARP=1,cargo test --release -p xcl --lib "gpu::effects::tests::" -- --test-threads=1 --nocapture):8 passed; 0 failed; 0 ignored; 0 skipped(3.74s, zero compiler warnings ineffects.rs).cargo clippy --all-targets):0new warnings incrates/xcl/src/gpu/effects.rs(only the 2 pre-existingtype_complexitylints on untouched existing test linesasmandwriters).cargo test --release -p xcl --lib "gpu::effects::tests::" -- --test-threads=1 --nocapture):8 passed; 0 failed; 0 ignored; 0 skipped(4.70s).Regression run
Full release workspace on RTX 4060 (
cargo test --release --workspace --no-fail-fast -- --test-threads=4 --nocapture):37test binaries,1436 passed; 0 failed; 47 ignored,29pre-existing environment-gatedSKIPPEDlines:21skipped:no wave64(RTX 4060 is wave32)3skipped: wave32per-lane form: refusedby driver (f16 arithmetic,f16 packed,f32 conversions)3skipped: no D3D12 debug layer (d3d12SDKLayers.dllunavailable on host: debug-layerdred: false/trueanduploads_start_from_each_subresources_state)1skipped:pso_measurement_compiles_an_exact_synthetic_record(cannot disable driver cache on Windows)1skipped:heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows)Paired 60 s RTX 4060 smoke capture (
scripts/smoke.ps1):Base (
origin/mainb49be1836844fe0b0cdb3211dce3cb7fb4e21ac7):PR (
caed44ec41eb77a2d619df1f43536e64bab705b6):Not tested
29host-gated workspace tests skipped on this RTX 4060 machine (wave64 hardware, wave32 per-lane driver support, D3D12 SDK debug layer, driver cache disable, and heap windows).AI use
Google Antigravity (Gemini 4 Neon) wrote the patch, unit tests, and PR description; all commands, test runs, benchmarks, and paired 60 s GPU smoke captures were executed directly in this workspace.
Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T05:12:42Z.
Review: COMMENTED
Could
analyze_with_far_jumpsalso cap its initial capacity whenstop_on_memoryis true? An earlyS_SETPC_B64reaches this reservation before any store is checked. If a buffer store follows shortly after it, the function immediately returns, but it has already requestedcode.len()/6fullDecodedslots instead of a small initial buffer. Main copied the code bytes but grew its decoded-instruction storage on demand. A far-jump-before-store fixture with a long retained suffix would exercise this early-reject path. Source review only at headcaed44ec; I did not measure peak memory or timing. AI-assisted with Codex (GPT-6.2 Sol).Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-26T05:28:06Z.
Native wave64 run (the wave64 tests skipped on the RTX 4060) on an AMD RX 9070 XT, plus an RTX 3060: the new test passes, and nothing else changes in the GPU suite.
Head
caed44eapplied onmainb49be18, debug, Windows 11 Pro 26200,cargo test -p xcl --lib -- gpu:: --test-threads=4onmainand with the PR, card chosen withXCL_ADAPTER:mainOn both cards, the only result change against
mainis the newstreaming_matches_reference_of_across_edge_cases(ok), with no new skips. The 2 RX 9070 XT failures are the AMD fuzz seeds tracked in #2115, the same onmain.Not tested: cold-start PSO timings on a retail cache, the D3D12 debug-layer tests (no
d3d12SDKLayers.dllhere either), a title.AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-26T05:34:11Z.
Tested: current PR head merged onto current
origin/main(clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo targetx86_64-pc-windows-gnurun under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).gpu_suite (cold cache): 165 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR. This PR does not change the mad/mac red on RADV.Targeted run of
streaming_matches_reference_of_across_edge_cases: passed (2.78 s).Not tested: retail titles (no title data on this lane, counts only).
AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-12-01T02:32:43Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:35:42Z.
Triage (#1607) – head
caed44eMain already has this change: commit
b66b5b03("Recompiler: stream gpu::effects without Vec/HashSet and avoid copying compute blobs", merged with the #2959 stack) makes the same 196/36-line change to crates/xcl/src/gpu/effects.rs, includinganalyze,analyze_with_far_jumps,is_big_image_only_codeand the same test. The only difference from main is inanalyze_with_far_jumps, where main's later commite1634cd8caps the initial allocation; this PR would undo that.Recommendation: close (superseded by main commit
b66b5b03).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 throny on 2026-12-01T12:57:03Z.
Closing as superseded: this change is already on
main(b66b5b03). PR's changed lines are identical to mainb66b5b03(gpu::effects streaming change; compared line by line, 234 lines both); main later addede1634cd8on topTwo independent checks found this: Foniass's close list on #1607 and ours against current
main. If something here is still missing onmain, say so and reopen it, or ask and I will.AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.
Pull request closed