Repository navigation
fix(shader): emit nothing for a vertex s_barrier that precedes every memory access - #6613
Conversation
|
Some 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.
|
70395f1 to
1ce582e
Compare
|
AMD on Windows: the tests this PR names pass on an RDNA 3.5 GPU. Radeon 860M (RDNA 3.5, driver 32.0.13058.8001), Windows 11 26300, WinLibs GCC 15.2.0 r7, Release.
AI-assisted |
|
Thanks @LeandroLP23 for the AMD run on Windows. I added it to the description. AI-assisted: yes (Claude Code) |
…memory access A vertex-path program with LDS, GDS or memory writes refused any s_barrier. NGG passthrough programs start with the s_barrier that orders GS_ALLOC_REQ, before any memory access, and some write buffers later. A barrier that runs before every load, store, atomic, image or LDS access of the program has nothing to order, so it emits no instruction, like the barrier of a program without memory access. Barriers after a memory access still throw. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1ce582e to
7092dde
Compare
|
Rebased onto AI-assisted: yes (Claude Code) |
|
Checked the entry-block walk (entry has no predecessors, any branch/merge stops it, memory-access set covers const, LDS, buffer, address and image ops), the new tests (fail on main without the change; the LDS-before-barrier case still throws) and the TechnicalDebt line. Merging through the queue. |
What
A vertex-path program that touches LDS or GDS or writes memory refuses any
s_barrier:NGG passthrough programs (
VGT_SHADER_STAGES_ENPRIMGEN_EN + PRIMGEN_PASSTHRU_EN) start with thes_barrierthat ordersGS_ALLOC_REQ. Crimson Desert (PPSA25286) registers one, routing0x2402000, 2133 instructions. Its only barrier is at pc 0x20, after a few scalar instructions, and it writes a buffer about 7 KB later (buffer_atomic_addat 0x1e78, then threebuffer_store_dwordx4). Its registration preparation fails with the line above, and the draw that uses it rethrows it.A barrier that runs before every memory access of the program has nothing to order: no load, store, atomic, image or LDS access can happen before it in any wave. Such a barrier now emits nothing, the same as the barrier of a program with no memory access. The check walks the entry block and its straight-line successors. A barrier behind a memory access, a branch or a merge still throws.
Tested
Linux (Ubuntu 24.04, GCC 13.3, Release), RTX 4070 Ti, NVIDIA 595.99.
agc_vertex_barrier: a vertex program withs_barrierbefore ads_write_b32, and one with a scalar instruction ahead of the barrier, compile without anOpControlBarrier. The existing case with the LDS write before the barrier is still refused. Withmain'sSpirvFlowEmitter.cppthe new cases fail with the refusal above. 3 of 3 runs pass.^agc_vertex_barrier|^agc_driver_(ngg|vertex|mesh|graphics|prepared|tessellation)): 30 of 30 pass.Crimson Desert (PPSA25286) with #6612, which gets it past its first stop:
main5d9dcc4 + #6612main5d9dcc4 + #6612 + this PRValidated on Windows 11 with an AMD Radeon 860M (RDNA 3.5, driver 32.0.13058.8001) by @LeandroLP23 (comment), in one build of
main6efb726 with this head and 13 other pull requests:agc_vertex_barrierpasses 3 runs of 3. 713 of 716agc_*tests pass; the 3 that fail fail the same way onmainthere.Not checked on Intel or on a console.
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)🤖 Generated with Claude Code