Repository navigation
vk: the pipeline notes file and the state list opened by the precompile, before play, not at the first new pipeline in play - #1417
Merged
Conversation
…le, before play, not at the first new pipeline in play pipeline_note opened hookshot_pipelines.bin at the first new pipeline of a run and read its keys back with a seek and an 8-byte read each: 142 ms for 1150 notes on the replaying thread (RTX 5070, Windows), the one long "pipelines" stall early in play. state_record read and hashed the whole state list there too, 8-18 ms. precompile_run now opens both with the notes it has just read (a note pipe_notes_read left out as not sane is written again when its pipeline is met); where it did not run, the notes are read in order, a record at a time. tests/test_pipeline_notes_open.py keeps it so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
|
This landed in the v2.0.12 branch (merged there for testing; it reaches |
Owner
|
Reopened: closing this was a mistake on my side. It was tested in the v2.0.12 branch, and it will be merged into main here, so it shows as merged. Sorry for the noise. |
rakefire-impala
added a commit
to rakefire-impala/Hookshot-w-Mesh-Shader-Fallback
that referenced
this pull request
Nov 10, 2026
…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. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rakefire-impala
added a commit
to rakefire-impala/Hookshot-w-Mesh-Shader-Fallback
that referenced
this pull request
Nov 10, 2026
…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.
NotRexed
pushed a commit
that referenced
this pull request
Nov 10, 2026
…ompile (#1512) 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 #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 (#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.
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.
What
The pipeline notes file (
hookshot_pipelines.bin) and the pipeline state list are now opened by the precompile, before play, not at the first new pipeline in play.pipeline_noteopened it at the first pipeline of a run that was not prepared, on the replaying thread. It read every key back with a seek and an 8-byte read per record. With 1150 notes of 27 KB each, that took 142 ms: the one long "pipelines" stall early in play (150-290 ms in earlier runs).state_recordread and hashed the whole list in the same draw, which took 8-18 ms.Change (
gpu/vk/vk_draw.cpp)notes_open_lockedandstate_open_locked, which run with their mutexes held.precompile_runcalls both right afterpipe_notes_read, so both files are open before the game draws.pipe_notes_readleft out as not sane (note_sane) is written again when its pipeline is met, and the next read takes that one.notes_open_lockedreads the records in order, one seek past the head, a record at a time.RX_VK_NO_PROGRAM_CACHEandRX_VK_NO_STATE_LISTare honoured as before.Measured
a new pipeline cost the draw 151.0 ms: lock 0.0, the state list 8.5, the notes opened 141.9, written 0.0.Not covered
precompile_rundoes not run.Tests
tests/test_pipeline_notes_open.py(source checks, 4 cases):pipeline_noteandstate_recordopen through the shared functions, and no seek is done per record;program_cache_load_some, under their mutexes, honouring the switches.tests/run_all.pyon every test that readsvk_draw.cpp: 32 pass. The 2 that fail here fail the same way on main on Windows:test_linux_driver_fault_guard.pyneeds POSIX signals, andtest_precompile_compute_guard.pyneeds an MSVC-target clang++. The latter only extracts the precompile's compute arm, which this does not change.🤖 Generated with Claude Code