perf(agc): audit a cached template only after the host import set changed #14838

Merged
oneandonlydean merged 1 commit from upstream-pr/14838 into main 2026-11-04 19:18:22 +00:00
oneandonlydean commented 2026-11-01 19:18:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-11-01T19:18:47Z.


What

Carries #9012 by @SP4C3B4R-8, with credit.

Carry the import-generation condition for periodic cached resource audits onto main ac26e59d9a. Keep the interval, audit budget and override from the original change. Preserve current recent-import lookup helpers, insertion counters and compared-import coverage API.

Successful insertions advance the audit generation; retirement, device replacement and reset advance it through the existing epoch changes. Joined creation uses the insertion path. The separate joined epoch invalidation stays intact. Add generation and stable repeated-lookup checks to the sampled lookup and joined heap fixtures.

Tested

  • Carry checks (ours, Linux workstation, on main ac26e59d9a plus this change; it also merges cleanly with main d8b60b46ed): the ctests that use the changed sources 17/17 passed, and the seven named focused tests passed 7/7 with none skipped: agc_driver_resource_cache_lookup_changed, agc_driver_sampled_cache_budget, agc_driver_resident_heap_mirror, agc_driver_host_import_at_map, agc_driver_host_import_proofs, agc_driver_host_import_teardown, agc_host_import_retire. Not run: Windows, macOS, any GPU/game qualification.

Local checks: git diff --check and git bundle verify succeeded. Current recent-import helpers, HostImportFor and importJoined remain byte-identical to the base. These checks do not establish runtime correctness.

Run the focused tests on main and the carry with the validation layer and the same GPU/configuration. Include agc_driver_resource_cache_lookup_changed, agc_driver_sampled_cache_budget, agc_driver_resident_heap_mirror, agc_driver_host_import_at_map, agc_driver_host_import_proofs, agc_driver_host_import_teardown and agc_host_import_retire. Also run the changed lookup and joined fixtures with insertion-generation advancement removed as a negative control. Skipped Vulkan or sparse joined cases are missing coverage.

Earlier A/B records belong to the original head 19191f4ea2, not this carry: https://github.com/boykopovar/AnyPS5/pull/9012#issuecomment-6361833585 and https://github.com/boykopovar/AnyPS5/pull/9012#issuecomment-6363581990 . No new performance or game-gate result is claimed. Preserve current performance and game qualification requirements.

Checklist

  • Based on main ac26e59d9a; carries #9012 (the original, which conflicts with 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; silent stubs are listed in technical debt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: none on the carry (game gate pending, Gate YES)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5110693718 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14838). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-11-01T19:18:47Z. --- ### What Carries #9012 by @SP4C3B4R-8, with credit. Carry the import-generation condition for periodic cached resource audits onto main ac26e59d9abf03805477b593f4d31294c185f442. Keep the interval, audit budget and override from the original change. Preserve current recent-import lookup helpers, insertion counters and compared-import coverage API. Successful insertions advance the audit generation; retirement, device replacement and reset advance it through the existing epoch changes. Joined creation uses the insertion path. The separate joined epoch invalidation stays intact. Add generation and stable repeated-lookup checks to the sampled lookup and joined heap fixtures. ### Tested - Carry checks (ours, Linux workstation, on main `ac26e59d9a` plus this change; it also merges cleanly with main `d8b60b46ed`): the ctests that use the changed sources 17/17 passed, and the seven named focused tests passed 7/7 with none skipped: `agc_driver_resource_cache_lookup_changed`, `agc_driver_sampled_cache_budget`, `agc_driver_resident_heap_mirror`, `agc_driver_host_import_at_map`, `agc_driver_host_import_proofs`, `agc_driver_host_import_teardown`, `agc_host_import_retire`. Not run: Windows, macOS, any GPU/game qualification. Local checks: git diff --check and git bundle verify succeeded. Current recent-import helpers, HostImportFor and importJoined remain byte-identical to the base. These checks do not establish runtime correctness. Run the focused tests on main and the carry with the validation layer and the same GPU/configuration. Include agc_driver_resource_cache_lookup_changed, agc_driver_sampled_cache_budget, agc_driver_resident_heap_mirror, agc_driver_host_import_at_map, agc_driver_host_import_proofs, agc_driver_host_import_teardown and agc_host_import_retire. Also run the changed lookup and joined fixtures with insertion-generation advancement removed as a negative control. Skipped Vulkan or sparse joined cases are missing coverage. Earlier A/B records belong to the original head 19191f4ea263d1024ae136ef00595a8d02756d4b, not this carry: https://github.com/boykopovar/AnyPS5/pull/9012#issuecomment-6361833585 and https://github.com/boykopovar/AnyPS5/pull/9012#issuecomment-6363581990 . No new performance or game-gate result is claimed. Preserve current performance and game qualification requirements. ### Checklist - [x] Based on `main` ac26e59d9a; carries #9012 (the original, which conflicts with 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 - [x] Unimplemented paths throw; silent stubs are listed in technical debt - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: none on the carry (game gate pending, Gate YES) - [x] AI-assisted: yes
MarcZX10 commented 2026-11-01 19:24:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T19:24:17Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

The exact head has a concurrency race in its shared audit budget, and the required AGC performance evidence is missing for this carry.

What I ran

Reviewed head 645b7272a8c8099c775b19bba3f569252abaad2a against PR base f2d874c1fdccf781c0fa5d86619bb5dd8894b958. The merge preview against current main (e0caf1360035286bd22b9f2a3030e97b880ffb28) is clean. Linux x86_64, Debian 12, Python 3.11.2, Git 2.39.5; no C++ build or compiler run.

Commands and inspections performed:

git diff --check f2d874c1fdccf781c0fa5d86619bb5dd8894b958...645b7272a8c8099c775b19bba3f569252abaad2a
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14838
python3 tools/pr_stack_check.py 14838 --repo boykopovar/AnyPS5
gh pr checks 14838 --repo boykopovar/AnyPS5
gh pr view 14838 --repo boykopovar/AnyPS5 --json headRefOid,body,reviews,statusCheckRollup
gh pr view 9012 --repo boykopovar/AnyPS5 --json number,state,headRefOid,baseRefName,mergeable,url
# Read all seven changed files and the relevant contribution rules.

Results

Check Result Note
Diff whitespace passed No whitespace errors
Conventions and template passed Hosted and local check passed
Stack and merge preview passed Clean against current main
ABI and test-quality helpers failed Helpers are absent from the PR snapshot
Hosted Windows build not run Still pending
Hosted Linux and specialized jobs not run Skipped by workflow
C++ tests and GPU validation not run No local build or GPU run
Commands and unedited output

git diff --check ... produced no output and exited successfully. The precheck report recorded:

Head unchanged at completion: True
Base unchanged at completion: True
diff_check: passed
conventions_and_pr_template: passed
live_dependency_and_mergeability_check: passed
changed_export_abi_audit: failed — tools/pr_abi_audit.py is absent from the PR snapshot
test_quality_heuristics: failed — tools/pr_test_quality.py is absent from the PR snapshot
build_and_compile: not_applicable — precheck does not build or compile
build_dependent_cpp_tests: not_applicable — exact-head binaries require a build

Hosted checks at review time:

conventions pass
eligibility pass
intake pass
labels pass
library-portability pass
report pass
windows pending
linux skipping
register-context skipping
relinker skipping
relinker-asan skipping
write-watch skipping

Negative control

Not run. I did not mutate the implementation or disable generation advancement to test whether the added tests detect the budget race.

Findings

Blocking

  1. The global 4 ms audit budget can be exceeded under contention. In ImportAuditAdmitted, one thread can successfully publish the new slot and pause before resetting admitted. Other threads then see that new slot and increment the previous slot's count; the first thread's reset erases those reservations, allowing more than the configured budget in the same time slice. This violates the intended shared cap. Make slot rollover and reservation atomic as one state transition (or serialize rollover/reservation), and add a deterministic concurrent rollover test.

  2. Required AGC validation evidence is missing for this head. The PR is labeled perf, but it has no matched main/change summary lines or attached traces for this carry. It also reports no GPU testing, while the repository requires the same focused validation-layer tests on main and the change using the same machine and GPU for AGC changes. The linked measurements belong to the older #9012 head and do not validate this SHA. Add the required matched records, traces and digest, plus the specified focused GPU results; otherwise remove the perf claim/title and provide the required AGC validation before merge.

Non-blocking

  • #9012 remains open at its older head and is marked conflicting with main; clarify whether this carry supersedes it and the intended landing order.

Sources

Not verified

No local build, C++ tests, GPU test, game qualification, Windows or macOS run was performed. Hosted Windows was pending; Linux and specialized jobs were skipped. The precheck's ABI and test-quality helpers were unavailable in the isolated PR snapshot. The author-reported Linux tests were read from the PR description and were not rerun here.

To get this to a good state

Fix the shared-budget rollover race and add a concurrent regression test. Attach the matched performance and AGC validation evidence required above. On the new head, I will rerun the precheck, diff check, stack check, and review the updated implementation and test; hosted checks and GPU evidence should be refreshed for that SHA.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5729837040 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14838#pullrequestreview-5729837040). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-01T19:24:17Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested The exact head has a concurrency race in its shared audit budget, and the required AGC performance evidence is missing for this carry. ## What I ran Reviewed head `645b7272a8c8099c775b19bba3f569252abaad2a` against PR base `f2d874c1fdccf781c0fa5d86619bb5dd8894b958`. The merge preview against current `main` (`e0caf1360035286bd22b9f2a3030e97b880ffb28`) is clean. Linux x86_64, Debian 12, Python 3.11.2, Git 2.39.5; no C++ build or compiler run. Commands and inspections performed: ```sh git diff --check f2d874c1fdccf781c0fa5d86619bb5dd8894b958...645b7272a8c8099c775b19bba3f569252abaad2a python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14838 python3 tools/pr_stack_check.py 14838 --repo boykopovar/AnyPS5 gh pr checks 14838 --repo boykopovar/AnyPS5 gh pr view 14838 --repo boykopovar/AnyPS5 --json headRefOid,body,reviews,statusCheckRollup gh pr view 9012 --repo boykopovar/AnyPS5 --json number,state,headRefOid,baseRefName,mergeable,url # Read all seven changed files and the relevant contribution rules. ``` ## Results | Check | Result | Note | |---|---|---| | Diff whitespace | passed | No whitespace errors | | Conventions and template | passed | Hosted and local check passed | | Stack and merge preview | passed | Clean against current `main` | | ABI and test-quality helpers | failed | Helpers are absent from the PR snapshot | | Hosted Windows build | not run | Still pending | | Hosted Linux and specialized jobs | not run | Skipped by workflow | | C++ tests and GPU validation | not run | No local build or GPU run | <details><summary>Commands and unedited output</summary> `git diff --check ...` produced no output and exited successfully. The precheck report recorded: ```text Head unchanged at completion: True Base unchanged at completion: True diff_check: passed conventions_and_pr_template: passed live_dependency_and_mergeability_check: passed changed_export_abi_audit: failed — tools/pr_abi_audit.py is absent from the PR snapshot test_quality_heuristics: failed — tools/pr_test_quality.py is absent from the PR snapshot build_and_compile: not_applicable — precheck does not build or compile build_dependent_cpp_tests: not_applicable — exact-head binaries require a build ``` Hosted checks at review time: ```text conventions pass eligibility pass intake pass labels pass library-portability pass report pass windows pending linux skipping register-context skipping relinker skipping relinker-asan skipping write-watch skipping ``` </details> ## Negative control Not run. I did not mutate the implementation or disable generation advancement to test whether the added tests detect the budget race. ## Findings ### Blocking 1. **The global 4 ms audit budget can be exceeded under contention.** In `ImportAuditAdmitted`, one thread can successfully publish the new `slot` and pause before resetting `admitted`. Other threads then see that new slot and increment the previous slot's count; the first thread's reset erases those reservations, allowing more than the configured budget in the same time slice. This violates the intended shared cap. Make slot rollover and reservation atomic as one state transition (or serialize rollover/reservation), and add a deterministic concurrent rollover test. 2. **Required AGC validation evidence is missing for this head.** The PR is labeled `perf`, but it has no matched main/change summary lines or attached traces for this carry. It also reports no GPU testing, while the repository requires the same focused validation-layer tests on `main` and the change using the same machine and GPU for AGC changes. The linked measurements belong to the older #9012 head and do not validate this SHA. Add the required matched records, traces and digest, plus the specified focused GPU results; otherwise remove the `perf` claim/title and provide the required AGC validation before merge. ### Non-blocking - #9012 remains open at its older head and is marked conflicting with `main`; clarify whether this carry supersedes it and the intended landing order. ## Sources - [Budget admission implementation at this head](https://github.com/boykopovar/AnyPS5/blob/645b7272a8c8099c775b19bba3f569252abaad2a/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp#L3126-L3141) - [Repository performance and AGC validation requirements at the reviewed base](https://github.com/boykopovar/AnyPS5/blob/f2d874c1fdccf781c0fa5d86619bb5dd8894b958/CONTRIBUTING.md#L72-L73) ## Not verified No local build, C++ tests, GPU test, game qualification, Windows or macOS run was performed. Hosted Windows was pending; Linux and specialized jobs were skipped. The precheck's ABI and test-quality helpers were unavailable in the isolated PR snapshot. The author-reported Linux tests were read from the PR description and were not rerun here. ## To get this to a good state Fix the shared-budget rollover race and add a concurrent regression test. Attach the matched performance and AGC validation evidence required above. On the new head, I will rerun the precheck, diff check, stack check, and review the updated implementation and test; hosted checks and GPU evidence should be refreshed for that SHA.
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!14838
No description provided.