Skip to content

test(agc): run the resident heap mirror tests only with sparse residency - #12272

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
tkcm01:test/agc-resident-mirror-no-sparse
Oct 28, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
tkcm01:test/agc-resident-mirror-no-sparse

Conversation

@tkcm01

@tkcm01 tkcm01 commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

What

ResidentBuffer::Create (Graphics/src/ResidentMirror.cpp) gives no resident buffer unless the device has sparseBinding, sparseResidencyBuffer and sparseResidencyAliased. The heap mirror then holds a whole copy of the heap. That fallback is intended, and CopiedTests already checks it by limiting the resident address space. agc_driver_resident_heap_mirror still ran the resident, reused-address, joined-import and uncopied partial-import tests on every device, and these expect block-sized mirrors. So on a device without sparse residency, such as MoltenVK, the test fails at its first check: the heap mirrors of two 8192 KiB heaps hold 16384 KiB of device memory; the guest and the GPU wrote 192 KiB of them.

The test now reads the device's context through VulkanDeviceTestAccess, as other AGC tests do, and runs those tests only when all three features are present. Otherwise it prints why they are skipped. CopiedTests and the copied partial-import tests run on every device. The production code is unchanged.

#10540 recorded this failure on macOS as a separate gap. The closed #8658 (@iamthehimansh, credited as co-author) skipped the same checks on Apple hosts. This change gates on the device features that production checks instead, so it also covers other devices without sparse residency. Announced on #1.

Tested

macOS 27.0.1 (26A434), Apple M4 (10-core GPU), Apple clang 21.0.0, x86-64 Release build under Rosetta 2, MoltenVK 1.4.2 from the Vulkan SDK 1.4.363.0. libSceAgcDriver doesn't link on macOS from main alone, so the tree is main 9fc181dde5 plus the open PRs @imellag listed on #1 (#7631, #7804, #10552, #11249, #11447, #10669, #11554) and #12076. The test and ResidentMirror.cpp are the same there as on main.

  • ctest -R '^agc_driver_resident_heap_mirror$' -V, run once with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, plus plain runs:
    • Without this change: fails 3 of 3 with the message above.
    • With it: passes 5 of 5 (--repeat until-fail:5) and prints the skip line. The final resident heap mirror tests passed is printed after the copied tests, so they ran.
    • 0 VUID- lines without and with the change. The validation layer was found.
  • Full ctest -j4 --timeout 120 with Vulkan: 2584 tests, 61 failed without and with the change. agc_driver_resident_heap_mirror now passes. agc_driver_msaa_dcc_clear_4 failed once under -j4 and passed 3 of 3 alone. That test doesn't use this file, and agc_driver_msaa_dcc_clear_2 flakes the same way on this machine.
  • Windows, through the fork's Build workflow on this change merged with main: the 1169 selected tests passed. agc_driver_resident_heap_mirror built and skipped, because the runner has no GPU.
  • python3 tools/check_conventions.py --base upstream/main: passed. tools/pr_overlap.py: perf(agc): stream resident heap mirror flushes through bounded staging chunks #11982 adds a test call next to these lines in the same main(), a trivial conflict.

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 (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: Apple M4 (10-core GPU), MoltenVK 1.4.2 (Vulkan SDK 1.4.363.0), macOS 27.0.1
  • AI-assisted: yes

🤖 Generated with Claude Code

ResidentBuffer::Create returns no resident buffer unless the device has
sparseBinding, sparseResidencyBuffer and sparseResidencyAliased, and the
heap mirror then holds a whole copy of the heap, which CopiedTests
already checks. The resident, reused-address, joined-import and
uncopied partial-import tests expected block-sized mirrors on every
device, so they failed on devices without sparse residency, such as
MoltenVK.

Co-Authored-By: iamthehimansh <67262056+iamthehimansh@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tkcm01 tkcm01 mentioned this pull request Oct 28, 2026
@github-actions

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 11982 core/libs/prx/libSceAgcDriver/tests/execution/ResidentHeapMirror.cpp L390-392

@fogydes

fogydes commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

verdict: OK

  1. [verified] The test gate uses the same sparseBinding, sparseResidencyBuffer, and sparseResidencyAliased checks as ResidentBuffer::Create. Copied-path tests remain enabled when those features are absent.
  2. [author-reported] The body reports the Vulkan validation test pair, zero VUID lines, and Windows workflow results. I did not rerun them; the existing build-full tree failed CMake regeneration, so its focused executables were unavailable here.
  3. [verified] The conventions checker and git diff --check pass.

Freshness envelope: head e8f6ba8; merge-base 0cd07dc; behind main: 0; git merge-tree --write-tree origin/main pull/12272: exit 0, clean.

Cross-PR ledger: open non-draft PR #11982 also changes ResidentHeapMirror.cpp. Pairwise git merge-tree exits 1 with a conflict in that file; the heads need conflict resolution if combined.

@github-actions github-actions Bot added the agc libSceAgc* label Oct 28, 2026

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test gate matches the production fallback condition: resident mirrors require all three sparse features, while copied mirrors remain supported without them. The change keeps copied heap and copied partial-import coverage active on every device and skips only assertions that require resident block-sized mirrors. The reported MoltenVK before/after comparison and validation-layer run demonstrate the original failure and verify the fallback coverage; current Windows and conventions checks pass. No production code changes. No blocking issue found.

@oneandonlydean oneandonlydean self-assigned this Oct 28, 2026
@maskym

maskym commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Windows + NVIDIA result for head e8f6ba8649, merged into main 3b979d42a9 (the PR's GPUs tested line names no NVIDIA run on Windows).

This PR's own tests: agc_driver_resident_heap_mirror (0.58 s); this device has sparse residency, so the test still runs rather than skipping, all passed.

Host: Windows 11 26300, Intel i7-12700K, NVIDIA GeForce RTX 2070 SUPER (vendor 0x10de, device 0x1e84; Vulkan loader 1.4.357 from the NVIDIA driver 621.01), Khronos Validation Layers nightly 1.4.366 (b2b44c0d37) through VK_ADD_LAYER_PATH, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh, r6), Release, BUILD_TESTING=ON, Ninja. Build clean.

Same focused run on main 3b979d42a9 and on this tree, same machine and GPU: VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1, VK_LOADER_DEBUG=error,warn,layer, ctest --test-dir build -R '^(agc|guest_video_out|video_out)' --parallel 4 -V.

The tree also carried the open PRs #12298, #12262, #12256, #12250, #12234, #12228, #12211, #12210, #12209, #12208, #12207, all merged cleanly, so the run is a joint one. Not run on a PS5.

AI-assisted: yes (Claude Code), the runs and the numbers above are from this machine.

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.

5 participants