Skip to content

perf(agc): build check failure messages only when a check fails - #444

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
oneandonlydean:perf/agc-lazy-check-messages
Oct 3, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
oneandonlydean:perf/agc-lazy-check-messages

Conversation

@oneandonlydean

Copy link
Copy Markdown
Collaborator

What

The message argument of Require is built before the call, so a check written as Require(ok, "... " + std::to_string(x)) formats its message (a to_string and one or more concatenations, so heap allocations) on every call, even when the check passes. Several of these sit on per-draw and per-descriptor paths:

  • DecodeSamplerResource: mip filter and anisotropy ratio
  • ShaderResources::buildPrepare and addImageBinding: descriptor role and kind
  • readFloat (State.cpp): non-finite register
  • StorageFormatFor, findFormatEntry: storage and guest texture format
  • TextureDetiler::pipeline and Dispatch: swizzle equation and detiling window

Each one now tests the condition first and calls Require(false, ...) with the same message on the failing branch only, the form State.cpp already uses. Messages and behaviour are unchanged.

I left BdaResources::markWrittenPages alone because #390 rewrites the message on that line; I can do it after #390 lands.

Tested

  • Linux (CachyOS, x86-64): full build with BUILD_TESTING=ON and ctest pass. The failing branches keep their existing coverage: agc_driver_graphics_tests checks the sampler messages ("unknown anisotropy ratio", "unknown mip filter"), the descriptor role and kind messages, and TextureFormat.cpp the "unsupported guest texture format" message.
  • PPSA21564: found while profiling the title's submission thread, where allocation was a visible share of the time; on my integration branch through repeated passes of my visual regression check (checkpoint frames, flicker, shimmer, video tearing, FPS). I did not measure this change on its own.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes

Require takes its reason as a std::string, so a check whose message is
built with std::to_string and concatenation formatted that message on
every call, even when the check passed. The checks on per-draw and
per-descriptor paths (sampler and texture format decoding, descriptor
binding roles, storage formats, detiling, float registers) now build
their message only on the failing branch. Behaviour is unchanged.
@github-actions github-actions Bot added the agc libSceAgc* label Oct 3, 2026
@oneandonlydean
oneandonlydean merged commit b6673c7 into boykopovar:main Oct 3, 2026
3 checks passed
@oneandonlydean
oneandonlydean deleted the perf/agc-lazy-check-messages branch October 3, 2026 22:35
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