Recompiler: stream gpu::effects without Vec<Decoded>/HashSet and avoid copying compute blobs #2656
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2656
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@Decodere on GitHub · 2026-11-26 05:10 UTC · original
Decodere:fix-gpu-effects-streaming-and-zero-copy→main· +196 −36 · 1 files · 1 commits · openWhat 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.
@DarkPanda69 on GitHub · 2026-11-26 05:28 UTC · original
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.
@SlopTart on GitHub · 2026-11-26 05:34 UTC · original
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.
@luckyteagirl on GitHub · 2026-11-26 05:12 UTC · original · reviewed
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).github-bot referenced this pull request2026-11-26 12:40:17 +00:00
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.