Skip to content

fix(agc): report draw cache validation miss reasons - #23550

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
JJenkx:fix/agc-draw-cache-validation-reasons-20261119
Dec 4, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
JJenkx:fix/agc-draw-cache-validation-reasons-20261119

Conversation

@JJenkx

@JJenkx JJenkx commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

What

Draw-cache reports group six validation refusals under gate. A saved Hamster workshop run ended an interval with 121,626 such misses, leaving the cause hidden.

Count the existing selected EntryOutcome alongside that aggregate and report inaccessible memory, queued labels, unfinished image publication, and changed publication/pending/forget serials separately. Selection, validation and synchronization stay as they are. The counts describe failed lookups using the same first layout-compatible candidate as the existing classification, rather than every attempted variant. Existing interval reset and cache locking cover the new counters.

Tested

Main bf10f075132a and change 1eb68bccbb01: full Release SDK/relinker builds and the same six draw-cache reuse/verification and user-word data-hit tests on Linux 7.2.14, GCC 16.2.1, AMD Radeon RX 6650 XT/RADV Mesa 26.2.7. ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, Khronos validation 1.4.363 and VK_LOADER_DEBUG=layer were set on both arms. All 12 cases passed: 24 confirmed layer insertions, no skips or VUID- errors. Pinned Vulkan-Headers version 335. Frozen SDK hashes and patched/unpatched module identity were checked.

Native PPSA06652 01.009.000, saved workshop, APS5_TRACE_DRAW_CACHE=1 with APS5_PROFILE_DRAW unset: normal close, exit 0 after 222.6 seconds. In all 22 report intervals the six detailed counts sum exactly to the existing gate count. Total: 1,063,404 flushing image, 37 publish moved, the other four zero. Original inputs, SDK and kernel settings remained intact; no native process remained. This is diagnostic validation, not a title speedup claim.

Example new output:

[draw-cache] validation misses (10 s): inaccessible 0, queued label 0, flushing image 104656, publish moved 3, pending moved 0, forget moved 0

Source patch, paired builds, complete GPU logs, native counter intervals and provenance, SHA-256 c3efb221b44bbcef3b13063a0ace827ea0e4a1f415ae14ad6d38f39203381c5c. Download and all 37 payload hashes verified. Game binaries and raw game traces are excluded.

Branch overlap scan completed. Eleven PRs with base conflicts required manual shared-file review; their indexed heads matched live GitHub heads, and none adds these outcome counters. The branch merges cleanly with d7e3a494470b; its four upstream files are unchanged since the tested base.

The six focused Linux cases are agc_driver_draw_cache_reuse, agc_driver_draw_cache_reuse_verify, agc_driver_draw_cache_reuse_entry_verify, agc_driver_draw_data_hit_user_words, agc_driver_draw_data_hit_user_words_verify, and agc_driver_draw_data_hit_user_words_table_keep.

Independent Windows/NVIDIA evidence: artor410's report tested this head on main ded746ea12, Windows 11 Pro 26300, RTX 3070 Ti, NVIDIA 610.88, WinLibs GCC 15.2.0 r7 and Khronos 1.4.363. The author reports 27/27 selected draw-cache/data-hit tests passing on both sides, the layer inserted in every test and no VUIDs. Those short tests do not exercise the new 10-second counter reports; no title or full-suite run is claimed by that report.

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: none
  • Unblocks: none
  • GPUs tested: AMD Radeon RX 6650 XT, RADV Mesa 26.2.7, Linux 7.2.14; independently reported NVIDIA RTX 3070 Ti, driver 610.88, Windows 11 Pro 26300 (linked above)
  • AI-assisted: yes

@github-actions github-actions Bot added the agc libSceAgc* label Nov 19, 2026

@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 inspected code supports the stated diagnostic behavior.

What I ran

Reviewed head 1eb68bccbb012081619888aa1b3102b65619198b using the prepared diff and repo_read.py for targeted source context. No commands or tests were run.

Results

Check Result Note
Diff and targeted source review passed Four changed files read
Build and tests not run Results in the PR description were not independently verified

Findings

Blocking

None.

Non-blocking

None.

Not verified

Builds, tests, native run, and attached validation artifacts were not independently verified. The four changed files in manifest.json were all read; files.json was not available in the review folder listing.

To get this to a good state

Nothing is required.

@JJenkx

JJenkx commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor Author

The Windows CI build completed, but its selected test run finished 3,714 passed, 1,519 skipped, and 1 failed (5,234 selected). The sole failure is nkwebkit_wtfcputime, reporting WTF::CPUTime check failed at line 118 (wall.count() >= 0.15 in the worker-clock timing test). This PR changes only the four AGC cache-diagnostic files; it does not change that test or the NKWebKit clock implementation.

Failing Windows job. This is a CI failure report, not a claim of a clean Windows run or a paired Windows regression result. The focused paired Linux/RADV results in the description remain unchanged.

AI-assisted: yes

@artor410

Copy link
Copy Markdown
Contributor

Windows + NVIDIA run of head 1eb68bccbb, merged onto main ded746ea12 with --no-ff (clean merge). The description covers AMD on Linux only.

Setup: Windows 11 Pro 10.0.26300, NVIDIA GeForce RTX 3070 Ti (Ampere), driver 610.88 (Vulkan 1.4.341), WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON, Khronos validation layer 1.4.363 (LunarG SDK 1.4.363.0). The baseline is a Release build of main ded746ea12 in the same tree.

Tests: the description does not name its six tests, so I ran every draw-cache and data-hit test: agc_driver_draw_cache_* (20), agc_driver_draw_data_hit_user_words* (6), agc_driver_dispatch_data_hit_words (the PR touches DispatchCache.hpp) and agc_driver_address_draw_space_reuse_verify. That is 27 tests. They ran with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 and ctest -V -j1.

  • main: 27 of 27 pass. This PR: 27 of 27 pass.
  • The loader inserts VK_LAYER_KHRONOS_validation in every test, and no log contains was not found but was requested by env var VK_INSTANCE_LAYERS.
  • No VUID- messages on either side.
  • The PR was run twice more without the layer: 27 of 27 each time, so 3 of 3 runs passed.

Not covered: the new [draw-cache] validation misses (10 s) line. These tests finish before a 10 s report interval, so with APS5_TRACE_DRAW_CACHE=1 they print no report on either side. The run shows the change does not break the draw-cache paths on this GPU, but it does not check the new counters. No title was run, and the whole suite was not run.

AI-assisted: yes (Claude Code). I ran the tests; this summary was written from their logs.

@domx4q

domx4q commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Ran the draw-cache tests with the Khronos validation layer on Linux and an NVIDIA GPU, since CI runs the GPU tests only on lavapipe, the Tested section is on AMD and the NVIDIA run in the comments is 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 1eb68bccbb merged onto main fbaae8a79d with --no-ff (clean, as a0821bc9b6). Main baseline is a Release build of fbaae8a79d on the same machine.

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_(draw_cache_|draw_data_hit_user_words|dispatch_data_hit_words)' -V
main fbaae8a79d this PR
Result 26 of 26 passed 26 of 26 passed
Insert instance layer "VK_LAYER_KHRONOS_validation" 52 52
was not found but was requested by env var VK_INSTANCE_LAYERS 0 0
VUID- none none

The Tested section does not name its six tests, so this runs every draw-cache and data-hit test (26 here; the loader inserts the layer twice per test). Every device selected the RTX 4090. The change only adds miss-reason counters to the statistics, so there is no negative control.

No new VUID- errors; all focused tests pass on Ada.

AI-assisted: yes (Claude Code)

@github-actions

github-actions Bot commented Nov 20, 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 5609 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cpp
PR 6188 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCacheStatistics.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cpp
PR 7642 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cpp
PR 9508 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cpp
PR 10193 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cpp
PR 10359 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp
PR 11551 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cpp
PR 13928 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cpp
PR 13929 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cpp
PR 17056 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cpp
PR 20153 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cpp
PR 22434 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
PR 22647 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
PR 24661 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
PR 28586 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cpp
PR 28668 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cpp
PR 28808 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCacheStatistics.cpp

@kiwe147

kiwe147 commented Nov 21, 2026

Copy link
Copy Markdown

Tested head 1eb68bccbb, applied with git apply on main fd4aeed483 together with the other 27 PRs of one batch (#11049, #20072, #20406, #22100, #22892, #23774, #24199, #24495, #15314, #21180, #21221, #21486, #22597, #22839, #22895, #24672, #14573, #16873, #17113, #17879, #19183, #20057, #22066, #22219, #22781, #22958, #24478). All applied without conflicts and the whole tree built.

Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON. GPUs: NVIDIA GeForce RTX 3080 (driver 621.24) and the AMD Radeon iGPU of the CPU (gfx1036, driver 32.0.21036.18). No validation layer. iGPU run: ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ANYPS5_GPU="AMD Radeon", agc_/video tests only.

tests RTX 3080 iGPU
none: no test of its own in this PR - -

Whole batch: the full ctest -j 12 (6522 tests) on the RTX 3080 has 8 failing tests; the 4 that also fail on main fd4aeed483 are agc_driver_stencil_plane_memory, agc_driver_msaa_dcc_unwatch, agc_storage_write_back_host_retile, and pr_overlap_names, which needs a newer Python than my 3.10. Intermittent in this run (pass when rerun alone, or known flaky): agc_driver_store_over_untracked, agc_storage_write_back_host_retile. Traced to other PRs of the batch, each by reverting it and testing again: #21486 (agc_driver_graphics, agc_graphics_profile_draw), #24672 (guest_kernel_sys_neo_mode); none is in this PR's area. Failing tests I could not trace to a single PR (reverting the likely candidates did not clear them): guest_indexed_draw. The 2125 agc_/video tests on the iGPU have 5 failing: agc_driver_graphics, agc_driver_stencil_plane_memory, agc_driver_store_over_untracked, agc_graphics_profile_draw, agc_storage_write_back_host_retile (agc_driver_stencil_plane_memory also fails on main).

This is one combined tree, not a run of this PR alone.

AI-assisted: yes (Claude Code)

@JJenkx

JJenkx commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the Windows + NVIDIA run. The six tests the description refers to are agc_driver_draw_cache_reuse, agc_driver_draw_cache_reuse_verify, agc_driver_draw_cache_reuse_entry_verify, agc_driver_draw_data_hit_user_words, agc_driver_draw_data_hit_user_words_verify and agc_driver_draw_data_hit_user_words_table_keep (names from gpu-change/ctest.log in the linked bundle); all six are within your 27.

On the counters: as you note, the unit tests end before the first 10 s report, so the new line is only covered by the native PPSA06652 run in the description (22 report intervals, the six detailed counts summing to the existing gate count in every interval).

AI-assisted: yes

@JJenkx

JJenkx commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Windows follow-up on the failing windows check (run 44484732028, 2026-11-19, head 1eb68bccbb): nkwebkit_wtfcputime aborted with 0xc0000409.

It doesn't reproduce here:

  • this head merged onto current main bfb39f4f5a (7bd74b18ea, clean merge): nkwebkit_wtfcputime passes in each of 3 runs;
  • current main alone passes it, in a full non-device sweep at b5460b9e94 (4,576 of 4,576).

This PR changes how the AGC draw cache reports validation misses; the WTF CPU-time test doesn't touch that code. So the failure looks like runner timing, inferred from not reproducing it. Re-running the windows check would refresh the status.

Setup: Windows 11 Enterprise 22621, AMD Ryzen 9 5950X, WinLibs GCC 15.2 UCRT r7, Release.

AI-assisted: yes.

@ligmaSec ligmaSec 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.

The counters use the same selected layout-compatible candidate as the existing gate miss, and the interval reset clears both sets together. Please add a report assertion that the six reasons sum to gate for a controlled interval. That would pin the public log behavior without requiring a second validation walk. The existing draw-cache fixture is queued on lavapipe.

AI-assisted: yes.

@oneandonlydean
oneandonlydean merged commit eacdbaa into boykopovar:main Dec 4, 2026
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants