Repository navigation
perf(shader): record a specialized buffer atomic's fault without the address tables - #4911
Merged
oneandonlydean merged 1 commit intoOct 13, 2026
Conversation
9 tasks done
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
|
…address tables A program with an atomic on a V# it specializes was compiled as address-based (usesDma) so that the atomic's unaligned-address check could call the fault function. The atomic itself goes through the element's storage buffer and nothing in such a program reads the address tables. In the driver an address-based build leases all registered guest memory and binds every V# of the program in place inside a host import, so none of its elements is staged in device memory, the atomic one included. The atomic now asks for the fault buffer alone (usesFaultBuffer) and records the fault through RecordBdaFaultWords, which has both forms. The fault record, the stop of the invocation and the atomic are unchanged. The 64-bit fault address needs shaderInt64, as the scalar buffer load does. A tessellation-control program with such an atomic is refused as before. Test: agc_shader_memory compiles a buffer_atomic_inc on a specialized V# and requires no address table binding, one fault buffer, one call of the fault function, logical addressing and the atomic element flag; without shaderInt64 the program is refused.
oneandonlydean
force-pushed
the
up4/atomic-buffer-fault-only
branch
from
October 13, 2026 05:30
281572f to
dbe16fb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A program with an atomic on a V# it specializes is compiled as address-based: since 7431e5a
TakeGpuDescriptorsetsusesDmafor it, so that the atomic's unaligned-address check can call the fault function. The atomic itself goes through the element's storage buffer, and nothing in such a program reads the address tables.Being address-based costs in the driver. The build leases all registered guest memory (
AcquireRegistered), and a V# inside it is served by the leased range and bound in place inside a host import. None of the program's elements reaches the staging decision inUploadPrepare: not the atomic element, and not a read and written element the dispatch sweeps (#2681). In one title's particle update a 20-byte atomic counter kept a 10 MiB pool in place, every load a PCIe round trip.The fault function has had a form without the tables since #759 (
usesFaultBuffer). Now:TakeGpuDescriptorsetsusesFaultBufferinstead ofusesDmafor an atomic on a specialized V#;EmitRuntimeBufferAtomicrecords the fault throughRecordBdaFaultWords, which has both forms, and stops the invocation as before;shaderInt64, checked as inEmitRuntimeScalarBufferLoad;ValidateBdaTarget.The fault record (reason, address, bytes, pc), the atomic and the in-bounds checks are unchanged. A program that is address-based for another reason is compiled as before. No driver change: a program with a fault buffer and no tables already takes the descriptor path.
Tested
Linux (CachyOS, kernel 7.2, GCC 16.2, RTX 4090, NVIDIA 610.57.04), Release,
BUILD_TESTING=ON, onmain2a55cfe.agc_shader_memory, new caseverifySpecializedBufferAtomicBindings: abuffer_atomic_incon a specialized V# must give no address table binding, one fault buffer, one call ofrecord_bda_fault, logical addressing and the element's atomic flag; withoutshaderInt64the program is refused. Onmainit fails withspecialized buffer atomic: a buffer_atomic_inc through a V# the program specializes binds the address tables.ctest -R "agc|shader": 456 of 456 onmainand on this branch.python3 tools/check_conventions.py --base origin/mainpasses.main, no skipped draws.mainyet (it stops at a storage image over a depth surface, feat(libSceAgcDriver): storage image access to depth surfaces #4500). Measured on a local tree,main682ef0c plus the pull requests the title needed that day, with and without this change, runs alternated, caches warm:The per-program times are from
APS5_PROFILE_GPU=1(one run each side); the scene numbers fromAPS5_PROFILE_DRAW=1. Other work ran on the machine between and during some runs; a sixth run without the change was dropped for that. The checked frames of the title, menu and level look the same and get the same reference scores with and without the change.Not tested:
APS5_TRACE_FRAMES: the 3D title does not run onmain, and the local tree is older than the trace.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)