perf: PPSA21567 Crash Site, a pixel shader's GDS append serializes on NVIDIA and costs ~16 ms of GPU per frame (RTX 5090, Windows) #15560
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 TripyFox on 2026-11-03T19:00:03Z.
Title and scene
PPSA21567 (ASTRO BOT 01.019.000), Crash Site hub entered with the title argument
-lvl hub_crashsite, no input (APS5_NO_PAD_INPUT=1), standing at the spawn point. Video output 3840x2160. Presents 700-999.What is slow or what changed
One draw per frame costs about 16 ms of GPU time on an RTX 5090, about a fifth of the GPU frame. Almost all of it is the translated
ds_appendon GDS in its pixel shader: about 3,500 returningOpAtomicIAddper draw on one 32-bit word of the GDS buffer, which run one after another at about 4.4 µs each.The draw. Vertex program 0x50054fb00, pixel program 0x500550800. It is
vkCmdDraw(36, N)with N between about 1,500 and 1,900, recorded alone with no color, depth or stencil attachment and a 128x128 viewport, followed by a 16x16-group compute dispatch (0x50052a400). The pixel shader is a light/decal cluster build:ds_appendon GDS for a record index,image_atomic_swapon a 32x128 head-pointer image, and twobuffer_stores of the record.Skipping it (
APS5_SKIP_SHADER=500550800, which also drops the dependent dispatch), onmain1e658521a0, two alternating pairs, 300 presents each:GPU busy drops by about 20 ms per present. The frame time drops by only about 6 ms, because at this point the frame is not GPU-bound. Four earlier 200 s runs with
APS5_PROFILE_GPU=1 APS5_PROFILE_GPU_DRAWS=1on4f41f4c375(plus one unrelated local blend-state commit) give the same split. The draw's[gputime]key loses 16 ms, the dispatch 2 ms, and no other key grows. GPU idle time goes from about 25 to about 40 ms per present.RenderDoc 1.47 capture of one Crash Site frame on the same machine (
4f41f4c375plus the same unrelated blend-state commit), drawvkCmdDraw(36, 1523), GPU counters per event:So the fragment count is small. I then replaced the pixel shader inside the capture with edited copies of its own SPIR-V and re-timed the event, three replays each:
mainOpAtomicIAddreplaced by its operand (no atomic)Coherentremoved from the GDS bufferOpAtomicExchangereplaced by its operandOpMemoryBarrier Device AcquireReleaseafter the image atomic removedReading the GDS buffer before and after the draw: the word grows by 92,072 with the captured shader, and by 3,500 when each atomic adds 1. So 3,500 subgroup-level atomics cost about 15.5 ms, about 4.4 µs each.
The cost needs a returned value and one shared word together. Memory placement, the
Coherentdecoration and the barriers make no difference. Under RenderDoc the GDS buffer is in a host-cached system-memory type, but the same atomic on a device-local image texel is just as slow. The emitter isAppendConsumeinSpirvMemoryInstructions.cpp. It already aggregates per subgroup: one lane doesOpAtomicIAddat Device scope and the result is shuffled to the other lanes. I found no change in the shader that keeps theds_appendsemantics (contiguous indices from one counter) and avoids the serialization.Questions:
APS5_PROFILE_GPU=1 APS5_PROFILE_GPU_DRAWS=1it is the[gputime]key of fragment program 0x500550800.Summary lines
Traces
aps5-trace-1e658521a0a5-32856.json.gzand-21160(main),-15484and-10520(main +APS5_SKIP_SHADER=500550800), to be attached in a comment. All four reporttrace_dropped: the buffers of queue worker 0x0 and the draw committer filled before the window ended (nototals_full, so the summary numbers are complete). I kept the default event count, because the form asks for no otherAPS5_TRACE_*switch.Digest
main,
aps5-trace-1e658521a0a5-32856:Threads (ms per frame)
Largest slices (ms per frame, inclusive, all threads): Driver.Packet 198.6, Driver.Packet.memory_wait 152.8, Driver.WorkerWait 89.8, Driver.WorkerWait.dequeue_order 82.4, batch 72.2, Graphics.Draw 25.3, Graphics.Draw.draw_and_resource_release 19.8, Driver.Packet.prepare_memory 16.8, Driver.Packet.dispatch 13.1, Driver.Dispatch 12.3
main +
APS5_SKIP_SHADER=500550800,aps5-trace-1e658521a0a5-15484:Threads (ms per frame)
Largest slices (ms per frame, inclusive, all threads): Driver.Packet 185.5, Driver.Packet.memory_wait 150.8, Driver.WorkerWait 85.6, Driver.WorkerWait.dequeue_order 83.5, batch 52.5, Graphics.Draw 24.1, Graphics.Draw.draw_and_resource_release 18.7, Driver.Packet.dispatch 12.2, Driver.Dispatch 11.4, Driver.Packet.draw 10.3
Capture
Built with WinLibs GCC 15.2.0 (Release). The RenderDoc capture and the shader variants can be shared on request.
AI-assisted: yes (Claude Code). The runs and the capture were made on the machine named in the summary lines.