fix(agc): exclude skipped vertex records from target alias checks #4408
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4408"
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 santhoshkumar-dev on 2026-10-12T09:44:39Z.
What
Direct vertex inputs treat every byte from the descriptor base through the last fetch as live. With stride 16 and firstVertex 4096, a target in the skipped first 64 KiB incorrectly causes
vertex buffer aliases the render target, although the three vertices read only bytes 65536 through 65583.Use the first vertex or first instance to bound the alias check. Indexed draws retain index zero as a conservative lower bound before adding the base vertex; indirect draws retain the full descriptor extent. Copy planning and buffer-binding origins stay unchanged. Actual vertex/target overlap, zero-stride overlap, and the existing index/shader-buffer alias checks remain rejected.
The existing flush hook orders pending GPU writes, storage-image writeback and shadow publication before a copied snapshot or imported vertex input. Same-draw overlapping-byte console ordering remains unverified and unsupported, as recorded in the AGC technical debt file.
Rebased onto
mainad653c9bc(PR head44623222c). The technical debt entry now uses the upstream split layout.Related to #4369, but this PR does not claim to fix Slay the Princess. The reporter identified intermittent
0xff000000index data with firstVertex 0, a separate cause from the skipped-prefix false positive. Later, plainmainffa198407also completed three 150-second control runs without the abort, so the earlier apparent improvement with #1359 was withdrawn. The latest maintainer request is for three more current-main runs and closure if clean.Tested
Local revalidation after the rebase: Windows 11 Pro 10.0.26200, MinGW-w64 GCC 15.2.0, Release, RX 6700 XT, driver 32.0.21045.5002, full CMake configuration with BUILD_TESTING=ON. Affected runtime and recorder, graphics, vertex-fetch and zero-stride test targets built. No title dump used.
agc_driver_vertex_target_range_copiedandagc_driver_vertex_target_range_imported,agc_driver_graphics, both vertex-fetch tests, pipeline cache/library tests, in-place draw inputs, snapshots, shadow publication, host-import lifetime and storage-buffer ordering.ad653c9bc: keeping the regression fixtures but restoring only main's Draw.cpp makes both range regressions fail withvertex buffer aliases the render target(0/2, 0.61 s). Rebuilding with the PR's Draw.cpp restored makes both pass again. The prior default-setting AMD crashes in pipeline cache/library and vertex-fetch tests were not observed in this focused rerun on the rebased tree.tools/pr_overlap.pylogic, excluding this PR, found no overlap with other open pull requests.Independent reports on the original head:
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 santhoshkumar-dev on 2026-10-12T09:49:58Z.
@xXPBSXx Could you test this branch with Slay the Princess and check whether it gets past the
vertex buffer aliases the render targetfailure reported in #4369?The fix covers a verified false positive where the alias check includes an unused vertex-buffer prefix skipped by
firstVertexorfirstInstance. Both synthetic GPU regressions pass, but we haven't confirmed that your failing draw has the same cause. Please let us know whether the original error still occurs and whether you encounter a different failure afterward.Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T10:54:54Z.
@santhoshkumar-dev you asked for a Slay the Princess run. Result first: it does not get past
vertex buffer aliases the render targetwith this PR, and I think the cause is different from the skipped prefix.Tree and tests: this PR (clean merge) on
maine7c70a2df+ #3840 (needed by this title forfcntl), Windows 10, MinGW GCC, Release, RTX 4080 SUPER.agc_driver_vertex_target_range_copiedand..._importedpass, and so doesagc_driver_graphics(3/3ctest, 13.4 s).Title: PPSA24423 relinked from its decrypted ELF, 0 absent imports; it runs about 79 s and ends with the same
what(): AGC graphics: vertex buffer aliases the render target.Why it does not apply here (details and a local diagnostic that prints the draw, on #4369): the failing draw is an indexed draw of 6 32-bit indices read from
0x39a418000, and all six are0xff000000. The vertex V# is sane (848c8000 00080003 00000004 0004022c, 4 records, stride 8) and the draw has firstVertex 0, but the highest index0xff000000times stride 8 makes the range0x7f8000008bytes (about 32 GiB), which covers the 1080p color target at0x385c30000. So the range is wrong because of the index data, not because of an unused prefix; this PR keeps index 0 as the lower bound for indexed draws, so the overlap stays. I do not know yet why the index memory holds0xff000000(my guess so far is data written too late or a clear that reached it); that is on #4369.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-12T13:16:26Z.
Ran this on AMD hardware, since the GPU tests in CI only use lavapipe: Windows 11 (26300), AMD Radeon 860M (RDNA 3.5, driver 32.0.13058.8001), WinLibs GCC 15.2.0, Release,
BUILD_TESTING=ON. Head8097648f9merged ontomainf8dee0595, together with #4445: on this GPU,maincrashes 47agc_tests insideamdvlk64.dllwithout it (#4435), which would hide anything else.ctest -R '^agc_' -j 1: 437/437.ctest -E '^agc_' -j 4: 530/530.agc_driver_vertex_target_range_copiedandagc_driver_vertex_target_range_imported: 3/3.main'sDraw.cpprestored, both of those fail.I don't have Slay the Princess, so this doesn't cover the title.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by santhoshkumar-dev on 2026-10-13T08:37:32Z.
Marked ready for review at
44623222c, rebased ontomainad653c9bc. Before doing so I checked this PR's comments/reviews, its six cross-referenced threads (#4369, #1359, #4073, #3709, #419 and #4411), and repository issue/PR and discussion searches. There are no outstanding inline review requests.Updated and verified
APS5_NO_PIPELINE_LTOoverride. This includes both copied/imported regressions, graphics validation, pipeline cache/library, vertex fetch, zero-stride fetch, draw-input/snapshot, shadow, import-lifetime and storage-ordering checks.Draw.cpp:mainad653c9bcvertex buffer aliases the render targetWhat the other reports establish
0xff000000indices with firstVertex 0 are a different cause from a skipped descriptor prefix. This PR did not fix that failure on the tested older tree. The proposed benefit from #1359 was withdrawn after the same-main control also passed. The maintainer's request remains three more current-main runs, closing #4369 if clean; no causal title-fix claim is made here.Still unchanged or unverified
The fix only excludes an unused prefix from the alias test. Copy/binding origins and real-overlap rejection remain unchanged. Same-draw reads of active target bytes remain unsupported, and console ordering is unverified. No title-specific workaround, index-data/CPU-write ordering fix or new dependency was added.
Depends on: noneandUnblocks: noneremain accurate. No local title run, full repository suite, Linux run or console-hardware result is claimed.Full CI request
Could a collaborator with upstream write access run the Build workflow for this revision? Full Linux/Windows tests and the relinker matrix are still pending; the automatic PR checks do not run them. This account cannot dispatch the upstream workflow under the repository's access rule.
AI-assisted: OpenAI Codex.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T14:15:29Z.
Checked on current main: both new
agc_driver_vertex_target_range_*tests pass and fail withDraw.cppreverted;agc_driver_graphicspasses. Indexed draws keep index 0 as the lower bound, indirect draws the full extent, so real, zero-stride and index aliases are still rejected.agc_driver_tessellationsegfaults here with and without this change. Merging once the full Build is green.