test(shader): skip open-entry cache replacements where SMB has no POSIX rename #11434
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11434"
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 LeandroLP23 on 2026-10-26T13:17:23Z.
What
Fixes #10833 the way agreed there (option 1): replacement stays atomic, and the tests skip only what an SMB share cannot do.
On Windows
WriteFileAtomicallyreplaces a cache entry with a POSIX-semantics rename (SetFileInformationByHandleclass 22,FileRenameInfoEx), so readers and mappings of the old entry keep working. Through an SMB share that rename fails withERROR_INVALID_PARAMETER, and thestd::filesystem::renamefallback is refused while the destination is open or mapped. The issue's NAS and\\localhost\C$(Windows' own SMB server, over NTFS) behave the same; the error codes are in https://github.com/boykopovar/AnyPS5/issues/10833#issuecomment-6411899172.With the first skip in place, the tests reached three more places that need the same operations:
verifyStoreandverifyPersistreplace an entry thatShaderDiskCacheitself has mapped withMapViewOfFileafter loading it. A mapping blocks the plain rename just like an open reader.removeCacheDirectorydeletes withFileDispositionInfoExandFILE_DISPOSITION_FLAG_POSIX_SEMANTICS, which SMB also rejects withERROR_INVALID_PARAMETER, and the entries the cache still maps can't be deleted there.shader_cache_file_readbuilt the\\?\alias of a UNC path as\\?\\\server\share\…; the extended form of a UNC path is\\?\UNC\server\share\….Changes:
ShaderCacheDirectory.hpp: the POSIX rename moves unchanged intoPosixReplaceByHandle, whichWriteFileAtomicallycalls as before, so production behaviour does not change.PosixReplaceUnsupported(directory)probes that rename on two scratch files in a directory and reports onlyERROR_INVALID_PARAMETER.agc_shader_disk_cache: where the probe reports it,verifyAtomicReplacementskips the retained-reader replacement,verifyStoreskips the truncated- and damaged-entry checks, andverifyPersistskips replacing the mapped persisted entry, each printing why. Any other replacement failure still fails. The cleanup falls back to a plain delete only when the POSIX delete returnsERROR_INVALID_PARAMETER, and then leaves the directory behind with a note instead of failing.shader_cache_file_read: the UNC alias fix, and the retained-reader replacement is skipped under the same probe. A plain replacement without a reader is still checked there.docs/dev/debt/shader.md: a "Shader cache directories on SMB shares" entry records that such a cache directory cannot update an open or mapped entry, including one this process's cache has mapped, and why replacement stays atomic.Tested
Rebased onto
main9656d366be(head8259ecb26d); on the RTX 5060 Ti the whole table below and the validation run were repeated on the rebased head and on9656d366be, with the same results. The first runs, on both machines, were on base7b415520b6.Same commands on two machines,
TEMP/TMPset to a local NTFS directory or to\\localhost\C$\aps5-smbtmp, each test 3 times, on this head and on its basemain7b415520b6:TEMPmain(both machines)agc_shader_disk_cacheshader_cache_file_readagc_shader_disk_cachecannot replace cache entry with a retained readershader_cache_file_readverifyStore/verifyPersist/cleanup changes, a local build that ran everyverify*case undertry/catchlisted the failing SMB cases: onlyverifyStore(cannot truncate the entry) andverifyPersist(cannot replace the persisted entry), then the cleanup's POSIX delete. The other 31 cases pass on the share unchanged.ctest -V -R "shader_disk_cache|shader_cache|pipeline_cache|pipeline_journal"withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(Vulkan SDK 1.4.363.0): 27/27 on this head and onmain, on both GPUs, with noVUID-lines and nowas not found but was requested by env var VK_INSTANCE_LAYERS. WithVK_LOADER_DEBUG=layer, four of these create a device and showInsert instance layer "VK_LAYER_KHRONOS_validation":agc_pipeline_cache_header,agc_pipeline_cache,agc_pipeline_cache_fileandagc_driver_pipeline_journal; the disk cache tests themselves are CPU-only.\\localhost\C$reproduces the issue's failure and error codes.check_conventions.py --base origin/mainpasses.pr_overlap.pyfinds no conflicting comparison; PRs that already conflict withmain(#6235, #6280, #6412, #6488, #6924, #7484, #7684, #8004, #9387, #9748, #10049, #10233) shareShaderDiskCache.cppor the shader debt file and were not compared.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 MarcZX10 on 2026-10-26T15:43:50Z.
Review: CHANGES_REQUESTED
I reviewed the Windows SMB probing/fallback and its test changes on exact head
8259ecb26dac1890717b823dd42f9558eb4fa9a4. I found no implementation defect in the boundedFILE_RENAME_INFO_EXbuffer construction or the fallback behavior. The author reports repeated Windows runs on two GPUs and local NTFS plus\\localhost\C$, including the cache test matrix and validation-layer comparison. I did not independently run those Windows tests. Current conventions,git diff --check, and the merge-tree preview pass; hosted Linux/Windows product jobs are path-skipped.Before merge, please sync this branch to current
main(b0f1183ca12b). Its tested base is9656d366be; the intervening commits do not touch this PR's implementation, tests, or debt entry, and the preview merges cleanly. This is the remaining branch-freshness requirement fromCONTRIBUTING.md.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T15:52:22Z.
Review: APPROVED
Re-reviewed exact head
b95b22cf1622, now based on livemainda89f18ea7c1. The rebase preserves the reviewed one-commit implementation and reported Windows SMB/NTFS regression coverage; no source or test files changed between the tested base and thismain. The current-main merge preview, conventions and whitespace checks pass. Linux and Windows relinker plus ASan checks pass; macOS relinker jobs are still running/queued, and runtime product tests are skipped by path policy. I did not independently run the Windows/GPU tests. The earlier branch-freshness request is resolved. Approved.