perf(shader): share the BDA dword span read between read sites #1267
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1267"
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 Celegans12 on 2026-10-07T20:34:09Z.
What
Every BDA dword read site still emits, in the entry function, the first-address add with its overflow fault, a
probe_bda_pointercall, the wide loads and oneread_bda_dword_bytescall per extracted dword. On NVIDIA every call left in the entry function costs compile time (one call doubles it), and PPSA26344's 0x8000196500 family has 911 of them, 47-77 s per pipeline in game.read_bda_span[_stop][_coherent](address, offset, extracted, pc), DontInline and defined once per module, which does the same steps in the same order: first-address add and fault, span probe, wide loads of the extracted dwords, or per dword the address, overflow check and byte reader.(values, stopped)and the caller stops; continue targets keep the non-stop variant.Volatile, the stop behaviour andAPS5_BDA_BYTE_READS=1are unchanged. SourceVersion follows the sources; the cache format is unchanged.DefineGetBdaPointerandSpirvBda.hppnearby and merge cleanly; #639 (draft) edits the BDA write path. #1265 puts the BDA byte stores into shared functions and conflicts next to each new declaration and definition (both are kept); #1227 changesRunBdaExecutionTestsnext to the new test helper inBdaShader.hpp.Tested
mainc5e10184: configure-DBUILD_TESTING=ON, full build,--target libs,ctest:ctest --output-on-failure)VK_DRIVER_FILES): 395/395 pass;agc_driver_flat_storeis left out there because it takes several minutes on Windows llvmpipeagc_shader_memory: oneread_bda_span*call per site. Fails on main.agc_driver_bda_span_reads(byte path);agc_driver_bda_device_testscases (not part of ctest).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 Celegans12 on 2026-10-07T20:54:16Z.
The Windows failure here is
guest_raise_exception(libkernel) timing out on its second repeat: it passed the first repeat in 7.3 s, then hit the 30 s timeout on the next. This PR only changes the shader recompiler's BDA read emission, so it looks like a flaky timeout; a re-run of the windows job should clear it.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-08T10:39:16Z.
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/shader/recompiler/SpirvBackend/src/SpirvBdaRead.cppL328-347core/libs/prx/libSceAgcDriver/tests/BdaShader.cppL9, L69core/libs/prx/libSceAgcDriver/tests/BdaShader.hppL9core/shader/recompiler/SpirvBackend/src/SpirvBdaRead.cppL289-290Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-08T17:49:36Z.
Linux results, since this was tested on Windows only. Everything passes here, including
agc_shader_memoryand the newagc_driver_bda_span_reads.Nobara 44 (Linux 7.2), GCC 16.2.1, Release,
BUILD_TESTING=ON. This PR merged ontomain29e533ac.main29e533acmain+ this PRctest -R agc_driver -j1-E agc_driver)The one CPU failure is
guest_dynamic_loader(subprocess aborted), and it fails the same way onmain. I didn't measure GPU time.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-09T22:43:38Z.
Checked the new
read_bda_span*against the inline sequence it replaces (first-address add and overflow fault, span probe, wide loads, per-dword byte reader, stop variant, coherence mask): same steps and order. Built merged onto currentmain: ctest 551/551, includingagc_shader_memory(fails without the change) andagc_driver_bda_span_reads. Linux/NVIDIA/RADV results from @fisherjoey also line up; merging.Note for #2259 and #2305: both conflict with this PR in
SpirvBdaRead.cpp/BdaShader.cpp, they will need to rebase on top of it (the wide load path now lives inread_bda_span).