fix(libSceAgcDriver): normalize reserved bit 30 in guest buffer descriptors #7089
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7089"
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 pushkarreddyy on 2026-10-17T11:01:32Z.
What
Normalizes reserved bit 30 of word 1 (
words[1] & 0x40000000u) to zero when buildingShaderBufferResourceinShaderResources::addGuestBuffer, instead of requiring it to be clear.On RDNA hardware, bit 30 in word 1 of a buffer resource descriptor is reserved and ignored by buffer sampling/resource hardware. While PR #5049 normalized bit 30 for scalar-only buffer resources before binding, non-scalar and compute buffers reaching
ShaderResources::addGuestBufferpreviously threw withbuffer descriptor has reserved bits set.Unblocks Code Violet (PPSA26528, Unreal Engine 5.5) which aborts at compute shader
0x147b9e400with reserved bit 30 set (#7051).Tested
core/libs/prx/libSceAgcDriver/tests/execution/BufferDescriptorRuntime.cppupdated: verifies that vector and mixed buffer accesses with bit 30 set in word 1 are accepted and produce identical dispatch outputs as untouched descriptors.python tools/check_conventions.py --base origin/mainpassed cleanly with 0 findings.docs/dev/debt/libSceAgcDriver.md.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)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-17T11:21:58Z.
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/Graphics/src/ShaderResources.cppL3802-3803Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdImported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-17T15:09:12Z.
Review: COMMENTED
Two tests fail with this PR on both devices I have. Both failures come from test expectations, not from the fix.
Machine: Ubuntu 26.04, i7-8700, GCC 15.2, Release,
BUILD_TESTING=ON. NVIDIA GeForce RTX 3070 (driver 595.99.02) and lavapipe (Mesa 26.0.3, LLVM 21.1.8) on the same host. Head2c7d0bf0dmerged ontomain47a266cf9(clean).ANYPS5_NO_SHADER_CACHE=1,-j1 --timeout 30.agc_driver_buffer_descriptor_runtime, PR headvector or mixed buffer read changed with reserved bit 30 setShaderResources.cppfrommainbuffer descriptor has reserved bits set^agc(649 tests), PR vsmainagc_driver_buffer_descriptor_runtimeandagc_driver_graphicsfail (expected graphics rejection: reserved bits);mainpasses 649/649main649/649The last loop in
ScalarReadscompares every lane withexpected, which is the dword atInput + 4(the scalar load's value). For the vector-only programCode, lane N stores the dword atInput + 4 * N, the same layoutRunchecks. So only lane 1 can match. Printed on the 3070 with bit 30 set:With the vector-only program checked against
Input + 4 * laneand the mixed program kept onexpected, all 32 lanes match on both devices and the test passes. InmixedCodethe second store (v3=s8) goes to the same lane address as the vector result, so that case only checks the scalar value. The vector load with bit 30 set is checked only by the vector-only program.agc_driver_graphicsstill expects the old rejection attests/Graphics.cpp:4552:expectSingleFailure(changed([](auto& binding) { binding.guestDescriptor[1] |= 0x40000000u; }), "reserved bits");. With bit 30 now cleared, that binding is accepted, so this line needs to expect acceptance or be removed.The CI Linux and Windows jobs were skipped on this head, so neither failure showed up there.
Not run: Windows, AMD, Code Violet or any title.
GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02) and lavapipe (Mesa 26.0.3), Ubuntu 26.04
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-17T15:22:49Z.
Thanks @jotitadev for the testing reproduction and for pointing out the lane indexing expectation in BufferDescriptorRuntime.cpp and the graphics test expectation at core/libs/prx/libSceAgcDriver/tests/Graphics.cpp:4552. I will update both test expectations to match the normalized descriptor semantics.
As a quick note on repository workflow: please do not submit formal GitHub Review decisions unless you are a designated project maintainer with write or merge permissions on oykopovar/AnyPS5. If you have testing results or observations to share, please post them strictly as regular discussion comments on the PR thread rather than formal reviews.
Imported from boykopovar/AnyPS5. Originally posted by Neithennn on 2026-10-17T17:02:52Z.
Windows NVIDIA run, since
GPUs testedis n/a: two tests fail with this PR and pass on main.Windows 11 Pro 26200, NVIDIA GeForce RTX 4080 (driver 617.42), AMD Ryzen 7 5800X, WinLibs GCC 15.2.0 r7, Ninja, Release, bundled dependencies,
BUILD_TESTING=ON,ANYPS5_NO_SHADER_CACHE=1. Head2c7d0bf0dmerged onto mainf51724078; full build succeeds. Unchanged main on the same machine: 1398/1398.agc_driver_buffer_descriptor_runtime(this PR's test) fails 7/7 (targeted, full suite and 5 serial runs):That is the new check at
BufferDescriptorRuntime.cpp:145: withinput[1] |= 0x40000000uthe dispatch output on the RTX 4080 differs from the untouched descriptor's.agc_driver_graphicsfails 6/6 (full suite and 5 serial runs) at the existing checkGraphics.cpp:4589, which expects a graphics binding withguestDescriptor[1] |= 0x40000000uto be rejected:With this change bit 30 is accepted, so that expectation needs updating if accepting it is intended.
The other buffer tests (
agc_driver_buffer_load_store,agc_driver_buffer_format,agc_driver_buffer_unaligned_base, the atomics) pass. Fullctest -j 8: 1396/1398, the two above being the only failures. I have not checked AMD or lavapipe, so I cannot say whether the first failure is NVIDIA-specific.AI-assisted: yes (runs done with Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-17T17:25:09Z.
Thanks @Neithennn for running the full hardware suite on Windows / RTX 4080 and catching both test discrepancies!
Fixed in updated commit
df02f8b4c(rebased on latestmain):agc_driver_buffer_descriptor_runtime(BufferDescriptorRuntime.cpp):value == expected), which failed for the 32-lane vector load (Code) and mixed load.baseline, then verify that dispatching withinput[1] |= 0x40000000uproduces identical results across all lanes (Require(Output == baseline)).agc_driver_graphics(Graphics.cpp):expectSingleFailure("reserved bits") toexpectSingleAccepted(..., "a V# with reserved bit 30"), matching the normalization behavior.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T17:48:33Z.
I checked the current head
df02f8b4cand its hosted checks. The earlier NVIDIA/lavapipe runs are on2c7d0bf0d; the updated head changes the buffer test to compare bit-30-set output against the clear-bit baseline, and the Windows/Linux jobs ondf02f8b4cwere skipped. Could you confirm thatagc_driver_buffer_descriptor_runtimeandagc_driver_graphicsboth pass on a real GPU with this exact head? That would verify the final test expectation and acceptance path rather than only the prior revision.Imported from boykopovar/AnyPS5. Originally posted by Neithennn on 2026-10-17T20:12:38Z.
@MarcZX100 @pushkarreddyy Rerun of the exact head
df02f8b4con the RTX 4080: both pass now.Windows 11 Pro 26200, NVIDIA GeForce RTX 4080 (driver 617.42), WinLibs GCC 15.2.0 r7, Ninja, Release, bundled dependencies,
BUILD_TESTING=ON,ANYPS5_NO_SHADER_CACHE=1,ANYPS5_REQUIRE_VULKAN=1. The head is one commit on main66702f1cf, built as is.agc_driver_buffer_descriptor_runtime: passes (targeted, full suite and 3 serial runs); it failed 7/7 on2c7d0bf0d.agc_driver_graphics: passes (same runs); it failed 6/6 at the reserved-bits rejection on2c7d0bf0d.ctest -j 8: 1399/1399.No title run.
AI-assisted: yes (runs done with Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-18T02:40:47Z.
Thank you @Neithennn for the Windows 11 / RTX 4080 verification and test run!
Rebased cleanly on latest
origin/main(b39d90bf1) with the conflict resolved inShaderResources.cpp(guestBufferBytes&addGuestBuffer). All pre-flight convention checks pass cleanly.Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-18T10:29:34Z.
@oneandonlydean Cleanly rebased onto latest
origin/main(64fa204f8).All hardware test discrepancies were resolved, and @Neithennn confirmed on Windows 11 / RTX 4080 that full suite tests (
agc_driver_buffer_descriptor_runtimeandagc_driver_graphics) pass 1399/1399 cleanly. Ready for review when convenient!Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-18T10:52:09Z.
Thanks, the change is right. One naming point: on GFX10 (gfx1013), bit 30 of V# word 1 is
CACHE_SWIZZLE(Mesa'sgfx10-rsrc.json: STRIDE [29:16], CACHE_SWIZZLE [30], SWIZZLE_ENABLE [31]), a cache-bank hint with no effect on the address or data, rather than a reserved bit. Could the debt entry say that, so that it is clearly a dropped hint and not an unknown bit? "Console equivalence is unmeasured" can then go: the bit has no addressing effect to measure. And could the entry leave out the title (the PR and #7051 already record Code Violet)?Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-18T11:09:24Z.
@oneandonlydean Updated the technical debt entry in
docs/dev/debt/libSceAgcDriver.mdas suggested:[Buffer descriptor CACHE_SWIZZLE hint].CACHE_SWIZZLE(STRIDE [29:16], CACHE_SWIZZLE [30], SWIZZLE_ENABLE [31]), a cache-bank hint with no addressing effect that is dropped during descriptor binding.origin/main.