Skip to content

perf(agc): keep read-only stencil binds clean - #15067

Merged
oneandonlydean merged 5 commits into
boykopovar:mainfrom
lgqdaxia:codex/quarry-stencil-write-intent-20261102
Nov 3, 2026
Merged

oneandonlydean merged 5 commits into
boykopovar:mainfrom
lgqdaxia:codex/quarry-stencil-write-intent-20261102

Conversation

@lgqdaxia

@lgqdaxia lgqdaxia commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

What

Supersedes closed draft #14843, which was closed by the earlier PR limit. The earlier PR retains its historical discussion and evidence.

Avoid marking a successfully stored stencil plane dirty when a draw cannot write stencil. Pass explicit stencil write intent through both draw paths via DepthSurfaceViewWithStencilWriteIntent, retaining the existing four-parameter entry point and its conservative behavior. A possible write requires stencil testing plus a face with a nonzero write mask and a non-KEEP fail, pass or depth-fail operation. Reuse that predicate for native depth writer accounting.

Preserve real clear publication: MarkStencilStale records both dirty state and range; NoteHtileClear and NotePlaneFill call it when a stencil clear is queued. That state survives a clear being applied by sampling or a depth-only flush before a read-only rebind. View binding still marks writes, new surfaces and stencil-owner changes; it does not clear pending dirty state.

The existing StencilPlaneMemory fixture adds two consumed-clear preservation controls before the three stencil-disabled/KEEP/zero-mask cases. Existing real-write and retirement checks remain. This follow-up reports all three read-only outcomes before failing, so the control reaches KEEP and zero-mask after the stencil-off failure. The existing multisample depth fixture also checks the tested-but-not-written path. No target or test registration is added. This builds on #12210; the storage-image work in #12617 and BDA lease work in #10382 are separate.

The stencilTested contract in #9533, #9717, #9742, #13021 and #13023 is distinct from stencilWritten. Real storage-image writes from #12617 must still mark stencil dirty; these combinations have not been runtime-tested.

Related open PR #14969 protects a later guest write from stale-stencil publication. It still marks mirrorable stencil stale on each bind, so it does not remove this report's redundant read-only publication when guest memory has not changed. It edits the same dirty-marking block; combining the changes must retain its snapshot/generation handling at the appropriate stale transitions as well as this PR's clear preservation. No combined build or runtime test, merge order agreement or integration resolution is claimed.

The earlier PR retains the historical title-screen capture. Neither that sample nor the current capture establishes a causal speedup or gameplay FPS benefit.

Tested

Follow-up 157352f989272fecfdbd9ac395216c9f1535339d changes only StencilPlaneMemory.cpp; production code and the published native new-interface tests are unchanged. NativeMultisampleDepth.cpp keeps both direct DepthSurfaceViewWithStencilWriteIntent assertions with depthWritten=true. Those contract checks are built on the PR; the old-main regression is the independently buildable stencil fixture.

Windows 11 (10.0.26200), WinLibs GCC 15.2.0 r7, NVIDIA GeForce RTX 3080 Laptop GPU / NVIDIA 610.74. Using two isolated BUILD_TESTING=ON Ninja configurations, rebuilt the same final StencilPlaneMemory.cpp against main 0278ca983148dbb9b8b54a267b2aeab0ce8aff37 and the PR. The main control builds only agc_driver_stencil_plane_memory_tests; the candidate builds that fixture, the native multisample fixture and the four depth-plane neighbors.

Read-only case Main standalone control PR
stencil off incorrectly dirties the stored plane keeps it clean
all operations KEEP, nonzero write mask incorrectly dirties the stored plane keeps it clean
REPLACE with zero write mask incorrectly dirties the stored plane keeps it clean

An earlier binary-swap control already failed at stencil-off. The fresh source-built control now reaches all three cases, then fails naturally at the final read-only assertion (fixture exit 1 / CTest exit 8). Each draw checks coverage and preserved stencil bytes; the consumed-clear and real-write/retirement controls remain. The same stencil fixture passes on the PR.

The candidate's nine focused CTests pass 9/9, including the original native new-API checks; the native alias group reports 33 cases, unavailable=0. The main control runs one selected CTest, which fails as expected. No claim is made that the new-interface native fixture compiles or was run against main after removing its API.

Both selected runs required Vulkan and disabled the shader cache, with the Khronos layer actually inserted. Neither final log contains VUID-, SYNC-HAZARD or a CTest skip. PID/creation-time, fixture path/hash and loaded AGC/libc module paths/hashes were sampled for all 10 selected fixture processes across the two arms and matched their isolated builds. The installed Epic overlay manifests still name absent files; the logs are not warning-free.

Both full configurations pass the registration audit: 1,801 test executables, none built-but-unregistered. The candidate's conditional guest stencil-write and depth-buffer-write portions were not exercised because write-watch was unavailable. Dependency-junction Git-version/dirty lookup remains unknown, not a clean-tree trace claim. No full product build, full suite, new-head Linux/other-GPU run, current-main integrated GPU run or #14969 combination is claimed. Earlier contributor GPU reports and the performance captures below remain scoped to ffac833; no new speed or gameplay claim is made.

Standalone negative-control reproduction

Start with this PR checked out and a configured BUILD_TESTING=ON build. In PowerShell, restore only the three production files from the tested main, then select the standalone target:

git restore --source=0278ca983148dbb9b8b54a267b2aeab0ce8aff37 -- core/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hpp core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
cmake --build build --target agc_driver_stencil_plane_memory_tests
$env:ANYPS5_REQUIRE_VULKAN = "1"
$env:ANYPS5_NO_SHADER_CACHE = "1"
$env:VK_INSTANCE_LAYERS = "VK_LAYER_KHRONOS_validation"
ctest --test-dir build -R '^agc_driver_stencil_plane_memory$' -V --no-tests=error

This keeps the final regression source unchanged. The native new-interface checks are separate from this selected old-main control. Use separate checkouts/builds when keeping the main and PR results side by side.

Current performance evidence

The Quarry (PPSA05813, 01.000.007), idle initial title screen, native output 3840×2160, RTX 3080 Laptop GPU, NVIDIA 610.74, i7-12700H, Windows 10.0.26200. Baseline 0278ca983148dbb9b8b54a267b2aeab0ce8aff37; candidate ffac833ecceace62e5fd4db4f11755072e0e86dc. Both native summaries report dirty: false and exactly 120 presents at frames 3400:120 with no recorded trace drops. Builds used the same incrementally reconstructed SDK and separately built AGC libraries; the revision generator ignored submodule status while the 26 linked dependency revisions and tracked changes were separately audited. Nested submodules and untracked files were not included in that audit.

Both runs were independently warmed and restarted, with separate writable shader caches and private save seeds. At warm-stop baseline had 478 cache files / 162553674 bytes; candidate had 480 / 163331329 bytes. The same renderer export harness (32 BMPs every 100 presents, scale 4) was used in both runs. Frame 031 in each shows the same initial red-logo title and has SHA-256 8b2b4b58ba71f7bef0c17d4e789c17f50fbb8324e101f3ecb70dbc24bd0d4a89. The observer recorded stable 32-file snapshots before the ROI and verified they were unchanged after capture; baseline last observed VideoOut present 3210 (age 0.148 s) and candidate 3180 (age 2.083 s). Both captures use the single-window Present/VideoOut relationship; renderer export harness overhead is common but not proven zero. No game input was sent.

Strict upstream context comparison succeeded. Window duration: 8101.854 ms baseline vs 8246.047 ms candidate; frame p50 66.009 vs 68.634 ms, p90 72.133 vs 71.218 ms, p99 95.347 vs 74.426 ms. This is one pair, not a statistically supported performance conclusion. Warm caches were independent, not byte-identical. Sparse pre-ROI readings showed baseline at 86°C / 1605 MHz with software thermal slowdown active; candidate readings were 83°C / 1740 MHz, 86°C / 1560 MHz, and 87°C / 1635 MHz, each with software/hardware thermal slowdown not active. These samples do not characterize the entire ROI, and thermal/clock equivalence was not established.

App and AGC paths/hashes were verified from sampled loaded-module records. Baseline had 12 successful module snapshots; candidate had 11 successful snapshots and its first at 0.016 s returned Windows error 299. A separate verifier copy records the error and retains the original identity/hash assertions. The 5–55 s successful samples do not prove modules loaded outside that interval. Actual full inherited environment and scene equivalence inside the ROI also have not been exhaustively verified.

Native summaries (unedited JSONL records)

Baseline:

{"commit":"0278ca983148","dirty":false,"env":{"APS5_DRAIN_COMPLETION_LABELS":"1","APS5_DUMP_FRAMES":"32","APS5_DUMP_FRAMES_EVERY":"100","APS5_DUMP_SCALE":"4","APS5_LAZY_SHADER_PREPARE":"1","APS5_LOG_TIMESTAMPS":"1","APS5_NO_GPL":"1","APS5_NO_LIBRARY_PREBUILD":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINE_JOURNAL_THREADS":"2","APS5_PLAYGO_UNLISTED_CHUNKS":"absent","APS5_TRACE_DIR":"<path>","APS5_TRACE_FRAMES":"3400:120","APS5_VIDEOOUT_TELEMETRY_DIR":"<path>"},"gpu":"NVIDIA GeForce RTX 3080 Laptop GPU","driver":"NVIDIA 610.74","os":"Windows 10.0.26200","cpu":"12th Gen Intel(R) Core(TM) i7-12700H","cpu_threads":20,"memory_mib":32472,"title_id":"PPSA05813","title":"The Quarry","content_version":"01.000.007","resolution":"3840x2160","window":{"spec":"frames 3400:120","first_present":3400,"ms":8101.854},"presents":120,"frame_ms":{"p50":66.009,"p90":72.133,"p99":95.347,"max":107.715},"gpu_busy_ms_per_present":62.585,"worker_busy_pct":{"queue worker 0x0":98.193,"queue worker 0x20":99.248},"top_phases_ms_per_frame":{"Driver.Packet":133.143,"Driver.Packet.memory_wait":60.887,"Driver.Packet.dispatch":32.202,"Driver.Dispatch":27.007,"Graphics.Draw":21.740,"Vulkan.Dispatch":20.387,"Vulkan.Dispatch.shader_resources":19.508,"Driver.Packet.pipeline_drain":18.614},"trace_dropped":false,"trace":"aps5-trace-0278ca983148-26276.json.gz"}

Candidate:

{"commit":"ffac833eccea","dirty":false,"env":{"APS5_DRAIN_COMPLETION_LABELS":"1","APS5_DUMP_FRAMES":"32","APS5_DUMP_FRAMES_EVERY":"100","APS5_DUMP_SCALE":"4","APS5_LAZY_SHADER_PREPARE":"1","APS5_LOG_TIMESTAMPS":"1","APS5_NO_GPL":"1","APS5_NO_LIBRARY_PREBUILD":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINE_JOURNAL_THREADS":"2","APS5_PLAYGO_UNLISTED_CHUNKS":"absent","APS5_TRACE_DIR":"<path>","APS5_TRACE_FRAMES":"3400:120","APS5_VIDEOOUT_TELEMETRY_DIR":"<path>"},"gpu":"NVIDIA GeForce RTX 3080 Laptop GPU","driver":"NVIDIA 610.74","os":"Windows 10.0.26200","cpu":"12th Gen Intel(R) Core(TM) i7-12700H","cpu_threads":20,"memory_mib":32472,"title_id":"PPSA05813","title":"The Quarry","content_version":"01.000.007","resolution":"3840x2160","window":{"spec":"frames 3400:120","first_present":3400,"ms":8246.047},"presents":120,"frame_ms":{"p50":68.634,"p90":71.218,"p99":74.426,"max":74.553},"gpu_busy_ms_per_present":64.965,"worker_busy_pct":{"queue worker 0x0":98.164,"queue worker 0x20":99.237},"top_phases_ms_per_frame":{"Driver.Packet":135.488,"Driver.Packet.memory_wait":62.483,"Driver.Packet.dispatch":33.474,"Driver.Dispatch":28.081,"Vulkan.Dispatch":21.358,"Graphics.Draw":20.948,"Vulkan.Dispatch.shader_resources":20.410,"Driver.Packet.pipeline_drain":18.313},"trace_dropped":false,"trace":"aps5-trace-ffac833eccea-26548.json.gz"}
Native trace assets

The linked traces are unmodified native outputs.

Static integration check: main 7feb37ee3e30e10139b483fb4df689d5b5b69ab8 merges cleanly with 157352f989272fecfdbd9ac395216c9f1535339d (merged tree 2286c66ae6183340cad33201d81ad15a52f8a619). Shared files have changed since the tested base; this merged tree was not built or runtime-tested. Results above remain scoped to the exact tested base and candidate.

Checklist

  • Based on tested main snapshot 0278ca983148; bounded deduplication found no same-root fix (related work listed above)
  • 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 perf(agc): read-only stencil binds trigger redundant publication #14842
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 3080 Laptop GPU, NVIDIA 610.74, Windows 11 (10.0.26200)
  • AI-assisted: yes

@github-actions github-actions Bot added perf Performance change agc libSceAgc* labels Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 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 13021 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp L3068-3069, L3837-3838
PR 13023 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp L3068-3069, L3837-3838
PR 14969 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp L2544-2548

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/Graphics/include/DepthSurface.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 1395 core/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 5609 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 5925 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6188 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6808 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cpp
PR 7085 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 7256 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 7275 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 7449 core/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
PR 7642 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 7668 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 8246 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9020 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9335 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9356 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9387 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9672 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
PR 9712 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9748 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9852 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9895 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
PR 9897 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9915 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9950 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cpp
PR 10193 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 10249 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
PR 10256 core/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
PR 10442 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 10920 core/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cpp
PR 11444 core/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
PR 11452 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 11825 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 11998 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
PR 12120 core/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
PR 12125 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 13148 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 13863 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 13920 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 13928 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 13929 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 14005 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
core/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cpp
PR 14032 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 14344 core/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
PR 14943 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 14944 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 15059 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp

@github-actions github-actions Bot added the fix error Closes an issue (Fixes #N) label Nov 2, 2026

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

Windows 11, AMD Radeon RX 9070 XT (RDNA 4), driver 32.0.32015.7029, WinLibs GCC, BUILD_TESTING=ON, PR merged into current main, with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_REQUIRE_VULKAN=1 and ANYPS5_NO_SHADER_CACHE=1.

  • agc_driver_stencil_plane_memory and the agc_driver_native_multisample_depth/agc_driver_native_depth_* set pass (12 pass, _driver_queued_fill skips here), with 0 VUIDs. (agc_driver_native_depth_bda_clear showed as Not Run only because I didn't build its executable.)
  • I couldn't get a negative control. With main's DepthSurface.{hpp,cpp} and Draw.cpp restored, the fixtures don't compile, because NativeMultisampleDepth.cpp calls the new DepthSurfaceViewWithStencilWriteIntent. So these runs show the PR doesn't break the existing cases on RDNA 4, but not that the new cases would fail without it.

If the KEEP/zero-mask/stencil-off checks could go through an entry point that exists on main too (or be split so one test compiles against both), the regression would be demonstrable. Leaving this as a comment for that reason; the logic of the write-intent predicate looks right to me.

@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head ffac833 merged onto main 1d91f29 · tested 2026-11-02 19:55 UTC · 24 min

GPU NVIDIA RTX 2000 Ada Generation, driver 595.99.02, Vulkan 1.4.329
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-38-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 2,618 passed · 4 failed (0 new, 2 also fail on main, 2 unstable on main) · 44 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 2,666 of 3,544 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (981 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_pipeline_journal 120.1 s, ⚠️ agc_driver_graphics_maps_fallback 30.2 s, ⚠️ agc_driver_native_depth_clears 30.1 s, ⚠️ agc_driver_graphics 30.1 s
Unstable on main (2, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_job_manager_compute_capacity: failed in 1 of the last 10 main runs
agc_driver_pipeline_journal: failed in 3 of the last 10 main runs
Failing on main too (2, not counted against this PR)
agc_driver_image_table
guest_socket_options_multicast
Passed on retry (1, failed in the parallel run, passed when re-run with a 360 s timeout; not counted against this PR)
agc_driver_native_depth_clears: Timeout in the parallel run; also passed only on retry in 15 other runs in the last 7 days
Validation IDs already present on main (4 IDs in 510 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (510 tests): agc_driver, agc_driver_address_passes, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_array_layer_target, agc_driver_bc_block_copy, agc_driver_bda_anchor_reads, agc_driver_bda_span_reads, and 502 more
VUID-vkCmdCopyImage-srcImage-01548 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-vkCmdCopyImage-srcImage-01551 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (1 test): agc_driver_prepared_exports
Skipped (44)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_sample_order_grid_reference: skipped, the device does not keep depth drawn at custom sample locations at those locations, even after a transition that names them: the composite of uniform renders holds the guest's depth in 0 of 3005 sloped samples, so no path can be compared with it bit for bit
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
guest_http_uri_locale: 
guest_video_out_color_space: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_hdr: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_high_frame_rate: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_output_mode: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_resolution_status: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_wqhd_detection: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
video_out_flip_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_backtoback: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_controls: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip_in_order: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_dcc: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_deferred: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop_main: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_fps_limit: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_fresh: skipped, no display or Vulkan device: 
Reproduce
git fetch origin ffac833ecceace62e5fd4db4f11755072e0e86dc 1d91f2966d0eef82a021628a7aa8e78e615ac807
git checkout 1d91f2966d0eef82a021628a7aa8e78e615ac807 && git merge --no-ff ffac833ecceace62e5fd4db4f11755072e0e86dc
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 32 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 4 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

@lgqdaxia

lgqdaxia commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

@BunnyFl Thanks for checking this on RDNA 4. I have kept the direct new-interface checks and made the standalone old-main regression easier to reproduce.

Updated locally in 157352f989272fecfdbd9ac395216c9f1535339d: only StencilPlaneMemory.cpp changes. It now reports stencil-off, KEEP and zero-mask before failing, instead of stopping at the first failure. The earlier binary-swap control already showed the stencil-off failure; the new source-built control reaches all three.

For the main control, restore the three production files from 0278ca983148dbb9b8b54a267b2aeab0ce8aff37, build only agc_driver_stencil_plane_memory_tests, then run ctest --test-dir build -R '^agc_driver_stencil_plane_memory$' -V --no-tests=error with required Vulkan, no shader cache and Khronos validation. The PR body includes the full commands. NativeMultisampleDepth retains its original new-API assertions, including depthWritten=true; they are tested on the candidate and are separate from that control.

With the same stencil regression source, main reports all three cases as incorrectly dirty and then fails naturally; the PR keeps all three clean. The candidate also passes the nine focused CTests, including all 33 native alias cases. Both selected runs actually loaded Khronos and had no VUIDs, sync hazards or CTest skips. The two candidate write-watch portions remain unexercised. These are exact-base Windows results, not a latest-main, full-suite or performance claim.

AI-assisted: yes

@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head 157352f merged onto main 9090972 · tested 2026-11-03 01:41 UTC · 32 min

GPU NVIDIA RTX 2000 Ada Generation, driver 595.99.02, Vulkan 1.4.329
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-38-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 2,624 passed · 5 failed (0 new, 2 also fail on main, 3 unstable on main) · 44 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 2,673 of 3,607 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (967 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_pipeline_journal 120.1 s, ⚠️ agc_driver_lookup_log_fits_build 30.9 s, ⚠️ agc_driver_graphics_maps_fallback 30.8 s
Unstable on main (3, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_pipeline_journal: failed in 3 of the last 10 main runs
agc_submit_progress: failed in 7 of the last 10 main runs
agc_submit_progress_no_timeline: failed in 6 of the last 10 main runs
Failing on main too (2, not counted against this PR)
agc_driver_image_table
guest_socket_options_multicast
Validation IDs already present on main (4 IDs in 517 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (517 tests): agc_driver, agc_driver_address_passes, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_array_layer_target, agc_driver_bc_block_copy, agc_driver_bda_anchor_reads, agc_driver_bda_span_reads, and 509 more
VUID-vkCmdCopyImage-srcImage-01548 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-vkCmdCopyImage-srcImage-01551 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (1 test): agc_driver_prepared_exports
Skipped (44)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_sample_order_grid_reference: skipped, the device does not keep depth drawn at custom sample locations at those locations, even after a transition that names them: the composite of uniform renders holds the guest's depth in 0 of 3005 sloped samples, so no path can be compared with it bit for bit
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
guest_http_uri_locale: 
guest_video_out_color_space: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_hdr: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_high_frame_rate: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_output_mode: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_resolution_status: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_wqhd_detection: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
video_out_flip_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_backtoback: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_controls: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip_in_order: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_dcc: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_deferred: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop_main: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_fps_limit: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_fresh: skipped, no display or Vulkan device: 
Reproduce
git fetch origin 157352f989272fecfdbd9ac395216c9f1535339d 9090972b7e91fd266819cbd77a8b058e177b5682
git checkout 9090972b7e91fd266819cbd77a8b058e177b5682 && git merge --no-ff 157352f989272fecfdbd9ac395216c9f1535339d
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 32 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 4 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

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

Re-review of 157352f989: the negative control I couldn't get now works the way you describe. The only change since my comment is StencilPlaneMemory.cpp.

Windows 11, AMD RX 9070 XT (RDNA 4), WinLibs GCC, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1, merged onto current main, building only agc_driver_stencil_plane_memory_tests:

  • PR: agc_driver_stencil_plane_memory passes. stencil-off, all-KEEP and zero-mask each print "kept the stored stencil plane clean".
  • Main's DepthSurface.hpp, DepthSurface.cpp and Draw.cpp restored: it fails. All three print "dirtied the stored stencil plane", then "read-only stencil draws dirtied the stored plane".

VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation was set, but this run's log has no line from the layer. I make no VUID claim for it. git diff --stat ffac833ecc 157352f989 lists only core/libs/prx/libSceAgcDriver/tests/execution/StencilPlaneMemory.cpp; the NativeMultisampleDepth results are from my earlier run.

@TechLevelZero

Copy link
Copy Markdown
Contributor

❌ AMD GPU test: failed

PR head 157352f merged onto main a4eca2a · tested 2026-11-03 01:56 UTC · 47 min

GPU AMD Radeon RX 6300 (RADV NAVI24), driver Mesa 25.2.8-0ubuntu0.24.04.4, Vulkan 1.4.318
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-42-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ❌ 2,592 passed · 14 failed (1 new: 1 not compared, 12 also fail on main, 1 unstable on main) · 56 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 2,662 of 3,591 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (974 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_graphics 120.3 s, ⚠️ agc_driver_graphics_maps_fallback 120.3 s, ⚠️ agc_driver_pipeline_journal 120.1 s, ⚠️ public_headers 90.2 s, ⚠️ agc_driver_image_sample_unnormalized 83.1 s

Failing tests

This PR changes test files, so each failing test was also built and run on main with only the PR's test changes applied. ✅ there means the failure comes from the PR's other changes; ❌ means the test fails on main too, so this run does not show the PR caused it.

Test With this PR Same test on main a4eca2a (main + this PR's test changes only)
guest_pthread_start ❌ failed not compared: the PR's tests do not build without its other changes
guest_pthread_start: Timeout (also failed when re-run alone), assertion and diagnostics
ctest: Timeout


Unstable on main (1, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_pipeline_journal: failed in 4 of the last 6 main runs
Failing on main too (12, not counted against this PR)
agc_driver_guest_memory_lifetime_direct
agc_driver_image_table
agc_driver_job_manager_compute_capacity
agc_driver_native_depth_bda_clear
agc_driver_native_depth_buffer_clear
agc_driver_native_depth_clears
agc_driver_native_multisample_depth
agc_idle_publish_wait
agc_submit_progress
agc_submit_progress_no_timeline
guest_mmap_executable
guest_socket_options_multicast
Passed on retry (7, failed in the parallel run, passed when re-run with a 360 s timeout; not counted against this PR)
agc_driver_emulated_color_compare: Timeout in the parallel run; also passed only on retry in 19 other runs in the last 7 days
agc_driver_graphics: Timeout in the parallel run; also passed only on retry in 54 other runs in the last 7 days
agc_driver_graphics_maps_fallback: Timeout in the parallel run; also passed only on retry in 64 other runs in the last 7 days
agc_driver_recorder: Timeout in the parallel run; also passed only on retry in 4 other runs in the last 7 days
public_headers: Timeout in the parallel run; also passed only on retry in 3 other runs in the last 7 days
trace_digest_TraceDigestTests_test_cli_rejects_invalid_event_fields_without_partial_output: Timeout in the parallel run; also passed only on retry in 21 other runs in the last 7 days
vulkan_validation_gate_integration: Failed in the parallel run
Validated but not compared (6, not in the main baseline's validation pass)
guest_pthread_start
public_headers
public_headers_compile_14
public_headers_compile_29
public_headers_compile_58
trace_digest_TraceDigestTests_test_cli_rejects_invalid_event_fields_without_partial_output
Validation IDs already present on main (4 IDs in 509 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (509 tests): agc_driver, agc_driver_address_passes, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_array_layer_target, agc_driver_bc_block_copy, agc_driver_bda_anchor_reads, agc_driver_bda_span_reads, and 501 more
VUID-vkCmdCopyImage-srcImage-01548 (6 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-vkCmdCopyImage-srcImage-01551 (6 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (1 test): agc_driver_prepared_exports
Skipped (56)
usage: check_skips.py [-h] [--job {linux,windows}] [--list] [--require-tests]
                      junit
check_skips.py: error: /home/ben/anyps5-gpu-ci/data/runs/pr-15067/157352f98927-a4eca2a056bf/ctest.xml: testcase 'public_headers_compile_14' is notrun and was not run
Reproduce
git fetch origin 157352f989272fecfdbd9ac395216c9f1535339d a4eca2a056bf3bbbec98ab42e9d28163e4ea9cb8
git checkout a4eca2a056bf3bbbec98ab42e9d28163e4ea9cb8 && git merge --no-ff 157352f989272fecfdbd9ac395216c9f1535339d
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 12 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 16 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1
# the failing tests, on this merge and on main:
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(guest_pthread_start)$' --parallel 1 -V

Automated build and test on a contributor's AMD machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

@oneandonlydean oneandonlydean self-assigned this Nov 3, 2026
@oneandonlydean
oneandonlydean merged commit 6674988 into boykopovar:main Nov 3, 2026
13 of 14 checks passed
@lgqdaxia
lgqdaxia deleted the codex/quarry-stencil-write-intent-20261102 branch November 28, 2026 17:31
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) perf Performance change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf(agc): read-only stencil binds trigger redundant publication

4 participants