Repository navigation
feat(shader): implement compute LDS beyond the device's shared memory limit - #1776
Conversation
|
Linux results on two real GPUs with different shared-memory limits, since this was tested on Windows and lavapipe. Everything passes here, including the new Nobara 44 (Linux 7.2), GCC 16.2.1, Release,
CPU tests ( |
|
Linux run on AMD, since the description lists it as not tested: Ubuntu 24.04.5 (kernel 6.8), GCC 13.3, Release, AMD Radeon RX 7600 (RADV NAVI33, Mesa 25.2.8). This PR's head |
adriadam10
left a comment
There was a problem hiding this comment.
Thanks for the work and the Linux/AMD/NVIDIA runs. This one doesn't build on current main:
core/shader/recompiler/ShaderDiskCache.cpp:69:static_assert(sizeof(RecompileResult) == 296 ...)fails because of the newRecompileResult::workgroupMemoryDwords(Recompiler.hpp). Rebase onmain, update the asserted size, and say in the PR whetherEncodeResult/DecodeResultneed the field (it is derived fromShaderInfo::sharedMemoryBytesinmaterializeResult, so a decoded result probably needs it set too, otherwise a decoded result binds no set 1).- Please rerun the Windows job after the rebase:
agc_validate_programaborted with0xc0000409. It doesn't touch LDS, so it may be a flake, but it has to be green. - Please run the full
ctestafter the rebase and put the newagc_driver_lds_beyond_device_limittime in Tested (a cold-pipeline run on lavapipe counts against the 120 s CI timeout).
Once it builds and is green, the rest looks fine to me.
5cad357 to
6025bb3
Compare
… limit Route oversized compute LDS through a per-workgroup storage buffer. Retain native shared memory for programs that fit the device limit. Carry the spill stride through prepared shader results and dispatches. Preserve the stride in the full-result codec and its round-trip fixture. Keep the Linux RecompileResult size guard aligned with the added field. Exercise interleaved workgroups and the device-limit boundary. This topic contains only the LDS change and its reviewer-requested repair. The base includes upstream's separately merged NaN result correction.
Co-Authored-By: Claude <noreply@anthropic.com>
6025bb3 to
60251f9
Compare
adriadam10
left a comment
There was a problem hiding this comment.
Checked on RADV and lavapipe: the PR merged onto current main, AGC/AgcDriver ctest 338/338, including agc_driver_lds_beyond_device_limit and agc_shader_disk_cache. With the device-memory LDS selection forced off the new test fails, so it pins the change. Consecutive dispatches sharing the buffer are ordered by the pre-dispatch barrier. Thanks to @fisherjoey and @johnmaia for the NVIDIA and AMD runs.
Pushed on top, docs only:
docs/dev/TechnicalDebt.md: a Functional line for the storage-buffer LDS (not measured on hardware, slower than shared memory, indirect group counts read on the CPU).docs/dev/ARCHITECTURE.md: a bullet under the shader pipeline for descriptor set 1 and the per-workgroup slice.
Merging once CI is green.
What
A compute shader whose LDS exceeds the host's shared-memory limit could produce an oversized Vulkan
Workgrouparray. This moves the whole LDS, including its atomic lock dword, into a coherent storage buffer with a separate slice for each workgroup. Programs that fit keep using shared memory.The driver sizes and binds that buffer from the dispatch dimensions, rejects ranges above
maxStorageBufferRange, and reads indirect dimensions on the CPU for spilled programs. LDS barriers and atomics use the corresponding storage-buffer memory semantics.Full-result serialization preserves
workgroupMemoryDwords, with a nonzero round-trip fixture and a 312-byte LinuxRecompileResultassertion. Production disk entries already persistShaderInfo::sharedMemoryBytes, from which the stride is reconstructed; the disk format is unchanged.Tested
Windows 11/MinGW-w64 GCC 15.2.0 and Linux GCC 13.3, based on
main256b8ed: configure-DBUILD_TESTING=ON, full build,libsand registration pass. Tested merge:b5b072c8.EINVAL; this coverage remains missing.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)