Skip to content

fix(agc): verify refreshed draw stage data - #8372

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
JJenkx:fix/agc-verify-refreshed-stage-data
Oct 23, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
JJenkx:fix/agc-verify-refreshed-stage-data

Conversation

@JJenkx

@JJenkx JJenkx commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

What

With APS5_VERIFY_DRAW_ENTRIES=1, a draw-cache hit whose constant data changes can report a stage mismatch even when the refreshed data is correct. lookupDraw puts the refreshed words and compiled result in StageDataHit, but the verifier compares the original cached variant against a fresh capture.

Pass the effective stage data to the verifier and compare the refreshed words and compilation when present. Keep both content and forwarded-word comparisons. The ordinary rendering path is unchanged.

Add a Vulkan regression that caches a constant-color draw, changes the constant from 0.25 to 1.0, requires a verified stage-data hit with no new mismatch, and checks the rendered bytes change from 64 to 255.

Overlap review: this is independent of #5609 and #6539, whose relocation work also edits the verification condition; those branches will need to retain this effective-data selection when rebasing. #6188 changes cache admission and verification too. None implements this refreshed-stage-data regression/fix. The test's Windows PATH setup is separate from the list edited by #5656.

Tested

Linux, AMD Radeon RX 6650 XT, RADV Mesa 26.2.4-arch1.1, Arch Linux. Built agc_driver_draw_cache_reuse_tests in Release with BUILD_TESTING=ON and ANYPS5_AGC_EXECUTION_TESTS=DrawCacheReuse.

Matched main b9a097353cc387d643a810594ed8dd60601109bb with this PR's test/CMake changes only, against main plus the implementation change, on the same machine/GPU:

ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 \
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
ctest --test-dir build-full -R '^agc_driver_draw_cache_reuse' -V --timeout 60

Both runs explicitly selected the RADV ICD and the installed validation-layer paths. Main: four existing tests pass; the new agc_driver_draw_cache_reuse_entry_verify fails with draw-entry verification: refreshed stage data differed from a fresh capture. Candidate: all five pass (2.90 seconds total), including refreshed-color GPU readback. Neither log has VUID-, a missing-layer warning, or a skipped test. python3 tools/check_conventions.py --base origin/main passes.

No performance or title-bring-up claim. Windows was not tested locally; the new test has the same DLL PATH setup as the existing Vulkan tests.

Independent Windows validation by @xXPBSXx (report), at this exact head bd017bc3ab, on Windows 10 Pro 10.0.19045, Ryzen 7 5800X3D, NVIDIA RTX 4080 SUPER, WinLibs GCC 15.2.0 (MinGW-w64 UCRT), Release: all five agc_driver_draw_cache_reuse tests pass three times each. With only the three production driver files restored from merge base b9a097353c, retaining this PR's test/CMake changes, the new _entry_verify test fails three times with the refreshed-stage-data mismatch; the other four pass. The contributor restored the PR sources afterward. This is attributed contributor evidence: no title, full-suite or other-GPU coverage was reported, and the report does not establish Khronos validation-layer coverage on Windows.

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: AMD Radeon RX 6650 XT; RADV Mesa 26.2.4-arch1.1; Arch Linux. Independent contributor @xXPBSXx: NVIDIA RTX 4080 SUPER, Windows 10 Pro, exact head bd017bc3ab; see attributed limitations above.
  • AI-assisted: yes

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 9243 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cpp L155-156
core/libs/prx/libSceAgcDriver/tests/execution/DrawCacheReuse.cpp L242-245
PR 9248 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cpp L155-156
core/libs/prx/libSceAgcDriver/tests/execution/DrawCacheReuse.cpp L242-245

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 1368 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 1395 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 1896 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
PR 2434 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5021 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5371 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5431 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cpp
PR 5441 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
PR 5609 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cpp
PR 5925 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
PR 6044 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6186 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6187 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6188 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cpp
core/libs/prx/libSceAgcDriver/tests/execution/DrawCacheReuse.cpp
PR 6192 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6209 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6280 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6300 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6412 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6481 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6501 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 6539 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cpp
PR 6642 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6788 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6804 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
PR 6808 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6820 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6868 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6973 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6987 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6989 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6995 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7002 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7048 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7201 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cpp
PR 7275 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 7307 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 7369 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
PR 7457 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7604 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7642 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cpp
PR 7677 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7705 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7833 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8014 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8246 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8365 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8484 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8542 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8552 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8564 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8592 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8740 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 8999 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9020 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9129 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 9335 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
PR 9387 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cpp
PR 9508 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cpp
PR 9521 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9700 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9748 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9892 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9897 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9898 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
PR 10000 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10064 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10193 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cpp

@github-actions github-actions Bot added build agc libSceAgc* labels Oct 20, 2026
@xXPBSXx

xXPBSXx commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Independent Windows run of this PR with a baseline (data only).

Environment: Windows 10 Pro 10.0.19045, Ryzen 7 5800X3D, NVIDIA GeForce RTX 4080 SUPER (the log shows Selected GPU name=NVIDIA GeForce RTX 4080 SUPER vendor=0x10de device=0x2702 subgroup=32, picked with ANYPS5_GPU=4080), WinLibs GCC 15.2.0 (MinGW-w64 UCRT), Release. PR head bd017bc3ab; merge-tree against main is clean. I built agc_driver_draw_cache_reuse_tests; ctest -R '^agc_driver_draw_cache_reuse' lists five tests (agc_driver_draw_cache_reuse, _off, _verify, _entry_verify, _inline).

Results (3 runs each):

  • PR head: all five tests pass 3/3.
  • Baseline: I kept the PR's tests/execution/DrawCacheReuse.cpp and CMakeLists.txt and replaced only Execution/include/Driver/Driver.hpp, Execution/src/Driver/Draw/Draw.cpp and Execution/src/Driver/Draw/DrawCapture.cpp with their versions from the merge base b9a097353c, then rebuilt. agc_driver_draw_cache_reuse_entry_verify fails 3/3 with [draw-cache] verify: stage 1 (...) of a hit captured differently: 1 runs / 1 words matched, 1 / 1 fresh and AGC graphics: draw-entry verification: refreshed stage data differed from a fresh capture; the other four pass. I restored the PR's sources afterwards.

Not run: other GPUs (I did not run an AMD card for this PR), other platforms, the other tests, the full repository CTest, and any title or console run.

AI-assisted (Claude Code).

@JJenkx

JJenkx commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

Refreshed against current main.

Head: df421d52bc, rebased onto 0db47b263d. The previous head was bd017bc3ab.

Conflict: main had gained a shapeNeedsEntry argument on cacheDrawStages, from the shape-refresh admission path. I kept main's refresh logic and added this PR's stageData parameter beside it. The signature in Driver.hpp and DrawCapture.cpp, and the call in Draw.cpp, now carry both arguments. The verify change itself is unchanged.

Checks:

  • git diff --check and tools/check_conventions.py --base origin/main --head HEAD pass.
  • Windows Release with WinLibs GCC 15.2.0 UCRT on an RX 6700 XT (AMD 26.10.1).
  • VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1.
  • ctest -V -R '^agc_driver_draw_cache_reuse', three runs: all six entries pass each time. Those are draw_cache_reuse, _draw_pipeline, _off, _verify, _entry_verify and _inline. No VUID- messages; the layer loaded.

@JJenkx
JJenkx force-pushed the fix/agc-verify-refreshed-stage-data branch from bd017bc to df421d5 Compare October 23, 2026 07:33
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 23, 2026
@adriadam10 adriadam10 self-assigned this Oct 23, 2026
@adriadam10
adriadam10 merged commit 65ac1d3 into boykopovar:main Oct 23, 2026
10 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Re-reviewed on the rebased head df421d52b (main 4883171f9). Checked: stageData is sized to programs.size() before lookupDraw, so the index in cacheDrawStages is in range; the verifier compares the refreshed words and compiled result when present and keeps the content and forwarded-word comparisons; the shapeNeedsEntry conflict with main is resolved in Driver.hpp, DrawCapture.cpp and the Draw.cpp call. The new _entry_verify test pins the verified stage-data hit and 64 → 255 readback, and fails on main per the Windows runs reported above. Merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants