test(agc): wait for the previous DCC mip case's image before reusing its memory #19335

Merged
chitters2004 merged 2 commits from upstream-pr/19335 into main 2026-11-16 21:20:32 +00:00
chitters2004 commented 2026-11-13 04:13:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by chitters2004 on 2026-11-13T04:13:10Z.


What

agc_storage_dcc_mip_writeback fails intermittently under load, with 64 KiB R_X 512x512, 3 mips, DCC keys uncompressed, an access to the first unit: the write-back stored 344064 of 344064 texels, expected only the accessed unit's. We saw it on Windows (lavapipe) CI runs of main 311f0472ee and of other branches. The driver is right; the test's timing is not.

Each case of dccMipWriteBackTests frees its block, and the next VirtualAlloc returns the same address. The previous case's image is still referenced for a short time after its memory is unregistered. Normally it is dropped before the next case creates its image. Under load the drop can land after the DCC case's flush. StorageTexture::storesWhole() then sees another live image over a DCC-keyed mip chain and stores the whole chain, as it must.

Before creating its image, each case now waits (reaping, bounded at 10 s) until the previous case's image is gone. If it is not, the test fails with the previous case's image is still live over the reused memory, so this image would store whole. Test only: +8 lines in tests/Recorder.cpp.

Tested

  • Wine with lavapipe (Mesa 25.2.8), WinLibs GCC 15.2, 16 copies of the test at once on 4 cores: 1 failure in 64 before, 640 of 640 passes with this change.
  • Mutant that keeps the previous case's image alive: before this change it fails 3 of 3 with the message above; with it, each run fails on the new wait.
  • Fork CI (Linux gate and Windows, lavapipe), this test, passes on both: https://github.com/chitters2004/AnyPS5/actions/runs/43359741330

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: lavapipe (Mesa 25.2.8 under Wine; Mesa on fork CI for Linux and Windows); test-only change
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5289858819 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19335). Originally posted by [chitters2004](https://github.com/chitters2004) on 2026-11-13T04:13:10Z. --- ### What `agc_storage_dcc_mip_writeback` fails intermittently under load, with `64 KiB R_X 512x512, 3 mips, DCC keys uncompressed, an access to the first unit: the write-back stored 344064 of 344064 texels, expected only the accessed unit's`. We saw it on Windows (lavapipe) CI runs of `main` 311f0472ee and of other branches. The driver is right; the test's timing is not. Each case of `dccMipWriteBackTests` frees its block, and the next `VirtualAlloc` returns the same address. The previous case's image is still referenced for a short time after its memory is unregistered. Normally it is dropped before the next case creates its image. Under load the drop can land after the DCC case's flush. `StorageTexture::storesWhole()` then sees another live image over a DCC-keyed mip chain and stores the whole chain, as it must. Before creating its image, each case now waits (reaping, bounded at 10 s) until the previous case's image is gone. If it is not, the test fails with `the previous case's image is still live over the reused memory, so this image would store whole`. Test only: +8 lines in `tests/Recorder.cpp`. ### Tested - Wine with lavapipe (Mesa 25.2.8), WinLibs GCC 15.2, 16 copies of the test at once on 4 cores: 1 failure in 64 before, 640 of 640 passes with this change. - Mutant that keeps the previous case's image alive: before this change it fails 3 of 3 with the message above; with it, each run fails on the new wait. - Fork CI (Linux gate and Windows, lavapipe), this test, passes on both: https://github.com/chitters2004/AnyPS5/actions/runs/43359741330 ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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) - [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: lavapipe (Mesa 25.2.8 under Wine; Mesa on fork CI for Linux and Windows); test-only change - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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!19335
No description provided.