Repository navigation
Conversation
…was recorded The "uncompressed" key store recorded behind a storage write-back filled the keys' host import whenever the GPU reached it. A title that had released the metadata block by then and reused it (a descriptor table, for one) got the fill pattern over its own bytes; the next dispatch built from such a V# failed in the recompiler with an unsupported format or type. The queued key store now takes a snapshot of the key bytes at record time and the batch stores the 0xff pattern through the changed-copy kernel, so a dword the CPU wrote after the record keeps the CPU's value. A range whose only pending writers are earlier 0xff fills of the same keys stays guarded (the kernel need not repeat them); a pending kernel of the title writing the keys, or a range without a device address or a snapshot, is filled as before. The [labels] line counts the guarded stores; APS5_NO_GUARDED_KEY_STORE=1 restores the fills.
…hat precedes it The publish of the key range's edge units notes a pending write over the keys, which made the key store queued right after it fall back to the plain fill. The publish leaves the key bytes as they are (its slab holds the seed the import had), so the store's snapshot stays exact: publishes note their writes with their own value and the key store treats them like its own fills. (cherry picked from commit a3c8286502a94b13d2fb7676a76c82e87f677d76)
…ded before it A title's DCC key clear is a recorded fill of a known value over the keys. The key store queued behind it saw a pending writer it did not know and fell back to the plain fill, which was a third of the stores in PPSA15304 after boykopovar#5520 and brought the descriptor faults back. The snapshot now predicts the import: the bytes read at queue time with every pending fill of a known value applied in note order, so the kernel stores the 0xff pattern over the clear's bytes and still keeps a CPU store made after the record. APS5_TRACE_KEY_GUARD=1 prints the pending writers of the stores that stay unguarded. The test records a key clear before the store and expects the keys stored, then a late CPU store kept. (cherry picked from commit 3da4934731c9231976f395b8f517bd2b03578968)
…to the CPU The guarded key store stored the 0xff pattern wherever the import still held the snapshot's value, so a CPU store of the value the keys already held (zeroing reused memory that was zero) read as untouched and was overwritten. The queued store now collects the guest writes of its range before taking the snapshot and keeps that generation. When the store is recorded, every 64 KiB block of the range the CPU wrote since then is left as the CPU left it, and the kernel only runs over the other blocks, so a store is kept whatever value it wrote. Without write watching the value compare stays the only guard. The [labels] line counts the key blocks left to the CPU. The test places the keys across a block boundary and adds a late store of the value the keys held.
# Conflicts: # core/libs/prx/libSceAgcDriver/CMakeLists.txt # core/libs/prx/libSceAgcDriver/tests/Recorder.cpp # docs/dev/ENVIRONMENT.md
…of its import's buffer, lead included
…itten blocks to the CPU
…the import is write-watched On hosts that compare host imports instead of watching them, the guarded key store cannot see which blocks the CPU wrote, so the value compare is the only guard there. Key the block expectation on the import's watch mode and note that case in the debt entry.
# Conflicts: # docs/dev/ENVIRONMENT.md
…pped guardedKeyStoreTests returned without a check when host imports or buffer device addresses were unavailable or the host import of its block was refused, and --guarded-key-store-only returned 0 all the same, so ctest reported agc_guarded_key_store as passed with nothing tested. The function now returns whether a case ran, the standalone entry returns 77 when none did (ctest's SKIP_RETURN_CODE for this test), and the full suite goes on as before. A run whose import is not write-watched still counts as run: its first cases complete, only the same-value late store is left out.
# Conflicts: # core/libs/prx/libSceAgcDriver/CMakeLists.txt # docs/dev/debt/libSceAgcDriver.md
# Conflicts: # core/libs/prx/libSceAgcDriver/CMakeLists.txt
# Conflicts: # core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketFlush.cpp # core/libs/prx/libSceAgcDriver/tests/Recorder.cpp # core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake # docs/dev/debt/libSceAgcDriver.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
After a storage write-back the driver records a fill of the "uncompressed" DCC keys into the keys' host import (
StoreUncompressedOnGpu,Recorder::QueueKeyStore). The fill lands whenever the GPU reaches it. A title that waited for its label, released the metadata block and reused it for something else had the 0xff pattern written over its new bytes. In PPSA15304 the reused block held a descriptor table, and the next dispatch built from it stopped the title in the recompiler:The change:
APS5_NO_GUARDED_KEY_STORE=1restores the fills, and the[labels]line counts the guarded stores.APS5_TRACE_KEY_GUARD=1prints the pending writers of the stores that stay unguarded.[labels]line counts those blocks. Without write watching, the value compare stays the only guard. Key dwords in such a block that the CPU did not write keep their old value instead of 0xff: write watching does not tell which dwords of a 64 KiB block were written, and the alternative, the value compare, overwrites a CPU store of the value the keys held. This is intended and recorded indocs/dev/debt/libSceAgcDriver.md.HostImportDeviceAddress, built on fix(agc): copy only the dwords a shader changed back from a GPU-copied buffer boykopovar/AnyPS5#6185'sHostImportBufferStart), so an import whose buffer starts below its range (lead) is addressed at the keys.Scope: the guard covers the deferred key stores; the unit shadow publishes (slab to import) stay unguarded, since a kernel over every published dword read the snapshot and the import over PCIe and halved the present rate of PPSA15304. boykopovar#4794 stores results right behind the draw instead; on this title that mode (then
APS5_EAGER_WRITEBACK=1) ran at 0.3 presents per second against 15 to 20 per 10 s with the deferred path and this guard, so the deferred path stays the one heavy titles need, and this guard keeps it safe where it crashed.Tested
Linux, Ubuntu 24.04, NVIDIA GeForce RTX 5080 (driver 595.99.02). New test
agc_guarded_key_store(a key clear recorded before the store: the keys end up stored; CPU stores made after the record survive, including one of the value the keys held, and the keys of a block the CPU left alone are stored).ctest -R agc_passes. PPSA15304 on currentmainwith boykopovar#6185 alone stopped three times after 10 to 11 minutes in the section after the first drop with the descriptor fault above; with this change two runs of 20 and 25 minutes of continuous movement showed no fault, with 99.6 percent of the key stores guarded. Upstream'sAPS5_STORE_AT_LABEL=1did not prevent the fault in the same section.Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repository