Skip to content

feat(agc): implement deferred faults for descriptors read through null SRT pointers - #1292

Merged
adriadam10 merged 2 commits into
boykopovar:mainfrom
Celegans12:feat/agc-draw-null-srt
Oct 9, 2026
Merged

adriadam10 merged 2 commits into
boykopovar:mainfrom
Celegans12:feat/agc-draw-null-srt

Conversation

@Celegans12

@Celegans12 Celegans12 commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

What

Stacked on #759; please review the last commit only.

A capture evaluates every V#, T# and S# a shader uses, even behind a branch the wave won't take. If one is loaded through a null or unmapped pointer read from memory, the capture throws (null or misaligned address, guest memory is not readable), while the console only faults when a wave runs that s_load. #759 covers only flat SRT reads.

Tested

  • Windows 11, MinGW-w64 GCC 15.2.0, based on main 1be6f9f with feat(agc): implement deferred faults for reads through null SRT pointers #759: configure -DBUILD_TESTING=ON, full build, --target libs, ctest:
  • 486/486 tests pass (ctest --output-on-failure)
  • Same build on lavapipe (Mesa 26.2.4 llvmpipe, 8-wide subgroups, VK_DRIVER_FILES): 485/485 pass; agc_driver_flat_store is left out there because it takes several minutes on Windows llvmpipe
  • agc_driver_guarded_null_pointer: a V# loaded through a pointer behind an SCC branch reads its payload when mapped, faults at the s_load's pc and address when null or unmapped and taken, and doesn't fault when skipped; a zero V# from memory and a zeroed one share one pipeline variant.
  • agc_shader_memory: a compute V# through a null or unmapped pointer and a vertex V# through a null one get four records and zero words, with the variant, specialization and module of a zero V# from memory. Both tests fail on feat(agc): implement deferred faults for reads through null SRT pointers #759 alone.
  • PPSA26344 v1.008, before perf(agc): baseline shader recompilation on registration #639: two 2,700 s runs had no such draw skips (13,213 without it). Not run again.
  • Not tested: graphics-stage execution on a GPU, console behaviour.

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: feat(agc): implement deferred faults for reads through null SRT pointers #759
  • AI-assisted: yes

@github-actions github-actions Bot added build shader core/shader docs agc libSceAgc* labels Oct 8, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 8, 2026
@Celegans12
Celegans12 force-pushed the feat/agc-draw-null-srt branch from 660e18d to 7380808 Compare October 8, 2026 14:52
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Oct 8, 2026
Capturing a shader threw "null or misaligned address" when the flat
SRT walk read through a pointer loaded from memory that is null or
unmapped, even when the program skips that s_load. Such a read now
yields zero and a record with its pc and address, as does a slot whose
address needs it. The registered artifact checks one flag word per
guarded slot at each ReadConst; the capture appends the flags and the
records to the flattened SRT, and a set flag raises an Unmapped BDA
fault through the fault buffer and stops the invocation as a BDA read
does. Nothing per capture enters a key: poisoned and clean captures
share one variant and specialization. Descriptors, branch conditions,
uniform fills, table bases and user-data pointers that need such a
value still throw, and poisoned results stay out of the dispatch and
draw caches. The shader disk cache format becomes 21.
…l SRT pointers

Capturing a shader evaluates every V#, T# and S# the program uses,
including those behind a branch the wave does not take. When such a
descriptor was loaded through a pointer read from memory that is null
or unmapped, the capture threw "guest memory is not readable", while
the console faults only if a wave executes that s_load. The descriptor
now reads as zero words, and the flat SRT walk records the s_load's
dwords as it does for flat reads, so their guarded ReadConst raises
the BDA fault where the wave runs the s_load. A zero V# is an absent
buffer and a zero T# binds a null descriptor, as for any zero word
read from memory, so nothing new enters a key. A zeroed descriptor
whose read no flat slot records still throws, as do branch conditions,
uniform fills, table bases and user-data pointers.
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked on a build merged onto current main: full ctest green (552/552); agc_shader_memory and agc_driver_guarded_null_pointer fail with the change reverted; CI green on this head. TechnicalDebt lines match the new behaviour. Merging.

@adriadam10
adriadam10 merged commit c9d4261 into boykopovar:main Oct 9, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build docs shader core/shader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants