Repository navigation
Shaders: O(1) LRU shader cache, compile coalescing, and mesh CS caching - #255
RandomGithub12309 wants to merge 2 commits into
Conversation
Related to ivall#156. Replaces the linearly scanned 128-entry VecDeque ShaderCache with a HashMap + monotonic LRU clock (up to 4096 entries within the 64 MiB byte cap, accounting for overwritten entries' old sizes), coalesces concurrent misses per ShaderKey while leaving cached-only probes non-blocking, and caches the compute pass of NGG console_mesh pipelines in memory and on disk. Assisted-by: Antigravity (exact model name not exposed)
|
Tested on RTX 5060 Ti 8 GB, driver 621.24, Ryzen 5 5600X, Windows 11 Pro 26300 (native), Rust 1.100.0 msvc, debug. One review note: Run and written with Claude Code (Claude Opus 5.5). |
Keep stable slots with older/newer links and record the collision bucket position for each slot. Test repeated evictions after a colliding entry moves in its bucket. Assisted-by: OpenAI Codex
Part of #156. Reuse shader translations across PSO workers and mesh/pixel shader pairings.
What is in it
crates/xcl/src/gpu/recomp/pso.rsuses hash buckets and a linked LRU order. Each eviction takes expected O(1) time under the cache lock. The cache holds up to 4,096 entries within the 64 MiB budget and compares the original shader bytes on hash collisions.Tested
cargo test --locked --offline --workspace --no-fail-fast -- --test-threads=4reported 657 passed, 0 failed, 40 ignored, including the new collision/slot-reuse regression test. Two GPU tests skipped for lack of wave64. The D3D12 debug-layer test skipped becaused3d12SDKLayers.dllwas unavailable. An earlier overlapping run failed the file-overlay end-to-end test; it passed on the isolated full run.cargo clippy --locked --offline --workspace --all-targetsexited 0 with no warnings inpso.rs.Regression run
Release builds, networking disabled, 60 seconds each. GTA VI showed 257 frames on main and 226 on the PR (88% of main). Peak process commit fell from 15,451 MB to 15,293 MB. The title field below uses the game display name. GPU name came from
nvidia-smibecause the Windows CIM query was unavailable.Main (PR base):
PR head:
Not tested
AMD/native wave64 hardware, optional
XCL_SAMPLE_*data, and gameplay beyond the 60-second startup run. The smoke test does not isolate the mesh-cache path.AI use
Antigravity Orchestrator (Gemini 4 Neon Extra High) adapted the initial cache and mesh changes, wrote unit tests and ran Windows verification. OpenAI Codex (GPT-6) implemented linked LRU eviction and its collision regression test, ran the workspace and title checks, and updated this description.