Repository navigation
Support using shared memory to store registers for faster evaluation - #515
Open
LukeP0WERS wants to merge 1 commit into
Open
LukeP0WERS wants to merge 1 commit into
LukeP0WERS wants to merge 1 commit into
Conversation
Contributor
Author
|
This addresses the idea I talked about way back in #243, so I can close that separately once this goes through. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Shared memory is a common optimization used to store moderate amounts of data for shaders that is faster to write and load than spilling to local memory. It is significantly faster (3-4 cycles) than loading from the L1 and L2 caches (10-20 and 100-200 cycles respectively), not quite the speed of static registers (1 cycle) but its close. In fidgets case, switching to these improved performance massively, however only
16KiBis guaranteed to be supported by all devices (and for devices that support more it starts to introduce tradeoffs to performance due to lowering occupancy). This means only some of the shader variants can support shared memory registers:REG_COUNTI tested every model and every model that fit within the window benefited from using it. Each of these measurements came from the median of 3 runs:
REG_COUNTI was also curious whether I could squeeze out any additional perf by automatically increasing the shared memory limit to whatever the users device supported. Doing so actually worsened performance for some passes. Prospero took 127.6% longer with shared float eval, but that might have been a worse case scenario. Some of the 3D passes saw 5-10% further improvement, so that feature will come with tradeoffs that need to be documented, and I can make a follow up PR to add that later on. For now this is an improvement across the board, at least on the RTX 4070 Laptop I tested this with.