Skip to content

perf(agc): trap label reads of small images inside pending large ones on macOS - #13678

Merged
adriadam10 merged 8 commits into
boykopovar:mainfrom
Gonic0:feat/agc-label-trap-aliased
Nov 1, 2026
Merged

adriadam10 merged 8 commits into
boykopovar:mainfrom
Gonic0:feat/agc-label-trap-aliased

Conversation

@Gonic0

@Gonic0 Gonic0 commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

What

Builds on #13499. Its label trap skips an image that shares a page with another pending image, so the label stores it as before. In PPSA21564 (ASTRO BOT 01.007.000) on MoltenVK, every image the trap skipped during the intro was skipped for that reason, and each of them lies inside a large pending tiled render target: a 960x540 linear image and 120x67, 60x33 and 30x16 tiled images of 64 KiB inside 2432x1368, 1920x1080 and 3840x2160 targets. The memory is reused across passes. A label never stores those large targets (they are tiled and over SmallStoreBytes), but the small images inside them were stored at every label. Each of those stores waited for the GPU (FlushPending → Recorder::Sync), on average 7.6 ms per frame on queue 0x40.

Three changes, all macOS-only like the trap:

  • Page rule: a pending image counts as sharing a page only if a label would store it: linear, or at most SmallStoreBytes. Images being stored (pending.flushing) still count, so a storing thread never faults on a new trap.
  • Store over a trap: when FlushPending stores an image that covers a trapped one, it stores the trapped one in the same flush. Without this, the large image's store lands first and the trapped image's store lands later, at the guest's first read, over it.
  • Eviction and explicit write-back: StorageTexture::Flush() and WriteBack() store a dirty image without FlushPending, so they first store the trapped images it covers through FlushPending. Flush() is called from the storage cache's evictions and FlushCachedTextures, under the cache's mutex; cachedStorageTexture already calls FlushPending under that mutex next to its evictions, FlushPending takes GpuMutex recursively and does not wait for the GPU inside a completion, and the memory-pressure eviction only evicts clean images, for which the new step does nothing.

With these, the bytes in guest memory are the same as when the label stores the small image: the new test checks four sequences against the bytes APS5_NO_LABEL_READ_TRAP=1 leaves. Which of two overlapping images wins is still decided by the existing write-back rules (blocks stamped since an image's generation keep their bytes); this PR does not change that.

The debt entry for label read traps describes the new rule and the two stores.

Performance

Apple M5 Pro, macOS 27.2, MoltenVK 1.4.2, 3840x2160. PPSA21564 01.007.000 from boot, warm shader cache, 60 s per run, the same tree with #13499 below this change (and the open macOS port PRs), alternated. Traces cover presents 700 to 880 (APS5_TRACE_FRAMES=700:180), in the intro.

round #13499 this change frame p50 (ms) GPU busy per present (ms)
1 42.8 FPS 52.8 FPS 24.3 → 18.5 14.8 → 12.1
2 45.4 FPS 51.6 FPS 21.3 → 18.7 13.4 → 13.7
3 49.3 FPS 53.5 FPS 19.9 → 18.5 12.9 → 12.1
4 46.7 FPS 44.2 FPS 22.0 → 21.1 14.6 → 15.4
5 41.2 FPS 48.0 FPS 24.6 → 20.7 15.4 → 15.3

Averaged over the five rounds: 45.1 → 50.0 FPS for the whole run, and 22.4 → 19.5 ms frame p50 in the traced window. Round 4 was slower with the change over the whole run, although its traced window was faster; across the five rounds the base alone ranged from 41.2 to 49.3 FPS.

Queue 0x40 drops from 6.8–8.5 ms of work per frame to 1.5–2.1 ms. In earlier runs with a temporary counter and the same page rule, StoreReadbackBeforeLabel stored 230 to 3,400 images per 10 s before the change and none with it, and no trap was resolved: no guest read touched those images.

Queue 0x0 is now the busy one (14–16 ms of work per frame). One run with the change (round 2) had a 438 ms frame at present 878: queues 0x40 and 0x48 waited on memory while queue 0x0 compiled shaders at first use and ran a long dispatch (Driver.Dispatch.materialize). Every run compiles those five shaders at use, at different points; this one fell inside the traced window, and rounds 3 to 5 with the change had no frame over 27 ms.

Paired summary lines (rounds 1 and 3)

Round 1, #13499:

{"commit":"a9a7ce776ec8","dirty":null,"env":{"APS5_ASYNC_PIPELINES":"1","APS5_DUMP_FRAMES":"200","APS5_DUMP_FRAMES_EVERY":"60","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_FRAMES":"700:180"},"gpu":"Apple M5 Pro","driver":"MoltenVK 1.4.2","os":"Darwin 27.2.0","cpu":"VirtualApple @ 2.50GHz","cpu_threads":18,"memory_mib":49152,"title_id":"PPSA21564","title":"ASTRO BOT","content_version":"01.007.000","resolution":"3840x2160","window":{"spec":"frames 700:180","first_present":700,"ms":4250.879},"presents":180,"frame_ms":{"p50":24.257,"p90":26.021,"p99":31.414,"max":31.570},"gpu_busy_ms_per_present":14.818,"worker_busy_pct":{"queue worker 0x0":97.290,"queue worker 0x40":99.400,"queue worker 0x48":82.419,"queue worker 0x3a":0.289},"top_phases_ms_per_frame":{"Driver.Packet":65.630,"Driver.Packet.memory_wait":39.927,"Driver.Packet.dispatch":7.468,"Recorder.Sync":7.383,"VideoOut.Flip":7.136,"Driver.Dispatch":6.097,"Driver.Present":5.885,"VideoOut.Flip.present":5.855},"trace_dropped":false,"trace":"aps5-trace-a9a7ce776ec8-68653.json.gz"}

Round 1, this change:

{"commit":"6d4e29cccb37","dirty":null,"env":{"APS5_ASYNC_PIPELINES":"1","APS5_DUMP_FRAMES":"200","APS5_DUMP_FRAMES_EVERY":"60","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_FRAMES":"700:180"},"gpu":"Apple M5 Pro","driver":"MoltenVK 1.4.2","os":"Darwin 27.2.0","cpu":"VirtualApple @ 2.50GHz","cpu_threads":18,"memory_mib":49152,"title_id":"PPSA21564","title":"ASTRO BOT","content_version":"01.007.000","resolution":"3840x2160","window":{"spec":"frames 700:180","first_present":700,"ms":3322.796},"presents":180,"frame_ms":{"p50":18.546,"p90":19.303,"p99":21.956,"max":22.176},"gpu_busy_ms_per_present":12.088,"worker_busy_pct":{"queue worker 0x0":96.972,"queue worker 0x40":97.674,"queue worker 0x48":80.660,"queue worker 0x3a":0.237},"top_phases_ms_per_frame":{"Driver.Packet":50.566,"Driver.Packet.memory_wait":31.276,"VideoOut.Flip":7.672,"Graphics.Draw":7.015,"Driver.Present":6.504,"VideoOut.Flip.present":6.473,"Driver.Present.render_fence_wait":6.337,"Vulkan.Retire":6.337},"trace_dropped":false,"trace":"aps5-trace-6d4e29cccb37-71654.json.gz"}

Round 3, #13499:

{"commit":"a9a7ce776ec8","dirty":null,"env":{"APS5_ASYNC_PIPELINES":"1","APS5_DUMP_FRAMES":"200","APS5_DUMP_FRAMES_EVERY":"60","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_FRAMES":"700:180"},"gpu":"Apple M5 Pro","driver":"MoltenVK 1.4.2","os":"Darwin 27.2.0","cpu":"VirtualApple @ 2.50GHz","cpu_threads":18,"memory_mib":49152,"title_id":"PPSA21564","title":"ASTRO BOT","content_version":"01.007.000","resolution":"3840x2160","window":{"spec":"frames 700:180","first_present":700,"ms":3583.436},"presents":180,"frame_ms":{"p50":19.916,"p90":21.262,"p99":22.743,"max":25.234},"gpu_busy_ms_per_present":12.929,"worker_busy_pct":{"queue worker 0x0":97.020,"queue worker 0x40":97.840,"queue worker 0x48":83.304,"queue worker 0x3a":0.254},"top_phases_ms_per_frame":{"Driver.Packet":55.106,"Driver.Packet.memory_wait":34.107,"Recorder.Sync":9.085,"VideoOut.Flip":7.682,"Driver.Packet.flush_between_packets":7.487,"Driver.Present":6.529,"VideoOut.Flip.present":6.494,"Driver.Present.render_fence_wait":6.373},"trace_dropped":false,"trace":"aps5-trace-a9a7ce776ec8-86790.json.gz"}

Round 3, this change:

{"commit":"6d4e29cccb37","dirty":null,"env":{"APS5_ASYNC_PIPELINES":"1","APS5_DUMP_FRAMES":"200","APS5_DUMP_FRAMES_EVERY":"60","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_FRAMES":"700:180"},"gpu":"Apple M5 Pro","driver":"MoltenVK 1.4.2","os":"Darwin 27.2.0","cpu":"VirtualApple @ 2.50GHz","cpu_threads":18,"memory_mib":49152,"title_id":"PPSA21564","title":"ASTRO BOT","content_version":"01.007.000","resolution":"3840x2160","window":{"spec":"frames 700:180","first_present":700,"ms":3324.290},"presents":180,"frame_ms":{"p50":18.477,"p90":19.384,"p99":20.596,"max":21.599},"gpu_busy_ms_per_present":12.075,"worker_busy_pct":{"queue worker 0x0":96.459,"queue worker 0x40":97.214,"queue worker 0x48":80.299,"queue worker 0x3a":0.272},"top_phases_ms_per_frame":{"Driver.Packet":50.307,"Driver.Packet.memory_wait":31.015,"VideoOut.Flip":7.807,"Graphics.Draw":7.623,"Driver.Present":6.378,"VideoOut.Flip.present":6.348,"Vulkan.Retire":6.161,"Driver.Present.render_fence_wait":6.160},"trace_dropped":false,"trace":"aps5-trace-6d4e29cccb37-86875.json.gz"}

Traces:

Tested

On the tree above (Apple M5 Pro, macOS 27.2, x86-64 under Rosetta 2):

The new part of agc_small_tiled_shadow_label puts an 8x8 linear image inside a 256x256 kR64KBX image that is pending, and checks:

  1. a label traps the small image;
  2. a store of the large image's 64 KiB block that holds it (an access next to it) stores the small image too, gives its page back and leaves the bytes a label store leaves;
  3. the same after the large image is written again after the small one;
  4. evicting the large image (Flush()) stores the trapped image inside it first;
  5. after the eviction, a label traps the small image again and a read from another thread sees its results.

Before writing the expected bytes into the test, I ran the same sequences with APS5_NO_LABEL_READ_TRAP=1 and with this change, and printed the bytes: they were the same at each step. Without the second and third changes the trap left the large image's bytes in each step, and at step 5 a read of the trapped image returned the large image's older bytes.

Negative controls, each of which fails the test:

  • the old page rule: "a label stored a small image inside a pending large tiled one instead of trapping its reads";
  • FlushPending not storing the trapped images a store covers: "a store of a large image's block left a trapped image inside it trapped";
  • no store of the covered traps before an eviction: "evicting a large image did not store the trapped image inside it first".

I also tried ordering the images of one flush (trapped ones first, or by last write) and widening the GPU wait to the added images' ranges. Neither changed any byte in these sequences, on the GPU path or the CPU path (FlushPending with idle), so neither is in this PR.

Not tested on Linux or Windows, where nothing changes.

Checklist

🤖 Generated with Claude Code

@github-actions github-actions Bot added the perf Performance change label Oct 30, 2026
@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Progress report (5f0857e → a3046f4)

📈 System libraries: 25.85% (+0.0022%, +1 implemented functions)

✅ 1 implemented
Library Name
libkernel DirectMemoryAliased_nid_postfix

Changed libraries (implemented exports)

Library Before After Change
libkernel 702/750 (93.60%) 703/751 (93.61%) +0.01%

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 1368 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 1395 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 2434 docs/dev/debt/libSceAgcDriver.md
PR 4449 docs/dev/debt/libSceAgcDriver.md
PR 5021 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 5609 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 5925 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6182 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6187 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6188 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6192 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6194 docs/dev/debt/libSceAgcDriver.md
PR 6197 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6209 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6223 docs/dev/debt/libSceAgcDriver.md
PR 6273 docs/dev/debt/libSceAgcDriver.md
PR 6280 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6300 docs/dev/debt/libSceAgcDriver.md
PR 6412 docs/dev/debt/libSceAgcDriver.md
PR 6481 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6548 docs/dev/debt/libSceAgcDriver.md
PR 6549 docs/dev/debt/libSceAgcDriver.md
PR 6804 docs/dev/debt/libSceAgcDriver.md
PR 6808 docs/dev/debt/libSceAgcDriver.md
PR 6867 docs/dev/debt/libSceAgcDriver.md
PR 6926 docs/dev/debt/libSceAgcDriver.md
PR 6970 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6977 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7048 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7256 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7449 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
docs/dev/debt/libSceAgcDriver.md
PR 7457 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 7514 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 7604 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7642 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7978 docs/dev/debt/libSceAgcDriver.md
PR 8014 docs/dev/debt/libSceAgcDriver.md
PR 8484 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 8542 docs/dev/debt/libSceAgcDriver.md
PR 8592 docs/dev/debt/libSceAgcDriver.md
PR 8707 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
docs/dev/debt/libSceAgcDriver.md
PR 8874 docs/dev/debt/libSceAgcDriver.md
PR 9020 docs/dev/debt/libSceAgcDriver.md
PR 9335 docs/dev/debt/libSceAgcDriver.md
PR 9356 docs/dev/debt/libSceAgcDriver.md
PR 9387 docs/dev/debt/libSceAgcDriver.md
PR 9432 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9445 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 9508 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9592 docs/dev/debt/libSceAgcDriver.md
PR 9712 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 9748 docs/dev/debt/libSceAgcDriver.md
PR 9884 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 9898 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9915 docs/dev/debt/libSceAgcDriver.md
PR 9950 docs/dev/debt/libSceAgcDriver.md
PR 10026 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
docs/dev/debt/libSceAgcDriver.md
PR 10233 docs/dev/debt/libSceAgcDriver.md
PR 10249 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 10256 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 10351 docs/dev/debt/libSceAgcDriver.md
PR 10359 docs/dev/debt/libSceAgcDriver.md
PR 10442 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 10469 docs/dev/debt/libSceAgcDriver.md
PR 10492 docs/dev/debt/libSceAgcDriver.md
PR 10497 docs/dev/debt/libSceAgcDriver.md
PR 10760 docs/dev/debt/libSceAgcDriver.md
PR 10920 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 10940 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/debt/libSceAgcDriver.md
PR 11126 docs/dev/debt/libSceAgcDriver.md
PR 11444 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 11551 docs/dev/debt/libSceAgcDriver.md
PR 12120 docs/dev/debt/libSceAgcDriver.md
PR 12348 docs/dev/debt/libSceAgcDriver.md
PR 12565 docs/dev/debt/libSceAgcDriver.md
PR 12567 docs/dev/debt/libSceAgcDriver.md
PR 12568 docs/dev/debt/libSceAgcDriver.md
PR 12746 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 12855 docs/dev/debt/libSceAgcDriver.md
PR 12904 docs/dev/debt/libSceAgcDriver.md
PR 13146 docs/dev/debt/libSceAgcDriver.md
PR 13793 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
docs/dev/debt/libSceAgcDriver.md
PR 13809 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
docs/dev/debt/libSceAgcDriver.md
PR 13942 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 14212 docs/dev/debt/libSceAgcDriver.md

@TechLevelZero

TechLevelZero commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head ea1ddab merged onto main 828ac0b · tested 2026-10-31 09:49 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,960 passed · 6 failed (0 new, 3 also fail on main, 3 unstable on main) · 42 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 3,008 of 3,048 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 (1185 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_lookup_log_fits_build 57.8 s, ⚠️ agc_driver_pipeline_journal 50.6 s, ⚠️ agc_driver_graphics 32.1 s, ⚠️ agc_driver_graphics_maps_fallback 30.7 s
Unstable on main (3, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_submit_progress: failed in 6 of the last 10 main runs
agc_submit_progress: failed in 6 of the last 10 main runs
agc_submit_progress_no_timeline: failed in 8 of the last 10 main runs
Failing on main too (3, not counted against this PR)
agc_driver_image_table
guest_mmap_executable
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_job_manager_compute_capacity: Failed in the parallel run; also passed only on retry in 165 other runs in the last 7 days
Validation IDs already present on main (5 IDs in 691 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (691 tests): agc_compute_pipeline_replay, agc_driver, agc_driver_address_passes, agc_driver_address_passes_draw_transitions, agc_driver_address_passes_targets_split, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_array_layer_target, and 683 more
VUID-vkCmdCopyImage-srcImage-01548 (12 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_plane_sampling, and 4 more
VUID-vkCmdCopyImage-srcImage-01551 (12 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_plane_sampling, and 4 more
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (2 tests): agc_driver_prepared_exports, agc_driver_srgb8_color_target
VUID-VkShaderModuleCreateInfo-pCode-08737 (1 test): agc_driver_image_sample_derivatives
Skipped (42)
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_msaa_dcc_compared_import_2: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_msaa_dcc_compared_import_4: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_msaa_dcc_compared_import_8: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
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_driver_sparse_dma_buf_import: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_stencil_ref_export: skipped, the device lacks VK_EXT_shader_stencil_export
agc_driver_vertex_elected_atomic_max: skipped, the device runs vertex programs in subgroups, so they keep their cross-lane reductions
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_net_ctl: skipped, the host has no IPv4 address
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_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_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_fresh: 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 plat
Reproduce
git fetch origin ea1ddab9f6abc9b24a6faa48c6af71f6b2382c10 828ac0b2ae74aac181ba128fb59b08a1534f2041
git checkout 828ac0b2ae74aac181ba128fb59b08a1534f2041 && git merge --no-ff ea1ddab9f6abc9b24a6faa48c6af71f6b2382c10
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.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 1, 2026
Gonic0 and others added 8 commits November 1, 2026 07:33
GuestWriteWatchTrapReads takes all access to the pages of a range until
the resolver set with GuestWriteWatchSetReadTrapResolver has run for it.
A fault on a trapped page waits while the resolver runs on the watch's
own thread; host writes and GuestWriteWatchProtect run it first on the
calling thread. Collections keep trapped pages inaccessible, and
registering or unregistering memory drops its traps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A fault that reaches the handler after its page was given back is retried.
The budget for that was shared by every thread faulting on the page, so the
17th delayed reader of one untrap was passed on as a crash. Each thread now
has its own budget per page and untrap, which still bounds a fault the page's
protection does not explain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A caller that traps the same range at every label then needs no record of
its own of which ranges are trapped, which registering memory again could
leave stale.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The per-thread retry entries are a 64-entry cache. More threads faulting in
turn on a page whose protection does not explain the fault evict each
other's entries before their next attempt, so each count restarted at 1 and
the faults were retried forever. Retries between two untraps are now also
counted in total, up to 64 times the per-thread budget.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ing them

Before a label, a pending linear or small storage image that shares no page
with another pending or storing image now gets a write-watch read trap
instead of its store. The first access to its pages stores it through the
host-read hook; any other store releases the trap first.
APS5_NO_LABEL_READ_TRAP=1 keeps the store at the label.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The trap was released when FlushPending took the image out of the pending
registry, before it waited for GpuMutex, so a read in between saw the old
bytes; cache eviction and explicit write-backs did not release it at all.
Every store now releases it in writeBackLayers: after recording the GPU copy
into the import, or before the first CPU access on the CPU path, which also
releases the traps of other images on the same pages. A trapped image is
stored whole, and direct memory mapped at a second address is not trapped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The label read trap skipped every image sharing a page with another
pending image. Large tiled images are never stored at a label, so an
image inside one no longer counts as sharing. A store of an image over a
trapped one now stores the trapped one in the same flush, and an
eviction or explicit write-back stores the trapped images inside it
first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Gonic0
Gonic0 force-pushed the feat/agc-label-trap-aliased branch from 3da032e to a3046f4 Compare November 1, 2026 06:38
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 1, 2026
@adriadam10 adriadam10 self-assigned this Nov 1, 2026
@adriadam10
adriadam10 merged commit 75df21b into boykopovar:main Nov 1, 2026
18 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the diff (page rule, FlushPending store of covered traps, Flush()/WriteBack() pre-store), that writeBack widens a trapped image to its whole range, the debt entry, the new test's per-step byte checks and the macOS-only guards; Linux and Windows paths are unchanged. Hosted checks are green; merged.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants