Repository navigation
Conversation
…d copying compute blobs Replace Vec<Decoded> + HashSet<u64> in gpu::effects::of with a single-pass streaming decoder over sorted instruction PCs, delegating to an explicit far-jump path only when S_SETPC_B64 appears. Add early-exit on memory writes and zero-copy slice borrowing for FSPX and FSSM compute shaders in big_and_image_only. Part of xcl-dev#2508 Part of xcl-dev#1833 Assisted-by: Google Antigravity (Gemini 4 Neon)
luckyteagirl
left a comment
There was a problem hiding this comment.
Could analyze_with_far_jumps also cap its initial capacity when stop_on_memory is true? An early S_SETPC_B64 reaches this reservation before any store is checked. If a buffer store follows shortly after it, the function immediately returns, but it has already requested code.len()/6 full Decoded slots 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 head caed44ec; I did not measure peak memory or timing. AI-assisted with Codex (GPT-6.2 Sol).
|
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
On both cards, the only result change against Not tested: cold-start PSO timings on a retail cache, the D3D12 debug-layer tests (no |
|
Tested: current PR head merged onto current
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. |
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.