fix(agc): honor release memory L2 write-back requests #18956
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/18956"
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 mjnhbg3 on 2026-11-12T16:05:36Z.
What
A RELEASE_MEM that explicitly requests GL2 write-back can make its completion label visible while a larger tiled storage image still has unpublished results. A later readback can then overwrite CPU stores made after that completion, including stores whose values match the image's earlier contents.
The production change is in shared AGC code, with no host CPU architecture-specific path.
Honor the GCR GL2_WB bit before the release's label, interrupt or cache-only completion. Publish pending image, depth and unit-shadow results, exclude these releases from label batching, and stop dispatch look-ahead at the boundary. Reject unsupported scope/discard/sequence fields, event/index combinations, queued-read ownership and concurrent image publication instead of reporting completion. The limits are recorded in the AGC driver debt file.
The supported event and cache fields follow AMD PAL commit
c5e800072a32f68b6ccc4422936d96167c6e0728: GFX10 GCR layout, release construction and event restrictions. This is source-based validation, not a console measurement. Ordinary releases without GL2_WB, including ordinal20x514, keep their existing path.The synthetic regression builds on JJenkx's published larger-surface fixture and controls. Closed #6960 is relevant prior work; this change honors an explicit cache request rather than flushing every image at every label. The test checks publication at completion, subsequent changed and identical CPU stores, untouched GPU-written bytes and allocation guards. It contains no game shaders or dump data.
Rebased onto pinned main
4e866156c12d1eeea1002e02b737cd0f71db6908. Main's merged #20127 GCN seven/eight-dword size gate and both seven-dword checks precede the new write-back checks; its GCN system-counter allowance remains afterward. The seven-dword control mask excludes bit 21, so those packets cannot enter the new GL2 write-back route. The debt edit is now an add-only fragment indocs/dev/debt/changes/gpu-completion-reuse-rebase.md.The optional review points were checked against the pinned source: bit 20 is GL2 invalidation, already covered by the acceptance test, and is intentionally outside the unsupported-scope mask. CMake registers the default execution case before loading the timeout fragment. The unregistered legacy mode explicitly reports a diagnostic with no asserted cache-visibility contract and is excluded from acceptance counts. The PAL line anchors above and in the debt fragment were corrected.
Tested
Fresh matched runs on 2026-11-16, from an isolated checkout: Windows 11 ARM64, native Qualcomm Adreno X1-85 (vendor
0x5143, device0x36334330), Qualcomm Vulkan driver0.863.0/ Windows display driver31.0.152.1, Vulkan API1.3.295, WinLibs GCC 15.2 Release. Both arms configured and built the same 13 focused targets with compiler caching disabled; generated revision metadata recorded the exact clean source head. The test-local PRXs matched the active build outputs, and all 23 recorded EXE/runtime artifacts stayed unchanged during each run.Production main is pinned to
4e866156c12d1eeea1002e02b737cd0f71db6908; the candidate is590c15c57d8cf98498fda6a5b547cf06d71cdcfd. The main-side negative control was local fixture commit8b4d0cb9bd7271d9794f7e0c803ffc4b1272941b: main plus only these identical test files copied from the candidate, with every production file unchanged:core/libs/prx/libSceAgcDriver/tests/execution/StorageCompletionReuse.cppcore/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_storage_completion_reuse_tests.cmakeAll 49 case names, commands and per-case environment settings matched. The same child-only settings were used in both arms:
ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,VK_LOADER_DEBUG=layer, SDKVK_LAYER_PATH, andANYPS5_GPU=Qualcomm(R) Adreno(TM) X1-85 GPU. The normal installed loader was used with no ICD override or staged loader. Actual project output proves every one of the 44 hardware cases selected the native Qualcomm GPU, loadedqcvkarm64xum.dll, and inserted the validation layer. The five CPU contract cases do not initialize Vulkan. The layer API was 1.4.363, newer than pinned Vulkan-Headers 1.4.335.The 19 failing negative controls become passes; all 25 existing case verdicts remain unchanged. The five already-passing new controls are the four small-size variants and
consumer_ahead. Both CTest processes honestly exited 8: the pre-existingagc_driver_label_ordered_flushstill fails withno label store took the GPU-ordered flush over the host import, and seven unsupported-path cases still skip. This is not an all-green suite or complete coverage of those skipped paths. No new failure, skip orVUID-error was added; neither log containswas not found but was requested by env var VK_INSTANCE_LAYERS.Exact focused command and unchanged skips
With the child settings above, both arms ran:
The same seven cases skipped in both runs:
agc_driver_copied_writer_label_orderagc_driver_unimported_label_orderagc_driver_unregistered_label_on_gpuagc_driver_copied_writer_label_order_drainagc_idle_publish_waitagc_driver_unimported_label_order_draw_pipelineagc_driver_unimported_label_order_plan_verifyFull verbose logs, raw JUnit, source/build receipts, per-case native-driver/layer evidence and artifact hashes were retained outside the repository. Main raw log SHA-256:
1dcec4185ef57ae66c0a8b75034469080ccac7a63b9d353d61fe29efb15a8371. Candidate raw log SHA-256:f3a74ceb957709ef35c8f7ffc584f2df70df0a2c8b4408bad3a50fb859e94dd3. The original baseline collector receipt is preserved alongside a separately derived classification receipt; only the source-backed classification of three CPU-routed predicated WRITE_DATA tests changed, with no rerun or alteration of results/settings.python3 tools/check_conventions.py --base origin/mainpasses on the final candidate. Its own debt fragment folds successfully as exactly one added Functional entry. Whole-repositorydebt_fold.py --checkfails identically on both main and candidate because the unrelateddocs-nkwebkit-drop-readded-count-lines.md:5fragment cannot find5933 of the 8703; no unrelated debt fix is included.Overlap was refreshed against the exact final main/candidate pins: 1,776 open PRs scanned, 77 peers selected, 34 with no findings, 43 uncompared including this PR's own old head. The checker exit remains 2. All 42 independent uncompared peers received manual shared-hunk review; their heads, original before/after blobs, patches and selected paths are unchanged in the refreshed packet. No independent duplicate explicit GL2 write-back implementation or current prerequisite was identified. The expected self-comparison against old head
6adb3d70822228f9ef783573353058f6cfd341d9is separate from independent overlap. The C-export name scanner does not establish overlap for these C++ helpers; manual source review supplies that check.Future integration needs care with #5925's dispatch scans, #10442's early labels, #15136's deferred serial capture, #18914's PM4 refactor, #17338's pending mutex, #13920's publication path, #9508's indexing, #13251's alias exemptions and #13863's lane behavior. These are not open dependencies. Earlier neighbors #9893, #16011, #17999 and #20127 are merged into the pinned main. This is a review of pinned shared changes, not a claim that all peer PRs build or run together. The complete evidence packet independently verified 448 objects / 219 file records; manifest SHA-256
bd675bccd94f55e586efdd26dae56deea781fca7e4408fa1e7025aa0c3bcccfb.Independent source review found no material blocker and confirmed the nine original code/test deltas and author metadata were preserved through the rebase. No PS5 comparison, title run or performance claim is made. Earlier AMD/NVIDIA reports in comments apply to old head
6adb3d7, not this refreshed matrix.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-11-12T16:09:47Z.
Review: COMMENTED
Reviewed the GL2 write-back release change — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
6adb3d70822228f9ef783573353058f6cfd341d9, basemain. This matches the reviewed head in the run folder.repo_read.py): theFlushPendingandStoreBeforeReleaseneighbourhood, theRELEASE_MEMvalidation, the packet call site, theRequirehelper, and the test wiring in the AGC driverCMakeLists.txt.Results
"release"Findings
Blocking
None verified.
Non-blocking
core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp:532masks0x00cf0000for scope, discard and sequence bits. Bit0x00100000is not in the mask, and no test intests/Pm4.cppchecks it either way. If that bit is a scope field, a release that sets it is accepted without the rejection the description promises.core/libs/prx/libSceAgcDriver/tests/execution/StorageCompletionReuse.cpp:358returns 0 whenreleaseFlagsis0x514, even iffailuresis nonzero. Thelegacymode is accepted bymainbut not registered in the cmake fragment, so a registered run cannot reach it. A manual run with that mode reports failures and still exits 0.core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_storage_completion_reuse_tests.cmake:4sets a timeout onagc_driver_storage_completion_reuse. That test name is never registered in the file, so the property applies to nothing.Not verified
agc_driver_label_ordered_flushand the seven skips, was not reproduced.Graphics/src/Texture.cpp,Graphics/include/Texture.hpp,Execution/include/Pm4.hpp,Execution/src/Driver/Dispatch/DispatchAhead.cpp,tests/Pm4.cppordocs/dev/debt/libSceAgcDriver.md. Those files were checked at their changed hunks and the context shown above. OnlyExecution/src/Driver/Packets/PacketMemory.cppwas read in part from the run folder. No verdict is given over the unread parts of these files.Requirecalls (Texture.cpp:4958,4982,5472,5476, and thePm4.cpp:532to537checks) throw frompreparePacketMemory, which is called atPacketExecution.cpp:400. Whether an outer handler catches the throw was not read.0x00100000is a scope field in the cited PAL layout was not checked.ClockStamp, which is the steady clock divided by 10. Whether the driver'sDATA_SEL 3uses that clock was not read.StoreBeforeReleasepasses the full address range (Texture.cpp:5483), so every explicit write-back publishes all pending images. The cost was not measured, and the description makes no performance claim.To get this to a good state
Nothing is required. The non-blocking points above are optional.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T06:12:54Z.
Review: APPROVED
Reviewed — looks good
Nothing in the inspected changes blocks merging; the reported focused runs support the release write-back behavior.
What I ran
Reviewed head
590c15c57d8cf98498fda6a5b547cf06d71cdcfd. I did not run commands or tests; the test and convention results below are author-reported. No merged-preview check was run.Inspected all nine changed files listed as
reviewedin the manifest, including the texture implementation through the pinned reader.repo_read.pywas not available as a shell command in this review interface; repository reads used the provided pinned reader tools.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
I did not independently run the reported Windows ARM64 test matrix, the convention checker, or debt checks. The author reports 7 skipped cases and one pre-existing failing test, and explicitly makes no PS5 comparison, title-run, or performance claim. These results were not independently confirmed.
To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T22:17:18Z.
Review: COMMENTED
The trial merge onto
a1b75b0947was clean. I checked the order from packet validation through publication to label or interrupt completion. Please retain a write-back case with pending work when testing a release with zero data, alongside the existing parser checks. Parser acceptance cannot show that a cache-only release actually publishes before later packets execute. Paired PM4 and Vulkan storage-publication controls are pending.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.