Repository navigation
Recompiler: the shader cache counts a dispatch chain when it goes in (#2454) - #2516
xpatfussy69x wants to merge 1 commit into
Conversation
…cl-dev#2454) ShaderCache::insert added the blob, cache dir, DXIL and samplers to its byte count, but evict_one subtracts ShaderEntry::bytes(), which also counts a split compute shader's dispatch_chain pieces. Evicting such an entry subtracted more than was added: a subtract-with-overflow panic in debug builds (poisoning the global shader_cache() mutex), and in release a count near usize::MAX, after which every insert evicts the whole cache. insert now builds the entry first and counts it with ShaderEntry::bytes(), so the two sides use one definition. Test: an entry with a 300- and a 200-byte piece. Without the fix insert counts 94 bytes where the entry holds 594; with it the count goes back to 0 on eviction. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested: current PR head merged onto current First cold-cache 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. |
Fixes #2454.
ShaderCache::insertadded the blob, cache dir, DXIL and samplers to its byte count, butevict_onesubtractsShaderEntry::bytes(), which also counts a split compute shader'sdispatch_chainpieces. Evicting such an entry subtracted more than was added: a subtract-with-overflow panic in debug builds (which poisons the globalshader_cache()mutex), and in release a count nearusize::MAX, after which every insert evicts the whole cache.insertnow builds the entry first and counts it withShaderEntry::bytes(), so both sides use one definition.What is in it
crates/xcl/src/gpu/recomp/pso.rs:ShaderCache::insertcounts the entry withShaderEntry::bytes(); no other behaviour changecrates/xcl/src/gpu/recomp/pso.rs:shader_cache_counts_a_dispatch_chain_on_insert_and_evict: an entry with a 300- and a 200-byte piece. Without the fix insert counts 94 bytes where the entry holds 594; with it the count matches and goes back to 0 on evictionTested
cargo test --workspace -- --test-threads=4: 1424 passed, 0 failed, 46 ignoredV_MUL_F16/V_PK_MUL_F16/V_CVT_F16_F32(onmaintoo; Recompiler: the per-lane form takes f16 converts and products from #1426 #2182 removes them)cargo test -p xcl --lib shader_cache: 26 passed, 0 failedRegression run
main:
PR:
Not tested
AI use