fix(agc): bind a buffer descriptor past the range limit by its committed bytes, or empty #3202
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3202"
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 CnRJay on 2026-10-11T00:59:41Z.
What
A buffer V# whose size (
num_records * stride) is pastmaxStorageBufferRangeaborted the whole dispatch withshader buffer exceeds descriptor range limit. PPSA28416 (STAR WARS: Galactic Racer) reaches this with V# words read from memory that holds no descriptor (one had base0x55268c155511, size0x1c9523763d77); the shader never touches the buffer on the path it takes, so on hardware nothing happens.The descriptor is now bound by what is behind it:
A descriptor inside the limit is unchanged. The two
descriptor range limitrejections inGraphics.cppare gone, since that case no longer throws; the new test covers it.Tested
Windows 11, WinLibs GCC 15.2.0, Release, RTX 4080.
agc_driver_graphics(oversizedDescriptorTestsinGraphics.cpp): a V# of 256 GiB over 64 KiB of committed guest-arena memory is bound at the mock limit (16 KiB); the same V# over uncommitted memory is bound as the placeholder (EmptyBufferBytes). Without the change it fails withshader buffer exceeds descriptor range limit.main).Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by Silverash-i8 on 2026-10-11T01:57:28Z.
Windows run, since the PR has no Intel or Windows results yet: Windows 11, WinLibs GCC 15.2.0 r7, Release, merged onto
maind31b57a4in one build with #3217, #3202, #3167, #3137, #2863, #2849 and #2847, on an RTX 5060 Laptop and the Arrow Lake iGPU (ANYPS5_GPU=Intel).agc_driver_graphics(Graphics.cpp) passes on both GPUs.Full
ctestof that build on both GPUs has no failure that isn't also on plainmainhere (guest_filesystemneeds the symlink privilege, #3169; the Intel ones are listed on #2114 and #3207).AI-assisted (Claude Code); I ran this on my machine.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-11T05:05:45Z.
Please keep the throw when the committed run reaches the limit (
ShaderResources.cpp:2681). As it is, a descriptor over more committed memory thanmaxStorageBufferRangeis cut there and the shader reads 0 from mapped memory; the test binds 16 KiB of 64 KiB committed. Cutting at the end of a committed run shorter than the limit, and the empty binding, are fine.oversizedDescriptorTestsis_WIN32only, so with the twodescriptor range limitrejections removed the Linux job checks none of this. Please make it run there too.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T07:06:04Z.
Review: CHANGES_REQUESTED
Thanks. Findings:
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp:1899:oversizedDescriptorTestsis wrapped in#ifdef _WIN32, so on Linux it runs nothing, and the two Linux-runningexpectSingleFailure(... "descriptor range limit")rows are deleted. Net result: no Linux coverage of this path, and the negative check can't fail there. Please make the test run on Linux too (e.g. a guest-arena-independent way to get committed/uncommitted memory, ormmap/VirtualAllocthrough the same helper other tests in this file use), or keep a Linux-valid case.ShaderResources.cpp:2674-2682: this binds a plausible but unverified result wheremainthrew. The "accesses past it read 0 and drop stores" semantics have no cited source (hardware measurement or reference). Please state the source in the PR and add a TechnicalDebt line under "Unknown function info" (not at the end of the section) for the cut-at-committed-end and empty-placeholder choices.ShaderResources.cpp:2681: onlycommitted.back().secondis used, so gaps between committed runs inside the range stay bound as if valid. Say whether that is intended, or cut at the first gap.ShaderRegistry.cpp:62already computes a committed extent withCommittedRanges; please reuse/share that rule instead of a second copy.Imported from boykopovar/AnyPS5. Originally posted by Mouhand-Kaddo on 2026-10-11T07:54:21Z.
Additional platform validation of standalone PR head
fe8660fd372dc56272e2ec31be2fce385295cac9(2026-10-11):Linux: passed — Arch Linux in WSL2 (kernel 6.6.87.2), GCC 16.2.1 20260810; CMake 4.3.1 / Ninja; Release,
BUILD_TESTING=ON.1 checks, 0 failures, 0 CTest skips. Built the selected targets and dependencies; this is focused validation, not a full build or full-suite run.
Checks:
agc_driver_graphics.Command after building:
ctest --test-dir <build> --verbose --no-tests=error --timeout 30 -R "^agc_driver_graphics$".This scope checks CPU-side behavior; no GPU execution result is claimed.
Internal limitation: heap-mirror subcases returned early because the guest arena was not write-watched in WSL. Zero CTest skips does not include that early return.
The new oversizedDescriptorTests fixture is guarded by _WIN32, so this Linux run checks the shared-source build and existing graphics cases; it does not execute the new over-limit descriptor regression. That Linux regression gap remains as noted by the maintainer.
No title/gameplay validation. These results cover the standalone head, not a merge with current main.
Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-11T10:10:01Z.
Tested on High on Life (PPSA15388 v01.120.000, Unreal Engine 4): this fixes its stop when loading a level. On my tree, loading the first level of a new game aborted with:
The PR's commit cherry-picks cleanly. With it, that load goes through, and the abort hasn't come back in any run since. The
agc_*tests have only the failures my tree had before.Details
Setup: CachyOS (Linux 7.2), RTX 4090 (NVIDIA 615.78), GCC, Release.
mainf5c0fe00plus my local integration patches and ports of #423/#1077, #425, #454 and #2904.Tested and written by Claude (AI assistant) on a contributor's machine.
Imported from boykopovar/AnyPS5. Originally posted by jweidenh on 2026-10-11T19:38:27Z.
I prepared a tested correction for the outstanding review points in this PR: patch on my fork.
The correction keeps
shader buffer exceeds descriptor range limitwhen the accessible prefix reaches the device limit. A shorter prefix stops at the first inaccessible page, or the first non-writable page for a writable binding; an inaccessible base uses the empty binding.ReadRawShaderand descriptor binding now shareGuestMemory::CommittedPrefixBytes. The unverified console behavior is recorded under Unknown function info in TechnicalDebt.The tests now run on both Windows and Linux. They cover exact-limit acceptance, oversized rejection with committed memory at/beyond the limit, short prefixes, inaccessible and read-only gaps, and empty bindings. The reported V# base/size is checked as descriptor metadata; the runtime empty-binding case uses the same stride/record count at an unaligned address inside an owned reservation.
A real Vulkan compute test also reads the bound SSBO length and two exact uint32 values from the valid prefix. It uses a reduced 192 KiB context limit over a bounded mapping; it does not allocate a device-limit-sized buffer or perform out-of-bounds shader accesses.
Validation used current main
a11c8f7f70a0ed4e71504a89de69e8cdae687817plus this PR's unchangedfe8660fd372dc56272e2ec31be2fce385295cac9, with identical tests before and after the correction:The three regressions are
agc_oversized_descriptor_limit,agc_oversized_descriptor_gap, andagc_oversized_descriptor_readback. Controls areagc_driver_graphicsandagc_shader_memory. Every test finished below 30 seconds. The corrected native RTX 5090 readback took 2.74 seconds. Linux's graphics control could not check heap mirrors or heap mirrors of imported ranges because the guest arena was unavailable or not write-watched; all new regression assertions ran on both platforms. Linux validation built the patchedlibstarget too, on a locally managed self-hosted runner.Test-only baseline:
b60b1f8447951d969477fec90871e5b0c2296f04. Corrected source:7ff3781b5b04b4b7ed035e6ec4a4548febf7ec60.To apply both commits, first rebase this PR onto main
a11c8f7f70a0ed4e71504a89de69e8cdae687817, then cherry-pickb60b1f8447951d969477fec90871e5b0c2296f04followed by7ff3781b5b04b4b7ed035e6ec4a4548febf7ec60. I verified that sequence produces the tested tree. Direct application to the older PR head has context conflicts in the test files.This is focused validation, not a full-suite or retail-title run. I do not have either affected title, and have not measured console behavior, game startup time or FPS. AI-assisted.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T10:38:42Z.
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.
main)core/libs/prx/libSceAgcDriver/tests/Graphics.cppL3Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-13T21:01:57Z.
High on Life (PPSA15388) still needs this on current
main(18c438b10), and there is no replacement for it. Walking through the home base aborts with:This PR's commit (
fe8660fd3) still cherry-picks cleanly, and with it the title runs on. @CnRJay, is a resubmission planned? @jweidenh's correction above kept the refusal for prefixes that reach the device limit. If neither of you plans to carry it, I can open it again with that correction.Tested and written by Claude (AI assistant) on a contributor's machine.
Pull request closed