perf(agc): keep the HTILE clear check of untracked memory until its stamp moves #11602

Merged
XatiX merged 6 commits from upstream-pr/11602 into main 2026-11-01 03:23:37 +00:00
XatiX commented 2026-10-26 22:33:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XatiX on 2026-10-26T22:33:02Z.


What

storeBackClearedHtile, called by every DepthSurfaceView, avoids rereading a depth target's HTILE while the write watch proves it unchanged since the last read: htileReads() keeps the generation CollectWrites returned, and UnchangedSince checks it. For HTILE outside the write watch, CollectWrites returns 0, so the stored generation is 0, the proof is never tried, and every draw reads the whole HTILE with GuestMemory::Read and scans every word with HtileFillClears.

Builder's Journey (PPSA05496) reaches this in a later level. Two HTILE buffers of 512 KiB and 640 KiB are outside the write watch. Counters added locally, not part of this PR, showed this per 10 s:

  • about 144,900 calls;
  • 144,433 full scans with a stored generation of 0;
  • 468 taking the UnchangedSince path;
  • 0 scans of HTILE that was pending or proven changed;
  • 50,000 of 50,000 sampled scans with Watched false and CollectWrites 0.

With APS5_SAMPLE_COMMITTER, DepthSurfaceView was 42.5 % of the draw committer: 23 % in the inlined scan loop and 11.6 % in the memcmp under GuestMemory::Read.

Change. Over HTILE outside the write watch (collected == 0, no pending write), a scan that found no clear is kept under the stamp StorageTexture::compareUntracked uses for untracked memory:

  • the untracked hint, or the collect epoch where there is none;
  • NewestStamp of the range;
  • ForgetSerial, cached only while even;
  • the recorder's NewestWriteNote over the range.

The stamp is taken before the read, after GuestMemory::FlushGpuWrites over the HTILE (as StorageTexture::compareUntracked does), so results still pending on the GPU over it are stored before the stamp is read. The kept scan also records htileStencil, because HtileFillClears reads the same words differently with and without stencil in the HTILE. A call with the same address, size, htileStencil and stamp returns 0 without reading. In all other cases the HTILE is read and scanned as before: any stamp change, a different htileStencil, a collect epoch of 0, a scan that found a clear, or a pending write. forgetHtileReads drops these entries with the generations.

This keeps the ordering the collect memo already relies on: a CPU write is seen at the next collect epoch, and a driver store or recorded GPU write moves the stamp.

Tests (DepthSurfaceReuse.cpp, run by agc_driver_graphics):

  • TestUntrackedHtileScan: an HTILE in memory outside the write watch, holding no clear, is checked twice in one collect epoch.

    • The first check reads it.
    • The second must not read it. On main this fails with "an HTILE outside the write watch that held no clear must not be read again before its stamp moves".
    • The CPU then writes a cleared pattern and a new epoch starts. The next check must read the HTILE again and clear the surface.
  • TestUntrackedHtileStencilScan: unchanged untracked HTILE words 0x0000000f on a D32S8 surface, all in one collect epoch.

    • A lookup without stencil in the HTILE reads them.
    • A second lookup without stencil neither reads nor clears.
    • A lookup with stencil in the HTILE reads them again and clears the surface. Without the htileStencil check this fails with "an HTILE outside the write watch scanned without stencil must be read again for a lookup with stencil in the same collect epoch".
  • TestUntrackedHtileDriverStore: after a kept scan, a cleared HTILE is stored through GuestMemory::MarkWritten (a driver store) in the same collect epoch. The next lookup must read the HTILE again and clear the surface. Without NewestStamp in the stamp this fails with "an HTILE outside the write watch must be read again after a driver store in the same collect epoch".

  • In these tests the flush hook counts calls over the HTILE: a lookup that reads it makes two (the stamp's flush and the read's), and a kept scan makes exactly one. Without the flush before the stamp the first check fails ("the first check of an HTILE outside the write watch must read it").

Tested

Windows 11 (build 26300), Ryzen 7 9800X3D, NVIDIA GeForce RTX 5080 with driver 617.42, 3840x2160 output, MinGW GCC Release build.

Performance. Builder's Journey (PPSA05496 03.002.583): title, then Continue into the level the save resumes. Plain main against main with this PR, same machine and session, game relinked once with main's relinker:

  • A (82e2d0ed142f): main 82e2d0ed1, which includes #11098.
  • B (b827db337d3d): the same main with this PR's first four commits (the flush before the stamp came later and only adds a hook call per lookup).

Each build started from an empty shader cache, ran once untimed to fill it, then once measured. Only APS5_TRACE_SECONDS=60:4 and the pad input file were set. Neither trace dropped events. The two traces follow in the next comment.

{"commit":"82e2d0ed142f","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"60:4"},"gpu":"NVIDIA GeForce RTX 5080","driver":"NVIDIA 617.42","os":"Windows 10.0.26300","cpu":"AMD Ryzen 7 9800X3D 8-Core Processor","cpu_threads":16,"memory_mib":32404,"title_id":"PPSA05496","title":"Builder's Journey","content_version":"03.002.583","resolution":"3840x2160","window":{"spec":"seconds 60:4","first_present":856,"ms":4077.297},"presents":53,"frame_ms":{"p50":76.776,"p90":82.165,"p99":90.759,"max":90.759},"gpu_busy_ms_per_present":39.891,"worker_busy_pct":{"queue worker 0x0":96.379,"queue worker 0x38":26.408},"top_phases_ms_per_frame":{"Driver.Packet":93.851,"Driver.Packet.dispatch":37.628,"Driver.Dispatch":35.616,"Graphics.Draw":35.275,"Graphics.Draw.draw_and_resource_release":32.231,"Driver.Packet.draw":30.389,"Driver.Draw":30.131,"Driver.Draw.draw_enqueued":16.459},"trace_dropped":false,"trace":"aps5-trace-82e2d0ed142f-7860.json.gz"}
{"commit":"b827db337d3d","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"60:4"},"gpu":"NVIDIA GeForce RTX 5080","driver":"NVIDIA 617.42","os":"Windows 10.0.26300","cpu":"AMD Ryzen 7 9800X3D 8-Core Processor","cpu_threads":16,"memory_mib":32404,"title_id":"PPSA05496","title":"Builder's Journey","content_version":"03.002.583","resolution":"3840x2160","window":{"spec":"seconds 60:4","first_present":874,"ms":4049.492},"presents":56,"frame_ms":{"p50":73.211,"p90":79.622,"p99":81.815,"max":81.815},"gpu_busy_ms_per_present":39.923,"worker_busy_pct":{"queue worker 0x0":96.061,"queue worker 0x38":30.619},"top_phases_ms_per_frame":{"Driver.Packet":91.262,"Driver.Packet.dispatch":41.403,"Driver.Dispatch":39.139,"Graphics.Draw":23.505,"Graphics.Draw.draw_and_resource_release":20.513,"Driver.Packet.draw":18.134,"Driver.Draw":17.923,"Driver.Packet.memory_wait":17.888},"trace_dropped":false,"trace":"aps5-trace-b827db337d3d-27460.json.gz"}

tools/trace_digest.py, threads in ms per frame, with an earlier pair from the same session (60:5 window; A's trace dropped 6,836 events in its last 0.1 s):

A 4 s B 4 s A 5 s B 5 s
Presents 53 56 50 65
Frame p50 76.8 ms 73.2 ms 102.0 ms 76.2 ms
draw committer busy 29.6 (39 %), Graphics.Draw 28.0 14.5 (20 %), Graphics.Draw 13.0 61.3 (60 %), Graphics.Draw 59.7 20.7 (27 %), Graphics.Draw 19.1
queue worker 0x0 busy 60.6 (79 %) 47.5 (66 %) 88.9 (87 %) 56.6 (73 %)
gpu 39.9 39.9 40.7 40.2

The draw committer's time drops by half or more in both pairs. The frame rate follows it only where the committer limits the frame: about +5 % in the 4 s pair and +30 % in the 5 s pair, whose A window caught a slower stretch of the level. @klosixgaming-arch's plain main comparison on a second title, Soul Hackers 2 (PPSA03743 01.002.000, RTX 5090), shows the same: Graphics.Draw 46.3/52.6 → 30.4/29.3 ms per frame and 80–90 → 100–129 presents in 5 s.

main 319621ba2 itself crashes in this title before the level: queue worker 0 faults inside the NVIDIA shader compiler (nvgpucomp64.dll+0xa98518) with or without this PR, when the shader cache starts empty. That is unrelated to this change and is why A is the earlier main 82e2d0ed1.

GPU tests. Rebased onto main 319621ba2. On this PR (d4afbc459) and on main 319621ba2, with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation:

  • Command: ctest --test-dir build-test -R "^agc_driver_graphics$|^agc_driver_.*depth|htile" -V, 42 tests.
  • Both: 42 passed.
  • Neither log contains was not found but was requested by env var VK_INSTANCE_LAYERS. Validation comes from Vulkan SDK 1.4.363.0.
  • Neither log contains a VUID- error.

python3 tools/check_conventions.py --base upstream/main passes.

tools/pr_overlap.py: these PRs change DepthSurface.cpp or DepthSurfaceReuse.cpp near this change:

  • #7256 adds a call to storeBackClearedHtile for layered views. This PR leaves its signature and result unchanged.
  • #6300, #6808, #7201 and #8223 add tests beside TestUnmappedStalePlaneFlush and RunDepthSurfaceReuseTests.

Not tested: Linux, where UntrackedHint returns 0 and the stamp falls back to the collect epoch.

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: NVIDIA GeForce RTX 5080, driver 617.42, Windows 11 (build 26300)
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5025656851 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11602). Originally posted by [XatiX](https://github.com/XatiX) on 2026-10-26T22:33:02Z. --- ### What `storeBackClearedHtile`, called by every `DepthSurfaceView`, avoids rereading a depth target's HTILE while the write watch proves it unchanged since the last read: `htileReads()` keeps the generation `CollectWrites` returned, and `UnchangedSince` checks it. For HTILE outside the write watch, `CollectWrites` returns 0, so the stored generation is 0, the proof is never tried, and every draw reads the whole HTILE with `GuestMemory::Read` and scans every word with `HtileFillClears`. Builder's Journey (PPSA05496) reaches this in a later level. Two HTILE buffers of 512 KiB and 640 KiB are outside the write watch. Counters added locally, not part of this PR, showed this per 10 s: - about 144,900 calls; - 144,433 full scans with a stored generation of 0; - 468 taking the `UnchangedSince` path; - 0 scans of HTILE that was pending or proven changed; - 50,000 of 50,000 sampled scans with `Watched` false and `CollectWrites` 0. With `APS5_SAMPLE_COMMITTER`, `DepthSurfaceView` was 42.5 % of the draw committer: 23 % in the inlined scan loop and 11.6 % in the `memcmp` under `GuestMemory::Read`. **Change.** Over HTILE outside the write watch (`collected == 0`, no pending write), a scan that found no clear is kept under the stamp `StorageTexture::compareUntracked` uses for untracked memory: - the untracked hint, or the collect epoch where there is none; - `NewestStamp` of the range; - `ForgetSerial`, cached only while even; - the recorder's `NewestWriteNote` over the range. The stamp is taken before the read, after `GuestMemory::FlushGpuWrites` over the HTILE (as `StorageTexture::compareUntracked` does), so results still pending on the GPU over it are stored before the stamp is read. The kept scan also records `htileStencil`, because `HtileFillClears` reads the same words differently with and without stencil in the HTILE. A call with the same address, size, `htileStencil` and stamp returns 0 without reading. In all other cases the HTILE is read and scanned as before: any stamp change, a different `htileStencil`, a collect epoch of 0, a scan that found a clear, or a pending write. `forgetHtileReads` drops these entries with the generations. This keeps the ordering the collect memo already relies on: a CPU write is seen at the next collect epoch, and a driver store or recorded GPU write moves the stamp. **Tests** (`DepthSurfaceReuse.cpp`, run by `agc_driver_graphics`): - `TestUntrackedHtileScan`: an HTILE in memory outside the write watch, holding no clear, is checked twice in one collect epoch. - The first check reads it. - The second must not read it. On `main` this fails with "an HTILE outside the write watch that held no clear must not be read again before its stamp moves". - The CPU then writes a cleared pattern and a new epoch starts. The next check must read the HTILE again and clear the surface. - `TestUntrackedHtileStencilScan`: unchanged untracked HTILE words `0x0000000f` on a D32S8 surface, all in one collect epoch. - A lookup without stencil in the HTILE reads them. - A second lookup without stencil neither reads nor clears. - A lookup with stencil in the HTILE reads them again and clears the surface. Without the `htileStencil` check this fails with "an HTILE outside the write watch scanned without stencil must be read again for a lookup with stencil in the same collect epoch". - `TestUntrackedHtileDriverStore`: after a kept scan, a cleared HTILE is stored through `GuestMemory::MarkWritten` (a driver store) in the same collect epoch. The next lookup must read the HTILE again and clear the surface. Without `NewestStamp` in the stamp this fails with "an HTILE outside the write watch must be read again after a driver store in the same collect epoch". - In these tests the flush hook counts calls over the HTILE: a lookup that reads it makes two (the stamp's flush and the read's), and a kept scan makes exactly one. Without the flush before the stamp the first check fails ("the first check of an HTILE outside the write watch must read it"). ### Tested Windows 11 (build 26300), Ryzen 7 9800X3D, NVIDIA GeForce RTX 5080 with driver 617.42, 3840x2160 output, MinGW GCC Release build. **Performance.** Builder's Journey (PPSA05496 03.002.583): title, then Continue into the level the save resumes. Plain `main` against `main` with this PR, same machine and session, game relinked once with `main`'s relinker: - A (`82e2d0ed142f`): `main` `82e2d0ed1`, which includes #11098. - B (`b827db337d3d`): the same `main` with this PR's first four commits (the flush before the stamp came later and only adds a hook call per lookup). Each build started from an empty shader cache, ran once untimed to fill it, then once measured. Only `APS5_TRACE_SECONDS=60:4` and the pad input file were set. Neither trace dropped events. The two traces follow in the next comment. ```json {"commit":"82e2d0ed142f","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"60:4"},"gpu":"NVIDIA GeForce RTX 5080","driver":"NVIDIA 617.42","os":"Windows 10.0.26300","cpu":"AMD Ryzen 7 9800X3D 8-Core Processor","cpu_threads":16,"memory_mib":32404,"title_id":"PPSA05496","title":"Builder's Journey","content_version":"03.002.583","resolution":"3840x2160","window":{"spec":"seconds 60:4","first_present":856,"ms":4077.297},"presents":53,"frame_ms":{"p50":76.776,"p90":82.165,"p99":90.759,"max":90.759},"gpu_busy_ms_per_present":39.891,"worker_busy_pct":{"queue worker 0x0":96.379,"queue worker 0x38":26.408},"top_phases_ms_per_frame":{"Driver.Packet":93.851,"Driver.Packet.dispatch":37.628,"Driver.Dispatch":35.616,"Graphics.Draw":35.275,"Graphics.Draw.draw_and_resource_release":32.231,"Driver.Packet.draw":30.389,"Driver.Draw":30.131,"Driver.Draw.draw_enqueued":16.459},"trace_dropped":false,"trace":"aps5-trace-82e2d0ed142f-7860.json.gz"} ``` ```json {"commit":"b827db337d3d","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"60:4"},"gpu":"NVIDIA GeForce RTX 5080","driver":"NVIDIA 617.42","os":"Windows 10.0.26300","cpu":"AMD Ryzen 7 9800X3D 8-Core Processor","cpu_threads":16,"memory_mib":32404,"title_id":"PPSA05496","title":"Builder's Journey","content_version":"03.002.583","resolution":"3840x2160","window":{"spec":"seconds 60:4","first_present":874,"ms":4049.492},"presents":56,"frame_ms":{"p50":73.211,"p90":79.622,"p99":81.815,"max":81.815},"gpu_busy_ms_per_present":39.923,"worker_busy_pct":{"queue worker 0x0":96.061,"queue worker 0x38":30.619},"top_phases_ms_per_frame":{"Driver.Packet":91.262,"Driver.Packet.dispatch":41.403,"Driver.Dispatch":39.139,"Graphics.Draw":23.505,"Graphics.Draw.draw_and_resource_release":20.513,"Driver.Packet.draw":18.134,"Driver.Draw":17.923,"Driver.Packet.memory_wait":17.888},"trace_dropped":false,"trace":"aps5-trace-b827db337d3d-27460.json.gz"} ``` `tools/trace_digest.py`, threads in ms per frame, with an earlier pair from the same session (`60:5` window; A's trace dropped 6,836 events in its last 0.1 s): | | A 4 s | B 4 s | A 5 s | B 5 s | |---|---|---|---|---| | Presents | 53 | 56 | 50 | 65 | | Frame p50 | 76.8 ms | 73.2 ms | 102.0 ms | 76.2 ms | | draw committer busy | 29.6 (39 %), Graphics.Draw 28.0 | 14.5 (20 %), Graphics.Draw 13.0 | 61.3 (60 %), Graphics.Draw 59.7 | 20.7 (27 %), Graphics.Draw 19.1 | | queue worker 0x0 busy | 60.6 (79 %) | 47.5 (66 %) | 88.9 (87 %) | 56.6 (73 %) | | gpu | 39.9 | 39.9 | 40.7 | 40.2 | The draw committer's time drops by half or more in both pairs. The frame rate follows it only where the committer limits the frame: about +5 % in the 4 s pair and +30 % in the 5 s pair, whose A window caught a slower stretch of the level. @klosixgaming-arch's plain `main` comparison on a second title, Soul Hackers 2 (PPSA03743 01.002.000, RTX 5090), shows the same: `Graphics.Draw` 46.3/52.6 → 30.4/29.3 ms per frame and 80–90 → 100–129 presents in 5 s. `main` `319621ba2` itself crashes in this title before the level: queue worker 0 faults inside the NVIDIA shader compiler (`nvgpucomp64.dll+0xa98518`) with or without this PR, when the shader cache starts empty. That is unrelated to this change and is why A is the earlier `main` `82e2d0ed1`. **GPU tests.** Rebased onto `main` `319621ba2`. On this PR (`d4afbc459`) and on `main` `319621ba2`, with `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`: - Command: `ctest --test-dir build-test -R "^agc_driver_graphics$|^agc_driver_.*depth|htile" -V`, 42 tests. - Both: 42 passed. - Neither log contains `was not found but was requested by env var VK_INSTANCE_LAYERS`. Validation comes from Vulkan SDK 1.4.363.0. - Neither log contains a `VUID-` error. `python3 tools/check_conventions.py --base upstream/main` passes. **`tools/pr_overlap.py`:** these PRs change `DepthSurface.cpp` or `DepthSurfaceReuse.cpp` near this change: - #7256 adds a call to `storeBackClearedHtile` for layered views. This PR leaves its signature and result unchanged. - #6300, #6808, #7201 and #8223 add tests beside `TestUnmappedStalePlaneFlush` and `RunDepthSurfaceReuseTests`. **Not tested:** Linux, where `UntrackedHint` returns 0 and the stamp falls back to the collect epoch. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 5080, driver 617.42, Windows 11 (build 26300) - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-26 23:12:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T23:12:07Z.

Review: CHANGES_REQUESTED


Reviewed head fe048a368bf30a7b6a1c1fd388878e3c599dcb39. The stamp layout and cacheability checks mirror StorageTexture::compareUntracked, and the new test covers one no-clear scan per epoch plus a CPU-written clear after the epoch advances. I downloaded both attached traces and ran python3 tools/trace_digest.py on them; the tool’s summary lines match the posted values and identify the same Builder’s Journey version, scene window, GPU, driver, OS and resolution. Both traces report trace_dropped: true (with totals_full: false for the affected threads), so event-level trace detail is incomplete even though the summary totals are reported complete.

[P2] Clarify the required main baseline before treating the perf report as complete. The report says capture A used main at a120df348 plus PR #11098, and #11098 is still open. That is a stacked base, not a capture of main as the performance-report requirement specifies. The matched A/B pair is useful evidence for this patch on top of #11098, but it does not establish the required main-to-change comparison. Please either provide maintainer-approved guidance that this dependency-stacked baseline satisfies the protocol (and declare the dependency), or add an applicable baseline/change pair under the approved report format. Because the title needs #11098 to reach the tested scene, please get that policy clarification rather than reporting a title capture that cannot reach the scene.

The PR reports a Windows build and focused Vulkan tests (35/36 passing identically on its comparison main); I did not rerun the GPU tests locally. Hosted conventions, intake and labels pass; this PR’s hosted status does not include a product/relinker build run.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5660320217 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11602#pullrequestreview-5660320217). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-26T23:12:07Z. **Review:** CHANGES_REQUESTED --- Reviewed head `fe048a368bf30a7b6a1c1fd388878e3c599dcb39`. The stamp layout and cacheability checks mirror `StorageTexture::compareUntracked`, and the new test covers one no-clear scan per epoch plus a CPU-written clear after the epoch advances. I downloaded both attached traces and ran `python3 tools/trace_digest.py` on them; the tool’s summary lines match the posted values and identify the same Builder’s Journey version, scene window, GPU, driver, OS and resolution. Both traces report `trace_dropped: true` (with `totals_full: false` for the affected threads), so event-level trace detail is incomplete even though the summary totals are reported complete. **[P2] Clarify the required `main` baseline before treating the perf report as complete.** The report says capture A used `main` at `a120df348` **plus PR #11098**, and #11098 is still open. That is a stacked base, not a capture of `main` as the performance-report requirement specifies. The matched A/B pair is useful evidence for this patch on top of #11098, but it does not establish the required main-to-change comparison. Please either provide maintainer-approved guidance that this dependency-stacked baseline satisfies the protocol (and declare the dependency), or add an applicable baseline/change pair under the approved report format. Because the title needs #11098 to reach the tested scene, please get that policy clarification rather than reporting a title capture that cannot reach the scene. The PR reports a Windows build and focused Vulkan tests (35/36 passing identically on its comparison main); I did not rerun the GPU tests locally. Hosted conventions, intake and labels pass; this PR’s hosted status does not include a product/relinker build run.
MarcZX10 commented 2026-10-28 20:09:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T20:09:12Z.

Review: APPROVED


Re-checked — new head, looks good

The stencil keying and its tests hold up, and the baseline concern from my earlier review is covered now that #11098 is merged and an independent plain-main comparison exists.

What I ran

  • PR head 3faa0e3dc7 merged onto main at 319621ba2e (merges cleanly; #11098 is already in that main).
  • Environment: Linux x86-64, GCC 12.
python3 tools/check_conventions.py --base upstream/main
git diff --check upstream/main
ninja agc_driver_graphics_tests
ctest -R '^agc_driver_graphics$'
python3 -I tools/trace_digest.py <each attached trace>

Results

Check Result
Conventions and git diff --check pass
agc_driver_graphics (runs RunDepthSurfaceReuseTests) pass
Trace A: 47 presents, p50 108.5 ms, Graphics.Draw 66.2 ms/frame matches the posted 47, 108.4, 66.2
Trace B: 66 presents, p50 75.8 ms, Graphics.Draw 19.9 ms/frame matches the posted 66, 75.8, 19.9
Second contributor's table vs its two posted JSON blocks consistent

Negative control

I changed the code under test in a scratch copy, kept the tests, and ran them.

Change to the code Outcome
drop stencil == target.htileStencil from the cache check (L1840) fails: "an HTILE outside the write watch scanned without stencil must be read again for a lookup with stencil in the same collect epoch"
remove the collect epoch from the stamp fails: "an HTILE outside the write watch must be read again in a new collect epoch"
drop NewestStamp, ForgetSerial and NewestWriteNote from the stamp no test fails

Findings

Blocking

None.

Non-blocking

  • No test moves the stamp without also advancing the collect epoch, so the driver-store, recorded-GPU-write and remap parts of the stamp are untested (last row above).
  • Question for @XatiX: StorageTexture::compareUntracked calls FlushGpuWrites before taking its stamp, and the new path (L1833, stamp at L1746) does not. I could not establish whether a deferred storage-image write over HTILE that is not yet stored can be missed here, since HTILE is normally written by recorded dispatches or fills that pending and NoteHtileDepthClear cover. If it is not reachable, a sentence saying so would be enough.
  • #11098 was merged on 2026-10-28, after the recapture, so Depends on: #11098 and "A = main + #11098" in the description are out of date. Please update them. The plain-main recapture promised in the description can now be taken on Builder's Journey.

Sources

Not verified

  • Linux behaviour of the stamp, where UntrackedHint returns 0 and the stamp falls back to the epoch.
  • GPU runs on real titles; the numbers above are the contributors' own.
  • trace_dropped from the attachments, since no summary file was attached; I rely on the posted JSON.
  • Windows and macOS builds.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5689013179 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11602#pullrequestreview-5689013179). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-28T20:09:12Z. **Review:** APPROVED --- # Re-checked — new head, looks good The stencil keying and its tests hold up, and the baseline concern from my earlier review is covered now that #11098 is merged and an independent plain-`main` comparison exists. ## What I ran - PR head `3faa0e3dc7` merged onto `main` at `319621ba2e` (merges cleanly; #11098 is already in that `main`). - Environment: Linux x86-64, GCC 12. ``` python3 tools/check_conventions.py --base upstream/main git diff --check upstream/main ninja agc_driver_graphics_tests ctest -R '^agc_driver_graphics$' python3 -I tools/trace_digest.py <each attached trace> ``` ## Results | Check | Result | |---|---| | Conventions and `git diff --check` | pass | | `agc_driver_graphics` (runs `RunDepthSurfaceReuseTests`) | pass | | Trace A: 47 presents, p50 108.5 ms, `Graphics.Draw` 66.2 ms/frame | matches the posted 47, 108.4, 66.2 | | Trace B: 66 presents, p50 75.8 ms, `Graphics.Draw` 19.9 ms/frame | matches the posted 66, 75.8, 19.9 | | Second contributor's table vs its two posted JSON blocks | consistent | ## Negative control I changed the code under test in a scratch copy, kept the tests, and ran them. | Change to the code | Outcome | |---|---| | drop `stencil == target.htileStencil` from the cache check ([L1840](https://github.com/boykopovar/AnyPS5/blob/3faa0e3dc7c95162eb9c96e8ab4e72280c70313c/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L1840)) | fails: "an HTILE outside the write watch scanned without stencil must be read again for a lookup with stencil in the same collect epoch" | | remove the collect epoch from the stamp | fails: "an HTILE outside the write watch must be read again in a new collect epoch" | | drop `NewestStamp`, `ForgetSerial` and `NewestWriteNote` from the stamp | no test fails | ## Findings **Blocking** None. **Non-blocking** - No test moves the stamp without also advancing the collect epoch, so the driver-store, recorded-GPU-write and remap parts of the stamp are untested (last row above). - Question for @XatiX: `StorageTexture::compareUntracked` calls `FlushGpuWrites` before taking its stamp, and the new path ([L1833](https://github.com/boykopovar/AnyPS5/blob/3faa0e3dc7c95162eb9c96e8ab4e72280c70313c/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L1833), stamp at [L1746](https://github.com/boykopovar/AnyPS5/blob/3faa0e3dc7c95162eb9c96e8ab4e72280c70313c/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L1746)) does not. I could not establish whether a deferred storage-image write over HTILE that is not yet stored can be missed here, since HTILE is normally written by recorded dispatches or fills that `pending` and `NoteHtileDepthClear` cover. If it is not reachable, a sentence saying so would be enough. - #11098 was merged on 2026-10-28, after the recapture, so `Depends on: #11098` and "A = `main` + #11098" in the description are out of date. Please update them. The plain-`main` recapture promised in the description can now be taken on Builder's Journey. ## Sources - Cache identity and use: [`DepthSurface.cpp` L1735 (scan record), L1746 (stamp), L1833 (use), L1840 (lookup with stencil), L1873 (store)](https://github.com/boykopovar/AnyPS5/blob/3faa0e3dc7c95162eb9c96e8ab4e72280c70313c/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L1735-L1873) - Independent plain-`main` comparison: the table posted by klosixgaming-arch on this PR (PPSA03743, RTX 5090, `main` `0cd07dc4ab` vs `92df59deeb`). ## Not verified - Linux behaviour of the stamp, where `UntrackedHint` returns 0 and the stamp falls back to the epoch. - GPU runs on real titles; the numbers above are the contributors' own. - `trace_dropped` from the attachments, since no summary file was attached; I rely on the posted JSON. - Windows and macOS builds.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!11602
No description provided.