Repository navigation
fix(agc): keep a context with no settle queue off the settle path - #26652
Conversation
On Windows an import of private writable memory above the settle floor called settleImport whenever the cached watch decision said private imports settle, without looking at the context's own settle queue. settleImport locks *context.settleQueueMutex, so a context with no settle queue threw std::system_error (EPERM) from the lock. The decision is cached under the VkDevice handle and outlives the device. A bare test device created at the handle of a destroyed driver device inherits "private imports settle" while having no settle queue. Since the settle floor went from 1 MiB to just over 64 KiB, the 128 KiB import of agc_driver_native_multisample_depth takes that path, and the test failed whenever the AMD driver reused the handle. Whether private imports settle now also asks the context for a settle queue and its mutex, as the deferred settle and dma-buf settle paths already do. Such an import stays compared and queues no deferred settle. agc_import_settle_deferred imports 128 KiB through a copy of its context without the settle queue and requires a compared import and no settle. The cached decision outliving its device is recorded as debt. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
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.
|
|
Correction: as @Plyxen points out below, |
|
Windows check on a discrete AMD GPU, next to the gfx1036 iGPU in #26649. The bug reproduces here too, more often, and this head fixes it. Setup: Windows 11 Enterprise 22621, AMD Radeon RX 6700 XT (RDNA2, AMD proprietary driver 26.11.2), WinLibs GCC 15.2 UCRT r7, Release, built at this head
All 12 multisample-depth failures and all 6 deferred-settle failures are the one in #26649, at the same offset: So the handle reuse isn't limited to the iGPU: on this card the bare device inherits the decision in more than half of the runs. Your new case (d) catches it every time. ( AI-assisted: yes. |
|
Thanks, both. @JJenkx that answers something I could not: the handle reuse is not an iGPU effect, and at 12 of 20 on the RX 6700 XT it is more frequent than the 2 of 20 I saw. Good to see the new case fail on the parent in @upipibi thanks for the RTX 3070 build and run. One note for anyone repeating it: AI-assisted: yes (Claude Code) |
|
NVIDIA run on Windows, next to the AMD logs in #26649: nothing regresses, but I couldn't reproduce the failure on this GPU in a loop. Setup: Windows 11 Pro 10.0.26300, NVIDIA Quadro P3200 (Pascal,
In a sweep of the 108 import, settle and write-watch tests on AI-assisted: yes (Claude Code) |
|
The rerun with the tests that go through the changed path, as @Plyxen pointed out. RTX 3070 run of Tested
The Not tested: AMD, titles. AI-assisted (Claude Code). |
mihiii1337
left a comment
There was a problem hiding this comment.
Hardware coverage note only — no code verdict on exact head ccafed0d8f7d877e78d69def729ad38b8eb6adc8.
I built two isolated Windows 11 Release arms with WinLibs GCC 15.2/Ninja:
- candidate: the exact PR head;
- control: the same head and test sources, with only
Graphics/src/GuestBufferMemory.cpprestored from parenteb4300802c52ef268e7e0c4038bd6f91ac4a2667.
On physical Intel RaptorLake-S Mobile/UHD (8086:a78b, Intel driver 32.0.101.6127), I ran agc_import_settle_deferred and agc_import_settle_deferred_other_family as three fresh serial CTest processes per test and arm (12 processes total). Every process selected the Intel device, inserted Khronos validation 1.4.369 at instance and device level, and had no missing-layer line, VUID or synchronization-hazard diagnostic.
All 12 were capability skips (SKIP_RETURN_CODE=77), not passes:
- ordinary deferred settle, candidate and control 3/3 each:
host imports within 64 KiB, a settle queue or write watching unavailable; - other-family case, candidate and control 3/3 each:
no other queue family to settle imports on.
A separate pinned-ICD capability probe reported 4 KiB external-host-memory alignment and one combined graphics/compute/transfer queue family; the remaining families were video-decode only. Therefore neither arm reached the new queueless-settle assertion or production guard, and I did not run the optional repeated native-depth case. This Intel adapter cannot add a functional A/B verdict for this fix, but it identifies the exact third-vendor coverage limit.
The candidate and control source scope and all 47 dependency pins were rechecked after the runs. No console or title was exercised.
AI-assisted: yes (OpenAI Codex); exact source arms, isolated builds, artifact/source hashes, 12 fresh CTest/JUnit logs, GPU selection, driver/ICD capability, validation-layer insertion, skip markers and diagnostics were checked directly and independently reviewed.
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
Nothing in the inspected change shows a blocking defect; the new guard prevents private import settling when the context has no settle queue.
What I ran
Read the prepared diff and the changed source ranges at head ccafed0d8f7d877e78d69def729ad38b8eb6adc8 using repo_read.py tools. No tests or build commands were run during this review.
Results
| Check | Result | Note |
|---|---|---|
| Diff and changed lines | passed | All three changed files read |
| Targeted source context | passed | Settle guard, import path and test context read |
| Tests run by reviewer | not run | Author-reported runs not repeated |
Findings
Blocking
None.
Non-blocking
None.
Not verified
The full 8,566-line GuestBufferMemory.cpp and 19,384-line Recorder.cpp were not read; only ranges relevant to the changed hunks were inspected. review/files.json was not available; the manifest identifies both source files as excluded from the prepared folder because they are too large, and the five-line debt fragment as included and read. Tests, build, CI results, and console behavior were not independently verified. Author-reported test results are in review/description.md.
To get this to a good state
Nothing is required.
What
On Windows
importRunAtsettled a private writable import at the import whenever the cached watch decision said private imports settle and the import was at or above the settle floor. It did not ask whether the context has a settle queue.settleImportstarts by locking*context.settleQueueMutex, so a context without one threwstd::system_error(EPERM) from the lock.That context exists in the tests: a bare
Devicehas no settle queue. It reached the settle path becausedecideImportWatchkeeps its decision under theVkDevicehandle and the decision outlives the device, so a bare device created at the handle of a destroyed driver device inherits "private imports settle". Since #10443 the floor is just over 64 KiB, and the 128 KiB import ofagc_driver_native_multisample_depthtakes that path whenever the AMD driver reuses the handle (#26649 has the logs).settlesPrivateImportsnow asks the context for a settle queue and its mutex as well as the decision. It replacesstate.watchPrivateImportsat the two places that act on it for one import: the settle at the import (importWatching) and the queueing of a deferred settle. Such an import stays compared, which is what a context with no settle queue gets from a decision of its own. The deferred settle rounds and the dma-buf settle already made the same check.agc_import_settle_deferredgains a case: it imports 128 KiB through a copy of its context with the settle queue cleared and requires a compared import and no settle.The cached decision outliving its device is not changed here and is recorded in the debt fragment: resetting it in
ClearHostImportswould also drop a mode forced withSetImportWatchin tests that clear the imports afterwards.Tested
Windows 11 Pro 10.0.26200, WinLibs GCC 15.2.0 r7, Release. The table was measured with
mainate68be05111, before the rebase ontoeb4300802c.agc_driver_native_multisample_depth,mainagc_driver_native_multisample_depth, this PRmain(test only, no fix)St12system_errormainctest --test-dir build -R '^agc_.*(import|settle)|native_multisample_depth|native_depth|^windows_write_watch' -V -j 2withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationandVK_LOADER_DEBUG=layer, validation layer 1.4.363. Each of the four logs shows the loader inserting the layer 141 times, none haswas not found but was requested, and none has aVUID-line.eb4300802c:agc_driver_native_multisample_depthpasses 20 of 20 on the Radeon and 3 of 3 on the RTX 5080, the new case passes on both, and no log has aVUID-line. The focused set and the overlap check were not run again; the diff is the same.agc_driver_linear_target_import_creation, the same onmainand here and on both GPUs (Windows: agc_driver_linear_target_import_creation fails every run since #10443 (private gate expects a 1 MiB settle floor) #26650). It passes withAPS5_SETTLE_FLOOR_KIB=1024.agc_host_import_sparse,agc_host_import_retire_snapshot, the threeagc_driver_msaa_dcc_compared_importtests andagc_driver_native_depth_driver_queued_fill).python3 tools/check_conventions.pyandpython3 tools/debt_fold.py --checkpass.python3 tools/pr_overlap.py --names ClearHostImports decideImportWatch importWatchinglists no export.--branchcould not compare 46 pull requests that conflict withmain. In their diffs only fix(agc): settle small private color target imports #22550 edits a line this PR edits (thesettledcondition inimportWatching, where it adds aneedsWatchterm), and none adds the settle queue check.maineb4300802cand this branch both build, andctest -R '^agc_.*(import|settle)|native_multisample_depth|native_depth'gives the same result on both: 89 tests, 79 pass and the same 10 skip. The source change and the new case are inside#ifdef _WIN32, so this shows only that the branch builds there and changes nothing. Not built or run on macOS.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)1002:13c0(Adrenalin 26.11.2, Vulkan driver 2.0.353) and NVIDIA RTX 5080 (621.24), Windows 11; lavapipe (LLVM 20.1.2), Ubuntu 24.04.5 under WSL 2🤖 Generated with Claude Code