test(agc-driver): retire the unit shadow block's import before releasing it #2299
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2299"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-09T15:00:33Z.
What
Fixes the device loss reported in #2155 (
vkQueueSubmit recorder: Vulkan result -4at the start ofstorageRefreshTestsinagc_driver_recorder_tests).On Windows, host imports are compared, not watched, so
unitShadowTestsreturns right after it imports its 17 MiB block. Its cleanup then removes the registration and releases the block. The import itself is only retired at the next lookup, which is theHostImportForinstorageRefreshTests. ItsvkFreeMemoryfrees an import whose pages are already gone. The Vulkan spec requires an imported host range to stay valid for as long as the memory object exists.Unregisternow looks the range up once more after removing it, as the cleanups inkeysFillTestsandstorageRefreshTestsalready do. The import is retired while the block is still committed.Tested
Windows 10 (19045), RTX 3060 Laptop (NVIDIA 616.92), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release.
agc_driver_recorder_testswas built with--target.maind70b8998main+ this PRmain+ #2248main+ #2248 + this PRWith
vkQueueWaitIdleprobes around each step, 7 of 20 runs lost the device. In all 7, the queue was healthy just before the retire'svkFreeMemoryof the 17 MiB import and lost right after it.A local probe mode (not part of this PR) imports a 17 MiB block, releases it, and lets the next lookup retire the import:
The window fits the late NVIDIA marks on imported pages, about 1.2 to 2 ms after the import, from #1434.
tools/check_conventions.pypasses.The runtime unmap path has the same order:
GuestAllocationsUnmap_nid_postfixreleases the pages inapplybefore the registry changes, andrefreshImportsretires the import later. I haven't checked whether a title ever releases memory within that window. This PR only changes the test; the runtime order is filed as #2352.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T17:07:56Z.
I reviewed the full diff. The cleanup retires the test import after removing the registry range but before
ReleaseWatchedreleases its pages, which matches the reported Windows failure window. The exact-head targeted Windows evidence is strong, including the 30/30 combined run with #2248; Conventions is green. The full Linux/Windows Build matrix was skipped, though. Could an authorized collaborator dispatch it on this PR head before merge? Although both PRs touchRecorder.cpp, their changes cover separate tests and complementary failures from #2155; #2248 remains the canonical refresh-store regression change.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T18:47:12Z.
Related production-path fix for #2352
I pushed a general guest-unmap lifetime fix to my fork branch, tracked in issue #2352. For guest ranges going through
GuestAllocations::Mutation::Unmap, the pin waiter now receives the mutation range, drains pending GPU work, and retires every overlapping host import before the unmap callback releases its pages. A recorder regression check verifies the import is already gone inside that callback.For the runtime unmap defect, this is broader than changing only the
unitShadowTestscleanup. The targeted Linux/GCC 12.2 build andagc_driver_recorder_tests --host-import-unmap-onlypass on lavapipe. Windows hardware and the required full upstream Build matrix have not been run for that branch.I would keep the changes distinct pending maintainer review: this PR's cleanup may still be needed for the
unitShadowTestsfixture if its teardown does not use the public guest-unmap path. The production branch addresses the general runtime lifetime ordering rather than replacing this fixture-specific coverage.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T21:32:53Z.
I consolidated the two complementary #2155 recorder-test fixes in Marc's existing #2248, which now targets the current
mainand includes both focused changes in separate commits. The unit-shadow import-retirement commit preserves this PR's original author and commit attribution.The changes address separate failure modes in the same
agc_driver_recorder_testsexecutable: #2248 covers untracked storage refresh visibility, and this PR covers retiring the unit-shadow host import before releasing its backing block. The existing combined Windows run reported 30/30 passes with both changes. On the rebased combined branch, Linux build and recorder executable also pass; that Linux runtime has no write watching and does not validate the Windows device-loss path.Since #2248 now carries both changes and their combined evidence for #2155, it is the consolidated candidate for review. I have not changed this PR or its branch. Please coordinate with the author and maintainers whether this PR should be closed in favor of the combined #2248, or kept open for separate review.