Repository navigation
fix(agc): keep a read-trapped image trapped when a label stores a large image around it on macOS - #20138
Conversation
…ge image around it on macOS
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
Nothing blocks this change; the implementation skips occasional label stores for overlapping images while a read trap is active, preserving the existing later flush path.
What I ran
Reviewed head 23d1a9d34ec7f447c6089a2e5a5ad86be2dcf376 using repo_read.py for targeted source reads. No tests were run during this review; test results in the description are author reported.
Results
| Check | Result | Note |
|---|---|---|
| Diff and implementation | passed | Targeted logic and callers read |
| Tests | not run | Author reported test runs only |
Findings
Blocking
None.
Non-blocking
None.
Not verified
Read description.md, commits.md, manifest.json, diff.patch, and targeted sections of Texture.cpp, Texture.hpp, and Recorder.cpp. The full changed Texture.cpp was excluded from the review folder because it was too large; only the relevant method, overlap helper, trap handling, and test context were read. No test execution, macOS runtime, or non-Apple build was verified.
To get this to a good state
Nothing is required.
|
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.
|
|
Windows + NVIDIA (Blackwell) run of head Setup: Windows 11 Pro, NVIDIA GeForce RTX 5070 Ti, driver 621.01, Ryzen 7 5800X3D, WinLibs GCC 15.2.0 r7 UCRT, Release,
AI-assisted: yes |
kurexw
left a comment
There was a problem hiding this comment.
Tested on macOS 27.2 / Apple M4 with MoltenVK 1.4.2 (LunarG Vulkan SDK 1.4.363.1, validation layer 1.4.363), x86-64 build under Rosetta. This is the only GPU I tested.
Head 23d1a9d34e merged alone onto main 3b17977ba6, compared with 3b17977ba6 itself. I ran the 29 AGC tests that fail on main on this Mac, with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation and VK_LOADER_DEBUG=layer, through ctest --test-dir build -R <those 29> -V, three runs per side. Every Vulkan test logged Insert instance layer "VK_LAYER_KHRONOS_validation" and none logged was not found but was requested by env var VK_INSTANCE_LAYERS.
| test | main (3 runs) | this PR (3 runs) |
|---|---|---|
agc_small_tiled_shadow_label |
Failed, Failed, Failed | Passed, Passed, Passed |
The other 27 tests gave the same result on both sides.
agc_driver_label_after_import_copy is flaky on main as well: main Failed, Passed, Passed, this PR Passed, Passed, Passed. Every failure on either side is the same timing check ("round N: a CPU read after the label that followed the copy found K of 262144 destination bytes not yet copied"), and it varied the same way across the other PRs I tested in the same session, so I don't attribute it to this change.
VUID- lines: identical per test on both sides (30 on main, 30 with this PR, over the three runs). The VUID- lines on both sides are main's existing VUID-VkDeviceCreateInfo-sType-unique (a duplicated VkPhysicalDevicePortabilitySubsetFeaturesKHR in the device pNext chain) and VUID-VkSamplerCreateInfo-samplerMipLodBias-04467; this PR adds none.
|
Tested this head (
This head also merges cleanly with #21972, which edits the trap checks in the same function. Also run under the Khronos validation layer 1.4.363 ( AI-assisted: yes (Claude Code) |
|
Tested head Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release,
Whole batch: the full This is one combined tree, not a run of this PR alone. AI-assisted: yes (Claude Code) |
What
On macOS,
agc_small_tiled_shadow_labelfails:The test writes a small linear image at
+0x20000inside a largekR64KBXimage (256x256, 0x40000 bytes); both have pending GPU results. It then callsStoreReadbackBeforeLabel. On macOS that function read-traps the small image's pages instead of storing them:GuestWriteWatchTrapReadssucceeds andreadTrappedis set. The same call then occasionally stores large tiled images that were written occasionally:That
FlushPendingcovers the trapped image.FlushPendingdeliberately stores every read-trapped pending image its stored images cover, so their newer results land on top. So the trap is lifted and the small image is stored within the same label: exactly what the trap was meant to avoid.With label traps on (macOS,
trap), the occasional store now skips a large image that covers a read-trapped pending image. ItswrittenOccasionallyflag is left set, so a later label stores it once nothing inside it is trapped. A CPU access to the large image still stores it through the usual hooks: the test's next step stores one block of the large image and checks that this releases the trapped image with its own results. Linux and Windows have no label traps, and their path is unchanged.Tested
Setup:
-DCMAKE_OSX_ARCHITECTURES=x86_64; tests run under RosettaANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1mainwith the open macOS build fixes appliedResults:
agc_small_tiled_shadow_labelfails before this change and passes after it, including the later steps: the block store releasing the inner trap, and the reads of both images.ctest -R '^(agc|shader|job)'(1578 tests,-j 1) and compared it with the same run before this change:agc_small_tiled_shadow_labelis fixed and nothing that passed before fails because of this change.agc_driver_msaa_dcc_clear_2failed once in that run; it is intermittent on this machine and failed the same way in earlier runs without this change.Checklist
main; no other open PR implements the same functionsNotImplemented_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)