Skip to content

test(agc): leave the host GPU driver's own allocations out of the draw allocation census on macOS - #1895

Open
Thimo188 wants to merge 1 commit into
mainfrom
upstream-pr/28060
Open

Thimo188 wants to merge 1 commit into
mainfrom
upstream-pr/28060

Conversation

@Thimo188

@Thimo188 Thimo188 commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

Imported from boykopovar/AnyPS5#28060, originally opened by kevinfavv.

Source commit: 608f27d27a4be235844b151b379377965c28da69. The import branch preserves this fetched upstream PR snapshot. The description and validation below are copied from upstream; no new code changes or test runs were made for this import. Original reviews, discussions, and attachments remain at the linked upstream PR.


What

Replaces boykopovar#25615, closed by the open PR limit and which GitHub does not let me reopen: same change, rebased on current main and retested.

On macOS the draw allocation census replaces operator new for the whole process, so it also counts the allocations of Apple's Metal driver, which MoltenVK loads into the process and which allocates through operator new. The compute dispatch shape then exceeds its ceiling on every Apple silicon run, in all three tests:

draw allocations [compute dispatch]: 12 allocations made on every draw, counted per call site
  site AGXMetalG17X+0x46b046: 1.000 per draw, 32.0 bytes per draw
  site AGXMetalG17X+0x486858: 1.000 per draw, 536.0 bytes per draw
  site AGXMetalG17X+0x4867a1: 1.000 per draw, 536.0 bytes per draw
AGC graphics: draw allocations [compute dispatch]: call sites allocate 12 times on every warmed draw, more than the 10 this shape makes

(_draw_pipeline and _plan_verify: 15 against 13.) These three sites are in the host GPU driver, not in the AGC driver, and nothing the AGC driver does can remove them.

This leaves the call sites in a host GPU driver image (/System/Library/Extensions/, where macOS keeps its GPU driver bundles) out of the counts, totals and bytes the ceilings are checked against, and prints what was left out:

draw allocations [compute dispatch]: not counted, made by the host GPU driver: 3.000 per draw (1104.0 bytes)
draw allocations [compute dispatch]: 9 allocations made on every draw, counted per call site

Linux and Windows are unchanged: the filter is compiled only on Apple, and Windows skips the census already.

Tested

Apple M5 Pro, macOS 26.5.1, Apple clang 21.0.0, x86_64 Release under Rosetta 2, MoltenVK and loader from Vulkan SDK 1.4.363.1, ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1. Tree: main (9f02806) + boykopovar#17425 + boykopovar#11049 + boykopovar#26739 + boykopovar#27739 (needed to build on macOS).

test main this PR
agc_driver_draw_allocations Failed (compute dispatch: 12 > 10) Passed (9)
agc_driver_draw_allocations_draw_pipeline Failed (15 > 13) Passed (12)
agc_driver_draw_allocations_plan_verify Failed (15 > 13) Passed (12)

Failed alone on main as well as in a parallel run. The other three shapes count no host driver allocation and keep their numbers (40, 42, 42).

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: Apple M5 Pro, MoltenVK (Vulkan SDK 1.4.363.1), macOS 26.5.1
  • AI-assisted: yes

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Allocation reports now exclude host GPU driver allocations from per-site and overall allocation totals, while reporting their rate separately when it meets the display threshold.
    • This keeps host-driver activity distinct from other allocation measurements in the report.

…w allocation census on macOS

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Dec 2, 2026

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Changes: Host GPU Driver Allocation Accounting

Layer / File(s) Summary
Classification and measurement
core/libs/prx/libSceAgcDriver/tests/execution/DrawAllocations.cpp
On Apple, the census classifies callers under /System/Library/Extensions/ as host GPU driver callers. It records their allocation counts and bytes separately and excludes them from ordinary site and total counts. Other platforms classify no callers this way.
Driver rate reporting
core/libs/prx/libSceAgcDriver/tests/execution/DrawAllocations.cpp
When the host GPU driver allocation rate is at least 0.05 allocations per draw, the report prints the allocation and byte rates.

Change: Other

Merge Risk: Minimal · up to 608f2

This change only adjusts a test-side allocation census so macOS system GPU driver allocations are reported separately rather than counted against draw limits. Production behavior is unaffected, and no actionable merge-blocking risk was found.

Security architecture risk: Minimal · up to 608f2

The AGC allocation test now separates allocations attributed to the macOS host GPU driver from those checked against the test’s ceilings. The change does not alter production allocation behavior or access controls.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Usage-based review receipt

  • Mode: Continue automatically
  • Reviewed files: 1
  • Waived: $0.25 (charged $0.00)
  • View usage details

Note

This review exceeded your plan’s limits and used usage-based reviews—free during trial, billed after paid activation unless disabled. Manage usage-based reviews.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c93fd7f8-ad7e-4d61-a372-abb482b7ccbc
Commits

Reviewing files that changed from the base of the PR and between 4131f51 and 608f27d.

Files selected for processing: 1

  • core/libs/prx/libSceAgcDriver/tests/execution/DrawAllocations.cpp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants