Skip to content

test(agc): keep the packed image table guard programs at different addresses - #21255

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
fernandomcrsilva:fix/agc-image-table-packed-guards-log
Nov 21, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
fernandomcrsilva:fix/agc-image-table-packed-guards-log

Conversation

@fernandomcrsilva

Copy link
Copy Markdown
Contributor

What

agc_driver_image_table_packed_guards fails on every run on a machine whose allocator hands a freed block to the next request of the same size (glibc 2.44 here):

AGC graphics: unrecoverable packed table format was not poisoned

Guards runs four opcodes (2, 0x42, 0x70, 10) against a poisoned table entry and requires image table: in the captured log each time. That line is written by LogCoalescedStderr_nid_no_patch in Recorder.cpp and carries the program's address, and AsyncLog::Admit prints an identical line only PrintedRepeats = 3 times per 10 s. Each program was a local freed at the end of its iteration, so the next one got the same address, the four lines were identical, and the fourth was suppressed.

The four programs now live in a vector until the loop ends, so their addresses differ and every line is printed. Test only; no product code changes.

Evidence that it is the coalescing and not the opcode or the GPU:

  • main (74696a0 and 579e4a0), default allocator: 30 of 30 runs fail, and the log has three identical shader 0x... stage 4 pc 0x68 lines.
  • With the loop reordered to {10, 2, 0x42, 0x70} on 74696a0, opcode 10 passes and 0x70 fails: the failure follows the fourth position.
  • GLIBC_TUNABLES=glibc.malloc.tcache_count=0 on 74696a0: the fourth program gets another address, four lines are printed, and main passes 6 of 6. main also passes with the validation layer loaded, which changes the allocation pattern too.

Tested

CachyOS (glibc 2.44, GCC 16.2.1), Release, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1.

  • agc_driver_image_table_packed_tests guards, 30 runs each: main 579e4a0 fails 30 of 30; this PR passes 30 of 30 with the default allocator and 30 of 30 with GLIBC_TUNABLES=glibc.malloc.tcache_count=0. The log now has four lines with four addresses.
  • ctest -R '^agc_driver_image_table': 29 of 29 pass (agc_driver_image_table_vouched_lookups skips itself, as on main).
  • agc_driver_image_table_packed_guards under VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation with VK_LOADER_DEBUG=layer (layer 1.4.363, inserted, not reported missing), main and this PR: no VUID- line in either log.
  • python3 tools/check_conventions.py --base upstream/main: passed.
  • Not run: lavapipe, Windows. tools/pr_overlap.py --branch did not run in my environment; with gh the only open PR I found touching ImageTablePacked.cpp is feat(shader): implement MIMG BY2/BY4 stores for the measured 2D subset #16321, in UnsupportedStores, not in Guards.

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: AMD Radeon RX 7600 (RADV NAVI33), Mesa 26.2.6, Linux
  • AI-assisted: yes

🤖 Generated with Claude Code

…dresses

Guards runs four opcodes against a poisoned table entry and requires the
"image table:" line in the captured log each time. The line carries the
program's address, and AsyncLog::Admit prints an identical line only three
times in ten seconds. Each program was freed at the end of its iteration,
so an allocator that hands the next one the same address made the four
lines identical and the fourth was suppressed: the test failed with
"unrecoverable packed table format was not poisoned" on glibc 2.44 and
passed with glibc.malloc.tcache_count=0.

The programs now live until the loop ends, so their addresses differ.

@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 test-only change; the targeted source review supports its stated fix.

What I ran

Reviewed head 79e34a5581b3c077de7b5b153048b0335b325124 using repo_read.py against the prepared review bundle. No build or tests were run.

Results

Check Result Note
Diff and changed test passed Read the only changed file and its affected test function.
Build and tests not run No commands were run.

Findings

Blocking

None.

Non-blocking

None.

Not verified

No build or test execution was performed. The description’s reported test runs were not independently verified. The manifest lists one changed file, core/libs/prx/libSceAgcDriver/tests/execution/ImageTablePacked.cpp, and marks its full text as included; that file was read. No files were excluded according to the manifest.

To get this to a good state

Nothing is required.

@NathanFahey23

Copy link
Copy Markdown
Contributor

Windows NVIDIA check of head 79e34a5581, merged onto main 3251ad6944 (f50c472216, clean merge).

Setup: Windows 11 Home 10.0.26300, i9-13900K, WinLibs GCC 15.2.0, Release, RTX 4080 (10de:2704, driver 32.0.16.2101), ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, Khronos validation layer loaded. GPU set: ctest -R '^(agc_\|shader\|video_out\|guest_video)' --parallel 4, one run per side.

main 3251ad6944 merge f50c472216
GPU set 1955 pass, 20 skipped, 0 failed 1955 pass, 20 skipped, 0 failed
VUID- lines 0 0
agc_driver_image_table_packed_guards (the test this PR changes) Passed Passed
homebrew, 30 s each (tools/title_run.py, cold shader cache) Jelly5 rendering 116.9, VLC rendering 119.4, DriftCheck rendering 54.2, PS5SX2 rendering 59.6, DOOM rendering 36.4 Jelly5 rendering 116.0, VLC rendering 119.5, DriftCheck rendering 58.3, PS5SX2 rendering 59.5, DOOM rendering 36.4

Windows doesn't reproduce the failure on main: agc_driver_image_table_packed_guards alone, without the validation layer, passes 30 of 30 on main 3251ad6944. The UCRT allocator here doesn't hand the freed program's address to the next one, so this machine only shows that the change doesn't break the test, not that it fixes it.

The one test not run on both sides is agc_driver_upload_cache_read_only_flush: its executable does not build on Windows on this main (setenv, fixed by #19899). The homebrew titles are Jelly5, VLC, DriftCheck, PS5SX2 and DOOM; fps is one run each, for whether they still render, not a performance comparison.

Not checked: AMD, Linux, macOS, any commercial title.

AI-assisted: yes

@domx4q

domx4q commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Confirmed on a second GPU vendor. agc_driver_image_table_packed_guards fails on main e4caa07 here for the reason this PR gives, and passes with this PR's diff.

Environment: Arch Linux, glibc 2.44, GCC 16.2.1, Release, NVIDIA RTX 4090, driver 620.70.06, Vulkan validation layer 1.4.363.

main e4caa07 (fresh worktree build, and the existing full build):

  • agc_driver_image_table_packed_tests guards with ANYPS5_NO_SHADER_CACHE=1: 0 of 10 pass in each build. Each log has exactly 3 identical [gpu] deferred write-back failed: image table: shader 0x... stage 4 pc 0x68 ... invalid format lines. The 4th is suppressed by AsyncLog::Admit (PrintedRepeats = 3 per 10 s).
  • Same run with GLIBC_TUNABLES=glibc.malloc.tcache_count=0: 7 of 10 pass. Same run with ANYPS5_REQUIRE_VULKAN=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation: 7 of 10 pass. A changed allocation pattern only lowers the chance that the address is reused, so the failure becomes intermittent.
  • ctest -R '^agc_driver_image_table_packed_' -j 10: guards fails in 2 of 3 runs.

With this PR's diff applied on e4caa07:

  • guards, 30 runs each: default allocator 30/30, tcache_count=0 30/30, validation layer 30/30. Each log has 4 lines with 4 different shader addresses.
  • ctest -R '^agc_driver_image_table_packed_' -j 10: 12/12 in 5 of 5 runs.
  • ctest -R '^agc_driver_image_table_packed_' -V with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer, main and this PR: the loader inserts VK_LAYER_KHRONOS_validation in all 12 tests, there is no was not found but was requested, there are 0 VUID- lines in either log, and 12/12 pass in both.

CI on main (runs 43841416406, 43834891663) passes this test on Linux and skips it on Windows. The runner allocator does not reuse the freed program address, which explains why CI is green.

AI-assisted: yes (Claude Code)

@Colewiz7

Copy link
Copy Markdown
Contributor

Head 79e34a5581 merged onto main db68035f8b as a31ae9d09b, no conflict. Linux 7.3.4, GCC 16.2.1 Release, Mesa 26.2.6 RADV, RX 7900 XT (NAVI31, gfx1100) and 7800X3D iGPU (gfx1036).

Fixes agc_driver_image_table_packed_guards on both GPUs, with and without the layer.

ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1, 10 runs per cell:

7900 XT, no layer 7900 XT, layer iGPU, no layer iGPU, layer
main 0/10 pass 10/10 pass 0/10 pass 10/10 pass
this PR 10/10 pass 10/10 pass 10/10 pass 10/10 pass

ctest -R '^agc' (1931 tests) with VK_LAYER_KHRONOS_validation 1.4.363 and VK_LOADER_DEBUG=layer on both GPUs: no new failures vs main, no VUID- or SYNC-HAZARD lines, same Undefined-Value-* warning set as main. In the parallel full suite (-j12), guest_audio_out_port_bounds failed once on the 7900 XT and guest_audio_out_ports once on the iGPU; both pass every solo run (10 per GPU) on main and on this PR.

AI-assisted: yes

@kiwe147

kiwe147 commented Nov 21, 2026

Copy link
Copy Markdown

Tested head 79e34a5581, applied with git apply on main fd4aeed483 together with the other 29 PRs of one batch (#17478, #21223, #24030, #24201, #14202, #18889, #19531, #21641, #21773, #22468, #22471, #23239, #23255, #23484, #23869, #23992, #24311, #18425, #21195, #22989, #23507, #23886, #14582, #17878, #19666, #19899, #20138, #21656, #21746). All applied without conflicts and the whole tree built.

Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON. GPUs: NVIDIA GeForce RTX 3080 (driver 621.24) and the AMD Radeon iGPU of the CPU (gfx1036, driver 32.0.21036.18). No validation layer. iGPU run: ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ANYPS5_GPU="AMD Radeon", agc_/video tests only.

tests RTX 3080 iGPU
agc_driver_image_table_packed, agc_driver_image_table_packed_mips, agc_driver_image_table_packed_mixed and 3 more (6 tests, matched by name to the test file this PR changes) all pass all pass

Whole batch: the full ctest -j 12 (6522 tests) on the RTX 3080 has 4 failing tests; the 4 that also fail on main fd4aeed483 are agc_driver_stencil_plane_memory, agc_driver_msaa_dcc_unwatch, agc_storage_write_back_host_retile, and pr_overlap_names, which needs a newer Python than my 3.10. Intermittent in this run (pass when rerun alone, or known flaky): agc_driver_store_over_untracked. The 2125 agc_/video tests on the iGPU have 2 failing: agc_driver_stencil_plane_memory, agc_driver_store_over_untracked (agc_driver_stencil_plane_memory also fails on main).

This is one combined tree, not a run of this PR alone.

AI-assisted: yes (Claude Code)

@oneandonlydean
oneandonlydean merged commit c12a8c5 into boykopovar:main Nov 21, 2026
3 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.

10 participants