RADV disables its pipeline cache because CS2 enables shaderAbort, so every pipeline recompiles (constant hitching on AMD/Linux)
Your system information
- System information from Steam: https://gist.github.com/dogfeeder/78b5d507b23900913c6e35d619250ec7
- Steam Runtime Diagnostics: https://gist.github.com/dogfeeder/8b88f25b7b2cd7abc5eb6ff312e78a6c
- Have you checked for system updates?: Yes
- RX 7900 XTX, RADV (Mesa 26.2.3), CachyOS, KDE Plasma 6.7.5 (Wayland), CS2 1.41.8.2
Please describe your issue in as much detail as possible:
On RADV, CS2 never uses the driver's shader cache. Every pipeline is compiled from scratch each time it's needed, including ones already built earlier in the same session. On a DM server it causes a 40-50 ms hitch about once a second (0.1% lows around 22 fps with a ~390 fps average). It doesn't improve across sessions, and Steam shader pre-caching doesn't help.
I've used Claude Code to help measure, debug and document the issue, as well as adding a vulkan layer to fix it. Its a bit of a hack, and not easily shareable but it does work for me and proves the issue (I think).
Cause and workaround
CS2 enables the shaderAbort feature (VK_KHR_shader_abort) at vkCreateDevice. RADV turns off its whole pipeline cache when that feature is on: in Mesa 26.2.3, radv_device_is_cache_disabled() (src/amd/vulkan/radv_device.c) returns true once device->shader_abort.buffer_addr is set, with the comment "The buffer address used for shader abort is hardcoded". That buffer is allocated in radv_device_init_tools() when enabled_features.shaderAbort is set.
With MESA_SHADER_CACHE_SHOW_STATS=1, a full DM session ends with disk shader cache: hits = 0, misses = 0, meaning the cache is never queried. Same on Mesa 26.2.2 and 26.2.3.
A small Vulkan layer that sets shaderAbort = VK_FALSE in vkCreateDevice, and changes nothing else, fixes it. Same DM server type, same launch options apart from the layer, gameplay only (menus and loading excluded):
| without layer | with layer | |
|---|---|---|
RADV pipeline cache (RADV_DEBUG=psocachestats) |
no lookups, prints nothing | 16,556 hits, 1,084 misses (libraries) |
| frames over 40 ms per minute | 7.3 | 0 |
| 0.1% low / worst frame | 23 fps / 63 ms | 136 fps / 12 ms |
The cache already held entries from one earlier session with the bit cleared, so a first-ever session will show more misses.
It would help if CS2 left shaderAbort off in release builds, or only enabled it behind a launch option.
Steps for reproducing this issue:
- Use an AMD GPU on RADV with a Mesa that exposes
VK_KHR_shader_abort(vulkaninfo | grep shader_abort). - Set launch options to
RADV_DEBUG=psocachestats MESA_SHADER_CACHE_SHOW_STATS=1 bash -c 'exec "$@" 2>>/tmp/cs2-err.log' -- %command% - Join a deathmatch server, play 2-3 minutes, quit from the main menu.
/tmp/cs2-err.loghas noradv: PSO cache statslines, and on exit printsMESA: info: disk shader cache: hits = 0, misses = 0- Build the layer from the gist below (README has the two commands), add
VK_INSTANCE_LAYERS=VK_LAYER_cs2_radv_cache_fixin front of the launch options and repeat.radv: PSO cache statslines now appear with mostly hits, and the spikes are gone.
Logs, Mesa source excerpt and the layer fix: https://gist.github.com/dogfeeder/2fc18bcd9497ea8e2c5238ed21a4fdc4
Closing in favor of the older issue report.