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

Merged
fernandomcrsilva merged 1 commit from upstream-pr/21255 into main 2026-11-21 11:00:52 +00:00
fernandomcrsilva commented 2026-11-16 02:17:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fernandomcrsilva on 2026-11-16T02:17:33Z.


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 (74696a08b2 and 579e4a0e6a), 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 74696a08b2, opcode 10 passes and 0x70 fails: the failure follows the fourth position.
  • GLIBC_TUNABLES=glibc.malloc.tcache_count=0 on 74696a08b2: 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 579e4a0e6a 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 #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

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5329875786 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/21255). Originally posted by [fernandomcrsilva](https://github.com/fernandomcrsilva) on 2026-11-16T02:17:33Z. --- ### 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` (74696a08b2 and 579e4a0e6a), 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 74696a08b2, opcode 10 passes and 0x70 fails: the failure follows the fourth position. - `GLIBC_TUNABLES=glibc.malloc.tcache_count=0` on 74696a08b2: 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` 579e4a0e6a 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 #16321, in `UnsupportedStores`, not in `Guards`. ### 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](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) and the licence notice of code adapted from upstream (see AGENTS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: AMD Radeon RX 7600 (RADV NAVI33), Mesa 26.2.6, Linux - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-11-16 02:40:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-16T02:40:00Z.

Review: APPROVED


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5914435618 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/21255#pullrequestreview-5914435618). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-16T02:40:00Z. **Review:** APPROVED --- # 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.
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!21255
No description provided.