test(agc): delete mapped shader cache entries with POSIX semantics on Windows #6415
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6415"
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 GitamarT045T3R on 2026-10-15T14:27:45Z.
What
On Windows 10,
agc_shader_disk_cachepasses every check and then fails at the end ofmainwithcannot remove the shader cache test directory: Access is denied, leaving%TEMP%\aps5-shader-disk-cache-test-*behind.The disk cache maps entry files (
MapFileinShaderDiskCache.cpp) and the variants decoded from them keep the view:LoadandPersistresults stay in the recompiler's source cache for the life of the process. The finalstd::filesystem::remove_alldeletes withDeleteFileW, which refuses a file that still has a mapped view withERROR_ACCESS_DENIEDon Windows 10 22H2 (19045). At cleanup, 18 of the 88 files in the test directory are such entries.The test now deletes each file with
FILE_DISPOSITION_FLAG_DELETE | FILE_DISPOSITION_FLAG_POSIX_SEMANTICSbeforeremove_allremoves the directories, the same POSIX semanticsWriteFileAtomicallyalready uses to replace entries. The views stay readable after the name is gone. The test still fails when a file cannot be deleted or the directory cannot be removed: a file held open withoutFILE_SHARE_DELETEmakes it fail with the sharing violation. Linux keeps the plainremove_all.The runtime is unchanged. It never deletes an entry the process maps: housekeeping only removes other source versions' directories unused for 14 days and
.tmp.files older than an hour, and replacing a mapped entry already works throughWriteFileAtomically.On this machine, deleting a file mapped the way
MapFilemaps it (handles closed, view kept):std::filesystem::remove,DeleteFileWERROR_ACCESS_DENIEDSetFileInformationByHandle(FileDispositionInfo)ERROR_ACCESS_DENIEDFileDispositionInfoEx,DELETE | POSIX_SEMANTICS | FORCE_IMAGE_SECTION_CHECKERROR_ACCESS_DENIEDFileDispositionInfoEx,DELETE | POSIX_SEMANTICSDeleteFileWalready removes an open, unmapped file's name at once here, so it uses POSIX semantics. It fails on mapped files the same way the image-section check does. The Windows CI job runs onwindows-latest(a newer Windows Server) and passes this test, presumably becauseDeleteFileWthere accepts mapped data files; this was not checked on that image.Tested
Windows 10 Pro 22H2 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Ninja, Release,
BUILD_TESTING=ON, onmain940eba9a2:main):agc_shader_disk_cachefails withcannot remove the shader cache test directory: Access is deniedand leaves its directory in%TEMP%.ctest -R '^agc_shader_disk_cache$' --repeat until-fail:5passes 5 of 5 runs, about 1.6 s each, with no directory left behind.ctest -R 'shader_cache|disk_cache'(shader_cache_file_read,shader_cache_native_paths,agc_shader_disk_cache) passes.python tools/check_conventions.py --base origin/mainpasses._WIN32; elsewhere the cleanup is the sameremove_allmoved into a function.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)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T14:34:06Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppL58Some 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.
core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppcore/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppcore/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppcore/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppcore/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppcore/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppcore/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppImported from boykopovar/AnyPS5. Originally posted by GitamarT045T3R on 2026-10-15T14:44:33Z.
I checked the four PRs listed by the overlap bot by hand. None of them overlaps with this one, and none fixes the same failure:
ShaderDiskCache.cppchanges(...)line inverifyKeySensitivityverifySpecializationDropsDeadConstants, called frommainjust above the cleanup this PR replacesmain(the<set>include and the plan fixtures)changes(...)line inverifyKeySensitivityverifyKeySensitivityHow I checked: I merged each PR's version of the file (three-way, from its merge base with
main) intomainand into this branch. In every case, merging into this branch gave the same result as merging intomainplusremoveCacheDirectory. This branch also still merges cleanly intomainff23657f3.