vk: the pipeline notes file and the state list opened by the precompile, before play, not at the first new pipeline in play #1417
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!1417
Loading…
Reference in a new issue
No description provided.
Delete branch "perf/pipeline-notes-open"
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?
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
This landed in the v2.0.12 branch (merged there for testing; it reaches
mainwith that release), so closing. Thanks!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.
Looks good to me. I went through the move of both first-opens into
notes_open_locked/state_open_lockedand the new calls inprecompile_run:!note_file/!state_file, so whichever of the precompile or a draw (orstate_list_prepareon the build path, orprepare_backgroundon an update) gets there first wins and the other skips. No new ordering problem compared to the old lazy open.pipe_notes_read's result holds up. That function already checks the same stamp/size header, and it dedupes only afternote_sane, so a note re-written because its earlier copy was dropped as not sane gets picked up on the next read, as the description says. The file just grows by those re-written records, which is fine._fseeki64maps tofseekoon POSIX through host/posix/windows.h, so Linux is fine.RX_VK_NO_PROGRAM_CACHE/RX_VK_NO_STATE_LISTchecks inprecompile_runmatch the staticoffchecks inpipeline_note/state_record.pipeline_note,state_recordor the top ofprecompile_runsince your base, and no existing test reads the old inline open code.run_all.pyglobstests/test_*.py, so the new test gets picked up without registering it.Nit, not blocking: the notes file now gets opened (and on a stamp change, truncated to a fresh header) at precompile time even in a run that never makes a new pipeline. That's harmless since
pipe_notes_readwould have returned nothing for a mismatched stamp anyway. Just calling out the small behaviour change.No CI ran on this branch, so the only checks are the source tests and your runs.