Recompiler: the shader cache counts a dispatch chain when it goes in (#2454) #2516
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!2516
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2516/head"
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?
@xpatfussy69x on GitHub · 2026-11-25 21:18 UTC · original
xpatfussy69x:recompiler/shader-cache-bytes→main· +27 −14 · 1 files · 1 commits · closed without mergingFixes #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; #2182 removes them)cargo test -p xcl --lib shader_cache: 26 passed, 0 failedRegression run
main:
PR:
Not tested
AI use
@xpatfussy69x on GitHub · 2026-11-25 21:23 UTC · original
Closing as a duplicate of #2475, which makes the same insert/evict byte-count fix for #2454 and was opened first. I'll post this branch's test and smoke results there instead.
@SlopTart on GitHub · 2026-11-25 22:33 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).First cold-cache
gpu_suite run:158 passed / 9 failed. Beyond the baseline trio:gpu_console_textures_upload_every_mip_and_slice,gpu_large_mixed_upload_keeps_tight_staging_and_exact_pixels,copy_scratch_budget_counts_resources_until_gpu_completion,cpu_watchdog_signal_with_inflight_gpu_signal_completes_cleanly,gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes,gpu_retire_queue_holds_heap_until_blocked_queue_passes_mark. Second run, same head:164 passed / 3 failed(baseline trio only). Targeted run ofshader_cache_counts_a_dispatch_chain_on_insert_and_evict: passed.Same upload/scratch/lifetime family as the burst I logged on #2486 (that one also showed 6 extras, non-reproducible). Two PRs in unrelated areas now show the identical burst pattern on cold first runs; the tests involved are timing-sensitive, this looks like lane flakiness rather than anything this PR does. Worth watching if CI starts showing the same cluster.
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.
Pull request closed