test(agc): hold the idle-yield fixture's queue until it takes the GPU mutex #14066

Merged
EagleBearerYS merged 2 commits from upstream-pr/14066 into main 2026-11-02 19:45:51 +00:00
EagleBearerYS commented 2026-10-31 17:31:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-31T17:31:09Z.


What

A test-only fix for agc_driver_idle_store_yields (tests/execution/IdleStoreYields.cpp), the test @beardsciences added in #13621. It fails intermittently on main. As @MarcZX10 asked on #13621, this is a separate PR, with the reproduction details and results below.

The test races the queue twice. Waiting for the driver to go idle, the first approach linked on #13621, fixes the first race but exposes the second. This PR's single commit fixes both.

Race 1: the check runs before the second dispatch is recorded (lines at main 73f4f7e06e):

  1. StopsWithinAnImage submits one packet with two dispatches over the same 8 MiB surface:
    • StoreRowZeroCode writes row 0, in the first 4 MiB piece;
    • StoreFarRowCode writes row 1000, in the second piece.
  2. SubmitAndWaitForPending (IdleStoreYields.cpp:110-117) returned 5 ms after StorageTexture::AnyPending() turned true. That happens once the row-0 dispatch is recorded.
  3. The far-row shader is new to the queue, so Driver::dispatch builds its pipeline (PrepareDispatch, Dispatch.cpp:586) before it takes the GPU mutex (:608). Without a warm pipeline cache, that build takes longer than 5 ms.
  4. The fixture then takes the GPU mutex with only row 0 recorded:
    • the stopped store and the store of the rest both run, and nothing is left pending;
    • but the image doesn't hold the far row yet;
    • the far-row dispatch is recorded only after the mutex is released, so Contains(split, end) (:172) can read guest memory before that row lands.
  5. No write-back is lost. A diagnostic that waited for the queue to go idle after a failed check found both rows in guest memory in 9 of 9 failures.
  6. The occasional segfault is the same race on the failure path. The throw frees the surface while the queue's work over it is still running. It's in the test's teardown, not a lavapipe bug.
  7. This fits @Dextroid17's findings on #13621:
    • the failure on an RTX 3080 Ti and on llvmpipe (comment, rerun);
    • the order result: swapping the two stores passes. StopsBetweenImages has already prepared row 0's shader, so as the second dispatch it's quick.
    • It also fits @beardsciences' 6/6 passes on an RTX 3060 Ti with an empty shader cache. The failure depends on how fast that pipeline builds.

Race 2: the queue's own idle store takes the GPU mutex first. The first approach, 3a3ec595b6 (the commit linked on #13621), waits with AgcDriverWaitIdle_nid_postfix(). On GitHub's Linux runner that exposed a second race:

  1. The queue marks the submission completed right after executing it (QueueWorker.cpp:282, :293). After plain dispatches nothing else is pending, so its 50 ms IdleResultsQuietPeriod (QueueWorker.cpp:20, :203-216) starts at once, at the point WaitIdle's drain returns.
  2. Driver::WaitIdle (Lifecycle.cpp:237-250) then takes the GPU mutex and calls VulkanDevice::WaitIdle, whose Recorder::Sync submits the packet's open batch and waits for the device to run it. Timed on lavapipe with the shader cache off and the CPU loaded, that took 12.4–168.2 ms (median 47.5). StoreDrawnLinear stored nothing, and vkDeviceWaitIdle took at most 4.6 ms.
  3. When that runs past 50 ms, the queue reaches StoreIdleResults (QueueWorker.cpp:219) and waits on the mutex. When WaitIdle releases it, the idle store can win and store both images, and the test fails with "the queue-idle store ran before the fixture could take the GPU mutex".
  4. In 30 timed runs, the images stayed pending in all 16 where the fixture took the lock within 50 ms of the queue finishing, and the idle store won in all 14 where WaitIdle returned 52.5 ms or more after it.

The change: the packet now ends with a WAIT_REG_MEM on a label in the test, the same packet Flip.cpp:242, Submit.cpp:323 and WaitShutdown.cpp:40 use.

  • SubmitAndWaitForPending becomes SubmitAndWaitHeld. It polls AgcDriverAwaitedWaits_nid_postfix until the queue waits on that label. The queue gets there only after recording both dispatches, which fixes race 1.
  • The fixture then takes the GPU mutex, and only then stores the label.
  • The idle store runs only in queue 0's own loop. That loop is still inside the packet's wait, and the wait loop stores no pending results. So the queue can't finish the packet, or start its quiet period, before the fixture holds the mutex. That fixes race 2, with no timing margin involved.
  • ~QueueHold also stores the label, so a failed check never leaves the queue blocked. The labels are static, so they outlive the queue's last read.
  • Both sub-tests keep every check and message. No driver code changes.
  • It replaces the first approach's wait. 3a3ec595b6 fixed race 1, but it failed on GitHub's runner from race 2 (run). It isn't part of this PR, and it stays on the fork's archive/agc-idle-store-yields-two-commits branch.

Related: #13621

Tested

Linux, on a 4-vCPU Xeon (Ubuntu 24.04, GCC 13.3, Release, CI flags, lavapipe, as an unprivileged user, ANYPS5_REQUIRE_VULKAN=1 GALLIUM_OVERRIDE_CPU_CAPS=avx). Each cell is 30 direct runs of agc_driver_idle_store_yields_tests, pass / fail / crash, all three from the same tree and driver library. This PR's column ran on 24598aa0a4, which has the same tree as this PR's commit:

condition main 73f4f7e06e first approach, 3a3ec595b6 this PR
ctest's environment (ANYPS5_NO_SHADER_CACHE=1 APS5_NO_PIPELINE_JOURNAL=1) 11 / 19 / 0 30 / 0 / 0 30 / 0 / 0
plain 30 / 0 / 0 30 / 0 / 0 30 / 0 / 0
shader cache off (MESA_SHADER_CACHE_DISABLE=true ANYPS5_NO_SHADER_CACHE=1) 8 / 20 / 2 21 / 9 / 0 30 / 0 / 0
shader cache off, with four more copies of the test looping alongside 5 / 24 / 1 19 / 10 / 1 30 / 0 / 0
  • Failure lines: main's are all "the two stores did not bring both rows of the large image to guest memory" (race 1). The first approach's are all "the queue-idle store ran before the fixture could take the GPU mutex" (race 2).
  • More runs of this PR:
    • 100 of 100 plain and 100 of 100 with the shader cache off under load;
    • ctest -R '^agc_driver_idle_store_yields$' --repeat until-fail:30: 100%.
  • Neighbouring tests: the 7 idle-store and queue tests (agc_driver_store_idle_results, _wake, agc_driver_idle_store_over_unmap, agc_driver_queue_zero_idle_wait, agc_driver_queued_index_read_order, agc_driver_storage_read_during_idle_store and this one) pass -j4 --repeat until-fail:10, 70 of 70.

GitHub's runners, agc_driver_idle_store_yields with --repeat until-fail:30:

runner main 73f4f7e06e first approach, 3a3ec595b6 this PR
Linux (lavapipe) failed on run 1, "the two stores did not bring both rows" (run) failed on run 1, "the queue-idle store ran before the fixture could take the GPU mutex" (run) 30 / 30 passed (run)
Windows skipped: no Vulkan device on the runner skipped skipped; builds, and the libc and libkernel suites pass

On @Dextroid17's devices (comment), the first approach with the shader cache off passed 10 of 10 on an RTX 3080 Ti and 10 of 10 on llvmpipe. That's the setup where main failed 40 of 40.

This PR's commit on the same setup (review), 0a676f3ebd on main 73f4f7e06e, with every pipeline built cold:

  • ANYPS5_NO_SHADER_CACHE=1:
    • NVIDIA GeForce RTX 3080 Ti (615.78.08): 10 of 10;
    • llvmpipe (LLVM 23.1.1, Mesa 26.2.4): 30 of 30.
  • ANYPS5_NO_SHADER_CACHE=0: 5 of 5 on both.

TechLevelZero's NVIDIA GPU test (report) passed at 0a676f3ebd, on an RTX 2000 Ada Generation (595.99.02): 813 passed, 0 new failures, and no new validation IDs in 397 GPU tests.

TechLevelZero's NVIDIA GPU test at 7cbafff1b8 (report), merged onto main e6f5730, on the same RTX 2000 Ada Generation (595.99.02): 833 passed, 0 new failures (1 fails on main too) and 0 skipped, with no new validation IDs in 406 GPU tests. agc_driver_idle_store_yields passed (8.12 s). The bot's report on #12745 of 10-31 (report, main 0836dfd) lists that test as failing on main on this machine.

On @bunbeans2-arch's AMD RDNA 4 (comment): Radeon RX 9070 XT, Windows 11 Pro 10.0.22631, MSYS2 UCRT64 GCC 16.1.0, Release, validation layer on, ANYPS5_NO_SHADER_CACHE=1. This PR (0a676f3ebd on main 16452da934) passed 10 of 10 (0.67 to 0.73 s each), with no validation errors. main also passed 10 of 10 there, so the race didn't show on that card in 10 runs. These runs show the change doesn't break the test there, not that it fixes the race.

On @JJenkx's Windows AMD GPU (comment): Radeon RX 6700 XT, AMD's driver 26.10.1, Windows 11 Enterprise 10.0.22621, WinLibs GCC 15.2.0 UCRT, Release, Vulkan Validation Layers 1.4.363. This PR's head 7cbafff1b8, merged cleanly onto main 5bae1a4bc2, passed agc_driver_idle_store_yields 3 of 3 (--repeat until-fail:3), with no VUIDs. main wasn't run there, so this shows the change works on that card on current main, not that it fixes the race there.

On @JJenkx's Linux AMD GPU (comment): Radeon RX 6650 XT, RADV (Mesa 26.2.6), Ryzen 9 7950X, Linux 7.2.11, GCC 16.2.1, Release, with the shader cache off, Vulkan required and the Khronos validation layer. main's own fixture segfaulted once against main b28bb77217 and once against the same runtime with #8932. The fixture at this PR's head 7cbafff1b8, built once, passed once against each of those two runtime builds, with no VUIDs and no skips. That's one run per arm, not a measured change in the failure rate.

Validation, CONTRIBUTING's AGC check (run):

  • Setup: GitHub's Linux runner, llvmpipe (LLVM 20.1.2, Mesa 25.2.8), Ubuntu 24.04.5, with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1 and ctest -V. It ran on 24598aa0a4, which has the same tree as this PR's commit.
  • The layer loaded in both runs, and neither log says "was not found".
  • No new VUIDs: both logs report the same single one, VUID-VkDeviceCreateInfo-pNext-pNext, which is on main too.
  • The test: main's run failed it, and this PR's passed.

Checks:

  • tools/check_conventions.py --base 73f4f7e06e: all passed.
  • tools/check_test_registration.py build: none new.
  • No comments added.

Not in this PR: Driver::WaitIdle holds the GPU mutex through Recorder::Sync while the queue's quiet period runs. A caller that waits idle and then expects results to still be pending can lose to the idle store the same way. Nothing in the driver relies on that; this test was the only one.

Checklist

  • Based on current main; no other open PR implements the same functions (no open PR touches IdleStoreYields.cpp)
  • 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: n/a, test-only
  • 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: n/a, none
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: lavapipe (llvmpipe), Ubuntu 24.04, on a 4-vCPU Xeon and on GitHub's Linux runner; NVIDIA GeForce RTX 3080 Ti (615.78.08) and llvmpipe (Mesa 26.2.4), Linux, by @Dextroid17; NVIDIA RTX 2000 Ada Generation (595.99.02), Linux, in TechLevelZero's NVIDIA GPU test; AMD Radeon RX 9070 XT (RDNA 4), Windows, by @bunbeans2-arch; AMD Radeon RX 6700 XT, Windows, and AMD Radeon RX 6650 XT (RADV), Linux, by @JJenkx. GitHub's Windows runner has no Vulkan device, so the test skips there.
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5099912525 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14066). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-31T17:31:09Z. --- ### What A test-only fix for `agc_driver_idle_store_yields` (`tests/execution/IdleStoreYields.cpp`), the test @beardsciences added in #13621. It fails intermittently on main. As @MarcZX10 asked on #13621, this is a separate PR, with the reproduction details and results below. The test races the queue twice. Waiting for the driver to go idle, the first approach linked on #13621, fixes the first race but exposes the second. This PR's single commit fixes both. **Race 1: the check runs before the second dispatch is recorded** (lines at main 73f4f7e06e): 1. `StopsWithinAnImage` submits one packet with two dispatches over the same 8 MiB surface: - `StoreRowZeroCode` writes row 0, in the first 4 MiB piece; - `StoreFarRowCode` writes row 1000, in the second piece. 2. `SubmitAndWaitForPending` (`IdleStoreYields.cpp:110-117`) returned 5 ms after `StorageTexture::AnyPending()` turned true. That happens once the **row-0** dispatch is recorded. 3. The far-row shader is new to the queue, so `Driver::dispatch` builds its pipeline (`PrepareDispatch`, `Dispatch.cpp:586`) before it takes the GPU mutex (`:608`). Without a warm pipeline cache, that build takes longer than 5 ms. 4. The fixture then takes the GPU mutex with only row 0 recorded: - the stopped store and the store of the rest both run, and nothing is left pending; - but the image doesn't hold the far row yet; - the far-row dispatch is recorded only after the mutex is released, so `Contains(split, end)` (`:172`) can read guest memory before that row lands. 5. **No write-back is lost.** A diagnostic that waited for the queue to go idle after a failed check found both rows in guest memory in 9 of 9 failures. 6. **The occasional segfault** is the same race on the failure path. The throw frees the surface while the queue's work over it is still running. It's in the test's teardown, not a lavapipe bug. 7. **This fits @Dextroid17's findings on #13621:** - the failure on an RTX 3080 Ti and on llvmpipe ([comment](https://github.com/boykopovar/AnyPS5/pull/13621#issuecomment-6543071829), [rerun](https://github.com/boykopovar/AnyPS5/pull/13621#issuecomment-6544158616)); - the order result: swapping the two stores passes. `StopsBetweenImages` has already prepared row 0's shader, so as the second dispatch it's quick. - It also fits @beardsciences' 6/6 passes on an RTX 3060 Ti with an empty shader cache. The failure depends on how fast that pipeline builds. **Race 2: the queue's own idle store takes the GPU mutex first.** The first approach, 3a3ec595b6 (the commit linked on #13621), waits with `AgcDriverWaitIdle_nid_postfix()`. On GitHub's Linux runner that exposed a second race: 1. The queue marks the submission completed right after executing it (`QueueWorker.cpp:282`, `:293`). After plain dispatches nothing else is pending, so its 50 ms `IdleResultsQuietPeriod` (`QueueWorker.cpp:20`, `:203-216`) starts at once, at the point `WaitIdle`'s drain returns. 2. `Driver::WaitIdle` (`Lifecycle.cpp:237-250`) then takes the GPU mutex and calls `VulkanDevice::WaitIdle`, whose `Recorder::Sync` submits the packet's open batch and waits for the device to run it. Timed on lavapipe with the shader cache off and the CPU loaded, that took 12.4–168.2 ms (median 47.5). `StoreDrawnLinear` stored nothing, and `vkDeviceWaitIdle` took at most 4.6 ms. 3. When that runs past 50 ms, the queue reaches `StoreIdleResults` (`QueueWorker.cpp:219`) and waits on the mutex. When `WaitIdle` releases it, the idle store can win and store both images, and the test fails with "the queue-idle store ran before the fixture could take the GPU mutex". 4. In 30 timed runs, the images stayed pending in all 16 where the fixture took the lock within 50 ms of the queue finishing, and the idle store won in all 14 where `WaitIdle` returned 52.5 ms or more after it. **The change:** the packet now ends with a `WAIT_REG_MEM` on a label in the test, the same packet `Flip.cpp:242`, `Submit.cpp:323` and `WaitShutdown.cpp:40` use. - `SubmitAndWaitForPending` becomes `SubmitAndWaitHeld`. It polls `AgcDriverAwaitedWaits_nid_postfix` until the queue waits on that label. The queue gets there only after recording both dispatches, which fixes race 1. - The fixture then takes the GPU mutex, and only then stores the label. - The idle store runs only in queue 0's own loop. That loop is still inside the packet's wait, and the wait loop stores no pending results. So the queue can't finish the packet, or start its quiet period, before the fixture holds the mutex. That fixes race 2, with no timing margin involved. - `~QueueHold` also stores the label, so a failed check never leaves the queue blocked. The labels are static, so they outlive the queue's last read. - Both sub-tests keep every check and message. No driver code changes. - **It replaces the first approach's wait.** 3a3ec595b6 fixed race 1, but it failed on GitHub's runner from race 2 ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41208705994)). It isn't part of this PR, and it stays on the fork's `archive/agc-idle-store-yields-two-commits` branch. Related: #13621 ### Tested **Linux,** on a 4-vCPU Xeon (Ubuntu 24.04, GCC 13.3, Release, CI flags, lavapipe, as an unprivileged user, `ANYPS5_REQUIRE_VULKAN=1 GALLIUM_OVERRIDE_CPU_CAPS=avx`). Each cell is 30 direct runs of `agc_driver_idle_store_yields_tests`, pass / fail / crash, all three from the same tree and driver library. This PR's column ran on 24598aa0a4, which has the same tree as this PR's commit: | condition | main 73f4f7e06e | first approach, 3a3ec595b6 | **this PR** | |---|---|---|---| | ctest's environment (`ANYPS5_NO_SHADER_CACHE=1 APS5_NO_PIPELINE_JOURNAL=1`) | 11 / 19 / 0 | 30 / 0 / 0 | **30 / 0 / 0** | | plain | 30 / 0 / 0 | 30 / 0 / 0 | **30 / 0 / 0** | | shader cache off (`MESA_SHADER_CACHE_DISABLE=true ANYPS5_NO_SHADER_CACHE=1`) | 8 / 20 / 2 | 21 / 9 / 0 | **30 / 0 / 0** | | shader cache off, with four more copies of the test looping alongside | 5 / 24 / 1 | 19 / 10 / 1 | **30 / 0 / 0** | - **Failure lines:** main's are all "the two stores did not bring both rows of the large image to guest memory" (race 1). The first approach's are all "the queue-idle store ran before the fixture could take the GPU mutex" (race 2). - **More runs of this PR:** - 100 of 100 plain and 100 of 100 with the shader cache off under load; - `ctest -R '^agc_driver_idle_store_yields$' --repeat until-fail:30`: 100%. - **Neighbouring tests:** the 7 idle-store and queue tests (`agc_driver_store_idle_results`, `_wake`, `agc_driver_idle_store_over_unmap`, `agc_driver_queue_zero_idle_wait`, `agc_driver_queued_index_read_order`, `agc_driver_storage_read_during_idle_store` and this one) pass `-j4 --repeat until-fail:10`, 70 of 70. **GitHub's runners,** `agc_driver_idle_store_yields` with `--repeat until-fail:30`: | runner | main 73f4f7e06e | first approach, 3a3ec595b6 | **this PR** | |---|---|---|---| | Linux (lavapipe) | failed on run 1, "the two stores did not bring both rows" ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41207503506)) | failed on run 1, "the queue-idle store ran before the fixture could take the GPU mutex" ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41208705994)) | **30 / 30 passed** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41220965932)) | | Windows | skipped: no Vulkan device on the runner | skipped | skipped; builds, and the libc and libkernel suites pass | **On @Dextroid17's devices** ([comment](https://github.com/boykopovar/AnyPS5/pull/13621#issuecomment-6544569480)), the first approach with the shader cache off passed 10 of 10 on an RTX 3080 Ti and 10 of 10 on llvmpipe. That's the setup where main failed 40 of 40. **This PR's commit on the same setup** ([review](https://github.com/boykopovar/AnyPS5/pull/14066#pullrequestreview-5724175264)), `0a676f3ebd` on `main` `73f4f7e06e`, with every pipeline built cold: - `ANYPS5_NO_SHADER_CACHE=1`: - NVIDIA GeForce RTX 3080 Ti (615.78.08): 10 of 10; - llvmpipe (LLVM 23.1.1, Mesa 26.2.4): 30 of 30. - `ANYPS5_NO_SHADER_CACHE=0`: 5 of 5 on both. **TechLevelZero's NVIDIA GPU test** ([report](https://github.com/boykopovar/AnyPS5/pull/14066#issuecomment-6547086703)) passed at 0a676f3ebd, on an RTX 2000 Ada Generation (595.99.02): 813 passed, 0 new failures, and no new validation IDs in 397 GPU tests. **TechLevelZero's NVIDIA GPU test at 7cbafff1b8** ([report](https://github.com/boykopovar/AnyPS5/pull/14066#issuecomment-6561947188)), merged onto `main` e6f5730, on the same RTX 2000 Ada Generation (595.99.02): 833 passed, 0 new failures (1 fails on `main` too) and 0 skipped, with no new validation IDs in 406 GPU tests. `agc_driver_idle_store_yields` passed (8.12 s). The bot's report on #12745 of 10-31 ([report](https://github.com/boykopovar/AnyPS5/pull/12745#issuecomment-6550001368), `main` 0836dfd) lists that test as failing on `main` on this machine. **On @bunbeans2-arch's AMD RDNA 4** ([comment](https://github.com/boykopovar/AnyPS5/pull/14066#issuecomment-6549413066)): Radeon RX 9070 XT, Windows 11 Pro 10.0.22631, MSYS2 UCRT64 GCC 16.1.0, Release, validation layer on, `ANYPS5_NO_SHADER_CACHE=1`. This PR (`0a676f3ebd` on `main` `16452da934`) passed 10 of 10 (0.67 to 0.73 s each), with no validation errors. `main` also passed 10 of 10 there, so the race didn't show on that card in 10 runs. These runs show the change doesn't break the test there, not that it fixes the race. **On @JJenkx's Windows AMD GPU** ([comment](https://github.com/boykopovar/AnyPS5/pull/14066#issuecomment-6564110871)): Radeon RX 6700 XT, AMD's driver 26.10.1, Windows 11 Enterprise 10.0.22621, WinLibs GCC 15.2.0 UCRT, Release, Vulkan Validation Layers 1.4.363. This PR's head `7cbafff1b8`, merged cleanly onto `main` `5bae1a4bc2`, passed `agc_driver_idle_store_yields` 3 of 3 (`--repeat until-fail:3`), with no VUIDs. `main` wasn't run there, so this shows the change works on that card on current `main`, not that it fixes the race there. **On @JJenkx's Linux AMD GPU** ([comment](https://github.com/boykopovar/AnyPS5/pull/14066#issuecomment-6584768804)): Radeon RX 6650 XT, RADV (Mesa 26.2.6), Ryzen 9 7950X, Linux 7.2.11, GCC 16.2.1, Release, with the shader cache off, Vulkan required and the Khronos validation layer. `main`'s own fixture segfaulted once against `main` `b28bb77217` and once against the same runtime with #8932. The fixture at this PR's head `7cbafff1b8`, built once, passed once against each of those two runtime builds, with no VUIDs and no skips. That's one run per arm, not a measured change in the failure rate. **Validation**, CONTRIBUTING's AGC check ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41220678900)): - **Setup:** GitHub's Linux runner, llvmpipe (LLVM 20.1.2, Mesa 25.2.8), Ubuntu 24.04.5, with `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ANYPS5_NO_SHADER_CACHE=1` and `ctest -V`. It ran on 24598aa0a4, which has the same tree as this PR's commit. - **The layer loaded in both runs,** and neither log says "was not found". - **No new VUIDs:** both logs report the same single one, `VUID-VkDeviceCreateInfo-pNext-pNext`, which is on main too. - **The test:** main's run failed it, and this PR's passed. **Checks:** - `tools/check_conventions.py --base 73f4f7e06e`: all passed. - `tools/check_test_registration.py build`: none new. - No comments added. **Not in this PR:** `Driver::WaitIdle` holds the GPU mutex through `Recorder::Sync` while the queue's quiet period runs. A caller that waits idle and then expects results to still be pending can lose to the idle store the same way. Nothing in the driver relies on that; this test was the only one. ### 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 (no open PR touches `IdleStoreYields.cpp`) - [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: n/a, test-only - [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: n/a, none - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: lavapipe (llvmpipe), Ubuntu 24.04, on a 4-vCPU Xeon and on GitHub's Linux runner; NVIDIA GeForce RTX 3080 Ti (615.78.08) and llvmpipe (Mesa 26.2.4), Linux, by @Dextroid17; NVIDIA RTX 2000 Ada Generation (595.99.02), Linux, in TechLevelZero's NVIDIA GPU test; AMD Radeon RX 9070 XT (RDNA 4), Windows, by @bunbeans2-arch; AMD Radeon RX 6700 XT, Windows, and AMD Radeon RX 6650 XT (RADV), Linux, by @JJenkx. GitHub's Windows runner has no Vulkan device, so the test skips there. - [x] AI-assisted: yes
MarcZX10 commented 2026-10-31 17:38:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T17:38:36Z.

Review: APPROVED


Reviewed — looks good

The queue hold removes the fixture’s timing window, and the exact-tree Linux repeat and paired validation runs support the change; I found no blocking issue.

What I ran

Reviewed head 0a676f3ebdabc1b378d0f158030d70415b475e8. GitHub records PR base 0c5ccb21439524e4da09b6c99c9ae3e701978c9f; I also checked the merge preview against the newer live main tip 0f302813cebfc09e3e0b6f8fced15262d186879e, which was clean. Local environment: Debian Linux 6.1, Python 3.11.2, GCC 12.2.0. I did not build or run CTest locally.

python3 tools/pr_precheck.py --base upstream/main --head 0a676f3ebdabc1b378d0f158030d70415b475e8f --title "test(agc): hold the idle-yield fixture's queue until it takes the GPU mutex" --body-file /tmp/anyps5-14066-review/pr-body.md --output-dir /tmp/anyps5-14066-review-current-main --no-negative-controls
python3 tools/pr_overlap.py --repo boykopovar/AnyPS5 --base main --branch 0a676f3ebdabc1b378d0f158030d70415b475e8 --jobs 8
git diff --check 0f302813cebfc09e3e0b6f8fced15262d186879e...0a676f3ebdabc1b378d0f158030d70415b475e8f
git merge-tree --write-tree 0f302813cebfc09e3e0b6f8fced15262d186879e 0a676f3ebdabc1b378d0f158030d70415b475e8f
gh run view 41224916664 -R boykopovar/AnyPS5 --job 124606978585 --log
gh run view 41220965932 -R EagleBearerYS/AnyPS5 --log
gh run view 41220678900 -R EagleBearerYS/AnyPS5 --log

Results

Check Result
Diff and conventions Passed against current main
Current-main merge preview Clean; preview tree 49154a0ef6f01d6c98bcd940147095200b081108
Open-PR overlap scan No overlap found
Optional precheck helpers The extracted PR tree lacks the ABI-audit and test-quality helper scripts, so those invocations could not run; no exports or Python tests changed. I separately ran the test-quality helper from this workspace.
Test-quality heuristic Its possible-unregistered-test warning is a false positive: CMake registers tests/execution/*.cpp through GLOB CONFIGURE_DEPENDS
Contributor-hosted Linux focused run Exact test tree: agc_driver_idle_store_yields passed all 30 repetitions on llvmpipe
Contributor-hosted Linux paired validation Baseline test failed and the fix passed; the validation layer loaded, with no new VUIDs
Upstream Windows workflow Passed its build job; it built library targets but did not run this AGC test. The dedicated Windows run skipped it because that runner has no Vulkan device
Linux and specialized upstream jobs Skipped by workflow policy
Unedited check output
All conventions checks passed.
No overlap with open pull requests.
49154a0ef6f01d6c98bcd940147095200b081108
with main's implementation: fail
with the fix, 30 runs: pass
RESULT os=Linux before=not-run after=pass count=1 skipped=0 suite=pass new-failures=none tests=agc_driver_idle_store_yields
RESULT os=Linux before=fail after=pass count=1 skipped=0 suite=pass new-failures=none tests=agc_driver_idle_store_yields validation=clean
validation layer: inserted 2 times on main and 2 with the fix; loader layer lines 122 and 122; 'was not found' 0 and 0 times
VUIDs with main's implementation: VUID-VkDeviceCreateInfo-pNext-pNext
VUIDs with the fix: VUID-VkDeviceCreateInfo-pNext-pNext
VUIDs the fix adds (none of them anywhere in main's log): none
{"findings":[{"path":"core/libs/prx/libSceAgcDriver/tests/execution/IdleStoreYields.cpp","line":1,"kind":"possible-unregistered-cpp-test","message":"Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage."}],"negative_control_candidates":[],"limits":["Heuristics can miss weak assertions and can flag valid tests; inspect every finding.","A test that passes against base is not by itself proof that the PR test is inadequate.","Negative controls are only candidates until the test actually runs against base and fails by assertion rather than import/setup error."]}
No guest core/libs test sources changed; the libs build still ran
/usr/bin/python3: can't open file '/tmp/anyps5-14066-review-current-main/head-0a676f3ebdab-ffa2c481/tools/pr_abi_audit.py': [Errno 2] No such file or directory
/usr/bin/python3: can't open file '/tmp/anyps5-14066-review-current-main/head-0a676f3ebdab-ffa2c481/tools/pr_test_quality.py': [Errno 2] No such file or directory
RESULT os=Windows before=not-run after=pass count=1 skipped=1 suite=pass new-failures=none tests=agc_driver_idle_store_yields

Negative control

Assertion Change under test Did the changed test fail?
agc_driver_idle_store_yields with the original fixture on the baseline implementation The PR replaces the timing-based wait with a queue WAIT_REG_MEM hold, then releases it only after taking the GPU mutex Yes. The paired Linux workflow reports the baseline arm failed and the fixed arm passed; the fixed arm also passed 30 repetitions

Findings

Blocking

None.

Non-blocking

None.

Sources

Not verified

  • No local build, CTest, or console run. I did not reproduce the reported Linux runs locally.
  • No physical GPU run of this PR; the verified GPU evidence is llvmpipe. The dedicated Windows test was skipped because no Vulkan device was available.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5724090679 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14066#pullrequestreview-5724090679). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-31T17:38:36Z. **Review:** APPROVED --- # Reviewed — looks good The queue hold removes the fixture’s timing window, and the exact-tree Linux repeat and paired validation runs support the change; I found no blocking issue. ## What I ran Reviewed head `0a676f3ebdabc1b378d0f158030d70415b475e8`. GitHub records PR base `0c5ccb21439524e4da09b6c99c9ae3e701978c9f`; I also checked the merge preview against the newer live `main` tip `0f302813cebfc09e3e0b6f8fced15262d186879e`, which was clean. Local environment: Debian Linux 6.1, Python 3.11.2, GCC 12.2.0. I did not build or run CTest locally. ```sh python3 tools/pr_precheck.py --base upstream/main --head 0a676f3ebdabc1b378d0f158030d70415b475e8f --title "test(agc): hold the idle-yield fixture's queue until it takes the GPU mutex" --body-file /tmp/anyps5-14066-review/pr-body.md --output-dir /tmp/anyps5-14066-review-current-main --no-negative-controls python3 tools/pr_overlap.py --repo boykopovar/AnyPS5 --base main --branch 0a676f3ebdabc1b378d0f158030d70415b475e8 --jobs 8 git diff --check 0f302813cebfc09e3e0b6f8fced15262d186879e...0a676f3ebdabc1b378d0f158030d70415b475e8f git merge-tree --write-tree 0f302813cebfc09e3e0b6f8fced15262d186879e 0a676f3ebdabc1b378d0f158030d70415b475e8f gh run view 41224916664 -R boykopovar/AnyPS5 --job 124606978585 --log gh run view 41220965932 -R EagleBearerYS/AnyPS5 --log gh run view 41220678900 -R EagleBearerYS/AnyPS5 --log ``` ## Results | Check | Result | |---|---| | Diff and conventions | Passed against current `main` | | Current-main merge preview | Clean; preview tree `49154a0ef6f01d6c98bcd940147095200b081108` | | Open-PR overlap scan | No overlap found | | Optional precheck helpers | The extracted PR tree lacks the ABI-audit and test-quality helper scripts, so those invocations could not run; no exports or Python tests changed. I separately ran the test-quality helper from this workspace. | | Test-quality heuristic | Its possible-unregistered-test warning is a false positive: CMake registers `tests/execution/*.cpp` through `GLOB CONFIGURE_DEPENDS` | | Contributor-hosted Linux focused run | Exact test tree: `agc_driver_idle_store_yields` passed all 30 repetitions on llvmpipe | | Contributor-hosted Linux paired validation | Baseline test failed and the fix passed; the validation layer loaded, with no new VUIDs | | Upstream Windows workflow | Passed its build job; it built library targets but did not run this AGC test. The dedicated Windows run skipped it because that runner has no Vulkan device | | Linux and specialized upstream jobs | Skipped by workflow policy | <details><summary>Unedited check output</summary> ```text All conventions checks passed. No overlap with open pull requests. 49154a0ef6f01d6c98bcd940147095200b081108 with main's implementation: fail with the fix, 30 runs: pass RESULT os=Linux before=not-run after=pass count=1 skipped=0 suite=pass new-failures=none tests=agc_driver_idle_store_yields RESULT os=Linux before=fail after=pass count=1 skipped=0 suite=pass new-failures=none tests=agc_driver_idle_store_yields validation=clean validation layer: inserted 2 times on main and 2 with the fix; loader layer lines 122 and 122; 'was not found' 0 and 0 times VUIDs with main's implementation: VUID-VkDeviceCreateInfo-pNext-pNext VUIDs with the fix: VUID-VkDeviceCreateInfo-pNext-pNext VUIDs the fix adds (none of them anywhere in main's log): none {"findings":[{"path":"core/libs/prx/libSceAgcDriver/tests/execution/IdleStoreYields.cpp","line":1,"kind":"possible-unregistered-cpp-test","message":"Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage."}],"negative_control_candidates":[],"limits":["Heuristics can miss weak assertions and can flag valid tests; inspect every finding.","A test that passes against base is not by itself proof that the PR test is inadequate.","Negative controls are only candidates until the test actually runs against base and fails by assertion rather than import/setup error."]} No guest core/libs test sources changed; the libs build still ran /usr/bin/python3: can't open file '/tmp/anyps5-14066-review-current-main/head-0a676f3ebdab-ffa2c481/tools/pr_abi_audit.py': [Errno 2] No such file or directory /usr/bin/python3: can't open file '/tmp/anyps5-14066-review-current-main/head-0a676f3ebdab-ffa2c481/tools/pr_test_quality.py': [Errno 2] No such file or directory RESULT os=Windows before=not-run after=pass count=1 skipped=1 suite=pass new-failures=none tests=agc_driver_idle_store_yields ``` </details> ## Negative control | Assertion | Change under test | Did the changed test fail? | |---|---|---| | `agc_driver_idle_store_yields` with the original fixture on the baseline implementation | The PR replaces the timing-based wait with a queue `WAIT_REG_MEM` hold, then releases it only after taking the GPU mutex | Yes. The paired Linux workflow reports the baseline arm failed and the fixed arm passed; the fixed arm also passed 30 repetitions | ## Findings ### Blocking None. ### Non-blocking None. ## Sources - [Queue hold, timeout, and pending-work assertion at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/0a676f3ebdabc1b378d0f158030d70415b475e8f/core/libs/prx/libSceAgcDriver/tests/execution/IdleStoreYields.cpp#L113-L145) - [Execution-test `CONFIGURE_DEPENDS` glob at current `main`](https://github.com/boykopovar/AnyPS5/blob/0f302813cebfc09e3e0b6f8fced15262d186879e/core/libs/prx/libSceAgcDriver/CMakeLists.txt#L2451) - [Upstream Windows job](https://github.com/boykopovar/AnyPS5/actions/runs/41224916664/job/124606978585) - [Contributor-hosted exact-head Linux repetition](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41220965932) - [Contributor-hosted paired Linux validation run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41220678900) ## Not verified - No local build, CTest, or console run. I did not reproduce the reported Linux runs locally. - No physical GPU run of this PR; the verified GPU evidence is llvmpipe. The dedicated Windows test was skipped because no Vulkan device was available.
Dextroid17 commented 2026-10-31 17:59:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-31T17:59:46Z.

Review: APPROVED


Ran this head (0a676f3ebd, on main 73f4f7e06e) on the setup that failed agc_driver_idle_store_yields 40 of 40 times on main earlier today (#13621), where every pipeline is built cold:

ANYPS5_NO_SHADER_CACHE=1   NVIDIA GeForce RTX 3080 Ti (615.78.08)   10/10 pass
                           llvmpipe (LLVM 23.1.1, Mesa 26.2.4, GALLIUM_OVERRIDE_CPU_CAPS=avx)   30/30 pass
ANYPS5_NO_SHADER_CACHE=0   both devices   5/5 pass

Direct runs of the test binary, build log shows IdleStoreYields.cpp compiled at this head. On the mechanism: the hold is a wait on a label the fixture owns, released only after it holds the GPU mutex, so neither the pipeline build time nor the queue's own idle store can get ahead of the check; that closes both races (the 5 ms wait, and the one WaitIdle opened on the Linux runner). Approving.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5724175264 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14066#pullrequestreview-5724175264). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-31T17:59:46Z. **Review:** APPROVED --- Ran this head (`0a676f3ebd`, on main `73f4f7e06e`) on the setup that failed `agc_driver_idle_store_yields` 40 of 40 times on main earlier today (#13621), where every pipeline is built cold: ``` ANYPS5_NO_SHADER_CACHE=1 NVIDIA GeForce RTX 3080 Ti (615.78.08) 10/10 pass llvmpipe (LLVM 23.1.1, Mesa 26.2.4, GALLIUM_OVERRIDE_CPU_CAPS=avx) 30/30 pass ANYPS5_NO_SHADER_CACHE=0 both devices 5/5 pass ``` Direct runs of the test binary, build log shows `IdleStoreYields.cpp` compiled at this head. On the mechanism: the hold is a wait on a label the fixture owns, released only after it holds the GPU mutex, so neither the pipeline build time nor the queue's own idle store can get ahead of the check; that closes both races (the 5 ms wait, and the one `WaitIdle` opened on the Linux runner). Approving. AI-assisted: yes
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!14066
No description provided.