From 462273dcdb24c49dc459aa31224b7c31f44f71d9 Mon Sep 17 00:00:00 2001 From: mrfelek <17274927+mrfelek@users.noreply.github.com> Date: Tue, 24 Nov 2026 00:07:51 +0100 Subject: [PATCH] fix(kyty): do not link graphics pipelines from libraries on RADV On RADV (Radeon 780M, Mesa 26.0.8) some fast-linked graphics pipelines hang the GPU: the gfx ring times out without a VM fault a few seconds into PPSA21564's pirate island when the Kyty pipeline cache and Mesa's shader cache are both cold. Linking the same libraries with link-time optimization does not hang, and neither does building the pipelines whole. Optimized links cost about 75 ms each on the draw thread and gave more pipeline stalls than whole pipelines, so RADV now builds whole pipelines, as with KYTY_PIPELINE_LIBRARIES=0. Other drivers are unchanged. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01EqZu9J6tUMvmRP7RkxVCQr --- core/kyty/graphics/presentation/window/vulkanWindow.cpp | 4 +++- docs/dev/ANYKYTY_SETTINGS.md | 2 +- docs/dev/THIRD_PARTY_KYTY.md | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/core/kyty/graphics/presentation/window/vulkanWindow.cpp b/core/kyty/graphics/presentation/window/vulkanWindow.cpp index 49e5570830b..65ccd2f9913 100644 --- a/core/kyty/graphics/presentation/window/vulkanWindow.cpp +++ b/core/kyty/graphics/presentation/window/vulkanWindow.cpp @@ -533,12 +533,14 @@ static vk::Device VulkanCreateDevice(GraphicContext& graphics, vk::StructureChain library_features; physical_device.getFeatures2(&library_features.get()); - vk::StructureChain + vk::StructureChain library_properties; physical_device.getProperties2(&library_properties.get()); const auto& library_limits = library_properties.get(); graphics.pipeline_library_enabled = + library_properties.get().driverID != vk::DriverId::eMesaRadv && library_features.get().graphicsPipelineLibrary == VK_TRUE && library_limits.graphicsPipelineLibraryFastLinking == VK_TRUE && diff --git a/docs/dev/ANYKYTY_SETTINGS.md b/docs/dev/ANYKYTY_SETTINGS.md index 6d0e6b4ecbb..86ef3b83444 100644 --- a/docs/dev/ANYKYTY_SETTINGS.md +++ b/docs/dev/ANYKYTY_SETTINGS.md @@ -30,7 +30,7 @@ On by default unless the row says otherwise. | `KYTY_COMPARE_WRITE_BACK` | `0`, `1` (default) | An image read back to game memory writes only the bytes the GPU changed, never bytes the game wrote since the read | | `KYTY_FAST_TLS` | `0`, `1` (default) | Windows: the driver's own `thread_local` variables come from one native TLS slot instead of libgcc's emulated TLS, which is slower and frees them before their destructors run when a thread exits | | `KYTY_PROGRAM_LOCK` | `narrow` (default), `wide` | Scope of the program-cache lock. `wide` is Kyty's | -| `KYTY_PIPELINE_LIBRARIES` | `0`, `1` (default) | Link graphics pipelines from per-stage pipeline libraries (`VK_EXT_graphics_pipeline_library`) | +| `KYTY_PIPELINE_LIBRARIES` | `0`, `1` (default) | Link graphics pipelines from per-stage pipeline libraries (`VK_EXT_graphics_pipeline_library`). Not used on RADV, where some fast-linked pipelines hang the GPU | | `KYTY_ASYNC_PIPELINES` | `0`, `1` (default in this build), `2` | Create the pipeline of a draw that only changes the picture in the background; the draw is skipped until it is ready, so an object or effect can be missing for a few frames when it first appears. `2` skips more draws and does not wait for a new pipeline, but only into targets the game redraws every frame: fewer shader compilation stutters on a first run. `1` skips fewer draws and waits up to 20 ms for each new pipeline; `0` always waits | | `KYTY_SHADER_CACHE` | `0`, `1` (default) | Keep recompiled shaders on disk and warm them up at the next start (Release builds). `0` translates them again at each start. A nonempty `ANYPS5_NO_SHADER_CACHE` value other than `0` forces the store off. | | `ANYPS5_KYTY_PRESTART` | `0`, `1` (default) | `0` starts the Kyty GPU after the window exists instead of during its creation | diff --git a/docs/dev/THIRD_PARTY_KYTY.md b/docs/dev/THIRD_PARTY_KYTY.md index d80234a81ad..33df270fb90 100644 --- a/docs/dev/THIRD_PARTY_KYTY.md +++ b/docs/dev/THIRD_PARTY_KYTY.md @@ -239,7 +239,7 @@ This build does not read KytyPS5's `KYTY_PIPELINE_PRECOMPILE`: stopping the game | Variable | Values | Default | Effect | Category | Platform | Origin | |---|---|---|---|---|---|---| | `KYTY_ASYNC_PIPELINES` | `0`, `1` or `2`, else stops | `1` | `1`: for a draw that only changes the picture, and is not a small colour target, the pipeline is created on a background thread and the draw is skipped until it is ready, after waiting 20 ms for it. `2`: when every target of the draw was drawn in one of the two frames before, the draw is also skipped if it goes to a small colour target, is counted by an occlusion query (the query then reads visible), has a small pipeline or has no depth and small vertex programs, and a new pipeline is not waited for: it is taken from the driver cache or linked from ready stage libraries at once, else the draw is skipped until the background thread has built it; a draw into a target that was not drawn just before is handled as with `1`. With both, draws whose programs write memory or whose targets are linear, and dispatches, wait. `0` always waits | perf | all | Kyty option | -| `KYTY_PIPELINE_LIBRARIES` | `0` is off | on | Links graphics pipelines from per-stage pipeline libraries (`VK_EXT_graphics_pipeline_library`) | perf | all | `76827a9140` | +| `KYTY_PIPELINE_LIBRARIES` | `0` is off | on | Links graphics pipelines from per-stage pipeline libraries (`VK_EXT_graphics_pipeline_library`); off on RADV, where some fast-linked pipelines hang the GPU | perf | all | `76827a9140` | | `KYTY_PIPELINE_CHAIN_THREADS` | whole number, clamped to 1 to 16 | `4` | Threads of the pipeline chain above; a value above 16 runs 16 threads and logs one `[kyty-gpl]` line | perf | all | `51c397b379` | | `KYTY_SHARE_EMPTY_BUFFERS` | `0` is off | on | A shader buffer slot whose V# has `num_records = 0` does not make a shader variant of its own. Its reads return zero and its writes are dropped, as on the console, and that holds for the module built for the slot bound: a raw slot of a compute shader that reads its stride at run time and a scalar slot take the bound form, and a draw or dispatch with such a slot uses a module already built for the other slots when every formatted component it reads gives the same out-of-range value. A module built for such a draw takes the bound form of a slot from a module already built. Manifests recorded before this setting read their empty forms back the same way. `0` builds one variant per combination of empty and bound slots | perf | all | AnyKyty | | `KYTY_GENERIC_COMPUTE_VARIANT` | `0` is off | on | A dispatch of a compute shader that already has a module, whose descriptor tables of images or samplers take a new shape (other slots with several descriptors, more candidates, a new numeric class in the image heap), runs at once on a module already built for a wider shape: the search tables and heap words of the dispatch are copied into that module's layout, and every key reaches the same descriptor, so the result is the same. A module whose pipeline is ready is preferred. When no module can take the shape, the module built is the union of the shapes already built for the shader, with room to grow, instead of the shape of the dispatch alone. `0` builds and waits for one module per shape. `KYTY_AB` can change it at a flip; its arms differ only for shapes first seen during a phase (see [Details](#details)) | perf | all | AnyKyty |