Skip to content

test(agc): run the second-store case on a surface that was never watched - #22764

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
DerKarussellbremser:fix/store-over-untracked-rewatched
Nov 27, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
DerKarussellbremser:fix/store-over-untracked-rewatched

Conversation

@DerKarussellbremser

@DerKarussellbremser DerKarussellbremser commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

What

agc_driver_store_over_untracked fails intermittently on Windows in its "a second store over a surface outside the write watch" case with the store left no saved guest bytes (#22670). The cause is the test's fixture, not a lost store.

RunSecondStore allocated its surface in the guest write-watch arena, took it out of the watch with GuestMemory::Unwatch and then required the first store to leave saved guest bytes. On Windows the host import that the store makes over the surface is settled, and rewatchSettledImports puts the range back under the write watch. When that happens before the first store's write-back, the write-back sees watched memory and keeps no saved bytes (GuestMemory::Watched(firstStored, ...) ? {} : prepareStoredSave(...) in writeBackLayers), and the case reported Outcome::Lost.

The case now uses a surface that is never in the write-watch arena (Surface surface;, the fixture's existing unwatched constructor), requires it to be outside the watch at the start and again after the first store, and keeps every check after that: the saved bytes, the CPU's page surviving the second store, and the second result reaching the block the CPU left alone. The driver is unchanged.

This fixture is the one @thalesdot1dot1 posted in #22670; the commit carries them as co-author. It replaces my first version of this PR, which let a surface that was watched again skip the saved-bytes check. As @u-instinct11 measured on Intel, that version skipped it in 98 of 300 runs, and on this machine in 21 of 40, so it no longer tested the unwatched second store it is named for.

Tested

Windows 11 Home 10.0.26200, Intel i7-10750H, NVIDIA GeForce RTX 2060 (driver 610.91), WinLibs GCC 15.2.0 r7, Release, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1, ctest -R ^agc_driver_store_over_untracked$, built from main d50640e264:

failed runs
main 9 of 20, all with the store left no saved guest bytes
this change 0 of 30

With this change none of the 30 runs printed a line for the second-store case, so each ran it to the end with saved bytes and lost 0.

Earlier measurements on this machine (local trace lines, not part of this PR): in all 9 failing traced runs on main rewatchSettledImports covered the surface between the test's Unwatch and the first write-back.

Not tested, and limits:

python tools/check_conventions.py --base origin/main passes.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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: Fixes agc_driver_store_over_untracked is flaky on Windows: the second-store case sometimes finds no saved guest bytes #22670
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 2060, driver 610.91, Windows 11 Home 10.0.26200
  • AI-assisted: yes

🤖 Generated with Claude Code

https://claude.ai/code/session_011TXsSW8zeAgKgHLCFsYwM3

@github-actions github-actions Bot added fix error Closes an issue (Fixes #N) agc libSceAgc* labels Nov 18, 2026
@domx4q

domx4q commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Ran the test on NVIDIA's proprietary Linux driver with the Khronos validation layer, since the description's runs are on Windows.

Setup: Arch Linux (kernel 7.3.4), GCC 16.2.1, Release, NVIDIA GeForce RTX 4090 (vendor 0x10de, device 0x2684, Ada), proprietary driver 620.70.06, Vulkan 1.4.357, Khronos validation layer 1.4.363.1. Head d1aaf844dd merged onto main 1ccc399b17 with --no-ff, clean merge. Main baseline is a Release build of 1ccc399b17 on the same machine.

WAYLAND_DISPLAY=wayland-1 XDG_RUNTIME_DIR=/run/user/1000 DISPLAY=:0 ANYPS5_REQUIRE_DISPLAY=1 \
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer \
ctest --test-dir build -R '^agc_driver_store_over_untracked$' -V
main 1ccc399b17 this PR
Result 1/1 passed 1/1 passed
Insert instance layer "VK_LAYER_KHRONOS_validation" 2 2
was not found but was requested by env var VK_INSTANCE_LAYERS 0 0
VUID- none none

The test binary was also run 50 more times on each side through ctest with the same environment: 0 of 50 failed on main and 0 of 50 on this PR, no VUID- in either. On this machine the race does not show up: none of the 51 runs per side printed the store left no saved guest bytes on main or the surface is under the write watch again on this PR, so the new branch is not exercised here; it changes nothing for the path that is taken. Every device selection picked the RTX 4090.

No new VUID- errors; the test passes on Ada, but the rewatched path this PR handles does not occur on Linux/NVIDIA.

AI-assisted: yes (Claude Code)

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 6188 core/libs/prx/libSceAgcDriver/tests/execution/StoreOverUntracked.cpp

@CIS-C0

CIS-C0 commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Turing on Windows with the validation layer.

Setup: Windows 11 Enterprise 10.0.28000, i5-11400F, NVIDIA GeForce RTX 2060 (Turing, device 0x1f08), driver 610.88, WinLibs GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON. Base main 4bc85f4dd9; head d1aaf844dd applied with git apply (clean). Only agc_driver_store_over_untracked_tests was rebuilt for each build.

Environment: ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (layer 1.4.363.1), VK_LOADER_DEBUG=layer, ctest -V, the test alone. All 20 logs show the loader inserting the layer, no was not found line, and no VUID- line.

build agc_driver_store_over_untracked, 10 runs
main fails 10 of 10: the second-store case prints the store left no saved guest bytes, then a pending storage result was stored over bytes the CPU wrote to untracked memory
this PR passes 10 of 10

The rate on main depends on timing here: in an earlier ctest invocation that ran this test after four other GPU tests, main failed 1 of 3.

As in #22670, some cases skip on both builds with not run, the surface is not write-watched: a surface that left the write watch and a surface whose first block left the write watch with the page before it in every run, a surface whose import left the write watch in 2 of 10 runs on main and 9 of 10 with this PR, and a surface written before it left the write watch in 2 of 10 on main and 6 of 10 with this PR.

Not run: the full suite with this PR.

AI-assisted: yes

@Ethan-Hainline Ethan-Hainline left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed and verified on Windows 11, Ryzen 5 7530U (Radeon Vega 8 iGPU), MinGW-w64 GCC 16.2.0 UCRT, Release, Vulkan available:

A/B on current main 168921678f

  • Without the patch: agc_driver_store_over_untracked_tests failed 1 of 3 runs with exactly a second store over a surface outside the write watch: the store left no saved guest bytes, so #22670 reproduces here.
  • With d1aaf844dd applied: 10 of 10 runs passed.

Other checks

  • The target compiles cleanly with the change.
  • AgcDriver::GuestMemory::Watched(address, SurfaceBytes) exists with that signature; reading it inside the same GpuMutex critical section as GuestSnapshotValid() matches how settleUnwatchedImports and rewatchSettledImports use it, so the decision is coherent.
  • The new branch fired on every run here (5 of 5), not occasionally. On this machine the rewatch happens before the check each time, so on Windows the case now always takes the "watched again" path and no longer exercises the saved-bytes assertion at all. The CPU-page and second-result checks still run, and the message makes the path visible in the log, so I don't think this blocks the fix — but if the rewatch is now the normal Windows behaviour rather than a race, the case name "outside the write watch" is doing less than it says. Worth a sentence in the body or a follow-up that re-unwatches and retries if the intent is to keep covering the unwatched path on Windows.

Not a blocker from me; the patch fixes the reproduced failure without weakening the assertions that still apply.

AI-assisted.

@Colewiz7

Copy link
Copy Markdown
Contributor

Head d1aaf844dd merged onto main 973026d9b0 as 819010bd2f, no conflict. Linux 7.3.4, GCC 16.2.1 Release, Mesa 26.2.6 RADV, RX 7900 XT (gfx1100) and 7800X3D iGPU (gfx1036).

No new failures and no new validation messages on either GPU.

RX 7900 XT iGPU
full suite (6163 tests), new failures vs main none none
-R '^agc' (1936 tests) with the layer, new failures vs main none none
VUID- / SYNC-HAZARD lines 0 / 0 0 / 0

Layer runs used VK_LAYER_KHRONOS_validation 1.4.363.1 with VK_LOADER_DEBUG=layer and ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1; the loader inserted the layer in every run, and the validation message set matches main.

AI-assisted: yes

@DerKarussellbremser

Copy link
Copy Markdown
Contributor Author

@Ethan-Hainline thanks, that is a useful observation, and it is not what I see here. I went back to the logs of the 40 runs in the description: with the change the new branch fired in 21 of 40 runs on the RTX 2060, and the other 19 ran the saved-bytes requirement and passed. So on this machine it is still a race and both paths are exercised; on your Vega 8 the rewatch always wins. I added a paragraph to the description saying so.

Forcing the unwatched path on every machine (unwatch again and retry, as you suggest) would be a change to the fixture rather than to the check, so I would keep it out of this fix; I can do it as a follow-up if the maintainers want the case to cover that path everywhere.

AI-assisted (Claude Code).

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — looks good

Nothing blocks this change; the optional points below are informational.

What I ran

Reviewed head d1aaf844dd53b545b6d07c922bf5b311944c6cc9. No commands or tests were run; I inspected the prepared diff and pinned source through the repository reader.

Results

Check Result Note
Changed-code review passed One test fixture change
Tests not run No local execution

Findings

Blocking

None.

Non-blocking

  • RunSecondStore now accepts a rewatched surface and carries on to its second-store assertions. That addresses the reported timing-dependent early failure while retaining the saved-bytes requirement when the surface remains unwatched. The PR description also clarifies that the second store’s result and CPU-written page are checked in the rewatched path.

Not verified

  • Test execution and CI results were not verified independently; reported runs in the PR description are author supplied.
  • I did not read the full changed file; the review was limited to the changed hunk and nearby RunSecondStore logic, the related GuestMemory::Watched implementation, and the adjacent fixture function.
  • review/description.md, review/commits.md, review/manifest.json, review/diff.patch, and core/libs/prx/libSceAgcDriver/tests/execution/StoreOverUntracked.cpp ranges 270–390 were read. No files were excluded by the manifest.

To get this to a good state

Nothing is required. The optional point above is informational.

@thalesdot1dot1

Copy link
Copy Markdown
Contributor

Following up on the coverage gap discussed above, I prototyped a test-only change that keeps the existing case where the surface leaves the write watch and adds a separate case using a surface that was never registered. The new case requires a saved guest snapshot after the first store, then verifies that the second store reaches the untouched block and preserves the full page written by the CPU between stores.

On Windows with an RTX 5060, I compared main at 99ff5e9cc31 plus this PR at d1aaf844dd with the same build plus the fixture change. agc_driver_store_over_untracked and agc_driver_store_pending_identity each passed 10/10 on both builds with Khronos validation 1.4.368 and no validation diagnostics. The original surface was rewatched in every run, and the new case completed on the never-watched path in all ten patched runs.

Sharing the test patch (66590026ee5) in case it helps with the follow-up discussed above. AI-assisted with Codex.

@eaglescoutmaster

Copy link
Copy Markdown
Contributor

RTX 5080 run of head d1aaf844dd, as asked for in #22670. agc_driver_store_over_untracked, 20 serial runs each:

Tree Failed
main 14 of 20, all with the store left no saved guest bytes then AGC graphics: a pending storage result was stored over bytes the CPU wrote to untracked memory
this PR 0 of 20

10 of the 20 runs with the PR took the watched-again path and 10 the saved-bytes requirement. The 5 tests matching ^agc_driver_store show no difference between the two trees.

Setup: base main afe88d44ad, the PR diff applied with git apply (clean), only the affected targets rebuilt. Windows 11 Pro build 26300, Intel Core i9-14900K, NVIDIA GeForce RTX 5080 (10de:2c02), driver 617.14, Vulkan API 1.4.351, WinLibs GCC 15.2.0 r7, Release. ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_GPU=RTX 5080. No validation layer installed, so no VUID- check. Another application was using the GPU during the runs.

AI-assisted: yes (Claude Code)

@XFlawless1

Copy link
Copy Markdown
Contributor

Windows 11 Pro (build 26300), WinLibs GCC 15.2.0 r7, Release, -DBUILD_TESTING=ON. NVIDIA GeForce RTX 5080 (Blackwell), driver 621.14, Vulkan 1.4.357; AMD Radeon integrated graphics (Ryzen 7 9800X3D, gfx1036), AMD driver 32.0.21042.62, Vulkan driver 2.0.353. ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (SDK 1.4.363; the loader's Insert instance layer "VK_LAYER_KHRONOS_validation" was confirmed with VK_LOADER_DEBUG=layer on the same build). The PR head was merged onto main ff63c72 with git merge --no-ff, as the CI build does; each test ran three times (--repeat until-fail:3) per GPU.

On main ff63c72, agc_driver_store_over_untracked fails on both GPUs here with a pending storage result was stored over bytes the CPU wrote to untracked memory, after a second store over a surface outside the write watch: the store left no saved guest bytes.

With this PR (d1aaf84) merged it passes 3/3 on the RTX 5080 and 3/3 on the AMD iGPU. On the RTX 5080 every run took the new branch: the surface is under the write watch again, which tracks its second store. The other cases still report not run, the surface is not write-watched, as on main. No VUID- messages.

@rafaconvaitis

Copy link
Copy Markdown
Contributor

Confirmation on a machine where main fails: agc_driver_store_over_untracked fails on main 907fe8fd31 on both GPUs and passes with head d1aaf844dd merged alone onto it (git merge --no-ff, clean merge).

Setup: Windows 11 25H2 (build 26200), two GPUs in the same machine, each selected with ANYPS5_GPU: AMD Radeon 760M integrated graphics (1002:15bf, Vulkan device name Radeon 5), AMD Software 26.11.2 (driver 32.0.32029.2010, Vulkan 1.4.359), and NVIDIA GeForce RTX 3050 6 GB (10de:2584), driver 610.88 (Vulkan 1.4.341). WinLibs GCC 15.2.0 r7 UCRT, Release, BUILD_TESTING=ON, all 914 agc*_tests targets built, Khronos validation layer 1.4.363 (LunarG SDK 1.4.363.1).

ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer SDL_AUDIODRIVER=dummy, ctest -R '^agc_driver_store_over_untracked$' -V -j 1, 3 runs per cell.

test main, Radeon 760M main, RTX 3050 this PR, Radeon 760M this PR, RTX 3050
agc_driver_store_over_untracked fails 3/3 fails 3/3 passes 3/3 passes 3/3
  • On main it logs [store over untracked] a second store over a surface outside the write watch: the store left no saved guest bytes and then AGC graphics: a pending storage result was stored over bytes the CPU wrote to untracked memory.
  • Across all of today's runs of main on this machine, the three in the table included, it failed 10 of 10 times on the RTX 3050 and 9 of 10 on the Radeon 760M, so here it is close to a steady failure.
  • VUID- lines: 0 in all logs. Every run logs the Selected GPU name= line of its GPU and Insert instance layer "VK_LAYER_KHRONOS_validation", and none logs was not found but was requested.

AI-assisted: yes (build and runs scripted with an AI assistant, on the hardware above).

@Gruzzberry

Copy link
Copy Markdown
Contributor

Hardware test report: RTX 4070 (Windows)

  • GPU: NVIDIA GeForce RTX 4070 (10de:2786), driver 610.88, Vulkan 1.4.341
  • OS/toolchain: Windows 11 build 26200, WinLibs GCC 15.2.0 r7, Release, -DBUILD_TESTING=ON
  • Base: main at fbaae8a79d; PR head d1aaf844dd merged onto it
  • Env: ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, VK_LOADER_DEBUG=layer
  • Validation layer: 1.4.363 (>= 1.4.335). The OBS and Overwolf implicit layers were disabled for these runs.
  • Each log shows Insert instance layer "VK_LAYER_KHRONOS_validation" and none contains was not found but was requested by env var VK_INSTANCE_LAYERS.

ctest -R ^agc_driver_store_over_untracked$ -V, 10 runs each:

passed failed VUID- lines
main 1 9 0
this PR 10 0 0

On this machine the test fails on main in 9 of 10 runs and passes in 10 of 10 with this change.

AI-assisted: yes. Results are from one machine and one GPU only.

@u-instinct11

Copy link
Copy Markdown
Contributor

For #22670, I compared this PR (d1aaf84) and the alternative fixture in the issue, each applied separately to 34bd032. The difference shows up even when both candidates pass CTest.

On Intel Graphics 0x7d67 (101.8860), the ordinary baseline failed the second-store snapshot check in 12/30 pilot runs and 23/60 interleaved controls. Each candidate passed 300/300 interleaved runs. In 98/300 PR runs the surface regained its write watch, bypassing the saved-snapshot assertion. The other 202 had no rewatch message; the assertion has no success marker. The alternative fixture explicitly requires the surface to remain unwatched after the first store, so it more directly tests the unwatched second store.

On the RTX 5090 Laptop (621.01), the ordinary baseline passed 30/30, so the long comparison ran only on Intel. With Khronos validation enabled the baseline failed 3/3 on each GPU and each candidate passed 3/3 on each. These are fixture comparisons on Windows 11 build 26200. The attached archive includes both diffs, runner, manifest and all 756 logs, including the 18 validation-enabled pending-identity controls. AI-assisted (Codex and Claude).

AnyPS5-22670-overnight-evidence.zip

The case took an arena surface out of the write watch, and a settled host
import could put it back before the first write-back, which then kept no
saved bytes. A surface outside the arena stays unwatched, so the case now
requires that and still checks the saved bytes and the second store.

Co-authored-by: thalesdot1dot1 <296322452+thalesdot1dot1@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011TXsSW8zeAgKgHLCFsYwM3
@DerKarussellbremser
DerKarussellbremser force-pushed the fix/store-over-untracked-rewatched branch from d1aaf84 to 5503a0c Compare November 20, 2026 03:38
@DerKarussellbremser DerKarussellbremser changed the title test(agc): let the second-store case run when its surface is watched again test(agc): run the second-store case on a surface that was never watched Nov 20, 2026
@DerKarussellbremser

Copy link
Copy Markdown
Contributor Author

@u-instinct11 Thanks, that is right: the first version let a surface that was watched again pass without the saved-bytes check, so it did not test the unwatched second store. On my RTX 2060 that path was taken in 21 of 40 runs.

The branch now carries the fixture @thalesdot1dot1 posted in #22670 instead (commit 5503a0cbff, with them as co-author), rebased on main d50640e264. On the RTX 2060 (driver 610.91): main failed 9 of 20 runs with the store left no saved guest bytes, the new fixture passed 30 of 30, and none of those runs printed a line for the second-store case. The description is updated.

AI-assisted (Claude Code).

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — looks good

Nothing blocks this change; the test now allocates an unwatched surface and checks that the write watch remains absent after the first store, while retaining its saved-byte and second-store assertions.

What I ran

Reviewed head 5503a0cbff3d3cf44f63b62c8c3c9ea69bde66b2 using repo_read.py to read the supplied review materials and the changed source. No commands or tests were run.

Files read: description.md, commits.md, manifest.json, diff.patch, and core/libs/prx/libSceAgcDriver/tests/execution/StoreOverUntracked.cpp (lines 1–25 and 260–355). The manifest lists one reviewed file, and its full text was available. No files were excluded by the manifest.

Results

Check Result Note
Diff and changed source review passed One changed test file
Tests not run Author-reported results were not rerun

Findings

Blocking

None.

Non-blocking

None.

Not verified

No tests or conventions checks were run. The author reports Windows runs and a conventions check in the description; these results were not independently verified. Linux, macOS, and full-suite behavior were not verified.

To get this to a good state

Nothing is required.

@NathanFahey23

Copy link
Copy Markdown
Contributor

Windows NVIDIA run of the new head 5503a0cbff, merged with --no-ff onto main d50640e264 (67645cc7e5, clean merge). Only agc_driver_store_over_untracked_tests was rebuilt.

Setup: Windows 11 Home 10.0.26300, i9-13900K, RTX 4080 (10de:2704), driver 32.0.16.2101, WinLibs GCC 15.2.0 Release, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1.

agc_driver_store_over_untracked, run alone 20 times in a row:

main d50640e264 merge 67645cc7e5
default 10/20 (the store left no saved guest bytes) 20/20
APS5_NO_REWATCH_UNDER_IMAGES=1 20/20 20/20

The other four cases still print not run, the surface is not write-watched on the merge, as on main.

Not checked: whether the second-store case took the unwatched path in each passing run (no counter added), the rest of the GPU set on the merge, AMD, Linux.

AI-assisted: yes

@u-instinct11

Copy link
Copy Markdown
Contributor

Thanks for updating the fixture. I checked the revised head 5503a0c against the exact alternative used in the Intel comparison: applying the saved fixture patch to 34bd032 produces the same StoreOverUntracked.cpp Git blob as the new head (b0219a8e73512b98f189b489251b28da239095b0). The saved fixture executable also matches the SHA-256 recorded in the run manifest. So the earlier 300/300 Intel comparison result covers this exact fixture source on the recorded base. I did not rebuild the new merge or count those as new trials. AI-assisted (Codex).

@throny throny left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving per the review above.

AI-assisted review (Claude Code)

@fin-github

Copy link
Copy Markdown
Contributor

Two more data points, including the first Ampere card and an RDNA2 iGPU on AMD's Windows driver.

Setup: Windows 11 Pro 10.0.26200, Ryzen 5 7600X, WinLibs GCC 15.2.0 r7 (WinLibs CMake 4.3.1, Ninja 1.13.2), Release, BUILD_TESTING=ON. main d32e214029; this PR's StoreOverUntracked.cpp (5503a0cbff) on the same tree. ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1, no validation layer, ctest --test-dir build -R '^agc_driver_store_over_untracked$', 20 serial runs per GPU and side, each a fresh process.

GPU Driver main this PR
NVIDIA GeForce RTX 3070 (Ampere, 10de:2488) 617.42 failed 1 of 20 failed 0 of 20
AMD Radeon Graphics, Ryzen 7600X iGPU (RDNA2 gfx1036, 1002:164e) AMD proprietary 25.30 failed 3 of 20 failed 0 of 20

All four main failures are the same case:

[store over untracked] a second store over a surface outside the write watch: the store left no saved guest bytes

The same test also failed once in a full ctest -j 4 sweep with VK_LAYER_KHRONOS_validation 1.4.363 on each GPU, with the same message on both.

AI-assisted: yes

@DannyOppenheimer

Copy link
Copy Markdown
Contributor

An RDNA1 data point: on an RX 5700 XT the test fails on every run on main, and this PR fixes it.

Setup: Windows 11 Home 26200, Ryzen 7 7700X, AMD Radeon RX 5700 XT (RDNA1, gfx1010, 1002:731f), AMD driver 32.0.21045.5002. WinLibs GCC 15.2.0 r7, CMake 4.3.1, Ninja 1.13.2, Release. main b8b8f49250. ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (layer 1.4.369; the loader log shows it inserted in every run), VK_LOADER_DEBUG=layer.

Command: ctest --test-dir build -R "^agc_driver_store_over_untracked$" -V, run 10 times one after another, with nothing else using the GPU.

Tree Result VUID- lines
main b8b8f49250 10 of 10 failed 0
main b8b8f49250 with this PR's StoreOverUntracked.cpp (5503a0cbff) 10 of 10 passed 0

Every main failure is the second-store case:

[store over untracked] a second store over a surface outside the write watch: the store left no saved guest bytes
AGC graphics: a pending storage result was stored over bytes the CPU wrote to untracked memory

Two more runs on main without the validation layer also failed. Earlier, in a -j4 run of all 2,071 AGC tests on the same tree, this was the only AGC test that failed. Main has not changed StoreOverUntracked.cpp since this PR's base, so the PR side differs from main only by this PR's change.

As on the other Windows machines, the two cases that need a write-watched surface print not run, the surface is not write-watched on both trees.

@zedekvdb

Copy link
Copy Markdown
Contributor

A Pascal data point: on a Quadro P3200 the test fails on every run on main, and this PR fixes it.

Setup: Windows 11 Pro 10.0.26300, Intel Core i7-8750H (laptop), NVIDIA Quadro P3200 (Pascal, 10de:1bbb), driver 582.42, Vulkan API 1.4.312, WinLibs GCC 15.2.0 r7, Release. This PR's StoreOverUntracked.cpp at 5503a0cbff applied onto main d32e214029. VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ANYPS5_GPU="Quadro P3200", ctest -R "^agc_driver_store_over_untracked$" -j 1 -V, each run started on its own. Every log shows Selected GPU name=Quadro P3200, the loader inserted the validation layer in every run, and there are no VUID- messages.

Runs passed Time per run
main d32e214029 0 of 10 1.5 to 6.3 s
With this PR 10 of 10 3.1 to 12.3 s

Every failure on main is the one in #22670: a second store over a surface outside the write watch: the store left no saved guest bytes. The same test failed 0 of 5 in the baseline sweep on this card (#26284).

AI-assisted: yes (Claude Code)

@JJenkx

JJenkx commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Windows / AMD: this fixes agc_driver_store_over_untracked here too. On current main, 10/10 runs fail; with this PR's test change, 10/10 pass.

Setup:

  • Windows 11 22621, Ryzen 9 5950X, Radeon RX 6700 XT (1002:73df, subgroup 64, AMD driver 26.11.2), GCC 15.2 UCRT r7, Release, ANYPS5_REQUIRE_VULKAN=1.
  • main arm: main 289b90f19c (today's), my existing full build.
  • PR arm: the same main with this PR's diff applied (StoreOverUntracked.cpp only, from head 5503a0cbff), in a separate build.
  • ctest -R '^agc_driver_store_over_untracked$', alternating main / PR, 10 runs each, in one FIFO job.
Arm Runs Passed
main 289b90f19c 10 0
main + this PR 10 10

On main, every run fails at the same check:

[store over untracked] a second store over a surface outside the write watch: the store left no saved guest bytes
AGC graphics: a pending storage result was stored over bytes the CPU wrote to untracked memory

On this host the failure isn't flaky. It also failed in my full Windows sweep of 289b90f19c an hour ago, and of a5bd6fad0d on 11-26. That makes AMD RDNA2 a second architecture after the Pascal result above.

AI-assisted: yes.

@oneandonlydean
oneandonlydean merged commit 8adee7b into boykopovar:main Nov 27, 2026
14 of 16 checks passed
oneandonlydean pushed a commit that referenced this pull request Dec 5, 2026
agc_driver_idle_store_over_unmap skipped on every Windows run with
"the first store left no saved guest bytes to compare with", so it never
reached the unmap it is written for. The surface came from the guest
write-watch arena and was taken out of the watch with
GuestMemory::Unwatch. On Windows the store's host import is settled and
rewatchSettledImports puts the range back under the write watch before
the first write-back, which then keeps no saved bytes. A probe showed
the surface watched again after the first store in 3 of 3 runs on each
GPU. This is the cause #22764 found for agc_driver_store_over_untracked.

The surface now comes from memory that is never registered with the
write watch (VirtualAlloc on Windows, mmap without registration
elsewhere), as #22764 did for its second-store case. The test requires it
to be outside the watch at the start and again after the first store,
and keeps every later check. The driver is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* fix error Closes an issue (Fixes #N)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

agc_driver_store_over_untracked is flaky on Windows: the second-store case sometimes finds no saved guest bytes