r/AskProgramming • • Aug 26 '26

How much does struct alignment really matter performance wise on modern GPUs?

Are things like std430 or std140 unnecessarily strict?

6 Upvotes

10 comments sorted by

View all comments

4

u/esaule Aug 27 '26

On every architecture, memory layout is about the most important thing for performance. About every performance issue boils down to memory layout and movements.

1

u/SimplySomeDude Aug 27 '26

right, but do 30% VRAM (and therefore less PcIE usage and less cache cluttering) savings outweigh the caching drawbacks

3

u/esaule Aug 27 '26

As always, it will depend on the precise application, on the access partern, spatial and temporal reuse distance.

But it will absolutelly matter.

2

u/TheThiefMaster Aug 27 '26

Sounds like time to profile it and find out

1

u/flatfinger Aug 27 '26

No layout is likely to be optimal for every possible access pattern. It's possible for layout X to be more than 50% faster than layout Y for some access patterns, while layout Y would be more than 50% faster than layout X for some other access patterns.