Skip to content

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

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
YossiYad:fix/sparse-import-test-backings
Oct 15, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
YossiYad:fix/sparse-import-test-backings

Conversation

@YossiYad

Copy link
Copy Markdown
Contributor

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

Each SharedRange in agc_host_import_sparse registered a pointer to its
Backing in the global list Resolve searches, and never removed it. The
ranges live on the stack of each check, so by the last check the list
held pointers into stack frames that had been reused. On this machine
Resolve matched one of them for the fourth check's range and returned
an unrelated descriptor (st_size 0, offset 46330441829925), the sparse
path was not chosen, and the check failed with "a failure at
vkQueueBindSparse after the sparse path was chosen did not throw".
Whether it passes depends on what the compiler leaves in those frames.

The range now removes its Backing when it is destroyed. The test passes
20 of 20 here, and fails again when a vkQueueBindSparse failure no
longer throws, which it could not show before.
@github-actions

Copy link
Copy Markdown

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

@github-actions github-actions Bot mentioned this pull request Oct 15, 2026
11 tasks
@adriadam10 adriadam10 self-assigned this Oct 15, 2026
@adriadam10

Copy link
Copy Markdown
Collaborator

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.

@adriadam10
adriadam10 merged commit 636b1b9 into boykopovar:main Oct 15, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants