Repository navigation
fix(vk): multi-second freezes and white foliage without mesh shaders: fallback pipelines on a worker and in the precompile - #1512
Merged
NotRexed merged 1 commit intoNov 10, 2026
Conversation
rakefire-impala
marked this pull request as ready for review
November 10, 2026 06:13
rakefire-impala
force-pushed
the
fix/mesh-fallback-freezes-pipelines-on-worker
branch
from
November 10, 2026 10:50
7f04cfa to
1649d20
Compare
…ompile fallback_compute_pipelines made a fallback program's compute pipelines in its first draw, under one lock. AMD's compiler took up to 12 s on one: every recording thread stopped behind it and the game froze in the first room with foliage, then the foliage and the door drew white (RX 5500M, RDNA1, no VK_EXT_mesh_shader). - fallback_pipelines_ready: the draw builds them on a worker, as dispatch() builds a compute program's pipeline (compute_state 0/1/2, which only compute programs used; RX_VK_COMPUTE_SERIAL as there). The draw that starts the build waits up to 50 ms for it, which covers NVIDIA's compiles; a draw while it still compiles is left out, as a dispatch is. - fallback_compute_pipelines is the build. Its lock now covers NotRexed#1317's failure set and the program's pipelines, not the compiles, so several programs compile at once on the workers and in the precompile. A failure is still remembered by key and variant before the return, and not tried again (tests/test_mesh_fallback_failed_once.py, unchanged, passes). - precompile_run builds every fallback program's pipelines with the compute programs', before play. program_cache_load_some takes a new fallbacks flag, which only the precompile sets, and then loads every program translated for the fallback (kind 4), not only those the notes name, whatever the compute list (NotRexed#1417) says: right after an update is when they are cold. Only a GPU without mesh shaders has such programs. The first start after a translator change compiles them (minutes on AMD; the precompile's stall rule lets the game start and they finish behind it); later starts take them from the driver's cache. tests/test_mesh_fallback.py checks the worker, the draw, the lock's scope, the precompile and the program cache's load.
rakefire-impala
force-pushed
the
fix/mesh-fallback-freezes-pipelines-on-worker
branch
from
November 10, 2026 11:31
1649d20 to
83933e8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On a GPU without mesh shaders, the fallback compiled its compute pipelines inside the first draw, under one lock. AMD's compiler takes up to 12 s on one, so the game froze, and foliage and the door drew white until each was done. This builds them on a worker, and before play in the precompile.
Independent of the floor-grass and allocator PRs; they merge cleanly in any order. Part of splitting up #1023.
Problem
fallback_compute_pipelinesmade a program's task and mesh compute pipelines in its first draw, holding one global lock. Every recording thread stopped behind it. On an RX 5500M the game froze for seconds in the first room with foliage, and the door at spawn drew white until its pipelines were done.Change
fallback_pipelines_readybuilds them on a worker, exactly asdispatch()builds a compute program's pipeline:compute_state0/1/2 (otherwise only compute programs use it), andRX_VK_COMPUTE_SERIALas there. The draw that starts a build waits up to 50 ms for it, which covers NVIDIA's compiles. A draw while it's still compiling is left out, as a dispatch is.fallback_compute_pipelinesis now the build step. Its lock covers vk: a mesh fallback program whose compute pipeline failed is not compiled again #1317's failure set and the program's pipelines, but not the compiles, so several programs compile at once. A failure is still remembered by key and variant before the return, and never retried.tests/test_mesh_fallback_failed_once.pypasses unchanged.precompile_runbuilds every fallback program's pipelines alongside the compute programs'.program_cache_load_somegets afallbacksflag, set only by the precompile, that loads every program translated for the fallback (kind 4), whatever the compute list from vk: the pipeline notes file and the state list opened by the precompile, before play, not at the first new pipeline in play #1417 says. Right after an update is exactly when those are cold. Only a GPU without mesh shaders has kind-4 programs.The first start after a translator change compiles them all: on this laptop, about 15 minutes for 1,300 programs. The precompile's existing stall rule lets the game start while the last ones finish in the background. Later starts take them from the driver's cache in seconds.
Who it affects
Tests
tests/test_mesh_fallback.pychecks the worker, the draw, the lock's scope, the precompile and the program cache's load. The check fails on main without this change.test_precompile_compute_guard.pyextracts the precompile's compute branch, which is byte-for-byte unchanged.Tested on
precompile: ... 1300 mesh fallback programs in 2934 ms(driver cache warm)