Skip to content

test(agc): honor image-pool budgets during pressure recovery - #26828

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
JJenkx:codex/test-image-memory-pool-disabled-20261124
Nov 27, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
JJenkx:codex/test-image-memory-pool-disabled-20261124

Conversation

@JJenkx

@JJenkx JJenkx commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

What

When an image block cannot fit the configured pool budget, CachePressure still requires recovery to reuse its Vulkan memory handle. Thus a correct release/reallocation fails four existing ImageMemory cases with APS5_STAGING_POOL_MIB=0, as reported on #23445. The same incorrect expectation affects a disabled image pool or a nonzero device budget smaller than the shared block.

Use the public device/image budgets to require reuse without a native free when the block fits, or a native free when it does not. Later standalone-pressure recovery tracks the actual recovered allocation, since pool-off recovery can produce a new handle. Whole-block reclamation, held siblings, partial returns, readback and teardown checks remain in place.

Add CTest cases for APS5_STAGING_POOL_MIB=0 and APS5_IMAGE_POOL_MIB=0. This changes only the fixture and its registrations; production allocation behavior is unchanged.

Tested

Linux/Arch, RX 6650 XT (RADV NAVI23), Mesa 26.3.1-2, Release, Vulkan headers 335 and Khronos validation 1.4.363. Base bd3a694f2b55a7ae319455cfa7238b7df51d444d and fixture commit 88afded4e1f90ee83c04e7f0022d336c490f09e7.

Built the exact base ImageMemory target and its dependencies; compiled the changed fixture with its actual Ninja flags and linked it against the same frozen base production libraries. Both fixture binaries used the identical 11-case registration, including the two new cases. Ran ctest -R '^agc_driver_image_memory' -V with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, the validation layer and loader debug enabled, and Mesa cache disabled:

Inherited environment Original fixture Changed fixture
default 9/11 11/11
APS5_STAGING_POOL_MIB=0 5/11 11/11
APS5_IMAGE_POOL_MIB=0 5/11 11/11
APS5_STAGING_POOL_MIB=1 5/11 11/11

Every original failure contains the incorrect recovered-block reuse assertion. Changed fixture: 44/44, comprising 40 physical-GPU cases and 4 CPU hook cases, no CTest skips. Four GPU wrapper cases per group deliberately force dedicated-allocation subcase skips and verify normal/failure teardown; they do not establish image sharing on dedicated-only hardware. Across both arms, 80 layer insertions, no unavailable-layer warning and zero VUID- lines; source, binaries and library hashes remained unchanged. Each GPU group held its own shared-FIFO reservation.

Source patch, build recipes, result receipts, verbose logs and JUnit (SHA256 2c8fb93b9158807e04b74c0bcf6696cf05bd245a55649e046f077040ba792f14). Windows and native games were not tested by the author; no performance claim. Subsequent main through fc54d18d8d10 changes no AGC production/fixture, shader code or dependency pin; the later libc scandir change is outside this fixture path. The recorded qualification base remains bd3a694f2b55; conventions pass against the earlier reviewed cc2e43451f58 main.

Contributor-reported Windows coverage (separate from the author’s Linux qualification): mihiii1337’s exact-head review reports 11/11, zero skips, on both Intel UHD Graphics/RaptorLake-S Mobile (driver 101.6127) and RTX 4070 Laptop (driver 621.01), Windows 11/WinLibs GCC 15.2 Release. Both used required physical Vulkan, cache-off and validation-layer insertion for all ten GPU cases, with zero VUID lines/no missing-layer warning. The exact-parent Intel negative control passes 9/9 by default and fails 4/9 with APS5_IMAGE_POOL_MIB=0; the changed registered case passes. upipibi’s RTX 3070 report, Windows 11/driver 616.56, compares a merge of this head onto main fc54d18d8d with that main alone: 11/11 versus 9/9, three runs each, validation inserted in every GPU case, zero VUID lines. Neither contributor states the validation-layer build number; these are attributed reports, not an author-run Windows qualification. No titles were tested.

Additional contributor-reported Windows comparison: hamdanpor-ctrl applied this PR’s two-file diff to main a40a1399b5 with the same #19899 MinGW build fix on both arms, using RTX 3050 Laptop (4 GB), driver 617.42, Windows 11 Pro 26300, WinLibs GCC 15.2 Release and validation layer 1.4.363.0. All 13 image-memory cases pass in three focused repeats. The broader parallel run reports the same two failures and 26 skips on both arms, zero VUID lines and the same 65 validation messages. The candidate’s additional agc_driver timeout passes alone in 50.3 seconds; the contributor reports similar timing variability on main. This tests the diff on a newer shared baseline, rather than the standalone PR head.

Additional contributor-reported Pascal coverage: zedekvdb compares main 7f99fbd60d with this change on Quadro P3200 / driver 582.42, Windows 11 Pro 26300 and WinLibs GCC 15.2 Release, two runs per arm. The nine existing image-memory tests pass on both sides and both new pool-off registrations pass with this change. The new cases report filling 16 images and reclaiming 4,194,304-byte blocks. Required Vulkan, cache-off, selected physical GPU and layer insertion are reported, with zero VUIDs. Both dedicated-pressure cases skip their cache-pressure subcase on both arms because those allocations require standalone memory; that subcase remains unverified on this GPU. Device Vulkan API 1.4.312 is stated, but the validation-layer version is not. This is attributed subset coverage, separate from the author’s Linux evidence.

The mandatory name lookup and manual internal-helper review were completed before editing. The publication branch scan examined 2,473 open PRs and exited 2 for one unavailable shared-file comparison, #9508. Its current head 7d4214c1f1f7 changes only the Recorder constructor in SampledImages; this branch changes CachePressure and the CTest registrations. Exact-head patch review found no duplicate recovery implementation or same-line change. Completed scan/manual review and main-advance receipt (SHA-256 85d5a3d8cbe8190e1c28cc965ef7f1760a15f02189f0657ec2f4ee51d19d2137; anonymous download verified).

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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: author: AMD Radeon RX 6650 XT/RADV Mesa 26.3.1-2, Arch Linux; contributor-reported Windows: Intel UHD, RTX 4070 Laptop, RTX 3070, RTX 3050 Laptop, Quadro P3200 (details above)
  • AI-assisted: yes

@mihiii1337 mihiii1337 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.

Reviewed exact head 88afded. The budget-dependent expectation matches the production pool policy, and the later pressure step now follows the allocation actually recovered by the first step. The two registrations exercise the disabled staging and image pools without changing production code.

Independent Windows 11 / WinLibs GCC 15.2 Release verification:

  • Intel UHD Graphics (RaptorLake-S Mobile, 8086:a78b), driver 101.6127, Vulkan 1.3.295: exact head 11/11 passed, zero skips.
  • NVIDIA GeForce RTX 4070 Laptop GPU (10de:2860), driver 621.01, Vulkan 1.4.357: exact head 11/11 passed, zero skips.
  • Both runs forced a physical ICD and ANYPS5_REQUIRE_VULKAN=1, disabled the shader cache, and inserted VK_LAYER_KHRONOS_validation for all ten GPU-backed cases. Logs contain zero VUID lines and no missing-layer warning.
  • Negative control on the exact parent bd3a694: Intel default passed 9/9; with APS5_IMAGE_POOL_MIB=0 the old fixture failed 4/9 at the obsolete returned-block reuse assertion. The exact head's registered no-image-pool case passes.
  • tools/check_conventions.py --base bd3a694 and git diff --check passed; final worktree clean.

No PS5 or native-game test was run. Software Vulkan was not used.

AI-assisted: yes.

@upipibi

upipibi commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

RTX 3070 run of 88afded4e1, merged with --no-ff onto main fc54d18d8d, against main alone.

Tested

  • NVIDIA GeForce RTX 3070 (driver 616.56, subgroup 32), Windows 11 Pro 26100, WinLibs GCC 15.2.0, Ninja, Release; ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation.
  • ctest -R "agc_driver_image_memory", 3 runs each:
    • main: 9/9 passed in all 3 runs.
    • this PR: 11/11 passed in all 3 runs (new in this PR: agc_driver_image_memory_no_image_pool, agc_driver_image_memory_no_staging_pool).
  • Validation layer inserted in every Vulkan test (10 per run on the PR side), 0 VUID- messages. Build: 0 failed targets.

Not tested: AMD, titles.

AI-assisted (Claude Code).

@github-actions github-actions Bot added build agc libSceAgc* labels Nov 25, 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.

Reviewed — looks good

Nothing blocks this change; the findings below are optional.

What I ran

Reviewed head 88afded4e1f90ee83c04e7f0022d336c490f09e7. Read the description, commit list, diff, manifest, both changed files, the pressure-recovery context, and the budget helper implementations. No tests were run in this review.

Results

Check Result Note
Changed-line review passed Both changed files read
Targeted context passed Budget helpers reviewed
Tests not run Author-reported results only

Findings

Blocking

None.

Non-blocking

None.

Not verified

The author reports 44/44 CTest cases passing on Linux/Arch with an RX 6650 XT, but I did not independently run them. Windows and native-game behavior were not verified. No files were excluded by the manifest.

To get this to a good state

Nothing is required.

@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
PR 9508 core/libs/prx/libSceAgcDriver/tests/execution/ImageMemory.cpp

@hamdanpor-ctrl

Copy link
Copy Markdown
Contributor

Test report, NVIDIA on Windows, head 88afded4e1: the two new budget cases pass on a 4 GB card, no regressions. This adds an NVIDIA/Windows run to the RADV results in the description.

  • GPU: NVIDIA GeForce RTX 3050 Laptop GPU (4 GB device-local heap), driver 617.42, Windows 11 Pro (10.0.26300)
  • Build: WinLibs GCC 15.2.0 r7 UCRT, Release, all AGC execution tests built
  • Compared: main at a40a139 with fix(tests): set the upload cache test's environment with _putenv_s on Windows #19899's diff applied (main does not build on MinGW without it: UploadCacheReadOnlyFlush.cpp:177: 'setenv' was not declared), and the same tree with this PR's own diff applied (git diff bd3a694f2b 88afded4e1, 2 files, applied cleanly)
  • Environment: ANYPS5_GPU=NVIDIA, ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (Vulkan SDK 1.4.363.0)
  • Command: ctest --test-dir build -V --parallel 4 --timeout 120 -R "^agc_|^request_serializer|shader|^windows_write_watch"
main main + this PR
Passed 2109 2110 (+2 new tests, see agc_driver below)
Failed 2: agc_driver_store_over_untracked (#22670) and agc_driver_linear_target_import_creation (#26650) the same 2
Timeout 0 1, agc_driver
Skipped 26 26
VUID- lines 0 0
Validation messages 65 65, same IDs
  • The new agc_driver_image_memory_no_image_pool and agc_driver_image_memory_no_staging_pool pass, and all 13 image_memory tests pass in three more runs alone with the layer (1.3 to 1.7 s each).
  • agc_driver hit the 120 s timeout in the parallel run and passed alone in 50.3 s; it varies like this on main here too (agc_driver takes up to 123 s on Windows: its self-linking buffer check runs to the 1 << 26 word copy limit #22565). This PR touches only the image-memory test.
  • Every other test has the same result on both sides. The layer loads in both logs and neither reports it missing.

Single run of the full set. AI-assisted (Claude Code).

@zedekvdb

Copy link
Copy Markdown
Contributor

Windows NVIDIA run, next to the RX 6650 XT on Linux in the description: the 9 existing agc_driver_image_memory* tests pass on main and with this head, and the two new ones pass here too.

Setup: Windows 11 Pro 10.0.26300, NVIDIA Quadro P3200 (Pascal, 10de:1bbb), driver 582.42, Vulkan API 1.4.312, WinLibs GCC 15.2.0 r7, Release, main 7f99fbd60d. VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ANYPS5_GPU="Quadro P3200", ctest -R "^agc_driver_image_memory.*$" -j 1 -V, 2 runs per side. Every test selects the Quadro P3200 with the layer inserted; there are no VUID- messages.

main This head (88afded4e1)
The 9 existing agc_driver_image_memory* tests 2 of 2 2 of 2
agc_driver_image_memory_no_staging_pool (new) 2 of 2
agc_driver_image_memory_no_image_pool (new) 2 of 2

Both new tests print cache pressure filled 16 images, reclaimed 4194304-byte blocks; small 2 failures/1 reclaims, standalone 2 failures/1 reclaims. On this GPU the two dedicated_pressure_* tests skip their cache-pressure subcase on both sides (dedicated=0 preferred=1 ... require standalone memory), so that part isn't checked here.

AI-assisted: yes (Claude Code)

@oneandonlydean
oneandonlydean merged commit 54aa3c6 into boykopovar:main Nov 27, 2026
16 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants