Add floats to storage buffers with the GPU's own atomic add instead of a compare-and-swap loop #2336
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot#2336
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?
The idea
Compute programs that run every frame in Kakariko and on Death Mountain Trail add floats to storage buffers, and the shader translator makes each of those adds a compare-and-swap loop. On an RTX 4090 the busiest of them takes 77 to 80 attempts per add on average. With the GPU's own float add (
VK_EXT_shader_atomic_float,shaderBufferFloat32AtomicAdd) the frame's GPU time there is 0.4 to 0.6 ms lower, about 7%.GPUs that can add floats atomically should do it in one instruction; the others keep the loop.
Anything else
docs/workflow.md: S3 (1), a small frame-rate gain x reach (GPUs whose driver offers the feature; measured on NVIDIA only) x confidence 1.0 for the RTX 4090.main, with no code copied from it.This is being done in your pull request #2306; closing the issue so the work is tracked in one place there.