test(agc): drop a shared range's backing when the range goes away #5759

Merged
YossiYad merged 1 commit from upstream-pr/5759 into main 2026-10-15 13:58:32 +00:00
YossiYad commented 2026-10-14 09:42:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by YossiYad on 2026-10-14T09:42:58Z.


What

agc_host_import_sparse (added with #5309) fails on my machine on main:

FAIL: a failure at vkQueueBindSparse after the sparse path was chosen did not throw (got "")

The test's Resolve callback searches a global backings list of Backing*, and each SharedRange adds a pointer to its own Backing. The ranges are locals of each check and nothing removed them from the list, so by the fourth check it held pointers into stack frames that had been reused. With a temporary print in createSparseDmaBufImport, the fourth check's range resolved to offset=46330441829925 and a descriptor with st_size=0. The sparse path was therefore not chosen, the range fell through to the whole-range UDMABUF_CREATE (refused above the 64 MiB limit, which logs falling back to copies), and nothing threw. Whether it passes depends on what the compiler leaves in those frames.

SharedRange now removes its Backing from the list in its destructor. Test-only change; GuestBufferMemory.cpp is untouched.

Tested

Linux (Bazzite 44, GCC 16.2.1, Ninja, Release, -DBUILD_TESTING=ON), RX 7700 XT, /dev/udmabuf accessible, size_limit_mb 64, based on main 1a40d3d81:

  • agc_host_import_sparse: fails on main, passes 20 of 20 (--repeat until-fail:20) with this change.
  • With if (bound != VK_SUCCESS) return false; in place of the vkQueueBindSparse throw, the fixed test fails on both of that check's assertions, which the old test could not show here because it never reached that path.
  • tools/check_conventions.py --base upstream/main and tools/pr_overlap.py (no overlap) pass.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; no silent stubs added
  • No notes, investigation .md files or images added to the repository
  • No new third-party code
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none (test reliability)
  • GPUs tested: n/a (the test mocks Vulkan)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4855954719 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5759). Originally posted by [YossiYad](https://github.com/YossiYad) on 2026-10-14T09:42:58Z. --- ### What `agc_host_import_sparse` (added with #5309) fails on my machine on `main`: ``` FAIL: a failure at vkQueueBindSparse after the sparse path was chosen did not throw (got "") ``` The test's `Resolve` callback searches a global `backings` list of `Backing*`, and each `SharedRange` adds a pointer to its own `Backing`. The ranges are locals of each check and nothing removed them from the list, so by the fourth check it held pointers into stack frames that had been reused. With a temporary print in `createSparseDmaBufImport`, the fourth check's range resolved to `offset=46330441829925` and a descriptor with `st_size=0`. The sparse path was therefore not chosen, the range fell through to the whole-range `UDMABUF_CREATE` (refused above the 64 MiB limit, which logs `falling back to copies`), and nothing threw. Whether it passes depends on what the compiler leaves in those frames. `SharedRange` now removes its `Backing` from the list in its destructor. Test-only change; `GuestBufferMemory.cpp` is untouched. ### Tested Linux (Bazzite 44, GCC 16.2.1, Ninja, Release, `-DBUILD_TESTING=ON`), RX 7700 XT, `/dev/udmabuf` accessible, `size_limit_mb` 64, based on `main` `1a40d3d81`: - `agc_host_import_sparse`: fails on `main`, passes 20 of 20 (`--repeat until-fail:20`) with this change. - With `if (bound != VK_SUCCESS) return false;` in place of the `vkQueueBindSparse` throw, the fixed test fails on both of that check's assertions, which the old test could not show here because it never reached that path. - `tools/check_conventions.py --base upstream/main` and `tools/pr_overlap.py` (no overlap) pass. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw; no silent stubs added - [x] No notes, investigation `.md` files or images added to the repository - [x] No new third-party code - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: none (test reliability) - [x] GPUs tested: n/a (the test mocks Vulkan) - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-15 12:09:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:09:16Z.


Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
#6222 core/libs/prx/libSceAgcDriver/tests/HostImportSparseDmaBuf.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6191697662 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5759#issuecomment-6191697662). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-15T12:09:16Z. --- <!-- pr-overlap --> Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | #6222 | `core/libs/prx/libSceAgcDriver/tests/HostImportSparseDmaBuf.cpp` |
adriadam10 commented 2026-10-15 12:37:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-15T12:37:00Z.


Checked: SharedRange registers &backing in backings in its constructor and the ranges are locals, so the destructor removal fixes the dangling pointers. agc_host_import_sparse passes 20/20 with --repeat until-fail:20 on the PR merged onto current main; merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6192203697 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5759#issuecomment-6192203697). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-15T12:37:00Z. --- Checked: `SharedRange` registers `&backing` in `backings` in its constructor and the ranges are locals, so the destructor removal fixes the dangling pointers. `agc_host_import_sparse` passes 20/20 with `--repeat until-fail:20` on the PR merged onto current main; merging.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!5759
No description provided.