Leave a stage library the driver has not compiled to a worker #1429
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!1429
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/gpl-cold-libraries"
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?
With RX_VK_GPL set, a draw links its pipeline from stage libraries, and a library the driver had not compiled was compiled right there, holding the draw. Where the device has pipelineCreationCacheControl, the draw now asks for the two libraries that hold shaders (pre-rasterization and fragment) with VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT. If either comes back VK_PIPELINE_COMPILE_REQUIRED the pipeline is not linked: the draw is left out or waits for the worker's full build, exactly as without libraries, and the worker builds the cold libraries after it, for the program's next pipeline. A library that fails is not asked for again. With RX_VK_GPL set, the frame line also counts the libraries the driver had, the cold ones, and how many of those the workers built and in what time. RX_VK_GPL_SYNC (set to anything): compiled in the draw, as before.
Testing: RTX 4070 Ti Super, driver 621.14, Windows 11, Ryzen 7 9800X3D. A scripted 10-minute route (boot, Hyrule Field, Kakariko, Market, Lost Woods, Gerudo Valley), RX_VK_GPL=1, libraries not warmed, one run each on
7dbdcdc:Alone it makes RX_VK_GPL as fast as having it off, with fewer draws left out. Warming the libraries into the pipeline cache (next PR) is what it is for. tests/test_gpl_cold_library.py is new.
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.
Rebased on main and resolved the conflict in gpu/vk/vk_replay.cpp: the frame line keeps main's descriptor saves and adds the library counts after them. Nothing else changed. The tests pass on the rebased branch; I have not run the game on it yet.
Looks good. I went through the handoff between the draw and the workers and couldn't find a hole:
emplacewas fresh, so a library is queued at most once even when two draw threads race on it. A null entry stops anyone from asking the driver again, andgpl_build_coldreplaces that null undergpl_mu. A failure just leaves it null.ready.store(true)and with no flag, so a draw that steals the full build injobs_waitdoesn't also end up running the library builds.jobs_waitdropsmubefore it runs the job, so callingjobs_pushfrom inside the job can't deadlock.Programalready outlives its pipeline jobs, andgpl_libsis never torn down, so a worker can't write into a map that's been destroyed.pipelineCreationCacheControlis enabled wheneverdev.vk13reports it.One thing about drivers. The libraries are created with
VK_NULL_HANDLEas the pipeline cache, so "the driver had it" only works where the driver keeps its own cache (NVIDIA, and RADV/ANV through Mesa's disk cache). A driver without one will report every shader library as cold on first use. That's harmless here (you get the no-GPL behaviour, then the worker-built library for the program's later pipelines), but the next PR's cache warming will probably need these libraries to go throughpcacheto help on those drivers.Two small nits (non-blocking):
tests/run_all.pyonly checks for or skips a compiler when the test has anARGSentry. Without one, this runsg++unconditionally, so it fails instead of skipping on a machine without g++. Adding"tests/test_gpl_cold_library.py": ["--cxx", "{cxx}"],next to the other fixture tests would make it use whatever compiler the runner finds.RX_VK_GPL_SYNC=0turns it on too. That matches howRX_VK_GPLworks, but the block comment above saysRX_VK_GPL_SYNC=1. Maybe say "set" there, like the PR description does.The conflict with #1330 in
log_frame_statsis resolved in your merge of main and keeps both sides, so it merges cleanly now.Thanks, both fixed in the new commit: the test is in run_all.py's ARGS with {cxx}, and the comment says "set".