feat(agc): count why a recorded draw builds no recipe #11452
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11452"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by johandavidcm on 2026-10-26T14:08:09Z.
What
A recorded draw builds a
DrawRecipeonly when nine conditions hold at once (recordPreparedDraw, the block before*recipeOut = ...): the driver asked for one, recipes are on, the build is cacheable, the draw did not wait, it is not indirect, its resources are reusable, no read-only buffer moved, the targets are not multisampled and the pipeline does not reorder samples;prepareDrawalso withdraws the request for stencil replay, quad lists and proxied targets. The[recipe] drawline counts the hits and the lookups that found no recipe, but nothing says which condition kept the recipe from being built. In Yakuza 0 Director's Cut (PPSA31327) the draw cache finds an entry for 47,000 of 388,000 draws per 10 s, those lookups reportno recipe49,000 times, and 2 recipes are built.DrawRecipeSkip(Draw.hpp) names the outcome:built, or the first condition that failed, in the order the code tests them;prepareDrawkeeps the reason it withdrew the request (PreparedDraw::recipeRefusal) sorecordreports stencil replay, quad list or proxied target instead of a bareno output.[draws]line printsrecipes built N, not built because:with the non-zero reasons of the 10 s window;Graphics::DrawRecipeSkips()returns the cumulative counts for the test.In PPSA31327 (Kamurocho gameplay,
APS5_PROFILE_DRAW=1,APS5_DRAW_PIPELINE=1 APS5_DRAW_INPUTS_IN_PLACE=1) the[draws]line now ends with, per 10 s:Of the 390,000 draws, 318,000 had no draw-cache entry (the driver asks for no recipe), 446 were not cacheable, and 80,000 were refused only because a read-only buffer of the cached template had moved (
MovedReadOnlyBuffers), which is the whole population the draw cache found (51,000 hits per 10 s plus the fresh entries). Every other condition held. A recipe that carries the moved bindings, or aDrawWithRecipethat re-resolves them as the template-hit path does, would let those draws replay.Tested
Windows 11 Pro 26200, WinLibs GCC 15.2.0, Release,
BUILD_TESTING=ON, head6ef198b47onmainf616a1397.New test
agc_driver_draw_recipe_skips(tests/execution/DrawRecipeSkips.cpp): three draws through aRecorder, readingDrawRecipeSkips()around each: a draw into a resident tiled color target with a recipe output builds a recipe (built), the same draw without the output builds none (no output), and a draw into a four-sample target with the output builds none (multisampled).built(the counted value replaced by the constant), it fails witha draw without a recipe output was not counted once as 'no output': built 1.--repeat until-fail:20.Pass with the change:
agc_driver_draw_cache_reuseand its_draw_pipeline,_entry_verify,_inline,_offand_verifyvariants,agc_driver_sample_orderand its_grid_reference,_planningand_recipe_depth_locationsvariants,agc_driver_graphics,agc_driver_address_passes,agc_driver_address_passes_targets_split,agc_driver_multisampled_pass_order.With
ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(VK_LOADER_DEBUG=layershowing the layer inserted),ctest -R <those tests> -Vpasses onmainf616a1397(14 of 14) and on this head (15 of 15, with the new test); both logs show the layer inserted, neither containswas not found but was requested by env var VK_INSTANCE_LAYERS, and neither contains aVUID-line (0 onmain, 0 on the head).PPSA31327 01.015.000, one profile run (
APS5_PROFILE_DRAW=1, scripted boot through the first dialogue, gameplay in Kamurocho) onmain9f386f3a2+ #8098 + #11361 + this commit (the profile predates the rebase; the counter's code is unchanged) for the line above; the last three 10 s reports agree within 3 %.Not a performance change; no A/B pairs.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)DrawProfilefields and[draws]line; whichever lands second rebases)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T14:11:12Z.
Review: CHANGES_REQUESTED
This changes AGC draw/pass accounting, so CONTRIBUTING requires the focused Vulkan suite on current main and the change with the same GPU, using ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, then confirming no missing-layer message or new VUIDs. The report currently compares against
3ead2d7251, while current main is51f5c57dd9; the PR is based on that older commit and also edits the shared AGC debt file. Please sync to current main, rerun the focused suite against current main and the rebased head, and update the report before final review. The declared dependency on #11361 is noted.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T15:24:36Z.
Review: CHANGES_REQUESTED
I reviewed exact head
6ef198b47311b5b41bb338e18e53e6c1994e071eand the additional validation report. The report now supplies the required same-GPU focused Vulkan comparison for this head and its stated base: it lists the required environment, confirms the validation layer loaded, and reports no missing-layer message orVUID-output. I withdraw the earlier request for more detail about that run. I found no implementation defect in the recipe-skip counter or regression test.The remaining blocker is the declared dependency on #11361. That PR is still open, and the pairwise merge preview shows a content conflict in
Graphics/src/Draw.cpp. The current base used for the reported tests isf616a1397f9b, while currentmainisb0f1183ca12b. As you noted, please resolve the shared-counter order after #11361 lands, sync to current main, and rerun the focused suite on both that main and the resulting head before approval.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-14T07:24:18Z.
Review: APPROVED
Reviewed — looks good
Nothing in the reviewed changes blocks merging; the reported test and profile results are author supplied, and I did not run checks.
What I ran
Reviewed head
7af977b7557c342c9716d300a022d47c96ec0e30. No commands or tests were run. Readdescription.md,commits.md,manifest.json,diff.patch, and all three changed files listed as reviewed in the manifest.files.jsonwas not available through the reader; the file listing showed all three changed files included. No excluded changed files were identified.Results
Negative control
Not run by this reviewer. The description reports that replacing the counted value with a constant makes the new test fail; this was not independently confirmed.
Findings
Blocking
None.
Non-blocking
None.
Not verified
I did not run the build, tests, negative control, Vulkan validation, or console profile. I did not independently confirm the author reported outputs or inspect excluded files; the reader listing showed no excluded changed files.
To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-29T23:35:13Z.
Review: COMMENTED
Actionable comments posted: 1
e312444d-2502-4ee7-be0d-8642fa603a00Reviewing files that changed from the base of the PR and between
26463cf742andebd2750116.core/libs/prx/libSceAgcDriver/Graphics/include/Draw.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/tests/execution/DrawRecipeSkips.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-29T23:44:55Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head
ebd27501160c2969f4ff65eb4215be880d449995. No commands or tests were run; the description reports its own test results.Results
Findings
Blocking
None.
Non-blocking
DrawRecipeSkip::MovedBuffersis declared but never selected: the classifier maps!resources->Reusable()toNotReusable(core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp:4845). Consider removing the unused category or distinguishing moved-buffer refusals so the breakdown matches the enum and description.Not verified
No tests were run. The reported Windows/Vulkan test results and PPSA31327 profile were not independently verified. Read:
Draw.hpp,Draw.cpp,DrawRecipeSkips.cpp, and targeted ranges ofShaderResources.hppandShaderResources.cpp. No changed files were excluded;files.jsonwas not available in the review folder, so exclusions could not be independently checked.To get this to a good state
Nothing is required. Optionally, make the
MovedBufferscategory reachable or remove it.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.