fix(agc): bind a V# of exactly the range limit within the limit #7717
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7717"
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 xXPBSXx on 2026-10-19T02:38:17Z.
What
Teardown (PPSA15246) stops with
guest buffer view exceeds descriptor range limitfrom compute shader0x1409cd300. A local print before the check inGuestBufferMemory::Descriptorshows why (lines 29-34 of the 71 lines of that run's stderr;main5d9dcc42dplus the print; lines 32 and 34 are the SIGABRT output of the same abort):The V# size is exactly
maxStorageBufferRange(0xffffffff), so the clamp that #5778 added inShaderResources::addGuestBuffer(size past the limit) does not apply. The address is 12 bytes past a 16-byte offset-alignment boundary, soDescriptorbinds from the alignment below and adds that 12 to the range (ViewBytes): 0x10000000b, one DWORD-rounded step over the limit, and it throws. The registered region behind the address is larger than the limit.The debt entry for #5778 gets one sentence on this case.
Descriptornow limits the range tomaxStorageBufferRangerounded down to a DWORD when the V# itself fits the limit. A V# larger than the limit still reaches the existing check. What the console does for an access past the bound range is not known, as for #5778.New
viewAtRangeLimitTestsbinds a V# of exactly the limit 12 bytes into a registered block, with a second V# at the block start so that the view's region begins before it and the offset alignment is 16. It fails onmainwithguest buffer view exceeds descriptor range limitand passes with the change.Tested
Windows 10 (19045), MinGW-w64, Release; the run below is from the earlier head
e74c6abb4onupstream/main43797ca8a. The current head4c615cbac4has the same source and test hunks (compared by patch id) plus two debt-only commits; it merges cleanly withmain8b426927d7andtools/check_conventions.py --base upstream/mainpasses on it. The test run was not repeated on it.ctest -R '^agc_driver_graphics$': passed (11.5 s). Without the one-line change, the same test fails withAGC graphics: guest buffer view exceeds descriptor range limit(0.66 s, run before the rebase onto43797ca8a; the test file did not change with it).tools/check_conventions.py --base upstream/main: all checks passed. The test module runs against the mock Vulkan device; no GPU was used for the PASS. The title reproduction above ran on an NVIDIA GeForce RTX 4080 SUPER (Windows 10); Teardown (PPSA15246) with this change (e74c6abb4on43797ca8a, fresh libs, no input from me, played by hand from the menu into the first area): the run's stderr (160 lines) no longer containsexceeds descriptor range limit(0 matches, counted with Python). The run then stops at line 139 withdriver failure: AGC driver: unsupported PM4 packet type: header 0x00000000 at DWORD 15 of 6369(SIGABRT, lines 139-142); that is a separate stop and not part of this change. Measured by others on earlier heads: karimibrahim07 on Windows 11 (NVIDIA GeForce RTX 3060, driver 610.88) at heade74c6abb4:agc_driver_graphicspasses 3 of 3 with the change and fails withGuestBufferMemory.cppofmain; savvaniss on Windows 11 (Intel UHD 770 and AMD Radeon RX 9070 XT) at head76012a2bf: all 21 tests pass with the change,agc_driver_graphicsfails without it on both. Linux/lavapipe not tested.Checklist
main; no open PR implements the same functions (related: #5778 merged, #3202 closed).mdfiles or images addedAI-assisted (Claude Code).
🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by karimibrahim07 on 2026-10-19T03:17:30Z.
Review: COMMENTED
Windows run of head
e74c6abb4, merged ontomainccbd40240together with #7669, #7670, #7709 and #7680 (each merge clean, built once). Windows 11 Pro (26300), Ryzen 5 3600, NVIDIA GeForce RTX 3060 (driver 610.88), WinLibs GCC 15.2.0 r7, Ninja Release.agc_driver_graphicswithviewAtRangeLimitTestspasses,--repeat until-fail:3.main'sGuestBufferMemory.cppit fails withAGC graphics: guest buffer view exceeds descriptor range limit, as in your description.Code:
ViewBytes(bytes, adjustment)adds the offset adjustment to the view, so a V# of exactlymaxStorageBufferRangeat an address offminStorageBufferOffsetAlignmentalways ended up past the limit and threw. Capping it at the limit rounded down to a DWORD fixes that. The cap only applies whenbytes <= maxStorageBufferRange, so a V# over the limit still goes through the existing allocation-end and placeholder handling.One wording point for the debt line: the cap applies to any V# whose size plus its adjustment passes the limit, not only one of exactly the limit. A V# a few bytes under the limit at an unaligned address also loses its last bytes. Something like "a V# within its offset adjustment of the limit" would describe what the code does. The test covers the exact-limit case, which is the Teardown one.
Not checked: a title. I don't have Teardown.
AI-assisted: yes. I ran the build, the test and the negative control above.
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-19T04:52:43Z.
Thanks for the Windows run and the negative control. You are right that the cap applies to any V# whose size plus its offset adjustment passes the limit, not only to one of exactly the limit. The debt line now says "a V# within its offset adjustment of the limit (for example exactly the limit)" (76012a2bf, documentation only; the code and the test are unchanged from 72abbb5bc, on which
agc_driver_graphicspassed on Windows 10, RTX 4080 SUPER).AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by savvaniss on 2026-10-19T09:34:33Z.
Intel and AMD Windows data: with this PR's test changes,
agc_driver_graphicsfails onmainand passes with the PR, on an Intel UHD 770 and an AMD RX 9070 XT.Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, every execution test built,
ANYPS5_NO_SHADER_CACHE=1, serial CTest. Intel UHD Graphics 770 (8086:a780), driver 32.0.101.7088. AMD Radeon RX 9070 XT (1002:7550), driver 32.0.31041.1004, withVkCacheemptied first. This head76012a2bfmerged intomain6b8228b2b. "Without" means only this PR's diff totests/Graphics.cpp, applied tomain6b8228b2b.tests/Graphics.cppagc_driver_graphicsfails:guest buffer view exceeds descriptor range limit; the other 20 passAI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-21T11:14:00Z.
Title data point for this PR (data only).
Title: PPSA15246, 300 s per run through the runner, Windows 10 Pro 10.0.19045, WinLibs GCC 15.2.0, Release, relinker and all libs built from one tree. Baseline:
upstream/main50efb5c405. With the PR: the samemainwith4c615cbac4merged (a local merge, not pushed). TheSelected GPUline of each.outnames the card.NVIDIA GeForce RTX 4080 SUPER (
ANYPS5_GPU=4080,vendor=0x10de):compute shader 0x1409cd300: AGC graphics: guest buffer view exceeds descriptor range limit, then SIGABRT.AGC driver: unsupported PM4 packet type: header 0x00000000 at DWORD 15 of 6369(lines 146 and 162), which this PR does not touch.AMD Radeon RX 6400 (
ANYPS5_GPU="RX 6400",vendor=0x1002, 4 GiB card, device-local heap 3227 MiB in the log):compute shader 0x1409cd300: AGC graphics: vkAllocateMemory buffer: allocation=5435817984 ... Vulkan result -13. On this card the PR changes nothing for this title.One run per card and state. I did not look at the picture, and I did not run the PR's test on this machine for this comment.
Not run: other GPUs, other titles, the console.
AI-assisted (Claude Code).