perf(shader): share the BDA byte read fallback between read sites #1043
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1043"
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-07T03:09:37Z.
What
When the probe rejects a BDA dword read (a span across ranges, an unaligned mirror), it falls back to four
get_bda_pointerbyte lookups, and each fault is recorded inline with a compare-exchange and seven stores. Both are copied into every read site, twice under wave64 on 32-lane subgroups, so PPSA26344's compute shader 0x8000196500 reaches a million SPIR-V words and 91-95 s invkCreateComputePipelines.DefineGetBdaPointerdefines, once per module, DontInlinerecord_bda_fault(reason, address, bytes, pc)andread_bda_dword_bytes[_stop][_coherent](address, pc), the existing overflow check and byte lookups of one dword returning(value, stopped). The stop variants exist only where invocations may stop, and the coherent ones only when the program has a coherent access.RecordBdaFaultemits a call. TheEmitBdaDwordReadsfallback calls the reader per extracted dword, in order, and stops onstoppedwhere invocations may stop; in a reader,StopBdaInvocationIfreturns(0, 1).Volatile, stopping or reading zero, the probe path and 8/16-bit reads are unchanged. Inlinable helpers compiled slower (186 s).RecordBdaFaultand the same spot inShaderMemory.cpp; I'll rebase whichever lands second. #639 (draft) editsDefineGetBdaPointernearby.Tested
maindc2bf2a5: configure-DBUILD_TESTING=ON, full build,--target libs,ctest:ctest --output-on-failure)VK_DRIVER_FILES): 376/376 pass;agc_driver_flat_storeis left out there because it takes several minutes on Windows llvmpipeagc_shader_memorycheck: with or without a barrier orglc, one DontInlinerecord_bda_faultand reader, one compare-exchange, no byte lookups inmain,Volatileonly in the coherent reader, 198 words per extra read (627 on main). Fails on main.agc_driver_bda_device_tests(not in ctest) gains dword and dwordx4 reads across ranges, plain and coherent, stopping and not (unmapped bytes read zero, the first fault is published); they pass on main too. NVIDIA and lavapipe, also with-DANYPS5_ENABLE_SPIRV_TOOLS=ON.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 adriadam10 on 2026-10-07T12:45:22Z.
Checked on RADV merged onto current
main: build + ctest green, the newagc_shader_memorycheck fails onmain, and the newagc_driver_bda_device_testscases give the same results with this PR's emitter and withmain's (values, unmapped bytes, first fault, stop/no-stop, coherent). No ISA semantics change, so nothing to measure on the HW oracle. Merging.