Skip to content

test(agc): scope the depth-expand out-of-place mirror count to the write base - #21570

Closed
tablefrogpillow wants to merge 1 commit into
boykopovar:mainfrom
tablefrogpillow:test/agc-depth-expand-mirror-count-scope
Closed

tablefrogpillow wants to merge 1 commit into
boykopovar:mainfrom
tablefrogpillow:test/agc-depth-expand-mirror-count-scope

Conversation

@tablefrogpillow

Copy link
Copy Markdown
Contributor

What

agc_driver_depth_expand_out_of_place_tests case unimported-copied-buffer-read fails deterministically when run standalone (reports 1 heap mirror where it expects none) but passes when the whole suite runs — a test-ordering dependency (#21562).

Root cause

The case asserts a delta on MirrorCounters().heapMirrors, which is a process-global live count of every heap-mirror entry in the registry — not a per-case or per-block count. The +1 seen standalone is the driver's own internal write-watched memory (Ps5DriverMemoryBase, 0xfe0000000): run standalone with SetHostImportBudget(1), the copied case is the first to drive an address-based copy with no import room, so that driver memory is legitimately served by a heap mirror → the global delta is 1, even though the case's write base is correctly served by a copy. In the full suite an earlier case already holds a live mirror/import for the driver memory, so the copied case creates no new heap mirror → delta 0 → pass.

So there is no product correctness bug and no mirror-lifetime leak: the mirror is correct product behaviour, and the copy itself is bit-exact (15360/15360 texels). The failure is purely an over-broad assertion reading a global accumulator contaminated by driver-internal state and cross-case ordering.

Fix

Scope the count to the case's own write base using the existing HeapMirrorsWithin(begin, end) helper — the same pattern ResidentHeapMirror and BdaResources already use — instead of the process-global MirrorCounters().heapMirrors. The (mirrors != 0) == watched assertion is unchanged; it is just fed a precise, scoped count. Test-only; +11/−3 in one file, no product code touched.

Verification (Linux / RADV)

Built on main e4caa07950, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 + Khronos validation layer:

  • RDNA2 (RADV RAPHAEL, gfx1036) and RDNA3 (RADV NAVI31, gfx1100):
    • standalone unimported-copied-buffer-read: PASS (write-base mirrors: 0) — fails without the change
    • standalone unimported-mirrored-buffer-read: PASS (write-base mirrors: 1 — the scoped count still distinguishes mirrored from copied)
    • full agc_driver_depth_expand_out_of_place_tests suite: PASS, no regression

AI-assisted: yes

…ite base

unimported-copied-buffer-read in agc_driver_depth_expand_out_of_place_tests
asserted a delta on the process-global MirrorCounters().heapMirrors, which
counts every live heap-mirror entry in the registry, including the driver's own
write-watched internal memory and mirrors left live by earlier cases. Run
standalone with SetHostImportBudget(1), the copied case is the first to drive an
address-based copy with no import room, so the driver's own memory is served by
a heap mirror and the global delta is 1 even though the case's write base is
served by a copy; the "expected none" assertion then fails. In the full suite an
earlier case already holds that mirror, so the delta is 0 and it passes: a
test-ordering dependency, not a product bug (the copy is bit-exact, 15360/15360
texels).

Scope the count to the case's own write base with the existing
HeapMirrorsWithin(begin, end) helper, as the sibling ResidentHeapMirror and
BdaResources tests already do. The (mirrors != 0) == watched check is unchanged;
it is just fed a precise, scoped count. Test-only; no product code changes.

Fixes boykopovar#21562

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions github-actions Bot added the agc libSceAgc* label Nov 16, 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 21636 core/libs/prx/libSceAgcDriver/tests/execution/DepthExpandOutOfPlace.cpp L637, L646-647

@tablefrogpillow

Copy link
Copy Markdown
Contributor Author

Superseded by @oneandonlydean's #21636, which applies the same HeapMirrorsWithin scoping fix for #21562. Closing in favour of the maintainer's PR — the fix is identical and theirs will land it. AI-assisted: yes

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.

1 participant