Repository navigation
perf(agc): keep read-only stencil binds clean - #15067
oneandonlydean merged 5 commits into
Conversation
|
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.
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.
|
BunnyFl
left a comment
There was a problem hiding this comment.
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_memoryand theagc_driver_native_multisample_depth/agc_driver_native_depth_*set pass (12 pass,_driver_queued_fillskips here), with 0 VUIDs. (agc_driver_native_depth_bda_clearshowed as Not Run only because I didn't build its executable.)- I couldn't get a negative control. With
main'sDepthSurface.{hpp,cpp}andDraw.cpprestored, the fixtures don't compile, becauseNativeMultisampleDepth.cppcalls the newDepthSurfaceViewWithStencilWriteIntent. 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.
✅ NVIDIA GPU test: passedPR head
Unstable on main (2, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (2, not counted against this PR)Passed on retry (1, failed in the parallel run, passed when re-run with a 360 s timeout; not counted against this PR)Validation IDs already present on main (4 IDs in 510 tests)Skipped (44)ReproduceAutomated 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 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 For the main control, restore the three production files from 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 |
✅ NVIDIA GPU test: passedPR head
Unstable on main (3, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (2, not counted against this PR)Validation IDs already present on main (4 IDs in 517 tests)Skipped (44)ReproduceAutomated 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
left a comment
There was a problem hiding this comment.
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_memorypasses. stencil-off, all-KEEP and zero-mask each print "kept the stored stencil plane clean". - Main's
DepthSurface.hpp,DepthSurface.cppandDraw.cpprestored: 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.
❌ AMD GPU test: failedPR head
Failing testsThis 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.
guest_pthread_start: Timeout (also failed when re-run alone), assertion and diagnosticsUnstable on main (1, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (12, not counted against this PR)Passed on retry (7, failed in the parallel run, passed when re-run with a 360 s timeout; not counted against this PR)Validated but not compared (6, not in the main baseline's validation pass)Validation IDs already present on main (4 IDs in 509 tests)Skipped (56)ReproduceAutomated 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. |
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:
MarkStencilStalerecords both dirty state and range;NoteHtileClearandNotePlaneFillcall 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
StencilPlaneMemoryfixture 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
stencilTestedcontract in #9533, #9717, #9742, #13021 and #13023 is distinct fromstencilWritten. 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
157352f989272fecfdbd9ac395216c9f1535339dchanges onlyStencilPlaneMemory.cpp; production code and the published native new-interface tests are unchanged.NativeMultisampleDepth.cppkeeps both directDepthSurfaceViewWithStencilWriteIntentassertions withdepthWritten=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=ONNinja configurations, rebuilt the same finalStencilPlaneMemory.cppagainst main0278ca983148dbb9b8b54a267b2aeab0ce8aff37and the PR. The main control builds onlyagc_driver_stencil_plane_memory_tests; the candidate builds that fixture, the native multisample fixture and the four depth-plane neighbors.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-HAZARDor 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=ONbuild. In PowerShell, restore only the three production files from the tested main, then select the standalone target: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; candidateffac833ecceace62e5fd4db4f11755072e0e86dc. Both native summaries reportdirty: falseand exactly 120 presents atframes 3400:120with 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
41b8e3a56d94550dfee23f46d15cfb448ca7f6f262c8ef2cec2ab8be854072a7.9ffe5b0649185ef4794a163de72e339650b178137329d5a5c1da94ab17ec7375.The linked traces are unmodified native outputs.
Static integration check: main
7feb37ee3e30e10139b483fb4df689d5b5b69ab8merges cleanly with157352f989272fecfdbd9ac395216c9f1535339d(merged tree2286c66ae6183340cad33201d81ad15a52f8a619). 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
0278ca983148; bounded deduplication found no same-root fix (related work listed above)NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)