agc_hook_clear_access fails on Linux when host imports are compared: a pending image's results are dropped #21627
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 edubox on 2026-11-16T13:41:11Z.
agc_hook_clear_access fails on Linux when host imports are compared: a pending image's results are dropped
What happens
ctest -R agc_hook_clear_accessfails on themainLinux job withAGC graphics: (e) the flush hook did not store the pending image's results it read.agc_hook_clear_access_offfails the same way; both areagc_driver_recorder_tests --hook-clear-access-only.Title, test or build step
ctest
agc_hook_clear_accessandagc_hook_clear_access_off(core/libs/prx/libSceAgcDriver/tests/Recorder.cpp,hookClearAccessTests), on Linux with llvmpipe and without a usable/dev/udmabuf, that is with[write-watch] host imports resolve write protection: yes ...; imported ranges are compared.AnyPS5 commit
origin/maine4caa07950f(dcf3d15978cfails the same), Release build,ctestfrombuild/. The Windows job passes this test.main's Linux job has no green run in the last 300 workflow runs to compare against, so I cannot say whether this is new.System
Linux, AMD Ryzen 9 9900X; the failure reproduces with Mesa lavapipe (
llvmpipe, Mesa 26.2.6), which is what the CI Linux runner selects. On this machine's NVIDIA RTX 4080 SUPER and RADV the test skips itself withskipped, the device reports watched host memory written when it imports or reads it, so llvmpipe is the only way to reach the failing path.Steps to reproduce
lavapipe does not have to be installed to be used:
It exits 1 with the message above and exits 77 (skipped) without
VK_ICD_FILENAMES.What the trace says
With
APS5_TRACE_FLUSH=1:So the step (e) access does reach the write-back (
StorageTexture::FlushPending→writeBackLayers) and the write-back itself decides the one 64 KiB block it needs is CPU-written since the image's generation 9, storing nothing. It is not theAccessKeptByCpu/C4 skip: forcing that off still fails here, through the samewriteBackLayersdecision.Instrumenting
WriteTracker::stampfor every non-driver stamp, the stamp that makes the block CPU-written is[stampdbg] block 0x7fe010890000 gen 11 kind 0 tag observe: kindCpu, from anobserve()walk (CollectWrites/CollectWritesUncached), generation 11 against the image's generation 9. The same block was already stampedgen 4 kind 0 tag observeearlier in the run, and the only CPU writes the test makes are thestd::memset(block, 0x55, allocated)before the image exists. Everything else in the block comes from GPU clears and from the driver's own write-backs, whichstoreOwnstampsStampKind::Driverand records as driver pieces.Since
blocksKept/ChangedBlocksdecide "the CPU wrote this block since the image's generation" fromcpuStampOf(block) > generation, a collect that re-attributes bytes to the CPU after a later generation exists makes a pending image's results vanish. The same hold forStampKind::ImportWindow, whichstamp()also counts incpuBlocks.What I could not settle
Where the fix belongs:
Cpu(theCpuwalkstoreOwnmakes before its store, or the import windows, both of which can land after a newer image's generation), orcpuStampOf(StorageTexture::blocksKeptfor the hook skip and thecpu[]ofGuestMemory::ChangedBlocksfor the write-back), by requiring that the newest stamp of the block is a store that really came from the CPU.I did not change either:
cpuBlocksis what keeps the CPU's bytes over an image's during a write-back, so narrowing it can make stale GPU results overwrite CPU data in titles, and that trade-off needs the owner's call.Instrumentation I used
git diffof the two debug prints (thestampdbgline inWriteTracker::stamp, andwritetrapinWrittenSince), plus thewalkTagthread-local that labels eachwalkWritescall site. They are not part of any branch.The full patch with the
walkTagassignments is in my worktree; I can attach it here if it helps.