docs(build): note the FPS Monitor Vulkan layer that breaks multi-instance tests #20011

Closed
ghost wants to merge 1 commit from upstream-pr/20011 into main
ghost commented 2026-11-14 11:44:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ghost on 2026-11-14T11:44:02Z.


What

Adds one entry to the Requirements list of docs/dev/BUILD.md, next to the antivirus entries: the 64-bit implicit Vulkan layer that FPS Monitor installs on Windows breaks the tests that hold more than one Vulkan instance.

The layer (C:\Program Files (x86)\FPS Monitor\tools\fpsmonvk64.dll) is registered in HKLM\SOFTWARE\Khronos\Vulkan\ImplicitLayers under the name VK_LAYER_RENDERDOC_Capture and is loaded into every Vulkan process, also while FPS Monitor is not running. With it, vkDestroyInstance returns with the destroyed instance still linked in the loader's instance list. The next loader call that walks the list reads freed memory. Depending on what the heap did with that memory, the test passes, faults inside vulkan-1.dll, or spins there for ever (the list becomes self-cyclic when the freed address is reused by the next instance).

No AnyPS5 code is involved; the driver destroys its instance correctly. The entry only records the cause and the two variables that disable the layer, so that a contributor with this layer does not report these tests as GPU failures.

Standalone reproduction without AnyPS5 code (the offset is the instance list head of loader 1.4.357.0):

#include <windows.h>
#include <stdio.h>
#include <vulkan/vulkan.h>
int main(void) {
    HMODULE lib = LoadLibraryA("vulkan-1.dll");
    PFN_vkGetInstanceProcAddr gipa = (PFN_vkGetInstanceProcAddr)GetProcAddress(lib, "vkGetInstanceProcAddr");
    void** head = (void**)((char*)lib + 0x188408);
    VkApplicationInfo app = {VK_STRUCTURE_TYPE_APPLICATION_INFO};
    app.apiVersion = VK_API_VERSION_1_1;
    VkInstanceCreateInfo info = {VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO};
    info.pApplicationInfo = &app;
    VkInstance a = 0, b = 0;
    PFN_vkCreateInstance create = (PFN_vkCreateInstance)gipa(NULL, "vkCreateInstance");
    create(&info, NULL, &a);
    create(&info, NULL, &b);
    printf("A=%p B=%p head=%p\n", (void*)a, (void*)b, *head);
    ((PFN_vkDestroyInstance)gipa(b, "vkDestroyInstance"))(b, NULL);
    printf("after destroy B: head=%p\n", *head);
    ((PFN_vkDestroyInstance)gipa(a, "vkDestroyInstance"))(a, NULL);
    printf("after destroy A: head=%p\n", *head);
    return 0;
}
default environment:
A=000001E3AFBB3640 B=000001E3F1E83640 head=000001E3F1E83640
after destroy B: head=000001E3F1E83640
after destroy A: head=000001E3F1E83640

DISABLE_LAYER=1:
A=0000018CFA1235F0 B=0000018CFC5F6A00 head=0000018CFC5F6A00
after destroy B: head=0000018CFA1235F0
after destroy A: head=0000000000000000

Tested

Windows 11 Pro, WinLibs GCC 15.2.0 (15.2.0posix-14.0.0-ucrt-r7), NVIDIA RTX 5070 Ti, driver 621.01, Vulkan loader 1.4.357.0, full Release build with BUILD_TESTING=ON, ANYPS5_REQUIRE_VULKAN=1.

On main f0c9b11f91 (built with the one-line change of #19899 applied locally, since UploadCacheReadOnlyFlush.cpp does not compile on MinGW without it), the 25 tests the entry names plus guest_video_out_flip_rate, agc_import_settle_initial_dcc, agc_driver_quad_pixel_mask and agc_driver_upload_cache_read_only_flush, run serially:

Environment Result
default 9 of 29 failed: 8 access violations, 1 timeout
DISABLE_LAYER=1 29 of 29 passed

On main 1d0b2c771a, where the investigation was done:

  • Full ctest -j 14: 25 of the 5227 tests failed for this reason (20 access violations; 5 agc_driver_prepared_shaders variants hung or timed out, one was left for 30 minutes before it was killed).
  • The 20 faulting tests, three serial runs: 13, 9 and 14 failed; each of the 20 failed at least once. All 35 faults are in vulkan-1.dll, at +0x486d0/+0x486d5 (25) and +0x480f3/+0x48100 (10), both in loops over the instance list.
  • agc_driver_native_depth_stencil alone, by layer:
Environment Failures
default 6 of 12
VK_LOADER_LAYERS_DISABLE=VK_LAYER_RTSS 12 of 12
VK_LOADER_LAYERS_DISABLE=VK_LAYER_RENDERDOC_Capture 0 of 12
VK_LOADER_LAYERS_DISABLE=~implicit~ 0 of 10
  • The 20 faulting tests with only the FPS Monitor layer disabled: 20 of 20 passed in each of three runs.
  • agc_driver_prepared_shaders: hangs 3 of 3 by default with the main thread spinning in the loader's device lookup under VulkanDevice::State::~State() (destroyDevice); passes in 10 s with DISABLE_LAYER=1. In the hung process the list head's next points to itself.

Not checked: other versions of FPS Monitor (the installed fpsmonvk64.dll is dated 2025-06-23), and why the layer skips the unlink (no symbols).

python tools/check_conventions.py --base upstream/main passes. tools/pr_overlap.py reported nine open pull requests that touch docs/dev/BUILD.md and could not be compared automatically (#1835, #11435, #11436, #15136, #15456, #15719, #16793, #18208, #18210); none of their diffs adds text about Vulkan layers or this list entry.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a (documentation only; the runs above are on NVIDIA RTX 5070 Ti, driver 621.01, Windows 11)
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5310873856 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20011). Originally posted by [ghost](https://github.com/ghost) on 2026-11-14T11:44:02Z. --- ### What Adds one entry to the Requirements list of `docs/dev/BUILD.md`, next to the antivirus entries: the 64-bit implicit Vulkan layer that FPS Monitor installs on Windows breaks the tests that hold more than one Vulkan instance. The layer (`C:\Program Files (x86)\FPS Monitor\tools\fpsmonvk64.dll`) is registered in `HKLM\SOFTWARE\Khronos\Vulkan\ImplicitLayers` under the name `VK_LAYER_RENDERDOC_Capture` and is loaded into every Vulkan process, also while FPS Monitor is not running. With it, `vkDestroyInstance` returns with the destroyed instance still linked in the loader's instance list. The next loader call that walks the list reads freed memory. Depending on what the heap did with that memory, the test passes, faults inside `vulkan-1.dll`, or spins there for ever (the list becomes self-cyclic when the freed address is reused by the next instance). No AnyPS5 code is involved; the driver destroys its instance correctly. The entry only records the cause and the two variables that disable the layer, so that a contributor with this layer does not report these tests as GPU failures. Standalone reproduction without AnyPS5 code (the offset is the instance list head of loader 1.4.357.0): ```c #include <windows.h> #include <stdio.h> #include <vulkan/vulkan.h> int main(void) { HMODULE lib = LoadLibraryA("vulkan-1.dll"); PFN_vkGetInstanceProcAddr gipa = (PFN_vkGetInstanceProcAddr)GetProcAddress(lib, "vkGetInstanceProcAddr"); void** head = (void**)((char*)lib + 0x188408); VkApplicationInfo app = {VK_STRUCTURE_TYPE_APPLICATION_INFO}; app.apiVersion = VK_API_VERSION_1_1; VkInstanceCreateInfo info = {VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO}; info.pApplicationInfo = &app; VkInstance a = 0, b = 0; PFN_vkCreateInstance create = (PFN_vkCreateInstance)gipa(NULL, "vkCreateInstance"); create(&info, NULL, &a); create(&info, NULL, &b); printf("A=%p B=%p head=%p\n", (void*)a, (void*)b, *head); ((PFN_vkDestroyInstance)gipa(b, "vkDestroyInstance"))(b, NULL); printf("after destroy B: head=%p\n", *head); ((PFN_vkDestroyInstance)gipa(a, "vkDestroyInstance"))(a, NULL); printf("after destroy A: head=%p\n", *head); return 0; } ``` ```text default environment: A=000001E3AFBB3640 B=000001E3F1E83640 head=000001E3F1E83640 after destroy B: head=000001E3F1E83640 after destroy A: head=000001E3F1E83640 DISABLE_LAYER=1: A=0000018CFA1235F0 B=0000018CFC5F6A00 head=0000018CFC5F6A00 after destroy B: head=0000018CFA1235F0 after destroy A: head=0000000000000000 ``` ### Tested Windows 11 Pro, WinLibs GCC 15.2.0 (`15.2.0posix-14.0.0-ucrt-r7`), NVIDIA RTX 5070 Ti, driver 621.01, Vulkan loader 1.4.357.0, full Release build with `BUILD_TESTING=ON`, `ANYPS5_REQUIRE_VULKAN=1`. On `main` f0c9b11f91 (built with the one-line change of #19899 applied locally, since `UploadCacheReadOnlyFlush.cpp` does not compile on MinGW without it), the 25 tests the entry names plus `guest_video_out_flip_rate`, `agc_import_settle_initial_dcc`, `agc_driver_quad_pixel_mask` and `agc_driver_upload_cache_read_only_flush`, run serially: | Environment | Result | |---|---| | default | 9 of 29 failed: 8 access violations, 1 timeout | | `DISABLE_LAYER=1` | 29 of 29 passed | On `main` 1d0b2c771a, where the investigation was done: - Full `ctest -j 14`: 25 of the 5227 tests failed for this reason (20 access violations; 5 `agc_driver_prepared_shaders` variants hung or timed out, one was left for 30 minutes before it was killed). - The 20 faulting tests, three serial runs: 13, 9 and 14 failed; each of the 20 failed at least once. All 35 faults are in `vulkan-1.dll`, at `+0x486d0`/`+0x486d5` (25) and `+0x480f3`/`+0x48100` (10), both in loops over the instance list. - `agc_driver_native_depth_stencil` alone, by layer: | Environment | Failures | |---|---| | default | 6 of 12 | | `VK_LOADER_LAYERS_DISABLE=VK_LAYER_RTSS` | 12 of 12 | | `VK_LOADER_LAYERS_DISABLE=VK_LAYER_RENDERDOC_Capture` | 0 of 12 | | `VK_LOADER_LAYERS_DISABLE=~implicit~` | 0 of 10 | - The 20 faulting tests with only the FPS Monitor layer disabled: 20 of 20 passed in each of three runs. - `agc_driver_prepared_shaders`: hangs 3 of 3 by default with the main thread spinning in the loader's device lookup under `VulkanDevice::State::~State()` (`destroyDevice`); passes in 10 s with `DISABLE_LAYER=1`. In the hung process the list head's `next` points to itself. Not checked: other versions of FPS Monitor (the installed `fpsmonvk64.dll` is dated 2025-06-23), and why the layer skips the unlink (no symbols). `python tools/check_conventions.py --base upstream/main` passes. `tools/pr_overlap.py` reported nine open pull requests that touch `docs/dev/BUILD.md` and could not be compared automatically (#1835, #11435, #11436, #15136, #15456, #15719, #16793, #18208, #18210); none of their diffs adds text about Vulkan layers or this list entry. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a (documentation only; the runs above are on NVIDIA RTX 5070 Ti, driver 621.01, Windows 11) - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!20011
No description provided.